Monday, 14 November 2016

Sitecore Tips: To Save time disable Sitecore cache and browser cache during development

Sitecore: To Save time disable Sitecore cache and browser cache during development


Cache is required for better performance of application.

During development stage, it is always suggested to disable Sitecore cache and also browser cache to avoid wasting time in recycling application pool or clearing cache from cache admin. To disable it, 

      <!--  CACHING ENABLED
            Determines if caching should be enabled at all
            Specify 'true' to enable caching and 'false' to disable all caching
      -->
      <setting name="Caching.Enabled" value="true" />
      <!--  DISABLE BROWSER CACHING
            If true, all pages will have:
              Cache-Control: no-cache, no-store
              Pragma: no-cache
            in the http header
      -->
      <setting name="DisableBrowserCaching" value="true" />

Both the setting should be true; former to avoid Sitecore cache and latter to BrowserCache.

Tuesday, 1 November 2016

Improving performance of Application startup in Sitecore 8+

Improving performance of Application startup in Sitecore 8+

Disable the precompilation of SPEAK components: 
  • Comment out this part of the
  • Website\App_Config\Include\Sitecore.Speak.config file:
  • <initialize>
    <processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Client">
    <Paths>/sitecore/shell/client/Business Component Library</Paths>
    </processor>
    </initialize>
  • Comment out this part of the 
  • Website\App_Config\Include\ContentTesting\ Sitecore.ContentTesting.config file: <processor type="Sitecore.Pipelines.Initialize.PrecompileSpeakViews, Sitecore.Speak.Client" use="ContentTesting">
  • <Paths>/sitecore/shell/client/Applications/ContentTesting</Paths>
    </processor>

Publish Queue, History and Event Queue too big

Publish Queue, History and Event Queue too big

Existing CMS users are unable to publish content on Sitecore.
Syntax:

/* TRUNCATE History TABLE */
IF OBJECT_ID('History', 'U') IS NOT NULL
IF((SELECT COUNT(*) FROM [History]) > 1000)
BEGIN
TRUNCATE TABLE [History];
PRINT 'Truncated the History Table';
END
/* TRUNCATE EventQueue TABLE */
IF OBJECT_ID('EventQueue', 'U') IS NOT NULL
if((SELECT COUNT(*) FROM [EventQueue]) > 1000)
BEGIN
TRUNCATE TABLE [EventQueue];
PRINT 'Truncated the EventQueue Table';
END
/* TRUNCATE PublishQueue TABLE */
IF OBJECT_ID('PublishQueue', 'U') IS NOT NULL
IF((SELECT COUNT(*) FROM [PublishQueue]) > 1000)
BEGIN
TRUNCATE TABLE [PublishQueue];
PRINT 'Truncated the PublishQueue Table';
END

Enable / Disable application access to users.

Enable / Disable application access to users.
If you do not want editors to be able to access the Page Editor at all, you can restrict access to the Page Editor buttons in the core database as you would with any other item. By default, there are Page Editor buttons in the following locations:
/sitecore/content/Documents and settings/All users/Start menu/Right/Page Editor
/sitecore/content/Applications/Content Editor/Ribbons/Chunks/Publish/Page Editor
If Read access is denied on these items, they do not appear in the ribbon or Desktop menu.

Tuesday, 2 August 2016

Disable Analytics in Sitecore 8

Step 1: Disable Analytics in Config: 

Go to /App_Config/Include/Sitecore.Analytics.config and set Analytics.Enabled to false:

<setting name="Analytics.Enabled" value="false" />

Step 2: Comment out connection strings related to analytics in connectionstrings.

<add name="analytics" connectionString="mongodb://localhost/analytics" />
<add name="tracking.live" connectionString="mongodb://localhost/tracking_live" />
<add name="tracking.history" connectionString="mongodb://localhost/tracking_history" />
<add name="tracking.contact" connectionString="mongodb://localhost/tracking_contact" />
<add name="reporting" connectionString="user id=Prakash;password=patel;Data Source=(patel);Database=Sitecore_Analytics" />

Thursday, 4 February 2016

Sitecore 8.1 new features

Sitecore 8.1 new features


  • CMS only mode (xManagement) without xDB
  • Language Fallback built-in
  • Enhanced Experience Editor
  • MVC/Web Api Upgrade to 5.2.3 + MVC Areas
  • New SPEAK Components and improved SPEAK component framework (1.1 and 2.0 support)
  • New Piplines for additional extensibility
  • Sitecore section move to Sitecore.config
  • Version changes in web database - multiple versions per item in web DB
  • Fixes and improvements(7.2 update-4 and 9.0 update-1 to Update-5

Monday, 25 May 2015

Guidelines for Sitecore MVC


­
1.    Controller is supposed to control and direct, it should not have any logic (many developers forget this and it happened in Vision Web too) and should be as slim as possible.
2.    One of the main advantages of MVC is that the view (technically called as View template) is not tightly coupled with the server side. So, we can switch/add a new view (say for mobile or tablet) for an existing flow any time. In order to achieve this we should make the view as ignorant as possible of what it displays and should concentrate more towards how it displays.
3.    Try to avoid c# code in .cshtml as much as possible. Use html helpers in all situations. Create extension methods for html helpers to re-use code and constructs.
4.    Model could contain all logics and calculations and can be fat. It is good to use Model only to represent an entity and to use ViewModel to represent transit entities.
5.    Better to avoid ViewBag or ViewData for transit entities when they are present in multiple places. ViewModel instead would make the code more managable.
6.    Use IOC to decouple the connection to SiteCore. This will help in redirecting the call for test data to our own repository.
7.    Methods which are not Actions should not be public.
8.    Use TempData instead of Session when the data is needed only for the subsequent request.
9.    Use filters as and when it becomes appropriate. It will help in getting an easier control of the flow in different stages on a global scale.
1.    For enhancing reusability, use controls/partial pages as much as possible.
. ...   Exception handling mechanism and Logging framework will have to be put in place which will not require much effort from the developer every time that he has to handle it for his module.

1.  Never put an unnecessary check when some value is not intended to be there. There were many problems in Visionweb due to this. (Example of this is developers putting a check for null/empty everywhere. This habit will avoid the exception but will make the intention of the code ambiguous and will lead to loop holes in the flow.