Saturday, September 4, 2010

Sitecore Fetch Squad

Automated crawler fetching websites and blogs from Sitecore content

Archive for February, 2009

Two for the bookmarks

Posted by admin On February - 24 - 2009
Some of this information has been available for a while, it just hasn’t been easy to locate. It actually still isn’t ;-) But at least these two links look like they might be more or less permanent.

1) Sitecore 6 Release Notes

Gives you all information about known current issues. A big help, which should help you avoid getting too stuck trying to solve a particular issue - only to find that it is already known, and in some cases even comes with a workaround.

2) Sitecore 6 Change Log

Detailed information about the individual updates, so you can now be confident when choosing whether to go with the Recommended Release or the Latest Release.

Into the core

Sitecore 6 Service Release 1 is Out

Posted by admin On February - 24 - 2009

Sitecore
6 Service Release One
is officially out by the name of Sitecore 6.0.1 rev.090212.

A
massive list of fixed issues
, props to our documentation team for providing nicely
formatted change log.

I’ve done my share of work on it, so I’m just as excited to see it being released. Yay!

This is not a recommended release yet, as we require builds to be used in production
for some time to ensure stability first. So make sure to read this notice: It
is appropriate for use if it contains fixes for issues that you encounter with the
recommended release.

Alexey Rusakov on Sitecore development

Sitecore MemoryMonitorHook Threshold

Posted by admin On February - 23 - 2009

I spent February 18 through 20 with a customer experiencing performance issues with a Sitecore 5.3.1 solution. We identified a configuration problem within the first few hours, but I stayed on the project for a little while to monitor the solution.

As most Sitecore developers are aware, Sitecore is thoroughly optimized for performance, relying heavily on caching. Caching consumes memory, and caching requirements for a solution with significant data or load can exceed available memory. Out of memory conditions can cause exceptions and can cause ASP.NET to crash or restart, resulting in errors, delays, and outages.

Sitecore provides a memory monitor hook to flush caches when memory exceeds a given threshold. You configure the memory monitor hook using the /configuration/sitecore/hooks section of web.config:

<hooks>
  <hook type="Sitecore.Diagnostics.HealthMonitorHook, Sitecore.Kernel" />
  <hook type="Sitecore.Diagnostics.MemoryMonitorHook, Sitecore.Kernel">
    <param desc="Threshold">500MB</param>
    <param desc="Check interval">00:00:05</param>
    <param desc="Minimum time between log entries">00:01:00</param>
    <ClearCaches>true</ClearCaches>
    <GarbageCollect>true</GarbageCollect>
    <AdjustLoadFactor>true</AdjustLoadFactor>
  </hook>
</hooks>

The first parameter (the first <param> element) to the constructor for the Sitecore.Diagnostics.MemoryMonitorHook class specifies the threshold for the memory monitor hook, which is 500MB by default in Sitecore 5.3.1. Sitecore frequently checks the amount of memory consumed by ASP.NET and if it exceeds this limit, then Sitecore will flush caches. The following message repeated frequently in the logs should have made this pretty obvious:

WARN  Memory usage exceeded the MemoryMonitor threshold. All caches have been cleared and a forced GC has been induced.
WARN  Memory used before/after GC: 554,590,208 / 554,590,208

If you see a message like this, your cache may be too small. If you see it constantly, your cache may be way too small, especially if the before/after values are the same.

The problem for this customer was that the amount of memory consumed by ASP.NET was always greater than 500MB. Therefore, Sitecore was flushing caches constantly. It’s somewhat amazing that this didn’t completely overwhelm the content delivery and the database servers.

The solution is quite simple: either set the memory monitor threshold to an appropriate value, or set the ClearCaches property to false. In this case, we set the size of the cache to 1792MB and afterwards were unable to reproduce the issue.

Note that in Sitecore 6, the default value for the memory monitor threshold is higher (800MB), but it shouldn’t matter anyway because cache clearing is disabled by default:

<hooks>
  <hook type="Sitecore.Diagnostics.HealthMonitorHook, Sitecore.Kernel" />
  <hook type="Sitecore.Diagnostics.MemoryMonitorHook, Sitecore.Kernel">
    <param desc="Threshold">800MB</param>
    <param desc="Check interval">00:00:05</param>
    <param desc="Minimum time between log entries">00:01:00</param>
    <ClearCaches>false</ClearCaches>
    <GarbageCollect>false</GarbageCollect>
    <AdjustLoadFactor>false</AdjustLoadFactor>
  </hook>
</hooks>

I would like to thank Alexey Romaniuha of the Sitecore Support team for his identification of the issue.

John West Blogs about Sitecore

PCheX this out…

Posted by admin On February - 23 - 2009
If you’re already maintaining a decent Sitecore Blogroll you know this. But in case this blog has escaped your attention, I think you need to take a look at this:

Check your packages with PCheX

As someone who often designs update packages and mail them off to clients, I am sure this tool will quickly make it to the top of my list of favourite tools and save me a lot of hassle.

The description says it all lol… ;-)

“In a way, you can imagine PCheX to be like a little friendly elf who comes around and kindly whacks you around the head with a big rubber hammer if you design an unhealthy package. “

And we certainly don’t want to get whacked by big rubber hammers do we? :P

Into the core

About Toolbars, Desktop Widgets and Tray Icons

Posted by admin On February - 23 - 2009

I’ve read about 30 books about Time Management and Productivity over the last few years and there are a couple of things all the techniques in these books have in common. One of them is: Do one thing at a time. This is one of the main reasons why I stay disconnected most the time, and it is also the basic idea behind this post.

This post is about all the little applications and programs you can install on your notebooks and desktops as companion to various online services and websites. Although they come with a lot promises and large feature lists, I have a pretty strict opinion regarding all these little tools: If you can do it on the web, don’t use software.

Not only do they slow down your PC, they also distract you constantly from the one really important thing you should be doing right now. Using your browser to access those services gives you a lot of advantages, that may not be that obvious. Here are my top three reasons not to use desktop counterparts for web services:

  1. You are in control of your time and you avoid distractions. The reason for this is pretty simple: If you need to access a website, it is totally up to you not to do so. So there is no chance for any of these services to make that decision for you. This means, you don’t get interrupted (or maybe even disturbed) by all these “tiny little helpers” hiding in your system tray (that is the area right next to your clock in the lower right corner on your desktop).
  2. You focus on one thing at a time. As you probably use one browser window in fullscreen mode to access different websites and services, you are automatically focused on one tool at a time. This makes your work much more efficient and effective.
  3. You don’t waste time for installing, configuring and maintaining an application that doesn’t work offline anyway, so why not accessing the native website instead? Just put a bookmark on your browser for fast access and enjoy the web.

This doesn’t mean that desktop versions of popular web services are inherently a bad thing. They’re not. But if you use them, you should consider the basic idea this post is based on: Do one thing at a time.

The following list contains the most important applications I use on my desktop although there are web-based counterparts: Windows Live Messenger (because there is no support for advanced features like File Sharing or Video Conferencing in web-based clients like Meebo), Skype (because there is no real web equivalent), EverNote and MindManager (because I need to be able to offline access my stuff and because of the great integration with other applications).

Julius Ganns . netzkern

Using anonymous types for databound web controls

Posted by admin On February - 18 - 2009

When using data bound controls it can sometimes be a pain to ship data across to web control you want to bind the data to. For example lets take a repeater control. Our application is quite simple, we have a person object containing name and date of birth, our application then takes this information and calculates which year they turned 18. The code for the Person class looks like this:

public class Person{
    public string Name{get;set;}
    public DateTime DoB{get;set;}
}

And the bit doing the calculation like so:

        List
 people = GetPeople();        people.ForEach(x =>        {            int year = GetYearTurned18(x);                    });

At the moment very simple but I am not doing anything with the calculated value except assign it to a variable. What I want to do is pass all this to a repeater control so that I can then render it nicely on screen. The result should look like this:

Mike 23/03/1976 1994
Fred 21/07/1980 1998

So I want to bind it to a repeater a control by passing it to the DataSource property and then calling DataBind. I can’t just pass both the person object and the calculated year into the DataSource because it only takes a single object, so I need to work out some other method.

The first thing might be to turn the calculation into a method on the person class like so, this will allow be to pass a list of Person objects to the DataSource. 

public class Person{
    public string Name{get;set;}
    public DateTime DoB{get;set;}
    private int YearTurned18
    {
        get
        {
            return this.DoB.Year + 18;
        }
    }
}

However what if we wanted to calculate the year they turned 16 or 24 or 65? We would have to write additional properties. It is not a good solution because of all the additional methods.

The second solution is to create a class to contain the person and year, something like:

    public class PersonContainer
    {
        public Person Person { get; set; }
        public int Year { get; set; }
    }

This again is still not great, what if at some time in the future I want to pass the person object over with another value that isn’t an int. I would have to either add another property to this class or create another class. Adding properties leaves me with a class where only a few peoperties are used or I have lots of container classes in my code.

A better solution is to use anonymous types. These types allow you to create classes with read only properties which you assign when the object is created. The code for our solution then becomes:

            List<Person> people = GetPeople();
            List<object> peopleData = new List<object>();

            people.ForEach(x =>
            {
                int year = GetYearTurned18(x);
                peopleData.Add(new { Person = x, Year = year });
            });

            _peopleRepeater.DataSource = peopleData;
            _peopleRepeater.DataBind();

This is quite nice. I can create this anonymous type and then in my repeater control get access to the data using the following: 

                        <%# DataBinder.Eval(Container.DataItem, "Person.Name") %>
                        <%# DataBinder.Eval(Container.DataItem, "Person.DoB", "dd/MM/yyyy") %>
                        <%# DataBinder.Eval(Container.DataItem, "Year")%>

I can also add as many other properties as I like to my anonymous type, allowing for easy expansion later on. However the only real problem is that the list is not strongly typed. I could add anything to the list because it accepts an object. So I want to make this more strongly typed.  However there is a way around this, read the post at the end of Microsoft’s Anonymous Types page for a way to do this.

Mike’s Blog

Introducing the Lucene Index Viewer

Posted by admin On February - 18 - 2009

I have earlier complained about Sitecore 6 Lucene implementation hard-coding compression, making it impossible to view the index in Luke. Further I have often wanted to view an index in production, where a Luke installation wasn’t allowed.

Therefore I decided to implement an index viewer and I am proud to announce, that it is now released. It has been added to the Sitecore Shared Source modules. Go to http://trac.sitecore.net/IndexViewer to download the package or the source. To see some screenshots go to http://trac.sitecore.net/IndexViewer/wiki/Documentation.

In the IndexViewer it is possible to: See information about an index (Last modified, number of ducuments etc.), browse the documents in an index and search through the index using different Lucene Query types.

Let me know if you have any comments, feature request or similar. Enjoy!

Molten Core

Content and presentation separated - Does it make sense?

Posted by admin On February - 18 - 2009

Often I hear that Sitecore separates content and presentation completely - In fact it seems that it is a key selling point. Lately I have also seen other CMS vendors promote the same idea. But I must admit that I don’t understand why it seems to be so important. Is it because of reuse of content? Is it because you want to be able to present the same content on different devices such as iPhones, PDAs etc.?

But…  Does it make any sense?

·         Most of the clients we have been working with prefer to use the content editor and not webedit. To ensure that content editing is user friendly and intuitive, most of the time we construct solutions, where the content structure and hierarchy is the same as how it is presented on the frontend. This enables the editor to find and edit content in the same manner they find the information on the frontend.

In this matter it makes more sense to bind content and presentation structure together.

·         You seldom want to use the same content structure on different devices. When constructing sites for mobile devices, you probably want to have a simple flat hierarchy, which is different from your normal site.

Therefore it makes more sense to me, to have two different structures optimized for the presentation on the different devices.

·         Often the editors want to be able to edit the presentation. If they create a list in a rich text, they probably want to be able to decide how this list is presented – hence you bind content to presentation. This is allowed in the rich text field. By nature WYSIWYG editors is bound to presentation. What you create is what is presented. Should you avoid rich text fields completely?

·         If content from rich text fields should be independent from what devices it is presented on, it requires editors to consider this, when they create their content. For instance a table with a lot of data expanding over 320 pixels wouldn’t look good on an iPhone, so the editor has to be more aware of the technical limitations of the devices or limited to use memo fields.

All in all I find that you on some level always want to bind the content to the presentation, allowing more flexible content and giving editors a more intuitive way of creating content.

I agree that you can construct a Sitecore solution that separates content from presentation completely, by developing a solution consisting of a big repository of memo fields, which can be pulled on to a presentation item… But this wouldn’t be very user friendly.

So why is it so important to separate content from presentation and does it make any sense?

Molten Core

The word is out

Posted by admin On February - 18 - 2009
As you might have noticed Sitecore announced the list of this years MVP’s. And I am proud to say that I am one of the thirteen MVP’s worldwide.
I would like to congratulate Alistair Deneys, Christopher Wojciech, Julius Ganns, Justin Sjouw, Klaus Petersen, Mark Cassidy, Thomas Eldblom, Eric Briand, Andy Uzick, Glen McInnis, Alexander Pfandt and [...]

Mark van Aalst

Custom search for Sitecore blogs

Posted by admin On February - 18 - 2009
Whenever I use Google to search for Sitecore information I get a lot of marketing and CMS review results and a few results with detailed developer information. So I created a Google custom search engine to search through all Sitecore related blogs. Now I can search through sites I think are the most usefull for [...]

Mark van Aalst