Saturday, February 13, 2010

SharePoint Sample Usage Blob Parser Error

SharePoint Usage Report

If you have SharePoint sites, one of the things that you want to know is how users is using the sites. To get that information, you want to analyze the users’ usage. From there you can find out which sites and pages that are popular, users’ usage patterns and trends. You can use those information to improve your SharePoint sites.

There are several ways in which you can get SharePoint sites usage information. The most common one probably through SharePoint Designer. Alternatively, SharePoint also gives us the usage information in a blob format. Blob can be a bit challenging to work with. You will need to parse the blob. But fear not, Microsoft has provided us with a sample usage blob parser. It is Windows SharePoint Services: Usage Blob Parser, which can be found here. The Usage Blob Parser is a simple windows application written in C++.

Compilation Error

After I downloaded the Usage Blob Parser, I tried to open the project with Visual Studio 2008. When I first open the project with Visual Studio 2008, the Conversion Wizard appear. It asked whether I want to convert the project into a Visual Studio 2008 project, which I did and the conversion process went without a hitch.

However, when I tried to build and run the project, I got 2 errors. Both errors are pointing to the same line of code. It is pointing to line 126 of Form1.h file. Here’re the errors that I got:

error C3867: ‘GetUsageBlobSample::Form1::button1_Click’: function call missing argument list; use ‘&GetUsageBlobSample::Form1::button_Click’ to create a pointer to member

error C3350:’System::EventHandler’ : a delegate constructor expects 2 argument(s)

Solution

To fix the errors, here what I did. I opened Form1.h file and go to line 126. On that line, I see the following line of code:

this->button1->Click += new System::EventHandler(this, button1_Click);

All I need to do is to modify it to the following:

this->button1->Click += new System::EventHandler(this, &Form1::button1_Click);

Once I did that, I was able to build and run the project.


Some Additional Notes

  • I came across this blog entry by Diego. He has written the SharePoint Blob Parser in C#. It was pretty good. I was able to download the code, made some minor tweaks and use it.

Tuesday, February 2, 2010

SQL Browser Service

So you have just installed SQL Server 2005/2008 Express. Everything looks good. You then opened SQL Server Configuration Manager. You then looked at the list of SQL Server services installed. You saw SQL Server (SQLEXPESS) service. You quickly thought, “That must be the database engine service. It’s up and running, cool.”

Then you also noticed SQL Browser service. Then you thought to yourself, “Hmm… what’s that? Should that service be running?”.

So, What is SQL Browser Service?

SQL Browser service was introduced in SQL Server 2005. In short, it is a service that provides information about SQL Server instances available on that particular SQL Server to clients. In addition, it also listen to client requests coming to SQL Server. For more information, you might want to read the following reference from SQL Server Book Online: http://msdn.microsoft.com/en-us/library/ms181087.aspx.

Do We Need to Have SQL Browser Service Running?

Well it depends. If you have a named instance of SQL Server (by default, SQL Server 2005/2008 Express is installed as a named instance), and the SQL Browser Service is not running, you might run into some problem connecting to the named instance remotely. For the sake of illustration, let say that you have installed SQL Server 2005 Express, as a named instance of SQLEXPRESS on one of your server named FOOBAR. You then open SQL Server Management Studio on another workstation, and you try to connect to the SQLEXPRESS instance that you’ve just installed. When you are presented with the Connect to Server window, you typed in FOOBAR/SQLEXPRESS. Now if you don’t have SQL Browser Service running, you will most likely get the following error:

Cannot connect to FOOBAR\SQLEXPRESS
Additional information:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server)

If you have your SQL Browser Service running, you will not get this error. In order to start SQL Browser service, you can do it through the SQL Server Configuration Manager.

Some Additional Notes

  • You can actually connect to your name instance SQL Server remotely without having to start running SQL Browser server. To do this, you need to specify the port number that the named instance listen to. You can get the port number from SQL Server Configuration Manager. If you are trying to connect using SQL Server Management Studio, to connect to a named instance on a specific port number, you need to use the following syntax on the server name: [Server Name]/[Instance Name],[Port number]. For illustration, if you have FOOBAR as your server name, SQLEXPRESS as your instance name and 1234 as the named instance port, you would type in the following on the server field: FOOBAR/SQLEXPRESS,1234 (Notes: Remember to use comma instead of colon).
  • You don’t need to have SQL Browser service running if you are connecting using Shared Memory connection (locally).