Remove an item for a multilist

Sometimes you spent to many time on answering a question on SDN5 Forum(sorry for no code highlighting, CopySourceAsHtml won’t install):

Sitecore.Data.Items.Item itemToBeRemovedFromMultilist;

Sitecore.Diagnostics.Assert.IsNotNull(itemToBeRemovedFromMultilist, “No item selected to remove from multilist”);

Sitecore.Data.Items.Item contentItem = Sitecore.Context.ContentDatabase.GetItem(Sitecore.Context.Item.ID);

Sitecore.Diagnostics.Assert.IsNotNull(contentItem, “Couldn’t find item in ContentDatabase!”);

Sitecore.SecurityModel.Domain sitecoreDomain = Sitecore.Configuration.Factory.GetDomain(“sitecore”);

Sitecore.Diagnostics.Assert.IsNotNull(sitecoreDomain, “Couldn’t retrieve the Sitecore domain!”);

Sitecore.SecurityModel.UserItem adminUser = sitecoreDomain.GetUser(“admin”);

Sitecore.Diagnostics.Assert.IsNotNull(adminUser, “Couldn’t retrieve the admin-user from the Sitecore domain!”);

using (new SecuritySwitcher(adminUser))

{

contentItem.Editing.BeginEdit();

Sitecore.Data.Fields.MultilistField myMultilistField = contentItem.Fields[“myMultiListField”];

Sitecore.Diagnostics.Assert.IsNotNull(myMultilistField, “Field connot be retrieved, please check field name!”);

myMultilistField.RemoveLink(itemToBeRemovedFromMultilist);

contentItem.Editing.EndEdit();

}

Don’t forget to check the logs

It seem that a lot of developers seem to forget that Sitecore has some excellent logging tools which make their life easier. It also gives you the ability to find out about problems which otherwise appear wjhhen the applications is deployed on your production environment.

You can find the log-files these days under %sitecoreRoot%/data/logs and %sitecoreRoot%/data/audit. All the exceptions including stacktraces which occur will be saved in this logfile. So when your website is down and you see some yellow pages on the website, just download the logfile. You can also do this using the reporting tools in Sitecore to download the logfiles. So you don’t require fysical access to the server.

I also recommend to walk to your log-files during your development. Personally I check the files direct after installing Sitecore(after the first run), when I’ve created a new page/extension and at the end of every day. When you are going to deliver an application in Sitecore to yur test-team, just install the app on a clean machine, when the test-tema is finished, you can run trough the log-files and merge the testresults with the information in the logfiles.

Happy bughunting ;-).

Some of my business concerns

A lot of people ask me these days: “Alex, why don’t you recommend more Open Source solutions? You are pretty enthousiast about product like Typo3, Alfresco and Umbraco.”.

Well, let me explain. Over the past 3,5 year I’ve worked with approx 8 different CMS’s. I’ve worked on large project and on small non-profit projects. I’ve seen several different solution for clients, marketing based solutions, technical based, usability based, etc. The only identical aspect was that the CMS was expected to work in a proper way, at any time. And when it didn’t work in the correct way, a patch should be releasedin at most 2 weeks.

Ofcourse everybody knows thos patches are always to late and upgrades are always a waste of money. I’m not going to start that discussion as it an endless one(even not with the Sitecore chaps ;)).
But essentially you’ve got a point there… Can we ‘trust’ the supplier of your CMS? In general I ask myself the next couple of question:

  • Are their any major releases last year?
  • Is the last patch released at least 2 month ago?
  • Does the producent supply an upgrade path?
  • Can I buy professional services in my own country without contacting the supplier itself?
  • Is the next big version scheduled in the next 18 months?
  • What about the history, does the supplier the software in-time(compared to the roadmap)?
  • Are their any signs of a Windows-awaiting-for-SP-image-problem?

For this reason I’m always a bit shy when it comes to recommending open source software. I’ve to say that the 3 mentioned above seem to have their releases on a quite high level, but then I only take a look at their releases in 2007.

(E)LECTRIC? Volta?

Yesterday I finally looked the videeos of Volta(video1, video 2), an amazing new way of webdevelopment. Well actually not new, it’s more an extremely flexible way of webdevelopment. It’s another product from the hands of Erik Meijer. In the past Erik was responsible for a lot of SQL Server stuff and ofcourse LINQ. These days he’s concentrating himself on productivity of developer by introducing stuff like LINQ2 and Volta.

I also like the name Volta, as LECTRIC is often pronounced as Electrian ;). Our 1o year anniversary had the slogan: ’10 years of the (E)Lectricity-men’ :P.

Anyway, back to Volta, what is Volta? Well Volta is a platform which provides developers to think about layering in their programs later. You cna decide at any time if you want to run someting on the client or the server. All managed.

Uhmm… All managed?! Yep! Even without a plugin… They’ve created a way where you can run assemblies using Javascript or when the client does support it, you can use SilverLight… Volta also allows you to modify your DOM in a more obvious way. Less tree-structured as you have to do it right now.
Just look at it as another toolset on top of ASP.NET / SilverLight / HTML.

Ofcourse it’s heavily under development. But who cares? It’s extremely exciting to see how hard guys like Erik are working for a simple developer like I’m and you are!

SubSonic, a cool OR mapper

Just came across SubSonic. It seems to be one of the best free .NET OR-mapper around the world. I’m playing with it, but as my Visual Studios are a bit crappy these days(to much bètas) it isn’t going so fast as it should be.

Nice to see is that the Sonic-guys spent a lot of time on webcast on their website. Browsing more across their website I’m getting more excited about this product :). Here, a last free commercial with the abilities of SubSonic:

Generates your Domain Model

using our BuildProvider, we can generate you a full and complete Data Access layer with NO CODE to maintain.

Scaffolding Admin Interface

Rails-like scaffolds for your entire database with the drop of a server tag.

Helpful Development Controls and Utilities

DropDowns, QuickTables, RadioButtonLists, Scaffold help you get your pages up fast

Customize Your Configuration

SubSonic’s wide open. If you don’t like our code, change the templates! Or checkout the many config bits you can change as needed.

Presentations and trainings

In september the season is starting again… a seasion full of knowledge sessions and training. I’ve planned a couple of nice sessions until the end of the year so far:

  • September internal knowledgde session:
    Enterprise Library 3.0: Validation, Policy Injection and AOP
  • Day afterwards: XAML for the Web
  • October internal knowledge session: Sitecore Web.config tuning
  • November internal knowledge session: Sitecore System-node
  • December internal knowledge session: Master & Templates, Usage, Inheritance, Tips & Trics
  • Incompany training: Efficient usage of workflow and Sitecore diagnostic tools

As you can see, a whole range of different training /sessions. Starting from one and a half hour to whole days. When you’re interested in one of the above sessions and you want to join them or invite me to speak for your team, just let me know!
I’m always interested in a bigger audience(let’s say Netherlands, Belgium and some parts of Germany), more feedback, etc. I’m even plannng to do some open knowledge sessions(total free or for minimal costs) on Sitecore in combination with C# and ASP.NET.
You can always reach me on a.degroot (a) lectric (dot) nl or alex (a) alexiasoft (dot) nl.

Laziness

I just went to my weekly tennis-training, and as usual, we had had drink(Ice Tea ;)) afterwards. Today I found out that one of my training buddies is a SAP-programmer/consultant. Ofcourse we spoke a lot about what he did and what I do. And not surprising, he works with web applications as well, actually, he implements them. He told be about larger systems he wrote and how his designs work. Finally he got some funny quotes I want to share with you:

  • I don’t have to look at connections, pooling, resources, etc, SAP takes care of that.
  • Service Orientation is not necesarry, why create a service when I can directly access the transaction layer?
  • I worked with a guy who created a service layer in an MVC-architecture, I told him he totally doesn’t understand SOA and MVC as well.
  • Databinding is the coolest feature of SAP.
  • I do create architectures, but I’m strictly binded to the kind of SAP portlet I implement.
  • ERP is so stable that it’s an excellent platform to build your website on.
  • I don’t see why you want any other rapportage them the stuff SAP does log by default.

I’m sorry, but I’m definitelly happy that I do not work with this guy! During the conversation I’ve been waiting if we’re able to come to a higher level, but this guys was so convinced about himself and SAP, that I decided to let it be… My god, does this guy understands why ERP’s and CMS’s are so often divided from each other just because the ERP ‘decides’ it are total different systems used for total different processes?
Or am I so wrong in this case?

Running trough my bloglist

Yesterday I’ve already started to run trough my bloglist, but left most tech posts for today. I’m going to share the most interesting posts with you by just supplying a link with a description. The information might be odered in the way my bloglist is ordered but you might see a total unordered list of links as well :).

Well that we’re all the the non-MS bloggers. I will continue with the Microsoft internal dudes after lunch. Have fun :).

Update: Let’s continue with the Microsofties ;-):

And last but not least, Channel 9 has an excellent movie on Garbage Collection.

Information Workers…

Yes I’m back from holiday. I’ll show you guys some pictures later on, but for now I just want to share the following movie on YouTube. This is another movie which shows us how much influence the world of information working has these days. I was extremly surprised by the figures and altought I don’t believe all of them are 100% correct, it’s extremely interesting to see it all behind each other. Sit back and learn: