Search This Blog

Wednesday, March 31, 2010

Track time spent for your custom code

SharePoint 2010 has built in monitoring for tracking time taken for code operations.
We can use that in our custom code also: SPMonitoredScope
Since this uses IDisposable interface we will put in a using clause:

using (SPMonitoredScope monitorScope = new SPMonitoredScope("My Query Time Test"))
void myFunction()
// Function logic here


How to use the above:
Once we have the code compiled and deployed - and the developer dashboard is enabled (please see another post in this blog on how to enable developer dashboard) this will show us the length of time spent on executing myFunction. Neat ... Is'nt it?

Monday, March 29, 2010

SharePoint Designer 2007 giving issues - clear the cache..

Close SPD --> execute batch file --> Open SPD and check...

Put this in a batch file:
cd "%APPDATA%\Microsoft\Web Server Extensions\Cache"

del *.web /S /Q "%APPDATA%\Microsoft\Web Server Extensions\Cache"

cd "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\"

rmdir /S /Q "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache\."

mkdir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"

dir "%APPDATA%\Microsoft\Web Server Extensions\Cache"

dir "%USERPROFILE%\AppData\Local\Microsoft\WebsiteCache"

Thanks to my friend Scott for creating a batch file for this.
I had done this manually in the past...

Friday, March 26, 2010

Failed to start the database service MSSQL$OfficeServers. Repair this product by selecting it from the Add/Remove Programs menu.

I had uninstalled this officeserver and installed SQL 2008 express for a demo server.
While there are some other solution available on this error: I fixed it by changing a different registry
Here it is:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\EvaluatorProvisioning\DatabaseEngine]


Changed the ServiceName value to the new SQL Express instance and Config Wizard started to work again...

Sunday, March 21, 2010

Using Locked Pages for SQL Server 2008

Select * from sys.dm_os_process_memory

gives us Information on locked pages.
How does that help? Locked pages can improve SQL Performance to an extent and afterall SQL is backend for SharePoint.

Here is very good article on AWE/PAE and other switches
Here is an excerpt from the above blog:
Now then, so why considering x64 Architecture if we have AWE?
The use of SQL Server (32-bit) with AWE has several important limitations. The additional memory addressability is available only to the relational database engine’s management of database page buffers. It is not available to other memory consuming database operations such as caching query plans, sorting, indexing, joins, or for storing user connection information. It is also not available on other engines such as Analysis Services.
For more detailed information, refer to:
Advantages of a 64-bit Environment

SQL 2005:
DBCC Memorystatus