The Infinite Space Between Lines

Wednesday, 23 August 2017

Overview

EPiServer separates the functionality for website editors and site administrators by using two distinct user interfaces (Edit & Admin interface).
Edit mode offers granular control by allowing you to set access rights for content.

The requirement is to provide editor access to a particular admin functionality i.e Categories, without providing full access to the user to the admin interface.

Background

Recently I was asked for a code snippet to manually invalidate site and individual page cache in EPiServer.

My first impression was why you want to go out of the way to manually invalidate site or a page cache when EPiServer automatically takes cares of it in a brilliant way?. It's not something you do in your daily EPiServer development routine, and being a big believer of "No such thing as a stupid question", it got me curious as I had some idea about doing this in theory but never actually get a chance to write a code to invalidate site or page cache.

The idea was to stress test load balancing environment where EPiserver event providers are doing the cache invalidation job but to disrupt their job through an invalidation cache web service. Later create a proof of concept in load balancing environment where EPiserver events providers for invalidating cache are disabled and on published event in CMS, a code gets triggers manually invalidation cache on site or page.

Thursday, 13 July 2017

Problem

I was trying to import a BACPAC that was generated on a different server to my local development environment using SQL Server Management Studio 17.1 "Import Data-tier Application" wizard and received the following error

Solution 1 - Write your own recursive function that iterate throughout all of your file and folder in your specified folder structure.
Solution 2 - Use a simple tool called "AWS Command Line Interface," provided by Amazon.

Quick tip here. According to AWS documentation "Amazon S3 has a flat structure with no hierarchy like you would see in a typical file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects. Amazon S3 does this by using key name prefixes for objects."

So you don't have to create folder in AWS S3 bucket before uploading the files. All you need to do is specify path to file e.g photos/abc.png and AWS will automatically create folder against the file abc.png

The downside of this approach is that it is a very slow process. For my folder (containing 2 155 Files, 87 Folders total size 32,8 MB), it took 41 minutes to upload everything on my AWS S3 bucket.

Solution 2.

Before we go through this approach we need to know, "What Is the AWS Command Line Interface?"

According to AWS CLI documentation "The AWS Command Line Interface is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts."

In this Tutorial we will use AWS CLI tools (recommend approach).

Before we go further you need to keep in mind few things

- We will be using Microsoft Windows 7 or above.
- Make sure you download and install AWS CLI tools in your Windows environment.

If you try do everything according to the documentation you will end up with the problem of setting up Environment variables (that's what happened to me at least). You need environment variables so setup AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION

Tip: The way its describe to set Environment Variables in AWS documentation is for example

AWS_ACCESS_KEY_ID =AK0BJUTDXP2PPTT

and this approach didn't work . So i end up using the different approach to set Environment Variables