Random links for February 2011

by Alex Meyer-Gleaves 7 March 2011 - 5:15 PM

I can’t believe another month has past already. It really is time to get back to writing some proper blog posts. Anyway, here are a few links that I found interesting for one reason or another.

  • Oapt
    An NUnit addin for running one assert per test.
  • Debug Analyzer.NET
    Debug Analyzer.NET is a debugging automation tool to analyze memory dumps using analysis plug-ins written in .NET!
  • arbor.js
    Arbor is a graph visualization library built with web workers and jQuery.
  • jLabel - A jQuery Label plugin by William Duffy
    jLabel is a jQuery plugin that formats text input fields with unobtrusive labels featuring interactive suggestions. This allows input fields to be labelled clearly and presented with minimal interface obstruction.
  • CSS Reset.com - CSS Resets and Free CSS Tutorials
    All the most common CSS Reset scripts in one place, with complete documentation, guides and tutorials.
  • jRating : Ajaxed star rating system with jQuery
    jRating is a very flexible jQuery plugin for quickly creating an Ajaxed star rating system. It is possible to configure every detail from" the number of the stars" to "if the stars can represent decimals or not".
  • CLR Profiler for .NET Framework 4
    The CLR Profiler allows developers to see the allocation profile of their managed applications.
  • Silverlight 4 Application Themes
    4 new application themes for Silverlight 4: JetPack, Accent Color, Windows 7 and Cosmopolitan. These themes can be used for the navigation template provided by the Silverlight 4 Tools installer or using the various resource dictionaries provided in this d
  • JustMock Free Edition
    JustMock Free Edition is a developer productivity tool designed to make it easy to create mock objects. JustMock Free Edition cuts your development time and helps you create better unit tests without requiring you to change your code.
  • Microsoft All-In-One Code Framework
    The Microsoft All-In-One Code Framework is a free, centralized code sample library provided by the Microsoft Community team. Our goal is to provide typical code samples for all Microsoft development technologies.
  • Rocket SVN for Microsoft Visual Studio: Subversion add-in for VS 2008/2010
    OnTime integration, no svn:ignore patterns, as easy to install as it is to use, keyboard friendly, and no more relying on TortoiseSVN. All these features come together in RocketSVN for Visual Studio. Not to mention it's 100% Free for Unlimited Users!
  • AppHarbor
    We’re building af Git-enabled .NET Platform-as-a-Service. That means we’ll build, deploy and host your .NET websites for you. To get started all you have to do is to create an account and git push your code to AppHarbor.
  • Elevate
    Elevate is an easy to pick up library containing things you wish were in the BCL. Use one component or many. Contribute your own utilities. Share your ideas with the community.
  • HTML5Labs - Home
    The HTML5 Labs site is the place where Microsoft prototypes early and unstable web standard specifications from standards bodies such as the W3C.
  • Whisper Systems
    Welcome to the public beta of the Whisper Systems mobile security suite for Android. We have two applications in the initial beta, RedPhone and TextSecure, which help restore your ability to conduct your personal and business communications privately.
  • EasyHttp
    After writing smaller wrappers around WebRequest on a few occasions, I decided it’s time to formalize the wrapper. This has given way to EasyHttp.
  • AnjLab Sql Profiler
    SQL Server Express Edition Profiler provides the most of functionality standard profiler does, such as choosing events to profile, setting filters, etc. By now there are no analogue free tools.
  • PusherDotnet
    An implementation of the Pusher REST API in C#.
  • Fizzler
    A .NET library to select items from a node tree based on a CSS selector. The default implementation is based on HTMLAgilityPack and selects from HTML documents.
  • Jurassic - A Javascript Compiler for .NET
    Jurassic is an implementation of the ECMAScript language and runtime. It aims to provide the best performing and most standards-compliant implementation of JavaScript for .NET.
  • Coroutine
    Coroutine makes writing asynchronous code in C# as easy and natural as writing synchronous code.
  • Kayak, a C# HTTP server.
    Kayak is an asynchronous HTTP server written in C#. It has been designed to be easy to embed into a variety of applications. Kayak natively supports the OWIN 1.0 Draft specification.
  • ReactiveUI
    This library is an exploration I've been working on for several weeks on combining WPF Model-View-ViewModel paradigm with the Reactive Extensions for .NET (Rx).
  • Nancy
    Nancy is a lightweight web framework for the .Net platform, inspired by Sinatra. Nancy aims to deliver a low ceremony approach to building light, fast web applications.
  • OWIN — Open Web Interface for .NET
    OWIN defines a standard interface between .NET web servers and web applications.
  • grumpydev/TinyIoC - GitHub
    Welcome to TinyIoC - an easy to use, hassle free, Inversion of Control Container. TinyIoC has been designed to fulfil a single key requirement - to lower the "level of entry" for using an IoC container; both for small projects, and developers who are new
  • Encog Java and DotNet Neural Network Framework | Heaton Research
    Encog is an advanced neural network and machine learning framework. Encog contains classes to create a wide variety of networks, as well as support classes to normalize and process data for these neural networks.
  • Grammarly - English grammar checker, proofreader
    Grammarly is an automated proofreader and your personal grammar coach. Check your writing for grammar, punctuation, style and much more.
  • SeeNowDo :: Digital Taskboards for Distributed Agile Teams
    SeeNowDo is a simple, flexible and free taskboard designed specifically to meet the needs of distributed Agile teams.
  • Pivotal Tracker - Simple, Effective Agile Project Management
    Collaborative, lightweight project management tool, brought to you by the experts in agile software development.
  • Banana Scrum - scrum tool for agile teams
    Banana Scrum is a very simple Scrum tool. Designed to help your team keep track of things, but never meant to replace your daily human interactions. A tool to know where you are, but not so complex as to blurr the picture.
  • Kanbanize.com
    Kanbanize.com is a free web-based software tool that modernizes and builds on top of the well-known from Toyota's factories visualization method - kanban.
  • Scrumy
    Scrumy is a project management tool loosely based off of Scrum.
  • Semantic Versioning
    I call this system "Semantic Versioning." Under this scheme, version numbers and the way they change convey meaning about the underlying code and what has been modified from one version to the next.
  • PowerDbg - Automated Debugging using WinDbg and PowerShell
    PowerDbg is a PowerShell library that enables you to easily create PowerShell scripts to automate a WinDbg / CDB debugging session. You can use PowerDbg for Kernel Mode or User Mode, Post-Mortem debugging or Live Debugging and for native or managed code.
  • Google Public Policy Blog: Keep your opt-outs
    Today we’re making available Keep My Opt-Outs, which enables you to opt out permanently from ad tracking cookies. It’s available as an extension for download in Chrome.

Tags:

Random

Upgrading through every version of windows

by Alex Meyer-Gleaves 7 March 2011 - 5:08 PM

This is a great video showing upgrades of all major Windows versions from 1 through to 7. In fact, the whole process starts with the installation of MS-DOS 5.0 before moving onto Windows. Monkey Island and Doom 2 are installed in MS-DOS to test the backwards compatibility of Windows. The level of legacy support that Microsoft has managed to maintain over such a long period of time is certainly impressive. This has definitely got to be a very heavy burden. You can read more about the whole process on the author’s blog.

Watching this certainly brings back a lot of memories. Looking at the DOS screens I quickly started to reminisce about how much I loved Norton Commander. There was no need to reach for the mouse and everything was just a quick tap of the keyboard away. I remember having to install Trumpet Winsock because Windows 3.0 didn’t support the TCP/IP protocol stack. Gone are the days of the screeching modem and the Gopher session. I never imagined I would have instant access to the internet on a phone that fit snuggly into my pocket. Anyway, that’s enough nostalgia from me, check the video out to bring back your own memories.

Tags:

Random

WSCF.blue V1.0.11 Update

by Alex Meyer-Gleaves 16 February 2011 - 6:05 PM

A V1.0.11 update release of WSCF.blue is now available for download from CodePlex. This one contains a few bug fixes and one new feature. It will be the first release since upgrading the V1 solution to Visual Studio 2010, but the add-in continues to support both Visual Studio 2008 and Visual Studio 2010.

Christian recently posted that WSCF.blue passed the 10,000 downloads mark. Benjy would have been proud to see that milestone. We miss you mate.

Features

  • Added a new option that allows properties on data contract types to be marked as virtual.

Bug Fixes

  • Fixed a bug caused by certain project properties not being available on Web Service Software Factory projects.
  • Fixed a bug that could result in the WrapperName value of the MessageContractAttribute being incorrect when the Adjust Casing option is used.
  • The menu item code now caters for CommandBar instances that are not available. For example, the Web Item CommandBar does not exist if the Visual Web Developer component of Visual Studio is not installed. Adding logging to report any CommandBar instances that could not be located.

Tags: ,

Web Services | WSCF

Random links for January 2011

by Alex Meyer-Gleaves 1 February 2011 - 5:28 PM

Here are a few links that I found interesting for one reason or another.

  • Windows Phone Certificate Installer
    Helps install Trusted Root Certificates on Windows Phone 7 to enable SSL requests. Intended to allow developers to use localhost web servers during development without requiring the purchase of an SSL certificate.
  • ahiguti/HandlerSocket-Plugin-for-MySQL - GitHub
    HandlerSocket is a NoSQL plugin for MySQL. It works as a daemon inside the mysqld process, accept tcp connections, and execute requests from clients. HandlerSocket does not support SQL queries. Instead, it supports simple CRUD operations on tables.
  • Data types interoperability between .NET and Java
    This whitepaper is written based on an interoperability analysis carried out between .NET 4 and three major Java based platforms - IBM Web Sphere, Oracle WebLogic and Oracle Metro (referred as Java client/server systems hereinafter).
  • Google URL Shortener API for .NET
    With Google URL Shortener API, you may shorten urls and get some analytics information about this. It's developed in C# 4.0 and VS2010.
  • NoRM
    NoRM is a .Net library for connecting to the document-oriented database, MongoDB.
  • FileDB - A C# database to store files
    FileDB is a free, fast, lightweight C# (v3.5) DLL project to store, retrieve and delete files using a single archive file as a container on disk. It's ideal for storing files (all kind, all sizes) without databases and keeping them organized on a single d
  • DotNetZip Library
    DotNetZip is an easy-to-use, FAST, FREE class library and toolset for manipulating zip files or folders. Zip and Unzip is easy: with DotNetZip, .NET applications written in VB, C# - any .NET language - can easily create, read, extract, or update zip files
  • Mobile Device Detection and Redirection
    51degrees.mobi Foundation is an ASP.NET open source module which detects mobile devices and browsers, enhancing the information available to ASP.NET. Mobile handsets can optionally be redirected to a home page designed for mobile phones.
  • RazorEngine
    A templating engine built upon Microsoft's Razor parsing technology. The Razor Templating Engine allows you to use Razor syntax to build robust templates. Currently we have integrated the vanilla Html + Code support, but we hope to support other markup la
  • TeamViewer - Free Remote Access and Remote Desktop Sharing over the Internet
    TeamViewer connects to any PC or server around the world within a few seconds. You can remote control your partner's PC as if you were sitting right in front of it.
  • Options - NDesk
    NDesk.Options is a callback-based program option parser for C#.
  • Open source anti-theft solution for Mac, PCs
    Prey lets you keep track of your phone or laptop at all times, and will help you find it if it ever gets lost or stolen. It's lightweight, open source software, and free for anyone to use. And it just works.
  • YoxView - jQuery image viewer plugin
    YoxView is a free Lightbox-type media and image viewer jQuery plugin. It's easy to use and feature-rich.
  • endjin : open source : templify
    Every project starts the same way:you create a place to put solution artefacts,on one file system, on one computer.Templify helps you work smart, not hardby reducing repetition.
  • Download details: Microsoft Mathematics 4.0
    Microsoft Mathematics provides a graphing calculator that plots in 2D and 3D, step-by-step equation solving, and useful tools to help students with math and science studies.
  • Google URL Shortener API - Google Code
    The Google URL Shortener API allows you to develop applications that interface with this service. You can use simple HTTP methods to create, inspect, and manage goo.gl short URLs from your desktop, mobile, or web application.
  • How 90's | How 90's Is Your Website?
    We are now in 2011 and yet many people have websites straight out of the 1990’s! Run your website through how90s and find out if your an offender, and just pray and hope you don’t make our infamous "League Of Shame".
  • The Free Online OCR - Sciweavers
    i2OCR is a free online OCR that converts scanned documents, faxes, or screenshots into editable text. i2OCR supports several input image formats including (TIF, JPEG, PNG, BMP, GIF, PBM, PGM, PPM), which can be loaded from disk or URL.
  • Internet Information Services (IIS) 7.5 Express
    IIS 7.5 Express is a simple and self-contained version of IIS 7.5 that is optimized for developers.
  • ASP.NET MVC 3 Application Upgrader
    This standalone application upgrades ASP.NET MVC 2 applications to ASP.NET MVC 3. It works for both ASP.NET MVC 3 RC 2 and RTM. The tool only supports Visual Studio 2010 solutions and MVC 2 projects targeting .NET 4.
  • COVERITLIVE.COM - Home
    CoveritLive is the world's best live event software, with advanced features to engage and excite your Readers! CoveritLive works seamlessly to provide instant and in-depth event coverage.
  • blekko | slashtag search
    blekko is a better way to search the web by using slashtags. slashtags search only the sites you want and cut out the spam sites. use friends, experts, community or your own slashtags to slash in what you want and slash out what you don't.
  • Ajax.org - The real-time collaborative application platform
    Ajax.org Platform is a pure javascript application framework for creating real-time collaborative applications that run in the browser.
  • Protovis
    Unlike low-level graphics libraries that quickly become tedious for visualization, Protovis defines marks through dynamic properties that encode data, allowing inheritance, scales and layouts to simplify construction.
  • jQuery Sparklines
    This jQuery plugin generates sparklines (small inline charts) directly in the browser using data supplied either inline in the HTML, or via javascript.
  • Axiis : Data Visualization Framework
    Axiis is an open source data visualization framework designed for beginner and expert developers alike. Whether you are building elegant charts for executive briefings or exploring the boundaries of advanced data visualization research, Axiis has somethin
  • Modest Maps
    Our intent is to provide a minimal, extensible, customizable, and free display library for discriminating designers and developers who want to use interactive maps in their own projects.
  • Flare | Data Visualization for the Web
    Flare is an ActionScript library for creating visualizations that run in the Adobe Flash Player. From basic charts and graphs to complex interactive graphics, the toolkit supports data management, visual encoding, animation, and interaction techniques.
  • blender.org - Home
    Blender is the free open source 3D content creation suite, available for all major operating systems under the GNU General Public License.
  • Voyage - RSS feed reader
    Voyage is an RSS feed reader with a difference. It’s been carefully designed around the content it displays. Add RSS feeds from you favourite sites and let voyage pull all the information together for your pleasure.
  • paulstovell / Pigeon / source – Bitbucket
    A point-to-point message queue channel, written in C# using raw TCP sockets and Google Protocol Buffers.
  • Tutti - Interactively run Javascript on multiple browsers
    Tutti lets you interactively execute Javascript on multiple web browsers at the same time.
  • Distributed Systems Podcast
    Distributed Systems Podcast - all you ever wanted to hear and learn about building with DDD, CQRS, Cloud and much more!
  • Open Craft Beer - An open blog for craft beer lovers around the world
    This is an open blog for all lovers and purveyors of great craft beers. When you are lucky enough to enjoy one of these great beers, please drop us a quick review at OpenCraftBeer@posterous.com.
  • jspp
    A simple way to build web applications with embedded server side JavaScript. In a few minutes you can build dynamic backend logic in to any page (html, css, etc) using node.js, jQuery and server side DOM with php-like embedded code.
  • kinemote - Project Hosting on Google Code
    KinEmote is an easy-to-use, free application that takes gestures captured by the Microsoft Kinect and translates them into key strokes that any Windows application can recognize.
  • Lively Kernel - New Home
    Originally developed at Sun Microsystems Laboratories, it provides a complete platform for web applications, including dynamic graphics, network access, and development tools.

Tags:

Random

My Blackberry Is Not Working!

by Alex Meyer-Gleaves 14 January 2011 - 3:26 AM

Ronnie Corbett and Harry Enfield in a very funny sketch from ‘The One Ronnie’ on BBC.

Tags:

Random

Random links for December 2010

by Alex Meyer-Gleaves 1 January 2011 - 8:08 AM

Happy New Year! I hope that 2011 brings you good health, happiness and prosperity. Here are the last of my random links for 2010, but there will be plenty more to come in 2011.

  • Windows Enabler
    It allows the user to enable disabled windows and controls such as buttons and tick boxes and choose menu options that would normally be disabled.
  • BindingHub for WPF and ViewModels
    Component to extend WPF binding functionality and to use binding in ViewModels not inherited from DependencyObject.
  • Socket.IO: the cross-browser WebSocket for realtime apps.
    Socket.IO aims to make realtime apps possible in every browser and mobile device, blurring the differences between the different transport mechanisms.
  • In-the-Lab: Windows Server 2008 R2 Template for VMware « SolutionOriented Blog
    Here’s my quick recipe to build a custom image of Windows Server 2008 R2 that has been tested with Standard, Enterprise and Foundation editions.
  • How to Sysprep in Windows Server 2008 R2 and Windows 7 : Brian Desmond's Blog
    If you never had the need to look at Sysprep in Windows Vista/2008, you'll find that it's nothing like what you're used to on Windows Server 2003, XP, etc.
  • StyleCop for ReSharper
    StyleCop for ReSharper is a ReSharper plugin that allows Microsoft StyleCop to be run as you type, generating real-time syntax highlighting of violations and automatic fixing of StyleCop issues during ReSharper Code CleanUp (silent mode).
  • IKVM.NET Home Page
    IKVM.NET is an implementation of Java for Mono and the Microsoft .NET Framework.
  • Tessnet2 a .NET 2.0 Open Source OCR assembly using Tesseract engine
    Tesseract is a C open source OCR engine. Tessnet2 is .NET assembly that expose very simple methods to do OCR. Tessnet2 is multi threaded. It uses the engine the same way Tesseract.exe does. Tessdll uses another method (no thresholding).
  • FreeTextBox - ASP.NET Rich HTML editor
    The most-used free ASP.NET WYSIWYG HTML editor featured in open source and commerical projects. Just drop FreeTextbox.dll in your /bin/ folder, change to , and you're done.
  • Grub | Help crawl it all
    Grub Next Generation is distributed web crawling system (clients/servers) which helps to build and maintain index of the Web. It is client-server architecture where client crawls the web and updates the server. The peer-to-peer grubclient software crawls
  • Best Open Source
    There is a certain need to identify the best and help the Users to locate it easily. We constantly monitor all the products and its development and will help you and guide you to identify the best.
  • Azure Blob Studio 2011
    A WPF client for managing files on your Windows Azure Blob Storage account available as a stand-alone application and as an extension for Visual Studio 2010.
  • Windows Live Plug-ins
    The Windows Live Team has launched a new website showcasing and organizing plugins for Photo Gallery, Movie Maker and Writer.
  • Preview Shortened URLs and Avoid Security Threats - TechSpot
    Fortunately, there are several ways to peek behind a shortened URL to see exactly where the link will take you before clicking it, so let's take a quick look at a few of them.
  • SQL Scripts Manager – Powerful, reliable, automated scripting by SQL Server experts, for the community
    SQL Scripts Manager is a free tool that brings together must–have scripts from expert DBAs, SQL Server MVPs, and Red Gate developers to enable you to automate common troubleshooting, diagnostic, and maintenance tasks.
  • Centage – The Smart and Fluid CSS/LESS Framework
    Centage! is my five cents in defining a good fluid css framework. Every framework has its shortcomings – as has Centage! too – but it also solves some major issues in existing ones.
  • CodeMirror
    CodeMirror is a JavaScript library that can be used to create a relatively pleasant editor interface for code-like content ― computer programs, HTML markup, and similar.
  • zLayer jQuery Plugin - Orientate Elements | Devin R. Olsen Web Developer
    zLayers is a jQuery plugin that allows you to orientate an element based on the position of your mouse to the page’s window, or element’s parent.
  • DHTMLX - JavaScript Ajax Library - Components for Rich Web UI - Complete Suite of Ajax Controls, File Uploader, Scheduler, Gantt
    DHTMLX is a JavaScript library that provides essential functionality for building cross-browser, Ajax-based user interfaces. Develop impressive web applications faster with a set of ready-to-use UI widgets.
  • Boxtuffs - The Box of free psd Stuff and HTML5/CSS3 things.
    Boxtuffs came from the idea of designing cool web and graphics elements, but not just you will find nice psd graphics, also you will be able to download the cool sliced elements using the new css3 and html5.
  • CSS3 Please! The Cross-Browser CSS3 Rule Generator
    Another really popular option, this one allows you to edit the code just like you’d see it in a code editor. The changes are reflected on a graphic in the upper right.
  • CSS3 Generator
    Definitely one of the most popular options. All the effects are fully customizable and you can choose from all the popular CSS3 properties.
  • Ultimate CSS Gradient Generator - ColorZilla.com
    A powerful Photoshop-like CSS gradient editor from ColorZilla.
  • Pure CSS speech bubbles – Nicolas Gallagher – Blog
    This tutorial contains various forms of speech bubble effect created with CSS 2.1 and enhanced with CSS3. No images, no JavaScript and it can be applied to your existing semantic HTML.
  • Free overlapped CSS menu using CSS Sprites
    Here I am presenting a cool overlapped pure CSS menu created using CSS sprites. This is an initial draft version, so far I have checked it only in Firefox 3.5, IE 7, Chrome 3.0
  • Super Awesome Buttons with CSS3 and RGBA
    It’s a simple button made possible by a transparent PNG overlay (for the gradient), border, border-radius, box-shadow, and text-shadow.
  • Regex Hero - The Online .NET Regular Expression Tester
    Silverlight tool built specifically to test .NET regular expression.
  • Head JS :: The only script in your HEAD
    Load scripts like images. Use HTML5 and CSS3 safely. Target CSS for different screens, paths, states and browsers. Make it the only script in your HEAD. A concise solution to universal issues.
  • NounProject
    The Noun Project collects, organizes and adds to the highly recognizable symbols that form the world's visual language, so we may share them in a fun and meaningful way.
  • Boozle.com.au : Search for Australia's cheapest alcohol prices
    Boozle searches 1000's of liquor stores in Australia to find your favourite beer, spirits and premixed drinks at the cheapest price, and at your closest outlets.
  • TFS Integration Platform
    The TFS Integration Platform is a project developed by the Team Foundation Server (TFS) product group and the Visual Studio ALM Rangers to facilitate the development of tools that integrate TFS with other systems.
  • Universal Extractor | LegRoom.net
    Universal Extractor is a program designed to decompress and extract files from any type of archive or installer, such as ZIP or RAR files, self-extracting EXE files, application installers, etc.
  • Cinch
    Cinch is a fully featured WPF MVVM framework that makes it easier to develop rich MVVM WPF applications. It also provides UI services/threading/unit tests helpers and much more.
  • MVVM Light Toolkit
    The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in Silverlight and WPF. It is a light and pragmatic framework that contains only the essential components needed.
  • Caliburn Micro: A Micro-Framework for WPF, Silverlight and WP7
    A small, yet powerful implementation of Caliburn designed for WPF, Silverlight and WP7. The framework implements a variety of UI patterns for solving real-world problems.
  • AvalonDock
    AvalonDock is a WPF controls library which can be used to create a docking layout system like that is present in VisualStudio.
  • XamlQuery - The Write Less, Do More, Silverlight Library
    It simplifies several tasks like page/document traversing; finding controls by name, type, style, property value or position in control tree; event handling; animating and much more.
  • xpaulbettsx/ReactiveXaml - GitHub
    An MVVM framework for Silverlight 4 and WPF that integrates the Reactive Extensions (Rx) framework.
  • Artefact Animator
    Artefact Animator provides an easy to use framework for procedural time-based animations in Silverlight and WPF.
  • nRoute Framework
    nRoute is a composite application framework for creating MVVM-style applications in Silverlight, WPF, and Windows Phone 7.
  • agatha-rrsl - Project Hosting on Google Code
    Implementation of the Request/Response Service Layer for .NET.
  • Vagrant
    Vagrant is a tool for building and distributing virtualized development environments.
  • Damn You Auto Correct! - Funny iPhone Fails and Autocorrect Horror Stories
    This site is dedicated to all the embarrassing, questionable, hilarious, and just plain WTF auto correct moments. If you’ve been screwed by predictive text, we want to know about it.
  • Oversharers
    People who twitter or post embarrassingly intimate details, or gross and disgusting habits, or their unfortunate social awkwardness, for all to see. As if we care.
  • restfulie - rest from scratch
    CRUD through HTTP is a good step forward to using resources and becoming RESTful, another step further is to make use of hypermedia aware resources and Restfulie allows you to do it in Java, Ruby and C#.
  • Xtranormal | Text-to-Movie
    Our revolutionary approach to movie-making builds on an almost universally held skill—typing. You type something; we turn it into a movie. On the web and on the desktop.
  • Executor
    This is a multi purpose launcher and a more advanced and customizable version of windows run.

Tags:

Random

View Page Injection in Autofac ASP.NET MVC 3 Integration

by Alex Meyer-Gleaves 29 December 2010 - 4:31 PM

The increased support for dependency injection in ASP.NET MVC 3 includes the ability to have your view pages created by your favourite container.

Historically, these classes have not had access to dependency injection/service location functionality, because their creation was buried deep inside the implementation of the view engine. In MVC 3, we have updated the built-in view engines to attempt to create the view page classes via the service locator; if that fails, it will fall back to using Activator.CreateInstance, just like in previous versions of MVC.

Because the view pages are dynamically compiled at runtime a few restrictions have been imposed; you cannot use constructor injection and your view pages must inherit from a custom base class.

The problem is that your .aspx/.ascx/.cshtml/.vbhtml files are converted into classes at runtime by the ASP.NET Build Manager (in collaboration with build providers). When those classes are auto generated, they are auto generated only with a single parameterless constructor.

We looked at auto-generating constructors, but it turns out that we don't actually know enough about the base class when we're generating the code to actually do any reflection on it, so it's not really possible for us to look at the base class and determine which constructors it may or may not have.

Happy that these limitations are not going to pose any serious problems let’s move onto the Autofac integration. Time for yet another uninspiring example, but one that should be easy to follow and doesn’t require too much typing on my part. Imagine that we have a service that provides common company information such as a copyright that we need to display on all our view pages.

public interface ICompanyInformation
{
    string Copyright { get; }
}

There is of course an implementation of the service that returns the dynamic copyright information (you were warned about the example).

public class CompanyInformation : ICompanyInformation
{
    public string Copyright
    {
        get { return string.Format("Copywrong © {0} ACME Corporation", DateTime.Now.Year); }
    }
}

In the application start event we build our container and register the service along with our controllers. We also add a registration source called ViewRegistrationSource.

ContainerBuilder builder = new ContainerBuilder();
builder.Register(c => new CompanyInformation()).As<ICompanyInformation>().InstancePerHttpRequest();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
builder.RegisterSource(new ViewRegistrationSource());

IContainer container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

The registration source is where all the magic happens. A registration source allows you to create an adapter that will dynamically provide a registration for a service. We know that MVC will ask the container for an instance of the view page before it attempts to create it itself, so we can use the registration source to make sure that the container always knows how to provide such an instance. Below is the implementation of the registration source for those that are interested in the details.

public class ViewRegistrationSource : IRegistrationSource
{
    public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
    {
        var typedService = service as IServiceWithType;

        if (typedService != null && IsSupportedView(typedService.ServiceType))
            yield return RegistrationBuilder.ForType(typedService.ServiceType)
                .PropertiesAutowired()
                .InstancePerHttpRequest()
                .CreateRegistration();
    }

    public bool IsAdapterForIndividualComponents
    {
        get { return false; }
    }

    static bool IsSupportedView(Type serviceType)
    {
        return serviceType.IsAssignableTo<WebViewPage>() 
            || serviceType.IsAssignableTo<ViewPage>()
            || serviceType.IsAssignableTo<ViewMasterPage>()
            || serviceType.IsAssignableTo<ViewUserControl>();
    }
}

If the requested service inherits from one of the supported view base classes, the RegistrationBuilder.ForType helper is used to build the registration. The registration also makes sure that property injection is performed and that the lifetime is scoped to the HTTP request. The Razor view base class WebViewPage is supported, along with the WebForms base classes ViewPage, ViewMasterPage and ViewUserControl.

To get properties on the view page that can be injected by the container, you need to slot your own base class into the inheritance hierarchy. This is as simple as creating an abstract class that derives from WebViewPage or WebViewPage<T> when using the Razor view engine.

public abstract class CustomViewPage : WebViewPage
{
    public ICompanyInformation CompanyInformation { get; set; }
}

If you are using the WebForms view engine in your MVC project you would derive from the ViewPage or ViewPage<T> class instead.

public abstract class CustomViewPage : ViewPage
{
    public ICompanyInformation CompanyInformation { get; set; }
}

The last thing you need to do is ensure that your actual view page inherits from your custom base class. This can be achieved using the @inherits directive inside your .cshtml file for the Razor view engine.

@inherits Example.Views.Shared.CustomViewPage

@{
    ViewBag.Title = "Home Page";
}

<h2>@ViewBag.Message</h2>
<p>
    This is the page content.
</p>
<p>
    @CompanyInformation.Copyright
</p>

When using the WebForms view engine you set the Inherits attribute on the @ Page directive inside you .aspx file instead.

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="Example.Views.Shared.CustomViewPage"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2><%: ViewBag.Message %></h2>
    <p>
        This is the page content.
    </p>
    <p>
        <%= CompanyInformation.Copyright %>
    </p>
</asp:Content>

Making your custom base class inherit from the generic WebViewPage<T> or ViewPage<T> class allows you to provide your strongly typed model as the generic type parameter. You can of course choose to leave the generic type parameter in your base class open making it more reusable.

public abstract class CustomViewPage<T> : WebViewPage<T>
{
    public ICompanyInformation CompanyInformation { get; set; }
}

You simply provide the model type as the closing generic parameter in the type declared in the @inherits or Inherits attribute of the page.

@inherits Example.Views.Shared.CustomViewPage<Example.Models.CustomModel> 

Taking advantage of view page injection is a very simple matter. No doubt you will have much more creative uses for this than the simplified example shown here.

Tags: ,

Autofac | Web Development

Model Binder Injection in Autofac ASP.NET MVC 3 Integration

by Alex Meyer-Gleaves 8 December 2010 - 4:30 PM

The Autofac MVC integration supported model binder injection in the MVC 2 version, but improvements in the dependency injection support offered by MVC 3 has allowed the implementation to be made cleaner. ASP.NET MVC 3 introduces the IModelBinderProvider interface that allows the implementer to determine what model binder should be used for a particular type.

Developers who implement this interface can optionally return an implementation of IModelBinder for a given type (they should return null if they cannot create a binder for the given type).

Let’s start by looking at how the model binder injection is configured in the MVC integration. You first create a class that implements IModelBinder like you would when creating any other model binder in MVC. Next you apply the ModelBinderType attribute provided as part of the integration to indicate what types the model binder supports binding. The simple example below declares that the model binder supports binding for string types.

[ModelBinderType(typeof(string))]
public class StringBinder : IModelBinder
{
    public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
    {
        // Do implementation here.
    }
}

You then use the RegisterModelBinders extension method on the ContainerBuilder to register all the IModelBinder types that are present in one or more assemblies.

ContainerBuilder builder = new ContainerBuilder();
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());

The interesting part about the implementation of the assembly scanning is that it finds the types the model binder supports through the ModelBinderType attributes and then adds this information as metadata to the registration.

public static IRegistrationBuilder<object, ScanningActivatorData, DynamicRegistrationStyle>
    RegisterModelBinders(this ContainerBuilder builder, params Assembly[] modelBinderAssemblies)
{
    return builder.RegisterAssemblyTypes(modelBinderAssemblies)
        .Where(type => typeof(IModelBinder).IsAssignableFrom(type))
        .As<IModelBinder>()
        .InstancePerHttpRequest()
        .WithMetadata(AutofacModelBinderProvider.MetadataKey, type => 
            (from ModelBinderTypeAttribute attribute in type.GetCustomAttributes(typeof(ModelBinderTypeAttribute), true)
             from targetType in attribute.TargetTypes
            select targetType).ToList());
}

You must also remember to register the AutofacModelBinderProvider using the RegisterModelBinderProvider extension method. This is Autofac's implementation of the new IModelBinderProvider interface.

builder.RegisterModelBinderProvider();

The constructor of the AutofacModelBinderProvider requests that an IEnumerable<Meta<Lazy<IModelBinder>>> be provided. When the GetBinder method is called through the IModelBinderProvider interface, the list of Meta<T> about the components is queried to locate any potential matches based on the types stored in the metadata. The Lazy<T> part of dependency makes sure that we do not actually create an instance of the IModelBinder until it is actually needed.

public IModelBinder GetBinder(Type modelType)
{
    Meta<Lazy<IModelBinder>> modelBinder = _modelBinders
        .FirstOrDefault(binder => ((List<Type>)binder.Metadata[MetadataKey]).Contains(modelType));
    return (modelBinder != null) ? modelBinder.Value.Value : null;
}

This dynamic approach to handling model binder injection removes the need for a special wrapper around each IModelBinder component, and avoids having to register this wrapper directly into the static ModelBinders.Binders dictionary.

Tags:

Autofac | Web Development

Random links for November 2010

by Alex Meyer-Gleaves 8 December 2010 - 3:30 PM

Here are a few links that I found interesting for one reason or another.

  • Free source code hosting – Bitbucket
    Bitbucket is a free code hosting site for the popular Mercurial distributed version control system (DVCS) with over 60,000 users.
  • Typemock Test Lint
    The world’s first and only fully extensible coding advisor for unit tests in Visual Studio 2010.
  • FakeItEasy
    A .Net dynamic fake framework for creating all types of fake objects, mocks, stubs etc.
  • .NET Framework System Requirements
    The tables in this topic provide the hardware, operating system, and software requirements for the .NET Framework.
  • jabber-net - Project Hosting on Google Code
    A set of .Net controls for sending and receiving Extensible Messaging and Presence Protocol (XMPP), also known as the Jabber. Client connections, server component connections, presence, service discovery, and the like.
  • Programming, Software, and Technical Interview Questions - XOR Swap
    XOR Swap was created with the goal of collecting and organizing all of the coding, programming, software, and technical interview questions that have been asked in interviews at various technology-oriented companies.
  • Small Basic | Development for Beginners | MSDN
    Microsoft Small Basic puts the fun back into computer programming. With a friendly development environment that is very easy to master, it eases both kids and adults into the world of programming.
  • Firesheep
    A Firefox extension that demonstrates HTTP session hijacking attacks.
  • JSON C# Class Generator
    This application generates C# classes from a sample JSON text, so you can use strongly typed programming with JSON. It currently supports typed arrays, typed objects, integers, floats, booleans, strings and nullable types.
  • JSON Formatter
    The JSON Formatter was created to help with debugging. As data expressed as JSON is often written without line breaks to save space, it became extremely difficult to actually read it. This tool hopes to solve the problem by formatting the JSON into data t
  • AutoFixture
    AutoFixture is designed to make Test-Driven Development more productive. It does so by removing the need for hand-coding anonymous variables as part of a test's Fixture Setup phase. Among other features, it offers a generic implementation of the Test Data

Tags:

Random

WSCF.blue on endpoint.tv

by Alex Meyer-Gleaves 11 November 2010 - 4:02 PM

If you are interested in a quick introduction to WCF contract first make sure you check out the latest episode of endpoint.tv. Ron Jacobs has recorded a Trans-Atlantic webcast with WSCF.blue developer Santosh Benjamin.

Get Microsoft Silverlight

Great stuff Benjy!

Tags: ,

WSCF | Web Services

About the author

Alex Meyer-Gleaves I'm a Technical Architect living in Australia (that island like continent in the southern hemisphere). I love Microsoft .NET and C#. I hate early mornings, slow drivers and Lotus Notes.

Twitter

Google Shared

 

Month List

Recent Comments

Comment RSS

Links

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010