Monday, December 14, 2020

Python set higher version default

 Set Python 3.5 with higher priority

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2

Check the result

sudo update-alternatives --config python
python -V

Wednesday, December 9, 2020

Error handling Episerver - 404 etc..

 

1. <customErrors mode="Off" /> (off - Everyone gets to see your errors guts, On - Everyone gets the Nice error page. remoteonly - only those local to the code get to see the errors guts)


2. Global error handling => false (EPiServers handling of this is problematic. <applicationSettings globalErrorHandling="Off")


3. Set route -> routes.MapRoute("Error_404", "notfound", new { controller = "DefaultPage", action = "Error404" });


4. Use httpErrors to direct to Your 404 action (<error statusCode="404" path="/notfound" responseMode="ExecuteURL" />)


5. Controller:


[BVNetwork.NotFound.Core.NotFoundPage.NotFoundPage]

public ActionResult Error404()

{

var startPage = ContentReference.StartPage.GetPage<StartPage>();

var notFoundPage = startPage.NotFoundPage.GetPage<StandardPage>();

ControllerContext.RequestContext.SetContentLink(startPage.NotFoundPage);



Response.StatusCode = (int)HttpStatusCode.NotFound;

Response.TrySkipIisCustomErrors = true;

var model = CreateModel<StandardPage>(notFoundPage);



return View("~/Views/StandardPage/Index.cshtml", model);

}

Wednesday, November 25, 2020

Episerver find - Developer Demo Services (Unauthorized)

 When running the scheduled job you get something like: {"status":401,"error":"Unauthorized"}


Solution:

Remove all entries from the Episerver find index job in: the tblScheduledItemLog db table. You can get the  GUID id of the job in the table tblScheduledItem.

SQL  

  DELETE FROM [YOURDB].[dbo].[tblScheduledItemLog]

WHERE fkScheduledItemId = 'YOUR GUID'

Friday, November 6, 2020

C#, Config: Config Sections - Section type meaning.

 <section name="example" type="Examples.Configuration.ExampleSection, 

                                  Examples.Configuration" />


 <section name="example" type="{Hela adressen till classen inkl namespace}, 

                                  {Namespace där klassen ligger}" />

Saturday, October 3, 2020

NPM - Start

 

What does npm start do in nodejs

When you issue the command npm start from the root directory of your nodejs project, node will look for a scripts object in your package.json file. If found, it will look for a script with the key start and run the command specified as its value.

If your package.json does not have any scripts object or if the scripts object does not have a start key, it will run the command node server.js instead.

Npm scripts are pretty useful because they let you group together and run logically related commands. e.g. linters, minifiers etc.


Wednesday, September 30, 2020

GIT - Make log Pretty with alias

 git config --global alias.graph "log --pretty --color --decorate --graph"