Surendra Sharma

Surendra Sharma

Search This Blog

Friday, October 19, 2018

ebook : SharePoint to Sitecore: Strategy and Implementation


Sharing my 6th eBook with Sitecore community - "SharePoint to Sitecore: Strategy and Implementation".

SharePoint to Sitecore
SharePoint to Sitecore


There are multiple ways to move data and images from SharePoint to Sitecore. I tried my best to include all the approaches but explained one approach which worked for me in Sitecore 9 update 1 instance.

You can read and download this ebook from here:


I hope you like this eBook.

Please leave your comments or share this eBook if it’s useful for you.

Monday, October 15, 2018

Course : Deep Learning Explained

Finished the course "Deep Learning Explained" successfully on EDX offered by Microsoft by 80%.


Deep Learning Explained score
Deep Learning Explained score

I study below modules in this course
  • 1 | Introduction and Overview
  • 2 | Multi-class Classification using Logistic Regression
  • 3 | Multi-Layer Perceptron
  • 4 | Convolution Neural Network
  • 5 | Recurrent Neural Network and Long Short Term Memory
  • 6 | Text Classification with RNN and LSTM

Friday, October 12, 2018

Sitecore installation 503 error : digged the mountain and found a rat

I was installing Sitecore 9 update 1 on desktop machine with Windows 10 Enterprise as OS and IIS 10.

At "UpdateSolrSchema : SitecoreUrl" stage, I received this error

[---------------------------------------- UpdateSolrSchema : SitecoreUrl ---------------------------------------------
[UpdateSolrSchema]:[Requesting] habitat.dev.local/.../PopulateManagedSchema.aspx
Install-SitecoreConfiguration : Error requesting habitat.dev.local/.../PopulateManagedSchema.aspx
The remote server returned an error: (503) Server Unavailable.
User Name         habitat\user1
[UpdateSolrSchema]:[Requesting] http://habitat.dev.local/sitecore/admin/PopulateManagedSchema.aspx?indexes=all
Install-SitecoreConfiguration : Error requesting
http://habitat.dev.local/sitecore/admin/PopulateManagedSchema.aspx?indexes=all: The remote server returned an error:
(503) Server Unavailable.
At C:\code\install-xp0.ps1:272 char:9
+         Install-SitecoreConfiguration $SitecoreConfiguration `
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration

When I checked my new Sitecore website were available in IIS, but when I try to run them , I was getting 503 errors.


I googled it find out that its something related with Windows 10 patches.
I tried different solutions suggested by developers like App pool settings, permission, SOLR availability issues but none of them work for me.

Solution:-


My initial doubt  was on Windows 10 Enterprise machine as I done the installations on Windows 10 Professional several time and didn't encountered any issue. After spending several hours Windows 10 Enterprise OS seems to be fine and have all the patches in place.

This machine was running in client office environment. So their IT team using proxy to access internet. This proxy is blocking all local websites to run in browser. When I disabled this, my Sitecore applications started to work.
 

To disabled proxy
Open Internet explorer -> Goto Tools Menu -> Select Internet Options -> Click Connections Tab -> Click on LAN Settings Button -> Disabled checkbox of Proxy 

server section.


Proxy Settings in Internet Explorer
Proxy Settings in Internet Explorer


I spend 2 days to figure out this issue. I dug up the mountain and all I could find was a dead rat.

I hope this tip will help somebody to resolve similar issue.

Saturday, October 6, 2018

Quick way to convert excel, csv file data to C# Datatable


I received English and Arabic data in Excel file and I have to migrate this data to SQL server.

I don’t want to use Office API for this as it’s a bit complex.

So for this, I used Nuget package “ExcelDataReader” and “ExcelDataReader.DataSet” as below

ExcelDataReader Nuget Package
ExcelDataReader Nuget Package


Note :- Must include “ExcelDataReader.DataSet” Nuget package for getting AsDataSet() method in code.

Code for reading excel file and to get data table is very simple as 

using ExcelDataReader;
using System.IO;

namespace ExcelConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            //1. Create File Stream for Excel file
            FileStream stream = File.Open("d:\\NewsListWithAllColumns.xlsx", FileMode.Open, FileAccess.Read);

            //2.. Reading from a Excel file *.xlsx
            IExcelDataReader excelReader = ExcelReaderFactory.CreateReader(stream);
            //...
            //2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
            //IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            //...

            //3. DataSet Configuration - Create column names from first row
            ExcelDataSetConfiguration excelDataSetConfiguration = new ExcelDataSetConfiguration
            {
                ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                {
                    UseHeaderRow = true
                }
            };

            //4. DataSet - The result of each spreadsheet will be created in the result.Tables
            var dataSet = excelReader.AsDataSet(excelDataSetConfiguration);

            //5. Get Datatable from dataset
            var dataTable = dataSet.Tables[0];

            //6. Read one of the cell to test
            var c11 = dataTable.Rows[2][2];

            //7. Free resources (IExcelDataReader is IDisposable)
            excelReader.Close();

        }
    }
}

Below is the screenshot while to view datatable output in program debug mode as

Excel to Datatable
Excel to Datatable

Let me know if you have any other idea to read excel file and get its values.