PDC09 – What I’ll watch – Day 1

PDC09  has started. Unfortunatelly I’m not there. But no worries! Everythings get recorded by the Channel 9 chaps.
I thought: let’s share my recommended movies / the movies I’ll watch :).

So here we go:

  1. Data Programming and Modeling for the Microsoft .NET Developer
    Don Box! The main guy behind Oslo, someone you should always watch!
  2. Microsoft ASP.NET 4 Core Runtime for Web Developers
    That’s my job isn’t it? ASP.NET 4 is upcoming, .NET 4 is upcoming, so we as Sitecore should remain running!
  3. Code Visualization, UML, and DSLs
    Very interesting way of looking at code is to Visualize it and make it more human.
    Definitelly one to watch.
  4. Manycore and the Microsoft .NET Framework 4: A Match Made in Microsoft Visual Studio 2010
    Many core is the main issue these days. This video brings a lot of the great work done by MSFT together.

All together 4 hours of watching. Have fun 🙂

Updated: Now with working links. Sorry!

Sitecore tells you: “Specified cast is not valid” during startup

An annoying issue which came across twice this week: Sitecore was throwing “Specified cast is not valid”-Exceptions:

"Specified Cast is not valid"-exception

And seriously, if there’s one thing I hate about .NET in general, it are exceptions. 95% of the time they are non self explaining and sometimes even nonsense. This exception would normally take me 20 minutes to solve at least. But not this time. So how to solve this one?

Basically, this is nothing more than a Database Connection error… When I added /sitecore behind my url, I received a generic connection failure exception. I had to do some work on my connection string(or start my SQL Server). That’s all. But Alex, where did it come from? And why does the login page show something different?

Chicken and the egg issue: when accessing an Item we need a (SQL)-Database, but before allowing to access an Item, we need a User, a User needs a (SQL)-Database. And of course, this dependancy became stronger when we introduced Sitecore v6 with the Membership Providers.

So what can we learn from this? Always consult both pages: / and /sitecore. Often, there’s a different message. Sitecore is all based on context(yes, Sitecore.Context…). So when you have a problem, always try different entry points to minimize the Context. For example, Sitecore has by default 2 active websites running: ‘website’ and ‘shell’. In this case, I tried to access both of them.

Happy coding out there 🙂

Sitecore 6.1 Update 1 Released

To all of you Sitecore Developers, Architects and Webmasters out there. I just want to point you on our latest update: CMS 6.1.0 Update rev. 090722 , also known as 6.1.0 Update-1 ) and OMS 1.0.0 (full version number: Sitecore Online Marketing Suite 1.0.0 rev. 090722).

Although it isn’t a recommended release at the moment, I’d suggest everybody who’s working with the Sitecore OMS to update your installation to this version. Especially when you’re still in the development process of your website. Directly after the final release we’ve been working for a full month to make sure this release would fix every annoying issue which was introduced with our newest release feeded by the earliest Customer and Partner feedback.

So to give your site an optimal boost: install this version! 🙂

Later this week, I do expect some more exciting news… I’ll keep you posted!

Sorting Sitecore Items

One of the most unknown but very useful feature in Sitecore is the Subitem Sorting. Often there’s a need to sort a group of Items in a particular order. Either to create a good navigation or to help the content editor find their content.

So let’s have a look how this functionality is working. I’ve installed an empty Sitecore 6.1 installation and created a couple of sample items in a random order.

Sitecore tree with random items
Now I want to sort my items in a less random order. Let’s order them on Display Name. To do so, I’ve to go to my Home and click on the Sorting Command:
Sorting command in Home tab
A new windows will appear with a list of the default Sitecore Sorting settings:

In this case I select ‘Display Name’. The box below will give me an immediate preview how the new order of the Subitems looks:

There are plenty other options to choose, including Standard Values.
When I click on ‘Ok’, the setting will be applied and my content tree will refresh:
To reflect the change in the front-end, you’ve to publish the Home item including subitems (or execute an Incremental Publish).
Note: As always, it’s a best practice to setup Subitem Sorting on the Standard values of a template. That will make sure that all the items based on the Template will reflect the same sort order. For individual cases, you can set it up on an individual item.

To make sure that this example works fine, I’ve made sure that the name of the item is also inserted in the Title field of my Item:

imageNow I want to create a custom Sorter which sorts my items rather on Title than on Display Name. The first thing I’ve to do is to write a small class:

   1: using Sitecore.Data.Comparers;

   2: using Sitecore.Data.Items;


   4: public class YetAnotherComparer1 : Comparer

   5: {

   6:     protected override int DoCompare(Item item1, Item item2)

   7:     {

   8:         string x = item1["title"];

   9:         string y = item2["title"];


  11:         return x.CompareTo(y);

  12:     }

  13: }

The class implements Sitecore.Data.Comparers.Comparer. This base class forces you to implement the DoCompare method. Basically, this method reads both title values and compares it using the .NET built-in string.CompareTo().

Note: I’m using the indexer([“fieldname”]) to retrieve fields. This will never return a null, only a string.Empty when the field doesn’t exist or is empty.

Afterwards, we’ve to register the class in Sitecore. We can create an item of the template ‘Child Sorting’ (/sitecore/templates/System/Child Sorting) in /sitecore/system/settings/Subitems Sorting:

imageNow I’m able to select my item from the sorting dialog:

imageAnd from now on, my items will get sorted by title-value.

Of course this is just an example. You can think about different sorters and also use them in the front-end.

Sitecore’s VP and Founder Lars Fløe Nielsen will follow up on this post with more technical details and how to use Sitecore Sorters in the frond-end. I’ll update this post once his second article is published.

Thank you, Sitecore community

Just a short blogpost from me this morning. I want to thank all of you for supplying us so much valuable input. We highly appreciate the way you guys are helping us on improving all the different functionalities in Sitecore.

Today I had a short conversation with a partner and later on one of our core developers about the page editor. It seems that we can accelerate very quickly when you express what your thoughts are.

It’s also a big compliment to our core team. These highly skilled guys are able to look through the bush and discover real life issues. It requires a high level of abstraction but also a deep insight in daily issues at our partners and customers.

Please keep the suggestions coming. I try to direct them. Likewise will Lars and Darren. And when I’m talking about suggestions, don’t stick to API changes, also higher level opinions such as documentation or development strategies are welcome. Feel absolutely free to contact us either using email(adg-at-sc-net), Twitter or any other media.

That’s it for this morning. Have a great day, I’ll have a great coffee :).

CMIS, my vision

Today I represent (as usual) my personal vision. I tell this once again, just to be sure that my personal vision won’t become Sitecore’s public vision :).

This morning while I was running through my task list I decided to share this on my twitter account:
Thinking about my CMIS proposal for product management: can WCM really benefit from an ECM(mostly DM) standard?!

I see it as one of my primary responsibilities inside Sitecore to inform product management about changes in our world of content management. Most of the time they’ve already added something similar on the roadmap, but it’s good to have my input. I talk on daily base with our implementation partners and customers, they do not always get that chance.

After a while, a couple of reactions showed up. John Newton, one of the founders of Alfresco replied to me and so did some others. It shows how constructive a tool like Twitter can be, but more important, how hot this topic is.

JBoye just posted a blogpost(also a reaction) about what they think customers should do an not do at this moment. I agree with them to some level, but only if you include the reactions in your vision.

But let’s get back! What is CMIS? It is a standard for communicating between different ECM installations. There’s a big need for the possibility to interexchange documents including metadata between these systems. These documents often have a lot of metadata and also their folder structure tells a lot about their semantics. As every vendor has its own idea about how to store this data, it is very important to have an common format for communication otherwise exchange of documents becomes impossible or very expensive.

(This is of course a simplified view on CMIS. It does include the state where a document is in and lots of other features. Some more or less important.)

The evolution of having such a ‘protocol’ and to see the different vendors talking about these things is a very good step. As vendors ECM, DM and WCM have to deal with all kinds of different standard. Most of them are very technical, take for example Web services, RSS, Atom, WebDAV, etc. Most of them are also not intended to become a standard in our particular space of issue solving. Which means that they are too general or too domain specific to integrate tight with a system like Sitecore.

The question is now what value CMIS brings to WCM. WCM is not document minded and often it does not focus at all on storing document. Looking at today’s Web pages, you often see that companies try not to deliver to many documents on their websites. Which is a good move, as it improves usability. But CMIS is not just about PDFs or Word documents. It does include movies, illustrating images and results of collaborated documents as well.

As soon as the standard will reach its public stages, we as Sitecore, but all the purely WCM vendors should definitely start supporting this standard. But not as a content producer. ECM and DM will continue to focus on creating documents. Although WCM can deliver this, their main target is a markup languages. WCM is very good in producing (X)HTML, XML and image manipulation. Its strength is definitely not creating PDFs or so. Most WCM vendors are capable of doing it technically, but they cannot facilitate the quality process steps ECM can.

Therefore it doesn’t make a lot of sense to integrate the whole standard a producer. But as a consumer it does. Often documents get published out of intranets and other collaboration environments. It does make sense to be able to consume these documents and use them on all kind of web pages.

In some way WCM should support the production side as well. WCM has a real strong relation minded structure. This means that content tagging, inter-content-relations and other ways of categorizing are available out of the box. Why not use this data back to feed the ECM again? Looking at the world of web 2.0, you often see the end consumer(also known as website visitor) does tag/rate content. This information is highly interesting for the content producer.

On the other hand that’s also the challenge for WCM. Because of our nature in linking data to each other, you can harder define a single asset. That’s a pity as you have to define, in my suggestion above, if user generated content is a property of a certain asset or not.

As you have seen above, I see a lot of value in CMIS for WCM. But we should keep in mind that the standard is still a draft. When the final version is there Sitecore and all the other WCM should start to support it as a data consumer(once again: my opinion). It will decrease the investment for companies to get their back office to communicate to the front-end. Which is always a great step. Beside of that it can decrease the time to market for certain information and allows team to gather feedback from the web(depending on the implementation and the product visions of both vendors: ECM & WCM).
It also shows how separated WCM can be from ECM. This discussion wasn’t ongoing when ECM had incorporated WCM totally.

The acceptance of the standard can highly benefit from a toolset developed for the different platforms. I would highly support the idea of having Microsoft (.NET) and Sun (Java) writing the communication layer as a library. The specific implementation can be completed by every individual vendor. But this communication part shouldn’t take to much time from every individual vendor, reinventing the wheel.
It doesn’t matter if it are Microsoft and Sun or if it becomes an open source project. As long a the biggest vendors doe support this open source solution as well and give an indication of it’s quality.

This whole CMIS standard, all the attention and discussion around it will hopefully open the discussion for standardizing WCM solutions as well. Similar to DM I think that it would be good to come to an exchange format which allows WCMS’s to exchange data but in a more specific way than RSS and Atom do these day. A big lack of these formats are internal linking and once again document support. Also, you’re strictly bounded to a set of predefined data.

But that’s a total different discussion. Hopefully this posting explains a lot to you. I’m sure I haven’t covered all parts of CMIS and also haven’t spoken about all the business opportunities WCM can get out of it. But I’ll leave that up to the imagination of you, my reader and commenter.
It’s time now to get this in more in-depth and slightly more technical to product management :).

Sitecore and SSL

As a Solution Architect in Sitecore you often get request ‘howto do SSL in Sitecore’. Beside of our great Shared Source SSL module, you’ve to do something on configuring the network/OS level to register the certificate.

So what’s the general idea of SSL? You want to have certain pages to execute over an encrypted connection. The most feasible solution is SSL which encrypts the data by default using a 128bit encryption. Still pretty strong these days, although I won’t be surprised if we move to 256bit somewhere in 2010. There are several traditional vendors who deliver certificates. In the Netherlands for example KPN. All register their certificates at VeriSign, a party who does take care of the strength of the encryption and the validation of newly created certificates.

Afterwards you’ve to integrate it into Sitecore. A very simple solution is to decide per item if you want to run the constructed page on SSL or not. The Shared Source component takes care of that part.

Now the infrastructure / OS ‘issue’. It seems for a several reasons that running certificates on the web application software(IIS) is very expensive. Combining encryption with page rendering is always possible in every internet server(Apache, Tomcat, IIS, etc), but all have significant disadvantages when it comes to delivery.

I often suggest to rather use a network based solution. These days’ routers, load balancers and switches have the possibility to handle https/ssl for you. As these machines are designed for passing TCP/IP packages thru, they can easily encrypt them. Beside of that, when you run into out scaling scenarios, you don’t have to manage your certificates on multiple places.

Here’s a simple diagram:

SSL Executor

In this case the SSL Executor is a Reversed Proxy, but it can also be a firewall or other network interface.

Hope this helped. 🙂

Note: This is a post written out of my experience as an architect in many projects. I’m involved in general in Sitecore projects, but rarely I’ve got the opportunity to ‘work’ a little outside of this boxed environment. Often these high level problems arise in project where Sitecore is involved but also in other projects. It’s never my intention to blame a vendor, although I might point out some weaknesses.

Microsoft: Maybe the solution for a lot of your problems?

Figured just out that when starting programs in my newly installed Windows 7 installation, I’m always searching for the name of the program. For those who are not familiar with ‘searching in the startmenu’, please have a look at the screenshot below and look particularly at the search box.


When I search for ‘Internet Explorer’ I’ll get my standard browser: IE. Searching for ‘Mozilla’ will return the browser I use for mail and feed reading(all Google).

Why am I searching for Internet Explorer or Mozilla, why not for ‘Browser’ or ‘Internet’? I can depend on the icon what to choose. It will safe me a bunch of irrelevant names to remember, but more important, it more intuitive. It will also get the discussion away from what kind of browser you’re using. Create a simple dialog which allows you to download a couple of browsers associated to it. It is more logical and less vendor specific. I think it will be the solution for the discussion bundling IE with Windows as well!

About Data Driven Websites and Object Relation Modeling

I’ve reinstalled my machine of last night with Windows 7. I’m very happy with this new platform! Thank you Microsoft. One of the final reasons to start yesterday was that my database integration in Visual Studio was broken. Of course there where many more reasons, but that was the issue which made me do it yesterday evening.

So far so good. This morning I started of with a clean and very fast machine. Visual Studio 2008 was ready to roll. I’ve installed the Developer Edition of VSTS yesterday eve.

Today I decided to spent a little bit of time on getting the Entity Framework to work for a small, highly data-driven portal I’ve to develop. One of the issues with the portal is that it should be ready by yesterday. Not so much pressure, but I wanted to be highly productive. Unfortunately I’m highly disappointed.

While we all still claim that simplistic data driven websites should be online in a couple of hours, the truth is the opposite. I’ve got an app where you’ve got users. Users can be in a WorkGroup and some of those these users are leaders of the group. In objects:

  • User.WorkGroups –> List<WorkGroup>
  • WorkGroup.Users –> List<User> –> All users associated, incl leaders.
  • WorkGroup.Leaders –> List<User> –> All leaders

In the database you’ll store this as 3 tables: User, WorkGroup and an AssociationTable with a property ‘IsLeader’ (bit).

The database design was easily made, as I told you before, I decided to use the Entity Framework. But somehow I was absolutely unable to get this to work. I could get the User <-> WorkGroup(many to many relation) to work, but the Leader-relation couldn’t be made without modifying the generated code(or maybe the XML?). 

I’m sure one of you guys will give me the solution how to get this to work. And once again absolutely sure that this is not impossible. But I’m in general wondering why I couldn’t figure this out during the 2 hour R&D I’ve spent on it. The designer doesn’t seem to support something like that. Or it is hidden, somewhere. I’m not sure if this is just a limitation of the Entity Framework or of many O/R mappers.

I do know I generally dislike my whole process. I’ve been switching over and over between the different designers for my entities and database. This makes me wondering. What if this is your daily task? Getting a model designed by business users(interpretation I), normalize this(interpretation II), fit this into an object design(interpretation III) and maybe redo some of these part during one of the stages.

Let’s look from a perspective of a developer. I do not care about the database. It should just be stored. I care about the way I can access the data, so I want to control the types in my entities. My illusion: create a model(we’ve got a language for that: UML). Hit a button, and code + database should be ready.

Optimizations for storage and in the data access code should be done by the generation. The computer is way smarter when it comes to optimizing, it can calc all data access roads and ask if I want to flag more often used data. When I want to create a specific method(for example: GetById) I can define it in OCL.

The solution seems to be so obvious. Why can’t I find such a tool? I can find database generation tools, I can find O/R mappers. I can even find frameworks which should be O/R mappers(isn’t the Entity Framework the framework to be?). But none of these support my vision.

What can I do know? I can use a CMS to store my relational data. All my relational data, maybe thousands of records. I’ve to find a way how to store it internally as CMS’s use all kind of structures, but never a relational one.

I’ll end up in this project using an heavily modified Sitecore installation with lots of custom code to get around the limitations(I’m able to write that quickly as you can imagine). But hopefully you’ve seen my point. I gives me a huge headache in this age of data generation, web service generation for out scaling, advanced cache structures, cloud computing, etc.

Do you got a solution in mind for me?

Note: This is a post written out of my experience as an architect in many projects. I’m involved in general in Sitecore projects, but rarely I’ve got the opportunity to ‘work’ a little outside of this boxed environment. Often these high level problems arise as well in project where Sitecore is involved. I won’t blame a vendor, but I’m wondering why we smart guys are not able to solve issues like productivity without doing concessions on the business requirements.

LINQ is all about being smart

The competent programmer is fully aware of the limited size of his own skull. He therefore approaches his task with full humility, and avoids clever tricks like the plague.

I wanted to be smart. I tried to use LINQ to XML for parsing an Atom feed. Here’s what I’ve got to read a link:

var urlElement = item.Elements(xmlns + "link")
                                .Where(link.Attribute("rel").Value == "alternate")
                                .Select(link => link.Attribute("href").Value)

Do you see the issues? 3 Nullpointers:

  1. Attribute “rel” in my Where
  2. Attribute “href” in my Select
  3. First() –> What if I have nothing to get the first of?

Once again this underlines what Edsger W. Dijkstra said in the quote written above. You try to be smart by using the latest stuff, coolest tools, etc. But the limitations are never described, you’ll only experience them while debugging.

Another lesson learned.

Small update: Those who are using Resharper will get notified about the first 2 nullpointers, but not about the third. On the other hand, solving that in the where clause doesn’t fix the value analysis (seems to be hard in lambda’s).