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

<channel>
	<title>Nirav Patel's Weblog</title>
	<atom:link href="http://niravpatel.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://niravpatel.wordpress.com</link>
	<description></description>
	<lastBuildDate>Tue, 07 Apr 2009 11:06:42 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='niravpatel.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/15ff555cc56f7199f72d678b20cd33b5?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Nirav Patel's Weblog</title>
		<link>http://niravpatel.wordpress.com</link>
	</image>
			<item>
		<title>I Love you Dad&#8230;</title>
		<link>http://niravpatel.wordpress.com/2009/04/07/i-love-you-dad/</link>
		<comments>http://niravpatel.wordpress.com/2009/04/07/i-love-you-dad/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 11:06:42 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2009/04/07/i-love-you-dad/</guid>
		<description><![CDATA[On 16th of Feb 2009, I lost my father. It was a huge loss of my life. He was a great man and fighter. He fought great against cancer. But destiny was defined. Cancer did it’s job. It was very tough to see our dear one dying and you were standing there helplessly. 
I was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=12&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>On 16th of Feb 2009, I lost my father. It was a huge loss of my life. He was a great man and fighter. He fought great against cancer. But destiny was defined. Cancer did it’s job. It was very tough to see our dear one dying and you were standing there helplessly. </p>
<p>I was checking his pulse on his forearm, and I felt his last pulse. I held his arm for few more minutes with tears in my heart with hope that I will catch his pulse again. But the pulse never came again… Instantly I became small child by heart. I wanted to cry like child, but I couldn’t. If I got to cry, who will give emotional support to my mother, younger brother and my wife. I had to put huge rock on my heart and control my emotions for sake of my family.</p>
<p>Suddenly my whole life changed. If you know about Indian families, father is always a key person in family. He possess the chief of the family status for his entire life span, specially in joint families. Children are always in father’s influence. Father is like roof of the house. And I lost my roof. As an elder son of the family it was my responsibility to become new ruff of my family. It is a great responsibility. But I now I will do that, my father is always with me. Even if he is not physically present, I can feel his present inside my heart. I know he is always with me. He is looking after my every failure and success.</p>
<p>I Love you Dad… You are always my source of inspiration…</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=12&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2009/04/07/i-love-you-dad/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>Back to Blogging</title>
		<link>http://niravpatel.wordpress.com/2008/08/24/back-to-blogging/</link>
		<comments>http://niravpatel.wordpress.com/2008/08/24/back-to-blogging/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 09:09:46 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2008/08/24/back-to-blogging/</guid>
		<description><![CDATA[After almost 2 months I am back to blogging. These two months went hectic for me. Lots of things happened in these two months. This all things affect a lot to my surrounding environment.

My dad is having cancer since last 4 years. He is fighting very hard to defeat the cancer. But before few months [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=11&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>After almost 2 months I am back to blogging. These two months went hectic for me. Lots of things happened in these two months. This all things affect a lot to my surrounding environment.
</p>
<p>My dad is having cancer since last 4 years. He is fighting very hard to defeat the cancer. But before few months cancer came in the winning position. We were starting losing the hope, but my dad didn&#8217;t. He again starts fighting with the cancer with passion.  During this chaos, I got good offer from the Cybage Software, which I couldn&#8217;t denied. And it was the end of a golden era of my working with Avani Cimcon Technologies (ACTL). I worked almost 2 years with ACTL. It was really a golden period of my life. Working with ACTL was the best working experience for me. But one day you have to step forward, and I took that step. It&#8217;s been a pleasure working with Cybage Softwares.  I became part of cybagian community from cimconiens community.
</p>
<p>One more thing happens which made me think a lot on my and my beloved&#8217;s life. <a href="http://en.wikipedia.org/wiki/2008_Ahmedabad_bombings">On 26<sup>th</sup> of July, 2008, Ahmedabad got serial blasts</a>. It was around 21 blasts in just 70 minutes time. The whole city and infect whole country catch into terror. Around 56 people died and 200 people injured. The biggest blast happened into the Civil Hospital (The same hospital, where my dad&#8217;s treatment is going on). Fortunately all of my beloved were safe. And I am thankful to God for this. But again and again, same thought came in my mind that, why this happens? Why a human can not understand each other? Why everybody wants to kill each other? Why we can not leave peacefully with each other? And I guess nobody in this world know these answers.
</p>
<p>Anyway, after all we have to back to our routine life also. So, now I am back to my routine life and started writing again. So below is my &#8220;To Write&#8221; list. I am going to write on below topics in near future. The list is not in sorted order.
</p>
<p><strong>To Write:<br />
</strong></p>
<ul>
<li>Extension methods in .Net 3.5
</li>
<li>Forms Authentication in SSRS
</li>
<li>Visual Studio Extensibility
</li>
<li>
<div>Project Management
</div>
<ul>
<li>Planning
</li>
<li>Scheduling
</li>
<li>PERT / CPM Techniques
</li>
<li>Risk Management
</li>
<li>Change Management
</li>
<li>Work Reporting
</li>
</ul>
</li>
</ul>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=11&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/08/24/back-to-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>10 Tips For Effective Reading And Learning</title>
		<link>http://niravpatel.wordpress.com/2008/05/23/10-tips-for-effective-reading-and-learning/</link>
		<comments>http://niravpatel.wordpress.com/2008/05/23/10-tips-for-effective-reading-and-learning/#comments</comments>
		<pubDate>Fri, 23 May 2008 08:22:20 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2008/05/23/10-tips-for-effective-reading-and-learning/</guid>
		<description><![CDATA[&#160;

Relax Before Reading Concentration is key factor of effective reading and learning. You will need to relax your mind and swipe off your thoughts. You brain need to be empty by thoughts before you start the reading. It is like giving space to new thoughts which are going to be arise during your reading. Your [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=10&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;</p>
<ol>
<li><strong>Relax Before Reading</strong> <br />Concentration is key factor of effective reading and learning. You will need to relax your mind and swipe off your thoughts. You brain need to be empty by thoughts before you start the reading. It is like giving space to new thoughts which are going to be arise during your reading. Your emotions need to be in neutral before reading. That will give you chance to evaluate your reading. You can do some meditation or listen to soft music before start of reading. Most of all fighter pilots and F1 racers adopt this technic before go to the flight or in race. Try it, it is really effective.&nbsp; </li>
<li><strong>Go Slow with the Reading <br /></strong>Never do hurry with your reading. Don&#8217;t just read. Go very slow with reading. Try to understand each and every word written by author. Try to ask questions to your own self and find the answer. The more deeply you force your brain to think, the better chance you have of learning and remembering.  </li>
<li><strong>Take Challenges of Exercises. <br /></strong>Authors keep exercises in book for you. But what if they do that for you? You will never take challenge to do that. It will be like, you have hunger and somebody is eating on behalf of you&#8230;.  </li>
<li><strong>Write Your Own Notes In Book</strong> <br />Its not bad to use Pencil to writ something in your books. You can write lots of your own notes in book. It is really good practice to improve your understanding of what you are reading. Some people don&#8217;t like to write anything into book, as book get spoil. In this case you can write your notes into separate notebook or even you can use sticky notes. But please write your thoughts.  </li>
<li><strong>Give Enough Time To Your Brain</strong> <br />The process of transferring the reading into long-term memory happens after stop reading. Our brain needs time to do processing. If we keep anything new or challenging during the processing time, Some of what you learned might be lost. It is recommended to read before you go to bed.  </li>
<li><strong>What Your Brain Need?</strong> <br />The performance of Brain is depend on lots of things. But we can follow few basic things to make it more efficient. The brain works best in a nice bath of fluid. Research said that Dehydration decreases cognitive function of brain. The dehydration can happened before we feel thirsty. So, keep drinking enough water while reading [But this also can cause lots of washroom visit and can break your concentration, so keep it in your own limit]. Brain also need good sound sleep. To learn at it&#8217;s best, give enough sleep to you brain [At least 6-8 hours]. And last but not least, you brain need food. Please eat proper to nourish your brain. Protein, Vitamins, Sodium and Iodine are very important for your brain.  </li>
<li><strong>Speak it out Loud.</strong> <br />Speaking activates a different part of your brain. If you are trying to understand something, or increase your chance of remembering it later, say it out loud. You can discuss what you have learned or read with some of your friend (Or even with your own self in front of mirror). The discussion will bust the confidence in you. And you will see that you are learning quickly. During discussion you might come out with new ideas you had not known were there when you were reading about it.  </li>
<li><strong>When To Stop</strong> <br />You should know that when to stop reading. Your brain may overloaded. You should understand the limitation of your brain <em>(I can not read more then 45 minutes in row, it&#8217;s limitation of my brain)</em>. Now one very obvious question, how to know when to stop? If you find yourself starting to forget what you just read, or the characters start dancing on page, then that is the right time to stop reading and have some break.  </li>
<li><strong>Feel it !!</strong><br />You must feel the importance of what you are reading or learning. Your brain need to take the reading seriously to learn effectively. Your brain will never take the reading seriously if it don&#8217;t know the importance of that.&nbsp; </li>
<li><strong>Practices</strong><br />Apply what you have read in your life. Try to put that in your everyday practice. Theoretical and practical both are the different knowledge. You need to apply your theoretical knowledge in your practical life. Coz all reading and learning will not matter until you start practicing that in your routine life. Books will show you the path (Theory) but to walk on the path (Practical) is your responsibility. I might have read everything written or printed about the Everest, but to archived the Everest is complete different thing. My reading and knowledge about the Everest only worth if, I climb and archived the Everest.</li>
</ol>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/10/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/10/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=10&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/05/23/10-tips-for-effective-reading-and-learning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Reporting Service (SSRS) &#8211; HTTP Status 401 Unauthorized Error</title>
		<link>http://niravpatel.wordpress.com/2008/05/21/sql-server-reporting-service-ssrs-http-status-401-unauthorized-error/</link>
		<comments>http://niravpatel.wordpress.com/2008/05/21/sql-server-reporting-service-ssrs-http-status-401-unauthorized-error/#comments</comments>
		<pubDate>Wed, 21 May 2008 12:45:30 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[.Net 2.0]]></category>
		<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Reporting Services]]></category>
		<category><![CDATA[SSRS]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2008/05/21/sql-server-reporting-service-ssrs-http-status-401-unauthorized-error/</guid>
		<description><![CDATA[I am going to continue on writing article on SQL Server Reporting Services (Its because, it is providing me good fame on http://forums.asp.net, LOL). 
We have to deploy the reports on the the Reporting Services Virtual Directory (I can write the whole different article on the Reporting Deployment, but may be next time. Right now [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=9&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am going to continue on writing article on SQL Server Reporting Services (Its because, it is providing me good fame on <a href="http://forums.asp.net">http://forums.asp.net</a>, LOL). </p>
<p>We have to deploy the reports on the the Reporting Services Virtual Directory (<em>I can write the whole different article on the Reporting Deployment, but may be next time. Right now we don&#8217;t want to go deep into that.</em>). The Reporting Server Virtual Directory may exist on the different server. It is recommended to keep anonymous access off for Reports virtual directory if you are going to call reports on the web. </p>
<p>The anonymous access allows any user to access the page. But now when we are keeping anonymous access off for the Reports, it can create problem while fetching the report inside the Report Viewer control on any ASPX page.</p>
<p>The Report server will expect authorized user to access the reports. This can be done by two ways.</p>
<ol>
<li>Passing the Report Server User Credentials with the Reports.  </li>
<li>Forms Authentication on Reporting Server. </li>
</ol>
<p>Today, I am going to explain that How can we pass the User Credentials of the Reporting Server with the report call.</p>
<p>We need to Create one sealed class to perform this action. This class need to be inherited from <font face="Courier New" color="#0000ff">IReportServerCredential</font> interface.</p>
<pre>    [Serializable]
    <span class="kwrd">public</span> <span class="kwrd">sealed</span> <span class="kwrd">class</span> ReportServerNetworkCredentials : IReportServerCredentials
    {
        <span class="preproc">#region</span> IReportServerCredentials Members

        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// Provides forms authentication to be used to connect to the report server.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;param name="authCookie"&gt;A Report Server authentication cookie.&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name="userName"&gt;The name of the user.&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name="password"&gt;The password of the user.&lt;/param&gt;</span>
        <span class="rem">/// &lt;param name="authority"&gt;The authority to use when authenticating the user, such as a Microsoft Windows domain.&lt;/param&gt;</span>
        <span class="rem">/// &lt;returns&gt;&lt;/returns&gt;</span>
        <span class="kwrd">public</span> <span class="kwrd">bool</span> GetFormsCredentials(<span class="kwrd">out</span> System.Net.Cookie authCookie, <span class="kwrd">out</span> <span class="kwrd">string</span> userName,
            <span class="kwrd">out</span> <span class="kwrd">string</span> password, <span class="kwrd">out</span> <span class="kwrd">string</span> authority)
        {
            authCookie = <span class="kwrd">null</span>;
            userName = <span class="kwrd">null</span>;
            password = <span class="kwrd">null</span>;
            authority = <span class="kwrd">null</span>;

            <span class="kwrd">return</span> <span class="kwrd">false</span>;
        }

        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// Specifies the user to impersonate when connecting to a report server.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;value&gt;&lt;/value&gt;</span>
        <span class="rem">/// &lt;returns&gt;A WindowsIdentity object representing the user to impersonate.&lt;/returns&gt;</span>
        <span class="kwrd">public</span> WindowsIdentity ImpersonationUser
        {
            get
            {
                <span class="kwrd">return</span> <span class="kwrd">null</span>;
            }
        }

        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// Returns network credentials to be used for authentication with the report server.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;value&gt;&lt;/value&gt;</span>
        <span class="rem">/// &lt;returns&gt;A NetworkCredentials object.&lt;/returns&gt;</span>
        <span class="kwrd">public</span> System.Net.ICredentials NetworkCredentials
        {
            get
            {
                <span class="kwrd">string</span> userName = <span class="str">"SERVERUSERNAME"</span>;
                <span class="kwrd">string</span> domainName = <span class="str">"DOMAIN"</span>;
                <span class="kwrd">string</span> password = <span class="str">"somepassword"</span>;

                <span class="kwrd">return</span> <span class="kwrd">new</span> System.Net.NetworkCredential(userName, password, domainName);
            }
        }

        <span class="preproc">#endregion</span>
    }</pre>
<p>.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, &#8220;Courier New&#8221;, courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt<br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }</p>
<p><strong>How to Utilize the <font face="Courier New" color="#0000ff">ReportServerNetworkCredentials</font> Class in your Report call on Page_Load event&#8230;</strong></p>
<pre><span class="kwrd">protected</span> <span class="kwrd">void</span> Page_Load(<span class="kwrd">object</span> sender, EventArgs e)
{
    myReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

    <span class="rem">// Here we are going to pass the ReportServerCredentials to the Report Viewer.</span>
    myReportViewer.ServerReport.ReportServerCredentials = <span class="kwrd">new</span> ReportServerNetworkCredentials();

    ReportServerLoaction = ConfigurationManager.AppSettings[<span class="str">"REPORT_SERVER_PATH"</span>];
    myReportViewer.ServerReport.ReportServerUrl = <span class="kwrd">new</span> Uri(<span class="str">"http://MyReportServer/Reports/"</span>);
    myReportViewer.ServerReport.ReportPath = <span class="str">"TempReports/MyFirstReport"</span>;
    myReportViewer.ShowParameterPrompts = <span class="kwrd">false</span>;
    myReportViewer.ShowPrintButton = <span class="kwrd">true</span>;

    Microsoft.Reporting.WebForms.ReportParameter[] reportParameterCollection = <span class="kwrd">new</span> Microsoft.Reporting.WebForms.ReportParameter[1];
    reportParameterCollection[0] = <span class="kwrd">new</span> Microsoft.Reporting.WebForms.ReportParameter();
    reportParameterCollection[0].Name = <span class="str">"ClientID"</span>;
    reportParameterCollection[0].Values.Add(<span class="str">"49020644-63AA-4D92-81A1-8F85D49ACF67"</span>);

    myReportViewer.ServerReport.SetParameters(reportParameterCollection);
    myReportViewer.ServerReport.Refresh();
}</pre>
<p>.csharpcode, .csharpcode pre<br />
{<br />
	font-size: small;<br />
	color: black;<br />
	font-family: consolas, &#8220;Courier New&#8221;, courier, monospace;<br />
	background-color: #ffffff;<br />
	/*white-space: pre;*/<br />
}<br />
.csharpcode pre { margin: 0em; }<br />
.csharpcode .rem { color: #008000; }<br />
.csharpcode .kwrd { color: #0000ff; }<br />
.csharpcode .str { color: #006080; }<br />
.csharpcode .op { color: #0000c0; }<br />
.csharpcode .preproc { color: #cc6633; }<br />
.csharpcode .asp { background-color: #ffff00; }<br />
.csharpcode .html { color: #800000; }<br />
.csharpcode .attr { color: #ff0000; }<br />
.csharpcode .alt<br />
{<br />
	background-color: #f4f4f4;<br />
	width: 100%;<br />
	margin: 0em;<br />
}<br />
.csharpcode .lnum { color: #606060; }</p>
<p>Please feel free to comment on the article. Critics are highly appreciated.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=9&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/05/21/sql-server-reporting-service-ssrs-http-status-401-unauthorized-error/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Server Reporting Services (SSRS) Versus Browser Compatibility</title>
		<link>http://niravpatel.wordpress.com/2008/05/10/sql-server-reporting-services-ssrs-versus-browser-compatibility/</link>
		<comments>http://niravpatel.wordpress.com/2008/05/10/sql-server-reporting-services-ssrs-versus-browser-compatibility/#comments</comments>
		<pubDate>Sat, 10 May 2008 10:31:07 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[.Net 2.0]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Reporting Services]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2008/05/10/sql-server-reporting-services-ssrs-versus-browser-compatibility/</guid>
		<description><![CDATA[ Microsoft has released SQL Server Reporting Services(SSRS) as server based report generation and development environment in 2004. It was released as SQL Server 2000 extension. SSRS has been released directly to the competition of Crystal Report and other Business Intelligence tools. The current version of SSRS is shipped with SQL Server 2005.
The file format [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=8&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p> Microsoft has released <em><a href="http://www.microsoft.com/sql/technologies/reporting/default.mspx" target="_blank" rel="nofollow">SQL Server Reporting Services</a>(SSRS)</em> as server based report generation and development environment in 2004. It was released as SQL Server 2000 extension. SSRS has been released directly to the competition of <em><a href="http://www.businessobjects.com/product/catalog/crystalreports/" target="_blank" rel="nofollow">Crystal Report</a></em> and other Business Intelligence tools. The current version of SSRS is shipped with SQL Server 2005.</p>
<p>The file format of SSRS reports is .rdl. The RDL is XML. The RDL can be exported to PDF, XML, Excel, TIFF, CSV, HTML. Apart from this, you can call the report by simple URL. </p>
<p>Sounds Good&#8230;!!!!!</p>
<p>But, with all this coolest features of SSRS, there are plenty of bugs too. First ever bug I encounter is Browser Compatibility. There is pretty big issue with SSRS reports browser compatibility. The reports are best view in only IE6 and above. In this competitive world, we need to provide browser compatible websites. SSRS can be big hurdle in your website against browser compatibility. </p>
<p>We experienced a problem with the multivalue parameter dropdown in ReportViewer control in <a href="http://www.mozilla.com/en-US/firefox/" target="_blank" rel="nofollow">FireFox</a>. It was working fine in IE. The calendar control and the multivalue dropdown was having problem. The problem caught me when I click on the calendar control, the calendar appears and then quickly disappeared before I can select anything. It was just in frequence of second. Wow, it was pretty quick and it became a challenging game for me to catch it. But Microsoft was very quick and I never could catch calendar.</p>
<p>The problem was with ReportViewer control provided by VS2005. When we call report directly in Firefox browser using report URL, it was working perfectly fine. So, finally we came to conclusion that, the problem is only due to ReportViewer control.</p>
<p>The solution to resolve the issue is very strange. We need to remove the <strong><em><a href="http://msdn.microsoft.com/en-us/library/ms535242.aspx" target="_blank" rel="nofollow">DOCTYPE</a></em></strong> tag from the HTML. Removing <strong><em><a href="http://msdn.microsoft.com/en-us/library/ms535242.aspx" target="_blank" rel="nofollow">DOCTYPE</a></em></strong> tag can create lots of issues with HTML and CSS layouts. But we have to rectify other issues.</p>
<p>Developers of ReportViewer control has used some nonstandard methods and attributes like <em>onactive</em> event. The page contains specific DOCTYPE, will not parse such events. We tried to use other DTDs like, HTML 4.0 and HTML 5.0 but nothing help. Finally we removed the DOCTYPE and problem get solve (And other design related problem start arising).</p>
<p>For more in SSRS please visit <a href="http://pareshjagatia.wordpress.com" target="_blank" rel="nofollow">Paresh Jagatiya&#8217;s Weblog</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=8&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/05/10/sql-server-reporting-services-ssrs-versus-browser-compatibility/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>Date Format Conversion</title>
		<link>http://niravpatel.wordpress.com/2008/05/02/date-conversion/</link>
		<comments>http://niravpatel.wordpress.com/2008/05/02/date-conversion/#comments</comments>
		<pubDate>Fri, 02 May 2008 17:53:29 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[.Net 2.0]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Date Conversion]]></category>
		<category><![CDATA[Web Application Development]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/?p=5</guid>
		<description><![CDATA[The whole world is divided into different time zones and cultures. Every country has own style to display date and time format. Like, in USA the date has been displayed in “mm/dd/yyyy” format while in Great Britain and India the date has been displayed in “dd/mm/yyyy” format. In the web era, it’s always tough to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=5&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The whole world is divided into different time zones and cultures. Every country has own style to display date and time format. Like, in USA the date has been displayed in “mm/dd/yyyy” format while in Great Britain and India the date has been displayed in “dd/mm/yyyy” format. In the web era, it’s always tough to provide culture oriented user interface. It is easy to display the date in specific format on page using ASP.net. Programmer can easily use .ToString(“dd/mm/yyyy”); to display the date into British format. But it’s not easy to store date into server with formatting.</p>
<p>Let’s take one scenario to understand this, I have a webpage which sense the user’s current time zone and display the date according to that. But the website is hosted on the USA based server. So the SQL Server for the Website will have the “mm/dd/yyyy” format. The SQL Server will expect the date in “mm/dd/yyyy” format. This can create problem when we provide such user interface which accept the date into “dd/mm/yyyy” format. We have to convert the date back into server’s date format before saving into database.</p>
<p>There is no any direct method to convert the date format with DateTime type. Probably Convert.ToDateTime() provide such facility with iFormatProvider interface. But, I really don’t know how to use that. So, I found one another work-around to convert the date in other format.</p>
<p>It’s very tricky to convert the date format from “dd/MM/yyyy” to “mm/dd/yyyy” in .Net 2.0. Below is function, using that programmer can convert any date in any format to the server’s date format.</p>
<pre>
<code>
public DateTime ConvertDate(string Date, string CurrentDateFormat)
{
    try
    {
        return DateTime.ParseExact(Date, CurrentDateFormat, new CultureInfo(Thread.CurrentThread.CurrentCulture.Name));
    }
    catch
    {
        throw;
    }
}
</code>
</pre>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=5&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/05/02/date-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>Credit Card Validations</title>
		<link>http://niravpatel.wordpress.com/2008/01/22/credit-card-validations/</link>
		<comments>http://niravpatel.wordpress.com/2008/01/22/credit-card-validations/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 03:33:00 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Card]]></category>
		<category><![CDATA[Credit]]></category>
		<category><![CDATA[Credit Card]]></category>
		<category><![CDATA[e-commerce]]></category>
		<category><![CDATA[Java Script]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Master Card]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[Visa]]></category>
		<category><![CDATA[web application]]></category>
		<category><![CDATA[web site]]></category>

		<guid isPermaLink="false">http://niravpatel.wordpress.com/2008/01/22/credit-card-validations/</guid>
		<description><![CDATA[
Credit Card transaction is one of the important parts of all e-commerce websites. There are lots of Credit Card Payment Gateways, which help you to authenticate credit cards. But almost all credit card payment gateways took very long time to respond back. And that might cause performance issue with our developed website. 
We can reduce [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=4&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="snap_preview">
<p>Credit Card transaction is one of the important parts of all e-commerce websites. There are lots of Credit Card Payment Gateways, which help you to authenticate credit cards. But almost all credit card payment gateways took very long time to respond back. And that might cause performance issue with our developed website. </p>
<p>We can reduce the payment gateway server trips by validating the credit cards in our system itself. As per my experience, most of the time the customer enters wrong credit card number and that cause the waiting time. We can validate those numbers in our system itself using JavaScript or server validators (i.e. Custom Validator in <a href="http://www.asp.net" target="_blank" rel="nofollow">ASP.Net</a>). We can achieve this using Regular Expression. But first let’s start with some facts with Credit Card Numbers… There are total 5 types of widely accepted credit cards, Visa, Master Card, American Express, Diners Club and Discover. The card number pattern is depending on the type of card. The number pattern consists of the length of Card Number and the number prefix.
<div class="snap_preview"></div>
<div class="snap_preview"></div>
<div class="snap_preview"></div>
<div class="snap_preview"></div>
<div class="snap_preview">&nbsp;</div>
</p>
</div>
<table cellspacing="0" cellpadding="2" width="582" border="1">
<tbody>
<tr>
<td valign="top" width="100"><strong><font color="#0000ff">Card Type</font></strong></td>
<td valign="top" width="100"><strong><font color="#0000ff">Prefix</font></strong></td>
<td valign="top" width="99"><strong><font color="#0000ff">Length</font></strong></td>
<td valign="top" width="281"><strong><font color="#0000ff">Example</font></strong></td>
</tr>
<tr>
<td valign="top" width="100"><strong>Visa</strong></td>
<td valign="top" width="100">4</td>
<td valign="top" width="99">16</td>
<td valign="top" width="281">4563 2214 3215 8542</td>
</tr>
<tr>
<td valign="top" width="100"><strong>Master Card</strong></td>
<td valign="top" width="100">51 to 55</td>
<td valign="top" width="99">16</td>
<td valign="top" width="281">5147 2254 6585 4521</td>
</tr>
<tr>
<td valign="top" width="100"><strong>American Express</strong></td>
<td valign="top" width="100">34<br />37</td>
<td valign="top" width="99">15</td>
<td valign="top" width="281">3422 4587 9874 125<br /> 
<p>3741 5478 9854 654</p>
</td>
</tr>
<tr>
<td valign="top" width="100"><strong>Diners Club</strong></td>
<td valign="top" width="100">30<br />36<br />38</td>
<td valign="top" width="99">14</td>
<td valign="top" width="281">3000 2544 8874 12<br />3685 1475 8544 32<br /> 
<p>3874 8745 6654 85</p>
</td>
</tr>
<tr>
<td valign="top" width="100"><strong>Discover</strong></td>
<td valign="top" width="100">6011</td>
<td valign="top" width="99">16</td>
<td valign="top" width="281">6011 7415 6587 2265</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>We can validate these credit cards using regular expression. Find below table of the regular expression for each credit card type.</p>
<table cellspacing="0" cellpadding="2" width="400" border="1">
<tbody>
<tr>
<td valign="top" width="140"><strong><font color="#0000ff">Card Type</font></strong></td>
<td valign="top" width="258"><strong><font color="#0000ff">Regular Expression</font></strong></td>
</tr>
<tr>
<td valign="top" width="140"><strong>Visa</strong></td>
<td valign="top" width="258">^4\d{3}-?\d{4}-?\d{4}-?\d{4}$</td>
</tr>
<tr>
<td valign="top" width="140"><strong>Master Card</strong></td>
<td valign="top" width="258">^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$</td>
</tr>
<tr>
<td valign="top" width="140"><strong>American Express</strong></td>
<td valign="top" width="258">^3[4,7]\d{13}$</td>
</tr>
<tr>
<td valign="top" width="140"><strong>Diners Club</strong></td>
<td valign="top" width="258">^3[0,6,8]\d{12}$</td>
</tr>
<tr>
<td valign="top" width="140"><strong>Discover</strong></td>
<td valign="top" width="258">^6011-?\d{4}-?\d{4}-?\d{4}$</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Below is the example of a validation function of Java Script for the Credit Card Validation using Regular Expression and <em><strong>“mod 10”</strong></em> algorithm… </p>
<p>This code validate the credit card using Regular Expression and the <em><strong>“mod 10”</strong></em> algorithm. All the card has different prefix and the length. We are using regular expression to validate the card length and prefix. After the card number has the right prefix and correct length, a <em><strong>“mod 10”</strong></em> validation is performed on the credit card number. Cards with an even number of digits go through differently than cards with an odd number of digits (American Express). Every other digit, starting with the second digit (first digit for American Express) is added together. Then a second pass is made, again with every other digit, starting this time with the first digit (second digit for American Express). During this second pass, each digit is multiplied by 2. If the digit multiplied by 2 is greater than or equal to 10, the total minus 9 is added to the original sum from the first pass. If the digit multiplied by 2 is less than 10, that total is added to the original sum from the first pass. After the two passes, the total should be evenly divisible by 10. This is the check that the JavaScript code goes through to validate the credit card.
<pre>function isValidCreditCard(type, ccnum)
{
    <span class="kwrd">if</span> (type == <span class="str">"Visa"</span>)
    {
        <span class="rem">// Visa: length 16, prefix 4, dashes optional.</span>
        var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
    }
    <span class="kwrd">else</span> <span class="kwrd">if</span> (type == <span class="str">"MC"</span>)
    {
        <span class="rem">// Mastercard: length 16, prefix 51-55, dashes optional.</span>
        var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
    }
    <span class="kwrd">else</span> <span class="kwrd">if</span> (type == <span class="str">"Disc"</span>)
    {
        <span class="rem">// Discover: length 16, prefix 6011, dashes optional.</span>
        var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
    }
    <span class="kwrd">else</span> <span class="kwrd">if</span> (type == <span class="str">"AmEx"</span>)
    {
        <span class="rem">// American Express: length 15, prefix 34 or 37.</span>
        var re = /^3[4,7]\d{13}$/;
    }
    <span class="kwrd">else</span> <span class="kwrd">if</span> (type == <span class="str">"Diners"</span>)
    {
        <span class="rem">// Diners: length 14, prefix 30, 36, or 38.</span>
        var re = /^3[0,6,8]\d{12}$/;
    }

    <span class="kwrd">if</span> (!re.test(ccnum)) <span class="kwrd">return</span> <span class="kwrd">false</span>;

    <span class="rem">// Remove all dashes for the checksum checks to eliminate negative numbers</span>
    ccnum = ccnum.split(<span class="str">"-"</span>).join(<span class="str">""</span>);

    <span class="rem">// Checksum ("Mod 10?)</span>
    <span class="rem">// Add even digits in even length strings or odd digits in odd length strings.</span>
    var checksum = 0;

    <span class="kwrd">for</span> (var i=(2-(ccnum.length % 2)); i&lt;=ccnum.length; i+=2)
    {
        checksum += parseInt(ccnum.charAt(i-1));
    }

    <span class="rem">// Analyze odd digits in even length strings or even digits in odd length strings.</span>
    <span class="kwrd">for</span> (var i=(ccnum.length % 2) + 1; i     {
        var digit = parseInt(ccnum.charAt(i-1)) * 2;
        <span class="kwrd">if</span> (digit &lt; 10)
        {
            checksum += digit;
        }
        <span class="kwrd">else</span>
        {
            checksum += (digit-9);
        }
    }

    <span class="kwrd">if</span> ((checksum % 10) == 0)
    {
        <span class="kwrd">return</span> <span class="kwrd">true</span>;
    }
    <span class="kwrd">else</span>
    {
        <span class="kwrd">return</span> <span class="kwrd">false</span>;
    }
}</pre>
</p>
<p>Note that the first character in a string is charAt(0), so that is why 1 is subtracted from the value of i all the time. For the first pass, if the length is even, then the length mod 2 (”mod” is a mathematical term that says to return the remainder of the first number divided by the second number, so 5 mod 2 is 1 and 6 mod 2 is 0. % is the mod operator in JavaScript) results in 0. So 2 minus 0 is 2, so the value of i will walk through the even numbered digits. In the first pass for strings of odd length, the length mod 2 is 1, so 2 minus 1 is 1, and the value of i will walk through the odd numbered digits.
</p>
<p>This way we can validate credit card numbers client side and save some server trips.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=4&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/01/22/credit-card-validations/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://niravpatel.wordpress.com/2008/01/17/hello-world/</link>
		<comments>http://niravpatel.wordpress.com/2008/01/17/hello-world/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 19:41:15 +0000</pubDate>
		<dc:creator>Nirav Patel</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to my Weblog. My name is Nirav Patel. I am a 26 year old guy from Ahmedabad, India. I work as Sr. Team Lead in Avani Cimcon Technologies Ltd.
&#160;
You can read some good stuff about Technologies, Project Management, My Personal Experiences, My Travel Experiences, Funny Incidence of my life, etc. in my blog entries.
&#160;
Feel free [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=1&subd=niravpatel&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="snap_preview">Welcome to my <a href="http://www.answers.com/topic/blog?nafid=22" class="answerlink">Weblog</a>. My name is Nirav Patel. I am a 26 year old guy from <a href="http://www.answers.com/topic/ahmedabad?nafid=22" class="answerlink">Ahmedabad</a>, India. I work as Sr. Team Lead in <a target="_blank" href="http://www.avanicimcon.com">Avani Cimcon Technologies Ltd.</a></div>
<div class="snap_preview">&nbsp;</div>
<div class="snap_preview">You can read some good stuff about <strong>Technologies</strong>, <strong>Project Management</strong>, <strong>My Personal Experiences</strong>, <strong>My Travel Experiences</strong>, <strong>Funny Incidence of my life</strong>, etc. in my blog entries.</div>
<div class="snap_preview">&nbsp;</div>
<div class="snap_preview">Feel free to provide comments on my all posts.</div>
<div class="snap_preview"></div>
<div class="snap_preview">Cya soon&#8230;. </div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/niravpatel.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/niravpatel.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/niravpatel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/niravpatel.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/niravpatel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/niravpatel.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/niravpatel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/niravpatel.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/niravpatel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/niravpatel.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/niravpatel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/niravpatel.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=niravpatel.wordpress.com&blog=2547681&post=1&subd=niravpatel&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://niravpatel.wordpress.com/2008/01/17/hello-world/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5a0d7459ba83cbc3b910181178906b2c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Shrain</media:title>
		</media:content>
	</item>
	</channel>
</rss>