Kentico the mule of development

I have talked before about how Content Management Systems(CMS) are getting so good, that it means they are doing more of the work so you don’t have too. Instead of doing the donkey work, you can be improving the whole application and doing the most advance features. However over my time of working with such a CMS called Kentico I have found some pro’s and con’s of this mode of working, so I wanted to share my thoughts of if it is a favourable idea to be working on these CMS’.

Kentico’s power

First off an overview of what Kentico is, in case you have not heard of it. Kentico is a C#.NET Swiss army knife of a CMS as it can do Content Management, E-commerce, Online Marketing and basically most of the work for a developer.

Some of the features are:

Kentico uses the name ‘Page Types’ for its content templates. In these you describe the format of how this content should be held, like a database table. You tell it what the field is called in the database, the size, the data format and things like the caption the Content Editor sees. When the Content Editor then adds new content and chooses that Page Type, they are presented with a form with these fields to enter the content. What it then means for the developer, is they have a standard format of how to pull different content from the CMS and not just get a blob of data. (Find out more http://www.kentico.com/product/all-features/web-content-management/custom-pages)

As well as just getting well formatted content, you can use ‘Web Parts’. Web Parts are like functional modules that get used on a template. These can be things like a navigation bar that is on each page, but you can also have different types on each template. Also these can pull content from the database using the Page Type like a news feed or list of blog posts. (Find out more http://www.kentico.com/product/all-features/web-content-management/webparts)

However the Web Parts are added by the developer and are only a single instance of the Web Parts. What we really want is the Content Editor to be able to choose what pages have what modules and for this there are ‘Widgets’. These are instances of the Web Parts, which means you create a Web Part and then the Widget references it. When the Content Editor uses the Widget it takes a copy of the Web Part that it stores on the Page. The control it gives is for the Content Editor to decide what module shows where, when and how. These can get very complex to give more control to the Content Editor or the Developer can keep some control by limiting the functionality of the module. (Find out more http://www.kentico.com/product/all-features/web-content-management/widgets)

The other great content editor control is to build forms, yes full forms. With the CMS you can use a bit of a WYSIWYG to construct a form with various types of fields and then get them submitted to the database. These can also have customisation to send emails to the user or the administrator, create A/B split testing of forms and the editor can even customise the layout of the form. This will spare some hours building custom forms each time with the same validation, same submitting pattern and same design. (Find out more http://www.kentico.com/product/all-features/web-content-management/on-line-forms)

You can read more about all the features in depth and download a demo from the Kentico website. [http://www.kentico.com/product/all-features]

Tell me why?

Other than just showing you the brochure, I wanted to explain what makes using a full customisable CMS like Kentico brings.

In my opinion DevOps is all about empowering the next person to do more with less work, for example an Operations Engineer could make it easier for a Developer to spin up development environment. This kind of this means the Operations Engineer can keep doing other work and the Developer can get on with their work faster. This is the same thing with Kentico and the Content Editors. The more generic and bespoke Web Parts you make, the more the Content Editor can do without the assistance of the Developer, which then leaves the Developer to get on with other work like improving the systems.

When you have a bespoke website that you need to do all the changes within the code, then the Developer needs to do all the leg work for even the smallest change. If the Content Editor wants a box moved to another location of the page, then that’s a boring task for the Developer. However with a CMS like Kentico, the Content Editor will be able to move this by themselves.

I would rather this kind of work pattern as for both Front End and Back End development, as I want to be working on the next great and latest thing, while also looking to improve my code and the testing. This work pattern removes them small tasks that interrupt your work, plus also if you work in Scrum like myself then it takes up your sprint points working in the more Developer heavy pattern.

As mentioned above its not just moving Widgets and custom Web Parts that make this CMS great. It is also the fact that the Content Editors can create their own forms. I remember having to built every simple form from scratch each time, but this now puts the work in their hand, but also in a simple way. I also say simple forms, but it is as simple as you the Developer wants to make it. As you can customise or custom build the Form Controls that build up the form and the Form Web Part that is the base of loading plus saving the form, then you can make them as complex as you want. If you want the form to be in different style, then build different Form Widgets. If you want multiple fields that result in a single field of content, like an Address, then build a custom Form Control. The ideas are only limited by you the Developer or the Content Editors ideas.

The downsides I have seen are where the Content Editors have a lot of great simple ideas. I have been given tasks of adding a new type of button or adding a new content area to a Widget. Although we are empowering them, we also still need to provide the tools to them, which aren’t always the most inventive ones. There is also a balance between empowering them and giving them the code. You could expose all the customisable features of the Web Part, like a button so the colour, size, wording, features but then it’s a huge amount of work for one button. This would then put them off using it, however the other way of closing it down can then put more tasks on you.

Another challenge is what you can customise and what you should. Kentico’s recommendation for when you are customising anything, is if it is default to Kentico then clone it and customise the clone. This is so if or when you need to upgrade the CMS, you haven’t broken anything that the upgrade will use, plus it could get over written when the upgrade is then place. Even though Kentico is full customisable, the method in which it performs some task might not be how you like and at best practice you need to leave them how they are.

Final thoughts?

Although there are downsides to using a CMS like Kentico, I think any method of using a CMS will have its downsides. I feel with this set up I am more looking at improving the code, myself and the product, rather than doing the same task each time.

What CMS do you use and do you think it helps you become a better developer, comment below?

Find Fully Qualified Azure SQL Database Name

This is a step by step guide on how to find you Fully Qualified Azure SQL Database Name in the new Azure Portal. This can be used for the Scale Azure SQL Database with PowerShell program.

1) Browse to https://portal.azure.com and sign in with you credentials.

2) On the left menu click ‘Browse’ then ‘SQL Servers’

3) In the first panel click on the server name you want the name for. This will bring up the next panel that you should click the ‘Settings’ tile. Finally click the ‘Properties’ button in the last tile.

4) The tile should now change and you can find the ‘Fully Qualified Server Name’ under ‘SERVER NAME’

Scale Azure SQL Database with PowerShell

In the pursuit to move to Azure we have had the need to scale the SQL databases. Your company may only have high or any traffic during certain times or even certain season. We need the best solution during working hours so this is what I have based it off.

The program will take the database you want to scale and then you can set it to be whichever setting you require. So lets begin…

The first step is to install the necessary programs and plugins. These are

  • Install Azure Power Shell
  • Install Command-Line tools

These can be downloaded from The Azure Downloads Section.

Now we get into the PowerShell scripting part. The first section is to get the credentials for the database server. There are two method to this that I have found.

The simplest and securist method is to use ‘Get-Credential’. This will promote you for the username and the password for the database, that will be used later for the authentication.
#Varibles
$DBname = "protech"
$creds = Get-Credential

The other method is less secure as you will have your username and password stored in the file unencrypted. Though this is the best method to then have it automated with out the need for user interaction.
#Varibles
$DBname = "database"
$username = "username"
$password = "password"


#Credentials
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$creds = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr

This section then gets the connection to the database. This is where it will use your ‘creds’ variable and also the full name to the database. You can get this by following the step guide on How to find the Fully Qualified Azure SQL Database Name. In the example below I have put ‘DBname.database.windows.net’
$serverContext = New-AzureSqlDatabaseServerContext -Credential $creds -FullyQualifiedServerName DBname.database.windows.net
Other methods to get the Server Context are on the Microsoft Website. https://msdn.microsoft.com/en-us/library/dn546736.aspx

Finally you can connect to the database using you ‘serverContext’ and the chosen ‘DBname’.
$db = Get-AzureSqlDatabase $serverContext –DatabaseName $DBname
Below are how to change to the different Azure SQL Database Tiers. I have added how to change to each one, so you will just have to chosen which you would like.


Scale Azure SQL Database to Basic

$b = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "Basic"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $b –Edition Basic


Scale Azure SQL Database to tandard 1

$S1 = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "S1"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $S1 –Edition Standard


Scale Azure SQL Database to Standard 2

$S2 = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "S2"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $S2 –Edition Standard


Scale Azure SQL Database to Standard 3

$S3 = Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "S3"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $S3 –Edition Standard


Scale Azure SQL Database to Premium 1

$P1= Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "P1"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $P1 –Edition Premium


Scale Azure SQL Database to Premium 2

$P2= Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "P2"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $P2 –Edition Premium


Scale Azure SQL Database to Premium 3

$P3= Get-AzureSqlDatabaseServiceObjective $serverContext -ServiceObjectiveName "P3"
Set-AzureSqlDatabase $serverContext –Database $db –ServiceObjective $P3 –Edition Premium


An issue I found was the once I had saved the PowerShell file it wouldn’t run. There would be permissions issue to run the program, so to get round this if you run the below script first it will give you the permissions to run the code.

Error:

Set-ExecutionPolicy : Access to the registry key
‘HKEY_LOCAL_MACHINESOFTWAREMicrosoftPowerShell1ShellIdsMicrosoft.PowerShell’
is denied.

Solution:

Set-ExecutionPolicy Unrestricted

How to find Azure Subscription ID in the new Azure Portal

Just a quick step by step on how to get you Subscription ID from the New Azure Portal.

1) Browse to https://portal.azure.com and Sign into your account.

Screen-Shot-2017-02-18-at-16.26.jpg2) Once  you are in the portal you should see the side panel with a tab for ‘Subscriptions’. Click on this to get to the next section. If the tab is not visible, then click on the ‘More services’ tab to find it.

3) In the new open panel you will see all the subscriptions you have access to and in the ‘Subscription ID’ column is the what you are looking for.

Screen-Shot-2017-02-18-at-16.29.jpg


Azure Training Resources

AZ-300 Microsoft Azure Architect Technologies Complete Video Learning Certification Exam Set (DVD)

70-487 Developing Microsoft Azure and Web Services Complete Video Learning Certification Exam Set (DVD)

AZ-500 Microsoft Azure Security Technologies Complete Video Learning Certification Exam Set (DVD)

Export Microsoft SQL Database to Azure

As a developer who has moved a database to Azure, I know it can be a pain to find out exactly how to export a database in Microsoft SQL Server Management Studio. Therefore here is a step by step guide on how to export your database to Azure. There are also some pointers where I found trouble and if anyone else has some tips, please add them in the comments.

1) First and the simple step is to open SQL Server Management Studio.

2) Find the Database you wish to move to Azure and right click on it.

3) Navigate to ‘Tasks’ then to ‘Deploy to Windows Azure SQL Database’

4) When the first pop up comes up, you will just need to click next.

5) On the next screen you will need to connect to your Azure Server.

Required Details:

  • Server Name
  • Choose ‘SQL Server Authentication’
  • Enter the server Username
  • Enter the server Password

6)   Once connected enter in the New Database name you want to call it. The other setting I left alone, but you may want to change them as you wish. After all is entered you can click next in the bottom right.

7) You will then have a summary page before you press next again to start the transfer. You can then start the transfer!

 

Errors

1)  Error SQL71564: Error validating element [DATABASE]: The element [DATABASE] has been orphaned from its login and cannot be deployed.

FIX

This means that there is another owner on the Database. To fix this do the following:

Go to the target Database > Expand ‘Security’ > Expand ‘Roles’ > Expand ‘Database Roles’ > right click on ‘db_owner’ > click ‘properties’ as below

The report would have told you what owners you need to delete. Select the owner and click remove in the bottom right.

As well as this, you will need to delete the ‘Users’ from under the ‘Security’ section.

 

2)  Error SQL71564: The element Extended Property: [dbo].[VIEW_NAME].[MS_DiagramPane1] is not supported when used as part of a data.

FIX

ou will need to delete the extended properties on the views in question. Go to the View and right click on it. Click on properties then go to ‘Extended Properties’ on the side navigation. Select each property and delete it.

3) Error SQL71564: Table Table: [dbo].[TABLE] does not have a clustered index.  Clustered indexes are required for inserting data in this version of SQL Server.

FIX

To fix this you need to make sure the table has a primary key. To do this find the tale you that is the cause. Open up the database and right click on the ‘tables’. Select the design view and find the row you wish to make the Primary Key. Right click on the row you want to set to the Primary Key and click ‘Set Primary Key’.