Friday, May 08, 2009

Altering the behavior of the tree view control


You may have noticed this too. When you create a template, the Base Template dropdown may be tricky to operate with. If you are trying to find a template in the subfolders to inherit from and miss the expansion plus, the tree will collapse and you will have to start over. This has been bugging me for a while so I asked the tech support if there is an easy way to fix this and not have the tree to collapse.
Luckily, there is an easy fix, but you will have to mess with the Sitecore.js file located under /sitecore/shell/controls.

What you need to do is to add a global variable in Sitecore.js:

var iAmTree = null;

Then straight after line 563 within scSitecore.prototype.postEvent = function(tag, evt, parameters) add the following:

iAmTree = false;                                                                                      
if (ctl.className.toString() == "scTreeItem") iAmTree = true;  

And finally within scRequest.prototype.resume = function() alter this IF statement:

if (this.closePopups && typeof(scForm) != "undefined") {
    scForm.browser.closePopups("Request");
  }

to this:

if (this.closePopups && typeof(scForm) != "undefined" && iAmTree != true) {
    scForm.browser.closePopups("Request");
  }

This will also affect the Droptree field’s behavior and possibly more areas.

And you may have guessed – create a backup of Sitecore.js file and use the solution on your own risk ;-)

Special thanks goes to Ruslan for providing the fix.

Thursday, April 09, 2009

How to troubleshoot SQL connection issues


Had a problem with remote web app not connection to newly installed SQL Server. Was getting generic “A network-related or instance-specific error occurred while establishing a connection to SQL Server…”

Found this great article with the breakdown of possible scenarios, very useful. Mine was #6, SQLBrowser not running. Was clicking too fast through the installation ;-)

Monday, April 06, 2009

Find of the day - Mozilla specific client caching


Looks like Mozilla stores documents locally even if "no-cache" header is passed in the HTTP response.
Official explanation here.

Wednesday, April 01, 2009

Silverlight Client Caching


Since SL creates a XAP file for further consumption, browsers will be caching it as a usual asset. While being awesome for production, it introduces a pain in the development process as you need to clear the temporary files in your browser to see the change.

In order to get rid of this inconvenience, just turn off the caching on the IIS level. If you are on IIS7, extend "Output Caching" options by introducing a rule for ".xap" files and specify "cache using file change notifications ":

Untitled

In order to confirm it worked, fire up Fiddler and verify you get "no-cache" for the request to XAP file.

Cookie sharing between processes in Internet Explorer


If you installed IE8 and tried running two separate Sitecore sessions in different processes, you may have experienced this as well.
IE8 shares the cookies between two different processes (windows) now so this may bring you inconvenience especially during the development process.

There are solutions out there which address the problem with special "-nomerge" parameter, but I decided to apply the registry fix directly so all my IE launches will not use this new "FrameMerging" feature that supposedly improves performance.

Related reading:
http://www.walkernews.net/2009/03/26/use-ie8-nomerge-option-to-login-multiple-accounts-of-same-site/ http://www.walkernews.net/2009/04/02/alternative-ie8-nomerge-option-to-login-multiple-web-accounts/
http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.internetexplorer.beta&tid=3d227efa-d0a1-4ec7-896e-2722c4026e62&cat=&lang=&cr=&sloc=&p=1

Registry fix from the article above:
HKCU\software\microsoft\internet explorer\main - FrameMerging = DWORD:0

Update 2/29/2012:

The registry key that disables this mess once and forever is actually called “SessionMerging” which can be found under:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
SessionMerging = DWORD:0

Works for IE9 too!