Thursday, June 13, 2013

Problems Installing Sitecore ECM 2.1

So I got to install Sitecore ECM, the Email Campaign Manager, which should work perfectly from Sitecore version 6.6 and forward.

In my test I simply installed Sitecore 7 from the Sitecore web application installer. From there on I setup the DMS (Digital Marketing System) which also is a prerequisite to run ECM.

When I had the ECM 2.1 installed correctly, I simply performed a smartpublish (as described in the installation instruction guide) and thought it was time to take a look at the module.

My dissappointment was huge when ECM failed to simply load from the "All Applications" menu.

I got an error stating that the newtonsoft.json.dll was not present in the correct version (3.5):


Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)




I double-checked this and was not surprised that the newtonsoft.json.dll in my bin folder was actually a much later version (ver. 4.5.x).

Now my question was - how could Sitecore let this bug through? It was a standard installation, I didn't do anything fancy. I couldn't even just start the module? But wait, my frustrations got bigger :/

I then downloaded the newtonsoft.json.dll in order to comply with the demands of the ECM module. I renamed my existing dll in order to neutralize it temporarily, I pasted the newly downloaded dll into the bin folder and refreshed Sitecore. I almost got happy: the ECM module loaded as intended.
But only to disappoint me further. When I tried to create the simplest flow to test-send an email I ran into further issues. When I attempted to edit the text for the test-email to send, I got a new exception. BAM!

This time it stated the reverse problem:
the newtonsoft.json.dll was not present in version 4.5.x. No it isn't I just neutralized it in order to comply with the other darn errormessage aaarrrgh :S

The solution was to add a section of configuration to web.config:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
  <assemblyIdentity name="Lucene.Net" publicKeyToken="85089178b9ac3181" />
  <bindingRedirect oldVersion="0.0.0.0-2.9.4.0" newVersion="3.0.3.0" />
    </dependentAssembly>
    <dependentAssembly>
  <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
  <bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="4.5.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

This configuration information tells the compiler to look for a newer version of the missing assemblies.

Strange that this is an issue in the first place. Secondly it should at least have been handled simply by submitting the information above as part of the installation instruction.

Well I hope we will get there some day :)

Upgrading to Sitecore 7

I have been in charge of upgrading our company Sitecore 6.5 rev. 110818 to Sitecore 6.6 in order to get the chance to use ECM 2.0. My first estimate on the task was purely based on documentation from Sitecore and knowledge about our internal development processes.

 I then came to learn that Sitecore 7 was just around the corner, and a tech-pub arragement by Sitecore on May 31st 2013 convinced me to take on this version instead of the 6.6 update 5. The main reason for the choice to upgrade to Sitecore 7 directly was that I was assured by members of the Sitecore-team behind the Sitecore 7 development, that the upgrade was merely a developer-centric feature-upgrade (not a very common thing in the Sitecore world), meaning that the new Linq provider, the item-buckets and the pluggable search was the only actual add-on of the upgrade (plus a few bugfixes).
 Of course we wanted to get hold of these features as well and therefore pursued the version 7.0 installation. 

Two interesting things to note though:

  1. Sitecore 7 is built targetting .net 4.5 
  2. The IIS application pool must be changed to run 4.5 in order to run the new site

Sitecore 7 on .net 4.5

This change means that you need to upgrade your Visual Studio Solution to VS 2012 (if your solution is based on Visual studio 2010 or lower), because you are not able to target 4.5 in VS 2010
Not that the installation of VS 2012 it-self was a problem for me personally - I have already made the transition to VS 2012 long ago - but the virtual machine the development-solution was using was not compatible with VS 2012 !

IIS application-pool on 4.5

This might turn out to be a problem for you if third-party DLLS are not able to run under this configuration.

Recommendation

Upgrade your solution to VS 2012 prior to installing the Sitecore 7 upgrade and making the necessary changes to your solution. This will enable you to address the problems one at a time and not pile up all the challenges you are facing.

Conclusion

Be sure that you are able to upgrade your solution to VS 2012 prior to the Sitecore 7 installation.

Hope that the description above will help you do a better estimate on your upgrade and help you be better prepared for the task.

Tuesday, September 20, 2011

Umbraco vs Sitecore (part I)

I recently started working with Umbraco CMS on a hobby basis and found it to be a pleasant change when comparing with working with Sitecore, which I have done for about 3 years now (since v.5.3.1).

Of course doing a real comparison on these two (although quite similar) products would be unfair to both parties as it would be similar to comparing a motorbike with a international flight based infrastructure; both are used for publishing content on the web, but there is a slight difference in size, maintainance, speed, reusability, scalability, etc.

Here I will not focus on the downsides of any of the products but rather the strengths. A strength in one product might be emphasized due to the lack of similar or only partial functionality in the other product.

Umbraco
What I found when I started using Umbraco was that it is extremely light-weight, easy to understand, use, maintain, flexible in some extent, combined with an open nice and friendly community that really supports the fellow umbracian.

Get it up and running
Its pretty easy to get umbraco up and running, through an easy and user friendly installer, and thats basically it. You even have the opportunity to install a default project called run way as a kind of structure scaffolding, that lets you get an easy start with umbraco. Furthermore the default installation contains xslt files for most common scenarios, such as menus and the like.

The structure
The structure that defines a webpage in Umbraco (normally) consists of
  • a 'document'
  • a 'template'
  • one or more macro's
The document being the data definition element, the 'template' being the umbraco implementation of an ASP.NET masterpage (which needs to inherit from the umbraco default.master)

and macro's being xslt files that render the data and are placed within the 'template'.

These are simply necessary conventions within umbraco that makes things work. 

In the image to the left the structure of the templates display the fact that inheritance is used to nest templates within eachother, thereby making it possible to reuse master pages for multiple template types. This kind of structure is used to create variations of subpages using the same master template.


Defining the data as properties in the 'document'
Defining the data as properties in the document is extremely easy and the range of field types fit most common purposes. In the image to the right a
'Textbox multiple' (which is a textbox with multiple lines) is chosen for the particular data type.

A regular expression is added as a validation expression making the editor aware of any errors typed into the field. This validation expression also prevents the editor from publishing the field. Clever, easy to setup, easy to manage, not so easy to reuse..
It would be great to be able to add the regex to a list of available validation expressions for solution scoped reuse.




Development in umbraco

Simply using the 'alias' of the document-property (see image above) disregarding the 'tab' the property is contained within, you can easily output the data directly in the markup of your template using the following syntax:


<umbraco:Item field='aliasName' runat='server' /> 


This approach is shown in the image below:



What you notice in the image above is also the use of an umbraco:Macro construct, which lets you reference an XSLT rendering. This is very easy and a commonly implemented approach to using XSLT in CMS. The use of an alias as a reference in Umbraco makes this implementation a tiny bit smarter than for example in Sitecore. Here you do not need to know anything about the actual physical localtion of the XSLT files as you need in a Sitecore solution. On the other hand you need to know the alias because Umbraco does not offer 'intellisense'/auto-completion in this case.


It is easy to create, maintain, and further develop document types, templates, and handle all the editorial work for a developer setting up the solution. XSLT editing directly in Umbraco is made easy and I definitely recommend it, because you get instant messages when some umbraco-specific error or compilation-related occurs. Like the lack of checking the value of a variable before use in some specific situations might give you an instant - although rather strange - error message.

Also you have the ability to develop and maintain the CSS and js files for the solution directly within the administration interface. This feature - and the ease of using it - really is a great feature, which in my opinion should become industry standard.

Need-to-mention drawbacks
Umbraco does have a functionality called packages, but moving templates, documents, and content between  development environments is quite a hassle. I have not found a working approach that supports this (yet).

Language versioning of content is not the easiest thing to do in Umbraco and requires a custom solution.

Development-environment-wise it is not as friendly as other CMS opponents.

Best area of application 
Small to medium-size solutions with no super critical data

Pros
Rapid development
easy maintainable
Fast
Great community
xslt macros within rich text editor



Monday, September 19, 2011

IntegerNumbersVerifiedWithRegex

Need a way to verify (positive)integer numbers within the range 0-999.999.999 containing dots? Use the following regex ^[1-9]\d{0,2}$|^[1-9]\d{0,2}\.\d{3}$|^[1-9]\d{0,2}\.\d{3}\.\d{3}$ Any optimization comments or better approaches are welcome.

Monday, November 16, 2009

XsltUrlEncodingInDotNet

I've tried to find out the smartest way to url-encode a string in Xslt (through .NET). To my surprise I must say that the easiest and fastest way to solve the problem was not through clean xslt, but rather through the use of jscript.

    <msxsl:script language="JScript" implements-prefix="xmlnamespaceofchoice">
        <![CDATA[
        function urlEncode(strURL)
        {
       
            return encodeURIComponent(strURL);
        }
    ]]>
    </msxsl:script>

and then calling the
<xsl:value-of select="xmlnamespaceofchoice:urlEncode(string(//myElement))" />

voila


Friday, November 6, 2009

Sitecore editor hassles

Recently I experienced an extremely annoying error which occurred
within the sitecore editor:

"Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: no segments* file
found in Sitecore.Data.Indexing.FSDirectory@D:\Inet\Websites\Development\Website\indexes\master\system:
files:
"

Just a plain .NET Exception page... What caused the error?

/*TODO: description LUCENE, stackoverflow,*/

FIX:
Goto sitecore "control panel", choose "Database" and "Rebuild the
Search Index" and reload sitecore. Done :)

Sunday, June 7, 2009

OneClickSuperSmoothOnlinePhotoGallery

I have owned a digital camera since 2002, but not felt that I could find the right platform for exposing them on the web. I have tried creating a website that contained galleries, I have tried tools that would generate galleries for me from tools on my local machine, but I just wasn't satisfied. Either the layout was not as I intended, the gallery urls were too parametrized, or preload of photos just didn't work well enough.

Now I have finally found an interesting setup, where all my needs(until now) have been met.

I worked with the flash based airtight simpleviewer component for a while and found it very usefull, configurable, and visually satisfying. You can configure the amount of thumbnails to display, the size of these, the layout(mostly colors and borders), the position of the thumbnails(top, bottom, left,right) and numerous other settings. The gallery information is maintained within an xml file and therefore it is easy to generate this information based on eg. images within a folder structure(I have done this before working on http://www.elileibo.com/ and http://colorrange.com/).

But still..I don't want to manually upload all the images for a gallery and the associated text files describing each picture, when what I really like to do is taking pictures and editing them.

Recently I found out that adobe lightroom 2.2 has an integrated functionality that enables you to compile a gallery(within the application), configure your ftp settings for your domain, and upload the compiled gallery as a simpleviewer gallery! This means that I do not need to spend time uploading all the files I have been developing anymore. Furthermore I do not need to write individual text files describing each image, here I just configure lightroom to add various information to the gallery (information like date information, keyword information etc.).

The last thing needed to finalize my one-click super-smooth photogallery was creating an index page displaying all the galleries on my domain. That was accomplished by writing a bit of C#, css and html(around 400 lines of code) and bada bing -

http://digitaldynamo.dk was done.

Layout is a matter of taste. I like it. Its simple and smooth. Main focus is on the photos anyway. The interesting thing here is that I now have a one-click super-smooth photogallery. I just have to compile the gallery within lightroom, tag the photos, write 3 lines of text , one for the gallery page title(displayed in the top of the browser), one describing the gallery, and the final one - the name of the folder on the ftp server. Then i simply hit "upload" and check it out on my website :)