<?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-7716996258329599145</id><updated>2012-02-16T16:41:56.693-08:00</updated><category term='Mood'/><category term='Grails'/><category term='XML'/><category term='docbook'/><category term='Gria'/><category term='python'/><category term='Groovy'/><category term='oracle'/><title type='text'>Grails,Groovy,GIRA</title><subtitle type='html'>def x=&amp;#39;Coding by convention&amp;#39;
if(x){
  x.each{code-&amp;gt;
code.less
code.elegant
print ${more performance}
print ${more holiday}
 
}
}</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-4344691093355574297</id><published>2008-10-30T01:57:00.000-07:00</published><updated>2008-10-30T02:10:41.253-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>Division operator in Groovy</title><content type='html'>Groovy similar to Ruby fairly,in groovy language all of thing is object,that means you have to operate an object by invocation its method.For example 123.abs() will return the absolute value of this integer.Groovy support Integer and Floating point numeric.Indeed,Groovy implement every operator as a method,for example "+" implement as plus:123.plus(456) means 123+456the return value is 578,it's a integer,then on the other hand,for  division operator,when you type and run 5/2 the result is 2.5,it's floating point numeric;now how about 6/2,what the result,I think the result is 3,an integer numeric,but I'm wrong,indeed all of the result of  division operator is a floating point,even if the result look like an integer.so the result of 6/2 is 3.0,it's a floating point numeric.&lt;br /&gt;And if you want to obtain an integer you should invoke the method intdiv:6.intdiv(2) then the result is an integer:3&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-4344691093355574297?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/4344691093355574297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=4344691093355574297' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4344691093355574297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4344691093355574297'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/10/division-operator-in-groovy.html' title='Division operator in Groovy'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7493688147819848710</id><published>2008-09-19T11:42:00.001-07:00</published><updated>2008-09-19T11:48:31.673-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>An ant example for how to Validate XML</title><content type='html'>&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:root xmlns:tns=&amp;quot;http://www.example.org/Simple&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;&lt;br /&gt;xsi:schemaLocation=&amp;quot;http://www.example.org/Simple Simple.xsd &amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;This is an user test&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:user role=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:name&amp;gt;tnsname1&amp;lt;/tns:name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:age&amp;gt;18&amp;lt;/tns:age&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:gender&amp;gt;Male&amp;lt;/tns:gender&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:password&amp;gt;sfds3555&amp;lt;/tns:password&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:title/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:user&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:user role=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:name&amp;gt;tnsname1&amp;lt;/tns:name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:age&amp;gt;18&amp;lt;/tns:age&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:gender&amp;gt;Male&amp;lt;/tns:gender&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:password&amp;gt;sfds3555&amp;lt;/tns:password&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:title/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:user&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:cost&amp;gt;0.22&amp;lt;/tns:cost&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:cost&amp;gt;0&amp;lt;/tns:cost&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:root&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7493688147819848710?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7493688147819848710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7493688147819848710' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7493688147819848710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7493688147819848710'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/ant-example-for-how-to-validate-xml.html' title='An ant example for how to Validate XML'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-4080585309977332623</id><published>2008-09-19T11:42:00.000-07:00</published><updated>2008-09-19T11:46:51.049-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='docbook'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>A XSD Schema file for example.</title><content type='html'>&amp;lt;xs:schema xmlns:xs=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;br /&gt;&lt;br /&gt;targetNamespace=&amp;quot;http://www.example.org/Simple&amp;quot; xmlns:tns=&amp;quot;http://www.example.org/Simple&amp;quot;&lt;br /&gt;&lt;br /&gt;elementFormDefault=&amp;quot;qualified&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:complexType name=&amp;quot;user&amp;quot; mixed=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:sequence&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;name&amp;quot; type=&amp;quot;xs:string&amp;quot; default=&amp;quot;Eric001&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;age&amp;quot; type=&amp;quot;tns:age&amp;quot; default=&amp;quot;30&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;gender&amp;quot; type=&amp;quot;tns:gender&amp;quot; default=&amp;quot;Male&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;password&amp;quot; type=&amp;quot;tns:password&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:any maxOccurs=&amp;quot;unbounded&amp;quot;&amp;gt;&amp;lt;/xs:any&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:sequence&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:attribute name=&amp;quot;role&amp;quot; type=&amp;quot;xs:string&amp;quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:complexType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:simpleType name=&amp;quot;gender&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:restriction base=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:enumeration value=&amp;quot;Male&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:enumeration value=&amp;quot;Female&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:restriction&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:simpleType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:simpleType name=&amp;quot;age&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:restriction base=&amp;quot;xs:integer&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:minInclusive value=&amp;quot;1&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:maxInclusive value=&amp;quot;120&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:restriction&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:simpleType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:simpleType name=&amp;quot;letter&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:restriction base=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:pattern value=&amp;quot;[A-Za-z0-9]&amp;quot;&amp;gt;&amp;lt;/xs:pattern&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:restriction&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:simpleType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:simpleType name=&amp;quot;password&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:restriction base=&amp;quot;xs:string&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:pattern value=&amp;quot;(([0-9]+[a-zA-Z]+)|([a-zA-Z]+[0-9]+))&amp;quot;&amp;gt;&amp;lt;/xs:pattern&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:minLength value=&amp;quot;5&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:maxLength value=&amp;quot;8&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:restriction&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:simpleType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:simpleType name=&amp;quot;amount&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:restriction base=&amp;quot;xs:decimal&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:totalDigits value=&amp;quot;2&amp;quot;&amp;gt;&amp;lt;/xs:totalDigits&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:restriction&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:simpleType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;root&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:complexType mixed=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:sequence&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:any maxOccurs=&amp;quot;unbounded&amp;quot;&amp;gt;&amp;lt;/xs:any&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:sequence&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:complexType&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:element&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;user&amp;quot; type=&amp;quot;tns:user&amp;quot; &amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:element&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;cost&amp;quot; type=&amp;quot;tns:amount&amp;quot; /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;xs:element name=&amp;quot;title&amp;quot;&amp;gt;&amp;lt;/xs:element&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/xs:schema&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;p/&gt;&lt;br /&gt;Following is the XML file:&lt;br /&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:root xmlns:tns=&amp;quot;http://www.example.org/Simple&amp;quot; xmlns:xsi=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;br /&gt;&lt;br /&gt;xsi:schemaLocation=&amp;quot;http://www.example.org/Simple Simple.xsd &amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;This is an user test&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:user role=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:name&amp;gt;tnsname1&amp;lt;/tns:name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:age&amp;gt;18&amp;lt;/tns:age&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:gender&amp;gt;Male&amp;lt;/tns:gender&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:password&amp;gt;sfds3555&amp;lt;/tns:password&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:title/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:user&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:user role=&amp;quot;admin&amp;quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:name&amp;gt;tnsname1&amp;lt;/tns:name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:age&amp;gt;18&amp;lt;/tns:age&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:gender&amp;gt;Male&amp;lt;/tns:gender&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:password&amp;gt;sfds3555&amp;lt;/tns:password&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:title/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:user&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:cost&amp;gt;0.22&amp;lt;/tns:cost&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;tns:cost&amp;gt;0&amp;lt;/tns:cost&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/tns:root&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-4080585309977332623?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/4080585309977332623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=4080585309977332623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4080585309977332623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4080585309977332623'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/xsd-schema-file-for-example.html' title='A XSD Schema file for example.'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-2817436895129907727</id><published>2008-09-17T22:28:00.000-07:00</published><updated>2008-09-17T22:41:31.894-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='docbook'/><title type='text'>Add bookmark on docbook PDF</title><content type='html'>In this article I'll discuss two points about docbook that generate to PDF.I use the ant to generate docbook,following is my ant file.&lt;br /&gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;&lt;br /&gt; - target:  build-pdf&lt;br /&gt;&lt;br /&gt; - description:  Iterates through a directory and transforms&lt;br /&gt;&lt;br /&gt; -     .xml files into .fo files which can then be turned into DocBook XML&lt;br /&gt;&lt;br /&gt; -     files.&lt;br /&gt;&lt;br /&gt; --&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;target name="build-pdf" depends="depends"&lt;br /&gt;&lt;br /&gt; description="Generates PDF files from DocBook XML"&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;xslt style="${fo.stylesheet}" extension=".fo"&lt;br /&gt;&lt;br /&gt;         basedir="${basedir}/src" destdir="${target.dir}/fo"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;classpath refid="xalan.classpath" /&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;include name="**/*.xml" /&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;exclude name="**/*chapter*.xml"/&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/xslt&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;property name="fop.home" value="${basedir}/lib/fop-0.95"/&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;classpath&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;fileset dir="${fop.home}/lib"&amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;include name="*.jar"/&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/fileset&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;fileset dir="${fop.home}/build"&amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;include name="fop.jar" /&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/fileset&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/classpath&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/taskdef&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;fop format="application/pdf"&lt;br /&gt;&lt;br /&gt;     outdir="${target.dir}/pdf" basedir="${target.dir}/fo"&amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;fileset dir="${target.dir}/fo"&amp;gt;&lt;br /&gt;&lt;br /&gt;        &amp;lt;include name="*.fo"/&amp;gt;&lt;br /&gt;&lt;br /&gt;     &amp;lt;/fileset&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/fop&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;following is my dobook segment:&lt;/span&gt;&lt;br /&gt;&amp;lt;sect1&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;title&amp;gt;Section 1 title&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;para&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;sect2&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;title&amp;gt;section 2 title&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;para&amp;gt;&lt;br /&gt;&lt;br /&gt;     description...&lt;br /&gt;&lt;br /&gt;    &amp;lt;/para&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;sect3&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;para&amp;gt;witing something...&amp;lt;/para&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;sect3&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/sect2&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;/sect1&amp;gt;&lt;br /&gt;&lt;br /&gt;Now the question is;&lt;br /&gt;1)I want to display the label of section.&lt;br /&gt;2)I want to display the bookmark in PDF.&lt;br /&gt;&lt;br /&gt;The final solution is change the param.xml file.&lt;br /&gt;1)to display the label of section:&lt;br /&gt;change following line&lt;br /&gt;&amp;lt;xsl:param name="section.autolabel" select="0"&amp;gt;&lt;br /&gt;&lt;br /&gt;to this line&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:param name="section.autolabel" select="1"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2)to display the bookmark in PDF.&lt;br /&gt;&lt;br /&gt;change following line&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:param name="fop1.extensions" select="0"&amp;gt;&lt;br /&gt;&lt;br /&gt;to this line&lt;br /&gt;&lt;br /&gt;&amp;lt;xsl:param name="fop1.extensions" select="1"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note:don't change following line otherwise you will get an exception like:&lt;br /&gt;&lt;span style=";font-family:Courier New;font-size:85%;color:red;"   &gt;&lt;span style="background: white none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:&amp;quot;;font-size:10;color:red;"   &gt;&lt;span&gt;No element mapping definition found for (&lt;b class="highlight"&gt;Namespace&lt;/b&gt; URI: "&lt;b class="highlight"&gt;http&lt;/b&gt;://&lt;b class="highlight"&gt;xml&lt;/b&gt;.&lt;b class="highlight"&gt;apache&lt;/b&gt;.&lt;b class="highlight"&gt;org&lt;/b&gt;/&lt;b class="highlight"&gt;fop&lt;/b&gt;/&lt;b class="highlight"&gt;extensions&lt;/b&gt;", &lt;b class="highlight"&gt;Local&lt;/b&gt; &lt;b class="highlight"&gt;Name&lt;/b&gt;: "&lt;b class="highlight"&gt;destination&lt;/b&gt;")&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;lt;xsl:param name="fop.extensions" select="0"&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-2817436895129907727?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/2817436895129907727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=2817436895129907727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2817436895129907727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2817436895129907727'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/add-bookmark-on-docbook-pdf.html' title='Add bookmark on docbook PDF'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-3521719260851591661</id><published>2008-09-12T01:25:00.000-07:00</published><updated>2008-09-12T01:29:24.182-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to change the locale in Grails.</title><content type='html'>It's simple to change the locale in Grail,just need put a param after you url.A better method is put a link in your template file,and include it in every your page,then write following code:&lt;br /&gt;&lt;br /&gt;&amp;lt;span&amp;gt;&lt;br&gt;&lt;br /&gt;     &amp;lt;g:link controller="${params.controller}" action="${params.action}" params="[lang:'en']" class="menuButton"&amp;gt;English&amp;lt;/g:link&amp;gt;&lt;br&gt;&lt;br /&gt;   &amp;lt;/span&amp;gt;&lt;br&gt;&lt;br /&gt;  &amp;lt;span&amp;gt;&lt;br&gt;&lt;br /&gt;     &amp;lt;g:link controller="${params.controller}" action="${params.action}" params="[lang:'de']" class="menuButton"&amp;gt;German&amp;lt;/g:link&amp;gt;&lt;br&gt;&lt;br /&gt;   &amp;lt;/span&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/br&gt;&lt;br /&gt;then you will have a change language in every page.or another way you can put this code in your layout.gsp file directly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-3521719260851591661?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/3521719260851591661/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=3521719260851591661' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3521719260851591661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3521719260851591661'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/how-to-change-locale-in-grails.html' title='How to change the locale in Grails.'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-5588146570913288864</id><published>2008-09-12T00:59:00.000-07:00</published><updated>2008-09-12T01:01:11.289-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Error starting Sun's native2ascii: In Grails</title><content type='html'>If you run app in Grails and get this error message and app cannot run.This happened sometimes because you want to use i18n feature in your application.&lt;br /&gt;Then try this method:&lt;br /&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;span style="color: red;"&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;Copying %Java_Home%/lib/tools.jar to &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt; %Java_Home%&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;/jre/lib/ext/tools.jar fixed this problem.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;(a better approach is to set up JRE path to the directory JDK&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 10pt;"&gt;&lt;span style="font-family: 新宋体;"&gt;&lt;span style="font-family: 宋体;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-5588146570913288864?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/5588146570913288864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=5588146570913288864' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5588146570913288864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5588146570913288864'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/error-starting-suns-native2ascii-in.html' title='Error starting Sun&apos;s native2ascii: In Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-5540911064333710075</id><published>2008-09-12T00:38:00.000-07:00</published><updated>2008-09-12T00:52:43.794-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to implement i18n message in controller</title><content type='html'>    In a Grails applicaton,actually it use spring message bundle for its i18n.let me give an example:&lt;div&gt;I have a Usercontroller and I want to display a message to our user when his user name or password is incorrectly and I want to show different language depend on the user's location.here is the code:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;           if(user){&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;session.userId=user.userId&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;def redirectParams=session.originalRequestParams?session.originalRequestParams:[controler:'race']&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;redirect(redirectParams)&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}else{    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;&lt;/div&gt;&lt;div&gt;                            //for now,it's a hard-code pattern.&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;    &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;flash['message']='Please enter a valid user id and password'&lt;/span&gt;&lt;/div&gt;&lt;div&gt;    &lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;following we should do is add something in my message.propertis file.&lt;/div&gt;&lt;div&gt;in the file:grails-app/i18n/messages.properties we added English message&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;user.invilate.message=&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;Please enter a valid user id and password&lt;/span&gt;&lt;/div&gt;&lt;div&gt;in the file:grails-app/i18n/messages_de.properties we added German message&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;user.invilate.message=&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Bitte geben Sie eine gültige Benutzer-ID und Passwort&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;then we change above code&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;flash['message']='${message(code:'user.invilate.message')}'&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-5540911064333710075?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/5540911064333710075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=5540911064333710075' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5540911064333710075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5540911064333710075'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/how-to-implement-i18n-message-in.html' title='How to implement i18n message in controller'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-8120929682348603894</id><published>2008-09-11T21:21:00.000-07:00</published><updated>2008-09-11T21:24:10.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Notes on Grails Internationalization (i18n)</title><content type='html'>Past from:&lt;a href="http://cochransoftware.blogspot.com/2008/03/notes-on-grails-internationalization.html"&gt;http://cochransoftware.blogspot.com/2008/03/notes-on-grails-internationalization.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When using Grails for web app development, it's desirable to place all text in messages.properties files. When you do this, you can easily change the text to another language, and that makes internationalization easier. You still have to deal with other issues such as date formats and currency, but at least the text is easy to modify that way.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Once you have all your properties files created, you can make change languages by passing in the lang parameter and setting it to the language of your choice. For instance, if you want to list out some values, you can call the "list" action and pass it the Spanish language as a parameter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link action="list" params="[lang:'es']"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: Once you pass this parameter to any page, your app will now be in that language until you change it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, in order to facilitate this, you need to create the necessary files and reference the properties in your code. For example, create a messages.properties file and add text such as "Search" for your home page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;home.search=Search&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, you can create a messages_es.properties that contains your Spanish translations:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;home.search=Buscar&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, once you have all the text defined in your messages.properties file(s), (one for each language you are translating to) all you then need to do is reference that particular property in your code. Grails picks that up and inserts the appropriate property for you. Here are some tips on doing that in your code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In the GSP page, if you want to reference the file in just plain text, use the g:message tag:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:message code="home.search" default="Search"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This tells Grails to find the property "home.search" in the properties file, and insert that value here. If it cannot find "home.search" in your properties file, it will insert whatever is in the default parameter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When using the sortableColumn GSP tag, use the "titleKey" parameter to set the property as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:sortableColumn property="title" titleKey="certification.title"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To set the text of a button, you can pass in a variable from the controller. I've used the flash scope to pass data back to the view, but you can use another object if you want to and return it. First, grab the value from the flash scope in the GSP page as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input type="submit" value="${flash.search}"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Next, in the controller action, just set the flash.search parameter before you return:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;flash.search = message(code: 'home.search')&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, the action in the controller will grab the message and throw it into the flash.search variable. You simply read that variable in the GSP page and it's all good. There's probably a better way of reading that parameter directly in the GSP page, and when I find it, I'll post an update.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-8120929682348603894?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/8120929682348603894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=8120929682348603894' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8120929682348603894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8120929682348603894'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/notes-on-grails-internationalization.html' title='Notes on Grails Internationalization (i18n)'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-549616112462748030</id><published>2008-09-11T02:27:00.000-07:00</published><updated>2008-09-11T02:48:15.098-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Log4j configuration in Grails</title><content type='html'>Today when I config log4j for Grails I meet an exception,"&lt;span style="font-family:Arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span&gt;&lt;b class="highlight"&gt;No&lt;/b&gt;    &lt;b class="highlight"&gt;such&lt;/b&gt; property: context for class: java.lang.String&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;" it's because of sometypo ,here is the wrong writing.&lt;br /&gt;development {&lt;br /&gt;        log4j {&lt;br /&gt;            appender.access="org.apache.log4j.ConsoleAppender"&lt;br /&gt;                appender.'access.layout'="org.apache.log4j.PatternLayout"&lt;br /&gt;                appender.access.layout.ConversionPattern==%d %p %x [%c] %m%n  //you must put the quote around "access.layout.ConversionPattern"&lt;br /&gt;                   logger&lt;br /&gt;                   {&lt;br /&gt;                    grails.'app.controller.UserController'='warn,access'&lt;br /&gt;                  }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;following statement is copy from Grails official site,it explain why we should do it like that&lt;br /&gt;A couple things to keep in mind while modifying Config.groovy:&lt;p class="paragraph"&gt;1) Unlike the flat format used by log4j, the Grails config format is hierarchical, so if you write: &lt;/p&gt;&lt;div class="code"&gt;&lt;pre&gt;grails.app.controller.YourController=&lt;span class="java-quote"&gt;"debug,stdout"&lt;/span&gt;&lt;br /&gt;grails=&lt;span class="java-quote"&gt;"info,stdout"&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; You're actually overriding the first setting with the second. To get around this you have to quote the first: &lt;div class="code"&gt;&lt;pre&gt;grails.'app.controller.YourController'=&lt;span class="java-quote"&gt;"debug,stdout"&lt;/span&gt;&lt;br /&gt;grails=&lt;span class="java-quote"&gt;"info,stdout"&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt; 2) If you're not using the 'quote' format shown above you must always define children before parents in the Config.groovy file. For example, putting a parent before a child as shown below will result in an error:&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;grails.app=&lt;span class="java-quote"&gt;"info,stdout"&lt;/span&gt;&lt;br /&gt;grails.app.controller=&lt;span class="java-quote"&gt;"debug,stdout"&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Reversing the lines will eliminate the error (but the definition of grails.app will override the definition of grails.app.controller):&lt;br /&gt;&lt;br /&gt;&lt;div class="code"&gt;&lt;pre&gt;grails.app.controller=&lt;span class="java-quote"&gt;"debug,stdout"&lt;/span&gt;&lt;br /&gt;grails.app=&lt;span class="java-quote"&gt;"info,stdout"&lt;br /&gt;&lt;br /&gt;But After I fix it,it sitll can not doesn't work.then I google again and again.finally,&lt;br /&gt;I found there are something error in default generate from Grails.&lt;br /&gt;we should change following line&lt;br /&gt;&lt;/span&gt; logger&lt;br /&gt;{&lt;br /&gt;grails.'app.controller.UserController'='warn,access'&lt;br /&gt;  }&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;instead of like this:&lt;br /&gt;logger.&lt;br /&gt;&lt;pre&gt;logger.grails.'app.controller.UserController'='warn,access'&lt;br /&gt;&lt;br /&gt;now it's work well done.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-549616112462748030?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/549616112462748030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=549616112462748030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/549616112462748030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/549616112462748030'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/log4j-configuration-in-grails.html' title='Log4j configuration in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-8012406116365756244</id><published>2008-09-11T01:08:00.000-07:00</published><updated>2008-09-11T01:09:12.173-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Deprecated constraints in Grails domain class</title><content type='html'>Following constraints has been deprecated in Grails domain class.&lt;br /&gt;length&lt;br /&gt;maxLength&lt;br /&gt;minLength&lt;br /&gt;&lt;br /&gt;instead of:&lt;br /&gt;size&lt;br /&gt;maxSize&lt;br /&gt;minSize.&lt;br /&gt;&lt;br /&gt;Just for remember&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-8012406116365756244?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/8012406116365756244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=8012406116365756244' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8012406116365756244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8012406116365756244'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/deprecated-constraints-in-grails-domain.html' title='Deprecated constraints in Grails domain class'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-2382263032407161193</id><published>2008-09-10T23:37:00.000-07:00</published><updated>2008-09-10T23:42:55.269-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Premature end of file in Grails</title><content type='html'>When I create a app and run it.I got an error message:"[Fatal Error] :-1:-1: Premature end of file." at console,even if every there is notiong happened in your application,it seems that occured in FireFox.then I google it,I found it's seems that because of how firefox process the mime types,so a alternative method is remove the line "xml: &lt;span class="error"&gt;['text/xml', 'application/xml']&lt;/span&gt;, " in Config.groovy file.but actually it's a bug of Grails.you can find some discussing about it on &lt;a href="http://jira.codehaus.org/browse/GRAILS-3088"&gt;http://jira.codehaus.org/browse/GRAILS-3088&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-2382263032407161193?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/2382263032407161193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=2382263032407161193' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2382263032407161193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2382263032407161193'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/premature-end-of-file-in-grails.html' title='Premature end of file in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-2600524478636317212</id><published>2008-09-09T02:38:00.000-07:00</published><updated>2008-09-09T02:41:52.166-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>How to define a closure by method</title><content type='html'> To declaring a closure is to reuse something that is already declared: a method. Methods have a body, optionally return values, can take parameters, and can be called. The similarities with closures are obvious, so Groovy lets you reuse the code you already have in methods, but as a closure. Referencing a method as a closure is performed using the reference.&amp;amp; operator. The&lt;div&gt;reference is used to specify which instance should be used when the closure is called, just like a normal method call to reference.someMethod().&lt;/div&gt;&lt;div&gt;for example:&lt;/div&gt;&lt;div&gt;class TestClass{&lt;/div&gt;&lt;div&gt;   hello(String name){&lt;/div&gt;&lt;div&gt;     println("Hello ${name}")&lt;/div&gt;&lt;div&gt; }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;def tc=new TestClass()&lt;/div&gt;&lt;div&gt;def testClosure=tc.&amp;amp;hello //now you obtained a new closure by class method.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-2600524478636317212?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/2600524478636317212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=2600524478636317212' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2600524478636317212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2600524478636317212'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/how-to-define-closure-by-method.html' title='How to define a closure by method'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7114234873714339492</id><published>2008-09-09T01:24:00.000-07:00</published><updated>2008-09-09T01:30:06.644-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><title type='text'>Safe dereferencing with the ?. operator</title><content type='html'>  When a reference doesn’t point to any specific object, its value is null. When calling a method or accessing a field on a null reference, a NullPointerException (NPE) is thrown. This is useful to protect code from working on undefined preconditions,but it can easily get in the way of “best effort” code that should be executed for valid references and just be silent otherwise.that is the "?." operator in Groovy.for example &lt;div&gt;def map=[x:[y:[z:1]]]&lt;/div&gt;&lt;div&gt;assert map.x.y.z==1&lt;/div&gt;&lt;div&gt;assert map.x.a==null//it'll throw an null exception ,because there isn't a "a" attribute.&lt;/div&gt;&lt;div&gt;try{&lt;/div&gt;&lt;div&gt;assert map.x.a==null&lt;/div&gt;&lt;div&gt;}catch(Exception){&lt;/div&gt;&lt;div&gt; //some code for process exception.&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;//this method is better,but it's a bit verbose.right?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;assert map.x?.a=null  //it'll be safe,the null exception will be silent.it's the best way in Groovy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7114234873714339492?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7114234873714339492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7114234873714339492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7114234873714339492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7114234873714339492'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/safe-dereferencing-with-operator.html' title='Safe dereferencing with the ?. operator'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7888090322553571051</id><published>2008-09-09T00:11:00.000-07:00</published><updated>2008-09-09T00:12:51.877-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How the Grails Link element work</title><content type='html'>&lt;div&gt;Here are some examples:&lt;/div&gt;&amp;lt;g:link action="show" id="1"&amp;gt;Book 1&amp;lt;/g:link&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link action="show" id="${currentBook.id}"&amp;gt;${currentBook.name}&amp;lt;/g:link&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link controller="book"&amp;gt;Book Home&amp;lt;/g:link&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link controller="book" action="list"&amp;gt;Book List&amp;lt;/g:link&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link url="[action:'list',controller:'book']"&amp;gt;Book List&amp;lt;/g:link&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;g:link action="list" params="[sort:'title',order:'asc',author:currentBook.author]"&amp;gt;&lt;br /&gt;&lt;br /&gt;    Book List&lt;br /&gt;&lt;br /&gt;&amp;lt;/g:link&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7888090322553571051?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7888090322553571051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7888090322553571051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7888090322553571051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7888090322553571051'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/how-grails-link-element-work.html' title='How the Grails Link element work'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-4014106288522756598</id><published>2008-09-08T22:30:00.000-07:00</published><updated>2008-09-08T22:40:32.706-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Single or double quotes</title><content type='html'>   As a developer we almost need write html code every day.today I want to talk about "quote",especial in GSP page,Grails is an amazing framework,I really like it,&lt;span class="Apple-style-span"   style="  ;font-family:Tahoma;font-size:15px;"&gt;Groovy Servers Pages (or GSP for short) is Grails' view technology. It is designed to be familiar for users of technologies such as ASP and JSP, but to be far more flexible and intuitive.To talk about quotes most of time we use double quotes but in some particular situation we should use single quote,for example,as an attribue of gsp taglib,a groovy map is allowed,so in this situation,you should use single quote for map's attribues.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Tahoma;font-size:48px;"&gt;&lt;div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Tahoma; font-size: 48px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-4014106288522756598?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/4014106288522756598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=4014106288522756598' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4014106288522756598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4014106288522756598'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/single-or-double-quotes.html' title='Single or double quotes'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-4105834462991598853</id><published>2008-09-08T00:38:00.000-07:00</published><updated>2008-09-08T00:53:03.329-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Another method for redirection in index.gsp</title><content type='html'>   In the last blog I talked about how to redirection by useing Taglib method.another simple method is config your Url maping file&lt;div&gt;grails-app/conf/UrlMappings.groovy&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;class UrlMappings {&lt;/div&gt;&lt;div&gt;    static mappings = {&lt;/div&gt;&lt;div&gt;        "/"(controller:"race",action:"search")   //this is your index action.&lt;/div&gt;&lt;div&gt;        "/$controller/$action?/$id?" {&lt;/div&gt;&lt;div&gt;            constraints {&lt;/div&gt;&lt;div&gt;                // apply constraints here&lt;/div&gt;&lt;div&gt;            }&lt;/div&gt;&lt;div&gt;        }&lt;/div&gt;&lt;div&gt;    }&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-4105834462991598853?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/4105834462991598853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=4105834462991598853' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4105834462991598853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/4105834462991598853'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/another-method-for-redirection-in.html' title='Another method for redirection in index.gsp'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-8889868784223478657</id><published>2008-09-07T23:49:00.000-07:00</published><updated>2008-09-07T23:54:18.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to redirect url from index.gsp?</title><content type='html'>   In the newly version of Grails,the index page is index.gsp but not index.jsp.you can't change the file name directly,it doesn't work.I think an alternative method is writen an TagLib.for example:&lt;div&gt;1,create a taglib file under  grails-app/taglib&lt;/div&gt;&lt;div&gt;TestTaglib&lt;/div&gt;&lt;div&gt;2,define a new tag&lt;/div&gt;&lt;div&gt;def redirectPage={ attrs-&gt;&lt;/div&gt;&lt;div&gt;  def url=attrs.get('url')&lt;/div&gt;&lt;div&gt;   response.sendRedirect("${request.contextPath}"+url)&lt;/div&gt;&lt;div&gt;}&lt;/div&gt;&lt;div&gt;3.in the index.gsp,writen like this:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;g:redirectpage url="/race/search"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-8889868784223478657?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/8889868784223478657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=8889868784223478657' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8889868784223478657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8889868784223478657'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/09/how-to-redirect-url-from-indexgsp.html' title='How to redirect url from index.gsp?'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-6307410654631063769</id><published>2008-03-19T22:53:00.000-07:00</published><updated>2008-03-19T23:26:44.339-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Test in Grails</title><content type='html'>Grails provide us simplest test framework.if you want to test your function,jutst run following command:&lt;br /&gt;&gt;&gt;grails create unit-test&lt;br /&gt;then Grails will ask you which Domain you want to test.for example type &lt;span style="font-style: italic;"&gt;project&lt;/span&gt;&lt;br /&gt;Then Grials will generate a class in directory: gwork\gira\workspace\test\integration&lt;br /&gt;Write some code like this&lt;br /&gt;class ProjectTests extends GroovyTestCase {&lt;br /&gt;&lt;br /&gt;   void testSort() {    &lt;br /&gt; &lt;br /&gt;       def sortByAttribute={property -&gt;&lt;br /&gt;         Project.findAll().sort{it."$property"}.title      &lt;br /&gt;       }&lt;br /&gt;     &lt;br /&gt;     &lt;br /&gt;       def titles=sortByAttribute("title")&lt;br /&gt;       assert titles&lt;br /&gt;       assert titles.size()==3&lt;br /&gt;       assert titles[0]=="App1"&lt;br /&gt;   }&lt;br /&gt;   void setUp(){&lt;br /&gt;      new Project(title:'App1',description:'This is a test',createDate:new Date()).save()&lt;br /&gt;       new Project(title:'App2',description:'This is a test',createDate:new Date()).save()&lt;br /&gt;       new Project(title:'App3',description:'This is a test',createDate:new Date()).save()&lt;br /&gt;   }&lt;br /&gt;   void tearDown(){&lt;br /&gt;      Project.list()*.delete()&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;Then run command:&lt;br /&gt;&gt;&gt;grails run-test&lt;br /&gt;You will get the test reult.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-6307410654631063769?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/6307410654631063769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=6307410654631063769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6307410654631063769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6307410654631063769'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/test-in-grails.html' title='Test in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-5321911726198780716</id><published>2008-03-19T02:02:00.000-07:00</published><updated>2008-03-19T02:47:17.799-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Dynamic scaffod in Grails</title><content type='html'>listed the all three command to create dynamic scaffod:&lt;br /&gt;• grails generate-views: Generates views for the specified domain class&lt;br /&gt;&lt;br /&gt;• grails generate-controller: Generates a controller for the specified domain class&lt;br /&gt;&lt;br /&gt;• grails generate-all: Generates both a controller and associated views&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-5321911726198780716?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/5321911726198780716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=5321911726198780716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5321911726198780716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5321911726198780716'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/dynamic-scaffod-in-grails.html' title='Dynamic scaffod in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-8620461818517446121</id><published>2008-03-19T01:44:00.000-07:00</published><updated>2008-03-19T01:50:50.276-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Hpw to change the default context of Grails server</title><content type='html'>Today I commit my code into google code project.As before my project named &lt;span style="font-style: italic;"&gt;sparrow&lt;/span&gt;,because &lt;span style="font-style: italic;"&gt;sparrow &lt;/span&gt;is another project's name so I can't use it now,I changed it to &lt;span style="font-style: italic;"&gt;gria&lt;/span&gt;.but when I run the command&lt;br /&gt;&gt;&gt;grails run-app&lt;br /&gt;I found the context of Grails server is still sparrow.Oh,how to change it.I found there is &lt;span style="font-style: italic;"&gt;application.properties&lt;/span&gt; file in my project directory,I edit it like this&lt;br /&gt;app.name=gria&lt;br /&gt;Then the server's context change to gria.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-8620461818517446121?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/8620461818517446121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=8620461818517446121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8620461818517446121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8620461818517446121'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/hpw-to-change-default-context-of-grails.html' title='Hpw to change the default context of Grails server'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7425012771904525939</id><published>2008-03-18T01:50:00.000-07:00</published><updated>2008-03-19T02:09:13.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>The inList conatraint  must follow blank constraint</title><content type='html'>I found an interesting thing,that is if you set the property of Grails's Domain class with a constratint--inList,like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 51, 0); font-weight: bold;"&gt;priority(inList:["High","Low"])&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;then,when you open the page to edit or create this domain,you will find that the property can't be select by a HTML select box.So,you must follow another constraint &lt;span style="font-style: italic; font-weight: bold;"&gt;blank &lt;/span&gt;and set it false.like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 51); font-weight: bold;"&gt;priority(inList:["High","Low"],blank:false)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Is it a bug?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7425012771904525939?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7425012771904525939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7425012771904525939' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7425012771904525939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7425012771904525939'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/inlist-conatraint-must-follow-blank.html' title='The inList conatraint  must follow blank constraint'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7470712479179072490</id><published>2008-03-17T20:29:00.001-07:00</published><updated>2008-03-19T02:09:13.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Constraint in Grails</title><content type='html'>Grails use constraint key word for Domain class's constraint.As a note,I summary the constraint in Grails Domain Model.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1" width="100%"&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td style="font-weight: bold;" bgcolor="blue"&gt;Name&lt;/td&gt;&lt;br /&gt;&lt;td style="font-weight: bold;" bgcolor="blue"&gt;Example&lt;/td&gt;&lt;br /&gt;&lt;td style="font-weight: bold;" bgcolor="blue"&gt;Description&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;blank&lt;/td&gt;&lt;br /&gt;&lt;td&gt;title(blank:false)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set to false if a string value cannot be blank&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;email&lt;/td&gt;&lt;br /&gt;&lt;td&gt;email(email:true)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set to true if the value must be an email address&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;inList&lt;/td&gt;&lt;br /&gt;&lt;td&gt;sex(inList:['Man','Woman'])&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Value must be contain within the given list&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;length&lt;/td&gt;&lt;br /&gt;&lt;td&gt;title(length:1..50)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Use a range value to restrict the length of string or range&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;min&lt;/td&gt;&lt;br /&gt;&lt;td&gt;age(min:new Date()&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the minimun value&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;minLength&lt;/td&gt;&lt;br /&gt;&lt;td&gt;title(minLength:5)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the minimum length of a string or array property&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;minSize&lt;/td&gt;&lt;br /&gt;&lt;td&gt;children(minSize:10)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the minimum size of a collection or number property &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;matches&lt;/td&gt;&lt;br /&gt;&lt;td&gt;name(matches:/[a-zA-Z]/)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Matches the supplied regular expression&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;max&lt;/td&gt;&lt;br /&gt;&lt;td&gt;age(max:new Date()&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the maximum value&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;maxLength&lt;/td&gt;&lt;br /&gt;&lt;td&gt;title(maxLength:5)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the maximum length of a string  or array property&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;maxSize&lt;/td&gt;&lt;br /&gt;&lt;td&gt;children(maxSize:10)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set the maximum size of a collection or number property&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;notEqual&lt;/td&gt;&lt;br /&gt;&lt;td&gt;name(notEqual:'Eric')&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Must not equal the special value&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;nullable&lt;/td&gt;&lt;br /&gt;&lt;td&gt;name&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set to false if property value cannot be null&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;range&lt;/td&gt;&lt;br /&gt;&lt;td&gt;age(range:30..60)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Must occur within the special range&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;size&lt;/td&gt;&lt;br /&gt;&lt;td&gt;children(size:5..15)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Use a range to restrict the size of a collection or number&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;unique&lt;/td&gt;&lt;br /&gt;&lt;td&gt;name(unique:true)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set to true if the property must be unique&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;url&lt;/td&gt;&lt;br /&gt;&lt;td&gt;url(url:true)&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Set to true if a string value is a url address&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7470712479179072490?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7470712479179072490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7470712479179072490' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7470712479179072490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7470712479179072490'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/constraint-in-grails.html' title='Constraint in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-3992393842622575204</id><published>2008-03-17T19:59:00.000-07:00</published><updated>2008-03-19T02:09:13.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>HQL in Grail</title><content type='html'>Today we'll discuss the HQL query in Grail.as you know,Grails's GROM is based on Hibernate.So you can use HQL to implement sql query in Grails.Grails provide three static method:find,findAll and executeQuery.Here are some demonstrate&lt;br /&gt;&lt;br /&gt;/**find method*/&lt;br /&gt;//following method will return a project object whose attribute is 'App1'&lt;br /&gt;def project=Project.find('from Project p where p.title=?',['App1'])&lt;br /&gt;/**findAll method*/&lt;br /&gt;//following method will return all of project objects.&lt;br /&gt;def projectList=Project.findAll('from Project')&lt;br /&gt;//Grails also provide a elegant  IN  operator&lt;br /&gt;def plist=Project.findAll('from Project')&lt;br /&gt;def ilist=Issue.findAll("from Issue as b where b.project in (:p)", [p:plist])&lt;br /&gt;/**executeQuery method*/&lt;br /&gt;def plist=Project.executeQuery("select distinct p.title from Project p")&lt;br /&gt;//it is possible to perform more-advanced queries using joins, aggregate functions, and subqueries.&lt;br /&gt;And also we can some limit for query result number,for example:&lt;br /&gt;&lt;pre class="code-java"&gt;def plist=Project.executeQuery("select distinct p.title from Project p",[max:10,offset:5])&lt;br /&gt;)&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-3992393842622575204?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/3992393842622575204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=3992393842622575204' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3992393842622575204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3992393842622575204'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/hql-in-grail.html' title='HQL in Grail'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-6356729531401062016</id><published>2008-03-16T22:38:00.000-07:00</published><updated>2008-12-10T07:33:03.843-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Dynamic Finders in Grails</title><content type='html'>In last section,we discussed the CRUD method in Grails.Now,we'll learn one .of the most powerfull concept of GORM (findBy* method).Following figure shown a example method.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_umxcSr0um1c/R94E2Jz31TI/AAAAAAAAAAs/ibHS0FS1b7Y/s1600-h/sparrow-finders.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_umxcSr0um1c/R94E2Jz31TI/AAAAAAAAAAs/ibHS0FS1b7Y/s320/sparrow-finders.PNG" alt="" id="BLOGGER_PHOTO_ID_5178581949915583794" border="0" /&gt;&lt;/a&gt;This figure from the book:&lt;span style="font-style: italic;"&gt;the definitive guid to grails&lt;/span&gt;.&lt;br /&gt;Now I list the available Dynamic Finder method and example:&lt;br /&gt;Expression                           Arguments   Example&lt;br /&gt;Between                                 2                   Project.findByCreateDateBetween(today-10,today)&lt;br /&gt;Equals                                    1                   Project.findByTitleEquals('App1')&lt;br /&gt;GreaterThan                         1                   Project.findByCreateDateGreaterThan(lastmonth)&lt;br /&gt;GreaterThanOrEqual          1                   Project.findByCreateDateGreaterThanOrEqual(lastmon)&lt;br /&gt;IsNull                                      1                   Project.findByTitleIsNull()&lt;br /&gt;IsNotNull                                1                   Project.findByTitleIsNotNull()&lt;br /&gt;LessThan                                1                   Project.findByCreateDateLessThan(lastmonth)&lt;br /&gt;LessThanOrEqual                1                   Project.findByCreateDateLessThanOrEqual(lastmonth)&lt;br /&gt;Like                                         1                   Project.findByTitleLike('App1%')&lt;br /&gt;NotEqual                               1                   Project.findByTitleNotEqual('App1')&lt;br /&gt;&lt;br /&gt;All of findBy* method only return that fisrt be found object.&lt;br /&gt;There are two cousins method findAllBy* and countBy*.&lt;br /&gt;findAllBy* :return a list that is matched the query logic&lt;br /&gt;countBy* :return a number that is matched result total.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-6356729531401062016?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/6356729531401062016/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=6356729531401062016' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6356729531401062016'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6356729531401062016'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/dynamic-finders-in-grails.html' title='Dynamic Finders in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_umxcSr0um1c/R94E2Jz31TI/AAAAAAAAAAs/ibHS0FS1b7Y/s72-c/sparrow-finders.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-213716021198822639</id><published>2008-03-16T20:26:00.000-07:00</published><updated>2008-03-19T02:09:58.604-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Data operator CRUD in Grails</title><content type='html'>How to implement CRUD(create,read,update,delete) in Grails.The answer is ,it's simple.Because of the Grails's GROM is based on Hibernate and we have already have the Domain class,and it's alsp maped to database table.So now,you can just simple use save(),update(),delete() method.let me demonstrate how to do these:In this section,I will use the Project and Issue Domain Object in Sparrow.&lt;br /&gt;/**Create data*/&lt;br /&gt;//create a project&lt;br /&gt;def project1=new Project(title:'Project1',description:'Hello world!',createDate:new Date())&lt;br /&gt;//now we have the project object.we will save it.&lt;br /&gt;project1.save()&lt;br /&gt;//as you can see ,we never define the method save().but we can use it,because Grails auto //generate it in runtime for us.when we call this method,the project information will be saved in database table,it's cool.&lt;br /&gt;//Now we'll define issue object&lt;br /&gt;def issue1=new Issue(summary:'Issue1',description:'This is a issue',createDate:new Date(),&lt;span style="font-weight: bold; font-style: italic;"&gt;project:project1&lt;/span&gt;)&lt;br /&gt;//we created the issue object,but the different in this place.we have a parameter &lt;span style="font-weight: bold; font-style: italic;"&gt;project:project1 ,&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;because the project and issue has a one-many relationship,so we need point there whcih &lt;span style="font-weight: bold; font-style: italic;"&gt;Project &lt;/span&gt;that this &lt;span style="font-weight: bold; font-style: italic;"&gt;Issue &lt;/span&gt;belong to.&lt;br /&gt;/**read*/&lt;br /&gt;after we create the object information.we usually need get these data.how to do that?the answer is &lt;span style="font-weight: bold; font-style: italic;"&gt;get(id) &lt;/span&gt;and &lt;span style="font-weight: bold; font-style: italic;"&gt;exists(id)&lt;/span&gt; method.&lt;br /&gt;//get Project by ID&lt;br /&gt;def p1=Project.get(1)//we will use id parameter get a project,which id is 1&lt;br /&gt;def boolean=Project.exist(1)//the exists method will return &lt;span style="font-weight: bold; font-style: italic;"&gt;ture &lt;/span&gt;if it's exists.&lt;br /&gt;The exists method,  reads better and is arguably more performant than get method.&lt;br /&gt;if(Project.get(1)){&lt;br /&gt;   def p=Project.get(1)  //bad performant,because you called twice &lt;span style="font-weight: bold;"&gt;get &lt;/span&gt;method&lt;br /&gt;}&lt;br /&gt;if(Project.exists(1)){&lt;br /&gt;   def p=Project.get(1)  //better performant&lt;br /&gt;}&lt;br /&gt;/**update Object*/&lt;br /&gt;//update object is easy&lt;br /&gt;def p=Project.get(1)&lt;br /&gt;p.title='New title'&lt;br /&gt;p.save()&lt;br /&gt;&lt;br /&gt;/**delete Object*/&lt;br /&gt;def p=Project.get(1)&lt;br /&gt;&lt;br /&gt;p.delete()&lt;br /&gt;&lt;br /&gt;/**sort,listing,and counting*/&lt;br /&gt;&lt;br /&gt;GORM provides a list method, which takes a number of named arguments such as max, offset,&lt;br /&gt;sort, and order to customize the results, the definitions of which are listed here:&lt;br /&gt;• max: The maximum number of instances to return&lt;br /&gt;• offset: The offset relative to 0 of the first result to return&lt;br /&gt;• sort: The property name to sort by&lt;br /&gt;• order: The order of the results, either asc or desc for ascending and descending order respectively&lt;br /&gt;&lt;br /&gt;//demonstrate&lt;br /&gt;//get all objecta&lt;br /&gt;def allProject=Project.list()&lt;br /&gt;//get top 10 objects&lt;br /&gt;def topten=Project.list(max:10)&lt;br /&gt;//sort objects&lt;br /&gt;def sortingProject=Project.list(max:10,sort:'createDate')&lt;br /&gt;//sort and order&lt;br /&gt;def sortingProject2=Project.list(max:10,sort:'createDate',order:'desc')&lt;br /&gt;//order by column name&lt;br /&gt;def allBycreateDate=Project.listOrderByCreateDate()&lt;br /&gt;Note:the listByCreateDate is auto generate by Grails.it's a role,that means listOrderBy+property'name&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-213716021198822639?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/213716021198822639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=213716021198822639' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/213716021198822639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/213716021198822639'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/data-operator-crud-in-grails.html' title='Data operator CRUD in Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-5447470970126732064</id><published>2008-03-14T01:51:00.000-07:00</published><updated>2008-12-10T07:33:04.209-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to create the Domain-class of Grails--Sparrow begin</title><content type='html'>After several days basic setup and config,our architecture of project Sparrow  has been create.Now we'll start our first step:create domain object. &lt;p&gt;      But before the beginning of our process,let me introduce the  requirement of our Sparrow.For facilitate,I will illustrate the requirement by a  UML diagram.&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_umxcSr0um1c/R9o9b5z31RI/AAAAAAAAAAc/E6MRquZEmEE/s1600-h/basic-process.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_umxcSr0um1c/R9o9b5z31RI/AAAAAAAAAAc/E6MRquZEmEE/s320/basic-process.PNG" alt="" id="BLOGGER_PHOTO_ID_5177518271199958290" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;As you can see, our project will include three functions.&lt;br /&gt;1)create a  project.&lt;br /&gt;2)create issues for this project.&lt;br /&gt;3)create issues type for  existing issues.&lt;/p&gt; &lt;p&gt;Following is the Domain Class Model :&lt;/p&gt;&lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_umxcSr0um1c/R9o9xpz31SI/AAAAAAAAAAk/Y2vAB5cd7OE/s1600-h/domain-model.PNG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_umxcSr0um1c/R9o9xpz31SI/AAAAAAAAAAk/Y2vAB5cd7OE/s320/domain-model.PNG" alt="" id="BLOGGER_PHOTO_ID_5177518644862113058" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;       Now,let's begin.In Grails,it use the Hibernate for ROM ,but as the  same time Grails extend the Hibernate,we call this extension "GOM".It's also  based on "Convention Role",so we only need create a POJO class by Groovy  language.In our project there are three domain class we'll create.Grail provide  us a easy to used tool.To do this,just open the command line.type:&lt;/p&gt; &lt;p&gt;&gt;&gt;grails create-domain-class&lt;/p&gt; &lt;p&gt;then enter the class name ,for example :project.&lt;br /&gt;Grails will auto generate  a class with capitalize letter.like this:&lt;/p&gt; &lt;p&gt;class Project {&lt;br /&gt;  static hasMany=[issues:Issue]//one project can has many  issues&lt;br /&gt;  String title&lt;br /&gt;  String description&lt;br /&gt;  Date createDate&lt;br /&gt;} &lt;/p&gt;&lt;blockquote&gt; &lt;p&gt;Note:the &lt;strong&gt;&lt;em&gt;hasMany&lt;/em&gt;&lt;/strong&gt; is a key word of Grails,that means  one project can has many issues.so Issue class will have a  &lt;strong&gt;&lt;em&gt;belongsTo&lt;/em&gt;&lt;/strong&gt; attribute.like this: &lt;/p&gt;&lt;p&gt;class Issue {&lt;br /&gt;  static belongsTo=Project&lt;br /&gt;  Project project&lt;br /&gt;  String  summary&lt;br /&gt;  String description&lt;br /&gt;  Date createDate&lt;br /&gt;} &lt;/p&gt;&lt;p&gt;Because of we have create our database(postgreSql).now we run our  application. &lt;/p&gt;&lt;p&gt;&gt;&gt;grails run-app &lt;/p&gt;&lt;p&gt;You'll see that grails auto create the database table for these two domain  class.&lt;br /&gt;As you can see Grails auto create two field "id" and "version".it's a  convention,also id is a default key and it's request.And also,may be you have  saw that the property field "createDate" in database table is  create_date,because the createDate field has a capitalize letter "D",so it  replace by "_d".yes it's also a convention. &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-5447470970126732064?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/5447470970126732064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=5447470970126732064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5447470970126732064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5447470970126732064'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-to-create-domain-class-of-grails.html' title='How to create the Domain-class of Grails--Sparrow begin'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_umxcSr0um1c/R9o9b5z31RI/AAAAAAAAAAc/E6MRquZEmEE/s72-c/basic-process.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-9156266151667265556</id><published>2008-03-12T02:50:00.000-07:00</published><updated>2008-03-19T02:09:58.605-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to config Grails's  datasource</title><content type='html'>As you can see,there is a directory named &lt;span style="font-style: italic; font-weight: bold;"&gt;conf&lt;/span&gt;($App_home$/grails-app/conf),it include many configuration file.Today we'll disscuss how to config Grails's datasoure.Because of Grails leverages Hibernate,it supports every database that Hibernate support.Following list the Grails supported database.&lt;br /&gt;• DB2 7.1, 7.2, 8.1&lt;br /&gt;• HSQLDB&lt;br /&gt;• HypersonicSQL 1.61, 1.7.0, 1.7.2, 1.8&lt;br /&gt;• Microsoft SQL Server 2000&lt;br /&gt;• MySQL 3.23, 4.0, 4.1, 5.0&lt;br /&gt;• Oracle 8i, 9i, 10g&lt;br /&gt;• PostgreSQL 7.1.2, 7.2, 7.3, 7.4, 8.0, 8.1&lt;br /&gt;• SAP DB 7.3&lt;br /&gt;• Sybase 12.5 (JConnect 5.5)&lt;br /&gt;• Timesten 5.1&lt;br /&gt;Let me assume that we use postgresql.Then we should download the JDBC driver from postgresql homepage,and copy it into the directoty &lt;span style="font-weight: bold; font-style: italic;"&gt;lib&lt;/span&gt;($App_home$/lib).Then edit the file &lt;span style="font-weight: bold; font-style: italic;"&gt;DataSource.groovy&lt;/span&gt; in directory conf.like this(I add some comments for every section):&lt;br /&gt;dataSource {&lt;br /&gt;   pooled = true  //which allows you to configure whether to use a connection pool or not&lt;br /&gt;   driverClassName = "org.postgresql.Driver" //the database driver class name&lt;br /&gt;   username = "postgres" //database name&lt;br /&gt;   password = "123456" //database password&lt;br /&gt;}&lt;br /&gt;//It is the configurate for hibernate,you can change it fit your want.&lt;br /&gt;hibernate {&lt;br /&gt;   cache.use_second_level_cache=true&lt;br /&gt;   cache.use_query_cache=true&lt;br /&gt;   cache.provider_class='org.hibernate.cache.EhCacheProvider'&lt;br /&gt;}&lt;br /&gt;// environment specific settings,there are three database for our application.&lt;br /&gt;//sparrow_dev:for development phase.&lt;br /&gt;//sparrow_test:for test phase.&lt;br /&gt;//sparrow_pro:for product phase.&lt;br /&gt;environments {&lt;br /&gt;   development {&lt;br /&gt;       dataSource {&lt;br /&gt;           dbCreate = "update" // one of 'create', 'create-drop','update'&lt;br /&gt;           url = "jdbc:postgresql://127.0.0.1:5432/sparrow_dev"&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   test {&lt;br /&gt;       dataSource {&lt;br /&gt;           dbCreate = "update"&lt;br /&gt;           url = "jdbc:postgresql://127.0.0.1:5432/sparrow_test"&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   production {&lt;br /&gt;       dataSource {&lt;br /&gt;           dbCreate = "update"&lt;br /&gt;           url = "jdbc:postgresql://127.0.0.1:5432/sparrow_pro"&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now,you can run you application under a database model.congratulation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-9156266151667265556?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/9156266151667265556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=9156266151667265556' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/9156266151667265556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/9156266151667265556'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-to-config-grailss-datasource.html' title='How to config Grails&apos;s  datasource'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-3055018245011560242</id><published>2008-03-10T23:22:00.000-07:00</published><updated>2008-03-19T02:09:13.081-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>What the Grails application directory contains?</title><content type='html'>When you run command grails create-app,what happened?The answer is it create a lot of directory and file to you.they are the core of a Grails application.Today let me explain what are these folders and files means to you.I make a summary of these stuff as a list:&lt;br /&gt;&lt;br /&gt;grails-app:This directory containing core Grails artifacts&lt;br /&gt;     +conf: Contains configuration elements,such as DataSource.groovy,UrlMappings.groovy&lt;br /&gt;     +controllers :Controllers that handle requests&lt;br /&gt;     +domain:Contains domain object class.&lt;br /&gt;     +i18n:Contains internationalization message bundles.&lt;br /&gt;     +services:Services that encapsulate business logic&lt;br /&gt;     +taglib:Dynamic tag libraries&lt;br /&gt;     +views:Groovy server page or JSP.&lt;br /&gt;     +layouts:the GSP or JSP layouts powered by sitemesh.&lt;br /&gt;grails-test:application unit tests.&lt;br /&gt;hibernate:optional Hibernate configuration.&lt;br /&gt;lib:java lib jar archives&lt;br /&gt;spring:optional Spring configuration.&lt;br /&gt;src:Include other   Groovy or Java sources.&lt;br /&gt;   +java:Further Java sources for compilation.&lt;br /&gt;   +groovy:Further Groovy sources for compilation.&lt;br /&gt;web-app:web application resources (CSS, JavaScript, etc.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-3055018245011560242?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/3055018245011560242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=3055018245011560242' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3055018245011560242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/3055018245011560242'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/what-grails-application-directory.html' title='What the Grails application directory contains?'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-2127290018737937804</id><published>2008-03-10T23:07:00.000-07:00</published><updated>2008-03-19T02:09:13.082-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to change the default servlet version of Grails</title><content type='html'>Because Grails use Jetty as its default servlet container,so its default servlet version is "2.4".for some reason,may be we need to develop our application under the version 2.3 or 2.5 then how to change its default behavior?Then way is:&lt;br /&gt;1)passs argument -Dservlet.version,for example:&lt;br /&gt;&gt;&gt;grails -Dservlet.version=2.5 run-app&lt;br /&gt;2)Or we can directly edit the Init.groovy file in directory Grails_Home/scripts.find the &lt;span style="font-style: italic;"&gt;key &lt;/span&gt;"servletVersion" and change its default value from 2.4 to others what you want,for example:&lt;br /&gt;servletVersion = System.getProperty("servlet.version") ? System.getProperty("servlet.version") :&lt;span style="font-weight: bold;"&gt; "2.5"&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-2127290018737937804?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/2127290018737937804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=2127290018737937804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2127290018737937804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2127290018737937804'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-to-change-default-servlet-version.html' title='How to change the default servlet version of Grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7823650912816156030</id><published>2008-03-10T20:42:00.000-07:00</published><updated>2008-03-19T02:09:13.082-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='oracle'/><title type='text'>How to display database comments of  table's columns</title><content type='html'>If you want to show the comments of a database tbale's column then try this way.     &lt;br /&gt;select * from user_col_comments where table_name='table name'&lt;br /&gt;as same principle.we can show the table's comments:&lt;br /&gt;select * from user_tab_comments where table_name='table name'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7823650912816156030?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7823650912816156030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7823650912816156030' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7823650912816156030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7823650912816156030'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-to-display-database-comments-of.html' title='How to display database comments of  table&apos;s columns'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7258975456014758965</id><published>2008-03-10T19:21:00.000-07:00</published><updated>2008-03-19T02:09:13.082-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How to change the default port number of Grails server</title><content type='html'>Grails use Jetty as its server,and run port 8080 by default.for some reason,we should change it ,for example 9090,how to do?There are two ways:&lt;br /&gt;1) when you do run-app,add command -Dserver.port=9090.for example&lt;br /&gt;   &gt;&gt;grails -Dserver.port=9090 run-app&lt;br /&gt;2) if you want to change the port to 9090 as default value,then Edit the file GRAILS_HOME/scripts/Init.groovy and change the phrase &lt;b&gt;8080&lt;/b&gt;  to another port number like &lt;b&gt;9090&lt;/b&gt; .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7258975456014758965?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7258975456014758965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7258975456014758965' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7258975456014758965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7258975456014758965'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-to-change-default-port-number-of.html' title='How to change the default port number of Grails server'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-6508709681597669504</id><published>2008-03-10T00:21:00.000-07:00</published><updated>2008-03-19T02:09:58.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>A good IDE for develop dynamic language.</title><content type='html'>Recently,we begin our new project named Sparrow.It's a project manage and trace application.&lt;br /&gt;We decide to find a easy to use and free license IDE for our team.After a several of days,we found a good tools &lt;a title="open komodo" href="http://community.activestate.com/" id="swmu"&gt;open komodo&lt;/a&gt; .It's support a lot of existing dynamic language.such as python,ruby,lisp and several of dynamic language such as django. etc....Also it's support customizable feature ,such as customize command,customize menu etc.. We'll use this IDE in our Sparrow application.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-6508709681597669504?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/6508709681597669504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=6508709681597669504' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6508709681597669504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6508709681597669504'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/good-ide-for-develop-dynamic-language.html' title='A good IDE for develop dynamic language.'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-986243988364668681</id><published>2008-03-09T23:37:00.000-07:00</published><updated>2008-03-19T02:09:58.606-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>The Controllers in Grails framework</title><content type='html'>Grails is an MVC framework and has models,controllers and views to cleanly separate concerns.&lt;br /&gt;So let's create our first controller for our Sparrow.let's assume we want a page to say hello for everyone who access our app.The requirement is simple,it's just print  a "hello world "(Yes,always hello world).It's easy to do this in Grails.We need a controllers,type following command:&lt;br /&gt;&gt;&gt;cd sparrow&lt;br /&gt;&gt;&gt;grails create-controller&lt;br /&gt;Grails will ask you what's controller name.pls type hello&lt;br /&gt;After a minute,Grails will create a HelloController.groovy in path /sparrow/grails-app/controllers/&lt;br /&gt;then open it and find the index method.Note every methods in this groovy file are &lt;span style="font-style: italic;"&gt;action&lt;/span&gt; .the index method is the default behavior when you navigate following url:http://127.0.0.1:8080/sparrow/hello/&lt;br /&gt;We will modify this method like this :&lt;br /&gt;def index = {&lt;br /&gt;        render "Hello World!"&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;When you navigate http://127.0.0.1:8080/sparrow/hello/&lt;br /&gt;you'll see a page with "Hello World!" string.Note this file is a standard groovy file.index method is  a default method as I said at above.the render also a keyword.We can assume it like Response object's write method  in  Java servelt.&lt;br /&gt;If you want define other action in hello controller.just define a new method in the file HelloController.groovy.for example.I want to show a good bye information.Just add following method :&lt;br /&gt;    def saygoodbye={&lt;br /&gt;        render "Good Bye!"&lt;br /&gt;    }&lt;br /&gt;then navigate to following url: http://127.0.0.1:8080/sparrow/hello/saygoodbye.&lt;br /&gt;Note:in this url,&lt;br /&gt;the &lt;span style="font-style: italic; font-weight: bold;"&gt;http://127.0.0.1:8080/&lt;/span&gt; is domain and port.&lt;br /&gt;the &lt;span style="font-style: italic; font-weight: bold;"&gt;saprrow &lt;/span&gt;is context path.&lt;br /&gt;the &lt;span style="font-weight: bold; font-style: italic;"&gt;hello &lt;/span&gt;is controler name.&lt;br /&gt;the &lt;span style="font-weight: bold; font-style: italic;"&gt;saygoodbye &lt;/span&gt;is action name.&lt;br /&gt;In future section we'll discuss it detail.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-986243988364668681?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/986243988364668681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=986243988364668681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/986243988364668681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/986243988364668681'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/controllers-in-grails-framework.html' title='The Controllers in Grails framework'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-2139117354010156845</id><published>2008-03-09T22:05:00.000-07:00</published><updated>2008-03-19T02:09:13.084-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mood'/><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><title type='text'>My friend get a new job</title><content type='html'>From 9 months wait in home,my friend Bony get her new job.She will work for a computer company ,too(like me).I'll congratulate her,and I'll have a dinner with her tonight,it'll be my treat.Oh,one more thing,what's for dinner?I think tuna  salad is good,I like it:).&lt;br /&gt;    In the end, I wish she have a good luck beginning.God bless her.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.bbcgoodfood.com/recipes/1803/images/1803_MEDIUM.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://www.bbcgoodfood.com/recipes/1803/images/1803_MEDIUM.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-2139117354010156845?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/2139117354010156845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=2139117354010156845' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2139117354010156845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/2139117354010156845'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/my-friend-get-new-job.html' title='My friend get a new job'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7665355871232834083</id><published>2008-03-09T21:33:00.000-07:00</published><updated>2008-12-10T07:33:04.412-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Getting start with Grails for our Sparrow app</title><content type='html'>Today we'll start to our Sparrow app.As a learning project we'll begin from how to create and run an application.&lt;br /&gt;     As you can see,our app's name is Sparrow,then how to create it,follow me.&lt;br /&gt;open your command line.type&lt;br /&gt;&gt;&gt;make dir learnapp&lt;br /&gt;&gt;&gt;cd learnapp&lt;br /&gt;&gt;&gt;grails create-app&lt;br /&gt;after this,grails will ask your what's name your project.we'll tyep&lt;br /&gt;&gt;&gt;sparrow&lt;br /&gt;then grails will generate all of you need to start an application.Note,Grails is a role framework.so you will see somes like domain,controllors,tlb folder etc.in the future,we'll create relative file to fit our application.for now,we only need a blamk frame,but it's a runable application.we'll start our first grails app.type following command:&lt;br /&gt;&gt;&gt;cd sparrow&lt;br /&gt;&gt;&gt;grails run-app&lt;br /&gt;You will see some run time information in console.then open your favorite browser then type:&lt;br /&gt;http://127.0.0.1:8080/sparrow/&lt;br /&gt;you will see a welcom page like this:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_umxcSr0um1c/R9S9Ppz31QI/AAAAAAAAAAU/Ma-OxVVZ-V4/s1600-h/sparrow_run-app.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_umxcSr0um1c/R9S9Ppz31QI/AAAAAAAAAAU/Ma-OxVVZ-V4/s320/sparrow_run-app.png" alt="" id="BLOGGER_PHOTO_ID_5175969948374652162" border="0" /&gt;&lt;/a&gt;Grails used Jetty as its default servlet container.In the future,may be you want to move it to other containers such as tomcat .or some appservers such as JBoss.You can just type &lt;span style="font-style: italic;"&gt;grails war &lt;/span&gt;.Grails will generate a &lt;span style="font-style: italic;"&gt;war &lt;/span&gt;file for you,then you can make your own deployment in others environment.&lt;br /&gt;Now.through only a few commmand you create a runable application.It's really cool.In the following section,we'll discuss how to add our first domain model &lt;span style="font-style: italic;"&gt;project&lt;/span&gt;.we'll add some useful feature for our application and introduce what grails's domain model is as same time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7665355871232834083?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7665355871232834083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7665355871232834083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7665355871232834083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7665355871232834083'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/getting-start-with-grails-for-our.html' title='Getting start with Grails for our Sparrow app'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_umxcSr0um1c/R9S9Ppz31QI/AAAAAAAAAAU/Ma-OxVVZ-V4/s72-c/sparrow_run-app.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-8381505125466413512</id><published>2008-03-09T20:57:00.000-07:00</published><updated>2008-03-19T02:09:58.607-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Grails Command-Line Help</title><content type='html'>Because our Sparrow is a learning project for Grails.So,let me list the command-line help for how to create a project.here they are:&lt;br /&gt;&gt;grails&lt;br /&gt;help:&lt;br /&gt;Usage: grails [target]&lt;br /&gt;Targets:&lt;br /&gt;"create-app" - Create a new grails app&lt;br /&gt;"create-controller" - Create a new controller&lt;br /&gt;"create-service" - Create a new service&lt;br /&gt;"create-domain-class" - Create a new domain class&lt;br /&gt;"create-taglib" - Create a new tag library class&lt;br /&gt;"create-test-suite" - Create a new test suite&lt;br /&gt;"create-job" - Create a quartz scheduled job&lt;br /&gt;"generate-controller" - Generates a controller from a domain class&lt;br /&gt;"generate-views" - Generates the views from a domain class&lt;br /&gt;"generate-all" - Generates all artifacts from a domain class&lt;br /&gt;"test-app" - Run current app's unit tests&lt;br /&gt;"run-app" - Run the application locally and wait&lt;br /&gt;"create-webtest" - Create the functional test layout&lt;br /&gt;"run-webtest" - Run the functional tests for a running app&lt;br /&gt;"shell" - Opens the Grails interactive command line shell&lt;br /&gt;"console" - Opens the Grails interactive swing console&lt;br /&gt;"war" - Create a deployable Web Application Archive (WAR)&lt;br /&gt;&lt;br /&gt;While you run these command.you will  note at this point that Grails uses the Apache Ant.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-8381505125466413512?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/8381505125466413512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=8381505125466413512' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8381505125466413512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/8381505125466413512'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/grails-command-line-help.html' title='Grails Command-Line Help'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-5969276843328933125</id><published>2008-03-09T20:53:00.000-07:00</published><updated>2008-12-10T07:33:04.584-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><title type='text'>Domain model for Sparrow</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_umxcSr0um1c/R9Sxdpz31PI/AAAAAAAAAAM/Xo-vf9KEnPs/s1600-h/sparrow.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_umxcSr0um1c/R9Sxdpz31PI/AAAAAAAAAAM/Xo-vf9KEnPs/s320/sparrow.png" alt="" id="BLOGGER_PHOTO_ID_5175956994753287410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;    Today we create the domain model for Sparrow system.For now,it's only a draft version.&lt;br /&gt;Also you can find the soure file from &lt;a href="http://docs.google.com/Doc?id=dffctbvk_2fcqd4xcm"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-5969276843328933125?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/5969276843328933125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=5969276843328933125' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5969276843328933125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/5969276843328933125'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/domain-model-for-sparrow.html' title='Domain model for Sparrow'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_umxcSr0um1c/R9Sxdpz31PI/AAAAAAAAAAM/Xo-vf9KEnPs/s72-c/sparrow.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7713621194953130695</id><published>2008-03-09T20:30:00.000-07:00</published><updated>2008-03-19T02:09:58.609-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>Start new project Sparrow</title><content type='html'>Today we plan to start a new project named Sparrow.It's a project manage framework.In this project we'll provide project manage feature.It'll based on Grails framework,as you will see.we'll create it as a learning project.That means,we'll learning it and development it step by step.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7713621194953130695?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7713621194953130695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7713621194953130695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7713621194953130695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7713621194953130695'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/start-new-project-sparrow.html' title='Start new project Sparrow'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-1644894588827928167</id><published>2008-03-07T10:13:00.000-08:00</published><updated>2008-03-19T02:09:13.086-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Lock step iteration in Python</title><content type='html'>Today I will log this big feature in python 2.x.That is lock set iteration.so what's that?let's assume,we have two list and for some reason we want to iteration them in the same time.In other language(eg.Java).we need a nesting loop.But in python .we can use &lt;span style="font-style: italic;"&gt;map &lt;/span&gt;function,it's build-in.following code is a example.&lt;br /&gt;&gt;&gt;a=(1,2,3)&lt;br /&gt;&gt;&gt;b=(4,5,6)&lt;br /&gt;&gt;&gt;for i in map(None,a,b): print i&lt;br /&gt;The result is :&lt;br /&gt;(1, 4)&lt;br /&gt;(2, 5)&lt;br /&gt;(3, 6)&lt;br /&gt;Wow.It's cool ,right.now assume the length of each list is different.for example,we set them like this&lt;br /&gt;&gt;&gt;a=(1,2,3)&lt;br /&gt;&gt;&gt;b=(4,5,6,7,8)&lt;br /&gt;The result is:&lt;br /&gt;(1, 4)&lt;br /&gt;(2, 5)&lt;br /&gt;(3, 6)&lt;br /&gt;(None, 7)&lt;br /&gt;(None, 8)&lt;br /&gt;&lt;br /&gt;As you can see,now we have two extra&lt;span style="font-style: italic;"&gt; small list&lt;/span&gt; with the element &lt;span style="font-style: italic;"&gt;None&lt;/span&gt;.Yes,Python auto append a None type in last &lt;span style="font-style: italic;"&gt;list,&lt;/span&gt;because it is the first parameter in the&lt;span style="font-style: italic;"&gt; map&lt;/span&gt; function.Until now,it looks good ,right ?we only write one line code ,then &lt;span style="font-style: italic;"&gt;map &lt;/span&gt;function do two times loop.But it's not elegant.because :&lt;br /&gt;&lt;pre&gt; - It is non-obvious to programmers without a functional&lt;br /&gt;     programming background.&lt;br /&gt;   - The use of the magic `None' first argument is non-obvious.&lt;br /&gt;   - It has arbitrary, often unintended, and inflexible semantics&lt;br /&gt;     when the lists are not of the same length: the shorter sequences&lt;br /&gt;     are padded with `None'.&lt;br /&gt;&lt;br /&gt;Fortunately,we have another function,zip.yes it's good to use.let me give a example:&lt;br /&gt;&gt;&gt;a=(1,2,3)&lt;br /&gt;&gt;&gt;b=(4,5,6,7,8)&lt;br /&gt;&gt;&gt;zip(a,b)&lt;br /&gt;The result is:&lt;br /&gt;(1, 4)&lt;br /&gt;(2, 5)&lt;br /&gt;(3, 6)&lt;br /&gt;Yes,as you can see,no other two redundant list.it's more clearly.of course,if you think that&lt;br /&gt;other twos is useful,you can also use the map function.But now we have another choose.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-1644894588827928167?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/1644894588827928167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=1644894588827928167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/1644894588827928167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/1644894588827928167'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/lock-step-iteration-in-python.html' title='Lock step iteration in Python'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-7667029883871967448</id><published>2008-03-07T09:39:00.000-08:00</published><updated>2008-03-19T02:09:13.086-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Mood'/><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><title type='text'>get up on the wrong side of the bed</title><content type='html'>It' a bad day today.I feel bad because I have a mistake in my work.I feel bad because I can't put up with my mistake.It should not be happened.It's happened just because I careless of the description in the document.just one sentence I missed.although it is only a small mistake but I can't bear me to do that again.I promise I will never ever slip a cog like this.never!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-7667029883871967448?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/7667029883871967448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=7667029883871967448' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7667029883871967448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/7667029883871967448'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/get-up-on-wrong-side-of-bed.html' title='get up on the wrong side of the bed'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7716996258329599145.post-6317841443776521730</id><published>2008-03-05T07:01:00.000-08:00</published><updated>2008-03-19T02:09:13.087-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Gria'/><category scheme='http://www.blogger.com/atom/ns#' term='Groovy'/><category scheme='http://www.blogger.com/atom/ns#' term='Grails'/><title type='text'>How should I say,I like grails</title><content type='html'>In my several  years development by profession.I used several computer languages,such as C++,Java,Python and many of web framework.But for Grails,I said ,it's really a good framework.because it's based on Groovy language,and very easy to use,also it can access all most of Java  library ,that means I never have to give up I have know about Java.So I think I'll be successful.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7716996258329599145-6317841443776521730?l=grailslog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://grailslog.blogspot.com/feeds/6317841443776521730/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7716996258329599145&amp;postID=6317841443776521730' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6317841443776521730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7716996258329599145/posts/default/6317841443776521730'/><link rel='alternate' type='text/html' href='http://grailslog.blogspot.com/2008/03/how-should-i-sayi-like-grails.html' title='How should I say,I like grails'/><author><name>Eric Laird</name><uri>http://www.blogger.com/profile/08611498506509373386</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
