<?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>Towards Next</title>
	<atom:link href="http://towardsnext.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://towardsnext.wordpress.com</link>
	<description>Next step of programming</description>
	<lastBuildDate>Thu, 05 Jan 2012 07:50:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='towardsnext.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/0d5c2635ec2a02c4496e83f10be76d61?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Towards Next</title>
		<link>http://towardsnext.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://towardsnext.wordpress.com/osd.xml" title="Towards Next" />
	<atom:link rel='hub' href='http://towardsnext.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Free E-Book from Microsoft on Parallel Programming</title>
		<link>http://towardsnext.wordpress.com/2010/09/22/free-e-book-from-microsoft-on-parallel-programming/</link>
		<comments>http://towardsnext.wordpress.com/2010/09/22/free-e-book-from-microsoft-on-parallel-programming/#comments</comments>
		<pubDate>Wed, 22 Sep 2010 18:15:49 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[Parallel Programming]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=551</guid>
		<description><![CDATA[Design Patterns for Decomposition and Coordination on Multicore Architectures Colin Campbell, Ralph Johnson, Ade Miller and Stephen Toub. Foreword by Tony Hey A book that introduces .NET programmers to patterns for including parallelism in their applications. Examples of these patterns are parallel loops, parallel tasks and data aggregation with map-reduce. Each pattern has its own <a href="http://towardsnext.wordpress.com/2010/09/22/free-e-book-from-microsoft-on-parallel-programming/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=551&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" style="margin-left:5px;margin-right:5px;" title="Parallel Programming in .NET" src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=parallelpatterns&amp;DownloadId=131472" alt="" width="221" height="273" /><strong>Design Patterns for Decomposition and Coordination on Multicore Architectures</strong><br />
Colin Campbell, Ralph Johnson, Ade Miller and Stephen Toub. Foreword by Tony Hey<br />
A book that introduces .NET programmers to patterns for including parallelism in their applications. Examples of these patterns are parallel loops, parallel tasks and data aggregation with map-reduce. Each pattern has its own chapter. Each chapter includes a description of the problem, an example of where the pattern is applicable, and code that implements the solution. On this site you will find; a preliminary draft of the book, the accompanying code samples and answers to the end of chapter questions.</p>
<p>You can read this book for from following URL</p>
<p><a title="Read Here" href="http://msdn.microsoft.com/en-us/library/ff963553.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ff963553.aspx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/551/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=551&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2010/09/22/free-e-book-from-microsoft-on-parallel-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=parallelpatterns&#38;DownloadId=131472" medium="image">
			<media:title type="html">Parallel Programming in .NET</media:title>
		</media:content>
	</item>
		<item>
		<title>Parallel Programming Framework 4.0 Part 3 – ParallelLoopSate</title>
		<link>http://towardsnext.wordpress.com/2010/09/08/parallel-programming-framework-4-0-part-3-%e2%80%93-parallelloopsate/</link>
		<comments>http://towardsnext.wordpress.com/2010/09/08/parallel-programming-framework-4-0-part-3-%e2%80%93-parallelloopsate/#comments</comments>
		<pubDate>Wed, 08 Sep 2010 10:03:48 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[Parallel Programming]]></category>
		<category><![CDATA[C# 4.0]]></category>
		<category><![CDATA[Data Parallelism]]></category>
		<category><![CDATA[Paralel.Foreach]]></category>
		<category><![CDATA[Parallel]]></category>
		<category><![CDATA[ParallelLoopState]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=537</guid>
		<description><![CDATA[Control over program execution is very important. These things we are listening and learning from the time we started with programing. We used to control the execution with the help of If else, Switch, loops. In the case of loops we used to break the execution of the loop with the help of break keyword. <a href="http://towardsnext.wordpress.com/2010/09/08/parallel-programming-framework-4-0-part-3-%e2%80%93-parallelloopsate/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=537&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;"><a href="http://towardsnext.files.wordpress.com/2010/09/control.jpg"><img class="alignleft size-thumbnail wp-image-545" style="border:1px solid black;margin:5px;" title="control" src="http://towardsnext.files.wordpress.com/2010/09/control.jpg?w=122&#038;h=81" alt="" width="122" height="81" /></a>Control over program execution is very important. These things we are listening and learning from the time we started with programing. We used to control the execution with the help of If else, Switch, loops. In the case of loops we used to break the execution of the loop with the help of break keyword. </span></p>
<p style="text-align:justify;">
<p style="text-align:justify;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;">But in case of Parallel programming things are bit different. We can&#8217;t use break in Parallel.For or Parallel.ForEach. Solution for this problem is using ParallelLoopState Class. The instance of this class is provided within the body of the loop by Parallel class itself.</span></p>
<p>Have a look to the following example</p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>

<span style="font-family:Consolas;color:#0000ff;font-size:small;">class </span><span style="font-family:Consolas;color:#2b91af;font-size:small;">Program·</span>
<span style="font-family:Consolas;font-size:small;">{</span>
<span style="font-family:Consolas;color:#0000ff;font-size:small;">static <span style="font-family:Consolas;color:#0000ff;font-size:small;">void</span></span><span style="font-family:Consolas;font-size:small;"> Main(</span><span style="font-family:Consolas;color:#0000ff;font-size:small;">string</span><span style="font-family:Consolas;font-size:small;">[] args)
{</span>
<span style="font-family:Consolas;color:#0000ff;font-size:small;">long</span><span style="font-family:Consolas;font-size:small;"> size = 0;</span>

<span style="font-family:Consolas;color:#0000ff;font-size:small;">string</span><span style="font-family:Consolas;font-size:small;">[] urls = { </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://towardsnext.wordpress.com"</span><span style="font-family:Consolas;font-size:small;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://yahoo.com"</span><span style="font-family:Consolas;font-size:small;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://microsoft.com"</span><span style="font-family:Consolas;font-size:small;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://google.com"</span><span style="font-family:Consolas;font-size:small;">,                                 </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://aol.com"</span><span style="font-family:Consolas;font-size:small;">,                                 </span>
<span style="font-family:Consolas;color:#a31515;font-size:small;">"http://rediff.com"                              </span>
<span style="font-family:Consolas;font-size:small;">};</span>

<span style="font-family:Consolas;color:#2b91af;font-size:small;">Parallel</span><span style="font-family:Consolas;font-size:small;">.ForEach(urls, (url, parallelLoopState, index) =&gt;
{</span>

<span style="font-family:Consolas;color:#0000ff;font-size:small;">if</span><span style="font-family:Consolas;font-size:small;"> (size &gt; 100000)
{
                    parallelLoopState.Stop();·</span>
<span style="font-family:Consolas;color:#2b91af;font-size:small;">Console</span><span style="font-family:Consolas;font-size:small;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;font-size:small;">"Breaking Thread, Index Cancelled : "</span><span style="font-family:Consolas;font-size:small;"> + index.ToString());
}</span>
<span style="font-family:Consolas;color:#0000ff;font-size:small;">else</span>
<span style="font-family:Consolas;font-size:small;">{·</span>
<span style="font-family:Consolas;color:#2b91af;font-size:small;">WebClient</span><span style="font-family:Consolas;font-size:small;"> client = </span><span style="font-family:Consolas;color:#0000ff;font-size:small;">new </span><span style="font-family:Consolas;color:#2b91af;font-size:small;">WebClient</span><span style="font-family:Consolas;font-size:small;">();·</span>
<span style="font-family:Consolas;color:#2b91af;font-size:small;">Console</span><span style="font-family:Consolas;font-size:small;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;font-size:small;">"Element Index : {1} Downloading : {0} "</span><span style="font-family:Consolas;font-size:small;">, url, index);
                    size += client.DownloadString(url).Length;·</span>

<span style="font-family:Consolas;color:#2b91af;font-size:small;">Console</span><span style="font-family:Consolas;font-size:small;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;font-size:small;">"Total Size downloaded till now: "</span><span style="font-family:Consolas;font-size:small;"> + size);
}
});</span>

<span style="font-family:Consolas;color:#2b91af;font-size:small;">Console</span><span style="font-family:Consolas;font-size:small;">.ReadLine();
}</span>
</code></pre>
<p>In this example we are having three parameter url, parallelLoopState and index</p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;">

url is a data we passed to this body delegate

parallelLoopSate is the instance of the ParallelLoopState class provided by the Parallel Class 

index of the element of that datasource on which we are running are parallel for each. It tell on which element of the source this current body loop is working on</span></pre>
<p style="text-align:justify;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;">In the above sample we are checking about the size of the content downloaded till now, if it is going beyond 100000 bytes we are telling to the loop to stop iterating further. We achieved this by using parallelLoopState.Stop() function. There is another function available to perform the same task parallelLoopState.Break().</span></p>
<p style="text-align:justify;"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small;">Yes you are right there is a difference between parallelLoopState.Stop() and parallelLoopState.Break(). in case parallelLoopState.Break we use it typically where data source is ordered and if we call break in the loop on 5th element then all the element further to that will not be executed but below and upto 5th element (means 0-4) will be executed, where as in case of parallelLoopState.Stop it will let no other iteration further.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/537/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/537/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/537/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=537&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2010/09/08/parallel-programming-framework-4-0-part-3-%e2%80%93-parallelloopsate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/09/control.jpg?w=150" medium="image">
			<media:title type="html">control</media:title>
		</media:content>
	</item>
		<item>
		<title>Parallel Programming Framework 4.0 Part 2 &#8211; Parallel.ForEach</title>
		<link>http://towardsnext.wordpress.com/2010/08/17/parallel-programming-framework-4-0-part-2-parallel-foreach/</link>
		<comments>http://towardsnext.wordpress.com/2010/08/17/parallel-programming-framework-4-0-part-2-parallel-foreach/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 05:02:40 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[Parallel Programming]]></category>
		<category><![CDATA[C# 4.0]]></category>
		<category><![CDATA[Data Parallelism]]></category>
		<category><![CDATA[Paralel.Foreach]]></category>
		<category><![CDATA[Parallel]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=510</guid>
		<description><![CDATA[Let us talk about Data Parallelism, which means concurrent opertaion over collections, array etc. Parallel.For and Parallel.ForEach, These methods are available in the System.Threading.Tasks.Parallel class. While working with Parallel for or Parallel foreach collections or array are partitioned so that multiple threads can work concurrently on it. We will talk about how to use the <a href="http://towardsnext.wordpress.com/2010/08/17/parallel-programming-framework-4-0-part-2-parallel-foreach/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=510&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Let us talk about Data Parallelism, which means concurrent opertaion over collections, array etc. </span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Parallel.For and Parallel.ForEach, These methods are available in the System.Threading.Tasks.Parallel class. While working with Parallel for or Parallel foreach collections or array are partitioned so that multiple threads can work concurrently on it. We will talk about how to use the parallel foreach as well as about other functionality associated with it </span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">To understand more about it, let us look at the example given below. In this example we have to download the webpages content and for this we will use parallel.foreach<br />
</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>

<span style="font-family:Consolas;color:#0000ff;">using</span><span style="font-family:Consolas;"> System;</span>
<span style="font-family:Consolas;color:#0000ff;">using</span><span style="font-family:Consolas;"> System.Net;</span>
<span style="font-family:Consolas;color:#0000ff;">using</span><span style="font-family:Consolas;"> System.Threading.Tasks;</span>
<span style="font-family:Consolas;color:#0000ff;">using</span><span style="font-family:Consolas;"> System.Diagnostics;</span>

<span style="font-family:Consolas;color:#0000ff;">namespace</span><span style="font-family:Consolas;"> ConsoleApplication1
{    </span>
<span style="font-family:Consolas;color:#0000ff;">class </span><span style="font-family:Consolas;color:#2b91af;">Program    </span>
<span style="font-family:Consolas;">{        </span>
<span style="font-family:Consolas;color:#0000ff;">static <span style="font-family:Consolas;color:#0000ff;">void</span></span><span style="font-family:Consolas;"> Main(</span><span style="font-family:Consolas;color:#0000ff;">string</span><span style="font-family:Consolas;">[] args)        
{            </span>
<span style="font-family:Consolas;color:#0000ff;">string</span><span style="font-family:Consolas;">[] urls =  { </span><span style="font-family:Consolas;color:#a31515;">"http://towardsnext.wordpress.com"</span><span style="font-family:Consolas;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;">"http://yahoo.com"</span><span style="font-family:Consolas;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;">"http://microsoft.com"</span><span style="font-family:Consolas;">,                                  </span>
<span style="font-family:Consolas;color:#a31515;">"http://google.com"</span><span style="font-family:Consolas;">,                                 </span>
<span style="font-family:Consolas;color:#a31515;">"http://aol.com"</span><span style="font-family:Consolas;">,                                 </span>
<span style="font-family:Consolas;color:#a31515;">"http://rediff.com"                              </span>
<span style="font-family:Consolas;">};            </span>

<span style="font-family:Consolas;color:#2b91af;">Stopwatch</span><span style="font-family:Consolas;"> stopWatch = </span><span style="font-family:Consolas;color:#0000ff;">new </span><span style="font-family:Consolas;color:#2b91af;">Stopwatch</span><span style="font-family:Consolas;">();            </span>

<span style="font-family:Consolas;color:#008000;">//Regular foreach and downloading content            </span>
<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;">"Regular Foreach"</span><span style="font-family:Consolas;">);
            stopWatch.Start();            </span>
<span style="font-family:Consolas;color:#0000ff;">foreach</span><span style="font-family:Consolas;"> (</span><span style="font-family:Consolas;color:#0000ff;">string</span><span style="font-family:Consolas;"> url </span><span style="font-family:Consolas;color:#0000ff;">in</span><span style="font-family:Consolas;"> urls)            
{                </span>
<span style="font-family:Consolas;color:#2b91af;">WebClient</span><span style="font-family:Consolas;"> client = </span><span style="font-family:Consolas;color:#0000ff;">new </span><span style="font-family:Consolas;color:#2b91af;">WebClient</span><span style="font-family:Consolas;">();                </span>
<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;">"Downloading : "</span><span style="font-family:Consolas;"> + url);
                client.DownloadString(url);            
}            </span>
<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(stopWatch.ElapsedMilliseconds.ToString());
            stopWatch.Stop();            </span>

<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;">"Parallel Foreach"</span><span style="font-family:Consolas;">);
            stopWatch.Restart();            </span>
<span style="font-family:Consolas;color:#2b91af;">Parallel</span><span style="font-family:Consolas;">.ForEach(urls, url =&gt;            
{                </span>
<span style="font-family:Consolas;color:#2b91af;">WebClient</span><span style="font-family:Consolas;"> client = </span><span style="font-family:Consolas;color:#0000ff;">new </span><span style="font-family:Consolas;color:#2b91af;">WebClient</span><span style="font-family:Consolas;">();                </span>
<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(</span><span style="font-family:Consolas;color:#a31515;">"Downloading : "</span><span style="font-family:Consolas;"> + url);
                client.DownloadString(url);            
});            </span>
<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.WriteLine(stopWatch.ElapsedMilliseconds.ToString());
            stopWatch.Stop();            </span>

<span style="font-family:Consolas;color:#2b91af;">Console</span><span style="font-family:Consolas;">.ReadLine();        
}    
}
}</span>
</code></pre>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Output : </span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><a href="http://towardsnext.files.wordpress.com/2010/08/parallelforeach1.jpg"><img class="alignnone size-full wp-image-528" title="ParallelForEach" src="http://towardsnext.files.wordpress.com/2010/08/parallelforeach1.jpg?w=500" alt=""   /></a><br />
</span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">In this sample program we have used foreach as well as parallel.foreach. In this case Parallel.foreach will be faster since it will instantiate more than one task to download the webpages where as in normal or regular foreach it will be downloading one by one. </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/510/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/510/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/510/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=510&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2010/08/17/parallel-programming-framework-4-0-part-2-parallel-foreach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/08/parallelforeach1.jpg" medium="image">
			<media:title type="html">ParallelForEach</media:title>
		</media:content>
	</item>
		<item>
		<title>Parallel Programming Framework 4.0 Part 1</title>
		<link>http://towardsnext.wordpress.com/2010/04/16/parallel-programming-framework-4-0-part-1/</link>
		<comments>http://towardsnext.wordpress.com/2010/04/16/parallel-programming-framework-4-0-part-1/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 15:20:21 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Parallel Programming]]></category>
		<category><![CDATA[.Net 4.0]]></category>
		<category><![CDATA[TPL]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=496</guid>
		<description><![CDATA[Parallel Programming is a one of the major thing in discussion now a days. Framework 4.0 is having Parallel Programming as one of the major feature. As we know that now a days computers are having multi-cores (dual ,quad and even more) and in near future the number of cores will increase significantly. To Leverage <a href="http://towardsnext.wordpress.com/2010/04/16/parallel-programming-framework-4-0-part-1/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=496&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;color:#000000;">Parallel Programming is a one of the major thing in discussion now a days. Framework 4.0 is having Parallel Programming as one of the major feature. As we know that now a days computers are having multi-cores (dual ,quad and even more) and in near future the number of cores will increase significantly. To Leverage these advantage of hardware microsoft has given the library to support the enhanced parallel programming. It includes, new runtime, new class libraries and diagnostic tools. </span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;color:#000000;">These will help developer to write efficient code to get maximum out of the machine without getting into difficulties of the threading and thread pools. Architecture of the parallel computing by microsoft</span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;color:#000000;"> </span></p>
<div class="wp-caption alignnone" style="width: 469px"><img title="Architecture" src="http://i.msdn.microsoft.com/dynimg/IC292903.png" alt="" width="459" height="245" /><p class="wp-caption-text">High level Architecture</p></div>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;color:#000000;">We can start our Journey with Task Parallel library (TPL). User can use TPL to get the maximum performance from the code by  adding parallelism and concurrency to the applications. It will help user(developers) to utilize all the processors that are available. TPL  can partition the work, schedule the threads on the thread pools, state management and cancellation and various low level details. In this way TPL hides complexity of the low level handling of the threads and scheduling</span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;color:#000000;">Parallel programing using TPL is very much useful to achieve full utilization of the processors, but doing parallel code for simple tasks will have negative effect on the performance. So we have to look for a need and place where we should implement it.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/496/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/496/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/496/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=496&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2010/04/16/parallel-programming-framework-4-0-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://i.msdn.microsoft.com/dynimg/IC292903.png" medium="image">
			<media:title type="html">Architecture</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Maps with ASP.NET MVC</title>
		<link>http://towardsnext.wordpress.com/2010/01/10/google-maps-with-asp-net-mvc/</link>
		<comments>http://towardsnext.wordpress.com/2010/01/10/google-maps-with-asp-net-mvc/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 10:15:34 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[GOOGLE MAPS]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=468</guid>
		<description><![CDATA[Once again i am back to my blog. In these days i was working on my project, which i developed using ASP.NET MVC. In that project i was in need of using google maps, for which i tried some of the things and i was able to use it. So i want to share that <a href="http://towardsnext.wordpress.com/2010/01/10/google-maps-with-asp-net-mvc/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=468&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"> </span></p>
<div id="attachment_479" class="wp-caption alignleft" style="width: 152px"><a href="http://towardsnext.files.wordpress.com/2010/01/mvc-logo.png"><img class="size-full wp-image-479" title="ASP.Net MVC" src="http://towardsnext.files.wordpress.com/2010/01/mvc-logo.png?w=500" alt=""   /></a><p class="wp-caption-text">ASP.Net MVC</p></div>
<p>Once again i am back to my blog. In these days i was working on my project, which i developed<span style="font-family:Verdana, Arial, Helvetica, sans-serif;"> using ASP.NET MVC. In that project i was in need of using google maps, for which i tried some of the things and i was able to use it. So i want to share that part with you. In this post i will be telling about &#8220;how to use the Google maps with ASP.net MVC&#8221;. It is a very simple application in which we will just put the marks(push pin) on the map and will send them back to controller to save them. Later on those can be again used to show it back in the Maps.</span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"> </span></p>
<div id="attachment_486" class="wp-caption alignright" style="width: 198px"><a href="http://towardsnext.files.wordpress.com/2010/01/google-maps3.jpg"><img class="size-full wp-image-486" title="Google Map" src="http://towardsnext.files.wordpress.com/2010/01/google-maps3.jpg?w=500" alt=""   /></a><p class="wp-caption-text">Google Map</p></div>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">First we will start with creating a new MVC project.  To get the mark form the user we have to show him a map(google). To show him the map we are going to use the javascript function and for that we have to include the javascript api file given by google. http://www.google.com/jsapi?key=[You Key]. You have to get this key from the google so that you can access the map api. http://code.google.com/apis/maps/signup.html</span></p>
<p>After creating a new project open the index.aspx page in the view section of the project. There in the source view add the following code to get the map</p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">with following lines we are adding the API file</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">Content </span><span style="color:#ff0000;">ID</span><span style="color:#0000ff;">"indexHead" </span><span style="color:#ff0000;">ContentPlaceHolderID</span><span style="color:#0000ff;">="HeadContent" </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"&gt;

<span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">script </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text/javascript" </span><span style="color:#ff0000;">src</span><span style="color:#0000ff;">="http://www.google.com/jsapi?key=[YourKey]"&gt;&lt;/</span><span style="color:#a31515;">script</span><span style="color:#0000ff;">&gt;</span>
</code></pre>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Following is the code to load the google map in the webpage. You can get the same code from google documentation also with more extra functions and features. But what extra we are doing here is, we are adding all the points in the array so that we can send it back to the controller.</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">script </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text/javascript"&gt;
<span style="color:#0000ff;">var</span></span> allMarks = [];
google.load(<span style="color:#a31515;">"maps"</span>, <span style="color:#a31515;">"2"</span>);

<span style="color:#008000;">//This function will help us to add the mark at
<span style="color:#008000;">//location where user has double clicked. Then
<span style="color:#008000;">//we will add all the marks in our array so that
<span style="color:#008000;">//we can send it back to the controller</span></span></span></span>
<span style="color:#0000ff;">function</span> initialize() {
<span style="color:#0000ff;">var</span> map = <span style="color:#0000ff;">new</span> google.maps.Map2(document.getElementById(<span style="color:#a31515;">"map"</span>));
map.setCenter(<span style="color:#0000ff;">new</span> google.maps.LatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
GEvent.addListener(map, <span style="color:#a31515;">"dblclick"</span>, <span style="color:#0000ff;">function</span>(overlay, latlng) {
<span style="color:#0000ff;">if</span> (latlng) {
<span style="color:#0000ff;">var</span> mark = <span style="color:#0000ff;">new</span> GMarker(latlng);
allMarks.push(latlng);
map.addOverlay(mark);
}
});

}
google.setOnLoadCallback(initialize);
</code></pre>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Following function is used for sending the data to the controller. It is ajax call with the data as the array and the description. We will be calling the controller with action name. Here we are creating a object GMap containing the data</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#008000;">//This function will be called for saving the mark
<span style="color:#008000;">//for that it will send the data back to the controller</span></span>
<span style="color:#0000ff;">function</span> saveMap() {

<span style="color:#008000;">//gmap object with all values of the map mark</span>
<span style="color:#0000ff;">var</span> gmap = {
Locations: allMarks,
Description: Description.value
}

<span style="color:#008000;">//Ajax call for saving the data at the server. It will send the gmap
<span style="color:#008000;">//object tot the server</span></span>
            $.ajax({
type: <span style="color:#a31515;">"POST"</span>,
url: <span style="color:#a31515;">"/Home/Create"</span>,
data: gmap
});
}
<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">script</span><span style="color:#0000ff;">&gt;

&lt;/</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">Content</span><span style="color:#0000ff;">&gt;</span>
</code></pre>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">That is it. After doing all this we have to write one create function in the HomeController.cs class. Have a look to the following code</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">public </span><span style="color:#2b91af;">ActionResult</span> Create(<span style="color:#2b91af;">GMap</span> gmap)
{
Session[<span style="color:#a31515;">"MapData"</span>] = gmap;
<span style="color:#0000ff;">return</span> View();
}</code></pre>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">As you can see here we have used a GMap type. That type you can create as following</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">public <span style="color:#0000ff;">class </span></span><span style="color:#2b91af;">GMap</span>
{
<span style="color:#0000ff;">public <span style="color:#0000ff;">object</span></span>[] Locations { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }
<span style="color:#0000ff;">public <span style="color:#0000ff;">string</span></span> Description { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }
}</code></pre>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;">Finally we are done with it. Now you can see the following screenshots to get an idea how it is working. Also you can download the sample from <a title="Sample google maps with asp.net mvc" href="http://www.box.net/shared/q9o5oadxb3" target="_blank">here </a></span></p>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"> </span></p>
<div id="attachment_476" class="wp-caption alignleft" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2010/01/gmap1.jpg"><img class="size-medium wp-image-476" title="Google Map in ASP.NET MVC application" src="http://towardsnext.files.wordpress.com/2010/01/gmap1.jpg?w=300&#038;h=180" alt="" width="300" height="180" /></a><p class="wp-caption-text">Google Map in ASP.NET MVC application</p></div>
<p><span style="font-family:Verdana, Arial, Helvetica, sans-serif;"> </span></p>
<div id="attachment_477" class="wp-caption alignleft" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2010/01/gmap2.jpg"><img class="size-medium wp-image-477" title="Action getting data from the webpage" src="http://towardsnext.files.wordpress.com/2010/01/gmap2.jpg?w=300&#038;h=217" alt="" width="300" height="217" /></a><p class="wp-caption-text">Action getting data from the webpage</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/468/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/468/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/468/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=468&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2010/01/10/google-maps-with-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/01/mvc-logo.png" medium="image">
			<media:title type="html">ASP.Net MVC</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/01/google-maps3.jpg" medium="image">
			<media:title type="html">Google Map</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/01/gmap1.jpg?w=300" medium="image">
			<media:title type="html">Google Map in ASP.NET MVC application</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2010/01/gmap2.jpg?w=300" medium="image">
			<media:title type="html">Action getting data from the webpage</media:title>
		</media:content>
	</item>
		<item>
		<title>.Net RIA Service Part 1</title>
		<link>http://towardsnext.wordpress.com/2009/09/03/net-ria-service-part-1/</link>
		<comments>http://towardsnext.wordpress.com/2009/09/03/net-ria-service-part-1/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 10:05:00 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[RIA Service]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=456</guid>
		<description><![CDATA[What is a .Net RIA Service It is set of libraries and tools given, to help develop the Rich internet application in much easier fashion. When we develop silverlight application we need to interact with the server for various reasons. Now .Net RIA Service will make that much easier and better. In our normal silverlight <a href="http://towardsnext.wordpress.com/2009/09/03/net-ria-service-part-1/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=456&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>What is a .Net RIA Service</h3>
<p>It is set of libraries and tools given, to help develop the Rich internet application in much easier fashion. When we develop silverlight application we need to interact with the server for various reasons. Now .Net RIA Service will make that much easier and better.</p>
<p>In our normal silverlight application we used to interact with the server from the client code to move data in async fashion and managing it. But now .NET RIA Service will just hide it all from you and handles all those stuff. You can concentrate more on what to do with data rather than how to get the data.</p>
<p>It is link between the presentation layer and business logic layer. You can add various kind of validation also to be performed.</p>
<p>you can download these services from <a href="http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en">here</a></p>
<p>Now i am developing sample application of RIA Service with silverlight and will post it with complete working details of .net RIA Service</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/456/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/456/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/456/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=456&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2009/09/03/net-ria-service-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>
	</item>
		<item>
		<title>Exam Time</title>
		<link>http://towardsnext.wordpress.com/2009/05/29/exam-time/</link>
		<comments>http://towardsnext.wordpress.com/2009/05/29/exam-time/#comments</comments>
		<pubDate>Fri, 29 May 2009 16:29:57 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[Towards Next]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=447</guid>
		<description><![CDATA[Hi all i am back now. Sorry for so much of delay But in these days i went through various new technologies. Now i will posting on that. First i will post on .NET RIA Service and further on WCF. If anything specific leave a comment for me. Hi everybody. Thanks for visiting the blog. <a href="http://towardsnext.wordpress.com/2009/05/29/exam-time/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=447&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-medium wp-image-448" title="Exams" src="http://towardsnext.files.wordpress.com/2009/05/review.jpg?w=207&#038;h=219" alt="Exams" width="207" height="219" /></p>
<p>Hi all i am back now. Sorry for so much of delay <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  But in these days i went through various new technologies. Now i will posting on that. First i will post on .NET RIA Service and further on WCF. If anything specific leave a comment for me.</p>
<p><span style="text-decoration:line-through;">Hi everybody. Thanks for visiting the blog. I am busy with exams so i will not be able to post new articles for few days. But i will try to post various good and nice article listed as soon as possible.</span></p>
<p><span style="text-decoration:line-through;">I have a list of nice articles to be posted mainly on following</span></p>
<p><span style="text-decoration:line-through;">MVC, JQuery, RESTful Service, RIA Service, WebServices, And others</span></p>
<p><span style="text-decoration:line-through;">If you want me to post on some specific topics or issue please leave a comments.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/447/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/447/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/447/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=447&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2009/05/29/exam-time/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/05/review.jpg?w=284" medium="image">
			<media:title type="html">Exams</media:title>
		</media:content>
	</item>
		<item>
		<title>Glimmer jQuery Effects Designer</title>
		<link>http://towardsnext.wordpress.com/2009/05/02/glimmer-jquery-effects-designer/</link>
		<comments>http://towardsnext.wordpress.com/2009/05/02/glimmer-jquery-effects-designer/#comments</comments>
		<pubDate>Sat, 02 May 2009 12:28:33 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Glimmer]]></category>
		<category><![CDATA[JQUERY]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=418</guid>
		<description><![CDATA[It is tool which helps to create interactive elements in the webpage. It is nice tool developed in WPF. You can insert various effects too Check the following screen shots and visit the glimmer website and check the video. also you can download setup from here Its a nice tool check at mix Sample Screen <a href="http://towardsnext.wordpress.com/2009/05/02/glimmer-jquery-effects-designer/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=418&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_425" class="wp-caption alignleft" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2009/05/home_sidebar_glimmer.jpg"><img class="size-medium wp-image-425" title="Glimmer" src="http://towardsnext.files.wordpress.com/2009/05/home_sidebar_glimmer.jpg?w=300&#038;h=76" alt="Glimmer tool for creating interactive elements using JQuery" width="300" height="76" /></a><p class="wp-caption-text">Glimmer tool for creating interactive elements using JQuery</p></div>
<p>It is tool which helps to create interactive elements in the webpage. It is nice tool developed in WPF. You can insert various effects too</p>
<p>Check the following screen shots and visit the glimmer website and check the <a title="Video" href="http://visitmix.com/Lab/Glimmer" target="_blank">video</a>. also you can download setup from <a title="Glimmer JQuery" href="http://code.msdn.microsoft.com/glimmer/Release/ProjectReleases.aspx?ReleaseId=2578" target="_blank">here</a></p>
<p>Its a nice tool check at <a title="Mix" href="http://visitmix.com" target="_blank">mix</a></p>
<p><strong> Sample Screen shots of glimmer.</strong></p>
<div id="attachment_429" class="wp-caption alignnone" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2009/05/glimmer2.jpg"><img class="size-medium wp-image-429" title="Image Sequence Wizard" src="http://towardsnext.files.wordpress.com/2009/05/glimmer2.jpg?w=300&#038;h=182" alt="Image Sequence Wizard" width="300" height="182" /></a><p class="wp-caption-text">Image Sequence Wizard</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/418/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=418&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2009/05/02/glimmer-jquery-effects-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://mschannel9.vo.msecnd.net/o9/mix/labs/glimmer/glimmer.wmv" length="37438401" type="video/x-ms-wmv" />
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/05/home_sidebar_glimmer.jpg?w=300" medium="image">
			<media:title type="html">Glimmer</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/05/glimmer2.jpg?w=300" medium="image">
			<media:title type="html">Image Sequence Wizard</media:title>
		</media:content>
	</item>
		<item>
		<title>Event Calendar in MVC application Using jMonthCalendar(JQuery)</title>
		<link>http://towardsnext.wordpress.com/2009/04/30/event-calendar-in-mvc-application-using-jmonthcalendarjquery/</link>
		<comments>http://towardsnext.wordpress.com/2009/04/30/event-calendar-in-mvc-application-using-jmonthcalendarjquery/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 17:25:30 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[jMonthCalendar]]></category>
		<category><![CDATA[JQUERY]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=408</guid>
		<description><![CDATA[A good Jquery plugin is available as Event Calendar which can be download from following location. http://www.bytecyclist.com/projects/jmonthcalendar/ or http://code.google.com/p/jmonthcalendar/ I used it in one sample project with MVC and loaded certain events from the controller. Which can in return load from the Model. But for the time being in this sample i returned from the <a href="http://towardsnext.wordpress.com/2009/04/30/event-calendar-in-mvc-application-using-jmonthcalendarjquery/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=408&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">A good Jquery plugin is available as Event Calendar which can be download from following location. </span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><a title="http://www.bytecyclist.com/projects/jmonthcalendar/" href="http://www.bytecyclist.com/projects/jmonthcalendar/" target="_blank">http://www.bytecyclist.com/projects/jmonthcalendar/</a><br />
or<br />
<a title="http://code.google.com/p/jmonthcalendar/" href="http://code.google.com/p/jmonthcalendar/" target="_blank">http://code.google.com/p/jmonthcalendar/</a></span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">I used it in one sample project with MVC and loaded certain events from the controller. Which can in return load from the Model. But for the time being in this sample i returned from the controller it self. </span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">public </span><span style="color:#2b91af;">ActionResult</span> Events(<span style="color:#0000ff;">string</span> date)
{
<span style="color:#2b91af;">MyEvents</span> event1 = <span style="color:#0000ff;">new </span><span style="color:#2b91af;">MyEvents            </span>
{
EventID = 11 ,
StartDate = <span style="color:#0000ff;">new </span><span style="color:#2b91af;">DateTime</span>(2009,04,01),
Title = <span style="color:#a31515;">"Meeting with Boss"</span>,
Description = <span style="color:#a31515;">"Meeting on product release"</span>,
CssClass = <span style="color:#a31515;">"Meeting"</span>,
URL= <span style="color:#a31515;">"/Home/EventDetails/11"            </span>
};

<span style="color:#2b91af;">MyEvents</span> event2 = <span style="color:#0000ff;">new </span><span style="color:#2b91af;">MyEvents            </span>
{
EventID = 12,
StartDate = <span style="color:#0000ff;">new </span><span style="color:#2b91af;">DateTime</span>(2009, 04, 01),
Title = <span style="color:#a31515;">"Celebration"</span>,
Description = <span style="color:#a31515;">"Fathers birthday"</span>,
CssClass = <span style="color:#a31515;">"Birthday"</span>,
URL = <span style="color:#a31515;">"/Home/EventDetails/12"            </span>
};

<span style="color:#0000ff;">string</span>[] stringlist = <span style="color:#0000ff;">new <span style="color:#0000ff;">string</span></span>[2];
stringlist[0] = event1.GetJSONResult();
stringlist[1] = event2.GetJSONResult();

<span style="color:#0000ff;">return</span> Json(stringlist);
}</code></pre>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><br />
For calling the events it did getJson call from the index page where the jMonthCalendar is shown. It will call one of the function the Controller and in return will get the array of the events which will then be sent to the jMonthCalendar. It will load the events. We can add the URL also so that when user clicks the event he will get the complete detail once again with the help of the controller</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">script </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text/javascript"&gt;</span>
    $().ready(<span style="color:#0000ff;">function</span>() {
<span style="color:#0000ff;">var</span> options = {

height: 650,
width: 980,
navHeight: 25,
labelHeight: 25,

onMonthChanging: <span style="color:#0000ff;">function</span>(dateIn) {
$.getJSON(<span style="color:#a31515;">"http://localhost:1511/Home/Events"</span>,
<span style="color:#0000ff;">function</span>(data) {

<span style="color:#008000;">//Array of my events                    </span>
<span style="color:#0000ff;">var</span> events = <span style="color:#0000ff;">new</span> Array();

<span style="color:#008000;">//Loop and load all the events and load them into the array</span>
                    $.each(data, <span style="color:#0000ff;">function</span>(i, item) {

<span style="color:#0000ff;">var</span> oResultData = eval(<span style="color:#a31515;">'('</span> + item + <span style="color:#a31515;">')'</span>);
<span style="color:#0000ff;">var</span> event = { <span style="color:#a31515;">"EventID"</span>: 5, <span style="color:#a31515;">"Date"</span>: oResultData.StartDate,
<span style="color:#a31515;">"Title"</span>: oResultData.Title, <span style="color:#a31515;">"URL"</span>: oResultData.URL,
<span style="color:#a31515;">"Description"</span>: oResultData.Description,
<span style="color:#a31515;">"CssClass"</span>: oResultData.CssClass
};

events.push(event);

});

<span style="color:#008000;">//Load the events into the calendar</span>
                    $.jMonthCalendar.ReplaceEventCollection(events);
$.jMonthCalendar.DrawCalendar(dateIn);
});
<span style="color:#0000ff;">return <span style="color:#0000ff;">true</span></span>;
},
onEventBlockOver: <span style="color:#0000ff;">function</span>(event) {
<span style="color:#0000ff;">return <span style="color:#0000ff;">true</span></span>;
},
onEventBlockOut: <span style="color:#0000ff;">function</span>(event) {
<span style="color:#0000ff;">return <span style="color:#0000ff;">true</span></span>;
},
onDayLinkClick: <span style="color:#0000ff;">function</span>(date) {
<span style="color:#0000ff;">return <span style="color:#0000ff;">true</span></span>;
},
onDayCellClick: <span style="color:#0000ff;">function</span>(date) {
<span style="color:#0000ff;">return <span style="color:#0000ff;">true</span></span>;
}
};

<span style="color:#0000ff;">var</span> newevents = [];
$.jMonthCalendar.Initialize(options, newevents);
});<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">script</span><span style="color:#0000ff;">&gt;</span>
</code></pre>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><br />
Download the sample from following location</span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><a title="Event Calendar" href="http://www.box.net/shared/ab9lrmpvy8" target="_blank">EventCalendar</a><br />
</span></p>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Here are the screen shot of the application.</span></p>
<div id="attachment_409" class="wp-caption alignnone" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2009/04/eventcalendar.jpg"><img class="size-medium wp-image-409" title="Event Calendar in MVC Application" src="http://towardsnext.files.wordpress.com/2009/04/eventcalendar.jpg?w=300&#038;h=180" alt="Event Calendar in MVC Application" width="300" height="180" /></a><p class="wp-caption-text">Event Calendar in MVC Application</p></div>
<div id="attachment_410" class="wp-caption alignnone" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2009/04/eventdetailresult.jpg"><img class="size-medium wp-image-410" title="Detail of selected=" src="http://towardsnext.files.wordpress.com/2009/04/eventdetailresult.jpg?w=300&#038;h=180" alt="Detail of selected=" width="300" height="180" /></a><p class="wp-caption-text">Detail of selected Event</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/408/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=408&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2009/04/30/event-calendar-in-mvc-application-using-jmonthcalendarjquery/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/04/eventcalendar.jpg?w=300" medium="image">
			<media:title type="html">Event Calendar in MVC Application</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/04/eventdetailresult.jpg?w=300" medium="image">
			<media:title type="html">Detail of selected=</media:title>
		</media:content>
	</item>
		<item>
		<title>File upload in ASP.NET MVC</title>
		<link>http://towardsnext.wordpress.com/2009/04/17/file-upload-in-aspnet-mvc/</link>
		<comments>http://towardsnext.wordpress.com/2009/04/17/file-upload-in-aspnet-mvc/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 10:55:13 +0000</pubDate>
		<dc:creator>A.Sethi</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[JQUERY]]></category>
		<category><![CDATA[UPLOAD]]></category>

		<guid isPermaLink="false">http://towardsnext.wordpress.com/?p=394</guid>
		<description><![CDATA[Here is a sample for handling upload of a file, In your MVC application. In this sample i used the Dialog box of JQuery, where user will select the file and will click upload &#60;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&#62;     &#60;h2&#62;Files uploaded to server&#60;/h2&#62;     &#60;div id="dialog" title="Upload files"&#62;             &#60;% using (Html.BeginForm("Upload", "File", FormMethod.Post, new { enctype = <a href="http://towardsnext.wordpress.com/2009/04/17/file-upload-in-aspnet-mvc/" class="excerpt-more-link">[&#8230;]</a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=394&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;">Here is a sample for handling upload of a file, In your MVC application. In this sample i used the Dialog box of JQuery, where user will select the file and will click upload</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">Content </span><span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="Content2" </span><span style="color:#ff0000;">ContentPlaceHolderID</span><span style="color:#0000ff;">="MainContent" </span><span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"&gt;    

<span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">h2</span><span style="color:#0000ff;">&gt;</span>Files uploaded to server<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">h2</span><span style="color:#0000ff;">&gt;    

<span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">div </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="dialog" </span><span style="color:#ff0000;">title</span><span style="color:#0000ff;">="Upload files"&gt;        </span>
    &lt;% <span style="color:#0000ff;">using</span> (Html.BeginForm(<span style="color:#a31515;">"Upload"</span>, <span style="color:#a31515;">"File"</span>, <span style="color:#2b91af;">FormMethod</span>.Post, <span style="color:#0000ff;">new </span>{ enctype = <span style="color:#a31515;">"multipart/form-data" </span>}))
    {%&gt;<span style="color:#0000ff;">&lt;</span><span style="color:#a31515;">br </span><span style="color:#0000ff;">/&gt;
<span style="color:#0000ff;">        &lt;</span></span><span style="color:#a31515;">p</span><span style="color:#0000ff;">&gt;&lt;</span><span style="color:#a31515;">input </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="file" </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="fileUpload" </span><span style="color:#ff0000;">name</span><span style="color:#0000ff;">="fileUpload" </span><span style="color:#ff0000;">size</span><span style="color:#0000ff;">="23"/&gt; <span style="color:#0000ff;">;&lt;/</span></span><span style="color:#a31515;">p</span><span style="color:#0000ff;">&gt;&lt;</span><span style="color:#a31515;">br </span><span style="color:#0000ff;">/&gt;
<span style="color:#0000ff;">        &lt;</span></span><span style="color:#a31515;">p</span><span style="color:#0000ff;">&gt;&lt;</span><span style="color:#a31515;">input </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="submit" </span><span style="color:#ff0000;">value</span><span style="color:#0000ff;">="Upload file" <span style="color:#0000ff;">/&gt;&lt;/</span></span><span style="color:#a31515;">p</span><span style="color:#0000ff;">&gt;        </span>
    &lt;% } %&gt;    
<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">div</span><span style="color:#0000ff;">&gt;
<span style="color:#0000ff;">&lt;</span></span><span style="color:#a31515;">a </span><span style="color:#ff0000;">href</span><span style="color:#0000ff;">="#" </span><span style="color:#ff0000;">onclick</span><span style="color:#0000ff;">="jQuery('#dialog').dialog('open'); return false"&gt;</span>Upload File<span style="color:#0000ff;">&lt;/</span><span style="color:#a31515;">a</span><span style="color:#0000ff;">&gt;
&lt;/</span><span style="color:#a31515;">asp</span><span style="color:#0000ff;">:</span><span style="color:#a31515;">content</span><span style="color:#0000ff;">&gt;</span></code></pre>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><br />
Then we have to handle this request in the respective controller which is specified in BeginForm of our above code (FileContoller) and action name (Upload). Following will be our code in the FileController Controller for the Upload action</span></p>
<pre style="border:1px dashed #999999;overflow:auto;width:95%;color:#000000;line-height:14px;padding:5px;"><code>
<span style="color:#0000ff;">public <span style="color:#0000ff;">void</span></span> Upload()
{
<span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">string</span> inputTagName <span style="color:#0000ff;">in</span> Request.Files)
{
<span style="color:#2b91af;">HttpPostedFileBase</span> file = Request.Files[inputTagName];
<span style="color:#0000ff;">if</span> (file.ContentLength &gt; 0)
{
<span style="color:#0000ff;">string</span> filePath = <span style="color:#2b91af;">Path</span>.Combine(HttpContext.Server.MapPath(<span style="color:#a31515;">"../Uploads"</span>)
, <span style="color:#2b91af;">Path</span>.GetFileName(file.FileName));
file.SaveAs(filePath);
}
}

RedirectToAction(<span style="color:#a31515;">"Index"</span>, <span style="color:#a31515;">"File"</span>);
}</code></pre>
<p><span style="font-family:Verdana,Arial,Helvetica,sans-serif;"><br />
Download the sample code from <a title="Download sample code" href="http://www.box.net/shared/zph4h2cb8p" target="_blank">here</a></span></p>
<div id="attachment_398" class="wp-caption alignnone" style="width: 310px"><a href="http://towardsnext.files.wordpress.com/2009/04/upload11.jpg"><img class="size-medium wp-image-398" title="File upload in MVC with JQuery Dialog" src="http://towardsnext.files.wordpress.com/2009/04/upload11.jpg?w=300&#038;h=182" alt="File upload in MVC with JQuery Dialog" width="300" height="182" /></a><p class="wp-caption-text">File upload in MVC with JQuery Dialog</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/towardsnext.wordpress.com/394/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/towardsnext.wordpress.com/394/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/towardsnext.wordpress.com/394/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=towardsnext.wordpress.com&amp;blog=4711428&amp;post=394&amp;subd=towardsnext&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://towardsnext.wordpress.com/2009/04/17/file-upload-in-aspnet-mvc/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d572ac324d6be5d65351eba70d1a029d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">A.Sethi</media:title>
		</media:content>

		<media:content url="http://towardsnext.files.wordpress.com/2009/04/upload11.jpg?w=300" medium="image">
			<media:title type="html">File upload in MVC with JQuery Dialog</media:title>
		</media:content>
	</item>
	</channel>
</rss>
