note to self – collation is important when installing umbraco

I was having problems getting the latest build of Umbraco to install on localhost and kept getting errors like:

Invalid column name ‘defaultToLiveEditing’.

After much googling and searching around the umbraco forums i discoverd that the collation on the database needs to be set to case insensitive otherwise the sql script freaks out and doesn’t install all the columns in to the users table.

Getting pipe delimited csv out of Excel

Handy little tip here. If you need to save an excel file in a flat file format such as csv but you want the separator to be something other than a comma or a tab then you can do the following.

Open up settings > control panel > regional and language settings and choose customize on the first tab. On the screen that shows up next, on the numbers tab is a box titled list separator. Change the value on this box to the delimiter you want to use and heh presto when you save as a csv in excel the values will be separated the way you wanted them.

Api aggregator services

I’ve been looking at gigya socialize this week which seems to be a great tool for easily adding authentication to your site based on facebook, Twitter or openid. Seems very easy to implement and removes some of the complexity of managing all the different Apis in your own code. I’m sure services like these (api aggregator) will become more prevalent as commercial sites seek to allow their users to interact with them socially more and more. As these services reduce the technical complexity of implementing these social features the adoption curve should rise quickly. They also allow (smaller) social networks to offer more to their users – if they implement Apis on their end then their users can carry their network with them and have less reason to migrate to rival social networks.

validating radio buttons in a controller rather than the model requires a ValueProviderResult to be set explicitly

Catchy title to this little post! If you are validating a radio button and the user has not selected any radio buttons in the group then you will get an error if you use ModelState.AddModelError(“radiobuttonname”,”my error message”) unless you explicitly use ModelState.SetModelValue and pass in a ValueProvierResult as the model binder doesn’t like the null when it binds the view.

ModelState.AddModelError(“gender”, “Please select male or female.”);
ValueProviderResult vpr = new ValueProviderResult(null, “”, null);
ModelState.SetModelValue(“gender”, vpr);

Updating selected fields with linq to sql

I have been writing a bunch of stuff in mvc of late and have been using linq to SQL to quickly pull together my DAL (although I have been using a repository pattern and castle Windsor to implement an IOC container which I picked up from the excellent pro mvc book). One of my entities is a profile object and, on editing, I only wanted to update the image field if the user uploaded a new image. After struggling to skip the field with linq I found I could select the old profile object from the data context and simply update the other fields declaratively if no Image is passed in the new profile object. I can’t help feeling there is a more elegant way of doing this but I have had to be pragmatic and implement this as it works. I’ll post the code shortly. mvc

Playing around mvc. Quite cool architecture and gets over lots of the issues with classic .net like page bloat and trying to force statefulness on to an inherently stateless system. I like the tight integration that’s possible with jquery as well so I will adopt asap but I have to figure out how well it can run alongside classic .net whilst I rewrite existing components into mvc versions. Pattern based, test driven development – should be good.