<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wysmedia.com &#187; Programming</title>
	<atom:link href="http://www.wysmedia.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wysmedia.com</link>
	<description>~ We make IT easy for you ~</description>
	<lastBuildDate>Fri, 08 May 2009 07:02:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dance with Dynamic Jasper Report</title>
		<link>http://www.wysmedia.com/2009/05/dance-with-dynamic-jasper-report/</link>
		<comments>http://www.wysmedia.com/2009/05/dance-with-dynamic-jasper-report/#comments</comments>
		<pubDate>Sat, 02 May 2009 03:07:35 +0000</pubDate>
		<dc:creator>adwin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[dynamic jasper]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[jasper]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.wysmedia.com/?p=64</guid>
		<description><![CDATA[Tutorial on using custom queries with Dynamic Jasper Report in Grails web application]]></description>
			<content:encoded><![CDATA[<div id="attachment_70" class="wp-caption alignleft" style="width: 160px"><img src="http://www.wysmedia.com/wp-content/uploads/2009/05/jasper-report-opensource-150x40.jpg" alt="jasper report " title="jasper-report-opensource" width="150"  class="size-thumbnail wp-image-70" /><p class="wp-caption-text">jasper report </p></div>Dynamic Jasper Report is such a nice thing that exists in this world. You can create a report using powerfull Jasper Engine without creating a jrxml first. You don&#8217;t need iReport anymore. Actually I hate using iReport, it is not fun for me <img src='http://www.wysmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <span id="more-64"></span></p>
<p>I will show you step by step how to use Dynamic Jasper Report with custom query. I won&#8217;t show how to use <strong>static reportable</strong> in Domain because there are lots of tutorial like <a href="http://blog.lucastex.com/2009/04/16/4of25-jasper-reports-in-grails-with-dynamic-jasper/">this one</a></p>
<p><strong>Installing Plugins</strong><br />
It is as simple typing </p>
<blockquote><p> grails install-plugin dynamic-jasper</p></blockquote>
<p><strong>Generating Domains step</strong><br />
We create 2 domains name: Book and Author simply type</p>
<blockquote><p>
grails create-domain-class Book<br />
grails create-domain-class Author
</p></blockquote>
<p>and add some field on the domains :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> <span style="color: #aaaadd; font-weight: bold;">Book</span> <span style="color: #66cc66;">&#123;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> name <span style="color: #66cc66;">;</span> 
    <span style="color: #aaaadd; font-weight: bold;">String</span> barcode <span style="color: #66cc66;">;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> summary<span style="color: #66cc66;">;</span>
    Author author<span style="color: #66cc66;">;</span> 
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> belongsTo <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>author:Author<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> constraints <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
        name<span style="color: #66cc66;">&#40;</span>nullable:<span style="color: #000000; font-weight: bold;">false</span>, blank:<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        barcode<span style="color: #66cc66;">&#40;</span>nullable:<span style="color: #000000; font-weight: bold;">false</span>, blank:<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        summary<span style="color: #66cc66;">&#40;</span>nullable:<span style="color: #000000; font-weight: bold;">false</span>, blank:<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #aaaadd; font-weight: bold;">String</span> toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000;">&quot;${name}&quot;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> Author <span style="color: #66cc66;">&#123;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> name <span style="color: #66cc66;">;</span>
    <span style="color: #aaaadd; font-weight: bold;">String</span> summary <span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> hasMany <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#91;</span>books:<span style="color: #aaaadd; font-weight: bold;">Book</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">static</span> constraints <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span>
        name<span style="color: #66cc66;">&#40;</span>nullable:<span style="color: #000000; font-weight: bold;">false</span>, blank:<span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        summary<span style="color: #66cc66;">&#40;</span>nullable:<span style="color: #000000; font-weight: bold;">false</span>, blank:<span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #aaaadd; font-weight: bold;">String</span> toString<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000;">&quot;${name}&quot;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p><b> Create a controller for displaying the Jasper </b></p>
<blockquote><p>grails create-controller Report</p></blockquote>
<p>Here we want to create an excel report so we fill ReportController with this :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
</pre></td><td class="code"><pre class="groovy" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">net.sf.jasperreports.engine.*</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">net.sf.jasperreports.engine.data.*</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">net.sf.jasperreports.engine.export.*</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">net.sf.jasperreports.engine.util.*</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">net.sf.jasperreports.view.*</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">ar.com.fdvs.dj.domain.DynamicReport</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">ar.com.fdvs.dj.domain.builders.FastReportBuilder</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">ar.com.fdvs.dj.core.DynamicJasperHelper</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">ar.com.fdvs.dj.core.layout.ClassicLayoutManager</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #a1a100;">ar.com.fdvs.dj.output.*</span><span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> ReportController <span style="color: #66cc66;">&#123;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">def</span> index <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#123;</span> 
        FastReportBuilder drb <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> FastReportBuilder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        drb <span style="color: #66cc66;">=</span> drb.<span style="color: #006600;">addColumn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Book Name&quot;</span>,<span style="color: #ff0000;">&quot;name&quot;</span>,<span style="color: #aaaadd; font-weight: bold;">String</span>.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        drb <span style="color: #66cc66;">=</span> drb.<span style="color: #006600;">addColumn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Barcode&quot;</span>,<span style="color: #ff0000;">&quot;barcode&quot;</span>,<span style="color: #aaaadd; font-weight: bold;">String</span>.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        drb <span style="color: #66cc66;">=</span> drb.<span style="color: #006600;">addColumn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Author&quot;</span>,<span style="color: #ff0000;">&quot;author.name&quot;</span>,<span style="color: #aaaadd; font-weight: bold;">String</span>.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">30</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        drb <span style="color: #66cc66;">=</span> drb.<span style="color: #006600;">addColumn</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Author Summary&quot;</span>,<span style="color: #ff0000;">&quot;author.summary&quot;</span>,<span style="color: #aaaadd; font-weight: bold;">String</span>.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006600;">getName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">70</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        DynamicReport dr <span style="color: #66cc66;">=</span> drb.<span style="color: #006600;">setTitle</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;My tester &quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">setUseFullPageWidth</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">build</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
        JRDataSource ds <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JRBeanCollectionDataSource<span style="color: #66cc66;">&#40;</span><span style="color: #aaaadd; font-weight: bold;">Book</span>.<span style="color: #006600;">list</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>   
        JasperPrint jp <span style="color: #66cc66;">=</span> DynamicJasperHelper.<span style="color: #006600;">generateJasperPrint</span><span style="color: #66cc66;">&#40;</span>dr, 
                <span style="color: #000000; font-weight: bold;">new</span> ClassicLayoutManager<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, ds<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
&nbsp;
        <span style="color: #000000; font-weight: bold;">def</span> reportFormat <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'XLS'</span><span style="color: #66cc66;">;</span>
        <span style="color: #000000; font-weight: bold;">def</span> reportFileName <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;myReport&quot;</span><span style="color: #66cc66;">;</span>
        ReportWriter reportWriter <span style="color: #66cc66;">=</span> ReportWriterFactory.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getReportWriter</span><span style="color: #66cc66;">&#40;</span>jp, reportFormat, <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#40;</span>JRHtmlExporterParameter.<span style="color: #006600;">IMAGES_URI</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #ff0000;">&quot;${request.contextPath}/report/image?image=&quot;</span>.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>reportFileName<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            response.<span style="color: #006600;">addHeader</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'content-disposition'</span>, <span style="color: #ff0000;">&quot;attachment; filename=${reportFileName}.${reportFormat.toLowerCase()}&quot;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#125;</span>
        reportWriter.<span style="color: #006600;">writeTo</span><span style="color: #66cc66;">&#40;</span>response<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>FastReportBuilder will create columns and do what the jrxml does.<br />
DynamicReport will build the report for you (i think it identical with compiling jrxml to .jasper)</p>
<p>You fill data of the report using JRBeanCollectionDataSource. here we use simple query Book.list(). You might try it using Criteria as well.</p>
<p>To display the report in the browser, we just tell the browser about the header and its content by this code :</p>

<div class="wp_syntax"><div class="code"><pre class="groovy" style="font-family:monospace;">ReportWriter reportWriter <span style="color: #66cc66;">=</span> ReportWriterFactory.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getReportWriter</span><span style="color: #66cc66;">&#40;</span>jp, reportFormat, <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#40;</span>JRHtmlExporterParameter.<span style="color: #006600;">IMAGES_URI</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #ff0000;">&quot;${request.contextPath}/report/image?image=&quot;</span>.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>reportFileName<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            response.<span style="color: #006600;">addHeader</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'content-disposition'</span>, <span style="color: #ff0000;">&quot;attachment; filename=${reportFileName}.${reportFormat.toLowerCase()}&quot;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#125;</span>
        reportWriter.<span style="color: #006600;">writeTo</span><span style="color: #66cc66;">&#40;</span>response<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&lt;</span>/blockquote<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>done &#8230; that&#8217;s so easy.</p>
<p><div id="attachment_68" class="wp-caption alignleft" style="width: 784px"><img src="http://www.wysmedia.com/wp-content/uploads/2009/05/dynamic-jasper-result.png" alt="dynamic jasper result in excel format" title="dynamic-jasper-result" width="550" class="size-full wp-image-68" /><p class="wp-caption-text">dynamic jasper result in excel format</p></div>
<p>more information about dynamice jasper visit:<br />
<a href="http://dynamicjasper.sourceforge.net/">http://dynamicjasper.sourceforge.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wysmedia.com/2009/05/dance-with-dynamic-jasper-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice ICal Calendar with JQuery</title>
		<link>http://www.wysmedia.com/2009/02/nice-ical-calendar-with-jquery/</link>
		<comments>http://www.wysmedia.com/2009/02/nice-ical-calendar-with-jquery/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 01:52:17 +0000</pubDate>
		<dc:creator>adwin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ical]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.wysmedia.comyr.com/?p=34</guid>
		<description><![CDATA[Stefanoverna.com write how to create a nice looking calendar like those in ICal using Jquery. It looks good  
 on
this web 
]]></description>
			<content:encoded><![CDATA[<p>Stefanoverna.com write how to create a nice looking calendar like those in ICal using Jquery. It looks good <img src='http://www.wysmedia.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p> on<br />
<a href="http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery">this web </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wysmedia.com/2009/02/nice-ical-calendar-with-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Liquibase (tutorial)</title>
		<link>http://www.wysmedia.com/2009/02/using-liquibase-tutorial/</link>
		<comments>http://www.wysmedia.com/2009/02/using-liquibase-tutorial/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 02:52:17 +0000</pubDate>
		<dc:creator>adwin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[database migration]]></category>
		<category><![CDATA[liquibase]]></category>

		<guid isPermaLink="false">http://www.wysmedia.comyr.com/?p=27</guid>
		<description><![CDATA[http://www.liquibase.org/manual/]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.liquibase.org">Liquibase</a> is the powerful database migration that available for free. For long time I am envy of rails database migration system. It is nice and have rich features. </p>
<p>Few weeks ago, I found that <a href='http://grails.org'> Grails </a> has Liquibase plugin (there are 2, liquibase and autobase). I tried both plugins and autobase won my heart because the simplicity they offer (not using XML is the biggest advantages, for me at least). Liquibase however build as stand alone java application that you can run with any operating system that support java.</p>
<p> Here I will show you how to configure and using Liquibase on command line, so you can apply whether you are using php, python, or others programming language/framework </p>
<p><span id="more-27"></span></p>
<ul>
<li> First, download and extract Liquibase files from <a href='www.liquibase.org'>www.liquibase.org</a></li>
<li> Create a file named liquibase.properties </li>
<li> Write the following, you can modify it to suit your needs

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">classpath: ../;lib/mysql-connector-java-5.1.6-bin.jar
changeLogFile=changelogs/root.changelog.xml
username=root
password=
url=jdbc:mysql://localhost/tester
driver=com.mysql.jdbc.Driver
logLevel=SEVERE</pre></td></tr></table></div>

<p>* you must download mysql-connector-java-5.xxxx.jar (mysql jdbc driver) from <a href='www.mysql.com'>www.mysql.com</a>
</li>
<li>Create a directory <b>changelogs</b></li>
<li>Inside, create root.changelog.xml and write the following

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;databaseChangeLog</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.7&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.7 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.7.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;preConditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dbms</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;mysql&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sqlCheck</span> <span style="color: #000066;">expectedResult</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>select 1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sqlCheck<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;runningAs</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;root&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/preConditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            You can add comments to changeSets.
            They can even be multiple lines if you would like.
            They aren't used to compute the changeSet MD5Sum, so you can update them whenever you want without causing
            problems.
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;createTable</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;id&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;int&quot;</span> <span style="color: #000066;">autoIncrement</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constraints</span> <span style="color: #000066;">primaryKey</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;firstname&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(50)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lastname&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(50)&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constraints</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/createTable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Add a username column so we can use &quot;person&quot; for authentication<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;addColumn</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;usernae&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(8)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/addColumn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fix misspelled &quot;username&quot; column<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;renameColumn</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span> <span style="color: #000066;">oldColumnName</span>=<span style="color: #ff0000;">&quot;usernae&quot;</span> <span style="color: #000066;">newColumnName</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">columnDataType</span>=<span style="color: #ff0000;">&quot;varchar(8)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/databaseChangeLog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

</li>
<li>When you finished, go to command line and type :<br />
<blockquote><p>java -jar liquibase-1.9.0.jar migrate</p></blockquote>
</li>
<li> This command will create databasechangelog and databasechangeloglock first. Databasechangelog contains record migration that you have done in the past. If you delete one record, next time you run migrate, it will re-run again</li>
</ul>
<p>Now I will explain what is inside the changelog </p>
<p>
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;databaseChangeLog</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.7&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.liquibase.org/xml/ns/dbchangelog/1.7 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.7.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;preConditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dbms</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;mysql&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sqlCheck</span> <span style="color: #000066;">expectedResult</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>select 1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sqlCheck<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;runningAs</span> <span style="color: #000066;">username</span>=<span style="color: #ff0000;">&quot;root&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/preConditions<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
..... 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/databaseChangeLog<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>It is the header of changelog that you need to have.<br />
There are preConditions tag that will help you to know whether the database is mysql or not. </p>
<p>next :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            You can add comments to changeSets.
            They can even be multiple lines if you would like.
            They aren't used to compute the changeSet MD5Sum, so you can update them whenever you want without causing
            problems.
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;createTable</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;id&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;int&quot;</span> <span style="color: #000066;">autoIncrement</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constraints</span> <span style="color: #000066;">primaryKey</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;firstname&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(50)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;lastname&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(50)&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constraints</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/column<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/createTable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>This change set will generate a table Person for you. having column firstname and lastName</p>
<p>next:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Add a username column so we can use &quot;person&quot; for authentication<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;addColumn</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;column</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;usernae&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;varchar(8)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/addColumn<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The second update will add &#8220;usernae&#8221; (typo mistakes is on purpose) with width 8 characters</p>
<p>next: we need to fix the usernae become username</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;changeSet</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">author</span>=<span style="color: #ff0000;">&quot;nvoxland&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Fix misspelled &quot;username&quot; column<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/comment<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;renameColumn</span> <span style="color: #000066;">tableName</span>=<span style="color: #ff0000;">&quot;person&quot;</span> <span style="color: #000066;">oldColumnName</span>=<span style="color: #ff0000;">&quot;usernae&quot;</span> <span style="color: #000066;">newColumnName</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">columnDataType</span>=<span style="color: #ff0000;">&quot;varchar(8)&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/changeSet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

</p>
<p>
They are lots of command that you can use on Liquibase, just make sure you read the manual first on <a href="http://www.liquibase.org/manual/">http://www.liquibase.org/manual/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wysmedia.com/2009/02/using-liquibase-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trapping Server Error</title>
		<link>http://www.wysmedia.com/2009/02/trapping-server-error/</link>
		<comments>http://www.wysmedia.com/2009/02/trapping-server-error/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 01:14:12 +0000</pubDate>
		<dc:creator>adwin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.wysmedia.comyr.com/?p=16</guid>
		<description><![CDATA[Sometimes we found that our server are not behave normal, like there are bugs or server produce runtime exception (or error 404 etc). Those exception are not returned by ajax. So it will keep hidden and seems nothing happened. But if you have firebug installed, you can found that there are errors happened from your [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes we found that our server are not behave normal, like there are bugs or server produce runtime exception (or error 404 etc). Those exception are not returned by ajax. So it will keep hidden and seems nothing happened. But if you have firebug installed, you can found that there are errors happened from your server.</p>
<p>So here is how you can trap all errors and displayed on your screen (without using firebug).</p>
<p>This example works on grails main layout (but you can use this tips on any programming language, just put this code on main layout). My code using Jquery and JQalert to display the error </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ajaxError</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #339933;">,</span> request<span style="color: #339933;">,</span> setting<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    <span style="color: #003366; font-weight: bold;">var</span> re <span style="color: #339933;">=</span> <span style="color: #009966; font-style: italic;">/&amp;lt;br\/&amp;gt;|&amp;lt;br&amp;gt;/g</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// for replacing all &amp;lt;br/&amp;gt; with empty string in error 404</span>
                    <span style="color: #003366; font-weight: bold;">var</span> txt <span style="color: #339933;">=</span> request.<span style="color: #660066;">responseText</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span>re<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    jqalert<span style="color: #009900;">&#40;</span>txt<span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Server Error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.wysmedia.com/2009/02/trapping-server-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- www.000webhost.com Analytics Code -->
<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
<noscript><a href="http://www.hosting24.com/"><img src="http://analytics.hosting24.com/count.php" alt="web hosting" /></a></noscript>
<!-- End Of Analytics Code -->
