• TFS Test Results XSL - Part 2

    This week I updated the XSL Stylesheet I created in a previous post for showing TFS Team Build test results.  I've added the ability to list WebTests as well as including the full Namespace of each Unit Test.

    Here's an example showing some tests from a SharePoint project I'm working on:


    You can read my previous post or download the XSL file.

    Full story

    Comments (0)

  • SOLID Principles

    At TechDays this week I spoke on the subject of SOLID principles for an ASP.Net MVC application, so here are some links to more articles on the SOLID principles, my PowerPoint presentation and the code examples.  Thanks to Steve Smith for the basis of this presentation:

    The SOLID Principles

    S - Single Responsibility Principle - Your code should have one reason to change.

    O - Open/Closed Principle - Classes should be open for extension, closed for modification

    L - Liskov Substitution Principle - Derived classes must be substitutable for their base

    I - Interface Segregation Principle - Avoid fat interfaces

    D - Dependency Inversion Principle -Depend on abstractions

    (links are to www.objectmentor.com articles)

    Presentation

    Download the PowerPoint presentation.

    Code

    Download the code for a blog application before refactoring for the SOLID  principles.

    Links

    Uncle Bob - Principles of OOD

    Hanselminutes - SOLID Principles with Uncle Bob

    Credits

    This presentation was based on the TechEd presentation from Steve Smith of www.NimblePros.com - Thanks Steve!

    http://stevesmithblog.com/blog/asp-net-mvc-and-solid-programming-principles-june-2009/

    Full story

    Comments (0)

  • TechDays 2009 - SOLIDify Your Microsoft ASP.NET MVC Applications

    I'm very pleased to announce that I shall be speaking again at the upcoming Microsoft TechDays Canada conference in Vancouver on September 15th.

     

    My talk will be titled "SOLIDify Your Microsoft ASP.NET MVC Applications".  Here's the overview:

    "Object-oriented programming makes it easier to manage complexity, but only if you do it right. The five SOLID principles of class design (one for each letter) help ensure that you’re writing applications that are flexible, comprehensible and maintainable, and we’ll explain and explore them in this session. We’ll start with a brittle ASP.NET MVC application that’s badly in need of refactoring and fix it by applying the SOLID principles. This session is a good follow-up for Introducing ASP.NET MVC, but it’s also good for developers of ASP.NET MVC looking to improve their code – or even if you’re not planning to use ASP.NET MVC. The SOLID principles apply to programming in any object-oriented language or framework."

    You can find out more about the sessions and instructors on the Microsoft TechDays Canada website.

    Full story

    Comments (0)

  • How Do I Upgrade a Virtual PC to Hyper-V

    I have a big stack of How Do I instructions for doing all those things that are needed on a somewhat infrequent basis but have a fairly tricky list of steps that need to be remembered.  This morning while upgrading another project VPC to work on Hyper-V I figured, why not keep them on my blog?

    Host Machine

    - Hyper-V Manager:
      - Click New
      - Specify Name and Location:  Pick the folder where your existing .vmc file is.
      - Assign your memory and network connection (Hyper-V)
      - Connect Virtual Hard Disk: Choose "Use an existing hard disk" and pick your existing .vhc file.
      - Finish. 

    Virtual Machine

    - Upgrade the VM software:
      - Control Panel > Add / Remove Programs > Remove "Virtual Machine Additions"
      - Restart
      - Action > Insert Integration Services Setup Disk. Setup should auto run, if it doesn't run - D:\Setup\x86\setup.exe
      - When prompted to "Upgrade HAL?"  Click Yes
      - Restart
      - Wait for everything to install
      - Restart

    - Join domain
      - My Computer > Properties
      - Computer Name tab - "To rename this computer or join a domain click Change".  Click Change.
      - Restart

    - Turn on Remote Access
      - My Computer > Properties
      - Remote tab
      - Check "Enable Remote Desktop on this computer"
      - Click "Select Remote Users" and add the relevant users.

    Full story

    Comments (0)

  • Microsoft BizSpark

    Not having kept up with company start-up info recently, today I discovered BizSpark, a new program from Microsoft for helping start-up companies build Software-as-a-Service applications. The program was launched on Dec 10th, 2008 in LA - here's the schpeel:

    "
    Microsoft® BizSpark™ is a global program designed to help accelerate the success of early stage startups by providing key resources when they need it the most:

    • Software. Receive fast and easy access to current full-featured Microsoft development tools, platform technologies, and production licenses of server products for immediate use in developing and bringing to market innovative and interoperable solutions. There is no upfront cost to enroll.
    • Support. Get connected to Network Partners around the world — incubators, investors, advisors, government agencies and hosters — that are equally involved and vested in software-fueled innovation and entrepreneurship who will provide a wide range of support resources.
    • Visibility. Achieve global visibility to an audience of potential investors, clients and partners
      As a Microsoft BizSpark member, you’ll be tapping into a rich, vibrant ecosystem of peers, partners and support resources around the globe, helping you grow and succeed. Microsoft BizSpark is the quickest way to get your Startup fired up.

    "

    Do I Qualify?

    To qualify, your startup must be

    • Actively engaged in development of a software-based product or service that will form a core piece of its current or intended business;
    • Privately held;
    • In business for less than 3 years;
    • Generating less than USD $1 million in annual revenue;
    • Sponsored by ...

    Full story

    Comments (0)

  • MSBuild Target Namespaces

    My recent project has included a fair number of technologies integrated into our automated build and packaging scripts.  Up until this project, I've been using MSBuild target names such as:

      RecreateDb, Build, Package, DeployK2, TestSP

    On this project we have SQL, K2 Blackpearl, SharePoint, Word 2007 Add-Ins, and a few other bits and pieces, and as each of them has their own pieces which need to be build, packaged, deployed and tested, using the above conventions started to become somewhat confusing so I created the following namespace convention in naming the MSBuild Targets:

       (Technology)-(Action)

     So for example, we now have:

      Db-Recreate
      K2-Build, SP-Build, Word-Build
      K2-Package, SP-Package, Word-Package, Db-Package
      K2-Deploy, SP-Deploy
      K2-Test, SP-Test

    Here, Package refers to creating a single file containing all the software for that component, so it's usually either a .zip file, a SharePoint .wsp or an .msi. Deploy refers to taking that package and deploying it to the relevant runtime environment.

    I made these changes after writing posts My Favourite MSBuild Targets #2: RecreateDbMy Favourite MSBuild Targets #3: DeployReports and My Favourite MSBuild Targets #4: DeployK2, and now favour these new conventions for their clarity, ability to be easily guessed if they are forgotten and the way they mirror class/method naming in code.

    I'd be interested to see what other naming conventions people are using in their scripts.

     

    Full story

    Comments (0)

  • BostonPizza.com is Live

    I'm excited to announce that today Boston Pizza launched their new website, developed by the team here at Habañero.  This is a really exciting day for us as this is the largest Sitefinity project we've worked on to date.

    The fully bilingual site was built on the Sitefinity CMS platform using Microsoft Virtual Earth for its mapping engine and has a ton of sweet jQuery for the galleries, flyouts and image rotations. We also integrated videos through Vimeo as well as the providers Boston Pizza uses for its gift card and email programs.

    The location finder uses jQuery to create the lightbox window and Virtual Earth to present the map and it's hover-over menus.  The Virtual Earth integration was pretty straightforward and comparable to other Google Earth projects I've worked on in terms of complexity and effort required.

     

    Each restaurant page uses jQuery to rotate the restaurant photo and to show a gallery of event photos at that location.  Also listed are the handy contact details, hours of operation, a list of upcoming events at that restaurant with its own RSS feed and a full menu, specific to that location.

    See an example - Broadway, Vancouver BC.

     

    Some of the pages include videos as in this example of the Work at BP page.  The videos are hosted at Vimeo and streamed through their nice and clean player.

    Work at BP.

     

    A large number of people from Habañero worked on the project - I forget how many exactly, probably ...

    Full story

    Comments (2)

  • ASP.Net Dynamic Data + MVC

    Earlier in May, Microsoft released a code example of using the ASP.Net Dynamic Data web forms in the same project as MVC 1.0 controllers and views.  Download the MVCDynamicData zip file from CodePlex.

    The example uses the familiar Dynamic Data scaffold UI and includes MVC views and controllers - Note that the Dynamic Data UI in this example is not an MVC UI - more on this later... 

    Looking at what they've done, it seemed to be a pretty straightforward task of simply combining the folder structure of a Dynamic Data project with that of an MVC 1.0 project, including both Dynamic Data routing and MVC routing in the Global.asax and updating the web.config file. So, I tried it out...

    Update - June 1st - It's best to start with an MVC application and add the components for Dynamic Data as this will allow you to still use the built in Visual Studio tools for adding Views etc.

    Start with an MVC project and copy in the following from your Dynamic Data project

    • Folder: /DynamicData
    • Files: /Site.master - if necessary
    • Files: /Default.aspx - Rename this to DynamicPages.aspx
    • Files: /DemoModel.edmx - if you are using the Entity Framework.  Copy this into your /Models folder.

    Next update your Global.asax to include the Dynamic Data routing, making sure to add the "DD/" to the routing for the Dynamic Data:

    using System.Web.DynamicData;
    using System.Web.Mvc;
    using System.Web.Routing;
    
    namespace MvcApplication1 {
      public class GlobalApplication : System.Web.HttpApplication {
        public static void RegisterRoutes(RouteCollection routes) {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
          //Routing for Dynamic Data 
          MetaModel ...

    Full story

    Comments (0)

  • Importing and Exporting K2 Blackpearl Settings Between Environments

    I've been using a great tool recently for importing and exporting configuration settings from K2 Blackpearl recently and it's been working out pretty well.  My goal was to have all the K2 configuration stored in text files which I can save into my source code control system and easily modify for each of my K2 Environments.  The tool is:

    DepAuto

    http://www.k2underground.com/k2/ProjectHome.aspx?ProjectID=110 - You'll need to be logged in to the K2 Underground to reach this page.

    Here're the usage (/?) results:

    Exporting Settings

    Before using the tool, I created 4 K2 Environments through the K2 Workspace and filled in all the values for the Development Environment.

    I then exported all the settings from my K2 development machine, by running the command "DepAuto"

    > DepAuto

    This will create a Zip file on your machine named "localhostExport.zip" which I then extracted into a "Development" folder and have created other folders for each of our K2 Environments. 

    You'll notice if you then open up the Environment.xml file that it lists all of the Environments created in the K2 Workspace, but that all the other files are specific to one single Environment:

    Importing Settings

    My next step was to copy all 5 files into each of the other 3 Environment folders and change all the settings to match those Environments.

    The final step is simply to zip the files up, copy the zip to the relevant machine and then import the files into that Environment:

    > DepAuto /ImportZip:localhostExport.zip /Overwrite:true

    MsBuild

    I also built some MSBuild targets to help with the export and ...

    Full story

    Comments (0)

  • MSBuild Well Known Metadata

    There are a bunch of super handy metadata in MSBuild for referencing pieces of folder and file names when using Item Collections, and I found a complete list from the guys at C# Online.Net.  Say for example, you are selecting a bunch of files as follows:

    <CreateItem Include="C:\MyFolder\**\*">
      <Output ItemName="AllFiles" TaskParameter="Include"/>
    </CreateItem>
    

    Metadata

    In this case, we are searching a folder called C:\MyFolder, and if we have a sub-folder called MySubDir containing a file called MyFile.txt, then the metadata items are:

    Metadata Name

    Description

    Example

    Identity

    Value for the item specified in the Include attribute.

    C:\MyFolder\MySubDir\MyFile.txt

    Filename

    Filename for this item, not including the extension.

    MyFile

    Extension

    File extension for this item.

    .txt

    FullPath

    Full path of this item including the filename.

    C:\MyFolder\MySubDir\MyFile.txt

    RelativeDir

    Path to this item relative to the current working directory.

    C:\MyFolder\MySubDir\

    RootDir

    Root directory to which this item belongs.

    C:\

    RecursiveDir

    Used for items that were created using wildcards. This would be the directory that replaces the wildcard(s) statements that determine the directory.

    MySubDir\

    Directory

    The directory of this item. Notice that the Drive is not specified.

    MyFolder\MySubDir\

    AccessedTime

    Last time this item was accessed.

    2009-05-22 10:29:47.3567776

    CreatedTime

    Time the item was created.

    2009-05-22 10:29:47.3567776

    ModifiedTime

    Time this item was modified.

    2009-05-22 10:29:47.3567776

     

    You can refernce any of these metadata in your MSBuild script using the syntax %(AllFiles.Blah), substituting the 'Blah' for the metadata you need.

    Wildcards

    The wildcards available are:

    * - Match 0 or many characters.
    ** - Recursively search all sub-folders.
    ? - Match a ...

    Full story

    Comments (0)

  • Adding a Wait Indicator to Long Running Post-Backs

    Today I've been working on some UI customisations for SharePoint and have added a few user actions that take a handful of seconds to post-back, do their work and return the new page content.  During that few seconds, our users were experiencing unexpected errors if they clicked on various links or buttons on that page - not surprisingly as the page was waiting for the previous click to complete.

    I found a great and simple solution from Eric Wendelin.

    Add a div to your page

    First we add a div to our page or master page which we'll use as a mask, covering the whole page during the post=back. You can add an animated gif inside the div if you like, but you'll notice that not all browsers animate the gif during a post-back.

    <div id="mask"></div>
    

    Add a CSS class

    Then we use CSS to size the mask to cover the entire screen and place it right at the front of the page using the z-index. We make the mask invisible until it's needed, by setting 'display' to 'none'. And to get around the problem of IE not working well with the 'position: fixed;' style, we'll set the div to have a huge height so that it shows when you are scrolled down the page.

    /*
     For preventing the screen being clicked during postback operations
     opacity: 0.5;   // 0 to 1:  0 is fully transparent
     filter: alpha(opacity = 50); - IE 0 - 100:  0 is fully transparent
    */
    div#mask 
    { 
     display: none; 
     cursor: wait; 
     z-index: 9999; 
     position: absolute; 
     top: 0; 
     left: 0; ...

    Full story

    Comments (2)

  • Adding Tabs to SharePoint Central Admin

    As I was browsing through SharePoint Central Administration, like you do, I was looking at the tabs at the top left of the page and I thought I'd try to work out how to add my own tab.  A bit of Googling didn't turn up anything very obvious so I set about working it out.  Turns out, it's super simple, here's what you do:

    1. Add an ASPX page to \12\TEMPLATE\ADMIN.
    2. Add an entry to the "Top Link Bar" list.
    3. Bask in your new found administrative glory.

    Adding the ASPX page

    First, create an aspx page with the following content. Mine is called DanielsTab.aspx and has some text to help you see where each Placeholder shows up on the UI.  You can add all your configuration goodness in their place:

    <%@ Page Language="C#" MasterPageFile="~/_admin/admin.master" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderTitleBreadcrumb" runat="server">
        <span><a class="ms-sitemapdirectional" href="/">
            <asp:Literal ID="Literal1" runat="server" Text="<%$Resources:AdminResource, labelCentralAdmin%>" /></a></span>
        <span>> </span><span class="ms-sitemapdirectional">
            <asp:Literal ID="Literal3" runat="server" Text="Daniel's Tab" /></span>
    </asp:Content>
    <asp:Content ID="Content6" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
        
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
        runat="server">
        Daniel's Shared Configuration page
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageDescription" runat="server">
       Timer Job configuration goes here
    </asp:Content>
    <asp:Content ID="Content5" ContentPlaceHolderID="PlaceHolderMain" runat="server">
        More stuff goes here...
    </asp:Content>
    

     

    Updating the Top Link Bar

    Next we add the tab itself.  Navigate to Site Settings and look for "Top link bar" under the Look and Feel section:

     

    That will take us to a list of all the current tabs:

     

    Then, click on "New Link" and enter the link to the page you created above, eg: "/_admin/DanielsTab.aspx" and the text you want to see on the tab, eg:  "Daniel's Tab":

     

    Click OK ...

    Full story

    Comments (2)

  • My Favourite MSBuild Targets #4: DeployK2

    As with all our projects, we have setup continuous integration on the BigUtilityCorp project.  In order to integrate this we needed to be able to deploy the K2 Smart Objects and Workflow Processes to the K2 server on the command line using MSBuild.  The following code is an MSBuild task which I created based on some code on the K2Underground site, and extended it. 

    The biggest hurdle we came across in implementing this commandline MSBuild task was that, whenever you perform a build or deploy of a K2 solution, K2 requires that new class names are generated for it's .kprx and .sodx files and new GUIDs created for the objects deployed to the server.  This is done so that K2 can seemlessly version the Smart Object and Workflow Processes in the server, however in our development environment, we aren't worried about being able to support old versions of the Smart Objects or Workflows, so this was not necessary.

    The problem that this caused for us was that all our code is stored in TFS and so it's all read-only and cannot be edited unless checked out, however K2 was requiring that we check out all the files and change the class names to allow this versioning.  Of course, when running an MSBuild task, I may also have some of the K2 files checked out if I'm working on them, so I don't want to check everything out automatically, or set them all to be writable.

    The solution is to make an MSBuild task ...

    Full story

    Comments (1)

  • My Favourite MSBuild Targets #3: DeployReports

    I worked on a project a few months back where we need to automate the deployment of RDL files to Reporting Services.  After a bit of researching I found some handy scripts from Paul Stovell that show how to use Reporting Services Script files (confusingly hanv the file extension, .rss).  These files are rather VB script files that you pass into rs.exe and can be used to upload RDL files and create folders and data sources in the server.

    Being a fan of MSBuild, I wanted to use the scripts within my MSBuild directly, so using the approach I showed in my post about recreating databases with MSBuild, I built the target - DeployReports.

    <!-- =============================================== -->
    <!-- DeployReports -->
    <!-- Deploy a collection of RDL files to Reporting Services, creating the necessary folders and data sources -->
    <!-- http://www.danielflippance.com -->
    <!-- With script from the excellent - http://paulstovell.net/blog/index.php/reporting-services-automation/ -->
    <!-- =============================================== -->
    <PropertyGroup>
      <ReportsPath>$(MSBuildProjectDirectory)/Reports</ReportsPath>
      <DeployReportUrl>http://localhost/ReportServer</DeployReportUrl>
      <Temp>C:\Windows\Temp</Temp>
      <DbInstanceName>(local)</DbInstanceName>
      <DatabaseName>MyDatabase</DatabaseName>
      <DeployReportFolder>Reports</DeployReportFolder>
      <DeployReportDataSourceFolder>Data Sources</DeployReportDataSourceFolder>
      <DeployReportDataSourceName>MyDataSource</DeployReportDataSourceName>
      <DeployReportConnectionString>Data Source=$(DbInstanceName);Initial Catalog=$(DatabaseName)</DeployReportConnectionString>
    </PropertyGroup>
      
    <Target Name="DeployReports" >
      <Message Text="Start deploy reports to $(DeployReportUrl)" />
      <CreateProperty
        Value='
        Public Sub Main()
          rs.Credentials = System.Net.CredentialCache.DefaultCredentials
          If not path.StartsWith("/") Then
            path = "/" + path
          End If
          If not String.IsNullOrEmpty(reportSourceFile) Then
            Dim reportName As String = reportSourceFile.Split("\\")(reportSourceFile.Split("\\").Length-1)
            reportName = reportName.Split(".")(0)
            PublishReport(reportName, path, reportSourceFile)
          End If
        End Sub
    
        Public Sub PublishReport(ByVal reportName as string, byval path as string, byval reportSourceFile as string)
          Dim definition As [Byte]() = Nothing
          Dim stream As FileStream = File.OpenRead(reportSourceFile)
          definition = New [Byte](stream.Length) {}
          stream.Read(definition, 0, CInt(stream.Length))
          stream.Close()
          rs.CreateReport(reportName, path, True, definition, Nothing)
        End Sub
        '>
        ...

    Full story

    Comments (1)

  • My Favourite MSBuild Targets #2: RecreateDb

    Hot on the heals of my first post of exciting MSBuild shenanigans, I decided to follow up with a target to recreate a SQL database.  One of the really handy things I like in MSBuild is the ability to create scripts on the fly and replace parameters like they were tokens.  Creating SQL scripts is a natural use of this technique:

    msbuild /t:RecreateDb

    <PropertyGroup>
      <Temp>C:\Windows\Temp</Temp>
      <DatabasePath>$(MSBuildProjectDirectory)\Source\Database</DatabasePath>
      <DatabaseName>MyFunDb</DatabaseName>
      <DatabaseUserName>DOMAIN\user</DatabaseUserName>
    </PropertyGroup>
    
    <Target Name="RecreateDb">
      <CallTarget Targets="DropDb;CreateDb;CreateContents;AddUserAccess"/>
    </Target>
    

    This is built on 4 central targets, each of which is pretty much made by copying the relevant action SQL from SQL Enterprise Manager and replacing the DB name, user names etc with the relevant $(parameters), allowing you to manage all these names in the above PropertyGroup.  Thanks goes to Larry Lau for his original scripts on which this is based:

    DropDb

    <!-- Drop the DB if it exists -->
    <Target Name="DropDb">
      <CreateProperty Value="
        USE [master]
        GO
        /****** Object:  Database [$(DatabaseName)] Script Date: 02/19/2009 11:55:05 ******/
        IF  EXISTS (SELECT name FROM sys.databases WHERE name = N'$(DatabaseName)')
        DROP DATABASE [$(DatabaseName)]      
        ">
        <Output PropertyName="DbScript" TaskParameter="value"/>
      </CreateProperty>
      <WriteLinesToFile Lines="$(DbScript)" File="$(Temp)\DbScript.sql" Overwrite="true"/>
      <Exec Command="sqlcmd -b -S localhost -i $(Temp)\DbScript.sql"/>
    </Target>
    

    CreateDb

    <!-- Create a new blank DB -->
    <Target Name="CreateDb">
      <CreateProperty Value="
        USE [master]
        GO
        /****** Object:  Database [$(DatabaseName)]    Script Date: 02/19/2009 10:56:21 ******/
        CREATE DATABASE [$(DatabaseName)] ON  PRIMARY 
        ( NAME = N'$(DatabaseName)', 
    	  FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\$(DatabaseName).mdf' , 
    	  SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
         LOG ON 
        ( NAME = N'$(DatabaseName)_log', 
    	  FILENAME = N'C:\Program Files\Microsoft SQL ...

    Full story

    Comments (1)

  • My Favourite MSBuild Targets #1: Complete

    I'm a big fan of MSBuild.  It's got all this coolness built in for handling lists of stuff, throwing around parameters like they're tokens and all sorts of handy trinkets and third party goodies you can import.

    To explain how msbuild can help you with more development tasks than you would think, this is the first in a series of posts describing my favourite msbuild tasks for web development projects.

    On such a project, I typically setup one single msbuild target which does everything.  It does a bit of cleaning first, makes you a bright new database, fills it up with handy bytes, compiles all your code, runs all the tests, wraps up a nice deployment package, deploys it somewhere, then loads up the app with some handy test data that I can see when I login and makes you a nice cup of tea when it's all complete.

    msbuild /t:Complete

    Here's the target, in a verbose style for readability:

    <Target Name="Complete">
      <!-- Delete any bin/obj folders that might be pesky -->
      <CallTarget Target="Clean" />
    
      <!-- Make brand new DB - NOTE:  This will delete your old Db -->
      <CallTarget Target="RecreateDb" />
    
      <!-- Build all of the solutions -->
      <CallTarget Target="Build" />
    
      <!-- Run all the Unit, Integration and Web tests -->
      <CallTarget Target="Test" />
    
      <!-- Create packages which are deployable: .zip; .wsp etc -->
      <CallTarget Target="Package" />
    
      <!-- Deploy the package to wherever:  webserver; SharePoint -->
      <CallTarget Target="Deploy" />
    
      <!-- Load some data into the application so when I first open it, it's ...

    Full story

    Comments (0)

  • TwitterList - A User Control For Displaying Tweets

    If you look over there on the right side of this blog you'll see some of my recents tweets from Twitter. I'm sure you're as excited as I am about all the pointless things I tweet about, so if you want to do the same for your more ground-breaking tweets, here's the code for that user control.

    Usage:

    <dan:TwitterList id="Tweets" 
      Title="Dan's Tweets" 
      Count="5" 
      CacheDuration="300"
      FollowMeUrl="http://www.twitter.com/danielflippance"
      RssUrl="http://twitter.com/statuses/user_timeline/19988318.rss"
      RemoveText="danielflippance: "
      HyperlinkTweeple="true" 
      HyperlinkUrls="true"
      HyperlinkHashcodes="true"
      runat="server"/>
    

    The FollowMeUrl is just the Url of your Twitter Profile page, and half way down the right side of that page you'll see a link for the RssUrl - The link will read, for example:  RSS feed of danielflippance's updates.

    User Control .ascx

    <%@ Control Language="C#" AutoEventWireup="true" 
        CodeFile="TwitterList.ascx.cs" Inherits="TwitterList" %>
    <h3 id="TitleH3" runat="server"></h3>
    
    <asp:XmlDataSource id="TwitterRss" 
        DataFile="" 
        XPath="rss/channel/item" 
        runat="server"/>
    <asp:Repeater ID="TwitterRepeater" DataSourceID="TwitterRss" 
        OnItemDataBound="TwitterRepeater_ItemDataBound" runat="server">
        <ItemTemplate>
            <p><%# FormatTweet(XPath("title").ToString()) %></p>
        </ItemTemplate>
    </asp:Repeater>
                   
    <p>
    <a href="<%= this.FollowMeUrl %>">Follow me on Twitter</a>         
    </p>
    

    Code Behind

    using System;
    using System.Text.RegularExpressions;
    using System.Web.UI.WebControls;
    
    /// <summary>
    /// Author:  Daniel Flippance - http://www.danielflippance.com
    /// 
    /// A simple list for displaying Twitter results from an RSS feed.
    /// Allows the option of adding hyperlinks to Tweeple and Urls.
    /// Allows basic caching.
    /// </summary>
    public partial class TwitterList : System.Web.UI.UserControl
    {
      public string Title { get; set; }
      public int Count { get; set; }
      public int CacheDuration { get; set; }
      public string RssUrl { get; set; }
      public string FollowMeUrl { get; set; }
      public string RemoveText { get; set; }
    
      public bool HyperlinkTweeple { get; set; }
      public bool HyperlinkUrls { get; ...

    Full story

    Comments (2)

  • Progess Indicator for Long Running Tasks

    Often in our projects we find we have some processes that take a while to run, for example in the BigUtilityCorp project, a long running workflow that creates SharePoint team sites, uploads documents, populates list content and configures user access.

    We are using K2 to manage a process like this using workflow and wanted to give the user a good feedback mechanism of how that workflow was progressing, showing which step we had reached.  Here's a simple version of the progress indicator I created and what it looks like as it progresses and if one of the tasks fails:

    We'll be using the following technologies to build this indicator:

    1. JQuery for browser-side script.
    2. JSON to pass data from the web server to the browser and Scott Guthrie's JSON Extension for .Net 3.5 to convert our data into JSON.
    3. ASHX - You'll need to follow this post to set-up SharePoint to allow these.
    4. SharePoint API.

    We first declare the C# class we want to serialize as a JSON object:

    public class ProgressItem
    {
        public StatusEnum Status { get; set; }
        public string Text { get; set; }
    
        public ProgressItem() 
        {
            Status = StatusEnum.NotDone;
        }
        public ProgressItem(StatusEnum status, string text)
        {
            Status = status;
            Text = text;
        }
    }
    
    public enum StatusEnum
    {
        NotDone = 1,
        InProgress,
        Done,
        Error
    }
    

    Next we define an ASHX handler to return the progress values.  We start by implmenting the ability to return a list of the tasks in our process:

    if (context.Request["action"] == "list")
    {
        List<ProgressItem> items = new List<ProgressItemgt;();
        items.Add(new ProgressItem(StatusEnum.NotDone, "Site creation"));
        items.Add(new ProgressItem(StatusEnum.NotDone, ...

    Full story

    Comments (2)

  • Using ASHX Files in SharePoint

    When building an ajax-i-fied SharePoint application using JQuery, I like to use ASP.Net Http Handler classes - ASHX files.

    You will discover that by default, you can't add ASHX to a site in SP, so here's a quick note on how you can use them:

    1. Login to SharePoint Central Admin
    2. Go to Operations > Blocked Files
    3. Choose the relevant Web Application from the drop-down on the right of the screen - You probably want the one called "Site"
    4. Delete the entry "ASHX"
    5. Lob the .ashx files into your feature(s)
    6. Simmer for 20 minutes and deploy.

    Sorted.

    Update - July 3rd 2009 - Added the step to choose the relevant Web Application.

    Full story

    Comments (0)

  • TDD - Tea Driven Development

    In the spirit of this blog post, I respectfully present the following alternate use of the acronym TDD - Tea Driven Development

    Definition: 

    TDD - An acronym for Tea Driven Development;
    A Tea based approach to developing computer software;
    The belief that software is best developed in an environment where there is plenty of Tea;
    The practice of drinking a really large amount of Tea whilst developing software;
    Sometimes referred to as TeaDD.

    Concepts:

    The 3 tenets of TeaDD are:

    1. Ensure there is Tea.
    2. Start by making a nice cup of Tea.
    3. Continue the Tea throughout the software development lifecycle.

    The Tea Meeting

    Twice daily team members gather in a room for a short meeting where each member stands up, drinks Tea and makes general comments about what they are planning for the day and what they had for dinner yesterday.

    Saunter

    A period of typically 2 to 4 weeks in which software development is focussed around one particular variety of Tea. The team are relaxed and proceed through the Saunter in a casual but dignified way.

    Blueprint Brewing

    A meeting that occurs once every Saunter in which team members drink really hot cups of Tea and discuss how much Tea they are going to need to develop the required software use cases and which variety of biscuits (see also: cookies) will be purchased to dip into the Tea.  Voting is done using Tea Cards allowing developers to honestly give their point of view.

    Benefits:

    Throughout it's use, TDD has proved be a useful approach for ...

    Full story

    Comments (2)

  1. 1
  2. 2
  3. »