Welcome to fuzzydev Sign in | Join | Help

Latest Posts

More Posts Next page »

External News

  • Binding Views with Anonymous Type Collection in ASP.NET MVC

    In this article Sheo explains how to bind ASP.NET MVC views with anonymous type collection objects.
    9 hours, 24 minutes ago by ASP.NET Articles of the Day
  • Autofac and Azure Mobile Services .NET Backend (Link)

    Posted the blog Autofac and Azure Mobile Services .NET Backend on the Azure Mobile Services Team Blog explaining how the .NET backend and you can use Autofac for all things dependency injection. Have fun! Henrik Read More......(read more)
    10 hours, 27 minutes ago by Henrik's Blog
  • Versioning ASP.NET Web API using URI, Query String, Custom Header or Accept Header

    This post discusses four different techniques for API versioning, starting with the most common one (versioning using URI), then covers versioning using query string, custom header, and finally using accept header.
    19 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • ASP.NET Upload Panel

    How to implement drag and drop file upload using HTML5 and ASP.NET Web Forms
    18 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • The Special Properties of ngRepeat In AngularJS

    Today’s tip comes straight from the AngularJS documentation, but I’ve seen a few people miss the topic. 

    Inside an ngRepeat directive the special properties $first, $last, and $middle are available. These properties hold boolean values ($first is true only for the first repeated element), and two more special properties that are available are $even and $odd.

    Another useful property is the $index property, which contains the offset of each repeated element and starts at 0 (like all good offsets).

    You can view the following markup live in this Plunker. The code is using $first and $last to avoid showing clickable up and down prompts when an item is in the first or last position. The markup is also using $index to grab the offset of a clicked item.

    <table>
        <tr ng-repeat="item in items">
            <td>{{item.title}}</td>
            <td><span ng-show="!$first" ng-click="moveUp($index)">up</span></td>
            <td><span ng-show="!$last" ng-click="moveDown($index)">down</span></td>
        </tr>
    </table>
    
    

    Combined with the following controller, you can move items up and down by clicking on the arrows.

    module.controller("mainController", function($scope){
        $scope.items = [
            { title: "Item 1" },
            { title: "Item 2" },
            { title: "Item 3" },
            { title: "Item 4" },
            { title: "Item 5" },
        ];
    
        var move = function (origin, destination) {
            var temp = $scope.items[destination];
            $scope.items[destination] = $scope.items[origin];
            $scope.items[origin] = temp;
        };
    
        $scope.moveUp = function(index){            
            move(index, index - 1);
        };
    
        $scope.moveDown = function(index){                    
            move(index, index + 1);
        };
    
    });
    
    17 Apr 2014, 12:12 PM by OdeToCode by K. Scott Allen
  • Default Model Binding and Explicit Model Binding in MVC

    This post covers Default Model Binding and Explicit Model Binding in MVC, using code snippets.
    17 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • Exploring ASP.NET Web Pages - A fully-featured MiniBlog using just Razor

    ASP.NET "Razor" Web Pages are ASP.NET sites without models, views, and controllers, without project files. Some folks say "oh, that's just Classic ASP, or PHP right? Not at all. It's the fill power and speed of the .NET CLR, the full syntax of C#, LINQ, along with things like C# dynamics. It's super powerful, and my friend Mads and I are surprised more people don't use them for small things. In fact, Rob Conery and I did the http://thisdeveloperslife.com web site using just Razor and Rob's "massive" micro-ORM . Later I made http://hanselminutes.com with Web Pages as well. This blog runs DasBlog , an older ASP.NET 2.0 blogging engine I worked on with Clemens Vasters and a lot of co-contributors, but...(read more)
    16 Apr 2014, 9:07 AM by Scott Hanselman - ASP.NET
  • MVC with Ajax - Push Start For Beginners

    This is quick tutorial on how to start with AJAX in MVC with basic operations such as Add, Update, Edit and Delete in a single page.
    16 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • Deconstructing A Function From Microsoft Word 1.1a

    When Microsoft released the source code to MS-DOS and Word, I had to take a look. One of the first functions I came across was ReplacePropsCa from the srchfmt.c file.

    /* %%Function:ReplacePropsCa %%Owner:rosiep */
    ReplacePropsCa(prpp, pca)
    struct RPP *prpp;
    struct CA *pca;
    {
        struct CA caInval;
    
        if (prpp->cbgrpprlChp)
            {
            ExpandCaSprm(pca, &caInval, prpp->grpprlChp);
            ApplyGrpprlCa(prpp->grpprlChp, prpp->cbgrpprlChp, pca);
            if (!vfNoInval)
                {
                InvalCp(pca);
                InvalText(pca, fFalse /* fEdit */);
                }
            }
    
        if (prpp->cbgrpprlPap)
            {
            int fStc;
            struct CHP chp;
            struct PAP pap;
    
            if (fStc = (*prpp->grpprlPap == sprmPStc))
                {
                CachePara(pca->doc, pca->cpFirst);
                pap = vpapFetch;
                }
            ExpandCaSprm(pca, &caInval, prpp->grpprlPap);
            ApplyGrpprlCa(prpp->grpprlPap, prpp->cbgrpprlPap, pca);
            if (fStc)
                {
                GetMajorityChp(pca, &chp);
                EmitSprmCMajCa(pca, &chp);
                if (!FMatchAbs(pca->doc, &pap, &vpapFetch))
                    InvalPageView(pca->doc);
                }
            if (!vfNoInval)
                {
                InvalCp(&caInval);
                InvalText (pca, fFalse /* fEdit */);
                DirtyOutline(pca->doc);
                }
            }
    }
    

    Thought #1: Every Function Has An Owner. Although I see the occasional project where each file has a comment indicating the owner, I don’t remember ever seeing ownership declared on individual functions. I think the concept of collective ownership is a healthier approach to building software, both for the software and the developers. Today’s tools also make it easier to jump around in code.

    Thought #2: The Flow Control Is All Wrong. Oh, wait, the flow control seems ok, it’s just the funny indentation of curly braces setting off alarm bells. Joel Spolsky has a post from 2005 titled Making Wrong Code Look Wrong in which he says:

    This is the real art: making robust code by literally inventing conventions that make errors stand out on the screen.

    After many years in 3 different languages using { and }, my eyes are accustomed to looking for a closing curly brace in the same column as the if. Not seeing the curly means code might accidently execute outside the conditional check. This function hides the closing curly and is full of evil.

    Thought #3: The Notation Is Hilarious. Call it Hungarian Notation, or Anti-Hungarian Notation, or something not Hungarian at all but a custom DSL designed in C. In any case the idea of checking to see if a prpp->grpplPap is equal to a sprmPStc is just one brick in a wall of gibberish that reminds me of a Lewis Carroll poem.

    `Twas brillig, and the slithy toves
      Did gyre and gimble in the wabe:
    All mimsy were the borogoves,
      And the mome raths outgrabe.

    Both the function and the poem include gibberish, but at least the Lewis Carroll poem rhymes.

    15 Apr 2014, 12:12 PM by OdeToCode by K. Scott Allen
  • Questions Developers Ask When Moving From ASP.NET Web Forms to MVC

    Some common questions that arise when seasoned Web Forms developers tread in ASP.NET MVC for the first time. It’s not an ASP.NET MVC vs. Web Forms article, but rather focuses on what’s different and how.
    15 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • Azure Updates: Web Sites, VMs, Mobile Services, Notification Hubs, Storage, VNets, Scheduler, AutoScale and More

    It has been a really busy last 10 days for the Azure team. This blog post quickly recaps a few of the significant enhancements we’ve made.  These include: Web Sites : SSL included, Traffic Manager, Java Support, Basic Tier Virtual Machines : Support for Chef and Puppet extensions, Basic Pricing tier for Compute Instances Virtual Network : General Availability of DynamicRouting VPN Gateways and Point-to-Site VPN Mobile Services : Preview of Visual Studio support for .NET, Azure Active Directory integration and Offline support; Notification Hubs : Support for Kindle Fire devices and Visual Studio Server Explorer integration Autoscale : General Availability release Storage : General Availability release of Read Access Geo Redundant Storage...(read more)
    14 Apr 2014, 11:58 PM by ScottGu's Blog
  • Deep Linking a Tabbed UI With AngularJS

    The idea is to dynamically generate a tabbed navigation using Angular and UI Bootstrap.

     I’ve done this before, but this time around I needed the ability to deep link into a tab. That is, if a user bookmarks /someapp/tab2, then the 2nd tab should be active with its content showing.

    Tabbed UI Angular JS

    Instead of using ngRouter, which is a bit simplistic, I decided to use UI Router. UI Router is not without quirks and bugs, but it does give the opportunity to setup multiple, named “states” for an application, and can manage nested states and routes through associated URLs. One of the first steps in working with UI Router is configuring the known states

    var app = angular.module("routedTabs", ["ui.router", "ui.bootstrap"]);
    
    app.config(function($stateProvider, $urlRouterProvider){
    
        $urlRouterProvider.otherwise("/main/tab1");
    
        $stateProvider
            .state("main", { abtract: true, url:"/main", templateUrl:"main.html" })
                .state("main.tab1", { url: "/tab1", templateUrl: "tab1.html" })
                .state("main.tab2", { url: "/tab2", templateUrl: "tab2.html" })
                .state("main.tab3", { url: "/tab3", templateUrl: "tab3.html" });
    });
    

    In the above code, “main” is a parent state with three children (tab1, tab2, and tab3). Each child has an associated URL (which will be appended to the parent URL) and a template. Each child template will plug into the parent template of main.html, which itself has to plug into the application shell.

    In other words, the shell of the application uses the ui-view directive to position the parent template (main.html).

    <body ng-app="routedTabs" class="container">
    
       <div ui-view></div>
    
    </body>
    

    This is not much different than using ngRouter and its ngView directive, but UI router also allows for main.html to use another ui-view directive where one of the child templates will appear.

    <div ng-controller="mainController">
    
        <tabset>
            <tab 
                ng-repeat="t in tabs" 
                heading="{{t.heading}}"
                select="go(t.route)"
                active="t.active">
            </tab>
        </tabset>
    
        <h2>View:</h2>
        <div ui-view></div>
    
    </div>
    

    This view requires a controller to provide the tab data.

    app.controller("mainController", function($rootScope, $scope, $state) {        
       
        $scope.tabs = [
            { heading: "Tab 1", route:"main.tab1", active:false },
            { heading: "Tab 2", route:"main.tab2", active:false },
            { heading: "Tab 3", route:"main.tab3", active:false },
        ];
    
        $scope.go = function(route){
            $state.go(route);
        };
    
        $scope.active = function(route){
            return $state.is(route);
        };
    
        $scope.$on("$stateChangeSuccess", function() {
            $scope.tabs.forEach(function(tab) {
                tab.active = $scope.active(tab.route);
            });
        });
    });
    

    The only reason to listen for UI router’s $stateChangeSuccess is to keep the right tab highlighted if the URL changes. It’s a bit of a hack and actually makes me wonder if using tabs from UI Bootstrap is worth the extra code, or if it would be easier to write something custom and integrate directly with UI router.

    If you want to try the code for yourself, here it is on Plunkr

    14 Apr 2014, 12:12 PM by OdeToCode by K. Scott Allen
  • Code in the Cloud Using Visual Studio Online

    Rachel Appel provides an overview of Visual Studio Online (codename Monaco), the newest Microsoft developer editor product.
    14 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • Base64 Encode Image in Website - Web Essential

    Learn about Base64 encoded images and how they can improve website performance. The article makes use of Web Essentials which is a must have Visual Studio extension.
    13 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • Custom Authentication and Authorization in ASP.NET MVC

    When standard types of authentication do not meet your requirements, you need to modify an authentication mechanism to create a custom solution. A user context has principal which represents the identity and roles for that user. A user is authenticated by its identity and assigned roles to a user determine about authorization or permission to access resources.
    12 Apr 2014, 3:00 AM by ASP.NET Articles of the Day
  • More Posts Next page »
Copyright 2010, Sachin Joshi. All rights reserved.
The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.
Powered by Community Server, by Telligent Systems