<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>MuNiRs</title>
	<atom:link href="http://irfanmunir.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://irfanmunir.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<pubDate>Mon, 07 Jul 2008 06:57:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title></title>
		<link>http://irfanmunir.wordpress.com/2008/07/07/39/</link>
		<comments>http://irfanmunir.wordpress.com/2008/07/07/39/#comments</comments>
		<pubDate>Mon, 07 Jul 2008 06:57:24 +0000</pubDate>
		<dc:creator>Irfan Munir</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://irfanmunir.wordpress.com/2008/07/07/39/</guid>
		<description><![CDATA[muslim_calendar_1429
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://irfanmunir.files.wordpress.com/2008/07/muslim_calendar_1429.pdf">muslim_calendar_1429</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/irfanmunir.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/irfanmunir.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/irfanmunir.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/irfanmunir.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/irfanmunir.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/irfanmunir.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/irfanmunir.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/irfanmunir.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/irfanmunir.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/irfanmunir.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/irfanmunir.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/irfanmunir.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=irfanmunir.wordpress.com&blog=853136&post=39&subd=irfanmunir&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://irfanmunir.wordpress.com/2008/07/07/39/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/irfanmunir-128.jpg" medium="image">
			<media:title type="html">irfanmunir</media:title>
		</media:content>
	</item>
		<item>
		<title>Asp.NET user Control tips</title>
		<link>http://irfanmunir.wordpress.com/2008/07/05/aspnet-user-control-tips/</link>
		<comments>http://irfanmunir.wordpress.com/2008/07/05/aspnet-user-control-tips/#comments</comments>
		<pubDate>Sat, 05 Jul 2008 11:02:42 +0000</pubDate>
		<dc:creator>Irfan Munir</dc:creator>
		
		<category><![CDATA[General Concepts]]></category>

		<guid isPermaLink="false">http://irfanmunir.wordpress.com/?p=37</guid>
		<description><![CDATA[&#60;br /&#62; 	Shahed Khan (MVP)&#60;br /&#62;


&#60;!&#8211;
//
 &#60;!&#8211;
//









Shahed Khan (MVP)
blog





posts - 213, comments - 140, trackbacks - 68






My Links

 Home
 Contact
 
 Login


 






&#60;!&#8211;
	var browName = navigator.appName;
	var SiteID = 1;
	var ZoneID = 1;
	var browDateTime = (new Date()).getTime();
	if (browName==&#8217;Netscape&#8217;)
	{
	document.write(&#8217;&#8216;); document.write(&#8221;);
	}
	if (browName!=&#8217;Netscape&#8217;)
	{
	document.write(&#8217;&#8216;); document.write(&#8221;);
	}
// &#8211;&#62;
&#38;lt;br /&#38;gt; 	&#38;lt;a href=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&#38;amp;Task=Click&#38;amp;Mode=HTML&#38;amp;SiteID=1&#38;amp;PageID=51102&#8243; mce_href=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&#38;amp;amp;Task=Click&#38;amp;amp;Mode=HTML&#38;amp;amp;SiteID=1&#38;amp;amp;PageID=51102&#8243; target=&#8221;_blank&#8221;&#38;gt;&#38;lt;br /&#38;gt; 	&#38;lt;img src=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&#38;amp;Task=Get&#38;amp;Mode=HTML&#38;amp;SiteID=1&#38;amp;PageID=51102&#8243; mce_src=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&#38;amp;amp;Task=Get&#38;amp;amp;Mode=HTML&#38;amp;amp;SiteID=1&#38;amp;amp;PageID=51102&#8243; width=&#8221;160&#8243; height=&#8221;600&#8243; border=&#8221;0&#8243;  alt=&#8221;"&#38;gt;&#38;lt;/a&#38;gt;&#38;lt;/p&#38;gt; [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&lt;br /&gt; 	Shahed Khan (MVP)&lt;br /&gt;</p>
<div>
</div>
<p>&lt;!&#8211;<br />
//</p>
<p> &lt;!&#8211;<br />
//</p>
<table class="Framework" border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td colspan="2">
<div id="top">
<table border="0" cellspacing="0" cellpadding="8" width="100%">
<tbody>
<tr>
<td>
<h1><a id="Header1_HeaderTitle" class="headermaintitle" title="The Title Of This Blog." href="/shahed/Default.aspx">Shahed Khan (MVP)</a></h1>
<p><span>blog</span></td>
</tr>
</tbody>
</table>
</div>
<div id="sub">
<div class="BlogStats">posts - 213, comments - 140, trackbacks - 68</div>
</div>
</td>
</tr>
<tr>
<td class="LeftCell" rowspan="2">
<div id="leftmenu">
<h3>My Links</h3>
<ul>
<li> <a id="MyLinks1_HomeLink" title="Link to the home page." href="/shahed/Default.aspx">Home</a></li>
<li> <a id="MyLinks1_ContactLink" title="Contact form." href="/shahed/contact.aspx">Contact</a></li>
<li> <a id="MyLinks1_XMLLink" title="Subscribe to this feed." href="http://geekswithblogs.net/shahed/Rss.aspx"><img style="border-width:0;" src="../images/xml.gif" alt="RSS 2.0 Feed" /></a></li>
<li> <a id="MyLinks1_Admin" title="Login Form." href="/shahed/login.aspx">Login</a></li>
</ul>
<div id="searchWrapper">
<div id="search"> </div>
<div id="search_searchUpdate"></div>
<div id="search_searchProgress" style="display:none;">
<div id="search-progress"></div>
</div>
</div>
<div style="text-align:center;margin-top:10px;"><!-- Begin -  Site: Geekswithblogs.net Zone: Skyscraper --><br />
&lt;!&#8211;<br />
	var browName = navigator.appName;<br />
	var SiteID = 1;<br />
	var ZoneID = 1;<br />
	var browDateTime = (new Date()).getTime();<br />
	if (browName==&#8217;Netscape&#8217;)<br />
	{<br />
	document.write(&#8217;<s>&#8216;); document.write(&#8221;);<br />
	}<br />
	if (browName!=&#8217;Netscape&#8217;)<br />
	{<br />
	document.write(&#8217;<s>&#8216;); document.write(&#8221;);<br />
	}<br />
// &#8211;&gt;<br />
&amp;lt;br /&amp;gt; 	&amp;lt;a href=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=51102&#8243; mce_href=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&amp;amp;amp;Task=Click&amp;amp;amp;Mode=HTML&amp;amp;amp;SiteID=1&amp;amp;amp;PageID=51102&#8243; target=&#8221;_blank&#8221;&amp;gt;&amp;lt;br /&amp;gt; 	&amp;lt;img src=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=51102&#8243; mce_src=&#8221;http://ads.geekswithblogs.net/a.aspx?ZoneID=1&amp;amp;amp;Task=Get&amp;amp;amp;Mode=HTML&amp;amp;amp;SiteID=1&amp;amp;amp;PageID=51102&#8243; width=&#8221;160&#8243; height=&#8221;600&#8243; border=&#8221;0&#8243;  alt=&#8221;"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt; &amp;lt;p&amp;gt;<br />
<!-- End -  Site: Geekswithblogs.net Zone: Skyscraper --></p>
<p><!-- Start Quantcast tag --></p>
<p>&amp;lt;br /&amp;gt; &amp;lt;a href=&#8221;http://www.quantcast.com/p-03-ZsKAm7O3lI&#8221; mce_href=&#8221;http://www.quantcast.com/p-03-ZsKAm7O3lI&#8221; target=&#8221;_blank&#8221;&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;img src=&#8221;http://pixel.quantserve.com/pixel/p-03-ZsKAm7O3lI.gif&#8221; mce_src=&#8221;http://pixel.quantserve.com/pixel/p-03-ZsKAm7O3lI.gif&#8221; style=&#8221;display: none&#8221; mce_style=&#8221;display: none&#8221; border=&#8221;0&#8243; height=&#8221;1&#8243; width=&#8221;1&#8243; alt=&#8221;Quantcast&#8221;/&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;<br />
<!-- End Quantcast tag --></div>
<h3>News</h3>
<div class="news">
<p><a href="https://mvp.support.microsoft.com/profile=886160C8-0AF6-4A4B-A531-B70B22C42600"><img src="http://www.msbdusers.net/smartmassemail/sk.jpg" border="0" alt="" /></a></p>
<p><a href="https://mvp.support.microsoft.com/profile=886160C8-0AF6-4A4B-A531-B70B22C42600"><img src="http://www.msbdusers.net/shahed/o_mvp_logo.jpg" border="0" alt="" /></a></p>
<p><img src="http://www.msbdusers.net/smartmassemail/mcad.gif" border="0" alt="" /></p>
<p>I am a Microsoft Certified Application Developer <strong>MCAD Chartered Member (C# .Net)</strong> and born in Bangladesh.<br />
I work for Ocean Informatics Pty Ltd as a Senior Developer - Analyst.<br />
I am also co-founder and core developer of Pageflakes <a href="http://www.pageflakes.com" target="_blank">www.pageflakes.com</a><br />
and most recently created <a href="http://www.codeplex.com/smartcodegenerator" target="_blank">SmartCodeGenerator</a></p>
<p><strong>My Articles</strong></p>
<p><a href="http://www.codeproject.com/dotnet/smartjobmanager.asp" target="_blank">Flexible and Plugin based .Net Application..</a></p>
<p><a href="http://www.codeproject.com/cs/internet/smartmassemail.asp" target="_blank">Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker&#8217; </a></p>
<p><a href="http://www.codeproject.com/csharp/smarttemplateengine.asp" target="_blank">Write your own Code Generator or Template Engine in .NET</a></p>
<p><a href="http://www.codeproject.com/aspnet/smartcodegeneratorusage.asp" target="_blank">Smart Code Generator .NET: Usage Overview</a></p>
<p><a href="http://www.codeproject.com/aspnet/smartcodegenerator.asp" target="_blank">Smart Code Generator .NET: Architectural Overview</a><br />
<a href="http://www.codeproject.com/useritems/smartcodegeneratorconsole.asp" target="_blank">Smart Code Generator .NET: using with NAnt and Cassini</a></div>
<h3>Archives</h3>
<ul>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl01_Link" href="/shahed/archive/2008/06.aspx">June, 2008 (4)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl02_Link" href="/shahed/archive/2008/05.aspx">May, 2008 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl03_Link" href="/shahed/archive/2008/04.aspx">April, 2008 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl04_Link" href="/shahed/archive/2008/03.aspx">March, 2008 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl05_Link" href="/shahed/archive/2008/02.aspx">February, 2008 (6)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl06_Link" href="/shahed/archive/2008/01.aspx">January, 2008 (4)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl07_Link" href="/shahed/archive/2007/12.aspx">December, 2007 (1)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl08_Link" href="/shahed/archive/2007/11.aspx">November, 2007 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl09_Link" href="/shahed/archive/2007/10.aspx">October, 2007 (5)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl10_Link" href="/shahed/archive/2007/09.aspx">September, 2007 (5)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl11_Link" href="/shahed/archive/2007/07.aspx">July, 2007 (3)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl12_Link" href="/shahed/archive/2007/06.aspx">June, 2007 (1)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl13_Link" href="/shahed/archive/2007/05.aspx">May, 2007 (4)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl14_Link" href="/shahed/archive/2007/04.aspx">April, 2007 (6)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl15_Link" href="/shahed/archive/2007/03.aspx">March, 2007 (4)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl16_Link" href="/shahed/archive/2007/02.aspx">February, 2007 ( <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl17_Link" href="/shahed/archive/2007/01.aspx">January, 2007 (1 <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl18_Link" href="/shahed/archive/2006/12.aspx">December, 2006 (13)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl19_Link" href="/shahed/archive/2006/11.aspx">November, 2006 (23)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl20_Link" href="/shahed/archive/2006/10.aspx">October, 2006 (12)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl21_Link" href="/shahed/archive/2006/09.aspx">September, 2006 (11)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl22_Link" href="/shahed/archive/2006/08.aspx">August, 2006 (13)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl23_Link" href="/shahed/archive/2006/07.aspx">July, 2006 (5)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl24_Link" href="/shahed/archive/2006/06.aspx">June, 2006 (7)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl25_Link" href="/shahed/archive/2006/05.aspx">May, 2006 (5)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl26_Link" href="/shahed/archive/2006/04.aspx">April, 2006 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl27_Link" href="/shahed/archive/2006/03.aspx">March, 2006 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl28_Link" href="/shahed/archive/2006/02.aspx">February, 2006 (2)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl29_Link" href="/shahed/archive/2006/01.aspx">January, 2006 (6)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl30_Link" href="/shahed/archive/2005/12.aspx">December, 2005 ( <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl31_Link" href="/shahed/archive/2005/11.aspx">November, 2005 (6)</a></li>
<li><a id="SingleColumn1_Categories_CatList_ctl00_LinkList_ctl32_Link" href="/shahed/archive/2005/10.aspx">October, 2005 (21)</a></li>
</ul>
<h3>Free Programming Language Training</h3>
<ul>
<li><a id="SingleColumn1_Categories_CatList_ctl01_LinkList_ctl01_Link" href="http://geekswithblogs.net/freetraining/archive/2005/12/28/64295.aspx">Free Programming Language Training</a></li>
</ul>
</div>
</td>
<td class="MainCell">
<div id="main">
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl00_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/06/26.aspx">Thursday, June 26, 2008</a><br />
</span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl00_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/06/26/123391.aspx">ASP.NET tips: Golden rules for Dynamic Controls.</a></h2>
<p>1. Make sure your dynamic controls are Loaded on every postback.</p>
<p>Lets play with a very simple example,</p>
<p>ASPX</p>
<p>&lt;%@ Page Language=&#8221;C#&#8221; AutoEventWireup=&#8221;true&#8221; CodeFile=&#8221;Default.aspx.cs&#8221; Inherits=&#8221;_Default&#8221; %&gt;</p>
<p>&lt;body&gt;<br />
&lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;<br />
&lt;div&gt;<br />
&lt;asp:PlaceHolder ID=&#8221;PlaceHolder1&#8243; runat=&#8221;server&#8221;&gt;&lt;/asp:PlaceHolder&gt;<br />
&lt;asp:Button ID=&#8221;Button1&#8243; runat=&#8221;server&#8221; Text=&#8221;Button&#8221; /&gt;<br />
&lt;/div&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<p>C# Code Behind</p>
<p>public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
TextBox t = new TextBox();<br />
t.ID = &#8220;textBox&#8221;;<br />
this.PlaceHolder1.Controls.Add(t);<br />
}</p>
<p>}</p>
<p>The above code works fine, but a common mistake is to try to conditionally load dynamic controls, if we tweak the code a little bit you will notice we loose our TextBox after any postback. The following code will not load the TextBox after our first postback.</p>
<p>public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<strong>if (!IsPostBack)<br />
</strong> {<br />
TextBox t = new TextBox();<br />
t.ID = &#8220;textBox&#8221;;<br />
this.PlaceHolder1.Controls.Add(t);<br />
}<br />
}</p>
<p>}</p>
<p>Its recommended to load the dynamic controls during the Page_Init instead, because we may want to hook up our events with proper handler at an early stage.</p>
<p>public partial class _Default : System.Web.UI.Page<br />
{<br />
<strong>protected void Page_Init(object sender, EventArgs e)<br />
</strong> {<br />
TextBox t = new TextBox();<br />
t.ID = &#8220;textBox&#8221;;<br />
t.TextChanged+=new EventHandler(t_TextChanged);<br />
this.PlaceHolder1.Controls.Add(t);<br />
}</p>
<p>}</p>
<p>2. Do not assigning properties of a dynamic control (viewstate enabled), during Page_Init, it will not be reflected.</p>
<p>Here is scenario of another common mistake, &#8220;123&#8243; assigned to the Text property during Page_Init,</p>
<p>public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Init(object sender, EventArgs e)<br />
{<br />
TextBox t = new TextBox();<br />
t.ID = &#8220;textBox&#8221;;<br />
<strong>t.Text = &#8220;123&#8243;;<br />
</strong> this.PlaceHolder1.Controls.Add(t);<br />
}</p>
<p>}</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETtipsGoldenrulesforDynamicControl_14FD2/controllifecycle_2.png"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETtipsGoldenrulesforDynamicControl_14FD2/controllifecycle_thumb.png" border="0" alt="controllifecycle" width="108" height="244" /></a></p>
<p>the above code will not work because, Initialization happens before LoadViewState during the control lifecycle. The value assigned to the properties during Initialization will simply get overwritten by the ViewState values.</p>
<p>3. If you are expecting your ViewState to retain after the postback, always assign same ID to the dynamic control</p>
<p>The following piece of code will not work, as I am assigning a new ID to the dynamic control after each postback. The LoadViewState retrieves previously saved viewstate data using the control ID, as the control ID has changed, it doesn&#8217;t know anymore what to load, as a result it cannot load previously saved viewstate data any more.</p>
<p>public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Init(object sender, EventArgs e)<br />
{<br />
TextBox t = new TextBox();<br />
<strong> t.ID = Guid.NewGuid().ToString(); </strong><br />
this.form1.Controls.Add(t);<br />
}<br />
}</p>
<p>Thank you for being with me so far.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/06/26/123391.aspx">Thursday, June 26, 2008 2:36 AM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/06/26/123391.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl01_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/06/17.aspx">Tuesday, June 17, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl01_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/06/17/122926.aspx">ASP.NET tips, Making Custom Validators work in Partial Rendering mode.</a></h2>
<p><strong>Introduction<br />
</strong><br />
There are many situations where we need to identify if partial rendering is supported in a page, especially when a control uses javascript, to get the control work in partial rendering mode, the script needs to be registered using a ScriptManager Type instead. A classic example will be Validators.</p>
<p>The ASP.NET Page class exposes the Validators property, which is a list of all the IValidator types on the page. A page keeps track of its validators, and registers a javascript array of validators automatically to the page. Example, When we add 3 RequiredFieldValidator in a page the following javascript Array will be automatically generated and added in our page automatically during the page load.</p>
<p>Page_Validators = new Array(document.getElementById(&#8221;RequiredFieldValidator1&#8243;),<br />
document.getElementById(&#8221;RequiredFieldValidator2&#8243;),<br />
document.getElementById(&#8221;RequiredFieldValidator3&#8243;));</p>
<p>The ASP.NET Page also registers couple of other script which eventually hooks up different events ( onclick, onkeypress, onchange, onblur ) to the the target control (ControlToValidate), to some predefined javascript functions that resides in WebUIValidation.js file. So when we add a validator in our Page we also notice the following script is automatically added. [WebUIValidation.js ships with ASP.NET and resides in the following folder "/aspnet_client/system_web/&lt;version&gt;/WebUIValidation.js".]</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
&lt;!&#8211;<br />
var Page_ValidationActive = false;<br />
if (typeof(ValidatorOnLoad) == &#8220;function&#8221;) {<br />
ValidatorOnLoad();<br />
}</p>
<p>function ValidatorOnSubmit() {<br />
if (Page_ValidationActive) {<br />
return ValidatorCommonOnSubmit();<br />
}<br />
else {<br />
return true;<br />
}<br />
}<br />
// &#8211;&gt;<br />
&lt;/script&gt;</p>
<p>ValidatorOnLoad plays the big role of hooking up the the events mentioned above, and here is a code snippet from this function,</p>
<p>for (i = 0; i &lt; Page_Validators.length; i++) {<br />
val = Page_Validators[i];<br />
if (typeof(val.evaluationfunction) == &#8220;string&#8221;) {<br />
eval(&#8221;val.evaluationfunction = &#8221; + val.evaluationfunction + &#8220;;&#8221;);<br />
}<br />
&#8230;</p>
<p>if (typeof(val.controltovalidate) == &#8220;string&#8221;) {<br />
ValidatorHookupControlID(val.controltovalidate, val);<br />
}<br />
&#8230;<br />
}</p>
<p>keen eyes may have already noticed the val.evaluationfunction property, yes every validators needs to have this property for it to work properly under the ASP.NET validation framework. Custom validators takes advantage of this property to point to custom js functions. Custom validator developers normally use RegisterExpandoAttribute method to register this attribute.</p>
<p>protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)<br />
{<br />
base.AddAttributesToRender(writer);<br />
if (this.RenderUplevel)<br />
{<br />
string clientID = this.ClientID;<br />
Page.ClientScript.RegisterExpandoAttribute(clientID, &#8220;evaluationfunction&#8221;, &#8220;EntryValidatorEvaluateIsValid&#8221;);<br />
}<br />
}</p>
<p><strong>Problem</strong><br />
When I used Update Panel with partial rendering enabled the Page.ClientScript.RegisterExpandoAttribute did not work for me. My validators always stopped working after the first postback, which was performed via partial rendering and triggering. I found the &#8220;evaluationfunction&#8221; in the javascript to be undefined.</p>
<p><strong>Solution</strong><br />
I started looking under the hood, and soon discovered, that the ASP.NET Validators that ships out of the box, ( eg. RangeValidator, RequiredFieldValidator ) uses a different internal method &#8220;AddExpandoAttribute&#8221; to register the property. Here is a code snippet from the RangeValidator.</p>
<p>protected override void AddAttributesToRender(HtmlTextWriter writer)<br />
{<br />
base.AddAttributesToRender(writer);<br />
if (base.RenderUplevel)<br />
{<br />
string clientID = this.ClientID;<br />
HtmlTextWriter writer2 = base.EnableLegacyRendering ? writer : null;<br />
base.AddExpandoAttribute(writer2, clientID, &#8220;evaluationfunction&#8221;, &#8220;RangeValidatorEvaluateIsValid&#8221;, false);<br />
&#8230;<br />
}<br />
}</p>
<p>and code snippet from BaseValidator, the internal method AddExpandoAttribute.</p>
<p>internal void AddExpandoAttribute(HtmlTextWriter writer, string controlId, string attributeName, string attributeValue, bool encode)<br />
{<br />
AddExpandoAttribute(this, writer, controlId, attributeName, attributeValue, encode);<br />
}</p>
<p>After digging further I realized, AddExpandoAttribute checks the ASP.Page whether partial rendering is supported, then it registers the attribute using ScriptManager instead. I did the same with my validation control and it works for me. Here is the piece of code that solved my problem.</p>
<p>protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)<br />
{<br />
base.AddAttributesToRender(writer);<br />
if (this.RenderUplevel)<br />
{<br />
string clientID = this.ClientID;<br />
if (!this.IsPartialRenderingSupported)<br />
{<br />
Page.ClientScript.RegisterExpandoAttribute(clientID, &#8220;evaluationfunction&#8221;, &#8220;EntryValidatorEvaluateIsValid&#8221;);<br />
}<br />
else<br />
{<br />
Type scriptManagerType = BuildManager.GetType(&#8221;System.Web.UI.ScriptManager&#8221;, false);<br />
scriptManagerType.InvokeMember(&#8221;RegisterExpandoAttribute&#8221;, BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, null, new object[] { this, clientID, &#8220;evaluationfunction&#8221;, &#8220;QuantityEntryValidatorEvaluateIsValid&#8221;, false });<br />
}<br />
}<br />
}</p>
<p>Note, the I am first checking whether Partial Rendering is Supported and using the ScriptManager  Type to register the property instead.</p>
<p>The following piece of code uses Reflection to figure out whether partial rendering is supported.</p>
<p>internal bool IsPartialRenderingSupported<br />
{<br />
get<br />
{<br />
if (!this.PartialRenderingChecked)<br />
{<br />
Type scriptManagerType = BuildManager.GetType(&#8221;System.Web.UI.ScriptManager&#8221;, false);<br />
if (scriptManagerType != null)<br />
{<br />
object obj2 = this.Page.Items[scriptManagerType];<br />
if (obj2 != null)<br />
{<br />
PropertyInfo property = scriptManagerType.GetProperty(&#8221;SupportsPartialRendering&#8221;);<br />
if (property != null)<br />
{<br />
object obj3 = property.GetValue(obj2, null);<br />
this.IsPartialRenderingEnabled = (bool)obj3;<br />
}<br />
}<br />
}<br />
this.PartialRenderingChecked = true;<br />
}<br />
return this.IsPartialRenderingEnabled;<br />
}</p>
<p>}</p>
<p>private bool PartialRenderingChecked<br />
{<br />
get<br />
{<br />
object val = ViewState["PartialRenderingChecked"];<br />
if (val != null)<br />
return (bool)val;<br />
return false;<br />
}<br />
set<br />
{<br />
ViewState["PartialRenderingChecked"] = value;<br />
}<br />
}</p>
<p>private bool IsPartialRenderingEnabled<br />
{<br />
get<br />
{<br />
object val = ViewState["IsPartialRenderingEnabled"];<br />
if (val != null)<br />
return (bool)val;<br />
return false;<br />
}<br />
set<br />
{<br />
ViewState["IsPartialRenderingEnabled"] = value;<br />
}<br />
}</p>
<p><strong>Conclusion</strong></p>
<p>The Page.ClientScript.RegisterExpandoAttribute may not work in Partial Rendiring mode, when a postback is performed via triggering,<br />
to get this work we need to determine whether partial rendering is supported and use the ScriptManager Type instead like described above.</p>
<p>Hope this helps, and saves some of your time, Thank you for being with me so far.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/06/17/122926.aspx">Tuesday, June 17, 2008 5:43 AM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/06/17/122926.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl02_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/06/11.aspx">Wednesday, June 11, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl02_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/06/11/122791.aspx">C# 3.0 tips, Automatic Property</a></h2>
<p>Declaring a property in C# 3.0 is super easy and super short.</p>
<p>public class Student<br />
{<br />
public string Name {  get; set; }<br />
}</p>
<p>yes that&#8217;s it, the framework will take care of the rest, the private variables will be automatically created and the getter and setter will be automatically implemented.</p>
<p>Here is how we can assign value to an automatic property via the constructor</p>
<p>public class Student<br />
{<br />
public string Name {  get; set; }<br />
public Student (string name)<br />
{</p>
<p>this.Name = name;</p>
<p>}<br />
}</p>
<p>And finally, here is how we can declare a Readonly property</p>
<p>public class Student<br />
{</p>
<p>public string Name {  get; private set; }</p>
<p>public Student (string name)<br />
{</p>
<p>this.Name = name;</p>
<p>}<br />
}</p>
<p>Hope this helps, Enjoy coding.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/06/11/122791.aspx">Wednesday, June 11, 2008 12:21 AM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/06/11/122791.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl03_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/06/09.aspx">Monday, June 09, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl03_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/06/09/122751.aspx">System.Net.WebClient().DownloadString(url) for Web Scrapeing</a></h2>
<p>WebRequest is the abstract base class for the .NET Framework&#8217;s request/response model for accessing data from the Internet.</p>
<p>To get content of a website, in .NET 1.0. we used to use WebRequest, which is good and also works asynchronously.</p>
<p>public static string GetContent(string url)<br />
{<br />
System.Net.WebRequest request = System.Net.WebRequest.Create(url);<br />
using (System.Net.WebResponse response = request.GetResponse())<br />
{<br />
using (System.IO.StreamReader reader =new System.IO.StreamReader(response.GetResponseStream()))<br />
{<br />
return reader.ReadToEnd();<br />
}<br />
}<br />
}</p>
<p>But in .NET 2.0, we can also use the WebClient class. It can also work asynchronous and works the same as the other one.</p>
<p>public static string GetContent(string url)<br />
{<br />
using (System.Net.WebClient client =new System.Net.WebClient())<br />
{<br />
return client.DownloadString(url);<br />
}<br />
}</p>
<p>We can use any of the above method for web scrapeing in .NET. But the second approach is probably more cleaner.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/06/09/122751.aspx">Monday, June 09, 2008 3:28 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/06/09/122751.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl04_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/05/23.aspx">Friday, May 23, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl04_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/05/23/122369.aspx">Project SOAK winner of 2008 Imagine Cup Australia.</a></h2>
<p>The theme of this year’s <a href="http://www.imaginecup.com">Imagine Cup</a> is &#8220;<strong>Imagine a world where technology enables a sustainable environment</strong>.&#8221; It had been a great honorary for me to take part as one the Judges of the 2008 Imagine Cup Australia. All the teams worked real hard and came up with breathtaking solutions. The interesting part was  solutions were built on top of cutting edge technologies technologies ie. Silverlight, Virtual Earth, LINQ, ASP.NET 3.5, WCF, .NET 3.5 and SQL2005.</p>
<p>The Project SOAK is announced the winner of Australian Imagine Cup 08. SOAK which stands for “Smart Operational Agriculture toolKit” is an integrated hardware and softwares platform that aims to help farmers make the most of the water (and other) resources on their land. It does this through an integration of a wide range of sensors which gathers data about the environment in real time, provide rich visual information to end-user about the status of the farm, and electronically controls various systems such as sprinklers. The team members of SOAK blogged more about the project, can be found here</p>
<p><a title="http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/" href="http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/">http://davidburela.wordpress.com/2008/05/22/2008-imagine-cup-australian-winner-project-soak/</a></p>
<p><a title="http://www.istartedsomething.com/20080523/imagine-cup-australian-winner-project-soak/" href="http://www.istartedsomething.com/20080523/imagine-cup-australian-winner-project-soak/">http://www.istartedsomething.com/20080523/imagine-cup-australian-winner-project-soak/</a></p>
<p><a href="http://apcmag.com/imagine_cups_surprise_winners_a_boon_for_farmers.htm">Australian PC Magazine has just published</a> published a very insightful story on this project and the competition</p>
<p><img src="http://apcmag.com/images/apcapc/news/imcup_map_625.jpg" alt="" /></p>
<p>I found SOAK to be a brilliant piece of work, where the team combined latest technologies together and came up with a environment friendly cost effective solution.</p>
<p>The winning team will now represent Australia at the World Imagine Cup finals in Paris in July.</p>
<p><img src="http://apcmag.com/images/apcapc/news/imcup_team625.jpg" alt="" /><br />
<strong><br />
Imagine Cup 2008 - Australia - Judging Panel<br />
</strong><br />
<img src="http://apcmag.com/images/apcapc/news/imcup_judges_625.jpg" alt="" /></p>
<p>The Imagine Cup’s judging panel consisted of Roger Lawrence, Microsoft Australia’s Manager Developer Evangelism; Nigel Watson, Microsoft Australia Architect Evangelist; Shekhar Kalra, computer science lecturer at RMIT University; Shahed Khan, Senior Software Engineer at Ocean Informatics MVP C#.NET, and APC, represented by its editor, Tony Sarno.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/05/23/122369.aspx">Friday, May 23, 2008 11:41 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/05/23/122369.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl05_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/05/03.aspx">Saturday, May 03, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl05_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/05/03/121869.aspx">ASP.NET Bug, Multi View control do not save ViewState, of dynamically added controls</a></h2>
<p>Couple of days back me and my colleague, we discovered an issue with the ASP.NET Multi View Control.<br />
We were surprised  to see that it do not add ViewState, of the dynamically added controls, of the Inactive Tabs.</p>
<p><strong>ASP.NET 2.0 </strong></p>
<p>&lt;asp:MultiView ID=&#8221;MultiView1&#8243; runat=&#8221;server&#8221; EnableViewState=&#8221;true&#8221;&gt;<br />
&lt;/asp:MultiView&gt;</p>
<p><strong>C# Code Behind</strong></p>
<p>if (!IsPostBack)<br />
{<br />
int index = 1;<br />
foreach (View v in MultiView1.Views)<br />
{<br />
TextBox t = new TextBox();<br />
t.ID = index.ToString();<br />
t.Text = &#8220;<strong>This text will not be assigned, to any Inactive Tabs, unless you put a breakpoint on this line and watch the value of this line explicitly</strong>&#8220;;<br />
v.Controls.Add(t);<br />
index = index + 1;<br />
}<br />
}</p>
<p>Surprisingly, you will notice only the Textbox.Text of the Active Tab will have value,<br />
however if you go to any other Tab of the MultiViewControl, you will notice that the TextBoxes are empty.</p>
<p>After investigating further we realized that the Viewstates of the dynamically added controls are not saved (for any of the inactive tabs).<br />
It became more interesting, when we started to debug, by putting a breakpoint to watch TextBox.Text, surprisingly every TextBox gets populated with desired Text ( for all tabs including the inactive tab, only when you explicitly watch ). Also it saves all ViewState correctly.</p>
<p>Not sure whether its a bug,  the ASP.NET team may have wanted this behavior to enhance performance of the Multi View control,</p>
<p>but if that is the case, why does it populate the TextBox.Text and also saves into Viewstate, when we try to debug !!!</p>
<p>Do not believe me?  Try it by yourself !!</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/05/03/121869.aspx">Saturday, May 03, 2008 3:31 AM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/05/03/121869.aspx#feedback">Feedback (1)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl06_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/04/28.aspx">Monday, April 28, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl06_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/04/28/121739.aspx">ASP.NET in VISTA ( IIS7 ) with VS2005 or VS2008</a></h2>
<p>The following 2 links may help.</p>
<p>VS 2005: <a href="http://learn.iis.net/page.aspx/431/using-visual-studio-2005-with-iis-70/">http://learn.iis.net/page.aspx/431/using-visual-studio-2005-with-iis-70/</a><br />
VS 2008: <a href="http://learn.iis.net/page.aspx/387/using-visual-studio-2008-with-iis-70/">http://learn.iis.net/page.aspx/387/using-visual-studio-2008-with-iis-70/</a></p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/04/28/121739.aspx">Monday, April 28, 2008 4:13 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/04/28/121739.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl07_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/04/12.aspx">Saturday, April 12, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl07_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/04/12/121211.aspx">ASP.NET Tips: Using Image as Embedded Resource for ASP.NET CustomControl</a></h2>
<h3>Problem</h3>
<p>I started writing an ASP.NET Custom Server Control, where I wanted an Image to be Embedded Resource of the Assembly itself,<br />
so that, I do not need to ship the images separately, but surprisingly it did not work straightway for me.</p>
<p>The following line was not working for me:<br />
writer.AddAttribute(HtmlTextWriterAttribute.Src, Page.ClientScript.GetWebResourceUrl(typeof(MyControls.MyImageControl), &#8220;ferrari.jpg&#8221;));</p>
<p>Ok, lets elaborate what I did and what I missed,</p>
<p><strong>Step 1</strong>, I created my ClassLibrary project, added an Image, added a Custom Control class.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image1_4.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image1_thumb_1.gif" border="0" alt="Image1" width="216" height="138" /></a></p>
<p><strong>Step 2</strong>, Made the image an embedded resource of the Assembly.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image2_4.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image2_thumb_1.gif" border="0" alt="Image2" width="398" height="346" /></a></p>
<p><strong>Step3</strong>, Written my very simple Custom Control, where I assigned the image &#8220;src&#8221; to the WebResource URL</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image3_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image3_thumb.gif" border="0" alt="Image3" width="720" height="267" /></a></p>
<p>Step 4, Then I wanted to tryout this CustomControl in my Test Website</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image5_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image5_thumb.gif" border="0" alt="Image5" width="663" height="308" /></a></p>
<p>Step 5, But I got the following result.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image4_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image4_thumb.gif" border="0" alt="Image4" width="235" height="207" /></a><br />
<a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image6_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image6_thumb.gif" border="0" alt="Image6" width="706" height="306" /></a></p>
<h3>Solution</h3>
<p>After investigating a bit, I realized I missed some critical bits.</p>
<p>1. I did not put the correct Resource URL. I discovered this by opening up the assembly via Reflector, I found that the resource URL is different than what I have put in my code.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image8_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image8_thumb.gif" border="0" alt="Image8" width="359" height="299" /></a></p>
<p>I corrected the resource URL in my code, (but still it did not work).</p>
<p>writer.AddAttribute(HtmlTextWriterAttribute.Src,<br />
Page.ClientScript.GetWebResourceUrl(typeof(MyControls.MyImageControl),<br />
&#8220;MyControls.images.ferrari.jpg&#8221;));</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image9_4.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image9_thumb_1.gif" border="0" alt="Image9" width="696" height="261" /></a></p>
<p>2. I investigated further and found that I did not explicitly declare the image as WebResource in my assembly info . To get the embedded resource bit working, the following line is very important, and this solved my problem.</p>
<p>[assembly: System.Web.UI.WebResource("MyControls.images.ferrari.jpg", "image/jpg")]</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image7_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image7_thumb.gif" border="0" alt="Image7" width="710" height="397" /></a></p>
<p>Note: We can also put this directly in the class file itself.</p>
<p>After the fix I got the following result as I have desired.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image10_2.gif"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image10_thumb.gif" border="0" alt="Image10" width="228" height="244" /></a></p>
<h3>Summary</h3>
<p>I have discussed here, how to embed image in an Assembly and how to use it as WebResource. Two points to note here, which are<br />
1. After embedding a resource it is very important to explicitly declare itself as WebResource in the assembly,<br />
2. We need correct resourceURL to access resouces from the assembly. Note: its case-sensitive as well.</p>
<p>I hope this discussion will save you some time. Thank you for being with me so far.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/04/12/121211.aspx">Saturday, April 12, 2008 8:45 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/04/12/121211.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl08_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/03/22.aspx">Saturday, March 22, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl08_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/03/22/120709.aspx">DataTable to JSON and ToJSON() Extension</a></h2>
<p>Very recently I wrote an application where I had to deal with DataSet from a Web Service.</p>
<p>Please note, I have no control on the Web Service and I ended up writing a small function which converts DataTable to JSON.</p>
<p>I understand I haven&#8217;t gain anything on the web traffic, but it surely simplified my JavaScript programming.</p>
<p>Let me go through what I did</p>
<p><strong>Step 1.  Extract the XML Schema. </strong><br />
DataTable has two handy methods to extract Xml and Xml Schema. I extracted the Xml Schema to be able to generate a C# class using the xsd.exe.</p>
<p>string path = &#8220;Your File Path&#8221;;<br />
myDataTable.WriteXml(path);<br />
myDataTable.WriteXmlSchema(path);</p>
<p><strong>Step 2. Generate C# Class using Xsd.exe that ships with the .NET Framework.</strong></p>
<p>C:\temp&gt;xsd mydatatable.xsd /l:cs /c<br />
Microsoft (R) Xml Schemas/DataTypes support utility<br />
[Microsoft (R) .NET Framework, Version 2.0.50727.42]<br />
Copyright (C) Microsoft Corporation. All rights reserved.<br />
Writing file &#8216;C:\temp\mydatatableclass.cs&#8217;.</p>
<p><strong>Step 3. DataTable to Object conversion</strong></p>
<p>The Web Service returns DataSet/ DataTable, and I want to transform all data that I I receive in the DataTable, to an instance of the class that I just generated in the above step.  Something like this:</p>
<p>private T DataTableToT&lt;T&gt;(DataTable dataTable, T obj)<br />
{<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
dataTable.WriteXml(ms);<br />
Type thetype = obj.GetType();<br />
XmlSerializer x = new XmlSerializer(thetype);<br />
ms.Position = 0;<br />
return (T)x.Deserialize(ms);<br />
}<br />
}</p>
<p>The above method uses the WriteXml() to write the data of DataTable in to a MemoryStream, then using the XmlSerializer I deserialize the xml to a .NET object. Here is how we may use the this method:</p>
<p>DataSet ds = WebService.GetDataSet();<br />
DataTable myDataTable = ds.Tables[0];<br />
MyDataTableClass obj = DataTableToT(myDataTable, new MyDataTableClass());</p>
<p><strong>Step 4. Serialize .NET object to JSON<br />
</strong><br />
We have done the hard part above, now we have .NET object so we have all the flexibility as you can imagine. I found that there is a handful amount of libraries which can serialize .Net Objects to JSON string ie. JavaScriptSerializer, DataContractJsonSerializer, JSON.NET etc.</p>
<p>JavaScriptSerializer ships with System.Web.Extensions.dll and you can locate it under Namespace:  System.Web.Script.Serialization. The following method returns JSON from a .NET object using JavaScriptSerializer.</p>
<p>private string GetJSONUsingJavaScriptSerializer&lt;T&gt;(T obj)<br />
{<br />
JavaScriptSerializer serializer = new JavaScriptSerializer();<br />
string json =   serializer.Serialize(obj);<br />
return json;<br />
}</p>
<p>DataContractJsonSerializer also does pretty much the same as above, it ships with .NET Framework 3.5 :  System.ServiceModel.Web.dll, and you can locate this under  Namespace:  System.Runtime.Serialization.Json, But we need to decorate the class with DataContract and DataMember attributes. Example</p>
<p>[DataContract]<br />
class Order<br />
{<br />
[DataMember]<br />
public int OrderID { get; set; }<br />
[DataMember]<br />
public DateTime OrderDate { get; set; }<br />
}</p>
<p>and the following method can return a JSON string.</p>
<p>private string GetJSONUsingDataContractJsonSerializer&lt;T&gt;(T obj)<br />
{<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());<br />
serializer.WriteObject(ms, obj);<br />
return Encoding.UTF8.GetString(ms.ToArray());<br />
}<br />
}</p>
<p><strong>Conclusion<br />
</strong><br />
Here we have discussed how we can easily transform a DataTable to JSON. Sometimes we do not have enough control over the Web Service, or we may need to invoke a legacy Web Service that returns DataSet/ DataTable. In those scenarios sometimes converting DataTable to JSON comes very handy in AJAX programming. In the above example I have shown plain vanilla .NET methods, but we can even take it further and implement Extention methods to return JSON string. <a href="http://weblogs.asp.net/scottgu/archive/2007/10/01/tip-trick-building-a-tojson-extension-method-using-net-3-5.aspx">Scott</a> has shown in his blog how to produce JSON using JavascriptSerializer. Here I show how we can do the same using DataContractJsonSerializer.</p>
<p>Example:</p>
<p>public static string ToJSON&lt;T&gt;(this T obj)<br />
{<br />
using (MemoryStream ms = new MemoryStream())<br />
{<br />
DataContractJsonSerializer serializer = new DataContractJsonSerializer(obj.GetType());<br />
serializer.WriteObject(ms, obj);<br />
return Encoding.UTF8.GetString(ms.ToArray());<br />
}<br />
}</p>
<p>and then we will be able to use it like this on a order collection,</p>
<p>string json = orders.ToJSON();</p>
<p>Hope this helps.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/03/22/120709.aspx">Saturday, March 22, 2008 5:31 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/03/22/120709.aspx#feedback">Feedback (1)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl09_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/03/18.aspx">Tuesday, March 18, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl09_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/03/18/120628.aspx">Visual Studio 2005 Debugging in Vista</a></h2>
<p><strong>Problem</strong>: I was trying to debug in Visual Studio 2005 in my new machine which came with Vista Home Premium. Surprisingly I found that none of the break points are touched and I cannot debug. I tried giving all types of permission to the folder but no luck.</p>
<p><strong>Solution</strong>: After googling a bit, I found that I needed to run VisualStudio2005 as an Administrator, and everything started working as I expected.</p>
<p>So all I had to do is :<br />
<em>Right-click the Visual Studio icon and select the &#8220;Run as administrator&#8221; option from the context menu.</em></p>
<p><strong><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/VisualStudio2005DebugginginVista_BFF5/vs05run_2.jpg"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/VisualStudio2005DebugginginVista_BFF5/vs05run_thumb.jpg" border="0" alt="vs05run" width="175" height="244" /></a></strong></p>
<p><strong></strong></p>
<p>Hope this saves some of your time.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/03/18/120628.aspx">Tuesday, March 18, 2008 2:39 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/03/18/120628.aspx#feedback">Feedback (1)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl10_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/02/21.aspx">Thursday, February 21, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl10_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/02/21/119884.aspx">Javascript Tips: Carefully use &#8220;this&#8221; when writing classes, else you may cause memory leak.</a></h2>
<p>Lets say we want to declare a class in Javascript, which is equivalent to the following C# class.</p>
<pre><span class="kwrd">public</span> <span class="kwrd">class</span> Student
{
  <span class="kwrd">public</span> <span class="kwrd">string</span> FirstName = <span class="str">""</span>;
  <span class="kwrd">public</span> <span class="kwrd">string</span> LastName = <span class="str">""</span>;

  <span class="kwrd">public</span> Student( <span class="kwrd">string</span> firstname, <span class="kwrd">string</span> lastname)
  {
    <span class="kwrd">this</span>.FirstName = firstname;
    <span class="kwrd">this</span>.LastName = lastname;
  }

  <span class="kwrd">public</span> <span class="kwrd">string</span> GetFullName()
  {
    <span class="kwrd">return</span> FirstName + LastName;
  }
}</pre>
<p>&lt;!&#8211; </p>
<p>To write a similar class in JavaScript we can do something like the following [ but this will create memory leak, I am explaining that in a moment ]</p>
<pre><span class="kwrd">function</span> Student ( firstname, lastname)
{
  <span class="kwrd">this</span>.FirstName = firstname;
  <span class="kwrd">this</span>.LastName = lastname;

  <span class="kwrd">this</span>.GetFullName = <span class="kwrd">function</span>()
  {
    <span class="kwrd">return</span> <span class="kwrd">this</span>.FirstName + <span class="kwrd">this</span>.LastName;
  }

}</pre>
<pre>now in C# if we want to instantiate an object of Student and want to call the GetFullName() method, we do the following.</pre>
<pre>Student student = <span class="kwrd">new</span> Student(<span class="str">"Shahed"</span>, <span class="str">"Khan"</span>);
<span class="kwrd">string</span> fullname = student.GetFullName();</pre>
<p>&lt;!&#8211; </p>
<p>and we can create as many objects as we want and call its methods, each of the object will maintain its own state, and all objects will use the same copy of the GetFullName()  method.</p>
<p>But Javascript has different behaviour when we do the following on the above Javascript class.</p>
<pre><span class="kwrd">var</span> student = <span class="kwrd">new</span> Student(<span class="str">"Shahed"</span>,<span class="str">"Khan"</span>);
car fullname = student.GetFullName();</pre>
<p>&lt;!&#8211;<br />
In Javascript, functions are treated as variables as a result when we create a new object of Student it creates  new sets of firstname, lastname and also a new copy of GetFullname method, as a result we are creating memoryleak.</p>
<p>Do not worry too much, there is a workaround for this, lets redefine the class in a different way.</p>
<pre><span class="kwrd">function</span> Student ( firstname, lastname)
{
  <span class="kwrd">this</span>.FirstName = firstname;
  <span class="kwrd">this</span>.LastName = lastname;

  <span class="kwrd">this</span>.GetFullName = GetFullName;

}

<span class="kwrd">function</span> GetFullName()
{
  <span class="kwrd">return</span> <span class="kwrd">this</span>.FirstName + <span class="kwrd">this</span>.LastName;
}</pre>
<p>&lt;!&#8211; </p>
<p>Notice I have moved the GetFullName function out of the class, and for this tweaking all new objects of the Student class will share the same instance of of GetFullName method and avoid memory leak.</p>
<p>Thank you for being with me so far.</p>
<p>Updated 24th Feb</p>
<p>===============</p>
<p>Laurent from Galasoft gave some good feedback,</p>
<p>JavaScript object oriented should be done by modifying the prototype property of the object, and never by storing methods using the &#8220;this&#8221; keyword. The workaround provided above is not good practice, as it forces the use of a global function. We should always declare methods in JavaScript object like this:</p>
<p>function Student(firstName, lastName)</p>
<p>{</p>
<p>this.firstName = firstName;</p>
<p>this.lastName = lastName;</p>
<p>}</p>
<p>Student.prototype =</p>
<p>{</p>
<p>getFullName : function()</p>
<p>{</p>
<p>return this.firstName + &#8221; &#8221; + this.lastName;</p>
<p>}</p>
<p>}</p>
<p>also note correct naming convension, ( Javascript follows Java notation not C#). For JavaScript best practices please refer to the work of Microsoft Silverlight team.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/02/21/119884.aspx">Thursday, February 21, 2008 5:38 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/02/21/119884.aspx#feedback">Feedback (1)</a> |</p>
</div>
<p class="date">
<p><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl11_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/02/19.aspx">Tuesday, February 19, 2008</a><br />
</span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl11_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/02/19/119788.aspx">Solving DNN deployment issues, Redirecting to localhost and Running DNN in a different port</a></h2>
<p>I was trying to host a small DNN application in one of our Server and I was facing couple of  issues.</p>
<p><strong>Problem 1:</strong><br />
The first problem I faced is it was always redirecting to localhost, whenever I tried <a href="http://domain.com/dnn">http://domain.com/dnn</a> it was redirecting to <a href="http://localhost/dnn">http://localhost/dnn</a> as a result the site was un-accessible from outside.</p>
<p><strong>Solution</strong></p>
<p>This was easy to solve.<br />
1. I needed to log in as host account.<br />
2. Then I needed to go to the Admin &gt; Site Settings page<br />
3. And finally In the Portal Alias section I added a new Http Alias &#8220;domain.com/dnn&#8221;</p>
<p>This solved my problem when I hosted the site in port 80.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B14%5D.jpg"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B14%5D_thumb.jpg" border="0" alt="clip_image002[14]" width="404" height="247" /></a></p>
<p><strong>Problem 2:</strong></p>
<p>Now I tried to host the application in a different port 8080. I.e. <a href="http://domain.com:8080/dnn">http://domain.com:8080/dnn</a>. and somehow when I clicking to redirect to any other page the port started to disappear. The <a href="http://domain.com:8080/">http://domain.com:8080/</a> automatically turned to http://domain.com/ .</p>
<p><strong>Solution</strong></p>
<p>After googling and looking at the web.config carefully I found, its clearly documented in web.config that</p>
<p>&lt;!&#8211; set UsePortNumber to true to preserve the port number if you&#8217;re using a port number other than 80 (the standard)<br />
&lt;add key=&#8221;UsePortNumber&#8221; value=&#8221;true&#8221; /&gt; &#8211;&gt;</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B12%5D.jpg"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B12%5D_thumb.jpg" border="0" alt="clip_image002[12]" width="404" height="301" /></a></p>
<p>I tweaked my appsettings section  and added the magic key</p>
<p>&lt;add key=&#8221;UsePortNumber&#8221; value=&#8221;true&#8221; /&gt;</p>
<p>Also I had to add a new Http Alias &#8220;domain.com:8080&#8243;</p>
<p>This solved my problem and started retaining the port for my <a href="http://localhost:8080">http://localhost:8080</a> but not <a href="http://domain.com:8080">http://domain.com:8080</a>.  The <a href="http://domain.com:8080">http://domain.com:8080</a> was still turning to <a href="http://domain.com">http://domain.com</a></p>
<p>Note: I later discovered this was not a problem of DNN and the issue happened because of the setup of our router settings and port forwarding, which I&#8217;ll discuss next.</p>
<p><strong>Problem 3:</strong><br />
Even after adding the &#8220;UsePortNumber&#8221; key it did not solve my problem</p>
<p><strong>Solution</strong></p>
<p>Our Router was Port Forwarding all traffic of 8080 to the port 80 of the machine where DNN app is hosted. I.e. 8080 &#8211;&gt; 80. As a result even from a browser I as typing <a href="http://domain.com:8080">http://domain.com:8080</a> , the DNN Request object was getting <a href="http://domain.com">http://domain.com</a> and when DNN handlers and url rewriters spitting the reformatted url it was spitting <a href="http://domain.com">http://domain.com</a>.</p>
<p>This was a big problem for me, initially I thought I would write a HttpHandler for 404 page not found, but soon realized it will never hit the server with the spitted Url so that didn&#8217;t work. Then I thought I would tweak the DNN handlers to handle this scenario, but later tweaked the IIS and Router to handle this.</p>
<p>1. In IIS I added, support for 8080  to my Default Website.</p>
<p><a href="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002_2.jpg"><img style="border-width:0;" src="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002_thumb.jpg" border="0" alt="clip_image002" width="404" height="454" /></a></p>
<p>2. In Router instead of forwarding to port 80 I started forwarding 8080 to 8080.<br />
3. Made sure that in my DNN Site Settings, I have added Http Alias &#8220;domain.com:8080/dnn&#8221;.</p>
<p>Waaa la, This solved my issue.</p>
<p>Hope this helps and Thank you for being with me so far.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/02/19/119788.aspx">Tuesday, February 19, 2008 5:14 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/02/19/119788.aspx#feedback">Feedback (2)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl12_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/02/14.aspx">Thursday, February 14, 2008</a></span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl12_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/02/14/119587.aspx">Dotnet Nuke Tips: Two common error while writing the SqlDataProvider</a></h2>
<p>Two common errors done while writing the SqlDataProvider SQL for Dotnet Nuke Modules are</p>
<p>1. Not saving the file that contains SqlDataProvider SQL codes in the correct format. A quick trick is to open the files in NotePad and save them as &#8220;Unicode&#8221;.</p>
<p>2. Not putting atleast 2 line breaks after each GO statement in the SQLDataProvider SQL code.</p>
<p>Hope this helps.</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/02/14/119587.aspx">Thursday, February 14, 2008 1:00 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/02/14/119587.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl13_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/02/06.aspx">Wednesday, February 06, 2008</a><br />
</span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl13_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/02/06/119363.aspx">LINQ Tips: Implementing IQueryable Provider</a></h2>
<p>Check out the following from Matt Warrens blog posts, if you are interested on how to implement IQueryable Provider.</p>
<p>source: <a title="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx" href="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx">http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx</a></p>
<p><a href="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx">Part I - Reusable IQueryable base classes</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/07/31/linq-building-an-iqueryable-provider-part-ii.aspx">Part II - Where and reusable Expression tree visitor</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/08/01/linq-building-an-iqueryable-provider-part-iii.aspx">Part II - Local variable references</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/08/02/linq-building-an-iqueryable-provider-part-iv.aspx">Part IV - Select</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx">Part V - Improved Column binding</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/08/09/linq-building-an-iqueryable-provider-part-vi.aspx">Part VI - Nested queries</a><br />
<a href="http://blogs.msdn.com/mattwar/archive/2007/09/04/linq-building-an-iqueryable-provider-part-vii.aspx">Part VII - Join and SelectMany</a></p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/02/06/119363.aspx">Wednesday, February 06, 2008 5:50 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/02/06/119363.aspx#feedback">Feedback (0)</a> |</p>
</div>
<p class="date"><span><br />
<a id="_a838cec9bce_HomePageDays_DaysList_ctl14_DayItem_ImageLink" title="Click to see entries for this day." href="/shahed/archive/2008/02/05.aspx">Tuesday, February 05, 2008</a><br />
</span></p>
<div class="post">
<h2><a id="_a838cec9bce_HomePageDays_DaysList_ctl14_DayItem_DayList_ctl00_TitleUrl" title="Click To View Entry." href="/shahed/archive/2008/02/05/119321.aspx">LINQ Tips: Querying ArrayList via LINQ</a></h2>
<p><strong>Problem</strong><br />
If you try to query an ArrayList via LINQ you might be surprised to see that its not supported and throwing an exception. In other words the following query will not work at all.</p>
<p>ArrayList students = GetStudents();<br />
var query =<br />
from student in students<br />
where student.Score &gt; 80<br />
select new { student.ID, student.Name };</p>
<p><strong>Cause</strong><br />
The problem comes from the fact that LINQ to Objects has been designed to query generic collections that implement the System.Collections.Generic.IEnumerable&lt;T&gt; interface. Where an ArrayList is a nongeneric collection that contains a list of untyped objects and also does not implement IEnumerable&lt;T&gt;.</p>
<p><strong>Solution</strong><br />
Cast operator comes into rescue.</p>
<p>Here is the signature of the Cast operator:<br />
public static IEnumerable&lt;T&gt; Cast&lt;T&gt;(this IEnumerable source)</p>
<p>Cast can take a nongeneric IEnumerable and returns a generic IEnumerable&lt;T&gt;.<br />
A modification of the above query like this will solve the problem and you will be able to query ArrayList via LINQ.</p>
<p>ArrayList students = GetStudents();<br />
var query =<br />
from student in students.Cast&lt;Student&gt;()<br />
where student.Score &gt; 80<br />
select new { student.ID, student.Name };</p>
<p class="postfoot">posted @ <a title="Permanent link to this post" href="/shahed/archive/2008/02/05/119321.aspx">Tuesday, February 05, 2008 4:30 PM</a> | <a title="comments, pingbacks, trackbacks" href="/shahed/archive/2008/02/05/119321.aspx#feedback">Feedback (1)</a> |</p>
</div>
</div>
</td>
</tr>
<tr>
<td class="FooterCell">
<p class="powererdby">Powered by:</p>
<p><a id="Footer1_Hyperlink2" title="Powered By Subtext" name="Hyperlink1" href="http://sourceforge.net/projects/subtext/"><img style="border-width:0;" src="../images/PoweredBySubtext85x33.png" alt="" /></a><br />
<a id="Footer1_Hyperlink3" title="Powered By ASP.NET" href="http://ASP.NET"><img style="border-width:0;" src="../images/PoweredByAsp.Net.gif" alt="" /></a></p>
<p class="copyright">Copyright © Shahed Khan</p>
</td>
</tr>
</tbody>
</table>
<div>
</div>
<p>&lt;!&#8211;<br />
//</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/irfanmunir.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/irfanmunir.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/irfanmunir.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/irfanmunir.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/irfanmunir.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/irfanmunir.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/irfanmunir.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/irfanmunir.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/irfanmunir.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/irfanmunir.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/irfanmunir.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/irfanmunir.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=irfanmunir.wordpress.com&blog=853136&post=37&subd=irfanmunir&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://irfanmunir.wordpress.com/2008/07/05/aspnet-user-control-tips/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/irfanmunir-128.jpg" medium="image">
			<media:title type="html">irfanmunir</media:title>
		</media:content>

		<media:content url="../images/xml.gif" medium="image">
			<media:title type="html">RSS 2.0 Feed</media:title>
		</media:content>

		<media:content url="http://www.msbdusers.net/smartmassemail/sk.jpg" medium="image" />

		<media:content url="http://www.msbdusers.net/shahed/o_mvp_logo.jpg" medium="image" />

		<media:content url="http://www.msbdusers.net/smartmassemail/mcad.gif" medium="image" />

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETtipsGoldenrulesforDynamicControl_14FD2/controllifecycle_thumb.png" medium="image">
			<media:title type="html">controllifecycle</media:title>
		</media:content>

		<media:content url="http://apcmag.com/images/apcapc/news/imcup_map_625.jpg" medium="image" />

		<media:content url="http://apcmag.com/images/apcapc/news/imcup_team625.jpg" medium="image" />

		<media:content url="http://apcmag.com/images/apcapc/news/imcup_judges_625.jpg" medium="image" />

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image1_thumb_1.gif" medium="image">
			<media:title type="html">Image1</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image2_thumb_1.gif" medium="image">
			<media:title type="html">Image2</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image3_thumb.gif" medium="image">
			<media:title type="html">Image3</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image5_thumb.gif" medium="image">
			<media:title type="html">Image5</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image4_thumb.gif" medium="image">
			<media:title type="html">Image4</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image6_thumb.gif" medium="image">
			<media:title type="html">Image6</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image8_thumb.gif" medium="image">
			<media:title type="html">Image8</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image9_thumb_1.gif" medium="image">
			<media:title type="html">Image9</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image7_thumb.gif" medium="image">
			<media:title type="html">Image7</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/ASP.NETTipsEmbedding.NETCustomControldll_F412/Image10_thumb.gif" medium="image">
			<media:title type="html">Image10</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/VisualStudio2005DebugginginVista_BFF5/vs05run_thumb.jpg" medium="image">
			<media:title type="html">vs05run</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B14%5D_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[14]</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002%5B12%5D_thumb.jpg" medium="image">
			<media:title type="html">clip_image002[12]</media:title>
		</media:content>

		<media:content url="http://geekswithblogs.net/images/geekswithblogs_net/shahed/WindowsLiveWriter/SolvingDNNdeploymentissuesRedirectintolo_E27A/clip_image002_thumb.jpg" medium="image">
			<media:title type="html">clip_image002</media:title>
		</media:content>

		<media:content url="../images/PoweredBySubtext85x33.png" medium="image" />

		<media:content url="../images/PoweredByAsp.Net.gif" medium="image" />
	</item>
		<item>
		<title>Oracle Techniques by Sameer Wadhwa ( Analytic Functions)</title>
		<link>http://irfanmunir.wordpress.com/2008/06/12/oracle-techniques-by-sameer-wadhwa-analytic-functions/</link>
		<comments>http://irfanmunir.wordpress.com/2008/06/12/oracle-techniques-by-sameer-wadhwa-analytic-functions/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 12:45:47 +0000</pubDate>
		<dc:creator>Irfan Munir</dc:creator>
		
		<category><![CDATA[General Concepts]]></category>

		<guid isPermaLink="false">http://irfanmunir.wordpress.com/?p=36</guid>
		<description><![CDATA[borrowed from : http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ranked_func_bk

xmlns:o=&#8221;urn:schemas-microsoft-com:office:office&#8221;
xmlns:w=&#8221;urn:schemas-microsoft-com:office:word&#8221;
xmlns=&#8221;http://www.w3.org/TR/REC-html40&#8243;&#62;
 

id=&#8221;_x0000_t136&#8243; coordsize=&#8221;21600,21600&#8243; o:spt=&#8221;136&#8243; adj=&#8221;10800&#8243; path=&#8221;m@7,0l@8,0m@5,21600l@6,21600e&#8221;&#62;
o:connectangles=&#8221;270,180,90,0&#8243;/&#62;
strokeweight=&#8221;1.5pt&#8221;&#62;
fitpath=&#8221;t&#8221; string=&#8221;Analytical functions&#8221;/&#62;
      
style=&#8217;mso-tab-count:13&#8242;&#62;                                                                                                                                                     
 
                                                                                    style=&#8217;color:maroon&#8217;&#62;SAMEER WADHWA
                                                                        style=&#8221;mso-spacerun: yes&#8221;&#62;       Wadhwa_S@Hotmail.com
                                                            

In this article I have 
tried to aware you about some of the analytic functions provided by oracle
8i.These funtions are very powerful and ease to use.
 

style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;
color:blue;mso-bidi-font-weight:bold&#8217;&#62;·        
href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Rollup_and_cube_bk&#8221;&#62;ROLLUP
AND CUBE AGGREGATE FUNCTIONS
style=&#8217;mso-bidi-font-weight:normal&#8217;&#62;·        
href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ranked_func_bk&#8221;&#62;RANKED
FUNCTION
style=&#8217;mso-bidi-font-weight:normal&#8217;&#62;·        
href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Case_bk&#8221;&#62;CASE
style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;
color:blue;mso-bidi-font-weight:bold&#8217;&#62;·        
href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Lag_and_lead_bk&#8221;&#62;LAG
AND LEAD FUNCTION
style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;
color:blue;mso-bidi-font-weight:bold&#8217;&#62;·        
href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ratio_to_report_bk&#8221;&#62;RATIO_TO_REPORT
 

 
 

                                    name=&#8221;Rollup_and_cube_bk&#8221;&#62;ROLLUP AND CUBE
AGGREGATE FUNCTIONS
 
To understand the power of ROLLUP [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!--CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//E-->borrowed from : <a href="http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ranked_func_bk">http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ranked_func_bk</a><br />
<!-- saved from url=(0059)http://www.geocities.com/samoracle/swAnalyticalFuntions.htm --><br />
xmlns:o=&#8221;urn:schemas-microsoft-com:office:office&#8221;<br />
xmlns:w=&#8221;urn:schemas-microsoft-com:office:word&#8221;<br />
xmlns=&#8221;http://www.w3.org/TR/REC-html40&#8243;&gt;</p>
<p> </p>
<div class="Section1">
<p class="MsoNormal" style="margin-left:-0.25in;">id=&#8221;_x0000_t136&#8243; coordsize=&#8221;21600,21600&#8243; o:spt=&#8221;136&#8243; adj=&#8221;10800&#8243; path=&#8221;m@7,0l@8,0m@5,21600l@6,21600e&#8221;&gt;</p>
<p>o:connectangles=&#8221;270,180,90,0&#8243;/&gt;</p>
<p>strokeweight=&#8221;1.5pt&#8221;&gt;</p>
<p>fitpath=&#8221;t&#8221; string=&#8221;Analytical functions&#8221;/&gt;<br />
<span>      </span></p>
<p class="MsoNormal" style="margin-left:-0.25in;">style=&#8217;mso-tab-count:13&#8242;&gt;                                                                                                                                                     </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span>                                                                                    </span>style=&#8217;color:maroon&#8217;&gt;SAMEER WADHWA</p>
<p class="MsoNormal"><span style="color:#800000;"><span>                                                                        </span>style=&#8221;mso-spacerun: yes&#8221;&gt;       </span><a href="mailto:Wadhwa_S@Hotmail.com">Wadhwa_S@Hotmail.com</a></p>
<p class="MsoNormal"><span>                                                            </span></p>
<div style="border:none;border-top:solid windowtext .5pt;padding:1pt 0 0;">
<p class="MsoBlockText"><strong><em><span style="font-size:11pt;color:#ff0000;">In this article I have<span> <br />
</span>tried to aware you about some of the analytic functions provided by oracle<br />
8i.These funtions are very powerful and ease to use.</span></em></strong></p>
<p class="MsoBlockText"><strong><em><span style="font-size:11pt;color:#ff0000;"> </span></em></strong></p>
</div>
<div class="MsoBlockText" style="margin-left:1.75in;text-indent:-0.25in;">style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;<br />
color:blue;mso-bidi-font-weight:bold&#8217;&gt;·<span style="font-size:11pt;color:#0000ff;">        <br />
</span><strong><span style="font-size:11pt;color:#0000ff;">href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Rollup_and_cube_bk&#8221;&gt;ROLLUP<br />
AND CUBE AGGREGATE FUNCTIONS</span></strong></div>
<div class="MsoBlockText" style="margin-left:1.75in;text-indent:-0.25in;">style=&#8217;mso-bidi-font-weight:normal&#8217;&gt;<span style="font-size:11pt;color:#0000ff;font-family:Symbol;">·</span><strong><span style="font-size:11pt;color:#0000ff;">        <br />
</span></strong><strong><span style="font-size:11pt;color:#0000ff;">href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ranked_func_bk&#8221;&gt;RANKED<br />
FUNCTION</span></strong></div>
<div class="MsoBlockText" style="margin-left:1.75in;text-indent:-0.25in;">style=&#8217;mso-bidi-font-weight:normal&#8217;&gt;<span style="font-size:11pt;color:#0000ff;font-family:Symbol;">·</span><strong><span style="font-size:11pt;color:#0000ff;">        <br />
</span></strong><strong><span style="font-size:11pt;color:#0000ff;">href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Case_bk&#8221;&gt;CASE</span></strong></div>
<div class="MsoBlockText" style="margin-left:1.75in;text-indent:-0.25in;">style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;<br />
color:blue;mso-bidi-font-weight:bold&#8217;&gt;·<span style="font-size:11pt;color:#0000ff;">        <br />
</span><strong><span style="font-size:11pt;color:#0000ff;">href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Lag_and_lead_bk&#8221;&gt;LAG<br />
AND LEAD FUNCTION</span></strong></div>
<div class="MsoBlockText" style="margin-left:1.75in;text-indent:-0.25in;">style=&#8217;font-size:11.0pt;mso-bidi-font-size:12.0pt;font-family:Symbol;<br />
color:blue;mso-bidi-font-weight:bold&#8217;&gt;·<span style="font-size:11pt;color:#0000ff;">        <br />
</span><strong><span style="font-size:11pt;color:#0000ff;">href=&#8221;http://www.samoratech.com/topicofinterest/swAnalyticalFuntions.htm#Ratio_to_report_bk&#8221;&gt;RATIO_TO_REPORT</span></strong></div>
<div class="MsoBlockText" style="margin-left:1.5in;"><strong><span style="color:#0000ff;"><span> </span></span></strong><strong></strong></div>
<div style="border:none;border-top:solid windowtext .5pt;padding:1pt 0 0;">
<div class="MsoNormal" style="margin:0 141pt 0 1.25in;padding:0;"><span style="font-size:11pt;"> </span></div>
<div class="MsoNormal" style="margin:0 141pt 0 1.25in;padding:0;"> </div>
</div>
<p class="MsoNormal"><span>                                    </span>name=&#8221;Rollup_and_cube_bk&#8221;&gt;<strong><span style="text-decoration:underline;"><span style="color:#ff0000;">ROLLUP AND CUBE<br />
AGGREGATE FUNCTIONS</span></span></strong><strong><span style="text-decoration:underline;"></span></strong></p>
<p class="MsoNormal" style="margin-left:99pt;text-indent:-99pt;"><strong><span style="text-decoration:underline;"> </span></strong></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;">To understand the power of ROLLUP and CUBE functions ,consider the<br />
following SQL statement :-</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;">ora816 SamSQL :&gt; compute sum of totsal on deptno</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;">ora816 SamSQL :&gt; break on deptno</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;">ora816 SamSQL :&gt; select deptno,job,sum(sal) totsal from emp group<br />
by deptno,job;</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;    </span>DEPTNO JOB<span>           </span>TOTSAL</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">&#8212;&#8212;&#8212;-<br />
&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10 CLERK<span>           </span>1300</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>MANAGER<span>         </span>2450</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>PRESIDENT<span>       </span>5000</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">********** style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>&#8212;&#8212;&#8212;-</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">sum style=&#8221;mso-spacerun: yes&#8221;&gt;                        </span>8750</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 ANALYST<span>         </span>6000</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>CLERK<span>           </span>1900</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>MANAGER<span>         </span>2975</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">********** style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>&#8212;&#8212;&#8212;-</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">sum style=&#8221;mso-spacerun: yes&#8221;&gt;                       </span>10875</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 CLERK<span>            </span>950</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>MANAGER<span>         </span>2850</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>SALESMAN<span>        </span>5600</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">********** style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>&#8212;&#8212;&#8212;-</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">sum style=&#8221;mso-spacerun: yes&#8221;&gt;                        </span>9400</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<h1><span style="color:#ff0000;">Now see the use of ROLLUP Function </span></h1>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><strong><span style="font-family:&quot;">ora816 SamSQL :&gt; select deptno,job,sum(sal) totsal from emp<br />
group by ROLLUP(deptno,job);</span></strong></p>
<p class="MsoNormal" style="margin-left:1.5in;"><strong><span style="font-family:&quot;"> </span></strong></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;    </span>DEPTNO JOB<span>           </span>TOTSAL</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">&#8212;&#8212;&#8212;-<br />
&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10 CLERK<span>           </span>1300</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10 MANAGER<span>         </span>2450</p>
<p class="MsoNormal" style="margin-left:1.5in;">id=&#8221;_x0000_t88&#8243; coordsize=&#8221;21600,21600&#8243; o:spt=&#8221;88&#8243; adj=&#8221;1800,10800&#8243; path=&#8221;m0,0qx10800@0l10800@2qy21600@11,10800@3l10800@1qy0,21600e&#8221;<br />
filled=&#8221;f&#8221;&gt;</p>
<p>textboxrect=&#8221;0,@4,7637,@5&#8243;/&gt;</p>
<p>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;<span>        </span>10 PRESIDENT style=&#8221;mso-spacerun: yes&#8221;&gt;       5000</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10<span>                 </span><span style="font-size:10pt;color:#ff0000;font-family:&quot;">8750<span>   </span>Total of Deptno 10</span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 ANALYST<span>         </span>6000</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 CLERK<span>           </span>1900</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 MANAGER<span>         </span>2975</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20<span>        </span><span>        </span> style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:red&#8217;&gt;10875</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 CLERK<span>            </span>950</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 MANAGER<span>         </span>2850</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 SALESMAN<span>        </span>5600</p>
<p class="MsoNormal" style="margin-left:1.5in;">type=&#8221;#_x0000_t88&#8243; style=&#8217;position:absolute;left:0;text-align:left;<br />
margin-left:297pt;margin-top:5.55pt;width:9pt;height:18pt;z-index:6&#8242;&gt;</p>
<p>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;<span>        </span>30 style=&#8221;mso-spacerun: yes&#8221;&gt;                 9400</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;                          </span>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:red&#8217;&gt;29025<span>   </span>Grand Total</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span style="font-family:&quot;">So if you compare the two output you will notice that you are getting<br />
the same output.<span>  </span><strong><em>By using rollup<br />
you can avoid compute and break clausesfrom SQL</em></strong>. style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>This will mostly helpful in style=&#8221;mso-spacerun: yes&#8221;&gt;  PL/SQL<span> <br />
</span>.<span>  </span>We do not have to put logic<br />
for computing values on break of groups.</p>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<p class="MsoNormal" style="margin-left:1.5in;"><span> </span></p>
<h1><span>Now see the use of<br />
CUBE<span>  </span>Function</span></h1>
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-left:99pt;"><strong><span style="font-size:11pt;color:#3366ff;font-family:&quot;">ora816<br />
SamSQL :&gt; select deptno,job,sum(sal) totsal from emp group by<br />
CUBE(deptno,job);</span></strong></p>
<p class="MsoNormal" style="margin-left:99pt;"><strong><span style="font-size:11pt;color:#3366ff;font-family:&quot;"> </span></strong></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">Fri Mar 23</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun:<br />
yes&#8221;&gt;                                                          </span>NuGenesis<br />
Report</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;"> </span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;    </span>DEPTNO JOB<span>           </span>TOTSAL</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">&#8212;&#8212;&#8212;-<br />
&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;-</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10 CLERK<span>           </span>1300</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span><span>      </span>10 MANAGER<span>        <br />
</span>2450</p>
<p class="MsoNormal" style="margin-left:99pt;">type=&#8221;#_x0000_t88&#8243; style=&#8217;position:absolute;left:0;text-align:left;<br />
margin-left:4in;margin-top:8.25pt;width:9pt;height:18pt;z-index:4&#8242;&gt;</p>
<p>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;<span>        </span>10 PRESIDENT style=&#8221;mso-spacerun: yes&#8221;&gt;       5000</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>10<span>                 </span><span style="font-size:10pt;color:#ff0000;font-family:&quot;">8750<span>   </span>Total of Deptno 10</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 ANALYST<span>         </span>6000</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 CLERK<span>           </span>1900</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20 MANAGER<span>         </span>2975</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>20<span>                </span><span style="font-size:10pt;color:#ff0000;font-family:&quot;">10875</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 CLERK<span>            </span>950</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 MANAGER<span>         </span>2850</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30 SALESMAN<span>        </span>5600</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;        </span>30<span>                 </span><span style="font-size:10pt;color:#ff0000;font-family:&quot;">9400</span></p>
<p class="MsoNormal" style="margin-left:99pt;">type=&#8221;#_x0000_t88&#8243; style=&#8217;position:absolute;left:0;text-align:left;<br />
margin-left:4in;margin-top:2.95pt;width:18pt;height:54pt;z-index:2&#8242;&gt;</p>
<p>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;<span>           </span>ANALYST style=&#8221;mso-spacerun: yes&#8221;&gt;         <span style="font-size:10pt;color:#800000;font-family:&quot;">6000</span> style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>CLERK<span>           </span><span style="font-size:10pt;color:#800000;font-family:&quot;">4150</span> style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>MANAGER<span>         </span><span style="font-size:10pt;color:#800000;font-family:&quot;">8275<span>    </span>Total w.r.t JOB</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>PRESIDENT<span>    </span><span>   </span> style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:maroon&#8217;&gt;5000</p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;">style=&#8221;mso-spacerun: yes&#8221;&gt;           </span>SALESMAN<span>        </span><span style="font-size:10pt;color:#800000;font-family:&quot;">5600</span> style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;</p>
<p class="MsoNormal" style="margin-left:99pt;">id=&#8221;_x0000_t87&#8243; coordsize=&#8221;21600,21600&#8243; o:spt=&#8221;87&#8243; adj=&#8221;1800,10800&#8243; path=&#8221;m21600,0qx10800@0l10800@2qy0@11,10800@3l10800@1qy21600,21600e&#8221;<br />
filled=&#8221;f&#8221;&gt;</p>
<p>textboxrect=&#8221;13963,@4,21600,@5&#8243;/&gt;</p>
<p>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:#3366FF&#8217;&gt;<span>            </span>style=&#8217;font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&#8221;Courier New&#8221;;<br />
color:red&#8217;&gt;Grand Total<span style="font-size:10pt;color:#3366ff;font-family:&quot;"><span>   </span></span><span style="font-size:10pt;color:#ff0000;">29025</span></p>
<p class="MsoNormal" style="margin-left:99pt;"><span style="font-size:10pt;color:#3366ff;font-family:&quot;"> </span></p>
<p class="MsoBodyTextIndent">Cube also do a total with respect to second group<br />
for example JOB in our case . Also at end you will see the grand total</p>
<p class="MsoBodyTextIndent"> </p>
<p class="MsoBodyTextIndent"> </p>
<p class="MsoBodyTextIndent"><span style="color:#993300;">Conclusion : Rollup and<br />
Cube are the aggregate function which allows developers and dbas to avoid<br />
compute and break clauses and simplify logic of programming</span></p>
<p class="MsoBodyTextIndent"><span style="color:#993300;"> </span></p>
<p class="MsoPlainText" style="margin-left:63pt;text-indent:.5in;">name=&#8221;Ranked_func_bk&#8221;&gt;<strong><span style="text-decoration:underline;"><span style="font-size:12pt;font-family:&quot;">Ranked Function in 8i (816)</span></span></strong><strong><span style="text-decoration:underline;"> style=&#8217;font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:&#8221;Times New Roman&#8221;;<br />
mso-fareast-font-family:&#8221;MS Mincho&#8221;;color:red&#8217;&gt;</span></strong></p>
<p class="MsoPlainText"><strong><span style="text-decoration:underline;"><span style="font-size:12pt;font-family:&quot;"> </span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#3366ff;font-family:&quot;">Suppose</span><span style="font-size:12pt;color:#0000ff;font-family:&quot;"> you have a data in table which you want to rank in a specified<br />
order for example you have a table test and you want to rank a value of repcol.</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText"><span style="color:#0000ff;font-family:&quot;"><span>                                               </span></span><strong>style=&#8217;font-size:12.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;Ora816 SamSQL</strong><span style="font-size:12pt;color:#0000ff;">&gt; select * from test;</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">REPCOL<span>         <br />
</span>VALUE</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;-<span>   <br />
</span>&#8212;&#8212;&#8212;-</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>100</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>            </span>style=&#8221;mso-spacerun: yes&#8221;&gt;     </span>200</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>300</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>               <br />
</span>1000</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>900</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>800</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>500</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>400</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>500</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="font-size:11pt;color:#0000ff;">Ora816<br />
SamSQL</span></strong><span style="font-size:11pt;color:#0000ff;">&gt; select repcol,value,</span><strong> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:red&#8217;&gt;rank() over ( partition by repcol</strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span><span>              </span>2 style=&#8221;mso-spacerun: yes&#8221;&gt;  <strong><span style="font-size:11pt;color:#ff0000;">order<br />
by value desc )</span></strong><span style="font-size:11pt;color:#0000ff;"> ranked_value</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt; </span><span>          </span>style=&#8221;mso-spacerun: yes&#8221;&gt;     3<span> <br />
</span>from test;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">REPCOL<span>         <br />
</span>VALUE RANKED_VALUE</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>500<span>            </span>1</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>300<span>            </span>2</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>200<span>            </span>3</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>                <br />
</span>100<span>            </span>4</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>  </span>style=&#8221;mso-spacerun: yes&#8221;&gt;              </span>1000<span>            </span>1</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>900<span>            </span>2</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>800<span>            </span>3</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>500<span>            </span>4</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                <br />
</span>400<span>            </span>5</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">The<br />
above value is ranked by the rank function provided by 8.1.6</span> style=&#8217;font-size:12.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><a name="Case_bk"><strong><span style="text-decoration:underline;">style=&#8217;font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:&#8221;Times New Roman&#8221;;<br />
mso-fareast-font-family:&#8221;MS Mincho&#8221;;color:red&#8217;&gt;Use of Case in SELECT </span></strong></a><strong><span style="text-decoration:underline;">style=&#8217;font-size:12.0pt;mso-bidi-font-size:10.0pt;font-family:&#8221;Times New Roman&#8221;;<br />
mso-fareast-font-family:&#8221;MS Mincho&#8221;;color:red&#8217;&gt;</span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="text-decoration:underline;"><span style="color:#0000ff;font-family:&quot;"> </span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="text-decoration:underline;"><span style="color:#0000ff;font-family:&quot;">Case Statement are similar to decode , it is more<br />
flexible and gives better performace</span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="text-decoration:underline;"><span style="color:#0000ff;font-family:&quot;"> </span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="font-size:11pt;color:#0000ff;">Ora816<br />
SamSQL</span></strong><span style="font-size:11pt;color:#0000ff;">&gt;<span>  </span>ed</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">Wrote<br />
file afiedt.buf</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>1<span> <br />
</span>select sum(<span style="font-size:11pt;color:#ff0000;">case</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; <span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; repcol=&#8217;A&#8217; <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> sum_of_A,</p>
<p class="MsoPlainText" style="margin-left:.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt; </span><span>          </span>style=&#8221;mso-spacerun: yes&#8221;&gt; 2<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">Case</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; <span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; repcol=&#8217;B&#8217; <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Sum_of_B,</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>3<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">case</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; <span style="font-size:11pt;color:#ff0000;">when </span>style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;value = 500 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 1 <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Value_Eq_500,</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>4<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">case</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; <span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value &gt; 100 <span style="font-size:11pt;color:#ff0000;">then </span>style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;1 <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Value_Gre_100</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>5*<span> <br />
</span>from test</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="font-size:11pt;color:#0000ff;">Ora816<br />
SamSQL</span></strong><span style="font-size:11pt;color:#0000ff;">&gt;<span>  </span>/</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;font-family:&quot;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;"><span>  </span>SUM_OF_A style=&#8221;mso-spacerun: yes&#8221;&gt;   </span>SUM_OF_B VALUE_EQ_500 VALUE_GRE_100</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212; &#8212;&#8212;&#8212;&#8212;-</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;"><span>      </span>1100 style=&#8221;mso-spacerun: yes&#8221;&gt;       </span>3600<span>            </span>2<span>             </span>8</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#000080;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="text-decoration:underline;"><span style="color:#ff0000;font-family:&quot;">Use of Group by in CASE</span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="text-decoration:underline;"><span style="color:#ff0000;font-family:&quot;"> </span></span></strong></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="font-size:11pt;color:#0000ff;">Ora816<br />
SamSQL</span></strong><span style="font-size:11pt;color:#0000ff;">&gt; ed</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">Wrote<br />
file afiedt.buf</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>1<span> <br />
</span>select repcol,sum(<span style="font-size:11pt;color:#ff0000;">case when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; repcol=&#8217;A&#8217; <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> sum_of_A,</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>2<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">Case when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; repcol=&#8217;B&#8217; <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Sum_of_B,</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>3<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">case when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value = 500 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 1 <span style="font-size:11pt;color:#ff0000;">else </span>style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Value_Eq_500,</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>4<span>        <br />
</span>sum(<span style="font-size:11pt;color:#ff0000;">case when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value &gt; 100 <span style="font-size:11pt;color:#ff0000;">then </span>style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt;1 <span style="font-size:11pt;color:#ff0000;">else</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; 0 <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> Value_Gre_100</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>5<span>  <br />
</span>from test</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>6* <span style="font-size:11pt;color:#ff0000;">group<br />
by</span><span style="font-size:11pt;color:#0000ff;"> repcol</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="color:#0000ff;">Ora816 SamSQL</span></strong><span style="color:#0000ff;">&gt; /</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">REPCOL<span>      <br />
</span>SUM_OF_A<span>   </span>SUM_OF_B VALUE_EQ_500<br />
VALUE_GRE_100</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">&#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8212;<br />
&#8212;&#8212;&#8212;&#8212;-</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">A<span>               <br />
</span>1100<span>          </span>0 style=&#8221;mso-spacerun: yes&#8221;&gt;            </span>1<span>             </span>3</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="color:#0000ff;">B<span>                  <br />
</span>0<span>       </span>3600 style=&#8221;mso-spacerun: yes&#8221;&gt;            </span>1<span>             </span>5</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:12pt;color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><strong><span style="font-size:11pt;color:#0000ff;">Ora816<br />
SamSQL</span></strong><span style="font-size:11pt;color:#0000ff;">&gt; ed</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">Wrote<br />
file afiedt.buf</span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;"> </span></p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>1<span> <br />
</span>select (<span style="font-size:11pt;color:#ff0000;">case</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; <span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value between 100 and 300 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; &#8216;100-300&#8242;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>2<span>      <br />
</span><span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value between 400 and 700 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; &#8216;400-700&#8242;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>3<span>      <br />
</span><span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value between 800 and 900 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; &#8216;800-900&#8242;</p>
<p class="MsoPlainText" style="margin-left:1.5in;"><span style="font-size:11pt;color:#0000ff;">style=&#8221;mso-spacerun: yes&#8221;&gt;  </span>4<span>      <br />
</span><span style="font-size:11pt;color:#ff0000;">when</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; value &gt; 900 <span style="font-size:11pt;color:#ff0000;">then</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&gt; &#8216;&gt;900&#8242; <span style="font-size:11pt;color:#ff0000;">end</span> style=&#8217;font-size:11.0pt;mso-bidi-font-size:10.0pt;mso-fareast-font-family:&#8221;MS Mincho&#8221;;<br />
color:blue&#8217;&#038;gt <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> VALUE_RANGE,</p>
<p class="MsoPlainText" style="m