<?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>Code Trek</title>
	<atom:link href="http://codetrek.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codetrek.wordpress.com</link>
	<description>To Go Where I have Never Gone Before</description>
	<lastBuildDate>Sat, 29 Dec 2012 02:47:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codetrek.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Trek</title>
		<link>http://codetrek.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codetrek.wordpress.com/osd.xml" title="Code Trek" />
	<atom:link rel='hub' href='http://codetrek.wordpress.com/?pushpress=hub'/>
		<item>
		<title>New Home</title>
		<link>http://codetrek.wordpress.com/2012/12/29/new-home/</link>
		<comments>http://codetrek.wordpress.com/2012/12/29/new-home/#comments</comments>
		<pubDate>Sat, 29 Dec 2012 02:43:12 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=427</guid>
		<description><![CDATA[All of my blog, Code Trek is now hosted with Windows Azure along with my homepage at kowsheek.com. The posts still have the same permalink structure so you can reach all the posts on the site by replacing http://codetrek.wordpress.com/ with http://kowsheek.com/blog/. Here&#8217;s wishing you all the best an more to come in 2013!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=427&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>All of <a href="http://kowsheek.com/blog">my blog</a>, Code Trek is now hosted with <a href="http://windowsazure.com/">Windows Azure</a> along with my homepage at <a href="http://kowsheek.com/">kowsheek.com</a>.</p>
<p>The posts still have the same permalink structure so you can reach all the posts on the site by replacing <code><a href="http://codetrek.wordpress.com/" rel="nofollow">http://codetrek.wordpress.com/</a></code> with <code><a href="http://kowsheek.com/blog/" rel="nofollow">http://kowsheek.com/blog/</a></code>.</p>
<p>Here&#8217;s wishing you all the best an more to come in 2013!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/427/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/427/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=427&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2012/12/29/new-home/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello Windows 8 XNA-ish</title>
		<link>http://codetrek.wordpress.com/2012/09/07/hello-windows8-xna-ish/</link>
		<comments>http://codetrek.wordpress.com/2012/09/07/hello-windows8-xna-ish/#comments</comments>
		<pubDate>Fri, 07 Sep 2012 15:06:51 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[MonoGame]]></category>
		<category><![CDATA[SharpDX]]></category>
		<category><![CDATA[SickHeadGames]]></category>
		<category><![CDATA[Windows 8]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=415</guid>
		<description><![CDATA[Yes you read that right. You can really get a flavor of XNA on that snazzy new Windows 8 installation of yours. Anything you build using this can work as Modern UI app. I know for many of us, like the crew at Three Red Cubes, this revelation put a smile across our faces. Before you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=415&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Yes you read that right. You can really get a flavor of XNA on that snazzy new Windows 8 installation of yours.</p>
<p>Anything you build using this can work as Modern UI app. I know for many of us, like the crew at <a href="http://threeredcubes.com/">Three Red Cubes</a>, this revelation put a smile across our faces.</p>
<p>Before you think I am bluffing, much of what I am about to detail has been covered by <a href="http://blogs.msdn.com/b/bobfamiliar/">the original posts</a>. Also, there is a <a href="http://channel9.msdn.com/coding4fun/blog/XNA-and-a-Windows-8-Store-game-MonoGame">Channel9</a> post about it.</p>
<p>Here is a rundown of my experience and the broad strokes of the steps.</p>
<h3>Backstory</h3>
<p>The answer to the owes of XNA developers comes in the form of <a href="http://monogame.codeplex.com/">MonoGame</a> which is an open source implementation of Microsoft XNA 4. MonoGame allows XNA-style development for plenty of platforms but that&#8217;s not the focus.</p>
<p>The development of MonoGame for Windows 8 has been a little slow so the hackers at <a href="http://www.sickhead.com/">SickHeadGames</a> came to the rescue.</p>
<p>Now it is possible to migrate existing XNA games without having to dive through <a href="http://www.sharpdx.org/">SharpDX</a>.</p>
<h3>(Kind of Long) Setup</h3>
<p><strong>a. Getting into Github</strong></p>
<p><a href="https://github.com/signup/free">Github account</a> and the <a href="http://windows.github.com/">client</a> are free. Also, One click installs are awesome!</p>
<p><strong>b. MonoGame Source Code</strong></p>
<p>1. Run Git Shell.<br />
2. Change directory (<code>cd</code>) to where you want to store your code<br />
3. Copy and paste this to the shell and hit enter:</p>
<p><code>git clone <a href="https://github.com/SickheadGames/MonoGame" rel="nofollow">https://github.com/SickheadGames/MonoGame</a> &amp;&amp; cd MonoGame &amp;&amp; git submodule init &amp;&amp; git submodule update</code></p>
<p>to start pulling the code.</p>
<p><strong>c. Visual Studio Template</strong></p>
<p>If you browse to <code>C:\Users\[you]\Documents\GitHub\MonoGame\ProjectTemplates\VisualStudio11.MonoGame.2.5\VS11MGWindowsMetroTemplate</code> you&#8217;ll find a whole bunch of files that you can zip up and copy over to <code>C:\Users\[you]\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#</code>. This will create a Visual Studio 2012 project template once you restart Visual Studio.</p>
<p><strong>d. Reference MonoGame</strong></p>
<p>Once you start a solution using that new template we just created, right click on your solution in the Solution Explorer and add the MonoGame Framework Windows 8 Project from <code>C:\Users\[you]\Documents\GitHub\MonoGame\MonoGame.Framework\MonoGame.Framework.Windows8.sln</code>.</p>
<p>Now, add a reference to the MonoGame Framework in your game project by right clicking on references, select Add Reference. Under Projects choose the MonoGame Framework project (check the box!) and click OK.</p>
<p><strong>e. Hit F5</strong></p>
<p>Make sure you select the game project to be the startup project and compile and run the project.<br />
You should be greeted with the good-old cornflower blue that XNA programmers know and love.</p>
<p><img class="aligncenter size-full wp-image-417" title="MonoGame Cornflower Blue" src="http://codetrek.files.wordpress.com/2012/09/0268-image_06f902c7.png?w=590&#038;h=377" alt="" width="590" height="377" /></p>
<p><strong>f. Content Pipeline</strong></p>
<p>You may have noticed the absence of that good old content project. At this time, MonoGame does not have an implementation of the Content Pipeline and Visual Studio 2012 does not have native support for XNA development therefore we need a workaround until which is in about a <a href="https://github.com/mono/MonoGame/issues?milestone=3">month</a> at the time of writing:</p>
<p>1. Head over to <a href="http://blogs.msdn.com/b/astebner/archive/2012/02/29/10274694.aspx">Aaron Stebner&#8217;s blog post</a> and (possibly) install XNA Game Studio or Windows Phone on Windows 8.<br />
2. Open up <em>Visual Studio 2010</em> and create a XNA project that will come with the content project.<br />
3. Import all your resources and build the project which will output <code>xnb</code> files to <code>C:\Users\[you]\Documents\Visual Studio 2010\Projects\[project name]\[project name]\[project name]\bin\x86\Debug\Content</code>.<br />
4. Copy these files to your MonoGame project&#8217;s <code>Content</code> folder: <code>C:\Users\[you]\Documents\Visual Studio 2012\Projects\[project name]\[project name]\bin\Debug\AppX\Content</code>.</p>
<p>Now, you can use the <code>ContentManager</code> object to load game assets during runtime. Just like the XNA we know.</p>
<h3>Credits</h3>
<p>All of this came into light, once again, from <a href="http://blogs.msdn.com/b/bobfamiliar/archive/2012/08/01/windows-8-xna-and-monogame-part-1-overview.aspx?wa=wsignin1.0">Bob Familiar&#8217;s blog posts</a>. And it is only possible because of the hard work of the MonoGame project and SickHeadGames.</p>
<h3>Q &amp; A</h3>
<p>So, is XNA dead?<br />
I don&#8217;t think so. It has been reincarnated in Windows 8.</p>
<p>Will there be a Windows 8 XNA Game Studio release from Microsoft?<br />
We don&#8217;t know yet, but you never know.</p>
<p>Is MonoGame the only solution?<br />
No, SharpDX is just an awesome a solution.</p>
<p>For now though, here&#8217;s to having XNA back on Windows 8.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/415/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/415/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=415&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2012/09/07/hello-windows8-xna-ish/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2012/09/0268-image_06f902c7.png" medium="image">
			<media:title type="html">MonoGame Cornflower Blue</media:title>
		</media:content>
	</item>
		<item>
		<title>Microsoft of the Future is Now</title>
		<link>http://codetrek.wordpress.com/2012/03/28/microsoft-of-the-future-is-now/</link>
		<comments>http://codetrek.wordpress.com/2012/03/28/microsoft-of-the-future-is-now/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 06:16:05 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Cubes]]></category>
		<category><![CDATA[Future]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Open]]></category>
		<category><![CDATA[Red]]></category>
		<category><![CDATA[Source]]></category>
		<category><![CDATA[Start]]></category>
		<category><![CDATA[Startup]]></category>
		<category><![CDATA[Student]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Three]]></category>
		<category><![CDATA[Up]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=399</guid>
		<description><![CDATA[Last weekend my friends from Three Red Cubes Inc. and I were at NBTC. A detailing of the event itself deserves a post, but this post is based on a conversation I had with the CEO of a pretty cool and successful Toronto-based start-up developing software as services using Java-based web-frameworks. As most of my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=399&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last weekend my friends from <a href="https://www.facebook.com/threeredcubes">Three Red Cubes Inc.</a> and I were at <a href="http://nbtc2011.nspire.org/">NBTC</a>. A detailing of the event itself deserves a post, but this post is based on a conversation I had with the CEO of a pretty cool and successful Toronto-based start-up developing software as services using Java-based web-frameworks.</p>
<p>As most of my conversations do, the question came to, &#8220;Why do you, as a start-up, use .Net?&#8221;</p>
<p>In most people&#8217;s perspective, Microsoft&#8217;s technologies are confined to being used in the cubicles of high-rise corporate buildings. Images of Windows 98 and XP flash through their minds when you say Microsoft. If you identify yourself as a .Net developer, they look confused, wondering why you don&#8217;t look like a nerd or surprised that you are having a conversation, in-person. They probably think you should look a lot like <a href="http://www.google.com/imgres?start=97&amp;hl=en&amp;biw=1280&amp;bih=720&amp;tbm=isch&amp;tbnid=9nowE6AMFF5zOM:&amp;imgrefurl=http://www.iloveoegen.com/post/2011/08/09/Net-Developer-needed.aspx&amp;docid=u_wjf3yHygYvAM&amp;imgurl=http://www.iloveoegen.com/image.axd%253Fpicture%253D2011%25252F8%25252Fgeek.jpg&amp;w=201&amp;h=251&amp;ei=apJyT8q5CKjm0QHav5XhAQ&amp;zoom=1">this guy</a>.</p>
<p>Not an image start-ups should associate with. Not one bit.</p>
<p>The new face of Microsoft is not represented by their past image, but it&#8217;s not determining the future. The future of Microsoft is being determined right now.</p>
<h3>Embracing Open-Source</h3>
<p>A few hours before I started writing this, it was announced that ASP.Net MVC 4 and several related technologies are being made available as open-source projects, accepting contributions from the community. That&#8217;s massive because ASP.Net MVC is Microsoft&#8217;s flagship web-framework of the future. If this is the attitude towards ASP.Net MVC, I can&#8217;t wait to see what&#8217;s in store.</p>
<p>This is not the first time of course, there has been many more initiatives from Microsoft which are all enumerated at <a href="https://www.microsoft.com/en-us/openness/">Microsoft Openness</a>. As this push continues, I believe we will see <a href="http://www.codeplex.com/">CodePlex</a> and <a href="http://nuget.org/">Nuget</a> take centre stage. These are two amazing platforms where open-source is very alive.</p>
<p>Now, there are a lot of conspiracy theories around the reasons behind Microsoft&#8217;s push towards open-source. For me, as long as I have personally seen initiatives such as <a href="http://www.webnotwar.ca/">Web Not War</a> in action and as long as the community is being nurtured, I&#8217;m good.</p>
<h3>Unifying Experiences</h3>
<p>Having heard it from <a href="https://www.microsoft.com/canada/media/bios/bio-eric_gales.aspx">Eric Gales</a> at NBTC, I can say that Microsoft&#8217;s realization that all technology should be unified is comforting.</p>
<p>Technology-wise, everything is being brought under one umbrella, which is great! Specially as a young developer, I can learn everything I wish to on the .Net web-stack and then transfer these skills to say, game development. And this is not just theory, I am a web-developer by birth but with the guys at Three Red Cubes I&#8217;ve worked on more than one game. It&#8217;s made possibly by how well the entire collection of frameworks and tools are integrated. They say Visual Studio spoils you, it&#8217;s true.</p>
<p>For consumers, learning to use Word or Excel means having learnt to use <a href="http://www.microsoft.com/en-us/office365/online-software.aspx">Office365</a> or <a href="http://windows.microsoft.com/en-US/skydrive/home">SkyDrive</a> because they all provide an unified experience. This is the case for Windows Phone, XBox and the up-coming Windows 8. They all speak the same user-experience language so we&#8217;re always at home.</p>
<h3>Engaging Students</h3>
<p>From my experience as a student, there is no other company that I know of that puts in so much effort to reach students. Microsoft has teams of amazing people dedicated to running programs for us students. The <a href="https://www.dreamspark.com/">Dreamspark</a> program is just one of many programs that make software worth thousands of dollars available to us students.</p>
<p>This is to Microsoft&#8217;s advantage of course. Students are going to continue on to become developers, consumers and influence the course of  technology and businesses.</p>
<h3>Inspiring the Future</h3>
<p>Part of building a future is tackling the problems of the present. <a href="http://www.imaginecup.com/">Imagine Cup</a> is yet another way for Microsoft to encourage students to use their technologies. This time, to change the world and to solve problems experienced by thousands if not millions over the world. Big words? Not at all, this has been the culture of Imagine Cup, <a href="http://www.imaginecup.com/CompetitionsContent/History.aspx">see for yourself</a>.</p>
<p>To arrive at anything remotely close to its <a href="https://www.microsoft.com/office/vision/">vision</a>, a world interconnected via technology and the cloud, Microsoft has to work tremendously hard. Maybe five years is a tall order but with all that it is doing, Windows 8, <a href="http://www.windowsazure.com/en-us/">Windows Azure</a>, and .Net technologies, powering forward to a super sleek future is only but a matter of time.</p>
<p>As a start-up, the image we associate with is open-minded, community-involving, forward-thinking and technologically savvy. And this is the kind of future that seems to be in the making for Microsoft. Being as smart as we are, Three Red Cubes jumped on board pretty early. This can only end well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/399/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/399/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=399&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2012/03/28/microsoft-of-the-future-is-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>Building Laaalallaaa Share</title>
		<link>http://codetrek.wordpress.com/2012/02/07/building-laaalallaaa-share/</link>
		<comments>http://codetrek.wordpress.com/2012/02/07/building-laaalallaaa-share/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 17:46:02 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[Chooser]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Launcher]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[Namespace]]></category>
		<category><![CDATA[Player]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[Status]]></category>
		<category><![CDATA[Task]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=389</guid>
		<description><![CDATA[My tally for Windows Phone 7 applications isn&#8217;t too high. Not compared to some of my friends at Three Red Cubes. In my defense though, I&#8217;ve been working on several MVC projects that are pure fun to work with. But to close the gap, I got down and dirty and wrote Laaalallaaa Share (♫share). The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=389&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>My tally for Windows Phone 7 applications isn&#8217;t too high. Not compared to some of my friends at <a href="http://fb.me/threeredcubes/">Three Red Cubes</a>. In my defense though, I&#8217;ve been working on several MVC projects that are pure fun to work with. But to close the gap, I got down and dirty and wrote <a title="♫share" href="http://www.windowsphone.com/en-US/apps/615c5ca3-b4a4-48d8-a09f-cabd6ccbe060">Laaalallaaa Share (♫share)</a>.</p>
<p>The application is really simple but it uses a very interesting .Net namespace <code>Microsoft.Xna.Framework.Media</code> and some classes from <code>Microsoft.Phone.Tasks</code>.</p>
<h3>MediaPlayer</h3>
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.media.mediaplayer.aspx">This static class</a> exposes a number of methods and properties to access the media player (duh!) and the library.</p>
<p>For example I used the properties in <code>MediaPlayer.Queue.ActiveSong</code> to find the details of the current song being played. <code>MediaPlayer.State</code> holds the status of the media player, use it to find the state of the player.</p>
<p>This class also exposes a number of events such as <code>ActiveSongChanged</code> or <code>MediaStateChanged</code> that lets the application know if the current song has changed or if the song has stopped/started playing. Handy stuff.</p>
<h3>MediaPlayerLauncher</h3>
<p><a href="http://msdn.microsoft.com/en-us/library/ff769542(v=vs.92).aspx">Launchers and Choosers</a> in the Windows Phone world give us developers access to a number of operating system and user functionalities.</p>
<p>The <code>MediaPlayerLauncher</code> is used to &#8220;start the media player and play the media file you specify.&#8221; But you don&#8217;t necessarily <em>have</em> to play a file, you can just take the user to the music player, like I did. <a href="http://msdn.microsoft.com/en-us/library/ff769542(v=vs.92).aspx">Read more about this class</a>.</p>
<h3>ShareStatusTask</h3>
<p>As of Windows Phone 7 Mango (Windows Phone OS 7.1), this class exists in the <code>Microsoft.Phone.Tasks</code> namespace. This class launches &#8220;a dialog that enables the user to share a status message on the social networks of their choice.&#8221;</p>
<p>By setting the <code>Status</code> property and calling <code>Show</code> you could get to the People Hub&#8217;s &#8220;Post a Message&#8221; page and let the user post away. <a href="http://msdn.microsoft.com/en-us/library/hh394027(v=vs.92).aspx">Read more about how to use this task</a>.</p>
<p>There you are, three nifty little classes that do really cool things that I hope you&#8217;ll use in your next application. Say&#8230; when you sign up for The Developer Movement and win a bunch of expensive cool gadets or <a href="http://www.imaginecup.com/">Imagine Cup</a> and win a lot of money!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/389/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=389&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2012/02/07/building-laaalallaaa-share/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net MVC Walkthrough &#8211; Gears of Web</title>
		<link>http://codetrek.wordpress.com/2011/11/09/mvc-walkthrough-gears-of-web/</link>
		<comments>http://codetrek.wordpress.com/2011/11/09/mvc-walkthrough-gears-of-web/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 02:24:55 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[Edition]]></category>
		<category><![CDATA[Express]]></category>
		<category><![CDATA[NuGet]]></category>
		<category><![CDATA[Platform Installer]]></category>
		<category><![CDATA[Professional]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Walkthrough]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">https://codetrek.wordpress.com/?p=358</guid>
		<description><![CDATA[There so many great resources for learning ASP.Net MVC out there, especially on Scott Guthrie&#8217;s blog. I found that the approach taken by most bloggers in their tutorials involves writing a project, while it is a great way to get the some hands-on experience, it can be overwhelming to first understand the context of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=358&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>There so many great resources for learning ASP.Net MVC out there, especially on Scott Guthrie&#8217;s <a href="http://weblogs.asp.net/scottgu/archive/tags/MVC/default.aspx">blog</a>. I found that the approach taken by most bloggers in their tutorials involves writing a project, while it is a great way to get the some hands-on experience, it can be overwhelming to first understand the context of the project and then how the MVC framework handles the project.</p>
<p>In this walkthrough series, I will go through the beautiful ASP.Net MVC framework and attempt to explain its many cogs that interact to build powerful web applications. I won&#8217;t be going in to any projects that involve restaurants or nerds.</p>
<p>First let&#8217;s get the gears of <a href="http://webnotwar.ca/">war err&#8230; web</a>.</p>
<h3>Visual Studio 2010</h3>
<p>You might have heard of it, it&#8217;s this amazing IDE we .Net-ers use. VS2010, like its predecessors comes in many editions. The <a href="http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-basic-express">VS2010 Express Edition</a> is free and pretty sweet. Also, if you&#8217;re a student, don&#8217;t read any further and head over to <a href="https://www.dreamspark.com/">DreamSpark </a>and get yourself a fresh <a href="https://www.dreamspark.com/Products/Product.aspx?ProductId=25">VS2010 Professional Edition</a>. Yeah, pretty sweeter!</p>
<h3>Web Platform Installer</h3>
<p>This is something you might not have heard of. Using <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a> Microsoft distributes all its web components to us developers. It&#8217;s got everything. Get it. Now.</p>
<h3>Nuget</h3>
<p>I have nothing else to say to you if you have not installed <a href="http://nuget.org/">Nuget</a>. It&#8217;s the one tool that every .Net developer needs besides Visual Studio. With it, you&#8217;ll be able to download from a plethora of community powered tools and projects that will make life and working with MVC a breeze.</p>
<h3>Everything else</h3>
<p>From here on, installing ASP.Net MVC 3 and updates for Visual Studio should be an easy exploration. Hint: Web PI. In my next post, I&#8217;ll write about all the basics and background to MVC. Stay tuned!</p>
<p>This post also appeared on the <a href="http://blogs.msdn.com/b/cdnstudents/">Go DevMENTAL blog</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/358/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/358/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=358&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/11/09/mvc-walkthrough-gears-of-web/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net MVC Walkthrough Series</title>
		<link>http://codetrek.wordpress.com/2011/11/09/sp-net-mvc-walkthrough-series/</link>
		<comments>http://codetrek.wordpress.com/2011/11/09/sp-net-mvc-walkthrough-series/#comments</comments>
		<pubDate>Wed, 09 Nov 2011 02:19:55 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[Series]]></category>
		<category><![CDATA[Walkthrough]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=360</guid>
		<description><![CDATA[In this walkthrough series, I go through the beautiful ASP.Net MVC framework and attempt to explain its many cogs that interact to build powerful web applications without going in to any projects that involve restaurants or nerds. 1. Gears of Web<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=360&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this walkthrough series, I go through the beautiful ASP.Net MVC framework and attempt to explain its many cogs that interact to build powerful web applications without going in to any projects that involve restaurants or nerds.</p>
<p>1. <a href="http://wp.me/pJ6K3-5M">Gears of Web</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/360/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/360/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=360&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/11/09/sp-net-mvc-walkthrough-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>Care Presentation at DevCamp Recap</title>
		<link>http://codetrek.wordpress.com/2011/10/26/care-presentation-at-devcamp-recap/</link>
		<comments>http://codetrek.wordpress.com/2011/10/26/care-presentation-at-devcamp-recap/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 17:16:58 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Art]]></category>
		<category><![CDATA[Camp]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Dev]]></category>
		<category><![CDATA[DevCamp]]></category>
		<category><![CDATA[Make]]></category>
		<category><![CDATA[Not]]></category>
		<category><![CDATA[Out]]></category>
		<category><![CDATA[War]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Your]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=375</guid>
		<description><![CDATA[DevCamp Toronto was a lot of fun with awesome speakers. Looking forward to more events from Make Web Not War, it&#8217;s a great place for open source and community talks. Loads to learn and enjoy! To prepare for the presentation I had written up the gist of my presentation&#8230; and here it is with the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=375&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.webnotwar.ca/events/event/devcamp-toronto-by-mwnw/">DevCamp Toronto</a> was a lot of fun with awesome speakers. Looking forward to more events from Make Web Not War, it&#8217;s a great place for open source and community talks. Loads to learn and enjoy!</p>
<p>To prepare for the presentation I had written up the gist of my presentation&#8230; and here it is with the slides!</p>
<h3>Slides</h3>
<div id="__ss_9890614" style="width:425px;"><iframe src='http://www.slideshare.net/slideshow/embed_code/9890614' width='425' height='348' scrolling='no'></iframe></div>
<h3>Transcript</h3>
<p><strong>Slide 1</strong></p>
<p>I&#8217;m going to talk about Care, a cloud powered<br />
application to help empower patients to take<br />
an active role in their healthcare. I am also<br />
going to talk about why and how we took Care<br />
to the cloud. And of course I&#8217;ll talk about the technologies<br />
involved.</p>
<p><strong>Slide 2</strong></p>
<p>Every idea spawns from some needs and the need for our application was brought into attention at Code Your Art Out in the summer. Now what are the needs?</p>
<p>Almost 80% of Ontarians over the age of 45 have a chronic condition but the time of healthcare professionals is limited so many have to manage their own conditions. The time between appointments for patients is usually long causing lack of communication and miscommunication of patients&#8217; symptoms.</p>
<p>The adoptation of technologies is slow, in the healthcare industry at least, and it&#8217;s understandable, typical healthcare applications will cost about $30,000 in infrustructure and IT. Especially if you are focusing on non-profits, as we are, it is so expensive for them, deploying applications to solve problems become an impossible task for them.</p>
<p><strong>Slide 3</strong></p>
<p>To tackles these needs Care exists. Unlike most healthcare applications its aim is to solve a small and realistic problem.<br />
In its core, it is a personal symptom management tool. It provides guided forms to record symptoms and create reports out of them. It&#8217;s a powerful yet simple way of involving patients in their care, also of providing healthcare professionals more accurate information about their patients and their symptoms. And how we involve our partners is by making<br />
Care a family and group focused application so that patients can share this information with the people helping them through their conditions.</p>
<p><strong>Slide 4</strong></p>
<p>That just solves one part of the problem, connecting patients to their professionals. To solve the problem of lacking infrustructure we picked the cloud. By hosting applications on the cloud we&#8217;ll be saving thousands on infrustructure, IT and utilities. It provides for a secure hosting environment with amazing fault tolerance. As developers we have access to utility style software services with greater performance and features, something we can provide to our partners. And as<br />
developers we get greater control over our software features and versions preventing fragmentations and giving us access in case some nasty bugs creep in.</p>
<p><strong>Slide 5</strong></p>
<p>Now what are the tools we used to build Care and how are the feasible for our non-profit partners?<br />
Microsoft Windows Azure with its utility style platform, it&#8217;s cost effective for us to develop<br />
using the technologies we want. We mainly a .Net firm so we love using ASP.Net MVC, it you&#8217;re<br />
familiar with the MVC architecture, you&#8217;ll know that it&#8217;s a beautiful framework to work with.<br />
For our ORM we use Entity Framework Code First which plays nicely with both MSSQL and MySql so we<br />
can deploy which ever suits our partners&#8217; needs. For the UI we leverage open source frameworks Blueprint, jQuery UI, Mobile. All of this is served through Nuget, my personal favorite to explore and find open source tools<br />
to use.</p>
<p><strong>Slide 6</strong></p>
<p>Care wouldn&#8217;t be what it is without the support of its partners in Colorectal Cancer Association of Canada<br />
and Hope and Cope working out of Montreal. We also need you to partner with us to<br />
bring Care to patients who need it. We are also would love to connect with you and<br />
hear about your ideas and experiences. You&#8217;ll find our company and myself on these Twitter handles.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=375&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/10/26/care-presentation-at-devcamp-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
		<item>
		<title>1Transit for them All (Exclusively for WP7)</title>
		<link>http://codetrek.wordpress.com/2011/06/28/1transit-for-them-all-exclusively-for-wp7/</link>
		<comments>http://codetrek.wordpress.com/2011/06/28/1transit-for-them-all-exclusively-for-wp7/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 00:17:00 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[Windows Phone 7]]></category>
		<category><![CDATA[America]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[North]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Transit]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=335</guid>
		<description><![CDATA[A few days ago we released 1Transit. Softly. It is an exclusive Windows Phone 7 transit application that is a bundle of simple but robust and hopefully useful features. Features Like The application serves data for over 20 transit agencies across North America. Yes, built for travel. We wanted you to be able to find [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=335&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A few days ago we released <a title="Get 1Transit for WP7" href="http://bit.ly/get1twp7" target="_blank">1Transit</a>. Softly. It is an exclusive Windows Phone 7 transit application that is a bundle of simple but robust and hopefully useful features.</p>
<h3>Features Like</h3>
<p>The application serves data for over 20 transit agencies across North America. Yes, built for travel.</p>
<p><img class="alignnone size-full wp-image-336" title="List of Agencies in 1Transit" src="http://codetrek.files.wordpress.com/2011/06/agencylist.png?w=590" alt=""   /></p>
<p>We wanted you to be able to find things fast. Thus, the searching is fast. Something we like to showoff to our friends.</p>
<p><img class="alignnone size-full wp-image-340" title="Search Fast with 1Transit" src="http://codetrek.files.wordpress.com/2011/06/searching.png?w=590" alt=""   /></p>
<p>No your eyes do not fool you. Those are live updates that you can receive for transit stops around you. We implemented a bookmarking (aka pinning in the Windows world) feature too, so that you can get these updates with only a touch.</p>
<p><img class="alignnone size-full wp-image-341" title="Live Updates with 1Transit" src="http://codetrek.files.wordpress.com/2011/06/liveupdates.png?w=590" alt=""   /></p>
<p>Not impressed? Try it for yourself and maybe you will be. Fingers crossed.</p>
<p><a href="http://bit.ly/get1twp7"><img class="alignnone" title="Get 1Transit for WP7" src="http://www.fersh.co/images/DownloadButton/new/Download-EN-Med.png" alt="" width="165" height="54" /></a></p>
<h3>Coming Soon</h3>
<p>We have put much weight behind this application and we&#8217;ll be building on the current version. In the coming updates we are looking to,</p>
<ul>
<li>Utilize location to enrich the experience,</li>
<li>Provide schedules and maps of routes,</li>
<li>Implement live updates of vehicle locations,</li>
<li>Add support for more agencies.</li>
</ul>
<h3>Coming Sooner</h3>
<p>Yes, 1Transit is exclusive for WP7 but we have been working on a version for our fellow smartphone users on Android and iOS. Stay tuned for that.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/335/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=335&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/06/28/1transit-for-them-all-exclusively-for-wp7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2011/06/agencylist.png" medium="image">
			<media:title type="html">List of Agencies in 1Transit</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2011/06/searching.png" medium="image">
			<media:title type="html">Search Fast with 1Transit</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2011/06/liveupdates.png" medium="image">
			<media:title type="html">Live Updates with 1Transit</media:title>
		</media:content>

		<media:content url="http://www.fersh.co/images/DownloadButton/new/Download-EN-Med.png" medium="image">
			<media:title type="html">Get 1Transit for WP7</media:title>
		</media:content>
	</item>
		<item>
		<title>Say Hello to Project jQMvc</title>
		<link>http://codetrek.wordpress.com/2011/06/26/say-hello-to-jqmvc/</link>
		<comments>http://codetrek.wordpress.com/2011/06/26/say-hello-to-jqmvc/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 15:21:31 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[jQMobile]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Mobile]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=324</guid>
		<description><![CDATA[After my previous post about jQuery Mobile and ASP.Net MVC, I found myself using jQM in a project. Now, it would be a shame if I didn&#8217;t share the goodies I built for MVC with jQM. So, I give you Project jQMvc. Really, it&#8217;s a collection of HTMLHelper extensions that build on jQM. With jQMvc [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=324&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After my <a href="http://codetrek.wordpress.com/2011/05/21/mvc-now-stands-for-mobile-views-conquered/" target="_blank">previous post</a> about jQuery Mobile and ASP.Net MVC, I found myself using jQM in a project. Now, it would be a shame if I didn&#8217;t share the goodies I built for MVC with jQM.</p>
<p>So, I give you <a href="http://jqmvc.codeplex.com" target="_blank">Project jQMvc</a>. Really, it&#8217;s a collection of HTMLHelper extensions that build on jQM. With jQMvc you&#8217;ll be able to build full HTML5 compatible and mobile ready views but with the lovely MVC behind it at all times. Let me show you some of the things it can do.</p>
<h3>Lists, a lot of them</h3>
<p>In the project there a several types of lists, with and without searching. Thanks to jQM, it&#8217;s a treat! And really useful.</p>
<p>The below code,</p>
<p><pre class="brush: java; light: true;">
@using jQM
@model IEnumerable

@{
    ViewBag.Title = &quot;Unordered List With Search&quot;;
}

@Html.UnorderedListWithSearchFilter(Model)
</pre></p>
<p>And a little bit of sauce from the controller will give you,</p>
<p><img class="size-full wp-image-325 alignnone" title="jQMvc List with Search Preview" src="http://codetrek.files.wordpress.com/2011/06/jqmvc_list_with_search.png?w=590" alt="jQMvc List with Search Preview"   /></p>
<h3>Buttons, all sorts of them</h3>
<p><pre class="brush: java; light: true;">
@using jQM

@{
    ViewBag.Title = &quot;Buttons&quot;;
}

@Html.ActionButton(&quot;Hi. I am a simple button.&quot;, &quot;Index&quot;, &quot;Home&quot;)

@Html.ActionButton(&quot;Hey! Look, I am a settings kind'a button.&quot;, &quot;Index&quot;, &quot;Home&quot;, ButtonIcon.gear)

@Html.ActionButton(&quot;Unlike others, I have route values.&quot;, &quot;Router&quot;, &quot;Home&quot;, new { id = &quot;value&quot; })
</pre></p>
<p>The code above will create a neat little stack of different kinds of button.</p>
<p><img class="alignnone size-full wp-image-326" title="jQMv Buttons Preview" src="http://codetrek.files.wordpress.com/2011/06/jqmvc_buttons.png?w=590" alt=""   /></p>
<p>So that&#8217;s it for now. As the project grows, I will be sure to update with the neat things that will go into jQMvc.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/324/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/324/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=324&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/06/26/say-hello-to-jqmvc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2011/06/jqmvc_list_with_search.png" medium="image">
			<media:title type="html">jQMvc List with Search Preview</media:title>
		</media:content>

		<media:content url="http://codetrek.files.wordpress.com/2011/06/jqmvc_buttons.png" medium="image">
			<media:title type="html">jQMv Buttons Preview</media:title>
		</media:content>
	</item>
		<item>
		<title>Implementation of a Generic Repository Beauty, with Ninject the Beast</title>
		<link>http://codetrek.wordpress.com/2011/05/29/generic-repository-ninject/</link>
		<comments>http://codetrek.wordpress.com/2011/05/29/generic-repository-ninject/#comments</comments>
		<pubDate>Sun, 29 May 2011 15:49:07 +0000</pubDate>
		<dc:creator>Kowsheek</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Control]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[First]]></category>
		<category><![CDATA[Generic]]></category>
		<category><![CDATA[Inversion]]></category>
		<category><![CDATA[Ninject]]></category>
		<category><![CDATA[Pattern]]></category>
		<category><![CDATA[Repository]]></category>

		<guid isPermaLink="false">http://codetrek.wordpress.com/?p=302</guid>
		<description><![CDATA[I really should be studying. But why study when I can blog right? Well, I have been meaning to write this post for a while now, and here it is. The Repository Pattern is invaluable when working with the data, particularly in MVC. It encapsulates a lot of redundant and hopefully generic operations, I use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=302&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I really should be studying. But why study when I can blog right? Well, I have been meaning to write this post for a while now, and here it is.</p>
<p>The <a href="http://www.martinfowler.com/eaaCatalog/repository.html" target="_blank">Repository Pattern</a> is invaluable when working with the data, particularly in MVC. It encapsulates a lot of redundant and hopefully generic operations, I use it to encapsulate operations on the Entity Framework Code First ORM. My implementation doesn&#8217;t use <a href="http://www.martinfowler.com/eaaCatalog/unitOfWork.html" target="_blank">Unit of Work</a> which tracks changes and updates the database accordingly. Instead, I let myself decide. It&#8217;s not that bad.</p>
<h3>The Context</h3>
<p>Firstly, there is the context interface. It can expose methods, but I didn&#8217;t need to. Let&#8217;s imagine this context is for a shop.<br />
This interface is important because it&#8217;ll be used by Ninject to wire everything up.</p>
<p><pre class="brush: java;">
public interface IShopContext
{
}
</pre></p>
<p>The concrete implementation of the context might look like this.</p>
<p><pre class="brush: java;">
public class CareContext: DbContext, IShopContext
{
    public DbSet&lt;Fruit&gt; Fruits { get; set; }

    public ShopContext()
    {
    }
}
</pre></p>
<h3>The Entities</h3>
<p><code>Fruit</code> above is an entity and there can be many more. The entities derive from an abstract <code>Identity</code> class. What it is, is pretty obvious.</p>
<p><pre class="brush: java;">
public abstract class Identity
{
    public Guid ID { get; set; }
}
</pre></p>
<p>Now let&#8217;s look at the example <code>Fruit</code>.</p>
<p><pre class="brush: java;">
public class Fruit: Identity
{
    public string Name { get; set; }
    public int AmountInShop { get; set; }
}
</pre></p>
<h3>The Repository</h3>
<p><pre class="brush: java;">
public interface IRepository&lt;TEntity&gt; where TEntity : Identity
{
    TEntity Add(TEntity model, bool persist = false);
    TEntity Get(Guid id);
    IEnumerable&lt;TEntity&gt; Get(Expression&lt;Func&lt;TEntity, bool&gt;&gt; predicate);
    IEnumerable&lt;TEntity&gt; GetAll();

    TEntity Update(TEntity model, bool persist = false);

    void Remove(Guid id, bool persist = false);
    void Remove(TEntity model, bool persist = false);

    void Save();
}
</pre></p>
<p>So these are some of the operations that the repository will perform. As you can see, I take care of the persistence using the optional parameter <code>persist</code>.</p>
<p>And now&#8230; the concrete implementation of the repository.</p>
<p><pre class="brush: java;">
public class Repository&lt;TEntity&gt; : IRepository&lt;TEntity&gt; where TEntity : Identity
{
    private DbContext Context;
    private DbSet&lt;TEntity&gt; DBSet;

    public Repository(IShopContext context)
    {
        Context = context as DbContext;
        DBSet = Context.Set&lt;TEntity&gt;();
    }

    public TEntity Get(Guid id)
    {
        TEntity model = DBSet.Find(id);
        return model;
    }

    public IEnumerable&lt;TEntity&gt; Get(Expression&lt;Func&lt;TEntity, bool&gt;&gt; predicate)
    {
        return DBSet.Where(predicate).AsEnumerable();
    }

    public IEnumerable&lt;TEntity&gt; GetAll()
    {
        return DBSet.AsEnumerable&lt;TEntity&gt;();
    }

    public TEntity Add(TEntity model, bool persist = false)
    {
        model.ID = Guid.NewGuid();
        DBSet.Add(model);
        Save(persist);

        return model;
    }

    public TEntity Update(TEntity model, bool persist = false)
    {
        Context.Entry(model).State = EntityState.Modified;
        Save(persist);

        return model;
    }

    public void Remove(Guid id, bool persist = false)
    {
        TEntity model = DBSet.Find(id);
        Remove(model, persist);
    }

    public void Remove(TEntity model, bool persist = false)
    {
        if (model != null)
        {
            Context.Entry&lt;TEntity&gt;(model).State = EntityState.Deleted;
            Save(persist);
        }
    }

    public void Save()
    {
        Save(true);
    }

    private void Save(bool persist)
    {
        if (persist)
        {
            Context.SaveChanges();
        }
    }
}
</pre></p>
<p>There you have it. It&#8217;s very simple to read really. It just spells out the methods defined in the interface and also provides logic for persistence when you want it.</p>
<h3>The Ninject</h3>
<p>Now all of this is pretty useless without Ninject. You&#8217;ll have noticed I used <a href="http://martinfowler.com/bliki/InversionOfControl.html" target="_blank">Inversion of Control</a> while implementing the repository. Ninject is available on <a href="http://nuget.org/List/Search?packageType=Packages&amp;searchCategory=All+Categories&amp;searchTerm=ninject&amp;sortOrder=package-download-count&amp;pageSize=10" target="_blank">Nuget</a>.</p>
<p>While registering the services on Ninject, I can tell it to provide a <code>ShopContext</code> when a <code>IShopContext</code> is required. The repository is bound to an interface, this context can be a development or deployment context, depending. Also, since I want to use the same context always, I bind it using <code>ToConstant</code>.</p>
<p>As for when a repository operating on a certain entity is requested, Ninject finds its type and provides accordingly.</p>
<p><pre class="brush: java;">
private static void RegisterServices(IKernel kernel)
{
    IShopContext shopContext = new ShopContext();
    kernel.Bind(typeof(IShopContext)).ToConstant(shopContext);
    kernel.Bind(typeof(IRepository&lt;&gt;)).To(typeof(Repository&lt;&gt;));
}
</pre></p>
<p>Hope that wasn&#8217;t too long a post, it probably is my longest so far. Till next time, then.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codetrek.wordpress.com/302/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codetrek.wordpress.com/302/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codetrek.wordpress.com&#038;blog=10750679&#038;post=302&#038;subd=codetrek&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codetrek.wordpress.com/2011/05/29/generic-repository-ninject/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a397580859bbb63e880948f18c98536?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Red Kid</media:title>
		</media:content>
	</item>
	</channel>
</rss>
