Archives

Archives / 2011 / April
  • Session Timer for Windows Phone 7

    Tags: Windows Phone 7

    Once in a while even a SharePoint addict does something else but SharePoint and so has I. I've been fiddling a bit with a Windows Phone 7 application. Actually the application has been available in the Windows Phone marketplace for two months now (thanks to those who downloaded it or even purchased it). But now it's up to version 2.0 where all my initial wanted features are in place, thanks to a huge delay when flying into Seattle this weekend.

    The application is called Session Timer. It's a WP7 app that allows you to plan your presentation sessions into segments and time them so that you can use your WP7 as a counter while presenting. Why you say, isn't that what PowerPoint presentation mode is for? Yea - if you're only using PowerPoint! I often do presentations where I have PowerPoint on the big screen and the outline on my laptop. But when it comes to doing demoes in virtual machines, Visual Studio or other non-presentation-mode aware applications you have to either stand looking over your shoulder on the big screen or flip back and forward between extended or duplicate screen. And this is where this application fits. Or when you're doing presentations without PowerPoint presentation mode - which in many cases is better (I remember the keynote from PDC08 where Chris Sells and Don Box did a command prompt and notepad only session - one of the best shows I've seen ever).

    So, in Session Timer version 2.0 you can create multiple sessions (trial limited to two) and each session has none or more segments (trial mode is limited to three). Each session has a running time and a title and each segment has a start time, title and color. The screen will always show your session and counting down the time for the whole session and for each segment individually. You can also see the title of the upcoming segment. Since each segment has a color that is reflected as the background color for the segment. This allows you to easy see what parts of your presentation you are in - for instance your demos might always have red background. You can also turn on vibration for each segment as an extra reminder.

    Here's some screenshots of the application.

     

    Do you think this sounds interesting, then download the trial on the Windows Phone Marketplace by clicking on the tile below:

    If you have any feature requests or find any anomalies - please head on over the the Session Timer Facebook page and discuss it.

  • Get rid of the annoying SPAN tags in SharePoint 2010 pages

    Tags: SharePoint 2010

    For quite some time I've been pretty annoyed (and that's an understatement) of the strange span-tags generated by the output of pages in SharePoint 2010. Not only are they annoying they also make the markup invalid, since the span tags are omitted after the closing html tag (duh!).

    Spans, spans, spans

    So in order to get to the bottom of this I decided to face my fears and entered debugging mode. It only took me a few minutes to find out what was going wrong, and I didn't even have to step (almost) through any SharePoint code to find it out. Here's what I found and how I found it...

    First I enabled the Developer Dashboard and turned on the ASP.NET page trace. I immediately noticed the following controls being added to the control tree at a suspicious location. The SPPageStateControl, a top-level control in the control tree, had 17 child controls - the exact same number as empty span tags being omitted. Probably not a coincidence.

    The mysterious controls...

    I checked the master page (v4.master) and could not find the SPPageStateControl. It must be inserted dynamically then, so I fired up Reflector and did an analysis of that control and found out that it's instantiated by the WikiEditPage during the OnLoad event. And the control is inserted directly as a child to the page object. Hence the rendering of the span-tags after the closing html tag. The SPPageStateControl inherits from SPControl (which inherits from Control) and produces no output - so this one was not the bad guy.

    I turned to the child controls (SaveCommandHandler etc) which all are inheriting from SPRibbonCommandHandler. And the SPRibbonCommandHandler inherits from the WebControl - if you know your ASP.NET basics then you know that a WebControl outputs a span tag, if nothing else is specified. Eureka!

    Get rid of 'em!

    So, how do we get rid of these span tags then? We can't just go into the SharePoint code and override the RenderBeginTag and RenderEndTag of the SPRibbonCommandHandlers, and we can't change the SPRibbonCommandHandler to inherit from something better; for instance a plain ol' Control (thanks Waldek). What do we have in our toolset then? ControlAdapters of course!

    After a quick analysis of the SPRibbonCommandHandlers (and the controls inheriting from it) I've found out that none of them requires to render anything (I've not tested every scenario available so I'm not giving guarantees here). I should be safe building a control adapter that makes the SPRibbonCommandHandler not rendering anything, not even a single pesky span. These controls are only present to handle different postback scenarios and handle server-side commands from the Ribbon, so they do not need to do this span-rendering-frenzia.

    Using the exact same technique that I use in my SharePoint 2010 Web Parts in Action book to register ControlAdapters (get the book if your looking for the details - or download the WSP linked to at the end of this article), I created a solution that completely removed the spans.

    First I created a control adapter like in the following snippet. We just override the Render method and make it do nothing.

    namespace Wictor.NoSpans {
        [Guid("78e05555-17b6-44b7-95ea-3db315058b1a")]
        public class RemoveTheSpansAdapter: ControlAdapter {
            protected override void Render(System.Web.UI.HtmlTextWriter writer) {
                //base.Render(writer);
            }
        }
    }

    This adapter must be registered using a Browser Definition File (.browser). This file contains the original control full name and the target control like this:

    <browsers>
      <browser refID="default">
        <controlAdapters>
          <adapter
            controlType="Microsoft.SharePoint.WebControls.SPRibbonCommandHandler,                     Microsoft.SharePoint, Version=14.0.0.0,                      Culture=neutral, PublicKeyToken=71e9bce111e9429c"
            adapterType="$SharePoint.Type.78e05555-17b6-44b7-95ea-3db315058b1a.FullName$,                     $SharePoint.Project.AssemblyFullName$"/>
        </controlAdapters>
      </browser>
    </browsers>

    The .browser file must be deployed to the App_Browsers folder of the respective web application. This is done by a timer job, that copies the file from the feature to the Web Application App_Browsers file. That is; we're creating a feature that targets a Web Application. [Commercial] Full code for this is available in the book[/Commercial].

    All we have to do next is deploy the control adapter, browser definition file using the WSP and start the timer job via the feature. Next time the page load we will not see the seventeen annoying empty span tags! Phew!

    No more spans

    Download the WSP file here to get rid of your spans...

  • Happy Birthday SharePoint - 10 amazing years!

    Tags: Personal, SharePoint, SharePoint 2010

    Earlier today Jeff Teper, Microsoft Corporate Vice President, wrote about the 10th birthday of SharePoint. This post made me lean back and close my eyes for a while and think back of what has happened during the last decade - and it is a lot of stuff! And I've playing with SharePoint more or less since then!

    iBizkitThe SharePoint story for me started back in 2000. I was running my own company, iBizkit, and we built a "SharePoint like" Intranet portal product. The product was modular based and very configurable. We hade something we called Modules based on COM+ components and XML output, that had a common interface and a single rendering engine which could translate the XML output to HTML, WML or whatever depending on the device and the users settings. I was, and am, still very proud of that architecture. Initially we looked at the Digital Dashboard, but came to the conclusion that it didn't fit our needs, so we built our own from scratch. It was built on top of Site Server (and then later on AD), IIS, ASP and COM+. We got a request from a customer that they would like a document management system for their Intranet. And what could be better than building it yourself - use a third party tool. And at that time I've been checking out the Tahoe project from Microsoft, that later became SharePoint Portal Server 2001SharePoint Portal Server 2001. What we did was build a more dynamic interface (way before AJAX was known as AJAX, and this is where Robert Nyman started his brilliant JavaScript career). than SPS 2001 had and incorporated that into a module in our portal solution. I dug up on old screenshot:

    SNAGHTML33c116e

    This gave me a great introduction to the SharePoint world. The document management module was a great success - and I think we were one of the companies in Sweden that actually managed to sell a few SPS 2001 licenses :-).

    SharePoint Portal Server 2003Then Microsoft Office SharePoint Portal Server 2003 and WSS 2.0 arrived! Based on .NET with all new API's and stuff - but the lack of real document versioning. We once again incorporated SharePoint into our portal - also now built on .NET. But since there was no real versioning our clients stayed on the SPS 2001 platform. I actually spent about six months trying to build decent versioning on top of SPS 2003 - without any good results. Microsoft Office SharePoint Server 2007And that project ended when the betas of Microsoft Office SharePoint Server 2007 and WSS 3.0 was released. And from that day I was totally hooked!

    For the last time we adapted our document management module to SharePoint and continued our portal product - but in parallel we started plain ol' SharePoint consulting. As time went the SharePoint consulting part took overhand for me and we could not longer compete with our small niche product. In 2009 I left my dear old company, which we sold a couple of years earlier, in chase of even greater SharePoint adventures.

    Microsoft SharePoint Server 2010In 2010 I was awarded SharePoint MVP, and now again in 2011. I just released my first book, about SharePoint of course, called SharePoint 2010 Web Parts in Action.

    Why is SharePoint so damn special then? First of all it's a great product - no doubt about it. Microsoft has sold a gazillion licenses, it's their fastest growing server product ever! But why am I still loving this so much? There are several reasons; first and foremost it's my will to build great things that the customers like. What can be better to base that of a great platform. Secondly is that it's quite a challenging product that gives you never ending obstacles and situations - which makes me learn more and grow more. Third is the amazing community - I do not think that there are many alike out there.

    I thought that I should end this with a link to a very, very old article, from back in February 1999. This is an article where Mary Jo Foley (who knows more about Microsoft than Microsoft themselves do) for the first time mentioned the product that we all love: MS readies next-generation software.

    Thank you all and thank you Microsoft. Looking forward to ten more great years!

  • Understand Top Browser statistics in SharePoint 2010 Web Analytics

    Tags: SharePoint 2010

    AnalyticsThe Web Analytics feature in SharePoint 2010 is a great new addition and allows you to get some insights on how your users behave whether it's an Intranet, Extranet or a public facing web site.

    One of the reports is called Top Browsers and shows which web browser that the users are using to access the site. For a public facing web site this report might make sense but for an Intranet the results may cause you a headache if you do not understand how to interpret the data.

    Let's assume that you have an Intranet with a standardized web browser platform with Internet Explorer 8. If you take a look at the statistics you will first notice that the most used browser is Internet Explorer 7, following that are most often Unknown and/or Netscape4. Internet Explorer 8 is coming later down (together with instances of Safari, Firefox, Chrome etc. - some people just have disobey the corporate rules :-).

    So why is Internet Explorer 7 the top used browser then - this is really easy to find out since on intranets IE8 and IE9 uses the Compatibility mode by default, that is it's acting as IE7 and sends that user agent string (see MS-IEDOCO 2.1.2.5). So the Web Analytics treats this session as an IE7 session. The default master page (v4.master) adds the X-UA-Compatible meta header which switches the document mode to IE8 though during runtime.

    What about Netscape4 and Unknown then? These requires us to understand a little bit more about how SharePoint is used on an Intranet. An Intranet is not just used by a web browser, people are requesting information using for instance the Office clients (Word, Excel etc.). When the Office clients talks to SharePoint through the WebDAV protocol it sends its own user agent string (for instance: Microsoft Office/14.0 (Windows NT 5.1; Microsoft Outlook 14.0.4734; Pro)). Web Analytics does not "recognize" this one and places it in the Unknown bucket. The Netscape4 browser comes from the same source but are used when detecting which version SharePoint has, when the Front Page Server Extensions requests the _vti_inf.html file.

    I hope that this gave you some insights in how the SharePoint 2010 Web Analytics interprets the user agent strings.

  • SharePoint MVP for another year

    Tags: Personal, SharePoint

    The 1st of April is one of those days when a fourth of all MVPs just waits for the renewal e-mail from Microsoft. Luckily I got mine this year, just before heading home from work this afternoon. This means that I will do my second term as a SharePoint MVP and I'm already looking forward to the paintball in a cold a rainy Seattle!

    Congrats to all other renewed and new MVPs all around this globe.

    image

AWS Tracker

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action