Friday, August 19, 2011

Designing a video Streaming Portal - Part 1

The core idea is to build a video streaming portal which leverages SharePoint assets and also ensure that the solution is not burning our pockets. This solution will be totally based  on Free software or the software which the cost was already included with operating system license and with bare minimal code.

Software involved:

Implementation

Windows Media Streaming Services
          Deploy and enable Windows Media Streaming services in a Windows Server 2008. This service is capable of streaming video files in MMS or HTTP protocol, depends upon the client which is requesting. If the request is raised from Windows Media player then the server switches to MMS protocol, for any other clients it'll be HTTP protocol. This is called as Protocol roll-over.
          Windows Media Streaming services support WMV,WMA,asx and wsx file formats.Among this asx and wsx are play list format. So convert your videos to WMV videos.If your video library is full of FLV and flash files then its worth taking a look IIS Media Services.
            Map the video folder to appropriate publishing points, this will give you a unique end point to each and every media file. If you've enabled HTTP protocol then this will create a web application in IIS default port 80. It is recommended to expose HTTP protocol along with MMS protocol because MMS is compatible only with Media player client.If you are planning to build your own streaming client then your ideal end point would be HTTP.

SharePoint Foundation 2010
           Create a custom list and add columns Title, description, endpoint and comments. If you want to capture more metadata about the media asset, pile up here. Populate the list with the list of publishing points which are exposed by Windows media streaming services. It gives a chance of automation but for the sake of simplicity we are populating it manually.
           Develop a web part which lists all entries in this list on a left pane and Windows Media player ActiveX control on right pane. Whenever the user selects a video on left pane, modify the url property of ActiveX control and start playing. Let the ActiveX control do all heavy lifting for us.

SharePoint Search Server Express 2010
             SharePoint Search server express is good enough for small organization to start with and to get a flavor of Enterprise Search experience without any additional cost. Although it comes with the limitation on items which gets crawled it is a best fit for this solution.
              Deploy SSX2010 and configure the search and managed meta data(if required).Initiate an crawl on the content and get it indexed. Create a search center and test the search results. Now edit the search results web part to include "endpoint" managed meta data in query columns list. Modify the search results XSLT to render a small thumbnail of Media player plug-in which allows the user to play the videos right there in the search results
 
 Configuration , setting up the servers, pros and cons will be part of next post...

Sunday, July 31, 2011

How to setup wireless broadband in Ubuntu 11 ?

Although a Microsoft fan boy, just wanted to taste the Linux flavor for awhile. To understand the things on Linux universe, installed Ubuntu 11 on my windows Server 2008 R2 with the help of WUBI. Now setting up the Tata Photon+ Wireless broadband on Ubuntu.

Select the Add/Edit connections from the Network menu from your top right bar


 Select the Mobile broadband tab and click on Add, Choose Huawei from the combo box

 Ubuntu comes with these many providers pre-configured for India, Can we expect this is Win 8 ?
 Apply the settings and start using the network.
No installation of drivers from a mounted disc drive, no need to install any third party software(Tata Photon software) and no more hassles. It's simple and amazing.

Love this feature from Ubuntu.

Wednesday, June 29, 2011

Microsoft Community Contributor Award

Received my Microsoft Community Contributor award for my contributions to Microsoft online technical communities this morning.



Thanks to Microsoft Community and online support team for recognizing community contributors.

Tuesday, June 7, 2011

Querying calendar list by meeting workspace Url

Calendar list doesn't support querying the list by a workspace url making it a daunting task for finding a recurrence meeting workspace URL in Calendar list. U2U CAML editor and SharePoint views are unable to break this nut.

The trick to accomplish is to pass the relative URL for the CAML segment for querying. Following code snippet helps better understanding.

//removing the Server hostname and protocol, eg:- stripping http://Foo from http://Foo/meetingsite
string hostServer = meetingWeb.Site.Protocol + "//" + meetingWeb.Site.HostName +":" + meetingWeb.Site.Port;
searchUrl = searchUrl.Replace(hostServer, string.Empty);
SPQuery qry = new SPQuery();
qry.Query = @"<Where><Eq><FieldRef Name='Workspace' />
 <Value Type='URL'>" + SPEncode.UrlEncodeAsUrl(searchUrl) + "</Value>" +"</Eq></Where>";
qry.ViewFields = @"<FieldRef Name='Title' />
              <FieldRef Name='Location' />
              <FieldRef Name='EventDate' />
              <FieldRef Name='EndDate' />
              <FieldRef Name='fAllDayEvent' />
              <FieldRef Name='fRecurrence' />";
DataTable tbl= list.GetItems(qry); 

Sunday, June 5, 2011

CrossListQueryInfo and CrossListQueryCache gotchas

CrossListQueryInfo class which comes with the Microsoft Publishing infrastructure makes use of object caching techniques to query the requested data from the cache instead from the database. Remember to use this facility only if your code runs against a MOSS server and not on a WSS server. As this makes use of  object cache stored in WFE servers, it avoids to database input/output and network latency between the WFE's and database server.

Although it uses SPSiteDataQuery internally,the very first request using CrossListQueryCache takes more time than SPSiteDataQuery. Practically it includes the time for querying, caching and returning the values. But subsequent queries fetch results in a flash and no where comparable with SPSiteDataQuery.

Interesting fact is that this CrossListQueryCache and QueryInfo will not work in a Console line tool, it badly depends on the context. If you are really trying this interesting query technique in a web part, whenever you implement any change in your webpart and trying to debug. Apart from doing the IISReset/App pool recycle, don't forget to flush the object cache

A sample CrossListQueryCache
public DataTable GetDataTableUsingCrosslistQuery(SPSite site)
{
CrossListQueryInfo clquery = new CrossListQueryInfo();
clquery.RowLimit = 100;
clquery.WebUrl = site.ServerRelativeUrl;
clquery.UseCache = true ;
clquery.Lists = "";
clquery.Webs = "";
//clquery.Query = "";
clquery.Query = "569";
clquery.ViewFields = "";
CrossListQueryCache cache = new CrossListQueryCache(clquery);
DataTable results = cache.GetSiteData(site);
return results; 
}

Tuesday, May 10, 2011

Multiple NT authentication prompts in MOSS 2007 Server

In our team, people usually build their own development machines from the scratch and recently faced this multiple authentication prompt issue while accessing central administration right after the PSConfig wizard execution.

We tried all the browser tricks
  • switching off the IE Enhanced security configuration
  • Adding the site to IE's Local intranet zone
  • Checking the IE cookie storage setting and Authentication settings
Nothing worked, still there were multiple  authentication prompts and Fiddler showing many HTTP 401 requests. Even without providing the username and password, by pressing the ESC key continuously we were able to reach the Central administration home page. But none of the Ok/Cancel button worked as expected and leaving the Central admin console useless.

Finally Manimaran,  found a  Microsoft's KB article 95271, which clearly says you guys might be trying to install IIS 6.0 on top of a Windows Server 2003 SP2.

The machine was patched with Windows Server 2003 SP2 and we installed IIS 6.0 using an RTM disc which apparently reverted some libraries to its older version especially asp.dll. Replacing only this library didn't workout and I don't want to re-install OS Service Pack 2 again.

Workaround without re-installing Win 2003 SP2:
  • Keep Win 2003 SP1 and SP2 installation media handy in a drive.
  • Extract I386 content of these service packs using an archive tool, mine is 7zip
  • Uninstall SharePoint server and delete the content databases in database.
  • Remove the machines application server role and Uninstall IIS 6.0
  • Add Application server role , Install IIS 6.0 
  • Whenever the installer prompts for files to install point to the folder where you extracted SP2
  • In case if you don't find the files in SP2 folder, drill down in SP1 folder else in RTM disc.
Thats it now start installing SharePoint now.

Wednesday, April 20, 2011

Continuous Integration and remote deployment for SharePoint

This is a short guide of setting up a Continuous integration server and integrating with different plugins to analyse the code quality. At the end of the pipeline, we'll deploy to a remote staging server. The core idea is to build the solution on top of open source stack rather than  proprietary solutions like TFS.

Setting up Continuous Integration server:

  • Although there are tons of CI tools available in the market,as CruiseControl.Net looked for great for integrating various tools we picked up CruiseControl for our implementation.
  • Install CruiseControl.Net on a designated build server
  • CC.NET supports various source control blocks CVS,Subversion,VSS,SourceGear, StarTeam etc.
  • Download a command line client for the source control repository, for Subversion download this CollabNet Subversion command line client
  • Upon successful installation, browse to the folder C:\Program Files\CruiseControl.NET and open ccnet.config file in a text editor.
  • Add the project level detail

<project name=" testProject">
<workingDirectory>C:\develop\project1WorkingDir </workingDirectory>
</project>
  • Add source control block, which contains the SVN repository end point and credentials required to access these resources.
<sourcecontrol type="svn">
<trunkUrl>svn://Foo/trunk</trunkUrl>
<Working Directory>C:\develop\project1WorkingDir </workingDirectory>
<username>ccnet </username>
<password> ccnet </password>
</sourcecontrol>
  • Now we've added a Subversion URL with required credentials to access 
  • Let's add a Trigger block to tell the integration server at what frequency it should get latest and do a build. set the frequency as 360 seconds.
<triggers>
<intervalTrigger name="Subversion" seconds="360" buildCondition="ForceBuild" />
</triggers>
  • Add a Task block for building the solution, CC.net supports various build automation engines such as MSBuild, VSDevenv,NAnt  etc. We'll configure for MSBuild.
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
<WorkingDirectory>C:\develop\project1WorkingDir</workingDirectory>
<projectFile>Sampleprojects.sln</projectFile >
<executable>
</tasks>
  • Alternatively if you want to use Visual studio to build the solution, following fragment will be helpful
<devenv>      
<solutionfile>C:development\Foo.sln</solutionfile>
        <configuration>Debug</configuration>
        <buildtype>Clean</buildtype>
        <executable>C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe</executable>        <buildTimeoutSeconds>360</buildTimeoutSeconds>
      </devenv>
  •  Add an Executable Task in this section after the build task for integrating other third party analysis tools like Microsoft FxCop for static code analysis, SPDisposeCheck tool for memory leak test, Microsoft StyleCop etc.
</exec>
<exec executable="C:\Program Files\Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe">      <buildArgs>C:Foo\bin</buildArgs>
</exec>
  • Above Exec snippet requires all binaries to be stored in a single folder to run SPDisposeCheck, this can be done by adding a post build command in CS Project files.
  • Integrate Unit test case execution tools and code coverage tools like MSTest and NUnit test.
Package and move to staging server
  • Add a Exec task tag for WSP Builder
<exec executable="C:\Program Files\WSPTools\WSPBuilderExtensions\WSPBuilder.exe"><baseDirectory>C:\Foo\solutions</baseDirectory>      <buildTimeoutSeconds>360</buildTimeoutSeconds></exec>
  • Add a task which executes a xcopy command to move all these wsp packages to a staging server
<exec executable="C:\WINDOWS\system32\xcopy.exe">
<buildArgs>C:\Foo\Solutions\Output.WSP\*.wsp \\md-stagingSvr\share</buildArgs></exec>
Remote deployment with Sysinternal's PSExec

  • Add  another exec task to invoke PSExec tool to do the remote deployment
  • Alternatively if you have Windows Powershell in these machines you can make use of power shell to do the remote deployment.
<exec executable="C:\SysinternalsSuite\psexec.exe">
<buildArgs>\\md-stagingSvr-u "md-stagingSvr\aravind" -p 123$ "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" -o addsolution -filename c:\share\output.wsp</buildArgs></exec>