codeflood logo

Coffee => Coder => Code

Ramblings on code, Sitecore and stuff

Solving Generic Casting Issues with Actions

Generics in .net are a great way to avoid having to repeat your code when all you need to do is alter a few of the types involved in the code. Recently I was retrieving some objects from a data store in several different places in my code, and just altering the return types at each call. This felt like an ideal candidate for generics. I didn’t want to have to cast the array of objects to the...

SEFE On-Site Payment Provider

I’ve recently had the opportunity to get to know the Sitecore eCommerce Fundamental Edition or SEFE for short. One of our clients wanted to port their existing online shop to Sitecore which we’d used to rebuild their site. The main reason I chose SEFE was due to the fact that SEFE IS Sitecore and is built completely in Sitecore. All other eCommerce platforms I assessed were external applications...

Virtual Items in Sitecore

One of the many benefits of using a good CMS like Sitecore is the ability to reuse a single piece of content in multiple locations around your site. This ability is provided through virtual items. So what is a virtual item? A virtual item is an item that doesn’t actually exist. Why wouldn’t you want the item to exist? One reason would be to keep your content tree clean and another would be to...

Importing lists with Revolver

Recently I had to create a list of reference items in Sitecore that was a few hundred items long. Doing this exercise manually would have been mind numbing and taken a few hours out of my day. Thanks goodness for Revolver! Revolver contains the split command which can be used to split larger strings up. Combined with the echo command which can be used to input text from files and I’ve got the...

Singleton Patterns for ASP.NET

Update 13th June 2011: Thanks to Damian Kulik who left a comment on this post pointing out that the classic singleton pattern I show below is not thread safe and provided a link to a great article showing a few options for creating a thread safe singleton in C#. I’ve updated the code examples for the classic singleton pattern to use a thread safe singleton pattern. Many of you are probably aware...

Unit Test Test Data

One of the most valuable lessons I learnt whilst doing unit testing with Sitecore projects was to ensure my tests were robust and repeatable. I went through a lot of pain in my earlier projects with brittle tests that as soon as one test failed, all the others would start failing. All this instability was to do with the test data I was using. I had a small amount of test content that I assumed was...

Decoupling through the Rules Engine

Recently I was designing a feature on a site that required dynamic behaviours. This kind of thing is right up the Sitecore rules engine’s alley so I made use of it in the design. But the use of the rules engine had larger benefits than simply meeting the requirements. More on that in just a second. Before getting too far into this blog post I feel I should make mention of Sitecore 6.5 which landed...

Calling Control

Several years ago I remember watching a dnrTV (dot net rocks TV) episode featuring Venkat Subramaniam discussing Ruby like features of .NET 2 and C# 2. You can catch the episode at http://www.dnrtv.com/default.aspx?showNum=41. One programming technique that stuck in my head from that episode was to do with passing control inside a method back to the calling code to allow it to fill in the specific...

Revolver 1.2 Released

Yesterday I released Revolver 1.2 for Sitecore 6.4. Releases for other Sitecore versions should be available over the next few days. Along with a few bug fixes and behind the scenes stuff the following list provides a brief overview of updates made to Revolver for the 1.2 release. Maximum Query Results Warning Sitecore query provides a nice way to query for Sitecore items using an XPath like...

Long Running Process Options

Recently I was asked by another developer about what options we had in Sitecore for long running processes. It wasn’t until I had to list them out all at once did I realise just how many options there are, all with their appropriate uses. Sitecore contains a very visual and engaging UI. And when it goes away to do something for a long time, it will provide feedback to the user so they know what’s...

How to Choose a CMS

So how do you currently select a CMS for a project. And I’m asking this more of the people who will be using the CMS to manage their website rather than those that will be doing the development work. Far too often people assess a CMS platform with giant spreadsheets listing features the CMS should have and score each candidate on each feature. The problem with this approach is that any good CMS...

Access Sitecore data with WCF

So, my laptop died. Again. Second time within 12 months. Time to get a new one…but as a result I’ve had to borrow another for this blog post. This laptop is quite under spec’d compared to my previous laptop. In fact, this laptop is actually a netbook with only 1 gig RAM and a 1.66 Ghz atom processor running Windows XP home. Yet I’ve been able to get Sitecore 6.4.1 running on it. I’m also missing...

Responsible Blogging Rules

When I started this blog many moons ago I mentioned a few pet peeves about blogs I had in my introductory post. Also in that post I mentioned I had a few guidelines for myself to follow to help prevent me from committing some of those mistakes myself. However at the time I never published what those guidelines were. This was mainly because I had never written a blog before and I didn’t know how...

More Unit Testing in Sitecore Videos

I've finally found enough free time to record the continuation of my first unit testing in Sitecore video which showed how to add a test project to your solution which used the codeflood custom NUnit test runner. The next video was a little larger than I expected and I had to split it out into 2 separate videos. The first shows how to prepare your unit test fixture for writing tests by creating...

EviBlog 1.6.1 Released

I’ve just dropped EviBlog release 1.6.1 onto the Sitecore shared source Trac project room for download. You can download the release from http://svn.sitecore.net/EviBlog/Trunk/EviBlog/Website/data/packages/EviBlog-1.6.1.zip. This release fixes a minor issue with the Windows Live writer integration. Previously posts created using Windows Live writer would have the body of the post published into...

Optional project output copying using MSBuild

Different people have different approaches for structuring their projects. This is quite evident when working with open source software such as that found in the Sitecore shared source library where the project is normally setup with the preferences of the maintainer of the project. There are 2 major approaches to project structure. The first keeps the code under the webroot of your solution and...

EviBlog 1.6 Released

Today I’ve made a new release of the EviBlog Sitecore shared source module. Release 1.6 includes the following bug fixes: Comment display on website contains an XSS vulnerability. Used Microsoft's AntiXSS library to properly escape the content before putting it on page. User comments were being displayed as a single line, removing line breaks entered during comment submission – fixed User...

Unit Testing in Sitecore is Not Scary

I was chatting to another Sitecore developer the other day about unit testing in Sitecore. The impression I got from the developer was that although they knew unit testing could be done, they felt it was quite cumbersome and difficult. Possibly the length of my previous series on unit testing in Sitecore didn’t help the cause either. So I’d like to show you just how easy unit testing in Sitecore...

Sharing Content with Item Clones

In my previous Sitecore 6.4 sneak peek I gave a quick overview of a new feature in Sitecore 6.4 called item clones. These were introduced to replace proxy items which have now been deprecated and are likely to be removed completely in the next major release of Sitecore. There’s already been a few posts about item clones from John West: Sitecore CMS 6.4: Cloning and from Adam Conn: Cloning What...

The Customized Startbar Module

A little while ago I blogged about how to tweak the startbar in the Sitecore desktop to always display the database name. The issue with the current way in which Sitecore shows the database name is that it puts it on the desktop surface, so it can be obscured by application windows. And the issue with my little tweak was that it was incompatible with the Quicklaunch Toolbar shared source module I...