SQL Azure and Sitecore Retryer

If you are deploying Sitecore on Azure and you are using SQL Azure, you should know that you could experience some connectivity issue between your Sitecore instance and your database…

Therefore it is strongly recommended to enable a retry mechanism on Sitecore data provider to recover these intermittent connectivity issues.

This is the default configuration that you will find in your web config, and what you need to do is to switch disabled to false….

you can either keep the logging enabled/disabled to log these connectivity issues and change the interval setting, but I would recommend to keep the default value…

<retryer disabled="true" type="Sitecore.Data.DataProviders.Retryer, Sitecore.Kernel">
      <param desc="Number of tries">6</param>
      <param desc="Interval between tries">00:00:00.500</param>
      <param desc="Log each exception (should be used for debug only)">true</param>
</retryer>

Sitecore 8 update4&5 Edit related item Issue with Multilanguage implementation

I have been struggling with the issue described in this StackOverflow question…

http://stackoverflow.com/questions/31959337/sitecore-editframe-button-support-multilanguage

Basically The edit related button was always pointing to the English version of the item, ignoring the current language context….

Sitecore has released a fix on 1st September and I have successfully tested it on Sitecore 8 update 4.

Here you can download the fix https://kb.sitecore.net/articles/814090

Sitecore has been working on similar issues and will probably fix this in 8.1….

SitecoreCommerce Introduction

As you probably know, Sitecore bought Commerce Server somewhile ago and now we are starting to see the results of this integration.

Sitecore have released CommerceServer 11 and Sitecore commerce at the same time with the goal of keeping the two products together and transform in one product in the near future.

At the moment, you can feel that are two different products:

Commerce Server with the traditional business user applications and the same legacy backend (same databases and management console)

On the other SitecoreCommerceConnect that try to integrate CommerceServer with a set of DataProvider and out of the box integration bits

At the moment has been released as well a MVC application as a sample front end to consume Commerce Server and demonstrate how to use the API and the integration bits.

At the moment the installation process is not super-easy, but Ihope it will improve with the Sitecore 8 release and the relevant Sitecore Commerce Update

CSS Inliner, it is easy….

I had to use a CSS Inliner building my newsletter on Sitecore….

Basically I wanted to build my newsletter HTML using external css for code re-usability and to enforce my branding style.  And I need to inline my CSS before sending to the clients (gmail & outlook ate external css…)

here it come Premailer: https://github.com/milkshakesoftware/PreMailer.Net

One line of code and the magic is done

Sql tips

A few tips useful for your Sql Query…

Update with a join:

 UPDATE MyTable 
  SET Column = NewValue 
  FROM MyTable  INNER JOIN OtherTable ON MyTable.Key = OtherTable.Key 

trimming…
  select LTRIM(RTRIM(columnOne)) from table1 

select into
 
 SELECT Persons.LastName,Orders.OrderNo 
  INTO Backup 
  FROM Persons 
  INNER JOIN Orders  ON Persons.P_Id=Orders.P_Id

AngularJS cheat sheet

ng-app (usually on html)

ng-controller (on the body or on the container)

‘use strict’;

scripts order: Jquery – Angular (in the head possibly) other scripts:

var testApp = angular.module(‘myFirstAng’, []);
testApp.controller(‘myController’, function ($scope) {
$scope.Test = “hello world”;
});

 

use of $http:

myApp.controller(‘myController’, function ($scope, $http) {

$http({
dataType: ‘json’, headers: {
“Content-Type”: “application/json”
}, data: ”, method: ‘GET’,
url: ‘/api/Sdb’
}).success(function (data, status, headers, config) {
$scope.Result = data;
})
.error(function (data, status, headers, config) {
});
});

 


NG-Repeat: ng-repeat=”friend in friends”

ng-click

<select
data-ng-model=”selection.bg”
data-ng-options=”bg.Name for bg in businessGroups”
data-ng-change=”ChangeEvent()”>
<option value=””>-Select-</option>
</select>;

 

ng-grid

 <div class=“gridStyle” ng-grid=“gridOptions” style=“width: 90%; height: 90%”></div>

 

 $scope.gridOptions = {
                data: ‘users’, columnDefs: [
                    { field: ‘FullName’, displayName: ‘FullName’, resizable:true, width:200 },
                    { field: ‘UserName’, displayName: ‘UserName’, resizable: true },
                    {
                        field: ‘LastLogin’, displayName: ‘LastLogin’,
                        cellFilter: “date:’dd/MM/yyyy HH:mm’”
                    },
                    { field: ‘AssignedRoles’, displayName: ‘AssignedRoles’, resizable: true, cellFilter:‘stringArrayFilter’ }]
            };
getUsersService.getUsers(data).then(
                            function (dataReturned) {
                                $scope.users = dataReturned;
                            });

Jasmine testing:

describe("myApp", function() {
    beforeEach(module('myApp'));
    describe("SimpleController", function() {
        var scope;
        beforeEach(inject(function($rootScope, $controller) {
            scope = $rootScope.$new();
            $controller("SimpleController", {
                $scope: scope
            });
        }));
        it("should double the numbers", function() {
            scope.doubleIt();
            expect(scope.x).toBe(6);
        });
    });
});