<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-22141639</atom:id><lastBuildDate>Thu, 16 May 2013 15:33:24 +0000</lastBuildDate><category>Me</category><category>Back To Basics</category><category>Cartoon</category><category>xaml</category><category>Neural Network</category><category>MVC</category><category>MVVM</category><category>Developer Self Help</category><category>CSharp5</category><category>Startups</category><category>winrt</category><category>Philosophy</category><category>Parallel Programming</category><category>Robotics</category><category>Azure</category><category>JQuery</category><category>node</category><category>Community</category><category>.NET Rx</category><category>DSL</category><category>Hadoop</category><category>cqrs</category><category>Surface</category><category>Mono</category><category>Tech Trends</category><category>India</category><category>VS SDK</category><category>HTML5</category><category>Non-Tech</category><category>Blend</category><category>Mobile</category><category>linq</category><category>Google Wave</category><category>Kinect</category><category>Javascript</category><category>TFS</category><category>Software Development</category><category>Screencast</category><category>XML</category><category>Tips</category><category>windows8</category><category>Fun</category><category>K-MUG</category><category>VS2008</category><category>Windows Phone 7</category><category>Weekend Hacks</category><category>Functional Programming</category><category>WCF</category><category>.NET 4.0</category><category>Dynamic</category><category>VS2010</category><category>Tools</category><category>asp.net</category><category>Programming-Tips</category><category>CSharp</category><category>WPF</category><category>.NET</category><category>Design And Architecture</category><category>Silverlight</category><category>Books</category><category>TypeScript</category><title>Amazedsaint's Tech Journal</title><description>Anoop&amp;#39;s observations on tech, web, design &amp;amp; architecture, .net and more..</description><link>http://www.amazedsaint.com/</link><managingEditor>noreply@blogger.com (Anoop Madhusudanan)</managingEditor><generator>Blogger</generator><openSearch:totalResults>186</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/amazedsaint/articles" /><feedburner:info uri="amazedsaint/articles" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-6530168702310532963</guid><pubDate>Wed, 15 May 2013 17:36:00 +0000</pubDate><atom:updated>2013-05-16T21:03:24.139+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">Community</category><title>May be this is the best time for Microsoft to Open Source the .NET Framework</title><description>&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-WJxQI0SEdkU/UZPHl083_jI/AAAAAAAAB7M/ZC_1tb-1t-A/s1600-h/image%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-tyXwDiie0lE/UZPHm5TUVZI/AAAAAAAAB7U/zfkTVZ5u0Qg/image_thumb%25255B3%25255D.png?imgmax=800" width="240" height="163" /&gt;&lt;/a&gt;Just read a thoughtful post from OdeToCode / Scott Allen – &lt;a href="http://odetocode.com/blogs/scott/archive/2013/05/15/where-is-net-headed.aspx"&gt;Where is .NET headed&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;Scott wrote,&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;If your business or company still relies solely on components delivered to developers through an MSDN subscription, then it is past time to start looking beyond what Microsoft offers for .NET development so you won’t be left behind in 5 years. Embrace and support open source.&lt;/p&gt;    &lt;p&gt;At least, that’s how I see things.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;As I commented there, the best move Microsoft could make at this point, with respect to .NET is - to Open Source the .NET Framework. And then launch a program like &lt;a href="http://incubator.apache.org/"&gt;Apache Incubator&lt;/a&gt; around to promote ‘real’ OSS initiatives around the .NET ecosystem. &lt;/p&gt;  &lt;p&gt;I believe, the real problem with .NET ecosystem is the unavailability of serious frameworks for solving new age problems - .NET developers are cramped with the non-availability of Proven libraries for Machine Learning, Distributed Processing, Text Processing etc. - Talk about Hadoop, Solr, Lucene, Mahout, Storm, OpenNLP etc - All written in Java and is continuously maturing, despite the fact that &lt;a href="http://arstechnica.com/information-technology/2010/08/oracles-java-lawsuit-undermines-its-open-source-credibility/"&gt;Sun started screwing the Java community&lt;/a&gt;. The .NET ports for some of these libraries bit the dust long time back, or has very little adoption compared to their prominence in Java ecosystem. &lt;/p&gt;  &lt;p&gt;Microsoft is now trying to bridge this gap by bringing in platforms like Hadoop to Azure, and building bridges around the same for .NET interoperability.&lt;/p&gt;  &lt;p&gt;CLR and C# are awesome - but MS just can't push forward the development of mature libraries around the same to keep up with the pace of OSS initiatives. The true future of .NET lies in the hand of OSS community at large. Hopefully, if Azure turns out to be a big success story, then Microsoft won't mind open sourcing the Entire .NET stack ;). As Scott pointed in his article,&amp;#160; Azure and related hosted offerings (like Office365) + Windows 8 could become the focus points for Microsoft’s revenue.&lt;/p&gt;  &lt;p&gt;It is heartening to see that a number of frameworks like ASP.NET MVC, MEF, EF etc already got Open Sourced. But Microsoft can do better in the OSS world to ensure .NET ecosystem will grow further. I believe a lack of buy in from OSS community at large is there –and Microsoft could reduce the friction a little bit by open sourcing .NET.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=ATrgjAEio_U:_mCAgYX4kSE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=ATrgjAEio_U:_mCAgYX4kSE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=ATrgjAEio_U:_mCAgYX4kSE:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/ATrgjAEio_U" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/ATrgjAEio_U/may-be-this-is-best-time-for-microsoft.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-tyXwDiie0lE/UZPHm5TUVZI/AAAAAAAAB7U/zfkTVZ5u0Qg/s72-c/image_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/05/may-be-this-is-best-time-for-microsoft.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-5787546008126091366</guid><pubDate>Tue, 16 Apr 2013 14:19:00 +0000</pubDate><atom:updated>2013-04-18T10:23:30.564+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Design And Architecture</category><category domain="http://www.blogger.com/atom/ns#">Fun</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Hack Raspberry Pi – How To Build Apps In C#, WinForms and ASP.NET Using Mono In Pi</title><description>&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-m7IGd3kJhk4/UW1diZYVvnI/AAAAAAAAB34/UlQmm39rOlM/s1600-h/image%25255B44%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh6.ggpht.com/-l1yWVRR2QvY/UW1djy3d_6I/AAAAAAAAB4A/TqsJEjGbed4/image_thumb%25255B26%25255D.png?imgmax=800" width="240" height="222" /&gt;&lt;/a&gt;Recently I was doing a bit of R&amp;amp;D related to finding a viable, low cost platform for client nodes. Obviously, I came across Raspberry Pi, and found the same extremely interesting. Now, the missing piece of the puzzle was how to get going using C# and .NET in the Pi. C# is a great language, and there are a lot of C# developers out there in the wild who are interested in the Pi.&lt;/p&gt;  &lt;p&gt;In this article, I’ll just document my findings so far, and will explain how develop using C# leveraging Mono in a Raspberry Pi. Also, we’ll see how to write few minimal Windows Forms &amp;amp; ASP.NET applications in the Pie as well.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Step 1: What is Raspberry Pi?&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;Raspberry Pi is an ARM/Linux box for just ~ $30. It was introduced with a vision to teach basic computer science in schools. How ever, it got a lot of attention from hackers all around the world, as it is an awesome low cost platform to hack and experiment cool ideas as Pi is almost a full fledged computer.&amp;#160; More About R-Pi From Wikipedia.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The &lt;b&gt;Raspberry Pi&lt;/b&gt; is a credit-card-sized &lt;a href="http://en.wikipedia.org/wiki/Single-board_computer"&gt;single-board computer&lt;/a&gt; developed in the &lt;a href="http://en.wikipedia.org/wiki/United_Kingdom"&gt;UK&lt;/a&gt; by the&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi_Foundation"&gt;Raspberry Pi Foundation&lt;/a&gt; with the intention of promoting the teaching of basic &lt;a href="http://en.wikipedia.org/wiki/Computer_science"&gt;computer science&lt;/a&gt; in schools. The Raspberry Pi has a &lt;a href="http://en.wikipedia.org/wiki/Broadcom"&gt;Broadcom&lt;/a&gt; BCM2835 &lt;a href="http://en.wikipedia.org/wiki/System_on_a_chip"&gt;system on a chip&lt;/a&gt; (SoC),&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi#cite_note-Broadcom-BCM2835-Website-3"&gt;[3]&lt;/a&gt;&lt;/sup&gt; which includes an&lt;a href="http://en.wikipedia.org/wiki/ARM11"&gt;ARM1176JZF-S&lt;/a&gt; 700 MHz processor (The firmware includes a number of &amp;quot;Turbo&amp;quot; modes so that the user can attempt overclocking, up to 1 GHz, without affecting the warranty),&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi#cite_note-Turbo_mode-4"&gt;[4]&lt;/a&gt;&lt;/sup&gt; &lt;a href="http://en.wikipedia.org/wiki/VideoCore"&gt;VideoCore&lt;/a&gt; IV GPU,&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi#cite_note-grandmax_brose_2012-12"&gt;[12]&lt;/a&gt;&lt;/sup&gt; and originally shipped with 256 megabytes of &lt;a href="http://en.wikipedia.org/wiki/Random-access_memory"&gt;RAM&lt;/a&gt;, later upgraded to 512MB.&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi#cite_note-512MB-13"&gt;[13]&lt;/a&gt;&lt;/sup&gt; It does not include a built-in &lt;a href="http://en.wikipedia.org/wiki/Hard_disk_drive"&gt;hard disk&lt;/a&gt; or &lt;a href="http://en.wikipedia.org/wiki/Solid-state_drive"&gt;solid-state drive&lt;/a&gt;, but uses an &lt;a href="http://en.wikipedia.org/wiki/Secure_Digital"&gt;SD card&lt;/a&gt; for booting and long-term storage.&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/Raspberry_Pi#cite_note-VerifiedPeripheralList-14"&gt;[14]&lt;/a&gt;&lt;/sup&gt; The Foundation's goal is to offer two versions, priced at US$25 and US$35.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Another good introduction from Life Hacker &lt;a href="http://lifehacker.com/5976912/a-beginners-guide-to-diying-with-the-raspberry-pi"&gt;is here&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 2: Setting up your Development Environment&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Let us have a quick look at setting up the development environment. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;If you have a physical Raspberry Pi&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;Raspberry Pi boots from an SD Card. Basically, this means you can transfer an operating system image to an SD Card, and boot your Pi from there. The &lt;a href="http://www.raspberrypi.org/downloads"&gt;Raspberry Pi download page&lt;/a&gt; lists multiple OS images you can use to load your SD Card. You will need to unzip it and write it to a suitable SD card using the UNIX tool &lt;a href="http://en.wikipedia.org/wiki/Dd_(Unix)"&gt;dd&lt;/a&gt;. Windows users should use &lt;a href="http://sourceforge.net/projects/win32diskimager/"&gt;Win32DiskImager&lt;/a&gt;&lt;strong&gt;. &lt;/strong&gt;There is a &lt;a href="http://elinux.org/RPi_Easy_SD_Card_Setup"&gt;simple guide about how to setup your SD card&lt;/a&gt; if you are wondering how to do this. Then, you can connect your Pi device to the TV using an HDMI cable, and can hook up an old USB keyboard to start hacking.&lt;/p&gt;  &lt;p&gt;Though multiple images are available in the below mentioned download page, please note that at this point only the &lt;a href="http://downloads.raspberrypi.org/images/debian/7/2012-08-08-wheezy-armel/2012-08-08-wheezy-armel.zip"&gt;Soft-float Debian “wheezy”&lt;/a&gt; image can be used to install Mono with out issues. This is because Mono doesn’t support hard-float for Raspberry Pi (simplified version) and some runtime methods like DateTime won’t work if you are using a hard float version. So, you need to download the Soft-Float Debian image and transfer the image file to the SD card. If you feel a bit adventurous, &lt;a href="http://www.raspberrypi.org/phpBB3/viewtopic.php?t=37174&amp;amp;p=327348"&gt;you can try this hard-float port of Mono for the Pi&lt;/a&gt;, but it is not supported.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;If you don’t have a physical Raspberry Pi &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You can still download one of the images from the &lt;a href="http://www.raspberrypi.org/downloads"&gt;download page&lt;/a&gt; and boot from an emulator like &lt;a href="http://qemu.weilnetz.de/w32/"&gt;Qemu&lt;/a&gt;, which supports ARM architecture.&lt;/p&gt;  &lt;p&gt;Get If you are on Windows and if you are not familiar with Qemu, you can download this &lt;a href="http://sourceforge.net/projects/rpiqemuwindows/"&gt;pre-packaged version of&amp;#160; Qemu + Raspberry Pi from here&lt;/a&gt; – How ever there is a problem. The Image file that comes with this download is the Hard float version. As we need Mono to work properly, download the Soft-Float Debian Wheezy image – and copy that to the Qemu folder, and modify run.bat in qemu folder to the below command line to point it to the correct image. (If you downloaded Qemu and Soft Float Debian Wheezy image separately, you can create a handy run.bat). Note that as of this writing, the image Soft float image is 2012-08-08-wheezy-armel.img – You need to modify this accordingly. The –cpu switch specify the CPU architecture, –hda attaches the image as the boot device and –m specifies the memory. I’m allocating &lt;strike&gt;512&lt;/strike&gt; 256 MB to my virtual machine. (&lt;em&gt;&lt;strong&gt;Note&lt;/strong&gt;&lt;/em&gt;: Updated the command line to use 256 memory based on the comment from Peter below)&lt;/p&gt;  &lt;pre name="code"&gt;qemu-system-arm.exe -M versatilepb -cpu arm1176 -hda 2012-08-08-wheezy-armel.img -kernel kernel-qemu -m 256 -append &amp;quot;root=/dev/sda2&amp;quot;&lt;/pre&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 3: Booting the Pie And Installing Mono&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Once you boot the Pie, enter the username and password based on the image/distribution you are using (user/password is normally pi/raspberry).&amp;#160; Now, to install mono, we’ll use the apt-get package manager. Let us update and upgrade all the packages before we proceed with the install. Run apt-get with admin permissions, using sudo in the console/terminal.&lt;/p&gt;
Each of the below command will take a bit of time - so make sure you've a pressure ball around. And let the force be with you for a successful installation #lol.&amp;#160; &lt;pre name="code"&gt;sudo apt-get update --fix-missing

sudo apt-get upgrade --fix-missing

sudo apt-get install mono-complete --fix-missing&lt;/pre&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 4: Writing C#&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Assuming you’ve got the installation right - Time to write a little bit of C#. Mono has a CSharp command line (REPL), you can bring it up by typing CSharp. So, just play around. If you are setting this up to teach CSharp to kids in schools (original Raspberry Pi vision), the force is stronger in you than you think (Sorry, HBO is now re-telecasting all the old Star Wards stuff). What ever. Here is my CSharp console. Note that if your DateTime.Now is behaving madly, you never read my above paragraph and you’ve got the wrong OS image.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-9YF6-9yAzvM/UW1dlDgNmlI/AAAAAAAAB4I/QoFQuTuZv6k/s1600-h/image%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-ECjtRyIvZ8o/UW1dmb-cFTI/AAAAAAAAB4Q/S0RB2z8NWCI/image_thumb%25255B3%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 5: Write And Compile Your Code – A Windows Forms app&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Quit the CSharp console (quit) and start the Window manager by typing ‘startx’ – Never mind if you are already there. This should bring up the Raspberry Pi desktop.&amp;#160; Now, let us create a CSharp file using Leaf pad, a light weight editor in the Raspberry Pi. Either in Run or in a terminal window, type &lt;/p&gt;

&lt;pre name="code"&gt;sudo leafpad /opt/windowapp.cs&lt;/pre&gt;
And type in some code. Let us create a quick Windows forms application to ensure this is possible in Mono in the Pi. 

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-WmRd6aAJ4l4/UW1dnsAKxwI/AAAAAAAAB4Y/l8fAwKB6F5M/s1600-h/image%25255B15%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-pGdWwULXs9k/UW1dpNBQbOI/AAAAAAAAB4g/jo4mizQFfs8/image_thumb%25255B9%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Now, let us compile the code using the mono compiler (gmcs). Ensure that you are providing the reference libraries we are importing using the /r switch. This should produce the windowapp.exe executable.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-PrWbj9Z5fxw/UW1dqWIPbgI/AAAAAAAAB4o/C-I7l1BavRA/s1600-h/image%25255B21%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-VgLI1mmRdYU/UW1dr7opbCI/AAAAAAAAB4w/BaZ70sL__vg/image_thumb%25255B13%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Cool. Now time to run it via Mono.&amp;#160; This should display a tiny window with width and height 100 – You can drag the corners to see the little Window we created. From here onwards, it is your normal .NET style. Add controls, build apps and have a blast.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-RTVsGmQlros/UW1ds6LkS_I/AAAAAAAAB44/QwKlvBAVfC8/s1600-h/image%25255B29%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-artQY0p_NHg/UW1dufjEjII/AAAAAAAAB5A/B2uKA_5iDN8/image_thumb%25255B17%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 6: Installing The XSP Web Server For Some ASP.NET Love&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Let us now install Mono &lt;a href="http://www.mono-project.com/ASP.NET"&gt;XSP server&lt;/a&gt; so that we can run some ASP.NET code in the Pie, to use it as a tiny web server.&amp;#160; Let us get the XSP bits using apt-get. Fire up your terminal, and type&lt;/p&gt;

&lt;pre name="code"&gt;sudo apt-get install mono-xsp2 mono-xsp2-base asp.net-examples&lt;/pre&gt;

&lt;p&gt;Which should install XSP.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-ZfrKOrdKDv4/UW1dvrq--fI/AAAAAAAAB5I/-CWer0aqt1I/s1600-h/image%25255B31%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-fa_jqibutiA/UW1dxSY57_I/AAAAAAAAB5Q/SiSIcmaRjpQ/image_thumb%25255B19%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cool, you got the XSP installed. Now, let us try some ASP.NET stuff in the Pi. Create a new aspx file in /opt folder using Leafpad, as we did earlier. Here is my aspx file, a simple aspx file &lt;a href="http://www.stardeveloper.com/articles/display.html?article=2001082401&amp;amp;page=1"&gt;I copied from Startdeveloper&lt;/a&gt; as I was lazy.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-SN7KI9T70FE/UW1dyWoPE-I/AAAAAAAAB5Y/Yt0T-vp1IZQ/s1600-h/image%25255B35%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-geeL5ltd2NA/UW1d0TZERII/AAAAAAAAB5g/CdLOc6eoVLk/image_thumb%25255B21%25255D.png?imgmax=800" width="660" height="522" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;Save the file to your /opt folder, and And start XSP2 in the opt folder.&amp;#160; Run XSP2, and open the Internet-&amp;gt;Browser and navigate to &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt; – You see, it works.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-UzbOv8Kb60w/UW1d2cdV-5I/AAAAAAAAB5o/Jdrz0OXXBVY/s1600-h/image%25255B40%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-XuspKXdl1w8/UW1d4OYcQTI/AAAAAAAAB5w/Iew5JrjBQho/image_thumb%25255B24%25255D.png?imgmax=800" width="656" height="518" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Conclusion&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;In this post, we explored how to setup Mono to build and run .NET Win forms and Web applications in the Raspberry Pi. Build a computer to learn .NET and C# for under 40$, huh. Follow me in twitter @ &lt;a title="https://twitter.com/amazedsaint" href="https://twitter.com/amazedsaint"&gt;https://twitter.com/amazedsaint&lt;/a&gt; – Happy Coding.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=T9iZtsHKNO4:u9JCYlQAsmY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=T9iZtsHKNO4:u9JCYlQAsmY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=T9iZtsHKNO4:u9JCYlQAsmY:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/T9iZtsHKNO4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/T9iZtsHKNO4/hack-raspberry-pi-how-to-build.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-l1yWVRR2QvY/UW1djy3d_6I/AAAAAAAAB4A/TqsJEjGbed4/s72-c/image_thumb%25255B26%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/04/hack-raspberry-pi-how-to-build.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-4084043204197136236</guid><pubDate>Thu, 28 Mar 2013 18:26:00 +0000</pubDate><atom:updated>2013-03-29T00:01:33.414+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Azure</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><title>BIG DATA for .NET Devs: HDInsight, Writing Hadoop Map Reduce Jobs In C# And Querying Results Back Using LINQ</title><description>&lt;p&gt;&lt;img style="display: inline; float: right; margin-left: 0px; margin-right: 0px" align="right" src="http://lh5.ggpht.com/-TL-RMGPwfhk/T83NNUgqhCI/AAAAAAAABb0/6mLGwzaOU5c/image_thumb%25255B1%25255D.png?imgmax=800" /&gt;Azure HD Insight Services is a 100% Apache Hadoop implementation on top of Microsoft Azure cloud ecosystem.&amp;#160; &lt;/p&gt;  &lt;p&gt;In this post, we’ll explore &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;HDInsight/Hadoop on Azure in general and steps for starting with the same&lt;/li&gt;    &lt;li&gt;Writing Map Reduce Jobs for Hadoop using C# in particular to store results in HDFS. &lt;/li&gt;    &lt;li&gt;Transferring the result data from HDFS to Hive &lt;/li&gt;    &lt;li&gt;Reading the data back from the hive using C# and LINQ&lt;/li&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;font style="font-weight: bold"&gt;Preface&lt;/font&gt;&lt;/h3&gt;  &lt;p&gt; If you are new to Hadoop and Big Data concepts, I suggest you to quickly check out&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.slideshare.net/kkrugler/a-very-short-intro-to-hadoop"&gt;A quick introduction to Hadoop&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.cs.brandeis.edu/~rshaull/cs147a-fall-2008/hadoop-intro/"&gt;A quick introduction to Map Reduce&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.windowsazure.com/en-us/manage/services/hdinsight/get-started-hdinsight/"&gt;An introduction to Hadoop HDInsight Services on Azure&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There are a couple of ways you can start with HDInsight.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;You may &lt;a href="http://www.windowsazure.com/en-us/home/features/preview/"&gt;Go to Azure Preview features and opt in for HDInsight&lt;/a&gt; and/or install the same locally &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;strong&gt;Step 1: Setting up your instance locally in your Windows&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;For Development, I highly recommend you to install &lt;a href="http://www.microsoft.com/en-us/download/details.aspx?id=35397"&gt;HDInsight developer version locally&lt;/a&gt; – You can find it straight inside the &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;Web Platform installer&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Once you install the HDInsight locally, ensure you are running all the Hadoop services.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-TkON_sX-aqA/UVSK74sVuiI/AAAAAAAAB2E/ynpyNlYUNwY/s1600-h/image4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-8eaFctihGpM/UVSK-MA5GII/AAAAAAAAB2M/mFQhqmobtpE/image_thumb2.png?imgmax=800" width="640" height="395" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also, you may use the following links once your cluster is up and running.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Goto &lt;a href="http://localhost:50030"&gt;http://localhost:50030&lt;/a&gt; to see the HDInsight dashboard locally &lt;/li&gt;    &lt;li&gt;Goto &lt;a title="http://localhost:50070" href="http://localhost:50070"&gt;http://localhost:50070&lt;/a&gt; to explore the HDFS file system &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here is the HDInsight dashboard running locally.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-ikr1o_dn9H4/UVSLAkDObrI/AAAAAAAAB2U/66hCB8XChhs/s1600-h/image13.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-kJPsp593zic/UVSLB9-3SWI/AAAAAAAAB2c/KWGxJem-79g/image_thumb9.png?imgmax=800" width="640" height="341" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And now you are set.&lt;/p&gt;  &lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 2: Install the Map Reduce package via Nuget &lt;/font&gt;&lt;/h3&gt;  &lt;p&gt;Let us explore how to write few Map Reduce jobs in C#. We’ll write a quick job to count namespaces from C# source files Earlier, in a couple of posts related to Hadoop on Azure - &lt;a href="http://www.amazedsaint.com/2012/06/analyzing-some-big-data-using-c-azure.html"&gt;Analyzing some ‘Big Data’ using C#&lt;/a&gt; and &lt;a href="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html"&gt;Extracting Top 500 MSDN Links from Stack Overflow&lt;/a&gt; – I showed how to use C# Map Reduce Jobs with Hadoop Streaming to do some meaningful analytics. In this post, we’ll re-write the mapper and reducer leveraging the the new .NET SDK available, and will apply the same on few code files (you can apply that on any dataset).&lt;/p&gt;  &lt;p&gt;The new &lt;a href="http://hadoopsdk.codeplex.com/"&gt;.NET SDK for Hadoop&lt;/a&gt; makes it very easy to work with Hadoop from .NET – with more types for supporting Map Reduce Jobs, For creating LINQ to Hive queries etc. Also, the SDK provides an easier way to create and submit your own Map Reduce jobs directly in C# either to the local developer instance or to Azure Hadoop cluster.&amp;#160; &lt;/p&gt;  &lt;p&gt;To start with, create a console project and install the Microsoft.Hadoop.Mapreduce package via Nuget. &lt;/p&gt;  &lt;pre&gt;Install-Package Microsoft.Hadoop.Mapreduce&lt;/pre&gt;

&lt;p&gt;This will add the required dependencies.&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 3: Writing your Mapper and Reducer&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;The mapper will read the input from the HDFS file system, and the writer will emit outputs to HDFS. HDFS is Hadoop’s distributed file system, which guarantees high availability. Checkout the &lt;a href="http://hadoop.apache.org/docs/r1.0.4/hdfs_design.html"&gt;Apache HDFS architecture guide for details&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With Hadoop SDK, now you can inherit your Mapper from the &lt;em&gt;MapperBase&lt;/em&gt; class, and Reducer from the &lt;em&gt;ReducerCombinerBase&lt;/em&gt; class. This is equivalent to the independent Mapper and Reducer exes I demonstrated earlier using Hadoop streaming, just that we’ve got a better way of doing the same. In the Map method, we are just extracting the namespace declarations using reg ex to emit the same (See hadoop streaming details in my previous article)&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;    //Mapper
    public class NamespaceMapper : MapperBase
    {
        //Override the map method.
        public override void Map(string inputLine, MapperContext context)
        {
            //Extract the namespace declarations in the Csharp files
            var reg = new Regex(@&amp;quot;(using)\s[A-za-z0-9_\.]*\;&amp;quot;);
            var matches = reg.Matches(inputLine);

            foreach (Match match in matches)
            {
                //Just emit the namespaces.
                context.EmitKeyValue(match.Value,&amp;quot;1&amp;quot;);
            }
        }
    }

    //Reducer
    public class NamespaceReducer : ReducerCombinerBase
    {
        //Accepts each key and count the occurrances
        public override void Reduce(string key, IEnumerable&amp;lt;string&amp;gt; values, 
            ReducerCombinerContext context)
        {
            //Write back  
            context.EmitKeyValue(key,values.Count().ToString());
        }
    }&lt;/pre&gt;

&lt;p&gt;Next, let us write a Map Reduce Job and configure the same. &lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 4: Writing your Namespace Counter Job&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;You can simply specify your Mapper and Reducer types and inherit from HadoopJob to create a job class. Here we go. &lt;/p&gt;

&lt;pre&gt;   //Our Namespace counter job
    public class NamespaceCounterJob : HadoopJob&amp;lt;NamespaceMapper, NamespaceReducer&amp;gt;
    {
        public override HadoopJobConfiguration Configure(ExecutorContext context)
        {
            var config = new HadoopJobConfiguration();
            config.InputPath = &amp;quot;input/CodeFiles&amp;quot;;
            config.OutputFolder = &amp;quot;output/CodeFiles&amp;quot;;
            return config;
        }
    }&lt;/pre&gt;

&lt;p&gt;Note that we are overriding the Configure method to specify the configuration parameters. In this case, we are specifying the input and output folders for our mapper/reducer – The lines in the files in input folder will be passed to our mapper instances, and the combined output from the reducer instances will be placed in the output folder.&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 5: Submitting the job&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Finally, we need to connect to the cluster and submit the job, using the ExecuteJob method. Here we go with the main driver.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;class Program
    {
        static void Main(string[] args)
        {
            var hadoop = Hadoop.Connect();
            var result=hadoop.MapReduceJob.ExecuteJob&amp;lt;NamespaceCounterJob&amp;gt;();
        }
    }&lt;/pre&gt;

&lt;p&gt;We are invoking the ExecuteJob method using the NamespaceCounterJob type we just created. In this case, we are submitting the job locally – if you want to submit the job to an Azure HDInsight cluster for the actual execution scenario, you should pass the Azure connection parameters. &lt;a href="http://hadoopsdk.codeplex.com/wikipage?title=Running%20jobs%20on%20Azure%20HDInsight%20service&amp;amp;referringTitle=Map%2fReduce"&gt;Details here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 6: Executing the job&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;Before executing the job, you should prepare your input – in this case, you should copy the source code files in the input folder we provided as part of the configuration while creating our Job (see the&amp;#160; NamespaceCounterJob). To do this, fire up the Hadoop command line console from the desktop. If your cluster is on Azure, you can remote login to the cluster head node by choosing Remote Login from the HDInsight Dashboard. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a folder using the &lt;strong&gt;hadoop fs –mkdir input/CodeFiles&lt;/strong&gt; command &lt;/li&gt;

  &lt;li&gt;Copy few CSharp files to your folder using &lt;strong&gt;hadoop fs –copyFromLocal your\path\*.cs&amp;#160; input/CodeFiles&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See I’m copying all my CS files under BasicsRevisited folder to input/CodeFiles.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-bywTwxteNOE/UVSLDdXwXYI/AAAAAAAAB2k/4DK0RWx7c9w/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-FlHQFV_KlIE/UVSLFiTHu7I/AAAAAAAAB2s/PZNwGwnfyZ4/image_thumb%25255B1%25255D.png?imgmax=800" width="644" height="168" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, build your project in Visual Studio, open the bin folder and execute your exe file. This will internally kick start MRRunner.exe and your map reduce job will get executed (The name of my executable is simply MapReduce.exe). You can see the detected file dependencies are automatically submitted.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-mCxR8GhorpE/UVSLG23Jb7I/AAAAAAAAB20/3k7Ijt8wqxM/s1600-h/image%25255B8%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-uZ5pbxOwltE/UVSLJa4tA_I/AAAAAAAAB28/fF2kvaLkaZ4/image_thumb%25255B3%25255D.png?imgmax=800" width="644" height="463" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once the Map Reduce job is completed, you’ll find that the combined output will be placed in output/CodeFiles folder. You can issue the –ls and –cat commands to list the files and view the content of the part-00000 file where the output will be placed (Yes, a little Linux knowledge will help at times &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://lh5.ggpht.com/-opLDEhMlZR4/UVSLKCSkB2I/AAAAAAAAB3E/_v3i9EpvCM0/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" /&gt;). The part-00000 file contains the combined output of our task – see the name spaces along with their count from the files I submitted.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-rfc_8OHW2oM/UVSLLaraWMI/AAAAAAAAB3M/KFnyEdD1pSY/s1600-h/image%25255B12%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-90WSvhDxbqg/UVSLNZV4ogI/AAAAAAAAB3U/1Pz01shHbGI/image_thumb%25255B5%25255D.png?imgmax=800" width="644" height="339" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;font style="font-weight: bold"&gt;Step 7: Loading data from HDFS to Hive&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;As a next step, let us load the data from HDFS to Hadoop Hive so that we can query the same. We'll create a table using the CREATE TABLE hive syntax, and will load the data. You can run ‘hive’ command from the Hadoop command line to run the following statements.&lt;/p&gt;

&lt;pre name="code"&gt;
CREATE TABLE nstable (
  namespace STRING,
  count INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE;

LOAD DATA INPATH 'output/CodeFiles/part-00000' into table nstable;&lt;/pre&gt;

&lt;p&gt;And here is what you might see.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-NoQdc-3wR5k/UVSLOOlHe9I/AAAAAAAAB3c/8zOi640AJRw/s1600-h/image%25255B17%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-xiHsnId_CWc/UVSLPl1SOOI/AAAAAAAAB3k/WdpoSED0rbU/image_thumb%25255B8%25255D.png?imgmax=800" width="640" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you can read the data from the hive. &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;See my article &lt;a href="http://www.amazedsaint.com/2013/02/a-quick-introduction-to-hadoop-hive-on.html"&gt;&lt;strong&gt;Querying data from the Hive using LINQ and C#&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;

  &lt;li&gt;I wrote a &lt;a href="http://www.amazedsaint.com/2013/03/azure-hadoop-hdinsight-tools-visual.html"&gt;&lt;strong&gt;VS Add In so that you can connect to Hive and query the data&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And there you go. Now you know everything about writing your own Hadoop Map Reduce Jobs in C#, load the data to the Hive, and query the same back in C# to visualize your data.&amp;#160; Happy Coding. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=aAhxSNnQCws:vtSe-GdP8vg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=aAhxSNnQCws:vtSe-GdP8vg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=aAhxSNnQCws:vtSe-GdP8vg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/aAhxSNnQCws" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/aAhxSNnQCws/taming-big-data-with-c-using-hadoop-on.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-TL-RMGPwfhk/T83NNUgqhCI/AAAAAAAABb0/6mLGwzaOU5c/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/03/taming-big-data-with-c-using-hadoop-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-3827203280124313338</guid><pubDate>Mon, 25 Mar 2013 13:06:00 +0000</pubDate><atom:updated>2013-03-25T19:07:42.087+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Reflection API Changes in .NET 4.5 Applications and Fun with Custom Reflection Context</title><description>&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-xjjkHKqls5E/UVBMctgeTsI/AAAAAAAAB1U/LZJnYTDIsic/s1600-h/image%25255B10%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/-ekW6rqscw3o/UVBMdU8vNHI/AAAAAAAAB1c/umj46AEvYlo/image_thumb%25255B6%25255D.png?imgmax=800" width="211" height="240" /&gt;&lt;/a&gt;Before .NET 4.5, as you are aware, the Type class in System namespace was used for most of the reflection scenarios. Though you can use Type class to inspect meta data, this is really heavy weight. As most reflection scenarios are just read only (for example, using attributes for providing meta data etc),&amp;#160; Microsoft decided to introduce a light weight, alternate Type API as part of .NET Core profile. If you are wondering about different .NET profiles, &lt;a href="http://blog.stephencleary.com/2012/05/framework-profiles-in-net.html"&gt;here is a good list compiled together&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Type and TypeInfo&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;So to keep the long story short - in .NET 4.5 onwards, Type class got ‘shrunk’ to provide a shallow, high speed read only view of an object’s structure (definition). And TypeInfo class got introduced that contains the actual type definitions with more detailed information. See &lt;a href="http://msdn.microsoft.com/en-us/library/system.type.aspx"&gt;Type&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.typeinfo.aspx"&gt;TypeInfo&lt;/a&gt; – and check out the platform specific support for it’s members. You can read &lt;a href="http://blogs.msdn.com/b/dotnet/archive/2012/08/28/evolving-the-reflection-api.aspx"&gt;more about the Reflection API changes here&lt;/a&gt;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The TypeInfo class represents &lt;i&gt;type definitions&lt;/i&gt; and the Type class represents &lt;i&gt;type references&lt;/i&gt;&lt;b&gt;. &lt;/b&gt;Given a Type object, you can get the name of the type as a string, without any requirement to load anything more. Alternatively, if you need rich information about a type, you can get a TypeInfo object from a Type object.&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In .NET full profiles used for desktop and web applications, the old Type API (Accessing everything through Type) is still available to maintain backward compatibility, along with the new Type API (TypeInfo etc). And For .NET Framework profiles for new platforms like WinRT that don’t need backward compatibility, Type class got shrunk by removing a number of members as discussed, and TypeInfo is the only way to dive deep into reflection. If you are writing code that should target multiple framework versions (as in Portable Class Libraries), you should use the new API. Otherwise, you can continue to use the old API as .NET framework versions on full profile actually returns the self contained Type object as previously. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Using TypeInfo&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You may call GetTypeInfo on any type object as shown below to get the TypeInfo for a Type, and may use the new API (like DeclaredProperties) to traverse the members.&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;	//Get the basic type
        Type myType = &amp;quot;somestring&amp;quot;.GetType();

        //Get more information about that type
        TypeInfo myTypeDetails = myType.GetTypeInfo();

        foreach(var prop in myTypeDetails.DeclaredProperties)
            {
                Console.WriteLine(prop.Name);
            }&lt;/pre&gt;

&lt;p&gt;Also, you may use TypeInfo to check the relations between types. For example, here is how to use IsAssignableFrom method of TypeInfo to determine variance.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;  //Can I assign a string to an object - True
   var canAssignStringToObject = typeof (object).GetTypeInfo()
                                  .IsAssignableFrom(typeof (string));

  //Can I assign an object to a string - False
  var canAssignObjectToString = typeof(string).GetTypeInfo()
                                 .IsAssignableFrom(typeof(object));&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Custom Reflection Context&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Custom Reflection Context is a new addition in .NET 4.5, to customize how a consumer using the TypeInfo based new Reflection API views reflected information about your types. This will be extremely helpful when you write Libraries and design components that take advantage of meta data. This is much like customizing Type information using techniques like &lt;a href="http://blogs.msdn.com/b/parthopdas/archive/2006/01/03/509103.aspx"&gt;type descriptors&lt;/a&gt;. The new API provides run time virtualization over reflection, and looks quite intuitive - I wish this was there when we spend years writing custom tools for extending Visual Studio few years back, to virtualize type information for existing and new components. &lt;/p&gt;

&lt;p&gt;You can override properties in CustomReflectionContext to add virtualized properties, custom attributes etc. For example, here is a quick PropertyAdder context that’ll inject some properties while accessed through the custom reflection context&lt;/p&gt;
. 

&lt;pre class="c#" name="code"&gt;
    //Just a dummy Dog class
    //See that we don't have any properties
    class Dog
    {

    }

//A PropertyAdder context
    //To add custom properties to the reflection context
    class PropertyAdder : CustomReflectionContext
    {
        private readonly Dictionary&lt;string  , object&gt; _properties;

        public PropertyAdder(Dictionary&lt;string  , object&gt; properties)
        {
            _properties = properties;
        }

        protected override IEnumerable&lt;propertyinfo&gt; AddProperties(Type type)
        {
            if (type == typeof(Dog))
            {
                foreach (var p in _properties)
                {
                    yield return
                        CreateProperty(MapType(p.Value.GetType().GetTypeInfo()),
                                       p.Key,
                                       (o) =&amp;gt; _properties[p.Key],
                                       (o, v) =&amp;gt; _properties[p.Key] = v);
                }
            }
            else
            {
                base.AddProperties(type);
            }
        }
    }&lt;/pre&gt;

&lt;p&gt;And here is a quick example for using our PropertyAdder. Essentially,&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;We are creating a new instance of PropertyAdder&lt;/li&gt;

  &lt;li&gt;Then decorating our Dog class’s type information by mapping the type information via the custom reflection context. &lt;/li&gt;

  &lt;li&gt;Finally, we are creating an instance of Dog class, and look ma- we’ve got the properties via reflection&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, here we go.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;
    //Main Driver
    class Program
    {
        static void Main(string[] args)
        {

            //Properties we want to add
            var properties = new Dictionary&lt;string  , object&gt;
                {
                    {&amp;quot;Name&amp;quot;, &amp;quot;Joe&amp;quot;},
                    {&amp;quot;Age&amp;quot;, 10}
                };

            //An instance of our custom reflection context
            var adderContext = new PropertyAdder(properties);

            //Get the type in the default reflection context.
            var dogTypeInfo = typeof (Dog).GetTypeInfo();

            //Get the type in the customized reflection context.
            //We'll map the context with our PropertyAdder
            var customDogTypeInfo = adderContext.MapType(dogTypeInfo);


            //Just an instance
            var d = new Dog();

            //Display properties and values using custom reflection context. 
            foreach (var prop in customDogTypeInfo.DeclaredProperties)
            {

                //We'll really see the properties we added above
                Console.WriteLine(&amp;quot;{0}={1}&amp;quot;,prop.Name, 
                    customDogTypeInfo.GetProperty(prop.Name).GetValue(d));
            }

            Console.ReadLine();
        }
    }&lt;/pre&gt;

&lt;p&gt;And here is the output. You’ll see that we are accessing the properties we added via the reflection context. Here you go.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-uC9jxMLZ2OQ/UVBLzJ4p4LI/AAAAAAAAB08/Nsgrif-lVlg/s1600-h/image%25255B6%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-sfglaeYBxDk/UVBLz94eVhI/AAAAAAAAB1E/YqxuDpjuCRs/image_thumb%25255B4%25255D.png?imgmax=800" width="485" height="227" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this is fun especially when you work with libraries that leverage meta data and on the tooling side. For example, the &lt;a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.composition.registration.registrationbuilder.aspx"&gt;RegistrationBuilder&lt;/a&gt; class in MEF 2.0 inherits custom reflection context to provide meta data based conventions that describes rules for decorating entities.&lt;/p&gt;

&lt;p&gt;Happy Coding &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh6.ggpht.com/-tLkbX9dozDY/UVBL0fvgxOI/AAAAAAAAB1M/4KFwdlY_3OI/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;. Also, see my &lt;a href="http://www.amazedsaint.com/search/label/CSharp"&gt;other C# posts here&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=n0U27AM4Jp4:3pdwULGyS2Q:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=n0U27AM4Jp4:3pdwULGyS2Q:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=n0U27AM4Jp4:3pdwULGyS2Q:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/n0U27AM4Jp4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/n0U27AM4Jp4/reflection-api-changes-in-net-45.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-ekW6rqscw3o/UVBMdU8vNHI/AAAAAAAAB1c/umj46AEvYlo/s72-c/image_thumb%25255B6%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/03/reflection-api-changes-in-net-45.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-4982368125668329346</guid><pubDate>Fri, 08 Mar 2013 13:21:00 +0000</pubDate><atom:updated>2013-03-08T19:12:37.684+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">VS SDK</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><title>Azure Hadoop HDInsight Tools – Wrote A VS Add In For LINQ To Hive Model Generation and Hive SQL Queries</title><description>&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-JUcfQtQmcrY/UTnlwg29x2I/AAAAAAAABzQ/yhZ728Z3T1w/s1600-h/image%25255B30%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/-NER3-15D6Bs/UTnlxqvEcMI/AAAAAAAABzY/fT2ohkj2iP4/image_thumb%25255B16%25255D.png?imgmax=800" width="225" height="240" /&gt;&lt;/a&gt;This post is about the HD Insight Tools Visual Studio Add In -&amp;#160; for accessing Azure Hadoop Hive&amp;#160; from Visual Studio. I hacked together the same on my way back from the MVP summit, and a post is due. If you are new, last week I wrote about &lt;a href="http://www.amazedsaint.com/2013/02/a-quick-introduction-to-hadoop-hive-on.html"&gt;issuing LINQ queries against the Hive meta store&lt;/a&gt; – read that post for a general introduction about LINQ to Hive.&lt;/p&gt;  &lt;p&gt;You may use &lt;a href="http://visualstudiogallery.msdn.microsoft.com/2df9fe93-13ba-46db-8b7b-351a80ab769a?SRC=VSIDE"&gt;HDInsight Tools Visual Studio Add In&lt;/a&gt; for&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Generating wrapper classes for Hive tables for easily executing LINQ to Hive queries.&lt;/li&gt;    &lt;li&gt;Running Hive SQL queries from Visual Studio and for viewing the results&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Please note that you need to provision a Hadoop cluster in Azure, or need HDInsight installed locally (See these earlier posts related to Hadoop on Azure - &lt;a href="http://www.amazedsaint.com/2012/06/analyzing-some-big-data-using-c-azure.html"&gt;Analyzing some ‘Big Data’ using C#&lt;/a&gt; and &lt;a href="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html"&gt;Extracting Top 500 MSDN Links from Stack Overflow&lt;/a&gt; ).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Installing The Add In&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You can install the Add In from Visual Studio Tools –&amp;gt; Extensions and Updates.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-TntDif600sw/UTnlyiGvkHI/AAAAAAAABzg/ZNBkJXMFe_8/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-hVDRo4Jij_0/UTnl0AZfC-I/AAAAAAAABzo/OZcTJGX5JmI/image_thumb%25255B2%25255D.png?imgmax=800" width="640" height="360" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Generating LINQ To Hive Model Classes&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Once you install the Add In, Goto View-&amp;gt; Other Windows –&amp;gt; Hive Explorer to bring up the Hive Explorer tool Window. Click Add Connection to add a hive connection, by providing the server details, port, user name and password and click Save.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-2HzB8_lkFt0/UTnl0s3ep1I/AAAAAAAABzw/XJ-mooEeuzU/s1600-h/image%25255B12%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-N5EflQKC60g/UTnl1kcybBI/AAAAAAAABz4/HJG8N06frUA/image_thumb%25255B6%25255D.png?imgmax=800" width="640" height="276" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Once you add a connection, you can expand the connection to view the tables and fields in the Hive. Now, you can right click on the Added connection name in the tool Window, and click ‘Generate Code’ context menu to generate the model classes. Also, make sure you install the Microsoft.Hadoop.Hive nuget package by issuing the &lt;em&gt;install-package Microsoft.Hadoop.Hive –pre&lt;/em&gt; nuget command.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-c3IieUb7jBk/UTnl2uujY1I/AAAAAAAAB0A/-n3wQSZtNnY/s1600-h/image%25255B17%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-hiy6ZhE8jFI/UTnl4cpqqEI/AAAAAAAAB0I/bRtk4jam3sk/image_thumb%25255B9%25255D.png?imgmax=800" width="640" height="414" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You can use the generated model to query Hive using LINQ as mentioned in the previous article.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Issuing Queries&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You can use the Queries window of Hive Explorer to issue Hive Queries. Choose the connection in the combo box, and shoot your query to view the results.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-6uTQ68JrWYU/UTnl5SfXsqI/AAAAAAAAB0Q/rjgEN9KHxPo/s1600-h/image%25255B22%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-pNSrYPMBPgk/UTnl6954UqI/AAAAAAAAB0Y/QR0WyOVpwJQ/image_thumb%25255B12%25255D.png?imgmax=800" width="640" height="351" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Happy Coding. I’m soon uploading the source code of Hive Explore to Github after some clean up once I’ve some time. &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh4.ggpht.com/-v6f2SQB90O4/UTnl7ZB9EZI/AAAAAAAAB0g/TmdU7nIOcls/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=maBItyjpWC4:U28Vb99YArg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=maBItyjpWC4:U28Vb99YArg:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=maBItyjpWC4:U28Vb99YArg:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/maBItyjpWC4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/maBItyjpWC4/azure-hadoop-hdinsight-tools-visual.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-NER3-15D6Bs/UTnlxqvEcMI/AAAAAAAABzY/fT2ohkj2iP4/s72-c/image_thumb%25255B16%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/03/azure-hadoop-hdinsight-tools-visual.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-6787445540204591426</guid><pubDate>Wed, 06 Mar 2013 18:47:00 +0000</pubDate><atom:updated>2013-03-07T00:38:14.883+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Startups</category><category domain="http://www.blogger.com/atom/ns#">Philosophy</category><category domain="http://www.blogger.com/atom/ns#">Non-Tech</category><title>About That ‘Feelings’ In Software Industry</title><description>&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-sHw7XqQzHS8/UTeQsaTTQbI/AAAAAAAABy4/lkCxwEwBHms/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 20px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/-Pe7LRP4klj8/UTeQtlCzw9I/AAAAAAAABzA/Pgr9L233NcE/image_thumb%25255B1%25255D.png?imgmax=800" width="239" height="240" /&gt;&lt;/a&gt;When I read &lt;a href="http://en.wikipedia.org/wiki/Built_to_Last:_Successful_Habits_of_Visionary_Companies"&gt;Built to Last&lt;/a&gt; few years back, I got stumbled upon this fact – it is all about building a cult. And a cult is not a bad thing. You can base it on some ethical values, and can sprinkle stories and sutras around the same to make it more exciting. Or, you may brand it as your corporate culture. But in the end of the day, it is all about building a cult which looks original and rallying your employees and customers around the same with out shaking their belief. &lt;/p&gt;  &lt;p&gt;In the last ten years, Steve Jobs did that much better than any one else. I think he learned about the art of creating a cult when he was &lt;a href="http://archive.is/20120709/http://in.news.yahoo.com/wandering-india-steve-jobs-learned-intuition-123904237.html"&gt;wandering in India&lt;/a&gt;, may be from &lt;a href="http://timesofindia.indiatimes.com/tech/itslideshow/7312002.cms"&gt;Neem Karoli Baba&lt;/a&gt;. Today, people worship Apple.&lt;/p&gt;  &lt;p&gt;I believe successful organizations are good in assembling together such a framework that can yield repeatable behavioral patterns from all stakeholders, most importantly, customers. Any successful organization need at least one iconic leader with charisma to grow beyond mediocrity. People buy a brand not just because of its usability – They buy or act when they believe in the cult of the brand, when they buy in to that ideology and find the trust. &lt;/p&gt;  &lt;p&gt;As Simon points out in this Ted Talk, great leaders inspire action – they inspire employees and customers and other stake holders to align with the cult or self of the organization. I think the justification for all this lies deep with in, we are wired to follow a cult. For example, our feelings and instincts influence a purchase decision – probably much more than the numbers we have in our head. &lt;/p&gt; &lt;iframe height="315" src="http://embed.ted.com/talks/simon_sinek_how_great_leaders_inspire_action.html" frameborder="0" width="560" scrolling="no" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"&gt;&lt;/iframe&gt;    &lt;p&gt;So, I believe everything from Brand loyalty to architecture decisions are influenced by aspects like peer recommendations and herd mentality in a big way. That’s why a number of CXOs invest in ‘Big Data’ and ‘Cloud’ with out knowing the intricacies. &lt;/p&gt;  &lt;p&gt;Even software has it’s FADs right now. So, it is of no surprise that the industry is also driven by its own fashions and styles at times. Some of these FADs will burst as bubbles. Who cares. The world works on chaos theory, and it is not really predictable all the time – so decisions based on gut feeling and intuitions are acceptable to some extent, isn’t it? Though, generally &lt;a href="http://www.amazedsaint.com/2012/09/the-problem-with-being-passionate-about.html"&gt;I don’t recommend subjectivity&lt;/a&gt; over objectivity.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=LbuJVl3okTU:16uvLm-ljoE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=LbuJVl3okTU:16uvLm-ljoE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=LbuJVl3okTU:16uvLm-ljoE:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/LbuJVl3okTU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/LbuJVl3okTU/that-feelings-in-software-industry.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-Pe7LRP4klj8/UTeQtlCzw9I/AAAAAAAABzA/Pgr9L233NcE/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/03/that-feelings-in-software-industry.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-7184895297513762833</guid><pubDate>Tue, 05 Mar 2013 20:55:00 +0000</pubDate><atom:updated>2013-03-06T02:33:53.431+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>AutoCommand For MVVM – More tricks With Lambdas and CallerMemberName</title><description>&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-2qB79DZaaIE/UTZb5ZBC1LI/AAAAAAAAByg/HIXta4z60Ak/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-KWvp9ssLsHk/UTZb6HN8kFI/AAAAAAAAByo/A4pPvCFhVLk/image_thumb%25255B1%25255D.png?imgmax=800" width="240" height="160" /&gt;&lt;/a&gt;Few days back I ranted about &lt;a href="http://www.amazedsaint.com/2013/02/lambda-patterns-in-c.html"&gt;Lamdba Patterns in C# and Init Time branching&lt;/a&gt;.&amp;#160; I also had a generally insane example regarding Init Time branching using CallerMemberName attribute, and got few comments about the usefulness (or the lack of the same). &lt;/p&gt;  &lt;p&gt;While I generally agree with the comments, here is a may be useful, still crazy AutoCommand for your next basement MVVM application. First, here is how the AutoCommand will work. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;//Our simple View Model
public class SimpleMathViewModel : BaseViewModel
    {
        public SimpleMathViewModel()
        {
            Commands = new Dictionary&amp;lt;string, Action&amp;gt;
                {
                    {&amp;quot;Add&amp;quot;, ()=&amp;gt;Result=A+B},
                    {&amp;quot;Substract&amp;quot;, ()=&amp;gt;Result=A-B},
                    {&amp;quot;Multiply&amp;quot;, ()=&amp;gt;Result=A*B},
                    {&amp;quot;Divide&amp;quot;, ()=&amp;gt;Result=A/B}
                };
        }

        //Your commands should get automatically wired up

        public ICommand Add { get { return new AutoCommand(this); } }
        public ICommand Substract { get { return new AutoCommand(this); } }
        public ICommand Multiply { get { return new AutoCommand(this); } }
        public ICommand Divide { get { return new AutoCommand(this); } }

        //Other blah blah properties
        public int A { get; set; }
        public int B { get; set; }

        private int _result;
        public int Result
        {
            get { return _result; }
            set
            {
                _result = value; OnPropertyChanged();
            }
        }
    }&lt;/pre&gt;

&lt;p&gt;Also, Look ma, there is no dirty property name string in the OnPropertyChanged method call to raise the PropertyChanged notification as it is inferred&amp;#160; - but I'm sure you might have read some where else how to use CallerMemberName to do the trick. If you are still wondering, see the method implementation in the BaseViewModel code below.&lt;/p&gt;

&lt;p&gt;Leaving that aside – how’z the wiring works for AutoCommand? Alright, guess you guessed it. Here is the AutoCommand implementation. &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;   public class AutoCommand : ICommand
    {
        private readonly BaseViewModel _instance;
        private readonly string _caller;

        //Just keep the caller name and the base view model instance
        public AutoCommand(BaseViewModel instance, 
                [CallerMemberName]string caller = &amp;quot;&amp;quot;)
        {
            _instance = instance;
            _caller = caller;
        }

        public bool CanExecute(object parameter)
        {
            return true; //who cares
        }

        //Fetch the right command to execute from the dictionary
        public void Execute(object parameter)
        {
            _instance.Commands[_caller](); //get the ICommand based on the caller name
        }

        public event EventHandler CanExecuteChanged;
    }&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And if you are wondering how we've implemented the BaseViewModel, it is trivial. There only interesting piece there is how we inject the property name to the base class method.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt; public abstract class BaseViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;
        public Dictionary&amp;lt;string, Action&amp;gt; Commands { get; set; }

        protected virtual void OnPropertyChanged([CallerMemberName]string propertyName=&amp;quot;&amp;quot;)
        {           
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }&lt;/pre&gt;

&lt;p&gt;This is not a best practice show case, was just discussing a language feature and few possibilities. Happy and Insane coding &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh3.ggpht.com/-dOJ7uR5NbPg/UTZbqAJ4EQI/AAAAAAAAByY/ECRZ-XORuH4/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=L_Ba8SS6zhg:-4oHSboAIXA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=L_Ba8SS6zhg:-4oHSboAIXA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=L_Ba8SS6zhg:-4oHSboAIXA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/L_Ba8SS6zhg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/L_Ba8SS6zhg/autocommand-for-mvvm-more-tricks-with.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-KWvp9ssLsHk/UTZb6HN8kFI/AAAAAAAAByo/A4pPvCFhVLk/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/03/autocommand-for-mvvm-more-tricks-with.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-5342485702869531872</guid><pubDate>Thu, 28 Feb 2013 03:04:00 +0000</pubDate><atom:updated>2013-02-28T08:39:12.161+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">Hadoop</category><title>A Quick introduction to Hadoop Hive on Azure and Querying Hive using LINQ in C#</title><description>&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-I8I6kwCGFjE/US7KUorS_jI/AAAAAAAABx0/j0akJBy-cZE/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-8c6GZWjtvQQ/US7KVSrHymI/AAAAAAAABx8/7n1er6cQbJE/image_thumb%25255B1%25255D.png?imgmax=800" width="213" height="240" /&gt;&lt;/a&gt;Earlier, in a couple of posts related to Hadoop on Azure - &lt;a href="http://www.amazedsaint.com/2012/06/analyzing-some-big-data-using-c-azure.html"&gt;Analyzing some ‘Big Data’ using C#&lt;/a&gt; and &lt;a href="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html"&gt;Extracting Top 500 MSDN Links from Stack Overflow&lt;/a&gt; – I showed how to use C# Map Reduce Jobs with Hadoop Streaming to do some meaningful analytics. &lt;/p&gt;  &lt;p&gt;Now, a preview version of the &lt;a href="http://hadoopsdk.codeplex.com/"&gt;.NET SDK for Hadoop&lt;/a&gt; is available, making it easier to work with Hadoop from .NET – with more types for supporting Map Reduce Jobs, For creating LINQ to Hive queries etc.&amp;#160; You can experiment with Hadoop and C# either by creating a cluster in &lt;a href="http://hadooponazure.com"&gt;http://hadooponazure.com&lt;/a&gt; or you can obtain Hadoop in your machine by installing Microsoft &lt;a href="http://www.microsoft.com/web/handlers/webpi.ashx?command=GetInstallerRedirect&amp;amp;appid=HDINSIGHT-PREVIEW&amp;amp;mode=new"&gt;HDInsight&lt;/a&gt; using WebPI.&lt;/p&gt;  &lt;p&gt;In case you are new to Hadoop on Azure, I suggest you read the introductory concepts &lt;a href="http://www.amazedsaint.com/2012/06/analyzing-some-big-data-using-c-azure.html"&gt;here&lt;/a&gt; before you start. This post is just a quick example that shows how to use LINQ to Hive.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Hive is a data warehouse system for Hadoop that facilitates easy data summarization, ad-hoc queries, and the analysis of large datasets stored in Hadoop compatible file systems&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;strong&gt;Installing the libraries&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To start with, you can fire up Visual Studio, Create a console project, and install Microsoft.Hadoop.Hive libraries via Nuget. &lt;/p&gt;  &lt;pre name="code"&gt;install-package Microsoft.Hadoop.Hive -pre &lt;/pre&gt;

&lt;p&gt;Also, head over to &lt;a href="http://hadoopoonazure.com"&gt;http://hadoopoonazure.com&lt;/a&gt; and create a new cluster. And you are now set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating the typed wrappers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To access Hive, you need to create a strongly typed wrapper – as of now, you need to roll this out your own, as there is no automated generation support. When you provision a Hadoop cluster, the Hive will be pre populated with a sample table (&lt;em&gt;hivesampletable&lt;/em&gt;), and I’m using the same for the below example for brevity.&amp;#160; You can &lt;a href="http://social.technet.microsoft.com/wiki/contents/articles/6226.how-to-connect-excel-to-hadoop-on-azure-via-hiveodbc.aspx"&gt;connect to the Hive via ODBC&lt;/a&gt; and see the hive tables in Excel.&lt;/p&gt;

&lt;p&gt;So, let us go ahead and create a hive connection (much like an EF data context) and a typed representation for a row in the table. HiveConnection and HiveTable types are in the Microsoft.Hadoop.Hive namespace.&lt;/p&gt;

&lt;pre name="code"&gt;    
    //Our concrete hive connection
    
    public class SampleHiveConnection : HiveConnection
    {
        public SampleHiveConnection(string hostName, int port) 
            : base(hostName, port, null, null) { }

        public SampleHiveConnection(string hostName, int port, 
                            string username, string password) 
            : base(hostName, port, username, password) { }

        public HiveTable&amp;lt;DeviceInfo&amp;gt; DeviceInfoTable
        {
            get
            {
                return this.GetTable&amp;lt;DeviceInfo&amp;gt;(&amp;quot;hivesampletable&amp;quot;);
            }
        }
    }

    //A typed row. Property names based on field names hivesampletable
    
    public class DeviceInfo : HiveRow
    {
        public string DevicePlatform { get; set; }
        public string DeviceMake { get; set; }
        public int ClientId { get; set; }
    }&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Querying the Hive using LINQ&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now,&amp;#160; you may perform LINQ queries against your Hive context, thanks to the Hadoop SDK we installed via Nuget. Just make sure to substitute the connection string, username and password with your own.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;class Program
    {
        static void Main(string[] args)
        {


            //Create a hive connection
            //I've my cluster in https://www.hadooponazure.com
            var hive = new SampleHiveConnection(
                    &amp;quot;saintcluster.cloudapp.net&amp;quot;, //your connection string
                    10000,                       //port                    
                    &amp;quot;user&amp;quot;,                      //your username
                    &amp;quot;yourpass&amp;quot;);                 //your password


            //Get the results
            //Make sure you goto the dashboard and turn on the ODBC port
            var res = from d in hive.DeviceInfoTable
                      where d.ClientId &amp;lt; 100
                      select d;

            //Dump it to the console if you like
            var list = res.ToList();     

        }
    }&lt;/pre&gt;
That is cool. Your LINQ query will be submitted to the Azure cluster via the ODBC driver, and will be compiled and executed in the Hive.&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=YZKwUsic4-E:kY95SSklZCM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=YZKwUsic4-E:kY95SSklZCM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=YZKwUsic4-E:kY95SSklZCM:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/YZKwUsic4-E" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/YZKwUsic4-E/a-quick-introduction-to-hadoop-hive-on.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-8c6GZWjtvQQ/US7KVSrHymI/AAAAAAAABx8/7n1er6cQbJE/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/02/a-quick-introduction-to-hadoop-hive-on.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-4231132419757554838</guid><pubDate>Tue, 26 Feb 2013 07:26:00 +0000</pubDate><atom:updated>2013-02-26T17:13:59.783+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Kinect</category><category domain="http://www.blogger.com/atom/ns#">Books</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Book Reviewed - Kinect for Windows SDK Programming Guide By Abhijit Jana</title><description>&lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 5px 5px 5px 20px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" border="0" align="right" src="http://www.packtpub.com/sites/default/files/2380OT.jpg" width="283" height="349" /&gt;Recently, &lt;a href="http://abhijitjana.net/"&gt;Abhijith Jana&lt;/a&gt; published his Kinect For &lt;a href="http://www.amazon.com/Kinect-Windows-SDK-Programming-Guide/dp/1849692386"&gt;Windows SDK Programming Guide&lt;/a&gt; – And I’m one of the three technical reviewers. The Book is very pictorial in the explanations, with crisp code samples and cited annotations. I was particularly impressed with the way Abhijit tied the features of Kinect with Real use cases. The book covers all the hardware and software aspects, with lot of illustrations and examples. I liked the easy to understand, simple narration followed by Abhijit.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;The Tone of the book&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;He starts with unpacking the Kinect, introducing you to the hardware and software components. And in the next couple of chapters, he is slowly familiarizing you to the camera, making sense of the color and depth image streams, Skeleton tracking, Speech API, Gesture detection etc. The book also covers various third party Kinect related APIs (including Coding4Fun Kinect Toolkit, few Gesture Libraries etc). &lt;/p&gt;  &lt;p&gt;The last couple of chapters is all about what you can build using Kinect, with some cool examples that demonstrates how to interface Kinect with multiple platforms including Azure, Windows Phone and few Micro Controllers. There are a number of cool graphics/illustrations to enable readers to visualize various aspects like depth detection, gesture detection etc. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;About the Content&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;More importantly, I believe this turned out to be a practical guide for any one to write real world applications using Kinect. One of my observations during the review stage was to include a lot of practical examples.&amp;#160; I am glad to see these countless examples in the book and should commend Abhijit for his hard work. There are lot of practical scenarios covered, including&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Using Kinect Windows SDK to build gesture capabilities in your Windows applications&lt;!--EndFragment--&gt; &lt;/li&gt;    &lt;li&gt;Adding night vision using IR sensors &lt;/li&gt;    &lt;li&gt;Audio processing &lt;/li&gt;    &lt;li&gt;Building an intrusion detector using Kinect &lt;/li&gt;    &lt;li&gt;Using Kinect Speech recognizer capabilities to integrate Speech detection &lt;/li&gt;    &lt;li&gt;Making Kinect and Netdunio work together to have some serious fun etc. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I recently showed this book to some enthusiasts during my “Natural User Interface using C#” sessions in Rutgers as well as in Cupertino, and the response was quite amazing. As it assumes no prior knowledge in NUIs, this was a good starting point for a number of hackers. Also, one startup I met in CA mentioned that they are building a 3D Scanner in Kinect to use with the 3D printers, by extracting the point cloud and to convert the same to a 3D format that can be passed to the printers.&lt;/p&gt;  &lt;p&gt;I may be a bit biased about the book as I was working with Abhi very closely for the review, but I suggest you to have a look at Amazon listing and see the reviews there. Suggest you should buy the same, if you ever tried hacking cool stuff. Or, what about building interactive Advertisement boards using Windows 8? Or a private intrusion detector for your home? Just &lt;a href="http://www.amazon.com/Kinect-Windows-SDK-Programming-Guide/dp/1849692386"&gt;Go ahead and buy one.&lt;/a&gt; – I’m so confident that you’ll love it..&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=o_2VnbCG170:1s0nUw4PpJk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=o_2VnbCG170:1s0nUw4PpJk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=o_2VnbCG170:1s0nUw4PpJk:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/o_2VnbCG170" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/o_2VnbCG170/book-reviewed-kinect-for-windows-sdk.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><feedburner:origLink>http://www.amazedsaint.com/2013/02/book-reviewed-kinect-for-windows-sdk.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-5744018555810166565</guid><pubDate>Tue, 26 Feb 2013 05:28:00 +0000</pubDate><atom:updated>2013-02-26T17:10:50.533+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Lambda patterns in C#?</title><description>&lt;p&gt;I had few interesting discussions during the MVP Summit around using patterns from other programming languages in C#. Earlier, I’ve blogged about some of these scenarios.&lt;a href="http://lh5.ggpht.com/-WO9_DOXw0vI/USxIQW47T-I/AAAAAAAABxs/XfFOqNGtaWM/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-KM0n_WGptFA/USxIRae5LoI/AAAAAAAABxw/1GOjYXQyIog/image_thumb%25255B2%25255D.png?imgmax=800" width="142" height="142" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2011/03/case-of-switch-case-in-c.html"&gt;The Case of Switch Case in C#&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2010/10/poor-mans-singleton-methods-via-dynamic.html"&gt;Mimicking Ruby style singleton methods in C# using Dynamic&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I’ve over heard Florian’s session this time during the summit, where he elaborated few interesting patterns from Java script that could be used in C#. He has a pretty good Code Project article regarding the same – &lt;a href="http://www.codeproject.com/Articles/507985/Way-to-Lambda"&gt;Way To Lambda&lt;/a&gt; – and it is pretty good to see a formalized approach towards re-using these patterns in C#&lt;/p&gt;  &lt;p&gt;One of my favorites is the C# version of Init-time branching (See &lt;a href="http://www.jspatterns.com/coding-patterns/init-time-branching/"&gt;Javascript Init time branching&lt;/a&gt; here)&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;   enum Mode
    {
        Http,
        WebSocket
    }

    class Messenger
    {

        public Func&amp;lt;string&amp;gt; Read { get; private set; }

        public Messenger(Mode m)
        {
            if (m == Mode.Http)
            {                
                Read = ()=&amp;gt;&amp;quot;Stub read logic using http&amp;quot;; 
            }
            else
            {
                Read = () =&amp;gt; &amp;quot;Stub read logic using websocket&amp;quot;;
            }
        }
    }&lt;/pre&gt;

&lt;p&gt;The above is a very simple version of Init time branching – but Instead of setting up the method (in this case the Read method) based on some configuration parameter, you can inject the same via the constructor or to the property – and in this way abstract out the branching as part the DI. &lt;/p&gt;

&lt;h4&gt;Convention Based Strategy Pattern *_*&lt;/h4&gt;

&lt;p&gt;Disclaimer: The remaining portion of the article is just not for regular use cases, and you can easily shoot yourself in the foot. &lt;/p&gt;

&lt;p&gt;Now, let us use Init-Time branching to attain some kind of ‘Convention based’ &lt;a href="http://www.amazedsaint.com/2008/01/design-patterns-part-i-and-ii.html"&gt;strategy pattern&lt;/a&gt;. Branching will be done based on the caller’s semantics. Let us assemble a simple Serializer, that uses some convention based on the caller’s name. Note that we are using the &lt;a href="http://msdn.microsoft.com/en-us/library/hh534540.aspx"&gt;Caller information attributes&lt;/a&gt; to extract the caller name.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;class ConventionSerializer
    {
        public Func&amp;lt;string&amp;gt; Serialize { get; private set; }

        public ConventionSerializer([CallerMemberName] string memberName = &amp;quot;&amp;quot;)
        {
            if (memberName.Contains(&amp;quot;Xml&amp;quot;))
            {
                Serialize = () =&amp;gt; 
                { /* serialize to xml */
                  return &amp;quot;xml&amp;quot;; 
                };
            }
            else
            {
                Serialize = () =&amp;gt;
                { /* serialize to json */
                    return &amp;quot;json&amp;quot;;
                };
            }
        }

    }&lt;/pre&gt;

&lt;p&gt;And then, you may consume the same from the methods WriteXml and WriteJson.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;       static void WriteXml()
        {
            var ser = new ConventionSerializer();
            Console.WriteLine(ser.Serialize()); //output xml
        }

        static void WriteJson()
        {
            var ser = new ConventionSerializer();
            Console.WriteLine(ser.Serialize()); //output json
        }&lt;/pre&gt;

&lt;p&gt;Was just bringing up an alternate perspective, requesting purists not to get offended. Happy Coding &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh3.ggpht.com/-RuyFGyjOw-E/USxH_jHI7TI/AAAAAAAABxA/UfVvJX-q48E/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=R6wKhrEbzO0:hyg4se6F9Ac:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=R6wKhrEbzO0:hyg4se6F9Ac:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=R6wKhrEbzO0:hyg4se6F9Ac:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/R6wKhrEbzO0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/R6wKhrEbzO0/lambda-patterns-in-c.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-KM0n_WGptFA/USxIRae5LoI/AAAAAAAABxw/1GOjYXQyIog/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/02/lambda-patterns-in-c.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-226916973772566896</guid><pubDate>Fri, 18 Jan 2013 06:19:00 +0000</pubDate><atom:updated>2013-01-18T11:49:32.580+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">DSL</category><category domain="http://www.blogger.com/atom/ns#">.NET 4.0</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Portable Library and WinRT support for ElasticObject</title><description>&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-FbQdrikC2Lc/UPjpY8ICHfI/AAAAAAAABrM/OSAAF4cL4eU/s1600-h/image%25255B3%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/-5ReIUSHji4A/UPjpcVV-UKI/AAAAAAAABrU/feSS9Ts3MYM/image_thumb%25255B1%25255D.png?imgmax=800" width="240" height="160" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Read these articles if you are catching up about Elastic Object&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.codeproject.com/Articles/62839/Adventures-with-C-4-0-dynamic-ExpandoObject-Elasti"&gt;Adventures with C# Dynamic&lt;/a&gt; – Implementing your own ElasticObject&lt;/li&gt;    &lt;li&gt;&lt;a href="http://bartwullems.blogspot.in/2011/11/creating-test-data-using-elasticobject.html"&gt;Creating Test data using ElasticObject&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;img alt="image" src="http://lh5.ggpht.com/__Mw4iY-4nuY/S369nqzA5GI/AAAAAAAAAnA/LDy9IXkN-ko/image_thumb%5B57%5D.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;p&gt;If you loved using my &lt;a href="https://github.com/amazedsaint/ElasticObject"&gt;ElasticObject&lt;/a&gt; implementation, here is some good news for you&lt;/p&gt;  &lt;p&gt;&lt;a href="https://twitter.com/ArielBH"&gt;Ariel Ben Horesh&lt;/a&gt; recently added&amp;#160; &lt;a href="https://github.com/amazedsaint/ElasticObject/pull/3"&gt;Portable Library project&lt;/a&gt; type and WinRT support for ElasticObject recently. So, enjoy the wicked evilness of ElasticObject in your Portable Libraries and WinRT projects.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=thBADPlOwdQ:1e-kChAYrPI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=thBADPlOwdQ:1e-kChAYrPI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=thBADPlOwdQ:1e-kChAYrPI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/thBADPlOwdQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/thBADPlOwdQ/portable-library-and-winrt-support-for.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-5ReIUSHji4A/UPjpcVV-UKI/AAAAAAAABrU/feSS9Ts3MYM/s72-c/image_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2013/01/portable-library-and-winrt-support-for.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-6798593135523068113</guid><pubDate>Mon, 31 Dec 2012 13:01:00 +0000</pubDate><atom:updated>2012-12-31T18:34:43.481+05:30</atom:updated><title>Top posts from 2012 – Roundup Post</title><description>&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-0fL_c7scH5g/UOGNE3AgFbI/AAAAAAAABqs/lSbNlmSd05o/s1600-h/image%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-kVTjzGUzWzQ/UOGNGomLAnI/AAAAAAAABq0/6nvCrkooZGc/image_thumb%25255B3%25255D.png?imgmax=800" width="240" height="150" /&gt;&lt;/a&gt;I would like to wish all my readers an amazing 2013 filled with joy and enthusiasm. Here are some of the top 2012 posts/publications&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Changing times for web developers&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/11/changing-times-for-web-developers-6.html"&gt;http://www.amazedsaint.com/2012/11/changing-times-for-web-developers-6.html&lt;/a&gt;&lt;/li&gt; &lt;!--EndFragment--&gt;&lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Extracting Top 500 MSDN links from Stackoverflow using Apache Hadoop, Azure and C#&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a title="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html" href="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html"&gt;http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Writing Hadoop Jobs in C#&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&amp;#160;&lt;a href="http://www.codeproject.com/Articles/398563/Analyzing-some-Big-Data-Using-Csharp-Azure-And-Apa"&gt;http://www.codeproject.com/Articles/398563/Analyzing-some-Big-Data-Using-Csharp-Azure-And-Apa&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Introducing Signal Wire&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/09/signalwire-magical-plumbing-with-your.html"&gt;http://www.amazedsaint.com/2012/09/signalwire-magical-plumbing-with-your.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;5 Points C# developers should know about WinRT&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/09/5-points-developers-should-know-about.html"&gt;http://www.amazedsaint.com/2012/09/5-points-developers-should-know-about.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Introduction to TypeScript for C# developers&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html"&gt;http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Top MSDN links from Stack Overflow&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html"&gt;http://www.amazedsaint.com/2012/06/top-500-msdn-links-from-stack-overflow.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;Self hosting Web APIs&lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/05/self-hosting-aspnet-web-api-and.html"&gt;http://www.amazedsaint.com/2012/05/self-hosting-aspnet-web-api-and.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;XML Driven code generation using C# &lt;/strong&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/02/xml-driven-ct4-code-generation-with.html"&gt;http://www.amazedsaint.com/2012/02/xml-driven-ct4-code-generation-with.html&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Happy Coding &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh3.ggpht.com/-fa6ccTTuiBI/UOGMkhCfEII/AAAAAAAABqk/Mw6bi1GGUo8/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=DxRWFUe_2G0:BY7WTYHj118:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=DxRWFUe_2G0:BY7WTYHj118:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=DxRWFUe_2G0:BY7WTYHj118:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/DxRWFUe_2G0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/DxRWFUe_2G0/top-posts-from-2012-roundup-post.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-kVTjzGUzWzQ/UOGNGomLAnI/AAAAAAAABq0/6nvCrkooZGc/s72-c/image_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/12/top-posts-from-2012-roundup-post.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-6455682974209303898</guid><pubDate>Mon, 17 Dec 2012 05:15:00 +0000</pubDate><atom:updated>2012-12-17T11:51:29.350+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>A quick note on Closing lambda loop variables in C# 5.0 - Breaking Changes in C# 5.0 compiler</title><description>&lt;p&gt;This p&lt;a href="http://lh5.ggpht.com/-FrghGfp-h7A/UM6qS7qvGfI/AAAAAAAABqc/rNaqbvh8Rbg/s1600-h/image%25255B29%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/-2l_dwrNRV-Q/UM6qUA_if1I/AAAAAAAABqg/n2UkyWHQRKg/image_thumb%25255B20%25255D.png?imgmax=800" width="105" height="105" /&gt;&lt;/a&gt;ost is regarding a breaking change in C# 5.0 related to using variables in lambdas with in a loop. &lt;/p&gt;  &lt;p&gt;For example, prior to C# 5.0 compiler, the following code&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;        
     //** Code Example 1 **
 
     static void Main(string[] args)
        {
            var items = new List&amp;lt;int&amp;gt;() { 1, 2, 3, 4, 5 };
            var queue = new List&amp;lt;Func&amp;lt;int&amp;gt;&amp;gt;();
            foreach (var item in items)
                queue.Add(() =&amp;gt; item);
            foreach (var q in queue) Console.WriteLine(q());
            Console.Read();
        
    }&lt;/pre&gt;
will produce the following output 

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-_VFKv0vqgV4/UM6qVoyEgFI/AAAAAAAABps/eu22EI0EUnQ/s1600-h/image%25255B21%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/--IxYuvSWVaM/UM6qXroKZyI/AAAAAAAABp0/dvwH2s3jZSk/image_thumb%25255B14%25255D.png?imgmax=800" width="553" height="219" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is because prior the C# 5.0, the compiler closes/captures the reference of the lambda/loop variable than its actual value. And hence the value defaults to the current value at the time of invocation (here, when invoking the q() method) instead of the value at the time of using the variable in the expression (when adding it to the queue). So, earlier, the compiler forced you to declare a local variable in a loop (counter intuitive any day)&amp;#160;&amp;#160; because if you want to see the expected output, you need to manually close the variable by assigning it to some other variable, like &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;
    //** Code Example 2 **

   static void Main(string[] args)
        {
            var items = new List&amp;lt;int&amp;gt;() {1,2,3,4,5};
            var queue = new List&amp;lt;Func&amp;lt;int&amp;gt;&amp;gt;();
            foreach (var item in items)
            {
                //Prior to C# 5.0 this was required to correctly
                //capture the value
                var val = item;
                queue.Add(() =&amp;gt; val);
            }
            foreach (var q in queue) Console.WriteLine(q());
            Console.Read();
        }
    }&lt;/pre&gt;

&lt;p&gt;And this should give the output as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-gcUvLgRNv8I/UM6qY26jxpI/AAAAAAAABp8/I2qi3eC3bi8/s1600-h/image%25255B24%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-NaCNn7ZN4VA/UM6qfrsFBQI/AAAAAAAABqE/7k2LTGyIkVo/image_thumb%25255B17%25255D.png?imgmax=800" width="329" height="207" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From C# 5.0 onwards, the compiler will capture the value of the variable instead of it’s reference when you use a variable in a lambda expression with in a loop. So, &lt;em&gt;Code Example 1&lt;/em&gt; will provide &lt;em&gt;Output Listing 2&lt;/em&gt; that eliminates the need to capture the value manually, and you can write better code with out being forced to have local variables with in a loop.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=CZTR0L6_AKU:OscH1dtFjGo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=CZTR0L6_AKU:OscH1dtFjGo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=CZTR0L6_AKU:OscH1dtFjGo:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/CZTR0L6_AKU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/CZTR0L6_AKU/a-quick-note-on-closing-lambda-loop.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-2l_dwrNRV-Q/UM6qUA_if1I/AAAAAAAABqg/n2UkyWHQRKg/s72-c/image_thumb%25255B20%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/12/a-quick-note-on-closing-lambda-loop.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-7076902026810052320</guid><pubDate>Tue, 27 Nov 2012 18:23:00 +0000</pubDate><atom:updated>2012-11-28T00:18:49.237+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">Design And Architecture</category><category domain="http://www.blogger.com/atom/ns#">Mobile</category><title>‘HTML5 vs. Hybrid vs. Native Dilemma’ When You Build Enterprise Mobile Applications - The Bigger Picture</title><description>&lt;p&gt;This post is mainly about building Enterprise Mobile applications. Today I was reading &lt;a href="http://www.geekwire.com/2012/apps-cross-platform/"&gt;Charlie's post&lt;/a&gt; about building mobile applications, and was analyzing the hybrid application scenario from an Enterprise Standpoint.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-co4_PxOgDIQ/ULUGnXY2_5I/AAAAAAAABoo/5uef6WZ--7s/s1600-h/image%25255B7%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/-FjHvJRYeBvc/ULUGpKHqE0I/AAAAAAAABow/RiA1OkqwkqY/image_thumb%25255B5%25255D.png?imgmax=800" width="240" height="164" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;The Bigger Picture&lt;/h3&gt;  &lt;p&gt;Most of the recent conversations I had about building enterprise mobile applications starts with questions like “Whether I should go Hybrid or Native”. It is true that a lot of organizations are interested to go the ‘hybrid’ way because of cost concerns – but in my opinion, any decision should be customer driven instead of cost driven. So, the answer for this question should be driven by “What will give the best user experience to the end user”, instead or/along with asking questions like “how we can reduce the cost”. This is true for all apps, not just for enterprise mobile apps. &lt;/p&gt;  &lt;p&gt;Beyond this, from an Enterprise Standpoint, I think achieving end point independence is another way to reduce your cost and future proof your investments. So, while “HTML5 vs Hybrid vs Native” is just one decision parameter, there are few more parameters to consider when you talk about a mobile strategy. Including, &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Concerns during envisioning phase&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Target user analysis &lt;/li&gt;      &lt;li&gt;Choose a simple framework to begin with, like Forrester’s &lt;a href="http://www.readwriteweb.com/enterprise/2010/08/how-to-plan-mobile-development.php"&gt;POST approach&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;Gap analysis and portfolio rationalization &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;Deciding a strategy for Mobile Application development &amp;amp; Delivery&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Mobile Web/Pure HTML/JS&lt;/li&gt;      &lt;li&gt;Hybrid apps (HTML5/JS apps in Native containers&amp;#160; - Like Phone Gap and/or native parts/plugs like in Titanium) &lt;/li&gt;      &lt;li&gt;Native apps &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;Concerns regarding a Common Service Layer&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Building/Implementing a scalable Common Service Layer &lt;/li&gt;      &lt;li&gt;Implementing a scalable broker system between the service layer and legacy systems &lt;/li&gt;      &lt;li&gt;Ensuring standards (like using REST) &lt;/li&gt;      &lt;li&gt;Identifying and integrating a Content Delivery Network (CDN) for media delivery &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;Testing Model&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Security and Performance &lt;/li&gt;      &lt;li&gt;Device based testing &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;Submission Governance&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Payment model &lt;/li&gt;      &lt;li&gt;Keep track of submitted applications &lt;/li&gt;      &lt;li&gt;Analytics &lt;/li&gt;      &lt;li&gt;Feedback tracking &lt;/li&gt;      &lt;li&gt;Continuous improvement &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;p&gt;So, all these are parts of your mobile strategy.&amp;#160; Especially when you talk about Enterprise mobility,&amp;#160; achieving Mobile End Point independence is a key concern, and organizations understand the necessity of making their business logic and data available to multiple end points. REST is evolving more and more as a default choice for building a public service layer, around your existing data and intelligence. &lt;/p&gt;  &lt;h3&gt;Hybrid vs Native&lt;/h3&gt;  &lt;p&gt;Now, specifically about Hybrid vs Native. Here are the main Pros and Cons as I see it.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;For Hybrid applications&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Pros:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;No need for device specific development&lt;/li&gt;    &lt;li&gt;Better ROI as same code base can be re-used (to an extent) across multiple platforms&lt;/li&gt;    &lt;li&gt;You can still access some of the device features&lt;/li&gt;    &lt;li&gt;Can be packaged for additional channels, (Chrome Packaged Apps, Awesonium)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Cons&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;UI specialization is difficult&lt;/li&gt;    &lt;li&gt;Can’t be as responsive and feature rich as ‘pure’ native applications&lt;/li&gt;    &lt;li&gt;May hit limitations when implementing specific, optimized features&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;For Native Applications&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Pros&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;High degree of customization, can satisfy edge conditions&lt;/li&gt;    &lt;li&gt;High degree of usability&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Cons&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Scattered/multiple platforms&lt;/li&gt;    &lt;li&gt;Investment required for each platform&lt;/li&gt;    &lt;li&gt;Non unified code base, not much re-usability&lt;/li&gt;    &lt;li&gt;Teams with multiple skill sets required&lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;And More&lt;/h3&gt;  &lt;p&gt;That said, again, think beyond the “Hybrid vs Native” point when you think about Enterprise Mobility.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;From a Middleware Perspective&lt;/strong&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Select a strategy where storage and compute resources of your Mobile apps can reside in Mobile devices, on-premises servers and Cloud computing infrastructure.&lt;/li&gt;    &lt;li&gt;Use a brokered service for connecting, communicating and brokering between Mobile apps, on-premise resources and Cloud/Middleware environment.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Custom implementation on top of brokers like Windows Azure Service Bus&lt;/li&gt;      &lt;li&gt;Build on a Mobile ready WOA stack like Marlabs Matrix platform&lt;/li&gt;      &lt;li&gt;Third party Mobile Middle ware platforms like Syclo etc&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Use Cloud based federated authentication services and security systems if you need support for multiple authentication providers – Like Azure Federated Authentication.&lt;/li&gt;    &lt;li&gt;Adopt cloud/service based push notification services for sending and receiving notifications from your Mobile devices.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;Choose a proper content delivery network that supports bit rate streaming to deliver video content. For example, Azure CDN or Limelight True Reach API.&lt;b&gt;&lt;/b&gt;&lt;/li&gt;    &lt;li&gt;Enable APIs for provisioning, tracking and feedback reporting.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;strong&gt;From a Middleware Perspective&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Submission governance includes deciding a proper strategy for payment model, usage tracking, analytics and feedback reporting. The Submission Governance should ensure&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Minimum criteria for submitting an application to the app store&lt;/li&gt;    &lt;li&gt;Users are heard properly – Feedbacks and ratings should be used for identifying features&lt;/li&gt;    &lt;li&gt;Releases and updates are following user expectations&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So, happy coding!!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=TxpP7HpiC2Y:ZTg1lu39RLQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=TxpP7HpiC2Y:ZTg1lu39RLQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=TxpP7HpiC2Y:ZTg1lu39RLQ:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/TxpP7HpiC2Y" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/TxpP7HpiC2Y/regarding-html5-vs-hybrid-vs-native.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-FjHvJRYeBvc/ULUGpKHqE0I/AAAAAAAABow/RiA1OkqwkqY/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/11/regarding-html5-vs-hybrid-vs-native.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-2540117265022586934</guid><pubDate>Sat, 24 Nov 2012 07:57:00 +0000</pubDate><atom:updated>2012-11-25T10:47:28.471+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">HTML5</category><category domain="http://www.blogger.com/atom/ns#">Back To Basics</category><category domain="http://www.blogger.com/atom/ns#">asp.net</category><title>Changing Times For Web Developers – 6 Tips You Should Read To Survive</title><description>&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-XQuKY_oe4Q8/ULB97_zFblI/AAAAAAAABoI/dwT34kRv1Vg/s1600-h/image%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-Y1MJZ2ANgYs/ULB99oZQ5lI/AAAAAAAABoQ/_dRdevnKG4A/image_thumb%25255B3%25255D.png?imgmax=800" width="240" height="147" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The context of this post is about the changing times for a web developer, and I see a lot of web developers still lagging behind especially in the .NET world.&amp;#160; If you haven't yet started mastering your art and adapting to the changing trends, you should start today. &lt;/p&gt;  &lt;p&gt;Think about crafting your web applications properly. Use commonsense to mix and match based on scenarios. Here we go with 6 Tips to be a responsible web developer, and to stay on top of what you do. &lt;/p&gt;  &lt;h3&gt;1 – Learn to write better JavaScript and CSS&lt;/h3&gt;  &lt;p&gt;If you don’t write proper JavaScript and CSS, you are dead. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=hQVTIJBZook"&gt;Learn the good parts about Javascript&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Venture into &lt;a href="http://www.youtube.com/watch?v=DwYPG6vreJg&amp;amp;feature=related"&gt;Advanced Javascript&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Familiarize yourself with a higher level abstraction language to write JavaScript once you are comfortable with plain Javascript – Like &lt;a href="http://coffeescript.org/"&gt;CoffeeScript&lt;/a&gt; or &lt;a href="http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html"&gt;TypeScript&lt;/a&gt;. Also, master the common Javascript libraries, including these essentials&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://jquery.com/"&gt;JQuery&lt;/a&gt; – Alright, you know this, don’t you? &lt;/li&gt;    &lt;li&gt;&lt;a href="http://requirejs.org/"&gt;Require.js&lt;/a&gt; - A JavaScript file and module loader. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://documentcloud.github.com/underscore/"&gt;Underscore .js&lt;/a&gt; – A pretty good Javascript utility library &lt;/li&gt;    &lt;li&gt;&lt;a title="http://modernizr.com/" href="http://modernizr.com/"&gt;modernizr&lt;/a&gt; – HTML5/CSS feature detector &lt;/li&gt;    &lt;li&gt;&lt;a href="https://github.com/balupton/History.js/"&gt;history.js&lt;/a&gt; – History State/APIs &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;More&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://coding.smashingmagazine.com/2012/09/23/useful-javascript-libraries-jquery-plugins-web-developers/"&gt;Useful Javascript Libraries and JQuery plugins&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.crockford.com/"&gt;Crockford’s Javascript Resources&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Oh yes, &lt;a href="http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html"&gt;start learning TypeScript&lt;/a&gt; especially if you have a Microsoft technology/C# background. &lt;/p&gt;  &lt;p&gt;On the CSS Side, familiarize with &lt;a href="http://sass-lang.com/"&gt;SASS&lt;/a&gt; and/or &lt;a href="http://lesscss.org/"&gt;Less&lt;/a&gt; –&amp;#160; Skim through the &lt;a href="http://www.webdesignerdepot.com/2011/01/50-awesome-css3-techniques-for-better-designs/"&gt;CSS 3 techniques&lt;/a&gt;, keep an eye on the &lt;a href="http://fmbip.com/litmus"&gt;CSS 3 features available in various browsers&lt;/a&gt;. Understand responsive concepts and start &lt;a href="http://www.w3.org/TR/css3-mediaqueries/"&gt;using media queries&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;2 – Familiarize yourself with a Responsive Framework&lt;/h3&gt;  &lt;p&gt;These days, the usage of web is increasing more and more in mobile devices, so most websites are expected to work in different form factors &lt;em&gt;by default&lt;/em&gt;. If you don’t want to hand craft all those web pages using media queries, better familiarize yourself with few responsive frameworks.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Responsive web design (often abbreviated to RWD) is an approach to web design in which a site is crafted to provide an optimal viewing experience—easy reading and navigation with a minimum of resizing, panning, and scrolling—across a wide range of devices (from desktop computer monitors to mobile phones)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="left"&gt;My personal choices include &lt;a href="http://twitter.github.com/bootstrap/"&gt;Twitter Bootstrap&lt;/a&gt; and &lt;a href="http://foundation.zurb.com/"&gt;Zurb’s Foundation&lt;/a&gt;. I’ve done quite a lot of work with Bootstrap, and I’m pretty impressed with the capabilities of foundation too.&amp;#160; &lt;/p&gt;  &lt;p align="left"&gt;Essential reads.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="left"&gt;&lt;a href="http://www.alistapart.com/articles/responsive-web-design/"&gt;Responsive Web Design by Ethan Marcotte&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="left"&gt;&lt;a href="http://responsive.vermilion.com/compare.php"&gt;Comparison of Responsive CSS Frameworks&lt;/a&gt;&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;3 – Learn the most useful JavaScript MVC frameworks&lt;/h3&gt;  &lt;p&gt;Be a first class JavaScript developer. There is a &lt;a href="http://coding.smashingmagazine.com/2012/07/27/journey-through-the-javascript-mvc-jungle/"&gt;jungle of Javascript MVC frameworks&lt;/a&gt; out there for client side development, but familiarize yourself with at least five (Yes, at least 5). I’ll pick some of these to start with.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://documentcloud.github.com/backbone"&gt;Backbone.js&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://angularjs.org/"&gt;AngularJS&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://spinejs.com/"&gt;Spine.js&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://knockoutjs.com/"&gt;KnockoutJS&lt;/a&gt; (MVVM) &lt;/li&gt;    &lt;li&gt;&lt;a href="http://emberjs.com/"&gt;Ember.js&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://yuilibrary.com/"&gt;YUI&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To compare and contrast them, have a look at &lt;a href="http://todomvc.com/"&gt;TodoMVC&lt;/a&gt; – I found it pretty useful. It is&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;A project which offers the same Todo application implemented using MV* concepts in most of the popular JavaScript MV* frameworks of today.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;4 – Understand REST and HTTP&lt;/h3&gt;  &lt;p&gt;Understand Restful services and master a server side technology to create one. For example, &lt;a href="http://www.amazedsaint.com/2011/09/creating-10-minute-todo-listing-app-on.html"&gt;Node Js&lt;/a&gt;. If you are in the .NET world, start with &lt;a href="http://www.amazedsaint.com/2012/05/self-hosting-aspnet-web-api-and.html"&gt;Web APIs&lt;/a&gt;.&amp;#160; More than that, understand proper REST. Understand Hypermedia. Go beyond the terms, and carve out some examples. Tie your REST services with one of the above MVC frameworks, and create something useful. Use proper HTTP codes for your services.&lt;/p&gt;  &lt;p&gt;Essential reads&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2011/08/woa-is-here-to-stay-and-why-new-wcf.html"&gt;WOA is here to stay&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://martinfowler.com/articles/richardsonMaturityModel.html"&gt;Richardson Maturity Model – Article from Martin Fowler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.amazon.com/REST-Practice-Hypermedia-Systems-Architecture/dp/0596805829"&gt;REST in Practice&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/gblock/archive/2011/05/09/hypermedia-and-forms.aspx"&gt;Hypermedia and Forms&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The above reads should help, to start with. Also, keep an eye on implementations, like Meteor, SignalR etc that could leverage &lt;a href="http://www.amazedsaint.com/2011/11/html5-is-in-killer-spree-may-kill-http.html"&gt;Web Sockets&lt;/a&gt; once they are ready.&lt;/p&gt;  &lt;h3&gt;5 – Understand HTML5 Beyond the Buzzword&lt;/h3&gt;  &lt;p&gt;HTML5 standard is not yet finalized and is still in progress, but already there is lot of adoption every where. Along with developing websites, there are lot of containers available (like PhoneGap etc) that’ll allow you to package your HTML5 applications with a browser like container for mobile devices (hybrid applications), to distribute them much like you distribute native applications.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;b&gt;HTML5&lt;/b&gt; is a &lt;a href="http://en.wikipedia.org/wiki/Markup_language"&gt;markup language&lt;/a&gt; for structuring and presenting content for the &lt;a href="http://en.wikipedia.org/wiki/World_Wide_Web"&gt;World Wide Web&lt;/a&gt; and a core technology of the &lt;a href="http://en.wikipedia.org/wiki/Internet"&gt;Internet&lt;/a&gt;. It is the fifth revision of the &lt;a href="http://en.wikipedia.org/wiki/HTML"&gt;HTML&lt;/a&gt; standard (created in 1990 and standardized as HTML4 as of 1997)&lt;sup&gt;&lt;a href="http://en.wikipedia.org/wiki/HTML5#cite_note-HTML5-20110405-2"&gt;[2]&lt;/a&gt;&lt;/sup&gt; and, as of November 2012, is still under development. Its core aims have been to improve the language with support for the latest multimedia while keeping it easily readable by humans and consistently understood by computers and devices (&lt;a href="http://en.wikipedia.org/wiki/Web_browser"&gt;web browsers&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Parsing"&gt;parsers&lt;/a&gt;, etc.).&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;There are lot of good articles about HTML5&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://net.tutsplus.com/tutorials/html-css-techniques/html-5-and-css-3-the-techniques-youll-soon-be-using/"&gt;Step by step article from Nettuts&lt;/a&gt; with examples &lt;/li&gt;    &lt;li&gt;&lt;a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/"&gt;This article in Smashing Magazine&lt;/a&gt; is a pretty good starting point to understand more about the design philosophy and thought processes involved &lt;/li&gt;    &lt;li&gt;&lt;a href="http://net.tutsplus.com/tutorials/html-css-techniques/25-html5-features-tips-and-techniques-you-must-know/"&gt;Top 25 HTML5 Features&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Familiarize yourself with the most useful and exciting HTML5 Javascript APIs and features. Like Web Sockets, Application Cache, Canvas API, Vide/Audio features etc. Start using something like HTML5 boiler plate as the baseline. &lt;a title="http://www.initializr.com/" href="http://www.initializr.com/"&gt;http://www.initializr.com/&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Understand the HTML 5 features and value adds you can use. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://html5demos.com/"&gt;Here are few quick demos of various HTML5 feautures&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Use something like &lt;a title="http://html5please.com/" href="http://html5please.com/"&gt;http://html5please.com/&lt;/a&gt; or&amp;#160; &lt;a href="http://caniuse.com/"&gt;CanIUse&lt;/a&gt;, keep yourself updated about the HTML5 features you can use to improve use cases based on requirements &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Also watch for the big players in the space who are leveraging HTML5 as a platform for building cross platform hybrid applications – not for web, but also for desktop and mobile.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://developer.chrome.com/apps/about_apps.html"&gt;Google Chrome Packaged Applications&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.mozilla.org/en-US/firefoxos/"&gt;Firefox OS&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;6 – Optimize&lt;/h3&gt;  &lt;p&gt;Optimize what ever you do, optimize when you are ready. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification"&gt;Bundle and minify your CSS and Javascript.&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Use some developer tools to inspect your page and check your JavaScript performance      &lt;ul&gt;       &lt;li&gt;&lt;a href="https://developers.google.com/web-toolkit/speedtracer/get-started"&gt;Google Chrome’s speed tracer&lt;/a&gt; &lt;/li&gt;        &lt;li&gt;&lt;a href="http://developer.yahoo.com/yslow/"&gt;YSlow&lt;/a&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Inspect your network traffic when required and this will come in handy every time– Familiarize with tools like &lt;a href="http://www.fiddler2.com/fiddler2/"&gt;Fiddler&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Use tools like &lt;a href="http://quirktools.com/screenfly/"&gt;Screenfly&lt;/a&gt; to check your screen for multiple form factors &lt;/li&gt;    &lt;li&gt;Use simulators like &lt;a href="https://chrome.google.com/webstore/detail/ripple-emulator-beta/geelfhphabnejjhdalkjhgipohgpdnoc"&gt;Ripple&lt;/a&gt; for checking the behavior of your websites in Mobile devices &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Alright, that was lot of tips. So, happy coding. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=6Hqq600g9D0:pAr7qLe3iNA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=6Hqq600g9D0:pAr7qLe3iNA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=6Hqq600g9D0:pAr7qLe3iNA:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/6Hqq600g9D0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/6Hqq600g9D0/changing-times-for-web-developers-6.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-Y1MJZ2ANgYs/ULB99oZQ5lI/AAAAAAAABoQ/_dRdevnKG4A/s72-c/image_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/11/changing-times-for-web-developers-6.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-5165316551043465551</guid><pubDate>Sat, 24 Nov 2012 05:40:00 +0000</pubDate><atom:updated>2012-11-24T11:14:06.498+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Meet Ms. Roslyn – Article in DNC Magazine</title><description>&lt;p&gt;I wrote a couple of articles here about Ms. Roslyn earlier.&amp;#160; Roslyn provides language services and APIs on top of .NET’s compiler services, and this will enable .NET developers to do a lot more things – including &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Using C# and VB.NET as scripting languages&lt;/li&gt;    &lt;li&gt;Use compiler as a service in your own applications for code related tasks&lt;/li&gt;    &lt;li&gt;Develop better language and IDE extensions etc.&lt;/li&gt;    &lt;li&gt;Write code analysis and manipulation tools around Visual Studio IDE&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;See my previous articles on Roslyn&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/09/roslyn-september-ctp-2012-overview-api.html"&gt;Roslyn September 2012 CTP Overview&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2012/07/bending-your-code-like-anders-with-c.html"&gt;Roslyn introduction – Bend your code with Roslyn&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So, I was more than happy to contribute when the Amazing Dotnet Curry Magazine team reached out to me for an article on Roslyn. Go, download and subscribe the DNC Magazine here. It is a free Magazine, and kudos to the great work from &lt;a href="http://www.dotnetcurry.com/About.aspx"&gt;Suprotim, Sumit and team&lt;/a&gt; for the awesome work they are doing for the community by bringing this out. &lt;a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue3.aspx"&gt;You can get the magazine issues for free here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.dotnetcurry.com/magazine/dnc-magazine-issue3.aspx"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-LbtFpuCSlB0/ULBdusHiGHI/AAAAAAAABn0/Gw3Xv7Jh1DI/image%25255B5%25255D.png?imgmax=800" width="660" height="430" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;    &lt;p&gt;Happy Coding!!&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=Z3caSLAsACw:lxxDetyG8bo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=Z3caSLAsACw:lxxDetyG8bo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=Z3caSLAsACw:lxxDetyG8bo:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/Z3caSLAsACw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/Z3caSLAsACw/meet-ms-roslyn-article-in-dnc-magazine.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-LbtFpuCSlB0/ULBdusHiGHI/AAAAAAAABn0/Gw3Xv7Jh1DI/s72-c/image%25255B5%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/11/meet-ms-roslyn-article-in-dnc-magazine.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-1978610835684291019</guid><pubDate>Thu, 25 Oct 2012 10:52:00 +0000</pubDate><atom:updated>2012-10-25T16:28:41.916+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">winrt</category><category domain="http://www.blogger.com/atom/ns#">windows8</category><title>Why I’m truly excited about Windows 8 – It is all about connecting the dots</title><description>&lt;p&gt;I think the true pitch of Microsoft is all about connecting the dots – Read a stable cloud platform, a plethora of PaaS offerings, A truly modern and fresh operating system that works seamlessly across multiple form factors, proper interfacing with existing devices like XBox – and all this working together.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-0_r-RtDvoBk/UIkappG3BsI/AAAAAAAABm4/osj4E4EZ5MQ/s1600-h/image%25255B9%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-YJDxrwC7yuU/UIkarGaZOBI/AAAAAAAABnA/Mh70mwHf_bk/image_thumb%25255B5%25255D.png?imgmax=800" width="756" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you are reading this before the Windows 8 launch event – You can &lt;a href="http://www.microsoft.com/en-us/news/presskits/windows/"&gt;watch it live&lt;/a&gt; here today (25th October 2012).&lt;/p&gt;  &lt;p&gt;Windows 8 versions include &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows 8 (Normal, Pro and Enterprise versions)&amp;#160; that runs on Intel and AMD processors&lt;/li&gt;    &lt;ul&gt;     &lt;ul&gt;       &lt;li&gt;This will be available with most of the PCs, Desktops and hybrids. This can run legacy Windows applications as well along with Metro applications. Has got both Metro and Desktop interfaces.&lt;/li&gt;     &lt;/ul&gt;   &lt;/ul&gt;    &lt;li&gt;Windows RT that runs on ARM chipsets&lt;/li&gt;    &lt;ul&gt;     &lt;ul&gt;       &lt;li&gt;This version is mainly for tablets, a stripped down version of Windows that can’t run legacy applications. Though this also has a desktop mode, the desktop mode will only support touch optimized Office 2013 apps.&lt;/li&gt;     &lt;/ul&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;As of now, Microsoft’s own Surface device is available with Windows RT, and a version with full Windows 8 will be available soon.&lt;/p&gt;  &lt;h3&gt;It is all about Connecting the dots&lt;/h3&gt;  &lt;p&gt;Make no mistake, today’s Windows 8 release is something that I’m truly excited about. But I’m more excited about the way Microsoft played all these strings together to create a symphony with all their different technologies, to create a connected and co-syncing user experience across devices and platforms - and I think they got it right this time. Along with this, add all the back end and front end platforms (and integrating points) they have for developers to create truly magnificent applications for both enterprise and consumer markets. &lt;/p&gt;  &lt;p&gt;This enables a lot of possibilities. Like using my Windows 8/Win RT tablet or phone as a remote control. Like using your television as a second screen for your Tablet. Like chatting about a movie with your friends when you watch it. &lt;/p&gt;  &lt;p&gt;See this Smart Glass Video&lt;/p&gt; &lt;iframe height="360" src="http://www.youtube.com/embed/NBGkSuaqWEE" frameborder="0" width="640" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt;  &lt;p&gt;This wave of releases from Microsoft will connect all your screens together – PCs, TVs (X Box),&amp;#160; Tablets, and Phone (Yea I know, it might take few months for Windows Phone to reach there eventually to provide full Win RT support). &lt;/p&gt;  &lt;p&gt;Few key un seen ingredients people miss when they talk about the pitch from Microsoft include &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A properly baked cloud ecosystem with enough PaaS and SaaS offerings in the backend to co-sync user experiences for both enterprise and consumer market (Azure, Office 365, Sky drive etc) &lt;/li&gt;    &lt;li&gt;Proper interfacing of Windows 8 with devices like X Box to provide seamless user experience (Smart Glass) &lt;/li&gt;    &lt;li&gt;Easy integration and up gradation for enterprise customers &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;A number of devices to choose from&lt;/h3&gt;  &lt;p&gt;It was a good move from Microsoft to raise the bar with it’s own Surface tablet. Windows 8 enables lot of hardware manufacturers to experiment with new generation hybrid devices, and I believe this &lt;a href="http://windows.microsoft.com/en-US/windows/all-pcs"&gt;new set of Windows 8 PC/Tablet/Laptop convertibles&lt;/a&gt; are awesome, and provides a lot of options when you want to pick your Windows 8 or Win RT device. You are not just locked in to Microsoft’s own Surface tablet (Though I may buy one) and it’s form factor.&lt;/p&gt;  &lt;p&gt;You have a lot of form factors to choose from, based on what you need. For example, see this 20 inch marvel from Sony.&lt;/p&gt; &lt;iframe height="360" src="http://www.youtube.com/embed/TW7-hWiOXOo" frameborder="0" width="640" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt;  &lt;h3&gt;The productivity factor&lt;/h3&gt;  &lt;p&gt;I always struggled with my iPad to do serious stuff – When I want to create good presentations, edit documents, and check and reply to my mails. Windows 8/Win RT along with Microsoft Outlook and Office Suite should take my worries away. &lt;/p&gt;  &lt;p&gt;The app ecosystem as of now is not as large as what iOS is having – for good and bad. As a developer, I think it is good because my applications will get noticed soon in the Windows market place. As an end user, may be having lot of apps is a good thing – though I’m more interested in quality rather than quantity anyway. &lt;/p&gt;  &lt;p&gt;The enterprise features finally will enable a controlled BYOD strategy for enterprises to bank on – so far they were ducking away from the Android and iPad tablets due to the lack of seamless integration with existing IT infrastructure. So I can see my enterprise customers caching in on Windows 8 devices for productivity boost.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=qK0LYD_O6jc:qUT9xwmfRrU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=qK0LYD_O6jc:qUT9xwmfRrU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=qK0LYD_O6jc:qUT9xwmfRrU:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/qK0LYD_O6jc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/qK0LYD_O6jc/why-im-truly-excited-about-windows-8-it.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-YJDxrwC7yuU/UIkarGaZOBI/AAAAAAAABnA/Mh70mwHf_bk/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/10/why-im-truly-excited-about-windows-8-it.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-2799920817827429431</guid><pubDate>Fri, 05 Oct 2012 17:46:00 +0000</pubDate><atom:updated>2012-10-05T23:36:41.240+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">HTML5</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">TypeScript</category><title>Type Script Language Features – Classes, Inheritance &amp; Overriding</title><description>&lt;p&gt;Type Script brings a lot more structure and object oriented goodness to JavaScript, thought under the hood it is just a Syntax sugar for JavaScript. This article uncovers some basic Object Oriented Programming concepts introduced by Type Script, that will wrap the ‘bad parts’ of JavaScript under the carpet so that you can write better code. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-2lHmwr5G4bE/UG8c56rMOKI/AAAAAAAABmY/VBNwxAcSb-o/s1600-h/image%25255B7%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-ex7ckIsrqNQ/UG8c7f6u7KI/AAAAAAAABmg/47715VtIiyw/image_thumb%25255B3%25255D.png?imgmax=800" width="240" height="213" /&gt;&lt;/a&gt;I suggest you read my post “&lt;a href="http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html"&gt;An Introduction To Type Script&lt;/a&gt;” before you read this article.&lt;/p&gt;  &lt;p&gt;In this post, Let us explore few features about Classes, Inheritance and Method Overriding in TypeScript. &lt;/p&gt;  &lt;h3&gt;Classes in Type Script&lt;/h3&gt;  &lt;p&gt;Classes in TypeScript closely resembles the ECMA proposal according the the language specification. Classes can have &lt;em&gt;private&lt;/em&gt; or &lt;em&gt;public&lt;/em&gt; members. &lt;/p&gt;  &lt;p&gt;Let us start with a very minimal Animal Class in Type Script.&amp;#160; Our Animal class also got a parameterized constructor, that takes name as an input to store it in the 'name' variable of type string, when the instance gets created. &lt;/p&gt;  &lt;pre class="c#" name="code"&gt;//Our Animal Class
class Animal {

    //Name 
    public name: string;

    //Animal Constructor
    constructor (name: string) {
        this.name = name;
    }

    //A Method, the scope is public by default. ‘this’ points to the class instance
    sayName() {
     
         var span = document.createElement(&amp;quot;span&amp;quot;);
         span.innerText =&amp;quot;My Name Is&amp;quot; + this.name;
         document.body.appendChild(span);
    }

}

//Let us do something in onload
window.onload = () =&amp;gt;
{
   //Create an instance of Animal
    var a = new Animal(&amp;quot;Tommy&amp;quot;);
	
   //Invoke the method	
    a.sayName();
}&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;You should see the message from the sayName method, &amp;quot;My name is Tommy&amp;quot;. &lt;/p&gt;

&lt;h3&gt;Parameter property declaration&lt;/h3&gt;

&lt;p&gt;In the above example, you could find that we are accepting the ‘name’ parameter via a constructor, and then assigning that to a property with name ‘name’. TypeScript has a short cut notation to declare properties with the same name and value as the constructor parameter. For this, you can prefix a constructor parameter with either ‘private’ or ‘public’, so that a property will be declared for you. The below code is functionally equivalent to the above code, see that we are not declaring the property explicitly though it is getting created for us.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;//Our Animal Class
class Animal {

    //Animal Constructor. Note that I’m having a 
    //public specifier to the parameter
    constructor (public name: string) {
        //Look ma, I'm not explicitly declaring
        //or assigning to a name
    }

	//A Method, the scope is public by default
    sayName() {
        //The name property is created for you, so you can
        //access this.name
         var span = document.createElement(&amp;quot;span&amp;quot;);
         span.innerText =&amp;quot;My Name Is&amp;quot; + this.name;
         document.body.appendChild(span);
    }
}

//Let us do something in onload
window.onload = () =&amp;gt;
{
	//Create an instance of Animal
    var a = new Animal(&amp;quot;Tommy&amp;quot;);
	
	//Invoke the method	
    a.sayName();
}&lt;/pre&gt;

&lt;p&gt;Run this now, and you should get the same output as the previous one. That was interesting, right?&lt;/p&gt;

&lt;h3&gt;Inheritance &amp;amp; Overriding&lt;/h3&gt;

&lt;p&gt;Now, let us quickly explore some inheritance concepts in Type Script. Consider a simple example where you are inheriting a Dog class from the Animal class. You can use the 'extends' key word to extend from a base class. You can also override methods. A derived class will inherit all public members from it’s base class. &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;//Our Animal Class
class Animal {

	//Animal Constructor
    constructor (public name: string) {
    }

	//A Method, the scope is public by default
    sayName() {
         var span = document.createElement(&amp;quot;span&amp;quot;);
         span.innerText =&amp;quot;My Name Is&amp;quot; + this.name;
         document.body.appendChild(span);
    }
}


//Let us inherit Dog from Animal
class Dog extends Animal {

    //Override sayName method with some other logic, as usually dogs bark before 
    //saying their name ;)
    sayName() {
         var span = document.createElement(&amp;quot;span&amp;quot;);
         span.innerText =&amp;quot;Bow Bow, My Name Is&amp;quot; + this.name;
         document.body.appendChild(span);
     }
}

//Let us do something in onload
window.onload = () =&amp;gt;
{
   //Create an instance of Dog and store in an Animal variable
    var a: Animal = new Dog(&amp;quot;Tommy&amp;quot;);
   //Invoke the method, this will invoke sayName() in Dog class	
    a.sayName();
}&lt;/pre&gt;

&lt;p&gt;Now, a.sayName() will invoke the sayName(..) method in Dog class.&amp;#160; Now, how will you down cast an instance of Dog from variable a of type ‘Animal’ back to a variable of type Dog? &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;//Create an instance of Dog and store in an Animal variable
var a: Animal = new Dog(&amp;quot;Tommy&amp;quot;);

//This will result in an error as what ever you stored in a can be a some other type
//inherited from Animal instead of dog.
var d: Dog = a;&lt;/pre&gt;

&lt;br /&gt;This is how to downcast properly, checkout the &amp;lt;type&amp;gt; syntax 

&lt;pre class="c#" name="code"&gt;   
//Create an instance of Dog and store in an Animal variable
var a: Animal = new Dog(&amp;quot;Tommy&amp;quot;);
//Downcasting by ensuring a proper type
var d: Dog = &amp;lt;Dog&amp;gt; a;&amp;#160; &lt;/pre&gt;

&lt;h3&gt;‘super’ Keyword&lt;/h3&gt;
You can use the super keyword in the constructor of a derived class, to pass the parameters to the base class constructor. Super calls for passing parameters are not allowed outside the constructor in TypeScript, though you can use super keyword to invoke methods of the base class from the derived class. Here is a quick example. See that we are passing the name to the base class constructor from the derived class constructor. Also note that we are using parameter property declaration to declare properties with the same name and value as constructor parameters, as explained above. 

&lt;pre class="c#" name="code"&gt;//Our Animal Class
class Animal {
	//Animal Constructor
    constructor (public name: string) {
    }
}

class Dog extends Animal {
      //Dog Constructor

      //We are leveraging parameter property declaration
      //to automatically create name and age properties
      constructor (public name: string, public age:number)
      {
        //Note that we are passing name to the 
        //base class constructor to initialize
        super(name);
      }

    sayHello() {
         var span = document.createElement(&amp;quot;span&amp;quot;);
         span.innerText = &amp;quot;Hello, I'm &amp;quot; + this.name + &amp;quot; with age &amp;quot; + this.age;
         document.body.appendChild(span);
     }
}

//Let us do something in onload
window.onload = () =&amp;gt;
{
  
    //Create an instance of Dog 
    var d: Dog = new Dog(&amp;quot;Jim&amp;quot;,20);    
    //Make the dog say hello
    d.sayHello();
   
}&lt;/pre&gt;

&lt;p&gt;
  &lt;br /&gt;Other than using Super for passing constructor parameters to base class, you may also use super for invoking methods in base class - like super.methodName() from methods in your derived class. I intentionally missed covering few other interesting aspects including Modules, Interfaces, Function Overloading, Function types etc - that is for another post. &lt;/p&gt;

&lt;p&gt;Stay tuned, and subscribe now.&lt;/p&gt;

&lt;div class="widget-content"&gt;
&lt;a href="http://feeds.feedburner.com/amazedsaint/articles"&gt;&lt;img src="http://feeds.feedburner.com/~fc/amazedsaint/articles?bg=99CCFF&amp;amp;fg=444444&amp;amp;anim=0" height="26" width="88" style="border:0" alt=""&gt;&lt;/a&gt; &amp;nbsp; &lt;a href="http://www.feedblitz.com/f/?Sub=177555"&gt;
&lt;img border="0" src="http://assets.feedblitz.com/chicklets/email/i/fe/177555.bmp" title="Subscribe to get updates by email, IM and more!"&gt;&lt;/a&gt;
&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=f2wxr0CqQx0:8XidY36jqS8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=f2wxr0CqQx0:8XidY36jqS8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=f2wxr0CqQx0:8XidY36jqS8:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/f2wxr0CqQx0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/f2wxr0CqQx0/type-script-language-features-classes.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-ex7ckIsrqNQ/UG8c7f6u7KI/AAAAAAAABmg/47715VtIiyw/s72-c/image_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/10/type-script-language-features-classes.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-3224978701710879897</guid><pubDate>Mon, 01 Oct 2012 18:39:00 +0000</pubDate><atom:updated>2012-10-05T23:18:46.840+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">.NET 4.0</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><category domain="http://www.blogger.com/atom/ns#">TypeScript</category><title>Microsoft TypeScript : A quick introduction and A Love Affair Begins here.</title><description>&lt;p&gt;Alright, I knew this was coming. At least, I inferred. When I went to Microsoft few months back to attend the MVP summit, we had an awesome session from Anders, and I asked him what is the future of C#. He muttered something like “JavaScript is the true cross platform language” (Did I hear that right?)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-8KIyO8p__zQ/UGnkVn0ulPI/AAAAAAAABl4/0CNpZyEZaUU/s1600-h/image%25255B24%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-1jia_TGU53w/UGnkXOJ52KI/AAAAAAAABmA/wAvAuamtoH4/image_thumb%25255B14%25255D.png?imgmax=800" width="240" height="210" /&gt;&lt;/a&gt;And there &lt;a href="https://twitter.com/amazedsaint/statuses/247236626449825792"&gt;was some speculation&lt;/a&gt; that Anders was working on something related to JavaScript. And now, &lt;a href="http://www.typescriptlang.org"&gt;Typescript&lt;/a&gt; is here. TypeScript is a neat little language that compiles in to JavaScript, and the compiled output is readable and pretty printed it seems, so that you can use the compiled JavaScript directly where ever you want. I played around with Typescript, and it looks pretty neat (Yea, I’m repeating the term ‘neat’). The syntax has some magical similarity to the aesthetics of C# (or that was my feeling?). I’ve seen few people wondering whether TypeScript is Microsoft’s version of Dart or whether it is some kind of Coffee Script on Steroids – but after trying TypeScript out for sometime, I’m in love with Typescript. I was making some notes, and combined them for this blog post.&lt;/p&gt;  &lt;p&gt;You can &lt;a href="http://www.typescriptlang.org"&gt;install Typescript from here&lt;/a&gt; , and then in Visual Studio, try creating an HTML application with Typescript. (OSS Fans Cheer up, &lt;a href="http://blogs.msdn.com/b/interoperability/archive/2012/10/01/sublime-text-vi-emacs-typescript-enabled.aspx"&gt;Support for VI, Sublime and Emacs is also available&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-5nge5p48yUQ/UGnjN0IuBNI/AAAAAAAABlI/c23Xm0F6Lec/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-iXqu0OGs5WY/UGnjRmbEyBI/AAAAAAAABlQ/zc50dAHIf4E/image_thumb%25255B2%25255D.png?imgmax=800" width="640" height="390" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;A Quick Hello World in TypeScript&lt;/h2&gt;  &lt;p&gt;Here is a quick hello world script I wrote using Typescript.&amp;#160; You can see the type script file (app.ts), and the generated app.js file.&amp;#160; As I mentioned, the syntax is very much similar to C#. And the big surprise – as the name indicates, &lt;em&gt;Type&lt;/em&gt;Script supports ‘Types’.&amp;#160; See my HelloWorld class below, I’m having a constructor which takes an HTMLElement, and I’ve got a sayHello method that accepts a message of type string. I feel having these type contracts will be a big boon because that’ll help programmers to specify expected types for a function.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-II5u-37UXA4/UGnjWz1sutI/AAAAAAAABlY/UfhW5wupa7M/s1600-h/image%25255B13%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-B2iCCZHMnCw/UGnjadqwiZI/AAAAAAAABlg/80bY6BSXPwA/image_thumb%25255B7%25255D.png?imgmax=800" width="640" height="450" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here is the Typescript code, and generated Javascript code. While working in Visual Studio, I’ve noticed that Visual Studio Typescript editor provides type inference, that’s cool. See my HelloWorld class – pretty self explanatory.&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;//Our TypeScript HelloWorld class

class HelloWorld {
    
    //A variable of type HTMLElement
    element: HTMLElement;

    //A Consctructor that accepts an element
    constructor (e: HTMLElement) { 
        this.element = e;
    }

    //A public method
    sayHello(message: string) {
        this.element.innerHTML = message;
    }

}

window.onload = () =&amp;gt; {
    var e = document.getElementById('content');

    //Initiate HelloWorld Class
    var hello = new HelloWorld(e);
    hello.sayHello(&amp;quot;Hello World&amp;quot;);
};&lt;/pre&gt;
Awesome. Now, here is the generated Javascript code, that's equivalent to the above Typescript code. Neat and clean generation.&amp;#160;&amp;#160; &lt;pre class="js" name="code"&gt;var HelloWorld = (function () {
    function HelloWorld(e) {
        this.element = e;
    }
    HelloWorld.prototype.sayHello = function (message) {
        this.element.innerHTML = message;
    };
    return HelloWorld;
})();
window.onload = function () {
    var e = document.getElementById('content');
    var hello = new HelloWorld(e);
    hello.sayHello(&amp;quot;Hello World&amp;quot;);
};&lt;/pre&gt;

&lt;p&gt;You can even use scope keywords in your TypeScript class - try making the &lt;em&gt;element&lt;/em&gt; variable &lt;em&gt;private&lt;/em&gt;, and &lt;em&gt;sayHello&lt;/em&gt; method &lt;em&gt;public&lt;/em&gt;. I also skimmed through the Type Script specification, and here are few other interested points I noticed apart from the Types support.&amp;#160; &lt;/p&gt;

&lt;h2&gt;Function Types&lt;/h2&gt;

&lt;p&gt;Typescript uses Function Types for handling call backs. Let us modify the above code, to have a call back. See that I've added a notify parameter to our sayHello method of type&lt;/p&gt;

&lt;p&gt;&lt;font face="Courier New"&gt;(feedback : string)=&amp;gt;any&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;This simply represents a function which takes a an input parameter of type string, and returns ‘any’ back to the caller (See ‘any’ type below). Upon the completion of sayHello, we are calling the notify(..) back, which will invoke the function(..) we passed to sayHello from window.onload – This is almost like passing a Function over a delegate type and invoking it back in the C# sense.. &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;//Our TypeScript class now with Callbacks

class HelloWorld {
    
    //A variable of type HTMLElement
    element: HTMLElement;

    //A Consctructor that accepts an element
    constructor (e: HTMLElement) { 
        this.element = e;
    }

    //A public method. See notify paramter is now taking a Function Type
    sayHello(message: string, notify: (feedback : string)=&amp;gt;any ) {
        alert(message);
        //Do some other complex stuff here
        notify(&amp;quot;completed sayHello&amp;quot;);
    }

}

window.onload = () =&amp;gt; {
    var e = document.getElementById('content');

    //Initiate HelloWorld Class
    var hello = new HelloWorld(e);
    hello.sayHello(&amp;quot;Hello World&amp;quot;, function (feedback) {
            alert(feedback);
        }
    );
};&lt;/pre&gt;

&lt;p&gt;Run the project, fire up the HTML page, and you’ll see the first message box with “hello world”, and second message box with “completed sayHello” message. Pretty cool. We just learned how to write type safe call backs in TypeScript, elegantly, with out worrying about closures&lt;/p&gt;

&lt;h2&gt;Object Types&lt;/h2&gt;

&lt;p&gt;An Object type looks like { parameter1: type1, parameter2: type2, … }. Example is &lt;/p&gt;

&lt;pre&gt;{name: string, age: number}&lt;/pre&gt;
You can give a name to an object type, like this. 

&lt;pre&gt; interface Human 
   {
    name: string, 
    age: number
   }&lt;/pre&gt;

&lt;p&gt;Once you define an interface, you can use it as a contract, for specifying input, for return types, for call backs etc, with full Intellisense support. See below.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-QyM-34KNFv0/UGnjb7EH2TI/AAAAAAAABlk/uSF2R7KRWvM/s1600-h/image%25255B18%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-AMlFuFt3wd0/UGnjc-pVVkI/AAAAAAAABlw/TCIBNOwEQf8/image_thumb%25255B10%25255D.png?imgmax=800" width="540" height="250" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;A Bit more about Types in Typescript&lt;/h2&gt;

&lt;p&gt;TypeScript has multiple types. Here is a quick overview&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;‘any’ type &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;“Any Type is a super set of all types” &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Example: 
    &lt;ul&gt;
      &lt;li&gt;var x : any; &lt;em&gt;//x is explicitly typed to any&lt;/em&gt; &lt;/li&gt;

      &lt;li&gt;var y; &lt;em&gt;//type of y is any by default as no other type is specified&lt;/em&gt; &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Primitive Types &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;TypeScript supports number, bool, string, null and undefined &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Example 
    &lt;ul&gt;
      &lt;li&gt;Number 
        &lt;ul&gt;
          &lt;li&gt;var num : number; &lt;/li&gt;

          &lt;li&gt;var num = 20; &lt;em&gt;//number type will be automatically inferred for num variable, same as var num : number = 20&lt;/em&gt; &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;String 
        &lt;ul&gt;
          &lt;li&gt;var name : string; &lt;/li&gt;

          &lt;li&gt;var message=”hello”; &lt;em&gt;//string type will be automatically inferred for message variable&lt;/em&gt; &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;

      &lt;li&gt;Bool 
        &lt;ul&gt;
          &lt;li&gt;var isOpen : bool; &lt;/li&gt;

          &lt;li&gt;var isEnabled=true; &lt;em&gt;//bool type will be automatically inferred for isEnabled variable&lt;/em&gt; &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;‘void’ type &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Used as the return type of functions that don’t return any value &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object Types &lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This include class, interface, module and literal types. These Object types contain one or more &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Properties &lt;/li&gt;

  &lt;li&gt;Call signatures (Parameters and return types associated with a call operation) &lt;/li&gt;

  &lt;li&gt;Construct signatures (Parameters and return types associated with applying the ‘new’ operator) &lt;/li&gt;

  &lt;li&gt;Index signatures &lt;/li&gt;

  &lt;li&gt;Brands (Brands are categories the given object type belongs to) &lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
  &lt;ul&gt;
    &lt;li&gt;More about this later. Examples 
      &lt;ul&gt;
        &lt;li&gt;Object obj = {name : “Vinod”, age: 30 }; &lt;/li&gt;

        &lt;li&gt;Function square = (x: number)=&amp;gt; x * x; //Almost like the lambda syntax in C# &lt;/li&gt;
      &lt;/ul&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Overall, I found that there is a strange attraction factor that connects C# developers with Type Script. I was able to start with out much hassle, and was able to grasp the basics in a couple of hours. Of course, introducing types &lt;em&gt;( CLARIFIED: i.e, types for enabling well defined contracts for functions, input parameters, return types etc)&lt;/em&gt; on a meta level and still maintaining the dynamic feature of JavaScript is a big thing as this means better refactoring, easier maintainability and better documentation. Enjoy TypeScript, I’m pretty sure I’ll write more about this pretty soon. I’m in love with Typescript. &lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Checkout the second part, &lt;a href="http://www.amazedsaint.com/2012/10/type-script-language-features-classes.html"&gt;Type Script Language Features – Classes, Inheritance and Overriding&lt;/a&gt; &amp;gt;&amp;gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=mIB-tOGSLhU:Mgm05tU0C0E:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=mIB-tOGSLhU:Mgm05tU0C0E:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=mIB-tOGSLhU:Mgm05tU0C0E:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/mIB-tOGSLhU" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/mIB-tOGSLhU/microsoft-typescript-and-quick.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-1jia_TGU53w/UGnkXOJ52KI/AAAAAAAABmA/wAvAuamtoH4/s72-c/image_thumb%25255B14%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/10/microsoft-typescript-and-quick.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-3774986920215889269</guid><pubDate>Sat, 29 Sep 2012 15:44:00 +0000</pubDate><atom:updated>2012-09-29T23:59:41.339+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">JQuery</category><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">HTML5</category><title>Introducing SignalWire – Magical Plumbing with your Data Store + C# and LINQ in your HTML pages</title><description>&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-NcSalGzkWEc/UGcXUTaxYDI/AAAAAAAABlA/DPH5mqt8yDo/s1600-h/image%25255B6%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh6.ggpht.com/-C4YpqPEZzjo/UGcXYVj5BGI/AAAAAAAABlE/IDyDjssI-EA/image_thumb%25255B4%25255D.png?imgmax=800" width="128" height="128" /&gt;&lt;/a&gt;SignalWire is an experimental Server&amp;lt;-&amp;gt;Client plumbing project I started, that magically wires up your HTML5 front end to the collections/tables in your data store or ORM, and I just pushed the &lt;a href="https://github.com/amazedsaint/SignalWire"&gt;first commit to Github&lt;/a&gt;. SignalWire uses SignalR and Roslyn libraries to implement features like&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Exposing collections in your Back end directly over the wire for CRUD operations and for performing LINQ queries from your JavaScript. &lt;/li&gt;    &lt;li&gt;Enable using C# in your HTML applications. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I got inspired by &lt;a href="http://www.amazedsaint.com/2012/08/up-and-running-with-meteor-in-linux-vm.html"&gt;Meteor&lt;/a&gt; and started SignalWire as a POC to implement some of these features on the .NET stack, but I’ve got few more ideas on the way and thought about pushing this to Github.&amp;#160; &lt;a href="https://github.com/amazedsaint/SignalWire"&gt;See the codebase in Github&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Check out this quick video (no sound, sorry), a simple Taskboard built using SignalWire. See how we are accessing the collections in Javascript, and check how we are issuing LINQ queries&lt;/p&gt; &lt;iframe height="480" src="http://www.youtube.com/embed/FCeYfikkHmQ" frameborder="0" width="640" allowfullscreen="allowfullscreen"&gt;&lt;/iframe&gt;  &lt;p&gt;As of now, support is available for EntityFramework and MongoDb as the back end. Also, it provides&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A light weight permission framework (wip) &lt;/li&gt;    &lt;li&gt;A Client side Javascript API to access your collections with minimal/no serverside code &lt;/li&gt;    &lt;li&gt;Model Validation support using normal C#/ASP.NET Data Validation attributes &lt;/li&gt;    &lt;li&gt;LINQ support to issue Linq queires from HTML pages (highly experimental, as of now no sandboxing support per caller) &lt;/li&gt;    &lt;li&gt;C# code in your HTML pages (wip) &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;How To Start&lt;/h2&gt;  &lt;p&gt;You may start with Creating an Empty ASP.NET Project in Visual Studio 2012 (You need .NET 4.5 as we are using Roslyn September CTP libraries). Then, install SignalWire using Nuget. In Package Manager console&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;&lt;font color="#333333"&gt;Install-Package SignalWire&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This will add the following components to your project.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Models\TaskDb.cs - An example Entity Framework Data Context. You can use your instead &lt;/li&gt;    &lt;li&gt;Hubs\DataHub.cs - An example Datahub. &lt;/li&gt;    &lt;li&gt;Scripts\SignalWire.js - Clientside JQuery Pluin for SignalR. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Now, goto Index.html, and verify all your JS file versions are correct. Run the application and see&lt;/p&gt;  &lt;h2&gt;Server – Data Context and Hub&lt;/h2&gt;  &lt;p&gt;The Only server side code you need is your POCO objects and a hub inherited from the DataHub base class, which is defined in the SignalWire library. You need to use the Collections attribute to map a POCO class with the set/collection, and make sure you always do that in lower case.&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;   //Simple POCO class to represent a task
    [Collection(&amp;quot;tasks&amp;quot;)]
    public class Task
    {
        [Required]
        public int Id { get; set; }

        [Required]
        [MaxLength(100, ErrorMessage = &amp;quot;Subject cannot be longer than 40 characters.&amp;quot;)]
        public string Subject { get; set; }

        [Required]
        [MaxLength(200, ErrorMessage = &amp;quot;Details cannot be longer than 40 characters.&amp;quot;)]
        public string Details { get; set; }

        public bool Completed { get; set; }
    }


   //Simple demo db context   
    public class TaskDb : DbContext
    {
        public DbSet&amp;lt;Task&amp;gt; Tasks { get; set; }
    }&lt;/pre&gt;

&lt;p&gt;Now, you need a hub. By convention, Wire assume’s the server hub’s name as Data if it is not specified in the init method of $.wire.init(..). In the example you get when you install the Nuget package, you’ll see we are using an Entity Framework Context Provider, for TaskDb which is a DataContext. Replace TaskDb with your own EF Data context if required. Once you do that, all your collections/sets with in the context can be accessed over the wire. In the example, you’ve only on set in your TaskDb data context as you can see above - that is Tasks. Let us create the Hub.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;public class Data : DataHub&amp;lt;EFContextProvider&amp;lt;TaskDb&amp;gt;&amp;gt; &lt;/pre&gt;

&lt;p&gt;That's all you need to access collections via the Wire.&lt;/p&gt;

&lt;blockquote&gt;&lt;/blockquote&gt;

&lt;h2&gt;Client - Initializing and Issuing Queries&lt;/h2&gt;

&lt;p&gt;SignalWire magically exposes all your Tables/Sets/Collections in your Data back end via the $.wire Javascript object at client side. You can initialize $.wire using the init() method, which returns a JQuery Deferred. Here is a quick example regarding initializing Wire and issuing a LINQ query.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;     //Initialize wire
     $.wire.init().done(function () {

      //Now you can access the tasks collection in your data context
      //You can issue a LINQ Query.
      $.wire.tasks.query(&amp;quot;from Task t in Tasks select t&amp;quot;)
               .done(function (result) {
                    $.each(result, function (index, task) {
                       //Do something with each task
                    });
                }).fail(function (result) {
                    alert(JSON.stringify(result.Error));
                });
         });&lt;/pre&gt;

&lt;h2&gt;Other Wire Methods&lt;/h2&gt;

&lt;p&gt;You can use $.wire.yourcollection.add(..) to add objects to a specific collection. The add method will return the added item with updated Id up on completion.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;    var t = {
        &amp;quot;subject&amp;quot;: $(&amp;quot;#subject&amp;quot;).val(),
        &amp;quot;details&amp;quot;: $(&amp;quot;#details&amp;quot;).val(),
    };


    //Add a task to the Tasks collection                    
    $.wire.tasks.add(t)
       .done(function (task) {
          //Note that you'll get the auto generated Id
       }).fail(function (result) {
            //result.Error contains the error if any                        
            //result.ValidationResults contains the Validation results if any 
            alert(JSON.stringify(result.Error)); 
       });&lt;/pre&gt;

&lt;p&gt;Similarly, you can use&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;$.wire.yourcollection.remove(item) to remove items &lt;/li&gt;

  &lt;li&gt;$.wire.yourcollection.update(item) to update an item (based on Id match). &lt;/li&gt;

  &lt;li&gt;$.wire.yourcollection.read({&amp;quot;query&amp;quot;:&amp;quot;expression&amp;quot;, &amp;quot;skip&amp;quot;:&amp;quot;xxx&amp;quot;, &amp;quot;take&amp;quot;:&amp;quot;xxx&amp;quot;}) to read from a specific collection &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Permissions&lt;/h2&gt;

&lt;p&gt;You can decorate your Model classes with Custom permission attributes that implements IPermission. This will check if the user in the current context can actually perform a specific operation on a Model entity.&lt;/p&gt;

&lt;h2&gt;What's More&lt;/h2&gt;

&lt;p&gt;I'm planning the following features based on my time&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Sandboxed execution for C# scripts in HTML page that can access client side context &lt;/li&gt;

  &lt;li&gt;Publishing and data sync &lt;/li&gt;

  &lt;li&gt;Permission based events, may be using something like PushQA. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/amazedsaint/SignalWire"&gt;&lt;strong&gt;Fork on Github&lt;/strong&gt;&lt;/a&gt; to play around&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=SKAjyHUfRCE:Azw0LP4Cv4c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=SKAjyHUfRCE:Azw0LP4Cv4c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=SKAjyHUfRCE:Azw0LP4Cv4c:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/SKAjyHUfRCE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/SKAjyHUfRCE/signalwire-magical-plumbing-with-your.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-C4YpqPEZzjo/UGcXYVj5BGI/AAAAAAAABlE/IDyDjssI-EA/s72-c/image_thumb%25255B4%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/09/signalwire-magical-plumbing-with-your.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-4607200196641620216</guid><pubDate>Wed, 19 Sep 2012 10:00:00 +0000</pubDate><atom:updated>2012-09-19T15:49:10.015+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Software Development</category><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Roslyn September CTP 2012 Overview – API Changes, Using Modified APIs for C# Script Execution, Embedding C# as a scripting language</title><description>&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-lUq9fLlwsrM/UFmZeJmm83I/AAAAAAAABkA/7bh7UutVwzI/s1600-h/image%25255B18%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/-Elf-mQXPGd0/UFmZf9IKdOI/AAAAAAAABkI/5g_TJfKcTL8/image_thumb%25255B9%25255D.png?imgmax=800" width="240" height="240" /&gt;&lt;/a&gt;Microsoft Roslyn September CTP 2012 is now released. You can &lt;a href="http://msdn.microsoft.com/en-US/roslyn"&gt;download the September CTP here&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;You could find a quick overview about Roslyn in my previous &lt;a href="http://www.amazedsaint.com/2011/10/c-vnext-roslynan-introduction-and-quick.html"&gt;overview post&lt;/a&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Roslyn CTP previews the upcoming features of C# and VB.NET. Roslyn CTP is a pretty exciting release, and it opens up lot of possibilities for C# and VB.NET programmers. Roslyn provides language services and APIs on top of .NET’s compiler services, and this will enable .NET developers to do a lot more things – including using C# and VB.NET as scripting languages, use compiler as a service in your own applications for code related tasks, develop better language and IDE extensions etc.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;What’s Exciting In September CTP (CTP3) release&lt;/h2&gt;  &lt;p&gt;One of the biggest excitement for me is the support for Expression Trees. This means, now you can include LINQ Queries in your script, and you can dynamically execute LINQ queries. This has lot of interesting aspects, and this is huge. For example, see how I’m executing a very simple Linq query from the C# interactive console.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-Ncog41aCK_0/UFmXrq19ebI/AAAAAAAABjY/TSEWXhUSL28/s1600-h/image%25255B6%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-ZT_BZuLaFtU/UFmXs1VcsmI/AAAAAAAABjg/zJWTMYyNEj4/image_thumb%25255B4%25255D.png?imgmax=800" width="705" height="296" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Along with inclusion of Expression trees, the following language features are also now supported in Roslyn, since CTP2.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Collection initializers &lt;/li&gt;    &lt;li&gt;Extern aliases &lt;/li&gt;    &lt;li&gt;Multi-dimensional arrays &lt;/li&gt;    &lt;li&gt;Nullable types &lt;/li&gt;    &lt;li&gt;Object initializers &lt;/li&gt;    &lt;li&gt;Type forwarders &lt;/li&gt;    &lt;li&gt;Unsafe code (except fixed-size buffers) &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Scripting API Changes&lt;/h2&gt;  &lt;p&gt;There are some breaking changes in September CTP release. I thought I’ll quickly re-phrase the Scripting Example I provided in the overview post. Some of the major changes for Scripting API includes, &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Changes for the ScriptEngine constructor &lt;/li&gt;    &lt;li&gt;Now you need to use ScriptEngine instance’s Create Method instead of Session.Create(..) you had in earlier version of Roslyn. &lt;/li&gt;    &lt;li&gt;The Execute method is now part of the Session, instead of Engine. So, instead of Engine’s Execute(code,session) in previous versions, you can directly call your Session’s Execute(code) method. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So, here is the updated code for the Scripting example I provided in the previous post. You could compare this with the &lt;a href="http://www.amazedsaint.com/2011/10/c-vnext-roslynan-introduction-and-quick.html"&gt;previous example&lt;/a&gt;, and I’ve listed some of the changes below. Note that the change is only with in the ScriptingHost class&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using Roslyn.Scripting.CSharp;
using Roslyn.Scripting;


namespace ScriptingRoslyn
{
    //Our Dog class so that we can train dogs later
    public class OurDog
    {
        private string _name = string.Empty;
        public OurDog(string name)
        {
            _name = name;
        }

        public string Name
        {
            get { return _name; }
        }

        public void Bite(OurDog other)
        {
            Console.WriteLine(&amp;quot;{0} is biting the tail of {1}&amp;quot;, _name, other.Name);
        }

        public void Walk()
        {
            Console.WriteLine(&amp;quot;{0} is Walking&amp;quot;, _name);
        }

        public void Eat()
        {
            Console.WriteLine(&amp;quot;{0} is Eating&amp;quot;, _name);
        }
    }



//Let us create a Host object, where we'll wrap our session and engine
//The methods in the host class are available directly to the environment
//Now you can create a ScriptEngine, and create a session out of the ScriptEngine

 public class ScriptingHost
    {
        private ScriptEngine engine;
        private Session session;

        //Methods in the Host object can be called directly from the 
        //environment
        public OurDog CreateDog(string name)
        {
            return new OurDog(name);
        }

        public ScriptingHost()
        {
            //Create the script engine
            //Script engine constructor parameters go changed
            engine=new ScriptEngine();

            //Let us use engine's Addreference for adding the required
            //assemblies
            new[]
             {
                    typeof (Console).Assembly,
                    typeof (ScriptingHost).Assembly,
                    typeof (IEnumerable&amp;lt;&amp;gt;).Assembly,
                    typeof (IQueryable).Assembly,
                    this.GetType().Assembly
             }.ToList().ForEach(asm =&amp;gt; engine.AddReference(asm));

            new[]
                {
                   &amp;quot;System&amp;quot;, &amp;quot;System.Linq&amp;quot;, 
                   &amp;quot;System.Collections&amp;quot;,
                   &amp;quot;System.Collections.Generic&amp;quot;
                }.ToList().ForEach(ns=&amp;gt;engine.ImportNamespace(ns));

            //Now, you need to create a session using engine's CreateSession method,
            //which can be seeded with a host object
            session = engine.CreateSession(this);
        }


        //Pass the code to the engine, nothing much here
        public object Execute(string code)
        {
            return session.Execute (code);
        }

        public T Execute&amp;lt;T&amp;gt;(string code)
        {
            return session.Execute&amp;lt;T&amp;gt;(code);
        }

    }

    //Main driver
    class Program
    {
        static void Main(string[] args)
        {
            var host = new ScriptingHost();
            Console.WriteLine(&amp;quot;Hello Dog Trainer!! Type your code.\n\n&amp;quot;);


            string codeLine;
            Console.Write(&amp;quot;&amp;gt;&amp;quot;);
            while ((codeLine = Console.ReadLine()) != &amp;quot;Exit();&amp;quot;)
            {
                try
                {
                    //Execute the code
                    var res = host.Execute(codeLine);

                    //Write the result back to console
                    if (res != null)
                        Console.WriteLine(&amp;quot; = &amp;quot; + res.ToString());
                }
                catch (Exception e)
                {
                    Console.WriteLine(&amp;quot; !! &amp;quot; + e.Message);
                }

                Console.Write(&amp;quot;&amp;gt;&amp;quot;);
            }
        }
    }
}&lt;/pre&gt;

&lt;p&gt;And now, let us run our little scripting app. And try some LINQ queries as part of your script &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh3.ggpht.com/--120Z2vNQy4/UFmXt83GceI/AAAAAAAABjo/5dJNGgB-rHw/wlEmoticon-smile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-YTVT5j9Z-Xk/UFmXvVgDX_I/AAAAAAAABjw/R90UZggz7m0/s1600-h/image%25255B14%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-VBq_zOGsWtM/UFmXxDXq_GI/AAAAAAAABj4/NQLm6LsPqZA/image_thumb%25255B7%25255D.png?imgmax=800" width="593" height="315" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Other API Changes&lt;/h2&gt;

&lt;p&gt;There have been some updates to the Roslyn APIs since the second CTP was released in June of 2012. Below is a summary of some of the most important changes, some of which are breaking.&amp;#160; For example, In compiler APIs,&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Instead of SyntaxTree.ParseCompilationUnit you can use ParseText or ParseFile instead.&amp;#160; &lt;/li&gt;

  &lt;li&gt;Also SyntaxNode.GetText and SyntaxNode.GetFullText have been replaced with ToString and ToFullString respectively &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/roslyn/thread/5a56122b-d6e5-40e0-8912-60eba3fc9a01"&gt;full list of API changes here&lt;/a&gt; - Happy Hacking with the new Roslyn APIs, Enjoy C#&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=uV3sZgkKSKI:5kcLGV9m0xw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=uV3sZgkKSKI:5kcLGV9m0xw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=uV3sZgkKSKI:5kcLGV9m0xw:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/uV3sZgkKSKI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/uV3sZgkKSKI/roslyn-september-ctp-2012-overview-api.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-Elf-mQXPGd0/UFmZf9IKdOI/AAAAAAAABkI/5g_TJfKcTL8/s72-c/image_thumb%25255B9%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/09/roslyn-september-ctp-2012-overview-api.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-410382798008566411</guid><pubDate>Sat, 15 Sep 2012 16:01:00 +0000</pubDate><atom:updated>2012-09-15T21:58:04.007+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Design And Architecture</category><category domain="http://www.blogger.com/atom/ns#">Programming-Tips</category><category domain="http://www.blogger.com/atom/ns#">Developer Self Help</category><title>The problem with being passionate about technologies</title><description>&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-AepvCi5wGSM/UFSmMnRcWLI/AAAAAAAABiw/4fumelDMApw/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh5.ggpht.com/-qSZKq0Ze_90/UFSmOvrmaEI/AAAAAAAABi4/G-n-_fQ6JNE/image_thumb%25255B2%25255D.png?imgmax=800" width="375" height="471" /&gt;&lt;/a&gt;The title is a little bit misleading. There is nothing wrong with being passionate about technologies you love/like. In fact, I believe in being a passionate developer, and I appreciate having passionate people in my team and around me.&lt;/p&gt;  &lt;p&gt;The real problem is – being subjective about something just because you are passionate about the same.&amp;#160; Few &lt;a href="http://www.englishbiz.co.uk/popups/objectivity.htm"&gt;quotes&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Subjective&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Subjective information is one person's opinion. In a newspaper, the editorial section is the place for subjectivity. It can be based on fact, but it is one person's interpretation of that fact. In this way, subjective information is also analytical.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Objective&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Objective information reviews many points of view. It is intended to be unbiased. News reporters are supposed to be objective and report the facts of an event. Encyclopedias and other reference materials provide objective information.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now, let us relate this to the developer’s life. Think about how you selected a specific framework or platform for your last assignment? &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Whether your decisions were made using objective parameters? Like &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;POCs that confirms the merit of the framework/platform/approach&lt;/li&gt;      &lt;li&gt;Team goals like cost, scope, quality&lt;/li&gt;      &lt;li&gt;Valid references with in proper context&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Or, you were driven by something subjective?&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Your comfort level&lt;/li&gt;      &lt;li&gt;Your own ego to prove what you suggested&lt;/li&gt;      &lt;li&gt;The person who suggested a different approach was your wife’s ex boy friend &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://lh6.ggpht.com/-VQU7OYmXh1w/UFSmPwMOrdI/AAAAAAAABjA/w5BFzCCUFwY/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;Subjectivity is bad because it’ll hurt others and yourself, and won’t let you focus on the real problems. Hence, especially with in a tech team, I think it is important to have a mutually agreed protocol to take architecture and design decisions objectively – and not subjectively. &lt;/p&gt;  &lt;p&gt;I’ve observed that practicing two critical points should always help&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Be open to explore suggestions from others - It is possible to have multiple ‘rights’ as two ways can lead to the same destination in the end. &lt;/li&gt;    &lt;li&gt;If you have difference of opinions, be open, take that offline and have an in depth discussion focusing on the problem + solution.&lt;/li&gt; &lt;/ul&gt;    &lt;p&gt;So, I believe you can enjoy your coding better if you have an objective view point as I’ve myself fallen for my subjectivity multiple times. And a line of disclaimer&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I wrote this post as an objective fact but is clearly a subjective opinion. lol.&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=oWc9dXdkiDs:l5O77wyHE2A:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=oWc9dXdkiDs:l5O77wyHE2A:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=oWc9dXdkiDs:l5O77wyHE2A:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/oWc9dXdkiDs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/oWc9dXdkiDs/the-problem-with-being-passionate-about.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-qSZKq0Ze_90/UFSmOvrmaEI/AAAAAAAABi4/G-n-_fQ6JNE/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/09/the-problem-with-being-passionate-about.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-1377485789589982599</guid><pubDate>Fri, 07 Sep 2012 11:49:00 +0000</pubDate><atom:updated>2012-09-07T17:59:18.360+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">xaml</category><category domain="http://www.blogger.com/atom/ns#">winrt</category><category domain="http://www.blogger.com/atom/ns#">windows8</category><title>5 points developers should know about WinRT/Windows 8</title><description>&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-CUndb6fEAPo/UEnfL0-1X4I/AAAAAAAABh4/5LlkDnqd5cg/s1600-h/image%25255B9%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; float: right; padding-top: 0px; padding-left: 0px; margin-left: 0px; border-left: 0px; display: inline; padding-right: 0px; margin-right: 0px" border="0" alt="image" align="right" src="http://lh6.ggpht.com/-25T4JW9mH-A/UEnfM4ZtbYI/AAAAAAAABh8/wgMgN4ThBQw/image_thumb%25255B5%25255D.png?imgmax=800" width="240" height="138" /&gt;&lt;/a&gt;Most of us already started developing for WinRT, so it make sense to have a better understanding of the run time. I am listing down few points with respect to WinRT, mainly from a developer’s perspective.&lt;/p&gt;  &lt;h3&gt;1 – WinRT is a new collection of COM objects, native to Windows &lt;/h3&gt;  &lt;p&gt;Here are some quick points about WinRT&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;WinRT is native, and all WinRT objects are unmanaged and use COM as the base. &lt;/li&gt;    &lt;li&gt;WinRT objects implement IUnknown and ref counting.&amp;#160; &lt;/li&gt;    &lt;li&gt;WinRT objects wraps a new XAML UI system, along with Win32 APIs. It consumes tons of Win32 APIs (Do &lt;a href="http://support.microsoft.com/kb/177429"&gt;dumpbin&lt;/a&gt; on a WinRT library) . The new set of XAML libraries are purely native, don’t confuse them with Silverlight or WPF though the terminologies remain same.&lt;/li&gt;    &lt;li&gt;As WinRT is COM and hence it is more closer to the Operating system, it is easier to write language bindings (Projections) for WinRT.&lt;/li&gt;    &lt;li&gt;A projection is a way of expressing WinRT in each language. More about this below&lt;/li&gt;    &lt;li&gt;Just in case you havn’t perceived it yet, WinRT world is totally different than the managed .NET world. &lt;/li&gt;    &lt;li&gt;WinRT libraries are built ground up using these new set of WinRT objects, and are kept in the Windows* namespaces. Eg. Windows.UI, Windows.Media, Windows.Networking, Windows.Security, Windows.Devices etc.&lt;/li&gt;    &lt;ul&gt;&lt;!--EndFragment--&gt;&lt;/ul&gt; &lt;/ul&gt;  &lt;h3&gt;2 – WinRT is not exactly your mama’s COM &lt;/h3&gt;  &lt;p&gt;You don’t need to work with the &lt;strike&gt;crappy&lt;/strike&gt; old&amp;#160; COM style, even while developing applications in C++. WinRT provides a higher level of abstraction, based on COM. Win RT implements multiple features on top of COM, including&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A Subscriber/Publisher model implemented using .NET inspired Delegates and events. In ‘old’ COM, this was done using events/sinks&lt;/li&gt;    &lt;li&gt;Parameterized interfaces or PInterfaces&amp;#160; (some what equivalent to generics), and this can be projected if the language supports them.&lt;/li&gt;    &lt;li&gt;WinRT components don’t implement IDispatch&lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;3 – WinRT can be accessed from multiple languages/platforms&lt;/h3&gt;  &lt;p&gt;WinRT itself is language neutral. Also, WinRT has got a language neutral type system.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;In some languages, you may even consume some WinRT types ‘as is’. &lt;/li&gt;    &lt;li&gt;In some other languages (like C#), WinRT types may be mapped to equivalent language types. For example, in C#, WinRT’s &lt;a href="http://msdn.microsoft.com/en-us/library/br205825(v=vs.85).aspx"&gt;IIterable&amp;lt;T&amp;gt;&lt;/a&gt; is mapped to IEnumerable&amp;lt;T&amp;gt; – where CLR will take care of the mapping.&lt;/li&gt;    &lt;li&gt;Full list of WinRT &amp;lt;-&amp;gt; CLR &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh995050.aspx"&gt;mapped types table is here&lt;/a&gt;. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In short, you can ‘project’ WinRT to multiple languages. The language run time will take care of the Garbage collection implementation. All WinRT components implement &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br205821"&gt;IInspectible&lt;/a&gt; interface for projecting itself to other language environments.&lt;/p&gt;  &lt;h3&gt;4 – Though WinRT&amp;#160; is unmanaged, it has got Meta Data&lt;/h3&gt;  &lt;p&gt;You might be thinking, if WinRT is so unmanaged, how we can call into WinRT from other environments, especially from the managed world without old techniques like P/Invoke?. In fact, Windows Runtime libraries are exposed using API metadata stored in &lt;em&gt;.winmd&lt;/em&gt; files. You could find the &lt;em&gt;winmd&lt;/em&gt; metadata corresponding to the WinRT libraries. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The format used for exposing metadata is the same as what is used by the .NET framework or Ecma-335 spec (Secret : WinMD files follow the same format of CLR assemblies though they don’t have any IL. Winmd files are just the definitions of the API. The implementation, as discussed, may be managed). &lt;/li&gt;    &lt;li&gt;The underlying binary contract makes it easy for you to access the Windows Runtime APIs directly in the development language you choose.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As the metadata format is similar to the .NET format, you can open a .winmd file in ILDASM and explore, like this.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-lZQ5WsP4ZHU/UEnfN-dM-2I/AAAAAAAABiE/YVwFwruXdY4/s1600-h/image%25255B3%25255D.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-8oSvjsrFROg/UEnfPqO754I/AAAAAAAABiQ/ymUaaAzMWAo/image_thumb%25255B1%25255D.png?imgmax=800" width="577" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h3&gt;5 – WinRT API has got language &lt;strike&gt;bindings&lt;/strike&gt; projections&lt;/h3&gt;  &lt;p&gt;As mentioned, a projection is a way of expressing WinRT in a specific language.&amp;#160; You may also create WinRT components in one language, and may consume the same from another (because the metadata is available). &lt;/p&gt;  &lt;p&gt;Presently, these are the projections available.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C++ Projections&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Using the C++/CX (Component Extensions) which does compile time bindings and compiles the code to a native image. As WinRT is fully native, applications developed using C++ doesn’t need CLR/.NET to compile/run WinRT applications. C++/CX is a set of extensions from Microsoft for developing for WinRT (much like C++/CL was for developing CLR/.NET apps in C++).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C#/XAML&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;CLR is modified to support WinRT access from the managed world.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Now CLR can can map WinRT types when you use C# as the language. &lt;/li&gt;    &lt;li&gt;When you create WinRT components in C# that can be used from other languages, you are further restricted to a minimal subset of C# (language features).&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When you develop for WinRT in C#/XAML, you’ll notice multiple things.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;As WinRT applications are sandboxed, you don’t have access to a lot of .NET libraries and types like File I/O. Only a minimal set of .NET APIs targeting the metro profile will be exposed&lt;/li&gt;    &lt;li&gt;You don’t have access to the synchronous versions of a number of methods. You need to leverage the asynchronous versions in those cases.&lt;/li&gt;    &lt;li&gt;When CLR does the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh995050.aspx"&gt;mapping of WinRT types to CLR types&lt;/a&gt;, the WinRT type definitions are made private by the CLR.&amp;#160; I may explain the actual mapping process in another post &lt;img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Winking smile" src="http://lh5.ggpht.com/-33uWkLGRHdM/UEnfQiTZoMI/AAAAAAAABiY/NeHvQ1Et_VE/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/li&gt;    &lt;li&gt;You can access WinRT XAML library, or can use the WebView as the front end when you use C# for your metro style apps. &lt;!--EndFragment--&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;JavaScript Projections&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Javascript projections are probably the most abstract and highest level projections for developing WinRT applications. How ever, you can’t create WinRT Components in Javascript. Also, you can’t use WinRT’s XAML library in/from JavaScript as of now. How ever, the advantage is if you are using Javascript, you could also leverage the HTML5 features for developing your applications. You can use the WinJS scripts and CSS files from Microsoft to provide the ‘metro-style’ look and feel.&lt;/p&gt;        &lt;p&gt;That is about WinRT for a good start.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=IfQR21BbN6Y:IVQhf9wpGZI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=IfQR21BbN6Y:IVQhf9wpGZI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=IfQR21BbN6Y:IVQhf9wpGZI:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/IfQR21BbN6Y" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/IfQR21BbN6Y/5-points-developers-should-know-about.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-25T4JW9mH-A/UEnfM4ZtbYI/AAAAAAAABh8/wgMgN4ThBQw/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/09/5-points-developers-should-know-about.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-708885391725961235</guid><pubDate>Fri, 17 Aug 2012 08:59:00 +0000</pubDate><atom:updated>2012-08-17T14:44:24.249+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Azure</category><title>Up and Running with Meteor in a Linux VM in Windows Azure in 10 minutes</title><description>&lt;p&gt;I wanted a developer machine/server for doing some quick prototyping with Node and &lt;a href="http://meteor.com"&gt;Meteor&lt;/a&gt;, and decided to setup one quickly in Azure. If you are wondering what is meteor, checkout this video from the &lt;a href="http://meteor.com"&gt;meteor website&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;iframe height="480" src="http://player.vimeo.com/video/40104996" frameborder="0" width="640" allowfullscreen="allowfullscreen" mozallowfullscreen="mozallowfullscreen" webkitallowfullscreen="webkitallowfullscreen"&gt;&lt;/iframe&gt;&lt;/p&gt;  &lt;p&gt;Meteor provides a unique model that doesn’t require much plumbing as in ‘normal’ web applications, and you can write Javascript files that combine both server and client side logic, and can write to the database directly from the client side. Behind the scenes, Meteor will manage all the plumbing. Exciting? Here is a quick guided walk through to start with a Meteor server in a Linux Azure VM in 10 minutes. &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1 – Setup the Linux Virtual Machine&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To start with,&amp;#160; Go to Windows Azure website &lt;a href="http://windowsazure.com"&gt;http://windowsazure.com&lt;/a&gt; and sign up for the trial (There is a 90 day free trial for you to enjoy) if you don’t have an account. Head over to the management portal at &lt;a title="https://manage.windowsazure.com" href="https://manage.windowsazure.com"&gt;https://manage.windowsazure.com&lt;/a&gt;, click New –&amp;gt; Virtual Machines –&amp;gt; From Gallery and choose OpenLogic CentOS 6.2. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-K6VoanSqTIo/UC4Hqv85pQI/AAAAAAAABfg/aUwBVr5k1_U/s1600-h/image16.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-EB3a7kaQuCw/UC4HsOzCIeI/AAAAAAAABfo/5JYzqUQqB1U/image_thumb7.png?imgmax=800" width="644" height="345" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click next, and provide the details, including Virtual Machine name, user name and password so that Azure can setup the instance.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-_gq4hjMWEaA/UC4HtsXJKvI/AAAAAAAABfw/lkhzjKGjVOA/s1600-h/image8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-V0EiqJbM-LU/UC4Hu9Se8RI/AAAAAAAABf4/am1Vnen6ovw/image_thumb3.png?imgmax=800" width="644" height="345" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Also, configure the DNS name so that we’ve a URL to access the VM.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-01LWNzKn3HE/UC4HwIN8-eI/AAAAAAAABgA/0dn2RLnFQ68/s1600-h/image12.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-QE7gLO_8vuk/UC4HxtHIicI/AAAAAAAABgI/P43UDVGFlQ0/image_thumb5.png?imgmax=800" width="644" height="345" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click next and complete the VM creation process. Once your VM is provisioned, have a look at the End points, and you’ll find that there is a Secure Shell (&lt;a href="http://en.wikipedia.org/wiki/Secure_Shell"&gt;SSH&lt;/a&gt;) end point for you to connect.&amp;#160; Let us connect over SSH.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-Cr8fBp0e5u0/UC4HzS2dtaI/AAAAAAAABgQ/r5d5-aJN2L8/s1600-h/image27.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-I2zd5fwqIa4/UC4H0mN7dhI/AAAAAAAABgY/un30H5OImNk/image_thumb14.png?imgmax=800" width="644" height="345" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;2 – Connecting over SSH using PuTTY&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We’ll use PuTTY, a free implementation of SSH to connect to the VM. Go and download &lt;a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html"&gt;PuTTY from here&lt;/a&gt; – I prefer installing via the &lt;a href="http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.62-installer.exe"&gt;PuTTY Windows installer&lt;/a&gt;. Fire up your PuTTY executable, and connect to the Linux Virtual machine. Make sure to provide your host name instead. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-L4EY2NQLByM/UC4H2ArfdhI/AAAAAAAABgg/jSa35KA_tiY/s1600-h/image23.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-Pe40U28a7dk/UC4H3fJ1eHI/AAAAAAAABgo/jILdqp7qLBk/image_thumb12.png?imgmax=800" width="470" height="452" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click Open, and in confirm the security alert and login via the Console by providing the username and password you provided while creating the Azure VM.&amp;#160; In the PuTTY console, you can execute what ever Linux commands you need.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;3 – Install Meteor&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now, installation of Meteor is dead simple. In the Putty Console, Just run&lt;/p&gt;  &lt;pre&gt;$ sudo curl https://install.meteor.com | /bin/sh&lt;/pre&gt;

&lt;p&gt;Once the installation is over, you can create a new project. I’m just creating a copy of the leaderboard example project. Cd to your leaderboard directory, and start the meteor server.&lt;/p&gt;

&lt;pre&gt;
$ meteor create --example leaderboard
$ cd leaderboard
$ meteor
&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-iH6tBcfq75c/UC4H4cT12MI/AAAAAAAABgw/rBcxsT9Oeuw/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Di6adtDzviw/UC4H5vqduTI/AAAAAAAABg4/cCGzkVArD5s/image_thumb%25255B2%25255D.png?imgmax=800" width="679" height="428" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to configure Azure end point rules to allow HTTP connections over port 3000. Just head over to Virtual Machines –&amp;gt; Meteor –&amp;gt; Endpoints section in the Azure management portal, and add a TCP end point for port 3000.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-Xls6T66SOAM/UC4H62Q5sFI/AAAAAAAABhA/607nhUsyA7U/s1600-h/image%25255B8%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-kZD5MwSsLrE/UC4H9KClX1I/AAAAAAAABhI/GcjOUK-HSZY/image_thumb%25255B4%25255D.png?imgmax=800" width="644" height="345" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You are ready. Browse to your VM’s address &lt;a href="http://meteor.cloudapp.net:3000"&gt;http://meteor.cloudapp.net:3000&lt;/a&gt; in my case, to see the leaderboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-iMvZ0HXGPgM/UC4H-90Kt4I/AAAAAAAABhQ/oejrFExBHqA/s1600-h/image%25255B12%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-VXBVRt2NefY/UC4IAdMa2PI/AAAAAAAABhY/gd-HlQ5sYvk/image_thumb%25255B6%25255D.png?imgmax=800" width="644" height="404" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Explore the codebase for Leaderboard, and get amazed!!. Happy coding.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; There is a &lt;a href="https://dl.dropbox.com/s/8g6o0edqhqmzly1/Meteor.msi?dl=1"&gt;Windows Installer&lt;/a&gt; for trying out Meteor in your Windows machine, how ever it don’t support &lt;em&gt;meteor update&lt;/em&gt; etc.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=bVPFNDz5HQE:9gm5Dz4-7jw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=bVPFNDz5HQE:9gm5Dz4-7jw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=bVPFNDz5HQE:9gm5Dz4-7jw:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/bVPFNDz5HQE" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/bVPFNDz5HQE/up-and-running-with-meteor-in-linux-vm.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-EB3a7kaQuCw/UC4HsOzCIeI/AAAAAAAABfo/5JYzqUQqB1U/s72-c/image_thumb7.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/08/up-and-running-with-meteor-in-linux-vm.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22141639.post-5344807474482065519</guid><pubDate>Fri, 20 Jul 2012 13:34:00 +0000</pubDate><atom:updated>2012-09-19T16:15:01.050+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSharp5</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">CSharp</category><title>Bending Your Code Like Anders With C# Roslyn APIs - More About Syntax Trees</title><description>&lt;p&gt;&lt;a href="http://lh4.ggpht.com/-DI4ri1_KnUI/UAlemEoq2XI/AAAAAAAABfA/tJUPhtoLkLI/s1600-h/image%25255B43%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://lh4.ggpht.com/-pilYCSBy7O4/UAlemxZPgsI/AAAAAAAABfI/7ilkOLAZBd4/image_thumb%25255B27%25255D.png?imgmax=800" width="240" height="240" /&gt;&lt;/a&gt;In my previous post &lt;a href="http://www.amazedsaint.com/2011/10/c-vnext-roslynan-introduction-and-quick.html"&gt;Introduction to C# Roslyn CTP&lt;/a&gt;, I gave a quick introduction about C# Roslyn CTP, and briefed how you could use C# as a Scripting Language using Roslyn. I also gave a quick introduction regarding parsing code using Roslyn APIs. Recommend you to read the same before starting this.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;On a side note, you could also read few of my related C# vNext posts here.&lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2010/05/tasks-1-2-3-parallel-extensions-in-net.html"&gt;Understanding C# Tasks and Parallel Extensions&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2010/10/c-50-asynchrony-quick-look-at.html"&gt;C# 5.0 Async – A Simple Introduction&lt;/a&gt; &lt;/li&gt;      &lt;li&gt;&lt;a href="http://www.amazedsaint.com/2010/09/c-as-scripting-language-in-your-net.html"&gt;Using Mono for implementing C# Scripting&lt;/a&gt; &lt;/li&gt;   &lt;/ul&gt; &lt;/blockquote&gt;  &lt;p&gt;In this post, we’ll re-look at few Roslyn features, based on the &lt;a href="http://blogs.msdn.com/b/csharpfaq/archive/2012/06/05/announcing-microsoft-roslyn-june-2012-ctp.aspx"&gt;June 2012 CTP release&lt;/a&gt; – so that you can start leveraging Roslyn to write your own build tasks and pre processors. Also, note that you can compile the &lt;a href="http://blogs.msdn.com/b/visualstudio/archive/2011/10/19/roslyn-syntax-visualizers.aspx"&gt;Syntax Debugger Visualizer&lt;/a&gt; sample that comes with the Roslyn CTP – Find it in the Shared folder in the CTP installation. Open the SyntaxDebuggerVisualizer project and compile the libraries, and place it in your &lt;em&gt;Documents\&amp;lt;VisualStudioFolder&amp;gt;\Visualizers&lt;/em&gt; so that you can visualize syntax trees during debugging.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;Update: Roslyn CTP September 2012 now has got released, and there are some breaking changes. &lt;/strong&gt;&lt;/font&gt;&lt;a href="http://www.amazedsaint.com/2012/09/roslyn-september-ctp-2012-overview-api.html"&gt;&lt;font style="background-color: #ffff00" color="#ff0000"&gt;&lt;strong&gt;I suggest you read this post&lt;/strong&gt;&lt;/font&gt;&lt;/a&gt;&lt;strong&gt;&lt;font color="#ff0000"&gt; about the new September 2012 CTP.&lt;/font&gt;&amp;#160;&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;Parsing Syntax Trees&lt;/h2&gt;  &lt;p&gt;So, let us start by parsing some code. Create a new Roslyn CTP Console project in Visual Studio, and try parsing this code. Note that in the new June 2012 CTP, Roslyn has added support for Query expressions, anonymous types, iterators, Indexers, switch statements etc. A Full list of features added since Oct 2011 CTP&amp;#160; &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/roslyn/thread/2341e1f5-ce2e-48ff-93d6-bdd1bdbabd81"&gt;is available here&lt;/a&gt;.&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using AForge.Genetic;
using Roslyn.Compilers;
using Roslyn.Compilers.CSharp;
using Roslyn.Scripting;
using Roslyn.Scripting.CSharp;

namespace Roslyn.Console
{   
    class Program
    {
        static void Main(string[] args)
        {

            string code=@&amp;quot;class SimpleClass { 
                                public void SimpleMethod()
                                    {
                                        var list = new List&amp;lt;string&amp;gt;();
                                        list.Add(&amp;quot;&amp;quot;first&amp;quot;&amp;quot;);
                                        list.Add(&amp;quot;&amp;quot;second&amp;quot;&amp;quot;);
                                        var result = from item in list
                                                     where item == &amp;quot;&amp;quot;first&amp;quot;&amp;quot;
                                                     select item;
                                    }
                        }&amp;quot;;


            var tree = SyntaxTree.ParseCompilationUnit(code);
        }&lt;/pre&gt;

&lt;p&gt;Now, put a break point near the closing bracket of our Main method, and try bringing up the Syntax Visualizer, assuming have the Visualizer libraries copied as above.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-8EAGa6cpgPE/UAleNR_HZkI/AAAAAAAABd4/4GOEkFOcvzY/s1600-h/image%25255B29%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-mvaTuoAnkFA/UAleOTX4WZI/AAAAAAAABeA/a35V1diy_k8/image_thumb%25255B19%25255D.png?imgmax=800" width="660" height="115" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And check out the Syntax Tree formed by Roslyn. The most interesting part is how the LINQ Expressions are parsed. So, this should provide a useful way to load Query Expressions dynamically (for implementing dynamic filters etc), once full version is available.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh3.ggpht.com/-R4lJgmqyDHA/UAleQXI0UaI/AAAAAAAABeI/RB1oX43Cm5A/s1600-h/image%25255B28%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-mjMMYl7Cg3U/UAleRUg18VI/AAAAAAAABeQ/U-919uWbAMg/image_thumb%25255B18%25255D.png?imgmax=800" width="644" height="387" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Walking The Syntax Tree&lt;/h2&gt;

&lt;p&gt;Now, let us quickly explore how you can walk the syntax tree. You can simply inherit your own &lt;strong&gt;SyntaxWalker&lt;/strong&gt; in the Roslyn API, that internally implements the Visitor pattern for visiting all nodes in the tree. Let us write a quick ConsoleDumpWalker that can dump the above syntax tree to a console, and a quick extension method so that we can use the walker to dump any syntax tree to console. &lt;/p&gt;

&lt;pre class="c#" name="code"&gt;public static class SyntaxTreeExtensions
    {
        public static void Dump(this SyntaxTree tree)
        {
            var writer = new ConsoleDumpWalker();
            writer.Visit(tree.GetRoot());
        }

        class ConsoleDumpWalker : SyntaxWalker
        {
            public override void Visit(SyntaxNode node)
            {
                int padding = node.Ancestors().Count();
                //To identify leaf nodes vs nodes with children
                string prepend = node.ChildNodes().Count() &amp;gt; 0 ? &amp;quot;[-]&amp;quot; : &amp;quot;[.]&amp;quot;;
                //Get the type of the node
                string line = new String(' ', padding) + prepend +
                                        &amp;quot; &amp;quot; + node.GetType().ToString();
                //Write the line
                System.Console.WriteLine(line);
                base.Visit(node);
            }

        }
    }&lt;/pre&gt;
And now, you can try dumping your syntax tree with the above Dump extension method. For example, dumping the above code we parsed in step 1 should show the syntax tree we found earlier in the Debug syntax visualizer. 

&lt;pre class="c#" name="code"&gt;  var tree = SyntaxTree.ParseCompilationUnit(code);
  tree.Dump();&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://lh5.ggpht.com/-qFTQeFNxAbs/UAleR6lgQpI/AAAAAAAABeU/8FQOhqIjB1U/s1600-h/image%25255B34%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-BnhXH6Acu4I/UAleTXMGZaI/AAAAAAAABeg/5aINL8YlGrQ/image_thumb%25255B22%25255D.png?imgmax=800" width="617" height="651" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;h2&gt;Modifying the Syntax Tree&lt;/h2&gt;

&lt;p&gt;Modifying Syntax Trees are equally easy. You can implement your own syntax re-writers, by inheriting from the &lt;strong&gt;SyntaxRewriter&lt;/strong&gt; class.&amp;#160; Here is a pretty naïve SyntaxRewriter, that appends an ‘I’ to the beginning of all interfaces that doesn’t start with an I in their name. In an actual scenario, you should also change the related implementations, but this is just for an example. So, here is our InterfaceRenameRewriter&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;//Our rewriter
public class InterfaceRenameRewriter : SyntaxRewriter
    {

        public override SyntaxToken VisitToken(SyntaxToken token)
        {
            //If the token is an identifier name, and it's 
           //parent is an interface declaration

            if (token.Kind == SyntaxKind.IdentifierToken &amp;amp;&amp;amp; 
                   token.Parent.Kind==SyntaxKind.InterfaceDeclaration)
            {
              //If the name doesn't start with I - bluntly fix it. 
               if (!token.GetText().StartsWith(&amp;quot;I&amp;quot;))
                    {
                        return Syntax.Identifier(&amp;quot;I&amp;quot; + token.GetText());
                    }
            }

            return base.VisitToken(token);
        }

    }&lt;/pre&gt;
And you can test our InterfaceRenameRewriter on some sample code.&amp;#160; &lt;pre class="c#" name="code"&gt;            string code = @&amp;quot;interface SomeInterface { 
                                //Some Simple Method
                                public void SomeMethod();
                        }&amp;quot;;


            var root = SyntaxTree.ParseCompilationUnit(code).GetRoot();
            var commentRewriter = new InterfaceRenameRewriter();
            var newRoot = commentRewriter.Visit(root);&lt;/pre&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;And if you inspect newRoot, you’ll find that the interface name got renamed as intended. Here we go.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-MB_U1dvPvPc/UAleUMe4TaI/AAAAAAAABeo/6Q0qr37qqAk/s1600-h/image%25255B39%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-N8fYZKFBytM/UAleV40-gDI/AAAAAAAABew/Ulj_eY4DEU4/image_thumb%25255B25%25255D.png?imgmax=800" width="764" height="281" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can experiment with more overrides available in the SyntaxRewriter, as you understood how to modify syntax trees. Another way to modify syntax trees is directly replacing an old node in the root with a new node, but that is quite simple. &lt;/p&gt;

&lt;p&gt;So, in this post we explored a bit about Roslyn Syntax Trees, and we saw how to start bending your code to write your own build tasks and pre-processors- Oh yes, all of us will take a little bit of time and practice to really bend it like &lt;a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg"&gt;Anders&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/b/ericlippert/"&gt;Eric&lt;/a&gt; – but you just kicked the ball. Happy coding. Checkout &lt;a href="http://www.amazedsaint.com/search/label/CSharp"&gt;my other C# posts as well&lt;/a&gt;&amp;#160;&lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://lh6.ggpht.com/-9DrQiQY2YmM/UAleWah7nUI/AAAAAAAABe0/Ic3cOJFGLi8/wlEmoticon-winkingsmile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=stKp2hRl_4o:rqcop7_7IFk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?i=stKp2hRl_4o:rqcop7_7IFk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/amazedsaint/articles?a=stKp2hRl_4o:rqcop7_7IFk:TzevzKxY174"&gt;&lt;img src="http://feeds.feedburner.com/~ff/amazedsaint/articles?d=TzevzKxY174" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/amazedsaint/articles/~4/stKp2hRl_4o" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/amazedsaint/articles/~3/stKp2hRl_4o/bending-your-code-like-anders-with-c.html</link><author>noreply@blogger.com (Anoop Madhusudanan)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-pilYCSBy7O4/UAlemxZPgsI/AAAAAAAABfI/7ilkOLAZBd4/s72-c/image_thumb%25255B27%25255D.png?imgmax=800" height="72" width="72" /><feedburner:origLink>http://www.amazedsaint.com/2012/07/bending-your-code-like-anders-with-c.html</feedburner:origLink></item></channel></rss>
