May 13, 2010

Creating Graphs or Charts in SharePoint and WSS Lists ( sparklines )

Sparkline are small graphs which generally indicates the trends or variations associated with entities like stocks, temperature, currency and so on. Nothing can express better then a picture itself (Note: Typo for the Temperature in the screen shots)

Implementation Steps

1) Create the SharePoint List or Document Library with the require data as shown below



2) Add some calculated fields like average, max, min in the List as shown below


In similar fashion calculate the Minimum and Average using the formula field.

=Min(January,February,March,April,May,June,July,August,September,October,November,December)

=Max(January,February,March,April,May,June,July,August,September,October,November,December)


3) Create a calculated column called "variation", which will have the chart populary called Sparkline

Add the following formula, as shown in the screenshot below:




i.e. ="<DIV><IMG src='http://chart.apis.google.com/chart?cht=bvs&chs=200x125&chd=t:"&[January]&","&[February]&","&[March]&","&[April]&"............................&chco=4d89f9,c6d9fd&chbh=20&chds=0,100' /></DIV>"

4) Create a View having the following columns
           City, Variation, Min, Max and Average
    Navigate to the View and it will appear as shown below:

 

5) Edit the Page and add Content Editor Webpart at bottom of the page in hidden mode with the following source

6) Now the Sparkline Graph should appear as shown below




OR

References

http://code.google.com/apis/chart/docs/making_charts.html

http://viralpatel.net/blogs/2009/04/generate-pie-bar-line-charts-using-google-chart-api.html

May 6, 2010

SharePoint Portal does not render properly in Internet Explorer or Internet Explorer Crashes for SharePoint Portal

Portal does not render the content pages properly, although the master page is coming quite well.

We tried bunch of things, like setting the IE to default settings, looking into the logs, Javascript Error and so on.

What worked is starting the Internet Explorer in safe mode ....

Click Start > Run > iexplore -extoff


Update:

Internet Explorer Crashes, when clicking on items in the document library.

This generally occurs, when we update office from 2003 to office 2007, or lets say downgrade office 2007 to office 2003 or some other office 2007/2003 related installs.

Either use
Click Start > Run > iexplore -extoff

or apply the following patch if possible

Microsoft Hotfix link




If this wouldn't have solved the issue, I would have rather started the client machine Operating System in Safe Mode, so that only basic components are loaded and anything customized or configured because of the other applications are not loaded.

May 3, 2010

Measuring Application Performance on Windows Server and the Key Perfomance Counters or Indicators

The performance counter data helps determining system bottlenecks and fine tune the application performance. We can utilize the "perfmon utility" on the server. Start > Run > Perfmon and this brings up the perfmon console. Other testing tools which can gather performance counters are Load Runner, VSTS, ...

Steps to measure perfomance counters using out of  box "Perfmon":

1) Download the following "Performance Monitor Wizard" on your server

2) Execute the wizard by double clicking it, give it a name, select terminal server, select all counters, specify path where to save log file and finish the wizard without starting it. So, now we have configured a perfmon template.

3) Open Perfmon, when you want to collect performance counters

4) Start and Stop the configured perfmon (lets say in our case configured template name is "t") as shown below.







Analyze the collected data i.e. performance counters

In the perfmon, do the following as shown in the below image






Click on the data tab and select the counters as shown below:



Now the graph below shows the performance counter selected:


Few Important Key Performance Indicators or Performance Counters to Monitor

Object                                                   Performance                                   Counter Indicates

Processor                                             % Processor Time/_Total                   Processor use level


Memory                                               Available Bytes                                  Amount of memory available


Network                                              Interface Bytes Total/sec                    Amount of network traffic traveling to & from test client
                                                                                                                      (Network contention).


Memory                                              Memory\Pages/sec                             The number of paging operations to disk during the 
                                                                                                                      measuring interval, and this is the primary counter to watch
                                                                                                                      for indication of possible insufficient RAM to meet your
                                                                                                                      server's needs.



The counters mentioned above can help to find out the possibly the bottlenecks and can help in deciding whether to scale up or scale wide. Generally, thumb rule is processor on an average during peak hours should not exceed 60% and page fault should not be more then 50 per seconds.

Apr 28, 2010

SharePoint Extranet Website using Form Based Authentication (FBA) via SQL Database User Store

Develop Content Management, Business Process Management, etc application onto the SharePoint Site, and the site by default is available via intranet using Active Directory user authentication.

We can go ahead and expose the application on intranet site to the external word i.e. extranet or anonymous user via provisiong a extranet site on top of the existing intranet site. The extranet site can leverage authentication using Form Based Authetication (FBA) mechanism via SQL database as the user store.

Implementation Steps:

1.  Double click C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe and follow the wizard. By default, ASPNET_RegSQL.exe will be using the ‘aspnetdb’ database for storing user data.

2.  Use Asp .Net WebSite Administration Tool to access the aspnetdb created in above step.

Under the website menu, select the option for ASP.NET Configuration.

3.  Modify/Replace connection string and membership provider in the web.config (replace connection string and System.web) by value shown below

<connectionStrings>
<add name="SP_FBA_DB_SQL_CONN_STRING" connectionString="server=2003Server\SQLEXPRESS; database=BP_FBA_DB; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<membership defaultProvider="SP_FBA_DB_AspNetSqlMembershipProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""
/>
</providers>
</membership>

<roleManager enabled="true" defaultProvider="SP_FBA_DB_AspNetSqlRoleProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" applicationName="/" />
</providers>
</roleManager>

4. Create user FBA_Admin in fba database and users (optional), using the step 2

5. Go to Central Admin in SharePoint

6. Create New Web Application for Intranet

7. Create Site collection using publishing portal template

8. Extend created web application and change zone to extranet

9. Change Web.config for Central Admin, and both web apps created Please Note Central Admin config uses

<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
<connectionStrings>
<add name="SP_FBA_DB_SQL_CONN_STRING" connectionString="server=2003Server\SQLEXPRESS; database=BP_FBA_DB; Integrated Security=SSPI;" providerName="System.Data.SqlClient" />
</connectionStrings>

<system.web>
<membership defaultProvider="SP_FBA_DB_AspNetSqlMembershipProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false"
passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""
/>
</providers>
</membership>

<roleManager enabled="true" defaultProvider="SP_FBA_DB_AspNetSqlRoleProvider">
<providers>
<add name="SP_FBA_DB_AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="SP_FBA_DB_SQL_CONN_STRING" applicationName="/" />
</providers>
</roleManager>

10. Go to Central Administration > Application Management > Authentication Providers Change Extranet to:





11. Go to Central Administration > Application Management > Site Collection Owners

       Add FBA_Admin as secondary site collection administrator



12. Test Sites, by login to intranet and extranet sites


13. Last but not the Least

       Manage FBA Users via WebParts on your Extranet Site



References:

SharePoint Development or Coding Practices to avoid slow performance (i.e. performance degradation)

Few pointers on SharePoint Development or Coding: Best Practices


  • Http Modules and Http Handlers
    • Know the difference between Http Module and Http Handler before using it
    • HTTP module is always called as part of the page processing pipeline, a poorly designed or faulty module can have a detrimental effect on performance or perceived stability of the environment. Thoroughly test each module for performance before deploying it.
    • Use Custom Http Handlers To Improve Performance in ASP.NET (rarely used)


  • Ghosting vs Un-Ghosting
    • All the Pages in the SharePoint are stored in the SQL database but some SharePoint pages lying in the layouts folders on the server are accessed as is. These pages have null as an entry in the sharepoint database. i.e. Ghosted Pages are not stored in the SQL database, they reside on the SharePoint Server folders. The Ghosted pages become unghosted when we modify them (like using SharePoint Designer).
    • Do not unghost the ghosted pages, as this will contribute in degrading the performance.

  •  Custom Stored Procedures preferred compared to SQL Queries
    • Measure performance using SQL Profiler
    • Keep transact SQL smaller, as these create locks.

  • Create Views
    • When we need to pull data from multiple tables and have complex multiple joins. It's preferred to create the views and write queries on top of it, instead of writing and calling complex queries on demand.

  • SharePoint List Views
    • Use proper Index in the SP List Views, i.e. column used in the filter of the views

  • Web Applications in the Farm (2-2-1)
    • Do not have more then 5-7 web applications in the medium size farm
    • Each web application should have it's own application pool

  • NTLM vs Kerbores authentication
    • Kerberos caches information about the client after authentication. This means that it can perform better than NTLM particularly in large farm

  • SSL (http vs https)
    • SSL mostlty degrades the performance

  • Server Round Trips
    • Code to avoid server round trips

  • Views Size
    • Views size should not be more then 2000 items.


 coming more soon ...

Pages