The Console of Mass Content Management

This one definitely took more time than I initially expected, and before I devote even more to it I would very much like to hear your opinion. Do you find it useful? Which way should the development be going? But first things first?

Have you ever found yourself:

  • having to make a mundane change to a large number of pages?
  • in need of getting statistics on page properties or page type usages?
  • being curious of e.g. what?s the oldest page on your site?
  • having to copy or move a large number of files from one folder to another or between versioning and non versioning virtual path providers?
  • renaming or deleting files in your file store en-masse?

If the answer to any of those (and more) is a ?yes!?, I believe you might find my little plugin useful.

The idea is to create a scripting environment to work with EPiServer on a more granular level than the existing PowerShell SnapIn API enables us currently. Manipulate not just sites, but files and pages on a large scale or perform statistical analysis of your content using  a familiar and well documented query language.

PowerShell1

The PowerShell console for EPiServer provides you with two abstractions to work with:

Virtual Path Provider Drive

With the console you can browse the VPP and perform a number of file operations just like you were doing it in a regular PowerShell console on a regular disk drive. Especially?

  • move files between Virtual path providers
  • move, copy or rename files and folders

Known limitations:

  • You cannot load files from disk directly onto a VPP and vice versa (this however can be overcome by mapping the path you want to migrate into your CMS as a native path provider and copying from that).
  • some actions might not respect or might unintentionally force recursive operation.
  • the console might blow up unexpectedly (What do you mean crippled? I got all five fingers! Three on this hand, two on the other one!)

I think you might find it quite useful offloading files from versioning VPP onto a Native VPP once you decide that you want to access the content of the files outside the CMS. Or pulling your files into the Database VPP (available for download from EPiCode).

Page Store Drives

The console will map all your CMS page roots as drives based on the site name (site name should not have space in it for the current version to work). Now this one? the sky is the limit!

The items that the drive exposes are fully functional PageData?s, additionally ? for your scripting convenience all page properties are mapped so that you can access them like they were regular POCO properties.

By far this is the coolest little toy I?ve recently played with ? I would strongly advised that you look into the samples and put your imagination to work!

PowerShell2

You can create statistics, modify pages based on regular expressions, filter, delete, rename, move around?

PowerShell3

Naturally the Obligatory disclaimer is that you use the tool at your own responsibility. Make backups, test your script on staging before doing anything. Heck! Don?t use it on production at all yet (!) ? it?s very much an alpha and a technology demo.

[Download & Enjoy]

How to install?

Extract the DLL form the ZIP file into the BIN folder of your web application to install the plugin. Remove the DLL to uninstall it.

All constructive feedback appreciated!

Easy Enum property for EPiServer

One of the most frequently and eagerly used programming constructs of the Microsoft.Net Framework is Enum. There are several interesting features that make it very compelling to use to for all kinds of dropdowns and checklists:

  • The bounds factor ? proper use of Enum type guarantee that the selected value will fall within the constraints of the allowed value set.
  • The ability to treat Enums as flags (and compound them into flag sets) as well as a one-of selector.
  • The ease of use and potentially complete separation of the ?Enum value? from the underlying machine type representation that ensures the most efficient memory usage.

Surprisingly enough EPiServer as it stands right now does not have an easy facility to turn Enums into properties. To give credit where credit is due, the EPiServer framework provides a nice surrogate that mimic that behaviour to a degree. The relevant property types are:

  • PropertyAppSettingsMultiple  – which ?creates check boxes with options that are defined in the AppSettings section in web.config. The name of the property should match the key for the app setting.?
  • PropertyAppSettings  – which ?creates a drop down list with options that are defined in the AppSettings section in web.config. The name of the property should match the key for the app setting.?

You quickly realize though that the properties have some limitations that makes their use a bit less compelling:

  • The properties are not strongly typed
  • The property entry in AppSettings section has to have the name that matches the property name on the page.
  • It?s rather poorly documented, Other than relating to this blog entry or Erik?s post documenting it I could not find any other examples on how to use them. (but then again, who needs docs really when we have Reflector)
  • You cannot have the very same property duplicated on the page since you can only have a single property of a given name per page. So you need to have multiple entries in AppSettings that match the name of each of those properties on your pages. I know? semantics but still?
  • You are working on strings rather than enums (Did i mention it?s not type safe?)
  • The values in the AppSettings are stored in a somewhat DLS-y manner (consecutive options are separated from each other with the ?|? character, the name and the value are separated with a ?;?, for example: <add key = "RegionId" value="First Option;Option1|Default Option;Option2|Disabled Option;Option3" /> ) and I have had on an occasion entered a string there that caused the server to crash.
  • The values are not translatable, or at least I could not find how to do it and any Reflector digging rendered no results either.

Read the rest of this article »

SoakIE ? a Web Server Stress Tool with a twist

Last week or so ago a couple of friends in another project in Cognifide has run into a wall while trying to load test their website. the problem was as follows: The website is highly AJAX based ? the page merely loads a stub in the initial request but then loads the rest of its data in a dynamic matter therefore a traditional web testing tools are fairly useless. What they tried was to setup a number of Selenium clients to pound the server, but that turned out to be fairly challenging to the machine doing the testing. It was not possible to set up more than 10 clients on a fairly strong machine.

Also there are other limitations like time to wait for the server to timeout and time between clicks, which I am not sure the tool allowed them to adjust. Talking to them I recalled a tool for grabbing website thumbnails long time ago. one way for them would be to to make a batch file with it. The tool would grab the sites? thumbnail and stress it, but they would still have to setup a number of clients. Also it creates and tears down an instance of IE every time, making it?s not optimal for that task.

So a couple of evenings later (and a few back-s and forth-s during the testing sessions) out comes SoakIE:

SoakIETest

Read the rest of this article »

SoakIE ? a Web Server Stress Tool with a twist

Last week or so ago a couple of friends in another project in Cognifide has run into a wall while trying to load test their website. the problem was as follows: The website is highly AJAX based ? the page merely loads a stub in the initial request but then loads the rest of its data in a dynamic matter therefore a traditional web testing tools are fairly useless. What they tried was to setup a number of Selenium clients to pound the server, but that turned out to be fairly challenging to the machine doing the testing. It was not possible to set up more than 10 clients on a fairly strong machine.

Also there are other limitations like time to wait for the server to timeout and time between clicks, which I am not sure the tool allowed them to adjust. Talking to them I recalled a tool for grabbing website thumbnails long time ago. one way for them would be to to make a batch file with it. The tool would grab the sites? thumbnail and stress it, but they would still have to setup a number of clients. Also it creates and tears down an instance of IE every time, making it?s not optimal for that task.

So a couple of evenings later (and a few back-s and forth-s during the testing sessions) out comes SoakIE:

SoakIETest

Read the rest of this article »

SoakIE – a Web Server Stress Tool with a twist

Last week or so ago a couple of friends in another project in Cognifide has run into a wall while trying to load test their website. the problem was as follows: The website is highly AJAX based – the page merely loads a stub in the initial request but then loads the rest of its data in a dynamic matter therefore a traditional web testing tools are fairly useless. What they tried was to setup a number of Selenium clients to pound the server, but that turned out to be fairly challenging to the machine doing the testing. It was not possible to set up more than 10 clients on a fairly strong machine.

Also there are other limitations like time to wait for the server to timeout and time between clicks, which I am not sure the tool allowed them to adjust. Talking to them I recalled a tool for grabbing website thumbnails long time ago. one way for them would be to to make a batch file with it. The tool would grab the sites’ thumbnail and stress it, but they would still have to setup a number of clients. Also it creates and tears down an instance of IE every time, making it’s not optimal for that task.

So a couple of evenings later (and a few back-s and forth-s during the testing sessions) out comes SoakIE:

SoakIETest

Read the rest of this article »

Advanced Language Manipulation Tool for EPiServer

Have you ever (or have your customers) created and edited a page in one language only to realize that their selected locale was wrong? Have you ever wished you could delete a master language branch of a page  after creating its localized counterpart but you could only delete the newly created slave language instead? Have a customer ever requested that they could copy a whole branch and you convert it to another language so that they could then translate in-place?

Well I have? and I?m sure I will. And so did Fredrikj on the our #epicode IRC channel ;).

Basically I had the tool that would convert from one language to another, but Fredrikj requested something that would switch master language of a page from one to another. Since I?ve already had some of the work done, I?ve updated the stored procedure I?ve written some time ago and slapped a nice GUI up on it. Here?s the result:

 

AndvancedLanguageTool

What the tool allows you to do is perform either language conversion or master branch switching on a selected page and all of its children (if you choose so).

The stored procedure have been updated to work on CMS5 R2 (will no longer work on R1 ? but if you need that functionality, comment here or give me a shout and I?ll create a compatible version for you).

A word of caution though ? I take no guarantee whatsoever about its operation. Especially, if you wreck your client?s database with it. I did what I could to prevent some of the obvious problems (like switching to a non existing master or converting to an existing one) but I will not be responsible if it won?t work for you. make a database backup and experiment there before you do any changes on the real data. That said ? it works for me, so I think it should also work for you.

You can download the archive containing the tool here. unzip it to your EPiServer web application folder keeping the folder structure or the plugin reference will be wrong. Include the *.aspx and the *.cs files in your project and apply the SQL file to your database (The manipulation is performed by a stored procedure located in the file).

Also if you?re performing the change in a load balanced environment, you may need to restart the other servers once you do the changes. I reset the DataFactory cache, but I am not sure it propagates through to other servers.

Immediately after you implement the VirtualPathProvider proxy from my previous post you will notice a one fairly serious lack in it. Namely all the files within that provider will be hiding behind the registration form. That is not cool for a couple of reasons?

  • You may want to keep all of the files in one store ? being forced to put them into a designated folder is not desired.
  • You may want to make some file freely available for some time and lock it after a while, or the other way around (e.g. to allow the robots to crawl it initially). having to move them is just silly and defeats the purpose.

So how do you discriminate the files that you want locked from those that you want to be publically available, and potentially from those that you want only the logged in users to be able to get?

Specifying the EPiServer File Metadata sweetness

One of the potential solutions would be to define a special rights group and check for that group for the people that have your ?registered? magic-cookie. That however introduces a bogus group, and I would rather like to avoid that. However if you look into the FileSummary.config file that?s located in your web application folder you will find a slightly mysterious content. A bit of hacking reveals that you can actually add your own metadata to the file. For example adding the access rights based on what I?ve established above would look as follows (the content you can already find in the file that comes with the public templates that-we-all-oh-so-love is skipped):

Read the rest of this article »

Simple registration for files served by EPiServer

With the culture of knowledge sharing and open source spreading, everyone races to show they have something valuable that you may want. And while you may not ask for money for your content you may still want to get something in return, say a contact, an email address that?s verified (or not), to keep in touch with the consumer of your content.

Yet a full fledged registration doesn?t seem like a proper thing to do ? cluttering your EPiServer user repository with (let?s face it ? for a large part fake or temporary email addresses that user create only to get your content).

While there may be a lot of ways to handle that (streaming it through a page Response.WriteFile might seem as one of the more obvious ones), I would like to show you a cleaner, simpler and more elegant way that I?ve come up with.

We really don?t want people to deep link to our files without them knowing the files are from our site, that?s just rude ? so hiding them behind an obscure URL wouldn?t work (thus we cannot use the regular file providers). We?ve already establish that we don?t want to log them in, so setting file rights are useless. But I want all the benefits including client-side caching.

Basically the solution boils down to creating a thin layer over the File provider of our choice, in my case the versioning file provider. The only method we need to override in it is GetFile. I want to allow downloading for logged in users and I want to allow downloading for all users that have a ?magic-cookie? set. If either of the conditions are met, the file just downloads using the underlying provider?s routines including all the logic EPiServer has put for caching and rights. But if neither of the requirements are met, the user is directed to a page of our choice.

Read the rest of this article »

WebParts based Sidebar for EPiServer ? how to use it?

Once you?ll update the framework to the extended one, you will immediately notice that? nothing has changed. Hmm? did something go wrong?

Well, not really. By default the framework will be run in the ?legacy mode?. Thanks to an old article by our own Marek Blotny, I?ve learned how to build Plugin settings which are just perfect for the purpose!

So to configure and enable the new features you need to open your admin UI and in the ?Config? click on the ?Plugin Manager? item and select our framework plugin as shown in the picture

WebPartFrameworkPluginSettings1

The available options are:

Read the rest of this article »

WebParts based Sidebar for EPiServer ? how to use it?

Once you?ll update the framework to the extended one, you will immediately notice that? nothing has changed. Hmm? did something go wrong?

Well, not really. By default the framework will be run in the ?legacy mode?. Thanks to an old article by our own Marek Blotny, I?ve learned how to build Plugin settings which are just perfect for the purpose!

So to configure and enable the new features you need to open your admin UI and in the ?Config? click on the ?Plugin Manager? item and select our framework plugin as shown in the picture

WebPartFrameworkPluginSettings1

The available options are:

Read the rest of this article »