Sunday, December 21, 2008

Perfmon counter labels turned to numbers

While I executing a few troubleshooting steps in local dev environment, I opted to put some perfmon counters to monitor the performance of the code. Unfortunately all the perfmon counters turned to numbers instead of their subsequent labels.

Tried adding all .net by using following lodctr command (This command is responsible for updating all performance monitor counters and their explain texts)

lodctr C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\corperfmonsymbols.ini
lodctr C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.ini


but no luck, not able to see the counters back.

Finally rebuilding the whole counters did the trick

lodctr /R

For those who are not able to succeed even after this command can try the following Microsoft Support article
How to manually rebuild Performance Counter Library values
Troubleshooting Performance Monitor Counter Problems

Tuesday, December 9, 2008

IIS management console presents blank window

You open the IIS management console using Inetmgr and you are presented with a empty console no application pools, no web sites, no virtual directories.

This happens occasionally on IIS 6 /IIS 7 which is hosting SharePoint sites. The very quick fix for this issue is restarting Sharepoint's OWSTimer service or make an IISRESET.


Microsoft support explains as follows
"Consider the following scenario. You have a process that has more than one thread. Additionally, the process uses the Internet Information Services (IIS) Active Directory Service Interfaces (ADSI) provider to access IIS. Two threads access IIS at the same time. In this scenario, you may be unable to manage IIS by using Server Manager"


Microsoft provides a hot fix for this nasty issue, that can be downloaded from the following link

FIX: You may be unable to manage IIS by using Server Manager if two threads access IIS at the same time

Tuesday, December 2, 2008

Browser Speed test . . . .

I did few benchmark for all my browsers on my desktop to just check who is fast,faster, fastest using SunSpider JavaScript. Ok let's see the stats

Google Chrome 1757.6 ms
FireFox 3.0 3695.8ms
Apple Safari 3.15021.2 ms
Opera 9.505237.2 ms
Opera 9.624681.0 ms
Microsoft IE 7.036744.6ms
Microsoft IE 6.060803.8ms

Obviously Google chrome is the front runner and we are expecting more in Microsoft IE 8 because the results of IE 7 and IE 6 soars. If you look at the stats you can notice Opera improves a lot in its latest 9.62.

Want to test your browser how fast it is ? Here you go
http://www2.webkit.org/perf/sunspider-0.9/sunspider-driver.html

Who ever wins or loses , the end user is surely getting the best out of the market :-)

Monday, December 1, 2008

STSADM operations poster released !!

We know STSADM command, how essential to a SharePoint administrator. Microsoft released a poster which represents all of its operations as visio document.
This can be downloaded from http://go.microsoft.com/fwlink/?LinkId=120150

Thursday, November 20, 2008

Filter SharePoint List items based on User context

Filtering the items created by the logged in user can be done by simply modifying the existing View or by adding a new view which has "Created By" value = [Me].

But how to achieve the same thing in Code, Getting a list looping it and filtering the result will do. But sure performance will go down.

Here comes the CAML query for the rescue of SharePoint developer. CAML is having a token which automatically uses the current user context.

So we can write a code snippet as follows to get items created by the current user.



SPList sList=[Get the list to query here];
SPQuery query = new SPQuery();
query.Query = string.Format(
"[Where]"+
+ "[Eq]"
+ "[FieldRef Name='Author' LookupID='TRUE'/]"
+ "[Value Type='User'][UserID /][/Value]"
+ "[/Eq]"
+ "[/Where]");
SPListItemCollection listItems = sList.GetItems(query);


you will get the list items only created by the current user, no iteration, no filteration happens only clean CAML query.

Replace all square brackets[ ] with angle brackets < >. Blogger refused to accept the angle brackets.

Happy coding,

Tuesday, October 21, 2008

Free Microsoft Ebook

Microsoft is celebrating its 25th anniversary by providing some free MS Press e-books



Windows Server® 2008 TCP/IP Protocols and Services
by Joseph Davies
ISBN: 9780735624474



Programming Microsoft Robotics Studio
By Sara Morgan
ISBN: 9780735624320

Woes of IE 8 beta un-Installation

Finally I planned(got some guts) to evaluate IE 8 beta in my local virtual machines. After evaluating I wanted to rollback for IE 7 for SharePoint requirements. Rollback happened like a charm with out any hitches.

But after a few hours I got a crazy error message box, asking me to Abort, Retry & Ignore.



I checked my event viewer, there I found the following error under UserEnv category.

Event Type: Error
Event Source: Userenv
Event Category: None
Event ID: 1041
Date: 10/14/2008
Time: 9:58:30 AM
User: NT AUTHORITY\SYSTEM
Computer: JD1E4K
Description:
Windows cannot query DllName registry entry for {CF7639F3-ABA2-41DB-97F2-81E2C5DBFC5D} and it will not be loaded.
This is most likely caused by a faulty registration.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

After digging a lot, no resolution was found. Finally I took a backup of Registry and did a quick search using the GUID in the error message. It seems to be in the following location.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions/

Delete the key and quit the Registry. Yeah done finally resolved the issue.

DISCLAIMER (As usual): Editing the registry may cause unpredictable problems in the machine, So take a BACKUP before proceeding.

Sunday, October 5, 2008

How to compact Virtual hard drives?

When we develop in our virtualized dev environment, the virtual hard disk will expand dynamically in size. The problem is they don't compact automatically when we clean-up the VHD's. steps to reduce the VHD in size

1. Remove all unwanted files in temp locations or use CCleaner to remove all unwanted files.
2. Uninstall all programs which are unused in the dev environment.
3. Defrag the disk by using the system defragmenter.
4. select Capture ISO Image from CD menu and browse to the Virtual PC additions
directory
5. Location is %ProgramFiles%\Microsoft Virtual PC\Virtual Machine Additions by default.
6. Mount Virtual Disk Precompactor.iso. The precompactor will start automatically.
7. Once it's done , shut down the Virtual Hard disk.
8. Select the VPC from the Virtual PC console. Click on the settings button and select the Harddisk1 from the left pane.
9. Click over the "Virtual Disk Wizard" button and click next in the wizard.
10. select Edit existing disk, next choose the compact option - this can take a while to complete

For more info KB888760 How to prepare a Virtual Server 2005 virtual hard disk file to send to Microsoft Product Support Services

Friday, September 26, 2008

FireFox easter eggs

Just an easter egg in FireFox 3.0, Type about:robots in its address bar and hit enter



Try about:Mozilla in its address bar you will be presented a red screen with a verse from The Book of Mozilla



hmmm due to the browser wars we got a few easter eggs and many compatibility issues in our web applications.

Thursday, September 25, 2008

Free Sql Server 2008 Ebook - Direct Download

As some of my friends felt bit difficult to make a download of free SQL Server Ebook. I would like to dedicate this direct download link to those who find it difficult to download and those who don't have hotmail ID or Live ID.

Download here:

Tuesday, September 23, 2008

Even Gmail server goes down.

Gmail is no exception from server errors, but it crashed graciously.

Monday, September 22, 2008

Free Microsoft Press E-Book offer

Download Free E-book from Microsoft
You will need to provide your Live Id or Hotmail ID for a registration process before downloading.



Table Of Contents:

Chapter 1: Security and Administration
Chapter 2: Performance
Chapter 3: Type System
Chapter 4: Programmability
Chapter 5: Storage
Chapter 6: Enhancements for High Availability
Chapter 7: Business Intelligence Enhancements

Introducing Microsoft SQL Server 2008
by Peter DeBetta, Greg Low, and Mark Whitehorn
ISBN: 9780735625587

Download From here

Thursday, September 18, 2008

Wednesday, September 17, 2008

SharePoint development VM loves IISReset

When we develop application pages or custom web part development in SharePoint. This requires a lot of IISreset for each and every bit of change in the assembly when we are going to deploy these modified binaries GAC.

IISRESET takes a lot of time instead of that if we recycle the required application pool which is associated to our IIS web application, this will save atleast a minute of dev effort.

This recycling process can be automated by using the following OOB VB script

cscript.exe iisapp.vbs /a SharePointAppPool /r

or
cscript.exe iisapp.vbs /p [Process ID] /r

[Process ID] : This can be obtained just by executing iisapp.vbs in the command line. This will list all the application pools with their process ids

Get more info about IISapp.vbs from Microsoft Technet library

Do you want to recycle all the application pools in your IIS ?

Save the following the VB script to vbs file and replace the MachineName with your Dev machine's name

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set Service = locator.connectserver("MachineName", "root/MicrosoftIISv2")
Set APCollection = Service.InstancesOf("IISApplicationPool")
For Each APInstance In APCollection
APInstance.Recycle
Next

Monday, September 8, 2008

The Last Supper bigggggessst Photo

HAL 9000, an Italian imaging company which recently posted a high resolution of world famous "The Last Supper" photograph in its web site. Watching such a famous painting closer in high definition is quite amazing (People are restricted to watch closer because of the current condition of the photograph, might be 500 years older).

The resolution of the picture is 16 billion pixel (approx), which is 1600 times larger than a picture which is taken by a 10 Mega pixel camera. Image was photographed as 1677 pieces and then electronically assembled by computers. Each piece is 73 Mega byte approx.You can watch the image here


Technical Information:

Image Info:

---------------
Resolution : 16.118.035.591 pixel (172181 x 93611)
Camera : "Nikon D2Xs"
Lens : AF-S Nikkor 600mm f/4D IF-ED II

Computer used for processing
:
---------------------------------------
Processor : Two Quad Core AMD Opteron™ processors
Memory : 16 Gigabyte RAM memory
Storage : 2 Terabyte hard disk space


Watch the video how they did it here

Friday, September 5, 2008

Retrieving the password for IUSR & IWAM accounts

IIS provides  a script file called adsutil.vbs to obtain or set the password for IUSR/IWAM accounts in IIS metabase. Just adding this tip not to forget in future.

More details : http://support.microsoft.com/default.aspx?scid=kb;en-us;297989

SharePoint Page processing model

This is one of the architectural diagram I'm searching for a long time, finally I found it in MSDN


  1. The browser requests a Web page from Microsoft Internet Information Services (IIS).

  2. IIS passes the request to ASP.NET 2.0.

  3. An HttpApplication pipeline is created for the request.

    a. This request will be handled by WSS specific module SPRequestModule

    b. Then the processed request will be handled by WSS specific handler SPHttpHandler.

  4. ASP.NET 2.0 fetches the page via the Windows SharePoint Services 3.03 file provider. ASP.NET passes the URL to the file provider, and the file provider fetches the page and returns the page stream. The Windows SharePoint Services file provider implements caching and reduces round-trips to the database.

  5. ASP.NET loads a Page class, parses the page stream, and finds a reference to the page layout upon which the page is based.

  6. The ASP.NET engine compiles the page stream and stores it in memory.

  7. ASP.NET queries the Windows SharePoint Services file provider for the page layout.

  8. ASP.NET loads the stream for the page layout associated with the current page.

  9. ASP.NET compiles the page layout and stores it in memory. ASP.NET can free this memory later if the system needs memory.

  10. ASP.NET determines the master page for the site and fetches the master page via the Windows SharePoint Services file provider.

  11. ASP.NET compiles the master page and writes to the disk so you never have to recompile the master page unless you modify it.

  12. The page layout runs each control on the page in the context of the page that was requested.

  13. ASP.NET updates the necessary caches.

  14. IIS returns the page to the browser.

The next time the page is requested by the same user or by a different user who has the same permissions to see the page as the first user, page processing is much more efficient:

  1. The browser requests a Web page from IIS.

  2. IIS passes the request to ASP.NET 2.0.

  3. An HTTPApplication pipeline is created for the request and hits the HandleRequest.

  4. ASP.NET uses all the internal caches.

  5. ASP.NET renders the HTML for the controls.

  6. IIS returns the page to the browser.



Wednesday, August 27, 2008

SSL Certificate bug in Google

I recently enabled SSL encryption in Gmail. After enabling SSL, navigating to Google reader from the inbox produces the following page. Here is what I'm trying to do, the status bar says https://www.google.co.in/reader but it is supposed to http://google.co.in/reader

The SSL certificate applies only to Google.com and not for Google.co.in.


Firefox redirected me to an error page which clearly explains the issue,


Internet explorer 7.0 managed to tolerate and showed me the right content but with a Certificate Error in its location bar.


hmm hope Google will fix this bug . . . .

Thursday, August 21, 2008

Querystring limitation in Internet Explorer

Internet Explorer browser is having a nasty limitation on URL length in its address bar, it cannot contain more than 2083 characters, It will trim the string whatever comes after position 2083. This applies from IE 4.0 to IE 7.0.

This limitation is only for HTTP GET request not on HTTP POST request

On the other hand Firefox 3.0 allowed me to paste >2,40,000 chars. So developers beware of IE while passing lengthy query strings from your web application, your code has a chance of failing on browser compatibility testing.

Keep in mind that the number of characters will be significantly reduced if you have special characters (e.g. spaces) that need to be URLEncoded (e.g. converted to the sequence '%20'). For every space, you reduce the size allowed in the remainder of the URL by 2 characters - and this holds true for many other special characters that you may encode before sending the URL to the client.

MSFT KB Article : http://support.microsoft.com/kb/q208427/

Wednesday, August 13, 2008

A CAML View of a SPList

Want to get some Guid's of a list or some of its site column Guid's while developing features.

http://Foo/Library/_vti_bin/owssvr.dll?Cmd=ExportList&List={DA45FCA4-2B2C-4532-8E89-65FF6813F057}

This will emit the information as CAML/XML there we can find all the information.

Naivgate to Web part maintenance page

To delete a closed web part in a web part page , we need to navigate to the maintenance page but there is no links pointing to the page, So force the web part page url by appending ?contents=1 to the query string will launch the page

Sample:
http://www.foo.com/default.aspx?contents=1

Saturday, August 9, 2008

Sharepoint Data Model is here........

All sharepoint developers would like to know about the Data model of Sharepoint which is hidden deep under WSS OM.

I was searching for the related documentation in msdn for a long time. My colleague, Subhajit recently blogged and revealed it to the community. Since blogger doesn't have the capability of the Track back feature I cannot trackback that blog.

Here we go for the Data model of Sharepoint


Any modification at database level is STRICTLY NOT SUPPORTED by MSFT.

Want to Take a DLL backup from GAC

Option-1:
~~~~~~~
open command prompt and navigate to %windir%/assembly/gac_msil/ and use copy command to take a copy of the require dll.

Option-2:
~~~~~~~
Want to do it in a windows way ,
Simply enter the following:
subst g: %windir%\assembly\gac

Now open Explorer, go to drive G: and you're all set.
Thanks to Jeff key

Option-3:
~~~~~~~
Start->Run->type c:\windows\assembly\gac
There you are take a back up of the required dll and go ahead

Friday, August 8, 2008

Get rid of memory leaks in Owsttimer & WssAdmin

Windows SharePoint Services Administration (WSSADMIN.EXE ) and Windows SharePoint Services Timer (OWSTIMER.EXE ) are processes which always take up most of the memory on my Dev Env.

SharePoint App Pools do take lots of memory but I do IISRESET or a process recycle very often to reclaim the memory,but WSSADMIN.EXE and OWSTIMER.EXE really consume ridiculous amount of memory.

This memory can be reclaimed by running the following scripts in the Dev virtual machines.

net stop "Windows SharePoint Services Timer"
net start "Windows SharePoint Services Timer"
net stop "Windows SharePoint Services Administration"
net start "Windows SharePoint Services Administration"

Want more details about this memory leak check out
http://www.mindsharpblogs.com/Ben/archive/2007/09/25/2965.aspx




Monday, August 4, 2008

Determine MOSS or WSS


There is no direct way to determine whether MOSS is installed over WSS throught Object model,
So we can just check the existence of profile service on the farm. Profile service comes along only with MOSS so we can ensure MOSS is installed by this snippet.


string
isapiFolder = SPUtility.GetGenericSetupPath("ISAPI");
string userProfileServicePath = Path.Combine(isapiFolder, "UserProfileService.asmx");
bool SharePointServerInstalled = File.Exists(userProfileServicePath);

Friday, July 4, 2008

Memory leak in Firefox 3.0


FireFox 3.0 has still the memory leak woes, take look at the memory consumption for firefox with only four tabs opened for more than 15 hours.

Thursday, July 3, 2008

STSADM Command line Reference posters

STSADM Command line Reference posters




How to get the connection string for Sharepoint Config Database

Sharepoint Config database connection string is persisted in a Registry key , querying the specific key we can get the config database connection string.

Registry key:
HKLM\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\configdb

Code snippet to get the connection string:

RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Secure\configdb");
DSN = (string) key.GetValue("DSN");
SQLServerInstance = new string[]
{
this.DSN.Split(new char[] { '=', ';' })[1]
};

key.Close();


Hope this will help some needy SharePoint Dev.

WARNING : Do not make any changes in the registry without taking proper backups