Wednesday, May 16, 2012

Virtualization on Client OS – Part 1

Virtualization on Client OS – Part 1 – Setting up Development Environments using Virtual Box

Virtualization has changed the way we manage and setup our IT systems including our Development/Testing/Production environments. The benefits of Virtualization are well known and documented on the internet and outside scope of this post. I wanted to discuss the Virtualization options for Client OS.

Hyper-V from Microsoft is a great product, and often used as the Virtualization platform for projects on Microsoft stack. However, Hyper-V is not available for Microsoft Client Operating System (Windows XP, Vista and Windows 7). It is available only for server OS - Windows 2008 R2.

Note: In Part 2, I will discuss how this is changing in near future.

So if I have a laptop running Windows 7, what are the options for Virtualization????

VMWare has some good Virtualization products for Client OS like Windows 7.

They are licensed products, so you can’t just download, install and start using VMWare for your projects. There is a cost involved and you need to factor in the same in your project pricing estimation.

The Virtual Hard Disc’s for Hyper-V (with a .vhd extension) are not directly compatible with VMWare (which uses its own proprietary format). You can use VMWare converter to convert from one format to other, but it’s a time consuming process and can take ages.

The various Demo virtual hard disc’s provided by Microsoft come with a .vhd extension.

So if I have a laptop running Windows 7, what are the options for Virtualization????

Microsoft Virtual PC is what I have used in past on Win XP, but I haven’t seen any recent updates for Virtual PC. I am not sure if MS wants to continue or kill the product with the superior Hyper-V.

So if I have a laptop running Windows 7, what are the options for Virtualization????

Virtual Box (i.e. Oracle VM Virtual Box) is an alternative that I explored. It’s a free software under GNU (but please check with Legal for hidden Terms and Conditions).

The Virtual Hard Discs with .vhd extension can be used for Virtual Box.

The installation and setup was easy (Click Next, Next, Next, I Accept). The Wizard helps you setup a new virtual machine and you can choose to create a new virtual hard disc or use an existing one.

Note: You need to do the change documented here to make existing .vhd work in Virtual Box

During installation/configuration, it will ask you whether you want to install the network drivers. Select Yes and proceed. After the VM is setup, it will configure the drivers and network adapters. After logging in to VM, Internet was up and running within the VM. This is cool as we have sometimes struggled to achieve the same in Hyper-V with machines having single NIC’s.

I had previously copied a .vhd file (having Windows 2008R2 OS) to my machine and it took me less than half hour to install, setup and have an VM machine up an running.  


Performance:

I haven’t tested and benchmarked Virtual Box Performance against HyperV, VMWare or other products. Though I have limited first hand experience, I have friends who have been using Virtual Box for long time and are satisfied. It seems to be pretty decent on my laptop having low end configuration.


Sample Usage Scenarios:

I have SharePoint 2010 running on my Win7 laptop, and MOSS 2007 running on the Virtual Machine. This allows me to execute an SharePoint Upgrade project. I can use the same MOSS 2007 image (.vhd) which I had previously downloaded from Microsoft.

It is not limited to setting up SharePoint Development environments, and Virtualization can be used for projects on any technology.


In terms of Hardware Resources, you still need to have sufficient RAM/Hard Disc space and a decent CPU to meet the requirements of both your Host and Guest Operation System.


Demo:

Best way is to download, install and use it.


My Recommendations:

For all your Official project purposes, Use Hyper-V with Windows 2008 R2 on your high end servers.
For your Home PC or Low End Laptop running Windows Client OS, VirtualBox is a good product which can meet your need.


In Part 2 of the series, I will discuss how Windows 8 changes the game.

Wednesday, March 14, 2012

Junk Characters displayed in User Name

We created a custom membership and role provider for SharePoint 2010. The first time the user log’s in, the User Name is displayed in the format 0#.f|sqlmember|username

We observed that the junk characters are displayeded only the first time user logs ins. On subsequent login, the user name is properly displayed. Try with the out of box membership and role providers that ship with ASP.Net, and you will face the same issue.
Quick Fix to above problem: Use JavaScript on Page Load and hide the junk characters.

Below is some sample JavaScript/jQuery that one of my colleagues Vikram wrote, which you can further customize to your needs.

var welcomeObj = $("#zz15_Menu");
if (welcomeObj.length == 0)

        welcomeObj = $("#zz16_Menu");

if (welcomeObj.length != 0) {

     var userName = welcomeObj.children("SPAN").html();

        if (userName.indexOf("0#.f|sqlmember|") != -1) {

         var newUserName = welcomeObj.children("SPAN").html().replace("0#.f|sqlmember|", "");

            welcomeObj.children("SPAN").html(newUserName);

        }

    }

I consider it a quick fix. Its not guaranteed to work in future versions of SharePoint.

A more elegant solution will be to find out the root cause, fix it in the membership and role providers, or probably override the Welcome User name control. But if you are short of time like we were, the quick fix might come to your rescue.

The characters are not actually junk, as I have been wrongly calling them in my post so far. They represent the Claims in the encoded format.  Details of the claims encoding format are available on Wictor’s blog

Monday, January 30, 2012

SharePoint Anonymous Users and Managed Metadata Columns

I was working on a SharePoint 2010 internet facing site, which will have Anonymous Users.

We allowed Anonymous Users access to the site using the steps document on Tech Net and other places on the internet.

While rest of the site worked as expected for anonymous users, the web parts which queries information from a SharePoint List having a column of type managed metadata, failed. It gave the following error:

Value does not fall within the expected range
at Microsoft.SharePoint.SPListCollection.ItemByInternalName(String strInternalName, Boolean bThrowException)  
at Microsoft.SharePoint.SPListCollection.get_Item(Guid uniqueID)  
at Microsoft.SharePoint.Taxonomy.TaxonomyField.GetLookupList(SPSite site)  
at Microsoft.SharePoint.Taxonomy.TaxonomyField.GetGuidOfWssIdFromHiddenList(SPSite site, Int32 id, Guid& termSetId, Guid& termId)  
at Microsoft.SharePoint.Taxonomy.TaxonomyField.GetGuidOfWssId(SPSite site, Guid sspId, Int32 id, String& termId)  
at Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue.get_TermGuid()  
at Microsoft.SharePoint.Taxonomy.TaxonomyFieldValue.ToString()  
at VisualWebPartProject1.VisualWebPart1.VisualWebPart1UserControl.Page_Load(Object sender, EventArgs e)


If we accessed the same page using an Authenticated User and then accessed the same page as an anonymous user, it seemed to work. I suspect Caching is internally at play.

To troubleshoot, you need to know a little bit about how MMS works and the TaxonomyHiddenList, which as the name suggest is an hidden list.

The URL for the list is similar to that of any other list at the top site collection level:

http://Sitecollection/lists/taxonomyhiddenlist

When you browse to the list, and look at the permissions for the list, you will notice that the permissions for the list are broken. The following was the permission for the list.

To resolve the issue, I re-inherited the permissions. And it fixed the issue. As simple as that.

After re-inheriting the permissions, the System Account now has Limited Access instead of Full Control granted earlier.

While there are no side-effects in our case, there is a possibility that if you have a list or library where users have Contribute permissions but not to rest of the site, it may break. In such a case, I would try the following:

1.       ReInherit the Permissions

2.       Break the Permissions again

3.       Add All Authenticated Users(NT AUTHORITY\Authenticated Users) with Read permissions and change the permissions for System Account to Full Control. Basically, the base site permissions, plus the special permissions for All Authenticated Users and System Account.

Thursday, December 08, 2011

SharePoint 2010 Lookup Columns & Projected Fields Limitations

SharePoint Lookup Columns and Projected fields are great way to build relationships between various lists.
However, there is a small limitation: You cannot lookup on Choice Columns, Lookups to other lists columns.
For e.g. I can establish a relationship to Title (Single Line of Text) Column, but not to Status (Choice) Column in my primary list.
On the Created Column UI, after you select the list, they are not listed in the dropdow to select the column (In this column:). They are also missing from the project fields check boxes (Add a column to show each of these additional fields:)
Quick Cheat Sheet: Created a Calculated Column in the Master List referring your original Choice Column.
SharePoint allows Calculated Columns to be used as Lookup Columns or Projected Fields in your Child List.

Thursday, November 24, 2011

SharePoint Content Export and Import – Importance of retaining GUID’s

We had to move some stuff from one environment to other.

There were number of Pages, Lists & Libraries, etc. The Pages has static content, custom and Out of Box Web Parts and whatever else you will normally have on a large SharePoint site.
There were 100+ pages, so it was not feasible to recreate them manually on destination environment.

We initially used SharePoint Granular Backups, available in Central Admin, to export from Source and then import using PowerShell into Destination environment. We restored the lists and then the pages library.

Post restoration, we had all the pages. Some of the pages worked as expected. However, webparts on some pages will not work as expected. For e.g. the Content Query Web Part (CQWP) will not display content and display a message that the query fired is not valid.

Guess, what was wrong? What were we missing?

The CQWP seems to internally keep a reference to the List GUID and not the List name. Same with few other web parts like the Image Slider Web Part.

To resolve, we exported using Content Management API and while importing, ensured that we retain the GUID’s. All the web parts are not working as expected.
We used Chris o'brien’s Sharepoint Content Deployment wizard  which is available on CodePlex for export and import. We however plan to replace it with PowerShell to automate the deployment process.

Note: You cannot import the list twice with same GUID to same content database. It will throw an error.
Key message of this blog: Important to retain GUID’s while exporting and importing lists and libraries if you have dependent pages/web parts internally referring them using GUID's

Monday, October 24, 2011

Enterprise Search market consolidation

Microsoft purchased FAST in Jan-April of 2008.
HP bought over Autonomy in Aug 2011.
And now Oracle buys Endeca in Oct 2011.

The Enterprise Search market is consolidating and getting serious, with big boys buying out the smaller players.
Will Microsoft, with FAST+SharePoint Search+Bing in its kitty, have an early mover advanatage over others in the Enterprise Search space?

Saturday, September 17, 2011

Installing PowerPivot for SharePoint on Denali

One of our enterprising team have installed SharePoint 2010 on Denali (SQL 2010) and things have been smooth so far.

While trying to install “PowerPivot for SharePoint” on the Server, we ran into the following error:

SharePoint version requirement for PowerPivot for SharePoint failed.

We were initially misled into thinking that it’s a Denali and not SharePoint issue. The Denali log files and Windows event viewer logs did not help.

To fix the error, you need to know the following:

·         BI Features are available only on SharePoint Enterprise edition. They are not available on SharePoint Standard edition.

·         How to check whether you are have Standard or Enterprise Edition installed. There is an option in Central Admin where this can be checked. Go to CAàUpgrade and Migration à Convert farm license type and it will display the current license type

·         A valid and genuine Enterprise License Key for SharePoint Server.

·         How to upgrade from Standard to Enterprise. You don’t need to re-install SharePoint. It can be upgraded by simply providing the key through the Central Admin.  If you run into issues, you may want to refer my previous blog post

As you have guessed by now, we were on Standard edition. We upgraded to Enterprise and then re-installed ‘PowerPivot for SharePoint’. Everything worked like a charm this time.