<?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.devmavens.com/~d/styles/itemcontent.css"?><rss version="2.0">
<channel>
    <title>DevMavens Feed</title>
    <link>http://DevMavens.com/</link>
    <description>DevMavens</description>
    <language>en-us</language>
    <docs>http://DevMavens.com/Rss</docs>
 
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.devmavens.com/Devmavens" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="devmavens" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Regional Differences</title>
      <author>Steve Smith</author>
      <link>http://ardalis.com/Regional-Differences</link>
      <description>&lt;p&gt;Last week I ran a poll (that maxed out at 400 responses on twtpoll) asking &lt;a href="http://twtpoll.com/r/prkogv"&gt;how developers recommend using regions in C# (or not)&lt;/a&gt;.&amp;nbsp; You can see the results here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://twtpoll.com/r/prkogv"&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Regional-Differences_8AAA/image_3.png" width="681" height="772" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;About 15% of the respondents chose Other and/or chose to leave a comment.&amp;nbsp; The comments are useful because they often highlight answer categories that I overlooked when I set up the poll.&amp;nbsp; In this case, there were a lot of comments, I think because there are a lot of different opinions about regions in general, some of them rather heated.&lt;/p&gt;
&lt;p&gt;Clearly the largest number of respondents simply never use Regions.&amp;nbsp; A number of comments went on to say things like &amp;ldquo;Regions aren&amp;rsquo;t evil I just don&amp;rsquo;t know a situation where they&amp;rsquo;re useful.&amp;rdquo;&amp;nbsp; The most popular use of regions from the ones I provided was for wrapping interface implementations, which isn&amp;rsquo;t too surprising since these regions are often automatically added when an interface is implemented automatically.&amp;nbsp; Similarly, a large number of comments referenced &amp;ldquo;generated code&amp;rdquo; as a use case for regions, which I probably should have included in the original listing.&lt;/p&gt;
&lt;p&gt;I added a couple of the options above, F and G, as items that I would consider obvious wrong answers on a standardized test.&amp;nbsp; Surprisingly, both got a reasonable number of votes, with 13% of respondents recommending the use of regions with long functions.&amp;nbsp; Now, some of these votes probably belong to commenters like this one: &amp;ldquo;Hiding long methods as I refactor it&amp;rdquo;.&amp;nbsp; If you&amp;rsquo;re temporarily collapsing sections of a long function during your refactoring exercise, that seems quite reasonable to me.&amp;nbsp; But if you&amp;rsquo;re putting regions into your function as a recommended, long-term approach, then I probably don&amp;rsquo;t want to work on that codebase with you.&amp;nbsp; I would much rather functions be small enough that (without regions) they fit on one screen, and if they get too big for that, fix the problem by extracting out well-named and well-composed methods, as opposed to hiding the problem behind regions.&amp;nbsp; And regions with regions.&amp;nbsp; Wow.&lt;/p&gt;
&lt;p&gt;My personal opinion is that regions had some great and common use cases in the early versions of .NET and C#.&amp;nbsp; For instance, the first version of ASP.NET used regions appropriately to hide auto-generated wire-up code in the codebehind.&amp;nbsp; A large number of comments continue to suggest that regions be used for generated code.&amp;nbsp; Today, two things make this less of an issue.&amp;nbsp; The first is partial classes.&amp;nbsp; Generated code today is almost always in its own class, or could be, and as such rather than wrapping it with a region, I find it is better to simply use a partial class to keep the generated code in a separate file from the custom code.&amp;nbsp; The second feature is more of an IDE feature.&amp;nbsp; A lot of users find regions helpful as a code navigation tool, or as a way to limit what they are looking at on the screen.&amp;nbsp; VS2010 provides great support for expanding and collapsing methods and other areas of code that you don&amp;rsquo;t wish to see, and tools like ReSharper make it trivial to navigate to a type or member anywhere in your solution&amp;nbsp; (ctrl-T, then type a substring of the type, then enter and you&amp;rsquo;re there.&amp;nbsp; For a member, the default keymap is the not-quite-as-easy-to-type ctrl-F12).&amp;nbsp; A number of comments also suggested using regions for using statements.&amp;nbsp; These don&amp;rsquo;t tend to bother me because I can quickly scroll down and not have to see them on my screen, and my using statements are usually quite small since ReSharper will clean up the ones I don&amp;rsquo;t need and will auto-add any that I do need, and my classes are small so they aren&amp;rsquo;t generally using more than a handful of other namespaces.&amp;nbsp; And of course, VS2010 supports collapsing using statements as well, like so:&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Regional-Differences_8AAA/image_6.png" width="179" height="47" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why Consider Them Harmful, Smelly, or even &amp;ldquo;Evil&amp;rdquo;?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Evil is obviously a strong word, and of course since regions have no effect on compiled code, they can&amp;rsquo;t directly have any impact on the software you&amp;rsquo;re creating.&amp;nbsp; However, I do think it is at least fair to say that regions often represent &amp;ldquo;code smells.&amp;rdquo;&amp;nbsp; That is, areas of your code that may be worth investigating to see if there is rotten code that needs to be cleaned up.&amp;nbsp; Why do some, including me, tend to feel this way?&amp;nbsp; Because regions are often a symptom of underlying problems with the code itself.&amp;nbsp; Regions do two things:&lt;/p&gt;
&lt;ol&gt;&lt;ol&gt;
&lt;li&gt;Provide a single-line comment&lt;/li&gt;
&lt;li&gt;Wrap some number of lines of code and allow it to be hidden on demand&lt;/li&gt;
&lt;/ol&gt;&lt;/ol&gt;
&lt;p&gt;When might you need these features?&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The intent of the code is unclear&lt;/li&gt;
&lt;li&gt;The code is too long to quickly understand at a glance&lt;/li&gt;
&lt;li&gt;Both of the above&lt;/li&gt;
&lt;li&gt;You prefer an &amp;ldquo;outline view&amp;rdquo; of classes so you can drill into each category of member when you dig into a class&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;In the case of items 1 through 3, regions are covering up problems.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If the intent of a block of code is unclear, fix the code.&amp;nbsp; Extract a method.&amp;nbsp; Rename the variables.&amp;nbsp; Refactor.&amp;nbsp; Simplify.&amp;nbsp; Don&amp;rsquo;t add a comment or a region (glorified comment) to try and cover up the problem.&amp;nbsp; If you spill something in the kitchen, should you clean up the floor, or just throw a rug over it or put out an orange cone to warn people about the spill?&amp;nbsp; Which option is going to keep the kitchen optimally usable?&amp;nbsp; The same goes for your code.&amp;nbsp; Keep it clean. &amp;nbsp;&lt;strong&gt;Regions are rugs under which to sweep smelly code.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If the code is simply too long, fix it.&amp;nbsp; Eliminate duplication.&amp;nbsp; Refactor.&amp;nbsp; Abstract details into larger-grained operations.&amp;nbsp; If you&amp;rsquo;re spending 10 lines of plumbing code talking to a database or service, move that into its own method or class that is only responsible for that work.&amp;nbsp; If you&amp;rsquo;re spending lots of lines of code copying values from one object to another, use a tool like &lt;a href="http://automapper.codeplex.com/"&gt;Automapper&lt;/a&gt; to map the values with one line of code.&amp;nbsp; Keep your code concise and at the appropriate level of abstraction for the method you&amp;rsquo;re in, and don&amp;rsquo;t mix plumbing code with application code if you can help it.&lt;/p&gt;
&lt;p&gt;In the case of 4, regions are being used to do something that your IDE should be able to easily do for you. I won&amp;rsquo;t say regions are being mis-used in this context, but I do think that if a large number of people use them for this purpose, then Visual Studio or one of the add-in providers should provide this kind of view such that you don&amp;rsquo;t have to implement yourself in the source code with region statements.&amp;nbsp; I definitely think it&amp;rsquo;s valid that some developers prefer this view of their classes, I just don&amp;rsquo;t think they should have to clutter up everybody&amp;rsquo;s codebase in order to do so.&amp;nbsp; Let the IDE do that work.&amp;nbsp; And of course, if the classes and methods are small, the need for a high-level view is significantly lessened.&amp;nbsp; If you prefer to have all of your public properties in one section, public methods in another, private members in another, etc. then wouldn&amp;rsquo;t you prefer to have an IDE that would simply let you specify the organization you prefer, and automatically have it in every file you open?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Almost half of the developers polled would never recommend using regions.&amp;nbsp; Yet nearly 15% of those polled would recommend using them to organize long methods.&amp;nbsp; A great many use them to organize code into categories (public, private, methods, properties), though this could probably be better done automatically by a tool.&amp;nbsp; When .NET was young, regions provided a useful way to hide generated code within classes or to provide expand/collapse capabilities within the IDE.&amp;nbsp; Today, partial classes and improvements to the IDE and various plug-ins make these uses unnecessary for many developers.&amp;nbsp; Clearly, there are still some opportunities for IDE/plug-in vendors to build in code organization support that will further erode the legitimate use cases for regions.&amp;nbsp; If you&amp;rsquo;re not using them for such organizational purposes today, think about the underlying reason you&amp;rsquo;re using a region the next time you add one, and consider if you wouldn&amp;rsquo;t be better off correcting the underlying code deficiency rather than hiding it under the region rug.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=wQnwqb2AzYY:7l35TpJV27Y:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=wQnwqb2AzYY:7l35TpJV27Y:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=wQnwqb2AzYY:7l35TpJV27Y:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=wQnwqb2AzYY:7l35TpJV27Y:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=wQnwqb2AzYY:7l35TpJV27Y:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=wQnwqb2AzYY:7l35TpJV27Y:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/wQnwqb2AzYY" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://ardalis.com/Regional-Differences"&gt;Regional Differences&lt;/a&gt; | &lt;a href="http://feeds.stevesmithblog.com/StevenSmith"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Tue, 21 May 2013 19:16:28 GMT</pubDate>
      <guid>http://ardalis.com/Regional-Differences</guid>
    </item>
 
    <item>
      <title>RavenDB, Victory</title>
      <author>Oren Eini</author>
      <link>http://feedproxy.google.com/~r/AyendeRahien/~3/lXllFzY0rCk/ravendb-victory</link>
      <description>&lt;p&gt;Jeremy Miller’s post about &lt;a href="http://jeremydmiller.com/2013/05/13/would-i-use-ravendb-again/"&gt;Would I use RavenDB again&lt;/a&gt; has been making the round. It is a good post, and I was asked to comment on it by multiple people.&lt;/p&gt; &lt;p&gt;I wanted to comment very briefly on some of the issues that were brought up:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Memory consumption – this is probably mostly related to the long term session usage, which we expect to be much more short lived.&lt;/li&gt; &lt;ul&gt; &lt;li&gt;The 2nd level cache is mostly there to speed things up when you have relatively small documents. If you have very large documents, or routinely have requests that return many documents, that can be a memory hog. That said, the 2nd level cache is limited to 2,048 items by default, so that shouldn’t really be a big issue. And you can change that (or even turn it off) with ease.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Don’t abstract RavenDB too much – yeah, that is pretty much has been our recommendation for a while. &lt;/li&gt; &lt;ul&gt; &lt;li&gt;I don’t see this as a problem. You have just the same issue if you are using any OR/M against an RDBMS.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Bulk Insert – the issue has already been fixed. In fact, IIRC, it was fixed within a day or two of the issue being brought up.&lt;/li&gt; &lt;li&gt;Eventual Consistency – Yes, you need to decide how to handle that. As Jeremy said, there are several ways of handling that, from using natural keys with no query latency associated with them to calling WaitForNonStaleResultsAsOfNow();&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Truthfully, the thing that really caught my eye wasn’t Jeremy’s post, but one of the comments:&lt;/p&gt; &lt;p&gt;&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/RavenDB-Victory_C687/image_2.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; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://ayende.com/blog/Images/Windows-Live-Writer/RavenDB-Victory_C687/image_thumb.png" width="682" height="314"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Thanks you, we spend a &lt;em&gt;lot&lt;/em&gt; of time on that!&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AyendeRahien/~4/lXllFzY0rCk" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://feedproxy.google.com/~r/AyendeRahien/~3/lXllFzY0rCk/ravendb-victory"&gt;RavenDB, Victory&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/AyendeRahien"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Tue, 21 May 2013 13:00:00 GMT</pubDate>
      <guid>http://feedproxy.google.com/~r/AyendeRahien/~3/lXllFzY0rCk/ravendb-victory</guid>
    </item>
 
    <item>
      <title>Moving a Site to Windows Azure in 5 Easy Steps</title>
      <author>Steve Smith</author>
      <link>http://ardalis.com/moving-a-site-to-windows-azure-in-5-easy-steps</link>
      <description>&lt;p&gt;One of my sites is currently having issues where it’s currently hosted.&amp;nbsp; They’re resolved by restarting the application, but that’s gotten tedious and I simply don’t have time to invest in troubleshooting this particular site.&amp;nbsp; And, oh hey, those &lt;a href="http://www.windowsazure.com/en-us/pricing/member-offers/msdn-benefits/"&gt;MSDN Windows Azure benefits&lt;/a&gt; keep looking shiny like I should play with them.&amp;nbsp; So, I figure I’ll try moving the site to Azure and see if miraculously that fixes the problem.&lt;/p&gt; &lt;h2&gt;Step One: Activate Azure Benefit&lt;/h2&gt; &lt;p&gt;Sign into your account with your &lt;a href="https://msdn.microsoft.com/en-us/subscriptions"&gt;MSDN Subscription&lt;/a&gt;, and click the Activate Windows Azure link:&lt;/p&gt; &lt;p&gt;&lt;a href="https://msdn.microsoft.com/en-us/subscriptions"&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_3.png" width="644" height="339"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Fill out the form, which will require a credit card and a mobile device (that can receive text messages) to complete.&lt;/p&gt; &lt;h2&gt;Step Two: Connect to Azure Portal&lt;/h2&gt; &lt;p&gt;Follow one of the many links to &lt;a href="https://manage.windowsazure.com"&gt;https://manage.windowsazure.com&lt;/a&gt; (or just click on mine).&amp;nbsp; There’s a ton of stuff you can configure and create from here.&amp;nbsp; In my case, since I may want to host more than one small website, and I want to be able to use A records (I’m not a fan of www in front of domains for web sites, which is pretty much required for CNAME DNS approaches), I’m choosing to create a small VM (&lt;a href="http://www.windowsazure.com/en-us/develop/net/common-tasks/custom-dns/"&gt;more on Azure DNS&lt;/a&gt;).&amp;nbsp; You can do this from the NEW command in the bottom left, and if you use the gallery option you can select the OS you want – in my case I went with Windows Server 2008 R2 SP1.&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_6.png" width="644" height="461"&gt;&lt;/p&gt; &lt;p&gt;Once you complete this wizard, it takes a few (really surprisingly few – I remember how long it took to deploy apps to the original version of Azure, and this is way faster) minutes to deploy and start the VM.&amp;nbsp; In a short while, you should see:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_9.png" width="644" height="148"&gt;&lt;/p&gt; &lt;p&gt;So now what?&amp;nbsp; Click on your VM to see what you can do with it:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_12.png" width="644" height="452"&gt;&lt;/p&gt; &lt;p&gt;The next thing I want to do is remote into the machine and start setting things up.&lt;/p&gt; &lt;h2&gt;Step Three: Connect to Virtual Machine&lt;/h2&gt; &lt;p&gt;My first thought was to just try to connect to the public foo.cloudapp.net name my VM was given, but of course that didn’t work.&amp;nbsp; Looking at your VM, navigate to the ENDPOINTS tab to see the public port configured for RemoteDesktop access.&amp;nbsp; You’ll need to specify that in your Remote Desktop Connection in order to connect (you do this by adding it to the end of your computer’s name following a : (colon)):&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_15.png" width="591" height="484"&gt;&lt;/p&gt;    &lt;p&gt;With that, you should be able to remote into the machine.&amp;nbsp; In my case, since I want this VM to act as a web server, the first thing I need to do is Add Roles and select the Web Server (IIS) role.&amp;nbsp; After that, the &lt;a href="http://www.microsoft.com/web/downloads/platform.aspx"&gt;web platform installer&lt;/a&gt; is your friend.&amp;nbsp; Once IIS is configured and I’ve gotten my web site’s files to the server, the next step is to configure the database.&lt;/p&gt; &lt;h2&gt;Step Four: Configure Database&lt;/h2&gt; &lt;p&gt;Your MSDN benefits include some database benefits in addition to the VM and web site benefits.&amp;nbsp; Note that the database benefits are fairly limited, so if you have a lot of small databases you may use up this benefit quickly.&amp;nbsp; With the Visual Studio Ultimate with MSDN benefit, you can use five 1GB web databases per month for free.&amp;nbsp; To create a new database, go back to the &lt;a href="https://manage.windowsazure.com/"&gt;Azure Management Portal&lt;/a&gt;, click on NEW, and choose SQL Database.&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_18.png" width="612" height="484"&gt;&lt;/p&gt; &lt;p&gt;Choose a name, and a server (or a new one will be created if this is your first SQL Database).&amp;nbsp; Then, if this is a new server, specify the username and password that will be used to connect to it.&amp;nbsp; Once set up, which takes a few seconds, you should see the database:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_21.png" width="644" height="177"&gt;&lt;/p&gt; &lt;p&gt;So now, how do you connect to this database and move your existing data to it, is the next question… &lt;/p&gt; &lt;h2&gt;Step Five: Connect to a SQL Database in Windows Azure&lt;/h2&gt; &lt;p&gt;Click on the database name just like with the VM to see initial options:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_24.png" width="644" height="404"&gt;&lt;/p&gt; &lt;p&gt;Now that you see the server info at the bottom, naturally the next step is to try and hit it with SQL Management Studio, but you’ll get this:&lt;/p&gt; &lt;p&gt;&lt;img title="SNAGHTML93b6115" 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="SNAGHTML93b6115" src="http://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/SNAGHTML93b6115_1.png" width="625" height="245"&gt;&lt;/p&gt; &lt;p&gt;Security bites us again!&amp;nbsp; Click on the DASHBOARD link to change which IP addresses are allowed to connect to the server:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_27.png" width="644" height="391"&gt;&lt;/p&gt; &lt;p&gt;It will help you out by suggesting your current client IP:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_30.png" width="644" height="153"&gt;&lt;/p&gt; &lt;p&gt;Be sure to click the SAVE link at the bottom after you add it.&lt;/p&gt; &lt;p&gt;Voila!&amp;nbsp; Now you can connect from Management Studio, which will let you run whatever queries you need in order to get your data into the database.&lt;/p&gt; &lt;p&gt;One last note – to actually connect to your web site on your VM, you’ll need to set up an endpoint for port 80 via the VM’s ENDPOINTS menu.&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_33.png" width="644" height="457"&gt;&lt;/p&gt; &lt;p&gt;Once that’s in place, you should be able to hit your site in a browser:&lt;/p&gt; &lt;p&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://ardalis.com/Media/Default/Windows-Live-Writer/Moving-a-Site-to-Windows-Azure_131EA/image_36.png" width="244" height="153"&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=-78pw2NHpmI:2ykqFeu1XFs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=-78pw2NHpmI:2ykqFeu1XFs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=-78pw2NHpmI:2ykqFeu1XFs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=-78pw2NHpmI:2ykqFeu1XFs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=-78pw2NHpmI:2ykqFeu1XFs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=-78pw2NHpmI:2ykqFeu1XFs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/-78pw2NHpmI" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://ardalis.com/moving-a-site-to-windows-azure-in-5-easy-steps"&gt;Moving a Site to Windows Azure in 5 Easy Steps&lt;/a&gt; | &lt;a href="http://feeds.stevesmithblog.com/StevenSmith"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Tue, 21 May 2013 06:42:53 GMT</pubDate>
      <guid>http://ardalis.com/moving-a-site-to-windows-azure-in-5-easy-steps</guid>
    </item>
 
    <item>
      <title>AngularJS Abstractions: Filters</title>
      <author>Scott Allen</author>
      <link>http://odetocode.com/blogs/scott/archive/2013/05/20/angularjs-abstractions-filters.aspx</link>
      <description>&lt;p&gt;&lt;img style="float: right; margin: 0px 0px 0px 10px; display: inline" align="right" src="http://odetocode.com/images2/Windows-Live-Writer/Angular-Abstractions-The-Application_F661/image_3.png"&gt;Filters in AngularJS can form a pipeline to format and adapt model data inside a view. The built-in filters for AngularJS are date (format a date), filter (select a subset of an array), currency (format a number using a currency symbol for the current locale), and many more. I say filters can form a pipeline because you place them inside expressions in a view using a pipe symbol. The canonical example of a filter is the &lt;em&gt;filter&lt;/em&gt; filter, which in the following markup filters a list of items according to what the user types in the search input (try it live &lt;a href="http://jsfiddle.net/gEEz6/"&gt;here&lt;/a&gt;). &lt;/p&gt;&lt;pre class="brush: xml; gutter: false; toolbar: false;"&gt;&amp;lt;input type="search" placeholder="Filter" ng-model="searchTerm"/&amp;gt;    

&amp;lt;ul ng-repeat="item in items | filter:searchTerm | limitTo:maxItems"&amp;gt;
    &amp;lt;li&amp;gt;{{item}}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;

&lt;/pre&gt;
&lt;p&gt;Notice the output of filter is also piped to a limitTo filter, which restricts the number of items in the list to maxItems (where maxItems would need to be defined in the model). &lt;/p&gt;
&lt;h3&gt;Custom Filters&lt;/h3&gt;
&lt;p&gt;Custom filters only require a filter function to be registered with Angular. The filter function returns a function that will perform the actual work. For example, a plurify filter to add the letter &lt;em&gt;s&lt;/em&gt; to the output: &lt;/p&gt;&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;(function() {

    var plurify = function() {
        return function(value) {
            return value + "s";
        };
    };

    angular.module("patientApp.Filters")
           .filter("plurify", plurify);
}());
&lt;/pre&gt;
&lt;p&gt;Now plurify is available to use in a view:&lt;/p&gt;&lt;pre class="brush: xml; gutter: false; toolbar: false;"&gt;&amp;lt;ul ng-repeat="item in items | filter:searchTerm | limitTo:maxItems"&amp;gt;
    &amp;lt;li&amp;gt;{{item | plurify }}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/pre&gt;
&lt;p&gt;A filter can also take one or more optional parameters. &lt;/p&gt;&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;var plurify = function() {
    return function(value, strength) {          
       strength = strength || 1;
       return value + Array(strength + 1).join("s");
    };
};
&lt;/pre&gt;
&lt;p&gt;Now we can add 5 s characters to the output:&lt;/p&gt;&lt;pre class="brush: xml; gutter: false; toolbar: false;"&gt;&amp;lt;li&amp;gt;{{item | plurify:5 }}&amp;lt;/li&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The beauty of filters is how you can package up small pieces of testable code to make the job of the model and view a bit easier, and the syntax to use a filter is easy and intuitive. &lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OdeToCode?a=m0IFJLYWzk8:dIy1LTqg0e8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OdeToCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt; &lt;hr /&gt;Read more: &lt;a href="http://odetocode.com/blogs/scott/archive/2013/05/20/angularjs-abstractions-filters.aspx"&gt;AngularJS Abstractions: Filters&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/OdeToCode"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Mon, 20 May 2013 13:12:00 GMT</pubDate>
      <guid>http://odetocode.com/blogs/scott/archive/2013/05/20/angularjs-abstractions-filters.aspx</guid>
    </item>
 
    <item>
      <title>Fixing up the build process</title>
      <author>Oren Eini</author>
      <link>http://feedproxy.google.com/~r/AyendeRahien/~3/QOzFLOprVdE/fixing-up-the-build-process</link>
      <description>&lt;p&gt;There is a big problem in the RavenDB build process. To be rather more exact, there is a… long problem in the RavenDB build process.&lt;/p&gt; &lt;p&gt;&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/Fixing-up-the-build-process_7889/image_2.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; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://ayende.com/blog/Images/Windows-Live-Writer/Fixing-up-the-build-process_7889/image_thumb.png" width="335" height="402"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;As you can imagine, when the build process run for that long, it doesn’t' get run too often. We already had several runs of “let us optimize the build”. But… the actual reason for the tests taking this long is a bit sneaky.&lt;/p&gt; &lt;p&gt;&lt;a href="http://ayende.com/blog/Images/Windows-Live-Writer/Fixing-up-the-build-process_7889/image_4.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; margin: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://ayende.com/blog/Images/Windows-Live-Writer/Fixing-up-the-build-process_7889/image_thumb_1.png" width="767" height="133"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;To save you from having to do the math, this means an average of 1.15 seconds per test.&lt;/p&gt; &lt;p&gt;In most tests, we actually have to create a RavenDB instance. That doesn’t take too long, but it does take some time. And we have a lot of tests that uses the network, because we need to test how RavenDB works on the wire.&lt;/p&gt; &lt;p&gt;From that perspective, it means that we don’t seem to have any real options. Even if we cut the average cost of running the tests by half, it would still be a 30 minutes build process. &lt;/p&gt; &lt;p&gt;Instead, we are going to create a layered approach. We are going to freeze all of our existing tests, move them to an Integration Tests project. We will create a small suite of tests that cover just core stuff with RavenDB, and use that. Over time, we will be adding tests to the new test project. When that becomes too slow, we will have another migration.&lt;/p&gt; &lt;p&gt;What about the integration tests? Well, those will be run solely by our build server, and we will setup things so we can automatically test when running from our own forks, not the main code line.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AyendeRahien/~4/QOzFLOprVdE" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://feedproxy.google.com/~r/AyendeRahien/~3/QOzFLOprVdE/fixing-up-the-build-process"&gt;Fixing up the build process&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/AyendeRahien"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Mon, 20 May 2013 13:00:00 GMT</pubDate>
      <guid>http://feedproxy.google.com/~r/AyendeRahien/~3/QOzFLOprVdE/fixing-up-the-build-process</guid>
    </item>
 
    <item>
      <title>Using system.js in MongoDB (From C#)</title>
      <author>Scott Allen</author>
      <link>http://odetocode.com/blogs/scott/archive/2013/05/17/using-system-js-in-mongodb-from-c.aspx</link>
      <description>&lt;p&gt;The official &lt;a href="http://docs.mongodb.org/manual/tutorial/store-javascript-function-on-server/"&gt;MongoDB docs&lt;/a&gt; recommend that you &lt;em&gt;avoid&lt;/em&gt; storing scripts on the server, but there are scenarios where having reusable functions available on the server can be useful. Inside a MapReduce operation, for example.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll start with some JavaScript code encapsulating statistical calculations, and place the code in a file named mathStats.js:&lt;/p&gt;
&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;function() {

    var stdDev = function(numbers) {
        // ...  
    };

    var mode = function(numbers) {
        // ...
    };

    var mean = function(numbers) {
        // ...
    };

    return {
        stdDev: stdDev,
        mode: mode,
        mean: mean
    };

};
&lt;/pre&gt;
&lt;p&gt;Note the script must be a function. To use the methods inside, the function must live in the system.js collection. The following C# code can do this:&lt;/p&gt;
&lt;pre class="brush: csharp; gutter: false; toolbar: false;"&gt;var sysJs = db.GetCollection("system.js");
var code = File.ReadAllText("pathTo\\mathStats.js");
var codeDocument = new BsonDocument("value", new BsonJavaScript(code));
codeDocument.Add(new BsonElement("_id", "mathStats"));
sysJs.Insert(codeDocument);

&lt;/pre&gt;
&lt;p&gt;It is important to insert the script as the&amp;nbsp; &lt;em&gt;value&lt;/em&gt; attribute of a document, and set the &lt;em&gt;_id&lt;/em&gt; of the document to a friendly string name and &lt;strong&gt;not&lt;/strong&gt; an ObjectID value. Failing to follow those two steps can lead to errors like &amp;ldquo;exception: name has to be a string&amp;rdquo; and &amp;ldquo;value has to be set&amp;rdquo; when you execute commands.&lt;/p&gt;
&lt;p&gt;Once the script is loaded, you can use the function from any map, reduce, or finalize function by invoking the function with its friendly _id name. For example:&lt;/p&gt;
&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;function(key, value){                      
    var stats = mathStats();
    value.stdDev = stats.stdDev(value.items);               
    return value;
}&lt;/pre&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OdeToCode?a=9H6mmWfWpcY:TiqI69Mtxxs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OdeToCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt; &lt;hr /&gt;Read more: &lt;a href="http://odetocode.com/blogs/scott/archive/2013/05/17/using-system-js-in-mongodb-from-c.aspx"&gt;Using system.js in MongoDB (From C#)&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/OdeToCode"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Fri, 17 May 2013 13:12:00 GMT</pubDate>
      <guid>http://odetocode.com/blogs/scott/archive/2013/05/17/using-system-js-in-mongodb-from-c.aspx</guid>
    </item>
 
    <item>
      <title>RavenDB Webinar: Aggregation just jump a grade or two…</title>
      <author>Oren Eini</author>
      <link>http://feedproxy.google.com/~r/AyendeRahien/~3/V6wIx6qdcUc/ravendb-webinar-aggregation-just-jump-a-grade-or-two</link>
      <description>&lt;p&gt;In tomorrow’s Webinar, we will discuss handle dynamic aggregation using RavenDB. A new feature in 2.5, this is meant to give you more options for reporting queries, including complex aggregation, dynamic selection, etc.&lt;/p&gt; &lt;p&gt;You can register here: &lt;a href="https://www2.gotomeeting.com/register/789291530"&gt;https://www2.gotomeeting.com/register/789291530&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/AyendeRahien/~4/V6wIx6qdcUc" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://feedproxy.google.com/~r/AyendeRahien/~3/V6wIx6qdcUc/ravendb-webinar-aggregation-just-jump-a-grade-or-two"&gt;RavenDB Webinar: Aggregation just jump a grade or two…&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/AyendeRahien"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Fri, 17 May 2013 13:00:00 GMT</pubDate>
      <guid>http://feedproxy.google.com/~r/AyendeRahien/~3/V6wIx6qdcUc/ravendb-webinar-aggregation-just-jump-a-grade-or-two</guid>
    </item>
 
    <item>
      <title>Move over TortoiseGit, welcome SourceTree</title>
      <author>Jeffrey Palermo</author>
      <link>http://feeds.jeffreypalermo.com/~r/jeffreypalermo/~3/X9hxbS165kg/</link>
      <description>&lt;p&gt;&lt;a href="http://jeffreypalermo.com/files/media/image/Windows-Live-Writer/Move-over-TortoiseGit-welcome-SourceTree_13C2E/image_2.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; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" align="right" src="http://jeffreypalermo.com/files/media/image/Windows-Live-Writer/Move-over-TortoiseGit-welcome-SourceTree_13C2E/image_thumb.png" width="452" height="372" /&gt;&lt;/a&gt;Since around 2005, I, and teams I’ve led, have been using the Tortoise flavor of source control clients.&amp;#160; &lt;a href="http://tortoisesvn.net/"&gt;TortoiseSVN&lt;/a&gt;, &lt;a href="http://tortoisehg.bitbucket.org/"&gt;TortoiseHg&lt;/a&gt;, and &lt;a href="https://code.google.com/p/tortoisegit/"&gt;TortoiseGit&lt;/a&gt;.&amp;#160; Each came with the command-line client as well for specific use cases, but most of the time, we used the Windows explorer shell integration.&amp;#160; To this day I’m using TortoiseGit with &lt;a href="https://github.com/"&gt;GitHub&lt;/a&gt;, &lt;a href="https://bitbucket.org/"&gt;BitBucket&lt;/a&gt;, and &lt;a href="https://tfs.visualstudio.com/en-us/home/news/2013/jan-30/#git support"&gt;Team Foundation Service+Git&lt;/a&gt;.&amp;#160; It works well with all of them.&amp;#160; I’m not sure why it took so long for me to figure out that Atlassian has a Git and Hg client called &lt;a href="http://sourcetreeapp.com/"&gt;SourceTree&lt;/a&gt;.&amp;#160; Here is what it looks like, and it seem to work seamlessly with my existing repositories and working copies.&amp;#160; In addition, it integrates diffs very well so that it’s obvious right off the bat what has changed in the file.&amp;#160; &lt;/p&gt;  &lt;p&gt;One feature that SourceTree does not provide is explorer shell integration so that I can right-click on the repository working copy and perform functions directly from there.&amp;#160; It will remain to be seen how often I reach for TortoiseGit with the new slick interface that SourceTree has.&amp;#160; I’m not sure, but I don’t think it will take long to see.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.jeffreypalermo.com/~ff/jeffreypalermo?a=X9hxbS165kg:3J2sLzbVP_s:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeffreypalermo?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.jeffreypalermo.com/~ff/jeffreypalermo?a=X9hxbS165kg:3J2sLzbVP_s:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/jeffreypalermo?i=X9hxbS165kg:3J2sLzbVP_s:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/jeffreypalermo/~4/X9hxbS165kg" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://feeds.jeffreypalermo.com/~r/jeffreypalermo/~3/X9hxbS165kg/"&gt;Move over TortoiseGit, welcome SourceTree&lt;/a&gt; | &lt;a href="http://feeds.jeffreypalermo.com/jeffreypalermo"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Fri, 17 May 2013 07:46:45 GMT</pubDate>
      <guid>http://feeds.jeffreypalermo.com/~r/jeffreypalermo/~3/X9hxbS165kg/</guid>
    </item>
 
    <item>
      <title>Videos: Beautiful Builds, and a Second Look at Unit Testing</title>
      <author>Roy Osherove</author>
      <link>http://feedproxy.google.com/~r/Iserializable/~3/4Jp5Qw7rgSA/videos-beautiful-builds-and-a-second-look-at-unit-testing.html</link>
      <description>&lt;p&gt;While at the msswit conference in the Ukraine, I got to speak on two subjects with the following videos:&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.techdays.ru/videos/6834.html"&gt;Beautiful Builds: &amp;nbsp;Maintainable, Coherent Build Processes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.techdays.ru/videos/6832.html"&gt;A Second Look at Unit Testing&lt;/a&gt;: what I learned since the first edtion of &lt;a href="http://ArtOfUnitTesting.com"&gt;Art Of Unit Testing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Iserializable?a=4Jp5Qw7rgSA:c9SP6yvALZU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Iserializable?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Iserializable?a=4Jp5Qw7rgSA:c9SP6yvALZU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Iserializable?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Iserializable?a=4Jp5Qw7rgSA:c9SP6yvALZU:D7DqB2pKExk"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Iserializable?i=4Jp5Qw7rgSA:c9SP6yvALZU:D7DqB2pKExk" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Iserializable/~4/4Jp5Qw7rgSA" height="1" width="1"/&gt; &lt;hr /&gt;Read more: &lt;a href="http://feedproxy.google.com/~r/Iserializable/~3/4Jp5Qw7rgSA/videos-beautiful-builds-and-a-second-look-at-unit-testing.html"&gt;Videos: Beautiful Builds, and a Second Look at Unit Testing&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/Iserializable"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Fri, 17 May 2013 03:16:59 GMT</pubDate>
      <guid>http://feedproxy.google.com/~r/Iserializable/~3/4Jp5Qw7rgSA/videos-beautiful-builds-and-a-second-look-at-unit-testing.html</guid>
    </item>
 
    <item>
      <title>AngularJS Abstractions: Scope</title>
      <author>Scott Allen</author>
      <link>http://odetocode.com/blogs/scott/archive/2013/05/16/angularjs-abstractions-scope.aspx</link>
      <description>&lt;p&gt;Continuing from the &lt;a href="http://odetocode.com/blogs/scott/archive/2013/05/13/angularjs-abstractions-controllers.aspx"&gt;controllers&lt;/a&gt; post, the parameter to the controller function is named $scope.&lt;/p&gt;
&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;var AboutController = function($scope) {

    // ...    

};
&lt;/pre&gt;
&lt;p&gt;The name $scope is important since it allows the AngularJS dependency injector to know what type of object you are asking for, in this case an &lt;strong&gt;object that will contain the view model&lt;/strong&gt;. Any plain old JavaScript you attach to $scope (properties, functions, objects, arrays) is eligible to use from the expressions inside the view.&lt;/p&gt;
&lt;p&gt;In the last post our model was relatively &amp;ldquo;flat&amp;rdquo; in the sense that properties and functions were added directly to $scope:&lt;/p&gt;
&lt;pre class="brush: js; gutter: false; toolbar: false;"&gt;$scope.rabbitCount = 2;

$scope.increase = function() {
    $scope.rabbitCount *= $scope.rabbitCount;
};
&lt;/pre&gt;
&lt;p&gt;This allowed us to use rabbitCount and increase() in the markup that was inside the view scope (the div) of the AboutController:&lt;/p&gt;
&lt;pre class="brush: xml; gutter: false; toolbar: false;"&gt;&amp;lt;div data-ng-controller="AboutController"&amp;gt;

    &amp;lt;div&amp;gt;Number of rabbits in the yard: {{rabbitCount}}&amp;lt;/div&amp;gt;

    &amp;lt;button ng-click="increase()"&amp;gt;More rabbits&amp;lt;/button&amp;gt;
    
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;img style="float: right; margin: 0px 0px 0px 10px; display: inline;" src="http://odetocode.com/images2/Windows-Live-Writer/Angular-Abstractions-The-Application_F661/image_3.png" alt="" align="right" /&gt;&lt;/p&gt;
&lt;p&gt;You can think of $scope as the execution context for the expressions in the view. Saying ng-click=&amp;rdquo;increase&amp;rdquo; results in a call to $scope.increase. The only thing tricky to understand about $scope is that having a controller inside a controller, or a controller inside an application (which you&amp;rsquo;ll always have), will result in nested $scopes, and a nested $scope will &lt;a href="http://msdn.microsoft.com/en-us/magazine/ff852808.aspx"&gt;&lt;strong&gt;prototypally inherit&lt;/strong&gt;&lt;/a&gt; from it&amp;rsquo;s parent scope by default. This is why $scope is injected by angularJS &amp;ndash; the framework sets up the prototype chain before giving your controller the $scope object to use as a model.&lt;/p&gt;
&lt;p&gt;Inheritance means a view has access to it&amp;rsquo;s own scope as well as any inherited scope. In the following example, the view inside the ChildController markup can use an expression like {{rabbitCount}}, and this expression will read the rabbitCount property of AboutController&amp;rsquo;s scope ($scope.rabbitCount will follow the prototype chain).&lt;/p&gt;
&lt;pre class="brush: xml; gutter: false; toolbar: false;"&gt;&amp;lt;div data-ng-controller="AboutController"&amp;gt;    

    &amp;lt;div&amp;gt;Number of rabbits in the yard: {{rabbitCount}}&amp;lt;/div&amp;gt;
    
    &amp;lt;div data-ng-controller="ChildController"&amp;gt;
        Number of rabbits in the yard: {{rabbitCount}}
        Number of squirrels in the yard: {{squirrelCount}}
    &amp;lt;/div&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;The one place to be careful with the inherited scope is with 2 way data binding. The way JavaScript prototypes work is that &lt;strong&gt;writing&lt;/strong&gt; to the rabbitCount property of the ChildController $scope will add a rabbitCount property to the ChildController $scope and effectively hide the parent property. $scope.rabbitCount no longer needs to follow the prototype chain to find a value. More details and pictures on this scenario in &amp;ldquo;&lt;a href="https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance"&gt;The Nuances of Scope Prototypal Inheritance&lt;/a&gt;&amp;rdquo;.&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/OdeToCode?a=rOKHOvFO_Rc:GGUXUQ6obwk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/OdeToCode?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt; &lt;hr /&gt;Read more: &lt;a href="http://odetocode.com/blogs/scott/archive/2013/05/16/angularjs-abstractions-scope.aspx"&gt;AngularJS Abstractions: Scope&lt;/a&gt; | &lt;a href="http://feeds.feedburner.com/OdeToCode"&gt;Subscribe&lt;/a&gt;</description>
      <pubDate>Thu, 16 May 2013 13:12:00 GMT</pubDate>
      <guid>http://odetocode.com/blogs/scott/archive/2013/05/16/angularjs-abstractions-scope.aspx</guid>
    </item>
 
  </channel>
</rss>
