Surendra Sharma

Surendra Sharma

Search This Blog

Friday, December 21, 2018

Speed up Sitecore JSS App creation process

To setup a new Sitecore JSS application, you must fire command “jss create <AppName> <JSFramework>”. This command download “master.zip” from github repository.

Sitecore JSS Github repository address
Sitecore JSS Github repository address

This downloading process is very slow on my machine which inspire me to write this blog.
 
To speed up JSS application creation process, download zip file https://github.com/Sitecore/jss/archive/master.zip which downloaded with name “jss-master.zip”. Rename it to “master.zip” and put it into “C:\inetpub\wwwroot” folder.

Open file “C:\Users\<UserName>\AppData\Roaming\npm\node_modules\@sitecore-jss\sitecore-jss-cli\dist\create\create.source.github.js”.

Comment and add below line. (In my machine, commented line number is 53.) 

//this.githubDownloadUrl = "https://github.com/" + repository + "/archive/" + branch + ".zip";
this.githubDownloadUrl = "http://localhost/" + branch + ".zip";

Save this file.

Now if you fire any “jss create <AppName> <JSFramework>” command, installation will be done very fast as instead of downloading from Github, zip file is downloaded from local machine as

Sitecore JSS localhost address
Sitecore JSS localhost address
Note – If there are any major changes on JSS Github for any future release, then we have to again download and replace this master.zip file.


Start playing with JSS. 
Happy Sitecore JSS.

Friday, December 14, 2018

Upgrade from Sitecore 9.0.2 to 9.1 via Update Center


Upgrade Sitecore 9.0.2 to Sitecore 9.1
Upgrade Sitecore 9.0.2 to Sitecore 9.1


Today I published an article on TADigital blog website for "Upgrade Guide from Sitecore 9.0.2 to Sitecore 9.1 via Update Center". Here is a Link for the same.

Monday, December 3, 2018

Fixed : Sitecore 9.1 Installation Error - No registration found for extension 'OutNull' of type 'Task'

I was installing Sitecore 9.1 and started to receive error "No registration found for extension 'OutNull' of type 'Task'".

PS>TerminatingError(): "No registration found for extension 'OutNull' of type 'Task'."
>> TerminatingError(MapTasks): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No registration found for extension 'OutNull' of type 'Task'."
>> TerminatingError(MapTasks): "The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: No registration found for extension 'OutNull' of type 'Task'."
Install-SitecoreConfiguration : No registration found for extension 'OutNull' of type 'Task'.
At C:\resourcefiles91\XP0-SingleDeveloper.ps1:74 char:1
+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Objec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
Install-SitecoreConfiguration : No registration found for extension 'OutNull' of type 'Task'.
At C:\resourcefiles91\XP0-SingleDeveloper.ps1:74 char:1
+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Objec ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

   
Reason:
I already have SitecoreInstallFramework version 1.2.1 installed and now I installed SitecoreInstallFramework 2.0.0
.
 

After that I run the "XP0-SingleDeveloper.ps1" script and I started to receive this error.

The root cause was that PowerShell load all the available modules when its start up. If you installed any module then it will not available in PowerShell immediately.

Solution:
I just restarted PowerShell
to load the newly installed module and run the "XP0-SingleDeveloper.ps1" script. This time my script completed successfully.

Happy Sitecore 9.1 Installation.

Sitecore 9.1 making HELIX as de facto standard for website development

I installed Sitecore 9.1 and notice this change in content tree. You should get Foundation, Feature and Project items under layout, rendering and template in content tree.

I have not observed this in earlier versions of Sitecore 9.

I suppose Sitecore is pushing HELIX guidelines as de facto standard for all Sitecore website development.


Happy to see these items in Content tree.

Foundation, Feature, Project items in Sitecore 9.1
Foundation, Feature, Project items in Sitecore 9.1

Sunday, November 25, 2018

Course : Reinforcement Learning Explained

Finished the course "Reinforcement Learning Explained" successfully on EDX offered by Microsoft by 78%.

Reinforcement Learning Explained Score
Reinforcement Learning Explained Score


I study below modules in this course

  • Introduction to Reinforcement Learning
  • Bandits
  • The Reinforcement Learning Problem
  • Dynamic Programming
  • Temporal Difference Learning
  • Function Approximation
  • Policy Gradient and Actor Critic

Friday, November 16, 2018

Sitecore PowerShell script: Copy value of one field to another


I like Sitecore but I started to love Sitecore PowerShell. The way it’s interacting with Sitecore and allows developers to write command with C# code is amazing.

I have migrated SharePoint records in Sitecore in my earlier post.

This time I am bulk updating English and Arabic news items where news image field value is copied to another news fields “News List Image”.

cls
#input
$newsTemplateId = "{B69277AD-E917-4B9F-9136-A12E0A3E462F}"
$newsParentPath = "master:/sitecore/content/Habitat/Home/News"
$counter = 1

$allNewsItems = Get-ChildItem -Path $newsParentPath -Recurse
$filteredNewsItems = $allNewsItems | Where-Object { $_.TemplateId -eq $newsTemplateId }

foreach($newsItem in $filteredNewsItems) {
        if($newsItem.NewsListImage -eq "")
        {
            #Update English content
            $newsItem.Editing.BeginEdit()
            $newsItem.NewsListImage = $newsItem.NewsImage
            $newsItem.Editing.EndEdit()
   
            #Get Arebic Content    
            $newsArebicItem = Get-Item master: -ID $newsItem.ID -Language "ar-QA"
            #Check if Arebic content is exist
            if($newsArebicItem -ne $null)
            {
                #Update Arabic content  
                $newsArebicItem.Editing.BeginEdit()
                $newsArebicItem.NewsListImage = $newsArebicItem.NewsImage
                $newsArebicItem.Editing.EndEdit()
            }
            $counter
            $counter = $counter + 1
        }
        else
        {
            Write-Host "Image exist for item id " $newsItem.ID " and name " $newsItem.Name
        }
}

Feel free to use this script for bulk updating field values.