Archive

Posts Tagged ‘Coding’

CBS Gives March Madness Gives a High-Quality Makeover with Silverlight

February 23rd, 2009 Kasper de Jonge No comments

Another big implementation with Silverlight that gets my basketball hearth beat faster !

CBS Sports is adding a high-quality viewing option to its March Madness On Demand (MMOD) video player.

2009_mmod_hq_player

The new player uses Microsoft’s Silverlight (CBS has a history with Microsoft and previously used the Windows Media Player). You can stream all 63 tournament games in standard definition at approximately 550kbps, or enjoy a sharper picture with the high-quality player with streams delivered up to 1.5 mbps.

Microsoft’s video technology already proved it can handle big sporting events during last year’s Olympics. Though Silverlight isn’t as ubiquitous as Flash, Microsoft says more than 100 million PCs have installed Silverlight 2.

Source: http://newteevee.com/2009/02/15/cbs-gives-march-madness-gives-a-high-quality-makeover/

Flickr: Found in space

February 20th, 2009 Kasper de Jonge No comments

Ok and now for something completly different, i found this today at flickr code blog:

A robot intelligence has invaded Flickr. The “blind astrometry server” is a program which monitors the Astrometry group on Flickr, looking for new photos of the night sky. It then analyzes each photo, and from the unique star positions shown it figures out what part of the sky was photographed and what interesting planets, galaxies or nebulae are contained within. Not only does the photographer get a high-quality description of what’s in their photo, but the main Astrometry.net project gets a new image to add to its storehouse of knowledge. Needless to say this is one of the coolest uses of Flickr groups and the API that we’ve ever seen. I recently discussed the project with team member Christopher Stumm, since he was the one who had the idea to hook it into Flickr.

Your scale and rotation invariant hashing algorithm is fiendishly clever. Where does it come from?

It’s an adaptation of an old idea in computer vision — “geometric hashing” — to astronomical images. It was originally created by researchers who were trying to model associative memory; “that shape reminds me of something I’ve seen before”. The idea works great for astronomical pictures, because stars are easy to locate exactly. By adding a fast search method for similar-shaped arrangements of stars, and a check that eliminates coincidental matches, we’re able to match an image against the whole sky, usually in a matter of seconds.

Some people are so smart, i’m realy jealous :) But still time to take out the camera and start shooting the night sky !

Categories: Coding, General Tags: , ,

PerformancePoint Monitoring + Silverlight: KPIs and Scorecards

December 1st, 2008 Kasper de Jonge No comments
PerformancePoint Monitoring doesn’t have as robust a prescription as Silverlight Blueprint for SharePoint, but yes, PerformancePoint Monitoring & Silverlight can be used together.

PerformancePoint dashboards are SharePoint web part pages, so web parts or master pages using Silverlight for menus, visualization, charting, or any other thing, are right at home in (or surrounding) a PerformancePoint dashboard.
Another integration point is the web service PmService.asmx. You can learn more about this service through PerformancePoint SDK documentation of its client proxy. In this article we’ll call the GenerateView method of this service to retrieve and work with a scorecard/KPI data set, and visualize that data in Silverlight 2.

For more read this msdn post:
 

WPF Datagrid CTP

August 14th, 2008 Kasper de Jonge No comments
Lester from MS anounounced WPF datagrid:
One of the common requests from LOB customers has been the Datagrid control. Its not there is SP1 but we have released the CTP version of this control on Codeplex.
 
In addition, it also includes VS templates for building GPU shader based effects.. http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962
 
 
Categories: Uncategorized Tags: ,

Software Quality control at Last.FM

August 1st, 2008 Kasper de Jonge No comments
The people at Last.FM have decided to let the public in on some Quality control features they have installed.
 
See here how they have integrated some monitoring tools en Build software into their Platform development.
Categories: Uncategorized Tags:

Sharepoint unittesting with typemock

June 16th, 2008 Kasper de Jonge No comments

We would like to test all our code by means of Unittests, now when using sharepoint this is difficult because code has to be executed against a live Sharepoint server with your latest site definition rolled out. This is not just impractical but also very slow, especially the fist time.

A colleague came with a solution, why don’t you try mocking. After some googling i came across the following article: First steps with TypeMock and the Sharepoint API. After reading this i decided to download TypeMock and try it out. TypeMock turns out to be a very powerfull mocking framework (to some too powerful) which allows us to mock the sharepoint framework very easy.

An example of a unittest with some code which gets a relative URL from a picture from a picturelibrary. The code:

///


/// Return the url of the Picture from a PictureLibrary by ID
///

/// Id of the picture/// Picture url
public static string GetPicturLinkById(int PictureId, SPWeb currentWeb)
{
   string PictureLink = string.Empty;
   //Open the picture library
   SPPictureLibrary Picturelibrary = (SPPictureLibrary)currentWeb.Lists[Resources.ProjectResources.PictureListName];
    try
    {
       //Get the SPListitem with id PictureId
       SPListItem PictureListItem = Picturelibrary.GetItemById(PictureId);
       //Get the ServerRelativeUrl
       PictureLink = PictureListItem.File.ServerRelativeUrl;
    }
   catch (Exception ex)
    {    //If the item doesn’t exist in the coll. return empty string
         if (ex is ArgumentException)
         {
               return string.Empty;
         }
         else
         {
             throw new Exception(“Error while retrieving a picture url”, ex);
         }
     }
     //return the url
     return PictureLink;
    }

The unittest code

[Test]
public void GetFotoLinkByIdTest()
{
    const string FILENAME = “/test/file1.hpg”;

     Mock mockSPweb = MockManager.MockObject(Constructor.Mocked);
    Mock spListCollection = MockManager.MockObject(Constructor.Mocked);
    Mock spPictureLibrary = MockManager.MockObject(Constructor.Mocked);
   Mock listItem = MockManager.MockObject(Constructor.Mocked);
   Mock file = MockManager.MockObject(Constructor.Mocked);
   //Expect get of relativeurl, fill the call with FILENAME
   file.ExpectGetAlways(“ServerRelativeUrl”, FILENAME);
   //Expect get of FILE, fill this with out SPFILE mock file
   listItem.ExpectGetAlways(“File”, file.Object);
   //Expect a call to GetItemById, return our SPListItem mock file
   spPictureLibrary.ExpectAndReturn(“GetItemById”, listItem.Object);
   //Expect a get at an idex which returns our SPPictureLibrary mock listItem
   spListCollection.ExpectGetIndex(spPictureLibrary.Object);
   //Expect a get of the attribute lists of SPWeb, return our mocked SPListCollection
   mockSPweb.ExpectGetAlways(“Lists”, spListCollection.Object);

   //Instantiate SPWeb rootWeb with our mocked object
   SPWeb rootWeb = mockSPweb.MockedInstance;
   //Check wheter filename is returned from the function
   Assert.AreEqual(FILENAME, Recept.GetFotoLinkById(1, rootWeb));
   //Verify of all code is called
   MockManager.Verify();
}

Typemocks reflecting allow you to start testing your code without rewriting all your existing code to Interfaces. You can even test static methods and step into your code while unittesting! Typemock is really a recommendation when you want to unittest your sharepoint Code.

Categories: Uncategorized Tags: ,

Export custom Sharepoint List Definitions (schema.xml)

June 2nd, 2008 Kasper de Jonge No comments

When creating a custom list for provisioning you need to manually edit the horrible Schema.XML file. Now there are a few methods to do it the easy way. Just create the lists and export the XML file to your solution

You can use Sharepoint Spy (doesn’t work under Server 2008). It allows you to spy into the internal data of SharePoint and compare the effects of making a change. Sharepoint Spy also allows you to compare settings between sites, lists, views, etc helping you troubleshoot configurations. Or you can use the STSADM toolm “OCDExportList“, you could imply from its name it allows you to export the List Definitions.

Categories: Uncategorized Tags: ,

Provision smartpart (or other custom webparts) with a site definition (onet.xml)

May 26th, 2008 Kasper de Jonge No comments
Smartpart uses some custom properties to point to the usercontrol. I found a really simple trick to find the code you need to embed to you onet.xml.
 
Just open your sharepoint site, add smartpart to a webzone, make your smartpart settings. Go to Edit -> Export. Save the file as a XML file. Copy everything excluding the first line and past it into your onet.xml in the CDATA part of your AllUsersWebPart. Et voila your custom webpart is ready for deployment, just dont forget to install and activate the custom webpart.
Categories: Uncategorized Tags: ,

WSSv3 Using a custom topnavbar using XMLSitemap

May 19th, 2008 Kasper de Jonge No comments

After provisioning the site as seen in: How to provision a site (with master page and default.aspx) in WSSv3 using a site definition I want to add a custom menu to the topnavbar. I decided to use the XmlSiteMapProvider so I can use a simple XML file to define the menu layout. When you want to use a custom XML you have to add a value to the web.config of the sharepoint site to point to the XML file, i want this menu to be added by default when a site is created so i will add it to my site provision

Step 1: Create a sitemap file and place it in TEMPLATE\Layouts\Cmenu.Sitemap, for example:







Step 2: Add the xml file as a new sitemapprovider to the web.config in a feature:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
  {     SPWeb siteCollection = (SPWeb)properties.Feature.Parent;
        SPWebApplication webApp = siteCollection.Site.WebApplication;

        SPWebConfigModification modification = new SPWebConfigModification();
        modification.Path = “configuration/system.web/siteMap/providers”;
        modification.Name = “add[@name='CMenu']“;
        modification.Sequence = 0;
        modification.Owner = “FeatureReceiverSiteLayout”;
        modification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
        modification.Value = ““;

            webApp.WebConfigModifications.Add(modification);
     //    webApp.WebConfigModifications.Remove(modification);
        // Save web.config changes.
        webApp.Farm.Services.GetValue().ApplyWebConfigModifications();
        // Serialize the web application state and propagate changes across the farm.
        webApp.Update();
        siteCollection.Dispose();
}
Use the webApp.WebConfigModifications.Remove part to remove the item from the web.config. Take note the FeatureDeactivating will not be be called when a site is deleted, use the FeatureUninstalling when you want the the item removed from the web.config at site delete.

Step3: Change your master page with the following:

  • find the asp:ContentPlaceHolder id=”PlaceHolderHorizontalNav” tag, place the following above it: ““. This creates the link from SiteMapDataSource to your XmlSiteMapProvider.
  • Edit the datasource propertie of  asp:ContentPlaceHolder id=”PlaceHolderHorizontalNav” to: DataSourceID=”SMCMenu”

The page will now use the your XML file as navigation

Step 4: When provisioning a site using a site definition you would like the feature to autmomaticly add the changes to the web.config. To do this you have to add:

  • Find the ID of the feature in feature.xml
  • Find the node in ONET.XML
  • Place a new WebFeatures in de the WebFeatures tag under configuration “
           
  • Now the feature will be activtivated on site creation.

Keep in mind that the feature has to be deployed to the server first, again this is posible with WSPBuilder

Categories: Uncategorized Tags: ,

WSSv3, Provisioning a site (with master page and default.aspx) using a site definition

May 19th, 2008 Kasper de Jonge No comments

I have to create a site in Sharepoint (Wss) with a default pages in complete custom layout and custom menu and it has to be created as a package so the Wss site can be deployed to multiple sites.

I started by developing the master page with heather solomon’s simple masterpage as basis, Then i decided to develop a few features to deploy the master page, install the menu and provision a few standard pagelouts to the site. The master page and menu worked, but provisioning the default.aspx is not possible with features.

So I decided to make a switch to provision with a site defenition instead of features, it has some advantages over features, you can use the site definition to create a site at once instead of using the feature’s.

Step 1: Create your own Sitetemplate.

  • Go to “12\TEMPLATE\1033\XML” and copy the file WEBTEMP.XML to WEBTEMPYOURTEMPLATE.XML
  • create your own template config:


  • Mind the ID part, just use a ID that doesn’t exist in WEBTEMP.XML .
  • create a directory in “\12\TEMPLATE\SiteTemplates\YOURTEMPLATE”
  • create a directory XML in your just created sitetemplate directory
  • Copy ONET.XML from “12\TEMPLATE\SiteTemplates\sts\xml” to “\12\TEMPLATE\SiteTemplates\YOURTEMPLATE\XML”
  • Your site template will work now, nothing is changed though

Step 2: Create a master page and place it in “\12\TEMPLATE\SiteTemplates\YOURTEMPLATE\”

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

     
  • Your master page will now be provisioned
  • To use it with all your provisioned pages find the Configuration ID=”0″  again and add the tag MasterUrl, like this: “

Step 3: Create site layout pages to provision and place them in “\12\TEMPLATE\SiteTemplates\YOURTEMPLATE\”

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

         
         
           
                                 http://schemas.microsoft.com/WebPart/v2″>
                            Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
                            Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
                            None
                                  None
                           
                      

                       ]]>
           

         
  • You now will have 2 pages under http://yoursite/Sitepages based upon you own site layout pages defined in the Url propertie. This code will add a content editor webpart to your pages.

Step 4: Provision the new Default.aspx based on your own page layout

  • Find the node in ONET.XML
  • Place a new module in de the Modules tag under configuration “
  • under the main node find and add:

         
           
                                 http://schemas.microsoft.com/WebPart/v2″>
                            Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
                           Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
                            None
                                  None
                           
                      

                       ]]>
           

        
Categories: Uncategorized Tags: ,