Wednesday, September 29, 2010

SharePoint Blog Site, CKS:EBE and Video Streaming

My last project was to create a few blogs in SharePoint 2007 platform for an USA based fashion house. Those blogs are different from the normal blogs – the main contents of the blogs are images and videos. In an average, each post consists of min 8 pictures, min 1 video and 1 or 2 single line of text.

To provide them cost effective, rapidly developed, stunning UI based blog sites, we have used mainly 3 components -

  • SharePoint Blog Sites
  • The Community Kit for SharePoint: Enhanced Blog Edition (V 2.0) and
  • FlowPlayer free version (Free version available under the GPL license)

This post is mainly regarding – How to stream media files within SharePoint Blog sites created using CKS:EBE 2.0.

Before we start, do the following things:

  1. Create a SharePoint Blog Site using CKS:EBE (for help: CKS:EBE 2.0 Final Release - CodePlex)
  2. Download FlowPlayer free version (URL: FlowPlayer Download Section)
  3. Download following files (These are also FlowPlayer installation files V 3.2.4)

Unzip what you have downloaded at 3rd point and rename the extracted contents as written below:

  • –> flowplayer –> Place this folder in your ‘Layouts’ folder present in the 12 hives (E.g.: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\flowplayer)
  • –> UOJS –> Place this folder in your ‘Layout\1033’ folder present in the 12 hives (E.g.: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\UOJS)
  • –> flowplayer –> Place this folder in your ‘Layout\1033’ folder present in the 12 hives (E.g.: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\1033\flowplayer)

Now, to have your web pages play videos with Flowplayer, you must embed Flowplayer in those pages. So, open up the master page of your blog site using SP Designer and place the following lines of code inside the head block of the master page:

<SharePoint:ScriptLink id="js_jquery" language="javascript" name="UOJS/jquery-1.3.2.min.js" runat="server"/>   
    <SharePoint:ScriptLink id="js_flowplayer" language="javascript" name="flowplayer/flowplayer-3.2.4.min.js" runat="server"/>
     <script type="text/javascript">
        jQuery(document).ready(function() {           
            $('a[rel*=fp]').flowplayer('/_layouts/flowplayer/flowplayer-3.2.4.swf',  {
              clip: {
                 autoPlay: false,
                autoBuffering: false,
                bufferLength: 5

and save the master page.

Sample Screen Shot:


Now, store some media files in your blog sites ‘Media’ document library. In my case, I have created another folder named ‘Video’ in the ‘Media’ document library and have stored videos inside them:


Now, go to your blog site created using CKS:EBE and select the ‘Create Post’ option available under ‘Blog Admin’ section. In the ‘NewPost.aspx’ page, give title to your post, select the body and then select the ‘html’ editor button as shown below:


In the HTML editor, enter the text and the url of your media files in the following way:


Select OK and then Select Publish and go to your blog site and hit F5 and you are done. Here is your blog page streaming media files stored in your own document library :)



Friday, September 24, 2010

Analyzing .Net Assemblies with NDepend


“NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality. With NDepend, software quality can be measured using Code Metrics, visualized using Graphs and Treemaps, and enforced using standard and custom Rules.” – When I visited their site for the first time, I thought it must be just another tool in the market. But, today after using it for a test run, I must say ‘This is THE TOOL in the market’ to what they called ‘Make your .NET Code Beautiful’.

Today I am going to write about one of the many features available in this beautiful tool – Analyzing .Net Assemblies. Today morning one of my team has delivered a small module to me for review purpose and I started reviewing it with NDepend. So, here we go:

Open NDepend and select the highlighted option as shown below:

NDepend Home Screen

Next, you browse/drag-drop assemblies that you want to analyze and select OK:

Add assemblies

Now, NDepend analyzes the assemblies and shows the result in one web browser window and if you want, the result can be shown in the tool itself. I went for the second option and here is the result –

The resultant screen after the analyzation process

So far, so good… 13 warnings mostly related to other assemblies couldn’t be found type. So, lets explore how beautiful code my boys have written.

Dependency Graph:

As I am not bothered with Microsoft’s patterns and practices related functionalities, we will look into our Business Entity, Business Logic and Data Access Classes.

Dependency Graph

So, the dependency among the assemblies are perfect. Next we are going to focus on the interaction that is going to happen between Business Logic((BL) and Data Access Layer(DAL). So, I have selected Dependency Matrix and placed my mouse at cross section of BL and DAL and the result is ‘7 methods of the BL assembly is using 8 methods of the data access class’(Look at Dependency Info panel at the right hand) :

Dependency Matrix

Left click on it to find out detailed results:

Graphical View

Wooowww… Great work by NDepend and my team also!!!

So, these are the methods written by my team. Let’s explore one of them – the 2nd one ‘UpdateUserRegDetails(UserRegDetails)’. Just select the that method and the summary can be found at the right hand side ‘Method Info’ section:

Reviewing each method

IL Instruction is 57 i.e., less than 100 and so good for the health of the method.

I am a little bit confused on ‘Percentage Comment’ output as after seeing a big zero (0 comment!!!), I immediately opened up the solution and found comments are present across all the methods as per my checklist!

Cyclometric Complexity higher than 20 is bad and in our case though the result is 0, my calculation says it should be 1, but may be our base formula are different.

ILCC below 20 is acceptable and in our case it is 6.

So, in this way I was able to review the code base pretty quickly and it helped me to take a loooong coffee break :) 

One can use a metric view also to have a look at the solution as shown below:


Another fundoo feature of the tool is CQL query editor with intellisense – I am loving it…

CQL Query Editor

So all together we can say only 2 words : NDepend Rocks :)

Saturday, September 18, 2010

IMP: ASP.NET Security Vulnerability @ Scott Guthrie

All of my fellow developers and readers,

"A few hours ago we released a Microsoft Security Advisory about a security vulnerability in ASP.NET.  This vulnerability exists in all versions of ASP.NET." - Scott posted this on his blog. And this affects all the SharePoint based projects also. And its really a big vulnerability for all of the ASP.NET based applications.
Please go through the Scott's blog post and fix your solution asap. Select the following link to visit the post:

Important: ASP.NET Security Vulnerability

Other meaningful blog post: vulnerability-in-asp-net-and-sharepoint.aspx by SP Team Blog