Monday, December 18, 2006

PhotoSynth Technology Preview

Personally i love seeing technology be presented to the public prior to it being finished, no matter if it works or not. This TP however works quite well and i think it's -really- cool. Check out PhotoSynth at P.

Friday, December 15, 2006

Visual Studio 2005 SP1

Also, on the topic of releases today, Service Pack 1 for Visual Studio 2005 is here. I was going to install it right away (i'm a sucker for installing new stuff as fast as possible), but then Alex's post made me think of a better reason, and that's to install it from home. 'cause, if it's going to be like Alex's installation, that way i can have a valid reason for playing gears of war while the installation runs, and that's always a good thing ;) Download links & further info: Take care, P.

ASP.NET 2.0 AJAX Extensions RC1

Yep, RC1 is now available. Grab it at: P.

another year passed

so, this post is really about 2 weeks old, but i thought i'd write it anyway.

I found myself thinking about the last couple of years that passed by, and it struck me like a blow to the head: this year has been fantastic!

The last year included:
  • working for metamatrix // interfolio
  • working with sitecore cms (which you all by now know i love)
  • went to tech ed in barcelona
  • living in stockholm
  • drinking beer
  • playing music
  • stopped smoking
  • started going to the gym (if you knew me a year ago you'd be laughing right about now)
  • bought an apartment
  • bought a car
  • started this blog
  • found what i was hoping i'd find in a company that develop top-of-the-line solutions

Now, for those of you that don't know me personally, let's just compare this year to some previous:

1 year ago i was..

  • living in stockholm
  • working for morningstar
  • drinking beer
  • smoking cigarettes
  • playing music

2 years ago i was..

  • living in london
  • working for morningstar
  • drinking beer
  • smoking cigarettes
  • playing music

3 years ago i was..

  • living in london
  • working for morningstar
  • drinking beer
  • smoking cigarettes
  • playing music

4 years ago i was..

  • living in stockholm
  • working for morningstar
  • drinking beer
  • smoking cigarettes
  • playing music

see a repetative pattern evolving here? well, for the first time that pattern is gone, completely (ok, so not -really- completely, i still like my beers, stockholm and my music).

morningstar was great working for, don't get me wrong, and london was a fantastic city to live in. the friends i have there i'll keep for life, without doubt. the thing that separates those years from today is that today i'm loving it. 100% loving it.

and yeah, it's true: i'm going to the gym these days and yeah, it's true: i've stopped smoking (so far anyway)

time sure flies..

i'm -so- looking forward to another great year!


Extending the RSS Module

the RSS module i really like. it's a good example of a great module that does what it's supposed to be doing. Alexey Rusakov is a wizard, can't put it any other way. his last posts about deletion workflow are really interesting and if you've ever thought about custom workflows i encourage you to read (apart from all the stuff at SDN5) Alexey's Deletion Workflow Part 1 & 2, and also Alex Shyba's Workflow with unpublishing article. now, with that said, i just thought i'd share a little example of how you can easily make your pages 'advertise' that there's feed content available on the page. modern browsers 'light up' to indicate a feed is present, and it's really, really, really simple - it's just a link in the header to the atual rss istelf. you don't need to have the RSS module, you can of course create your own, but i strongly recommend that you use the module. so, assuming you have the module installed & running you'd have a node somewhere that stores your feeds, here's what you do: 1) add a new Tree list field (i -so- love this field, i use it all the time) called "RSS_Feeds" to your content templates (even better if you got a sitewide template your content templates inherit from) and set the source of that field to your Feeds node (like '/sitecore/content/global/rss feeds' or something). 2) create a new class called RssAlternativeRenderer - this class will output the alternative links to the header of your page 3) add the following code to your new class
public static void GetRssUrls() { Item root = Sitecore.Context.Item; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (root != null) { if (root.Fields["Rss_Feeds"]!=null) { Sitecore.Data.Fields.MultilistField mf = root.Fields["Rss_Feeds"]; if (mf != null) { if (mf.Count > 0) { foreach (Item itm in mf.GetItems()) { sb.AppendLine("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"" + itm.Fields["Title"].Value.ToString() + "\" href=\"" + itm.Paths.GetFriendlyUrl() + "\" />"); } } } Sitecore.Context.Page.Page.Header.Controls.Add(new LiteralControl(sb.ToString())); } } }
4) add the following code to your Page_Load event

protected void Page_Load(object sender, EventArgs e) { RssAlternativeRenderer.GetRssUrls(); }

that's it. now compatible browsers will 'light up' all shiny and stuff when you select a feed that will be available on a page - ain't that great for christmas? finally, wrapping up, Alex de Groot just posted his 1-year-blogging-anniversary post. Congratulations! today is friday - today is afterwork - today is gonna be one more day that i forget to go buy gifts.. but hey, at least it's friday.. take care, P.

Wednesday, December 13, 2006

10 steps to adding search providers to a sitecore website using OpenSearch specifications

yep, 10 steps to adding search providers to a sitecore website using OpenSearch specifications. ok, so there's a lot of sub-steps and some code, but at least the highlighted parts are only 10 :) here we go!

1) create a new layout called OpenSearch

2) create a new template called OpenSearchSource     2.1) add the following fields to this template         2.1.1) OpenSearchDescription : text         2.1.2) ShortName : text         2.1.3) LongName : text         2.1.4) Description : text         2.1.5) Tags : text         2.1.6) Contact : text         2.1.7) URL_RSS : text         2.1.8) URL_Atom : text         2.1.9) URL_HTTP : text         2.1.10) Attribution : text         2.1.11) Language: text         2.1.12) AdultContent : checkbox         2.1.13) inputEncoding : text         2.1.14) outputEncoding : text         2.1.15) count : text         2.1.16) Icon_Large : text         2.1.17) Icon_Small : text     2.2) set the standard values of the fields accordingly (without the qoutes):         2.2.1) OpenSearchDescription : ""         2.2.2) ShortName : "MyExample" (set your site name or something)         2.2.3) LongName : "Search using MyExample Search" (just a more detailed name)         2.2.4) Description : "Use our own search engine to search our site"         2.2.5) Tags : "example web"         2.2.6) Contact : "" (your email would be better)         2.2.7) URL_RSS : "{searchTerms}&view=rss" (set this to the result querystring of your rss search page (if any) and add the {searchTerms} to the query param, or leave empty)         2.2.8) URL_Atom : "{searchTerms}&view=atom" (set this to the result querystring of your atom search page (if any) and add the {searchTerms} to the query param, or leave empty)         2.2.9) URL_HTTP : "{searchTerms"} (set this to the result querystring of your search page and add the {searchTerms} to the query param)         2.2.10) Attribution : "Copyright 2006, Peter Johansson, All Rights Reserved."         2.2.11) Language: "*" (can be set to a desired language, like sv-SE)         2.2.12) AdultContent : unchecked :)         2.2.13) inputEncoding : "UTF-8"         2.2.14) outputEncoding : "UTF-8"         2.2.15) count : 10         2.2.16) Icon_Large : "" (or leave blank to show no icon)         2.2.17) Icon_Small : "" (or leave blank to show no icon)     2.3) create a master for the newly created template

3) add a folder where you'll store your OpenSearch specification items (perhaps /sitecore/content/global/OpenSearch)     3.1) assing the master created in 2.4 to the newly created folder     3.2) assing the layout we created at step 1 to the standard values of our OpenSearchSource template

4) add a dummy specification item that we can change later, i'm naming mine OpenSearchExample, but you can name it what you want.

5) here you can approach it from many angles, but since this is my tutorial we're gonna look at it my way :),     5.1) create a template that your site-specific templates will inherit from (make sure it inherits Standard template), maybe even name it SitewideSettings like i'm doing.     5.2) add a Tree list field to that template, name it OpenSearch_Sources and specify it's source to be your newly created folder at step 3, and finally check the shared checkbox.     5.3) make your site-specific templates inherit from the SitewideSettings template created at step 4.1.

6) edit an item (or create a new one) and select the dummy item we created at step 4 in the OpenSearch_Sources tree list

7) commit a full publish

That's it for sitecore desktop stuff.. for now.. next up, let's change the OpenSearch layout file.

8) Create a new class called OpenSearchPage     8.1) Set the Inherits attribute of the layout to the newly created class, like Inherits="OpenSearch.OpenSearchPage"     8.2) make the new class inherit from the standard Page class     8.3) override the OnLoad event     8.4) create code to output our OpenSearch specification. Instead of doing this the really fancy way i'll just show a really simple way to output it. What should really be done is to make use of an xmltextwriter and an actual xml document to make sure the output is nice all follows standards, but to save time i've simply sent the format straight to the page and made sure the ContentType is text/xml. to make this better, go ahead and change all this, it should be made better so if you use any of this think about that :) anyway, here's really all of the code needed for (the not-so-correct-way-of) returning the output:

public class OpenSearchPage : Page { protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Sitecore.Context.Item != null) { this.Context.Response.Clear(); this.Context.Response.ContentType = "text/xml"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); sb.AppendLine("<OpenSearchDescription xmlns=\"" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["OpenSearchDescription"].Value, "") + "\">"); sb.AppendLine("<ShortName>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Shortname"].Value, "") + "</ShortName>"); sb.AppendLine("<Description>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Description"].Value, "") + "</Description>"); sb.AppendLine("<Tags>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Tags"].Value, "") + "</Tags>"); sb.AppendLine("<Contact>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Contact"].Value, "") + "</Contact>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_RSS"].Value, "") != "") sb.AppendLine("<Url type=\"application/rss+xml\" template=\"" + Server.HtmlEncode(Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_RSS"].Value)) + "\"/>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_Atom"].Value, "") != "") sb.AppendLine("<Url type=\"application/atom+xml\" template=\"" + Server.HtmlEncode(Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_Atom"].Value)) + "\"/>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_HTTP"].Value, "") != "") sb.AppendLine("<Url type=\"text/html\" method=\"get\" template=\"" + Server.HtmlEncode(Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["URL_HTTP"].Value)) + "\"/>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["LongName"].Value, "") != "") sb.AppendLine("<LongName>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["LongName"].Value) + "</LongName>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Icon_Large"].Value, "") != "") sb.AppendLine("<Image height=\"64\" width=\"64\" type=\"image/png\">" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Icon_Large"].Value) + "</Image>"); if (Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Icon_Small"].Value, "") != "") sb.AppendLine("<Image height=\"16\" width=\"16\" type=\"image/png\">" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Icon_Small"].Value) + "</Image>"); sb.AppendLine("<Attribution>"); sb.AppendLine(Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["Attribution"].Value, "Copyright, All rights reserved.")); sb.AppendLine("</Attribution>"); sb.AppendLine("<AdultContent>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["AdultContent"].Value, "false") + "</AdultContent>"); sb.AppendLine("<Language>" + Server.HtmlEncode(Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["language"].Value, "*")) + "</Language>"); sb.AppendLine("<OutputEncoding>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["outputEncoding"].Value, "UTF-8") + "</OutputEncoding>"); sb.AppendLine("<InputEncoding>" + Sitecore.StringUtil.GetString(Sitecore.Context.Item.Fields["inputEncoding"].Value, "UTF-8") + "</InputEncoding>"); sb.AppendLine("</OpenSearchDescription>"); this.Context.Response.Write(sb.ToString()); this.Context.Response.End(); } } }

9) add functionality to add content to the header. all we really need now is a way to tell the browser that there's a search provider available on the site, and here's a little code snippet for that as well

public class OpenSearchRenderer { public static void GetOpenSearchUrls() { Item root = Sitecore.Context.Item; System.Text.StringBuilder sb = new System.Text.StringBuilder(); if (root != null) { if (root.Fields["OpenSearch_Sources"] != null) { Sitecore.Data.Fields.MultilistField mf = root.Fields["OpenSearch_Sources"]; if (mf != null) { if (mf.Count > 0) { foreach (Item itm in mf.GetItems()) { sb.AppendLine("<link title=\"" + itm.Fields["ShortName"].Value.ToString() + "\" rel=\"search\" type=\"application/opensearchdescription+xml\" href=\"http://localhost" + itm.Paths.GetFriendlyUrl() + "\">"); } } } Sitecore.Context.Page.Page.Header.Controls.Add(new LiteralControl(sb.ToString())); } } } }

10) output the header information. to finalize the entire thing and actually get the output to the page, all you have to do is add a call to the GetOpenSearchUrls method on the pages, so for example just add a call to it in the Page_Load event;

protected void Page_Load(object sender, EventArgs e) { OpenSearch.OpenSearchRenderer.GetOpenSearchUrls(); }

now, to wrap it all up you should have a working example of how to add OpenSearch information that will enable your site to 'tell' the browser there's one or more search providers available on your site, it should light up the down arrow to the right of the magnifying glass in the top-right search area part of your IE7 toolbar and if you expand it it should show your newly added search provider. you could also extend the definition of the xml output to include mozilla specific resources (like xmlns:moz="") and even further extend the functionality in a lot of customized ways since OpenSearch has many ways to extend the specifications and results.

further reading: OpenSearch: OpenSearch Specifications 1.1: Search Provider Extensibility in Internet Explorer 7: Adding Search providers to IE 7 using OpenSearch 1.1:

well, i guess that's that. Sorry for the bad formatting, one of these days i'll actually change the design, but right now this will have to do. take care, P.

Tuesday, December 12, 2006

December 2006 Sandcastle CTP

What actually should (and probably will) be another post from Alex is this: The December 2006 CTP version for Sandcastle is now available for download. After reading his article about it, i had to check it out.. and, i really like it. So, if you're interested you can read more about the December CTP at, and make sure to read Alex's article too. P.

Wednesday, December 06, 2006

XNA Game Studio Express Launch

Microsoft has announced that Monday the 11th of December signals the launch of XNA Game Studio Express. Some of you might think that posting about XNA is not really for this blog, but hey, i'm a die-hard xbox360 fan, so this is fantastic news if you ask me. I've tried the beta of XNA Game Studio Express, and it really is great fun creating your own games, take my word for it. Further reading & details on the event: P.

Tuesday, December 05, 2006

ASP.NET 2.0 CSS Friendly Control Adapters 1.0

Well, it's not a brand-new release (1.0 was released 20th of November), but i still felt like writing a little about it. ASP.NET 2.0 CSS Friendly Control Adapters 1.0 is a great add-on to visual studio for those of you out there that develop websites and keep to css styled sites. Basically, what it does is that it hooks on to existing controls as a control adapter and instead of generating annoying table/tr/td etc tags it transforms the output into css friendly elements. Really good addition to your visual studio installation. More info & download: P.


Seems Microsoft just announced the first CTP of "WPF/E" (codename), their new cross-platform/xaml/wpf combo.. thingy.. something.. If you find it interesting (like i do), you'll find it at P.

Monday, December 04, 2006

The Panel

I like microsoft's "The Panel" initiative, it's quite cool to see different XAML applications and also to get your hands on the sourcecode to see how it's implemented. Gathered that some require massive CPU & RAM it's still awesome and enjoyable to test it, if your computer is XAML capable that is. Right now i'm trying the UniveRSS application, and yep, it's cool alright. The Panel:

Friday, November 24, 2006

first 5.3 site launched

we've just launched our new website for metamatrix // interfolio built on Sitecore 5.3. after working with 5.3 for some time now I can't help but to, yet again, be amazed at what they team at sitecore can accomplish. the site includes hooking 2.0 ajax extensions directly into sitecore, and even that went extremely painless. really the only thing that caused worry was the usual 'damn, i knew i shoul've checked the layout on a Mac earlier to avoid this headache' issue, but once that was solved the development was moving forward yet again. now i can't wait to move all my ideas over to 5.3 modules, but i doubt i'll have time for that in the near future.. Now, seeing that it's friday, what better way to celebrate a launch than with a few beers after work? :) Have a great weekend, P.

Tuesday, November 21, 2006

Making the Media Library F.O.B.A.R

who else but me manages to completely mess up the 5.3 media library less than 2 hours after installing a new site? it's a gift. pure talent. for some strange reason i now get a broken image instead of a working one. but: this is only for the published site and the actual image editor, when browsing the media library the image appears and everything's neat and nice and cozy. so, right now to make images work i've resorted to clearing the assigned image from the item i want to publish so that it doesn't show up in the image field, and then re-enter only the text value of the path - making sure not to look it up. needless to say this is -extremely- frustrating.. UPDATE: well, it seems that it's not outputting the db parameter (&db=master) anymore when it's 'visually' assigned. frustration just got a touch of annoyance.. P.

Tuesday, November 14, 2006

Sitecore Certified Developer

well, I passed. Yay! Was fun and interesting and Kim Hornung was great at holding the certification and presentation. Bring on the next level! Also, now that i know that Kim is at Sitecore, i'll add his blog ( to the bloglist. P.

Sunday, November 12, 2006

A new day dawning

Besides the fact that my keyboard kept switching back and forth between swedish & english, and that for some reason blogger kept defaulting my language to spanish (really wierd) there ability to communicate from TechEd was fantastic and really quite impressive. Countless of connected vista computers available, wi-fi in the entire complex and even public laptops and wi-fi at our hotel. Yep, i know. Bizarre way to start a post, but i just thought i'd get it out into the open and make it clear that i'm not going to blame the communication standards in barcelona (even tho it'd been an easy way out) for the lack of a proper post. Well, here goes: Tuesday: Keynote Developing rich Web Applications with ASP.NET Ajax ASP.NET Developer and Designer Ajax bliss with Visual studio and Expression ASP.NET Ajax Tips and Tricks Understanding the Service Modelling Language (SML) Wednesday: ASP.NET: Developing data-driven web applications with .NET Language Integrated Query Windows Presentation Foundation (WPF): Creating Windows and Browser Applications with WPF Connected Systems - Part 4: Presentation and Interactivity Extending ASP.NET 2.0 with Custom Providers C# 3.0: Future directions in Language Innovation from Anders Hejlsberg Thursday: Connected Systems - Part 5: Identity and Access Management An implementation of Windows CardSpace .NET Hidden Treasures Building WebParts the Smart way Friday: Windows Vista for Managed Developers: Beyond .NET 3.0 Microsoft XNA and the Future of Game Development AJAX Patterns with the Microsoft AJAX Library Iron Architect finals The above list defines the sessions i went to, and it was quite the handful of things to see and consider for the future, but more on that later. Now - A special message to Sitecore (seeing they're danish and will probably want strong coffee): Don't go for the coffee inside the building, it tastes a bit like iron combined with cherry, and it was really more like tea than coffee. However, there is a place outside that sells proper coffee, even espresso, and it's just outside between the two buildings. Take my word for it - that coffee will save your day. That's it for now, i'll update this post later to reflect on all the sessions, but now it's time to get Sitecore certified. P.

Thursday, November 09, 2006

TechEd - All about the Experience!

Author: Dennis Skantz After spending a couple of days on TechEd in Barcelona it is clear to me that Microsoft now is all about the Experience... User experience for system users (Vistas awesome UI) and deleveloper experience for developers (geat designer tools)... and also... conference experience for delegates to the TechEd Conference... and here I'm thinking about the well planned and executed conference. Microsoft has thought about everything... If you feel thirsty, there are cold drinks everywhere. If you feel cold, they give you a warm nice sweater and to top it all off there are over 250 sessions to choose from! Thats really the only problem here right now. How to select 18 out of 250 all (almost all.. anyway) compelling sessions. Here is what I've learnt so far... Sitecore is way way way ahead! We've been XAMLing now for about a year. Now MS is releasing Windows Presentation Foundation wich is really XAML for windows apps. So for us to adopt WPF is not a hard thing to do. Thank you for that Sitecore! AJAX, AJAX, AJAX! I think I counted 11 sessions about AJAX, that means you could basically spend the whole week just listening to AJAX seminars... This is nothing new to Sitecore partner. Sitecore's been using AJAX for ages. What new now is Microsoft standard framework för AJAX. Comes with a nifty library of clientside scripts guaranteed to work on IE, Mozilla, Firefox and soon Opera (wich can be used stand alone from the Asp.Net Framework) and a lot of AJAX controls to be dragged onto your standard aspx and ascx controls. AJAX is exciting, yes... But is it worth 11 sessions? No. Can we even speak about a AJAX hype? Yes... But still AJAX is cool, and the AJAX library is a good start. For pattern freaks I have good news in the patterns for logics department. You only have to learn three patterns; Call, Queue and Sub/Pub... All other patterns are just variations of these. Of course this is my highly simplified intrepretation of Steve Swarts and Clemens Vasters presentation about Communication, Flow and Logic. For SOA preachers... SOA is not the solutions to all future system design. SOA should be used only in those places in the system where it doesn't relly really slow down the user interface... because... we don't want to spoil the user experience... ;-) For security concerned (arent we all?) I've recently irritated myself on the fact that Sitecore doesnt lock out accounts after x number of failed login attempts. Turns out, thats actually just what the experts suggests. If you have a lock-out function in place, it is really easy to stage a DNS attack against the system. All you have to do is try to login to all accounts and fail doing so and you have soon locked out all editors and administrators from ever reaching the system. So hats of to you Sitecore for that... However, there is still an area where Sitecore (in my opinion) must change and thats in the auditing. It is bad practice not to log failed login attempts. How should you otherwise be able to detect attempted attacks? Sitecore could easily add a bundle of Auditing, and they should, for sake of traceability! Well, thats it for now. My beer is going flat... and there are 50 sessions left to choose between.... /Dennis

Sitecore 5.3

Well, seems it's released now (at least on SDN5). For those of you (like me) that have been eagerly waiting i hope you've already installed it.. seeing i'm currently in barcelona right now i however have a few obstacles to tackle prior to installing it (like getting a hold of a decent bandwith for starters).. oh well... way to go Sitecore! P.

Wednesday, November 08, 2006

TechEd: middle of day 2

So far so damn awesome it's sick.. this messes with your mind a lot and you'll surely notice it later when i finish up this post.. right now it's back to the sessions. P.

Sunday, November 05, 2006


Well, tomorrow I'm off for Barcelona where we're going to attend the TechEd conf. It's going to be 5 days of brainmelting-ideainspiring-codecrazy madness, but that's why we're going there :) More posts to come i'm sure once we've arrived and all. P.

Friday, October 27, 2006

waiting / writing

It's friday so I'll keep this short: I really like the new package designer in Sitecore 5.3. It's heaps better than the old one, and even tho this is pretty much identical to a solution a collegue of mine wrote last spring (so he's probably gonna have to come up with something even better yet again) I like the way things are moving forward.. Haven't had a chance to do all the things I hoped to accomplish this week since a middle-hand has been keeping me from completing a milestone in one of my current projects. Oh well, guess that's life. Not much to do there but hope that next week will be better. However, since I've been waiting a lot this week I've kept myself busy testing out the new release of ASP.NET 2.0 AJAX Extensions (or "Atlas" if you're like me and still use that name since it's -heaps- easier to say). First thing that still strikes me when working with it is how easy it is to implement. I'm really impressed at the dedication and level of development that has gone into this project. Good stuff! My next post will probably be a tutorial on the new release of ASP.NET 2.0 AJAX Extensions, but more on that when I do so.. Good stuff, bring on the beers (and the final release of Sitecore 5.3, please?). Take care, P.

Saturday, October 21, 2006

Microsoft ASP.NET AJAX v1.0 Beta

Yesterday Microsoft made the Microsoft ASP.NET AJAX v1.0 Beta (previously known under codename "atlas") available to the public, it's up for grabs at Also, alongside the release of that beta version, the new ASP.NET AJAX Control Toolkit (previously known as Atlas Control Toolkit) was also made public, and you'll find it at Have fun! P.

Wednesday, October 18, 2006

IE7 roll-out

Well, actually it seems that some people -still- get the same errors (KB918899 related), even if they install the update. Wierd. For these people (and for the rest of you/us all) the perhaps good news is that a majority of clients will get Internet Explorer 7 as an automatic update - today. To read more about this see the excellent IEBlog, including posts IE7 to be distributed via Automatic Updates and IE7 Is Coming This Month...Are you Ready?) Now, there's -always- a catch (I feel like a broken record, but there usually is): This automatic update is only available for the users running on english/american locale. Seems the swedish version will be ready for roll-out as an automatic update sometime during december. Oh well. (You could always change your/your clients/whomever's locale to english in the system since that'll tell IE to use the same, and then it'll get updated..) Personally I like the idea that IE7 has been made an "update" since it's a lot better and it gives more to the people developing websites. That's all folks - Take care, P.

Monday, October 16, 2006

Annoying KB918899 issue resolved

As -many- have noticed the Cumulative Security Update for Internet Explorer (KB918899) that came a while ago caused major problems with IE6 (Internet Explorer 6) on XP and 2003 Server. Well, there's another fix now available (KB923996) that you can download directly (instead of the previous one where you actually had to get microsoft to send it to you). Update for Microsoft Windows XP (SP2), English version Update for Microsoft Windows XP (SP2), Swedish version Update for Windows Server 2003 Service Pack 1 x64 Edition, English version Hopefully this helps to make your experience smooth once again, P.

Sneaky, sneaky..

Seems Sitecore has released a new version of 5.3, namely Sitecore 5.3 RC3. Interesting.. feels like the final version will be arriving shortly. UPDATE The installer is a lot friendlier now, and it didn't crash once for me when installing it on my laptop that runs Vista. Good stuff! However, might just be my setup, but i was unable to create a new website in my IIS7, I just had the option to install it on the already existing website. Oh well, that's a really petty problem anyway since you can change it manually anyway you want. Take care, P.

Wednesday, October 11, 2006

Sitecore 5.3 & Vista RC2

So, i've been running Vista RC2 now on my laptop and I have to say that all this fuzz about bugs and crashes and whatever people keep screeming about all over the net seems -way- exaggerated.. well, either that or these people are trying to install it on a pc that was outdated even back when bellbottoms were cool.. Anyway, that's not the point. What i was getting to is that, for me, Vista is a huge improvement compared to todays systems, and that's good. However, there's always a catch, otherwise there's no point in writing about it, but considering that it's still just RC2 -hopefully- these issues will be fixed when it's released. Configuring things like IIS7, or even installing Web Applications Projects update for Visual Studio 2005, or "Atlas"/ASP.NET AJAX is anything but easy and user-friendly. After hours of failed installations I finally got them all running the way they should, and then I proceeded to my final goal, installing Sitecore 5.3.. Again, another no-go-zone (at least, for me). The installer crashed, bigtime, and pretty much won't let me do anything.. First up it crashes in the background after selecting the licence file, I get a notification saying that InstallDriver Module has stopped working.. What's interesting though is that I'm simply able to close the popup and continue with the installation. At this stage i'm going "Heeey, that's neat." but unfortunately that only lasts a minute until it throws another error: Error 1609:.. ASPNET user is not a valid user or group.. And that's where I'm at right now. Might have to manually configure the ASPNET user (shouldn't tho, but who knows?). If/When I get this up and running i'll post again.. UPDATE: Well, here's what has to be done:
  1. Make sure Vista is configured to recognize IIS6 actions/scripts etc. This can be done by checking the appropriate boxes under the IIS part of the "Turn Windows features on or off".
  2. Install .NET Framework 1.1 (and updates).
  3. Turn the UAP off (not sure if this really is needed, but that's what I did).
  4. Run the installer as administrator (right click the installer, "Run as Administrator").

For me it still crashes in the beginning with that InstallDriver Module error, but after that the installer runs (read "is now running" since i'm installing right now) smoothly..


Well, the happiness of the first update was not kept alive for long. After the installation finished (which it did and that was nice) I'm now stuck at the next obstacle - When trying to access localhost all I got at first was an error message saying it couldn't read the config file and a wierd "Could not load all ISAPI filters for site". So, like every other time something goes wrong, I added Network Service and the other system roles to the website and it's content, allowing full access for ease of use. Voila, time to see the next error, and this one is regarding changes made to the handling of the actual web.config file itself. This part was a little more tricky since it's not at all that well documented..

Below is what i've done so far (and as of right now I'm not at all sure about this solution, maybe there's a best-practice way to go about all this, but since I haven't seen one yet I'll keep on trying).

  1. Create a system.webServer node
  2. Move HttpModules and HttpHandlers from system.web to system.webServer
  3. Rename HttpModules to modules
  4. Rename HttpHandlers to handlers

So far all I get is that it's missing a http handler and nothing will load, but perhaps I'll have it fixed soon..


Well, this is a situation with IIS7 having two options to run the site in: "Classic .NET Mode" or "Integrated .NET mode", the later of the two is what they recommend for IIS7 and future versions. Fine, they want us to move up, that's alright. But right now I don't care, I just want it to run. So, if you want to try and load it into the Integrated .NET mode (which I'm trying to), keep thinking and comment, otherwise you can run a command in the command promt to switch it to Classic .NET mode.

%systemroot%\system32\inetsrv\appcmd.exe set app "SITENAMEHERE/" /applicationPool:"Classic .NET AppPool"


When all else fails, admit you've probably done something stupid and save yourself the worry by simply scrapping the old installation and do a new one. Lesson learned.

Hope this will help you install it on Vista if you run across these problems as well.

Take care, P.

Wednesday, September 27, 2006

Atlas Example

Right, down to business then: Sitecore and "Atlas".

"Atlas" is pretty much microsofts approach to AJAX and the hype surrounding it, so it's quite obvious that it was not going to go away but instead turn into a new part of the framework (see Scott Guthrie's blog on the matter at


Now, there's more or less two ways of going about using "Atlas" to power your website, either you build your own custom extender, or you could go with the really easy way - use the UpdatePanel. For now, let's just go with the UpdatePanel approach. If you haven't installed "Atlas" on a already existing site that you want to enable "Atlas" on, don't worry, it's pretty easy to set up:
  1. Install "Atlas" (make sure the checkboxes are ticked to also install Visual Studio project template and to register the .asbx extension in IIS).
  2. Copy the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll) from its installation folder to your site's Bin folder.
  3. Open the Web.config file
  4. Add these elements as children to the <configuration> element <configSections> <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup"> <section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/> </sectionGroup> </configSections> <microsoft.web> <converters> <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/> <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/> <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/> </converters> </microsoft.web>
  5. Add/Integrate these elements as children to the <system.web> element <pages> <controls> <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/> <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/> </controls> </pages> <!-- ASMX is mapped to a new handler so that proxy javascripts can also be served. --> <httpHandlers> <remove verb="*" path="*.asmx"/> <add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/> </httpHandlers> <httpModules> <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/> </httpModules>
  6. Save the Web.config file.
  7. Add a reference to the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll).
  8. (Optional) You can now also add "Atlas" to the Toolbox in Visual Studio. Right click the Toolbox, chose "add tab", name it, then right click, "choose items..", and browse to the "Atlas" run-time assembly (Microsoft.Web.Atlas.dll).

Phew! Ok, that's about it for the installation and messing with a already existing site, now on to the fun stuff.

If you've never tried it before you're going to have fun, "Atlas" is neat and easy to use (note tho that it's still not a full release, so if it for whatever reason does crash, well, sorry, not much to do then but to re-install it).

1: Adding a ScriptManager

Add this to the page you want to enable "Atlas" on.

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> </atlas:ScriptManager> Now, there's more stuff to add here if you want to, like automated error handling etc:

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> <ErrorTemplate> <div style="width: 450px; height: 300px; padding: 10px; border: solid 1px black; background: gray; text-align: left;"> <h1>Site error detected</h1> <p>An unhandled exception with the following message has occured on the server:</p> <p><span id="Span1" runat="server"></span></p> <p>We're sorry for any trouble this has caused you and will fix the problem as soon as possible.</p> <p><input id="Button1" type="button" value="OK" runat="server"/></p> </div> </ErrorTemplate> </atlas:ScriptManager>

Play around with it, you'll find more things to use i'm sure.

2: Adding a UpdatePanel

An UpdatePanel is pretty much a content-wrapper that will allow you to reload parts of the page (AJAX styled content refreshing instead of reloading an entire page) so let's look at that one. First up, we need to wrap our area with the tags.

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> </atlas:UpdatePanel> Next up, adding a ContentTemplate to define what within this UpdatePanel that's our actual content area.

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <div id="Div1"> </div> </ContentTemplate> </atlas:UpdatePanel> Now, let's add a nice looking UpdateProgress as well to show that something's going on when it loads

<atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <div id="Div1"> <atlas:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <div id="Div2"> <asp:Image ID="Image2" runat="server" ImageUrl="/images/loading2.gif" GenerateEmptyAlternateText="True" AlternateText="Loading.." /> </div> </ProgressTemplate> </atlas:UpdateProgress> </div> </ContentTemplate> </atlas:UpdatePanel> 3: Refreshing the content

It's nice to have the possibility to update content on the page, but unless we actually activate it there's no point, so let's add an automated update of the content using a TimerControl.

<atlas:TimerControl ID="tcExample" runat="server" Interval="10000" Enabled="true" OnTick="tcExample_Tick"> </atlas:TimerControl> Next we need to add the tick event to the UpdatePanel so that it knows when to update itself. This is done using a Trigger that we'll connect to the Tick event of the newly created TimerControl. Add the following code within the UpdatePanel section:

<Triggers> <atlas:ControlEventTrigger ControlID="tcExample" EventName="Tick" /> </Triggers> 4: Defining what to refresh/update

Well, now that we have automated updating partially set up, let's add something to actually refresh/update. For this example we'll use an image (simple, i know, but it's just for example purposes). Add the following image tag within the <ContentTemplate> section of the UpdatePanel

<asp:Image id="ExampleImage" runat="server"/> 5: The code so far

Now, if you've followed the steps above somewhat down each line your page should look something like this:

<atlas:ScriptManager ID="MyScriptManager" runat="server" EnablePartialRendering="true"> <ErrorTemplate> <div style="width: 450px; height: 300px; padding: 10px; border: solid 1px black; background: gray; text-align: left;"> <h1>Site error detected</h1> <p>An unhandled exception with the following message has occured on the server:</p> <p><span id="errorMessageLabel" runat="server"></span></p> <p>We're sorry for any trouble this has caused you and will fix the problem as soon as possible.</p> <p><input id="okButton" type="button" value="OK" runat="server"/></p> </div> </ErrorTemplate> </atlas:ScriptManager> <atlas:UpdatePanel ID="UpdateExample" runat="server" Mode="Always"> <ContentTemplate> <atlas:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <asp:Image ID="Image1" runat="server" ImageUrl="/images/loading2.gif" GenerateEmptyAlternateText="True" AlternateText="Loading.." /> </ProgressTemplate> </atlas:UpdateProgress> <asp:Image id="ExampleImage" runat="server"/> </ContentTemplate> <Triggers> <atlas:ControlEventTrigger ControlID="tcExample" EventName="Tick" /> </Triggers> </atlas:UpdatePanel> <atlas:TimerControl ID="tcExample" runat="server" Interval="10000" Enabled="true" OnTick="tcExample_Tick"> </atlas:TimerControl> 6: Adding the final code

Almost done now, just one thing left, and that's to add the actual code we use behind the scenes. For this example i've used a simple sitecore structure to attach images to an existing item Sitecore - Content -- Home --- AtlasExample ---- Image 1 ---- Image 2 ---- Image Whatever ---- ...

The template that holds the images simply holds a Image field named "image", nothing more. The reason for having them located under one item is just for easy access through sitecore.

In the code we're gonna be using a ItemCollection and IEnumerator to move through the items and get the content.

protected static System.Collections.IEnumerator images; protected static ItemCollection imageItems;

First up, load the content into the collection when the page is first loaded:

protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitColl(); } } protected void InitColl() { if (Sitecore.Context.Item.HasChildren) { imageItems = new ItemCollection(); Item imageFolder = Sitecore.Context.Item.Children["AtlasExample"]; if (imageFolder!=null) { foreach (Item itm in imageFolder.Children) { imageItems.Add(itm); } images = imageItems.GetEnumerator(); SelectNextImage(); } else { this.ExampleImage.Visible = false; Sitecore.Context.ClientPage.ClientResponse.Refresh(this.ExampleImage); } } } protected void SelectNextImage() { if (imageItems!=null) { if (imageItems.Count>0) { if (images != null) { if (!images.MoveNext()) { images.Reset(); images.MoveNext(); } Item next = (Item)images.Current; Sitecore.Data.Fields.ImageField image = (Sitecore.Data.Fields.ImageField)next.Fields["image"]; this.ExampleImage.ImageUrl = "~/media library/Images/" + image.Src; this.ExampleImage.AlternateText = "AtlasExample"; } } } } Next, add the tick event that we stated in the TimerControl earlier.

protected void tcExample_Tick(object sender, EventArgs e) { SelectNextImage(); }

Now go ahead and build it and watch the results on your site.

8: Moving on

As you can see extending a site, even a sitecore powered one, with "Atlas" is really a piece of cake and is there for everyone's taking. Check out the Atlas control toolkit and the samples there for more details on how to extend with "Atlas" using custom extenders.

Further reading:

Take care, and have fun!


Tuesday, September 19, 2006

Atlas loves Sitecore

Well, the title pretty much says it all. I've played around a bit with Atlas now, which b.t.w. is now called Microsoft AJAX Library and ASP.NET 2.0 AJAX Extensions, so scrap the whole "Atlas" namning thing, it's going to be incorporated into the asp: namespace by the looks of it. Moving on then: Including Microsoft AJAX Library / ASP.NET 2.0 AJAX Extensions was actually a lot easier than i thought, it's pretty much just install & use. I've started on an article (not finished yet) that will detail the steps/outlines of how you can do this in a few easy steps.. might have time to publish it later today, we'll see.. UPDATE: I'm afraid i don't have the time to finish the article, and seeing that i'm heading to New York tomorrow i'll either finish it there or when i get back. Take care! P.

Friday, September 15, 2006


Seems there's a bug in the template handling - it's impossible to add a external link via the link field. Try this:
  1. Create a template
  2. Add a Link field
  3. Save
  4. Create an Item based on the newly created template
  5. Try to add a external link using the link field

Notice that the dialog that opens up is in fact the dialog for Internal Link?

Hopefully this'll get fixed, or is already fixed perhaps?


Keeping an eye open proves to be priceless at times, and this time i'm soooo proven wrong (the dropdown to the right, on the side of "insert link" includes the option to add a external link). Well, you live and learn. There's no bug what-so-ever, i'm the bug :)


Wednesday, September 13, 2006

Sitecore 5.3

Well well well, quite the surprise for SDN5 users to see is the change from 5.3 Beta to simply 5.3 (RC2). This i've been waiting for with the restlessness of a child, so I'll post more later after I've used it for a while. To quote myself:
For those of you with access to sdn5 and curiosity to satisfy, run on over there and download it..
UPDATE: Well, the installer works better than before, but i still hope they will add the option to specify the prefix when installing on SQL, 'cause if they don't it'll be a pain to install on a server with existing solutions.. That's it for now, P.

Friday, August 25, 2006

Items and their security

Security is a tricky thing, no matter what application or layer you're trying to manipulate/access. First up, sitecore has awesome security, and with each release it keeps getting better and better, so that's a really big + for them, and that's why i'm just gonna relay this post to Alexey Rusakov instead since he's worked on this a lot (i only wrote a work-around). So, go read: Alexey Rusakov - More on 'Hidden' Items that's it for me today, it's friday and almost time for after-work beer :) have a great weekend, P.

Tuesday, August 22, 2006

Tthe importance of looking ahead

First release has seen daylight and now (i think) i can finally breathe again.

It's been interesting, that i can't argue, but it's also proven to be quite challenging at times. Had to figure out a lot of new ways to do things you know you somehow should be able to do. Next in line will probably be updates and enhancements and what-not but that's all in the coming so i reckon for this very moment i'm quite happy with the release i've made and the chance to breathe again.

Ever thought about the way blogs and articles help you think outside the box? Well, i have.

There are people that do a lot more for others that they think. People that don't just develop solutions, they also develop other people. They are, in lack of better words, people developers.

Think about it: Who hasn't glanced at pieces of code in articles from the various sitecore blogs? or adapted the code from sdn5 to suit their needs? I know i have.

All these authors, thinkers and futurists make a difference if you ask me - They're part of a new breed of developers, of teachers.

You know what? let's dub them knights of sitecore. Along with the awesome code in sitecore their ways of adaptation and use of it make damn sure that people, like me & you, keep looking ahead, looking for more & striving to improve.

Sitecore, and their knights, are one step ahead, and from what i'm seeing people are running as fast as they can to catch up.

This time my hat's off to you all, and hopefully you know who you are.

That my friends, is the importance of looking ahead.


Wednesday, August 16, 2006

Murphy's 1st Law: If anything can go wrong, it will

2 days to deadline i installed a package with some updates to parts that shouldn't affect the solution at all, but now all my portals have stopped loading and instead only gives me the below error message no matter what i do to the IDs all over the place.
Server Error in '/' Application. Multiple controls with the same ID '_menu' were found. FindControl requires that controls have unique IDs. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Multiple controls with the same ID '_menu' were found. FindControl requires that controls have unique IDs.
Not the ideal scenario to start my day with, but hopefully i'll have it fixed soon (otherwise it's going to be a loooooong day).. P. UPDATE: well, i don't really know if it was from lack of sleep or stress or something else, but after moving a few more IDs around it's back to normal again.. 2 days & counting..

Friday, August 11, 2006

Hook, line & sinker

I think the first week of being back from vacation is a pseudo-realistic experience: you wake up each morning thinking 'damn, i so wanna stay in bed', then you get up, go to work and somehow there's tons of stuff to do that wasn't there when you left. Then, as fast as you thought you'd like a couple of weeks more, the first couple of days go by and you're back in the net: hook, line & sinker. Right now i'm in the process of finalizing the, by far, biggest sitecore solution i've ever built. 100% XAML/Sheer UI based on a number of portals and -tons- of portlets, custom applications, controls, wizards, events, messages, workflows & pipelines (i won't even try to count the number of templates, masters and items). And you know what? i'm loving it. Working with the sitecore adaptation of xaml is damn cool and at times it's been keeping me up at nights (something i thought nothing anymore could ever get me to). It's built on 5.2, not 5.3, but as soon as 5.3 gets a final release i'd like to port it over 'cause i've noticed a lot of things in there that this solution could benefit from. Once the solution is live (and if i get the 'ok' from the captains) i'll post more on it. Although i haven't slept much this week, come end of next week i'm damn sure gonna make up for it (if there's still a hint of summer outside the walls that is). Take care, P.

Wednesday, August 02, 2006

Vacation: Week #2

Well, it's been awesome so far. Managed to go up to the northern parts of Sweden where i'm from, and the sun never sets up there. Piteå and the cities close by are interesting during the summer: daylight 24/7, tons of stuff to do and more than enough beer to drink. Even managed to try the new discgolf course they're building up there, and by the looks of it that course is gonna rock. After a couple of days up there we headed down to Copenhagen (yes, Denmark) for a chance to get away from the everyday life and stuff. Actually walked past the Sitecore HQ, but didn't really manage to pop in and say hello. Now afterwards i kinda wish i had.. oh well.. another time perhaps (when someone invites me instead of crashing). Copenhagen is an amazing city tho, so relaxed and interesting. Managed to walk for more than i'd hoped to walk for in a lifetime, but it was well worth it. After that we headed up back thru sweden and stopped by Skummeslövstrand for a few days, driving around to Halmstad, Båstad and a lot of other places i don't remember the name of but they pretty much all ends with -arp something something. All things considered, a very nice couple of days spent relaxing and feeling like i'm actually on vacation. Back in Stockholm now, so for this week (which is also my last week of vacation) i'm gonna focus on the important things in life: discgolf, volleyball, beer and poker. Next post will probably be a lot more tech orientated, but this one is comepletely clean from all things tech (hey, i'm on vacation damnit). Take care.

Wednesday, July 12, 2006

First impressions..

Well, it didn't dissapoint me at all i have to say. 5.3 looks like it's going to be awesome. Had a bit of trouble installing it to my regular sql server, so for attempt #2 i went for the sqllite option instead and it works like a charm after setting a few additional security permissions. Don't know where to start really, so i'll just drop a few things on here for now. The layout of the content editor is heaps better than 5.2. no more waste of space here, in fact, it's quite clever how they've managed to squeze so much information and still keeping it easy to access. Working with this editor will make us, and clients, save a lot of time. Also, on the note of the content editor: it's fast. way faster than the one in 5.2. Probably for the above reason alone i'd jump at the chance to upgrade everything we have to 5.3, but that'll have to wait until a full version is available and we're asked to upgrade :) Some other things that jump at you right away: There's now an easy way to set SubItems Sorting of an item, very neat & useful. Validation is also very easy to access and will make clients happy indeed. Even Icon assigning is made easy with new panels showing the icons and smart positioning. The Developer Center is an interesting idea, and can indeed prove useful in the future, but i hope it gets a bit more options to it, or a way to easily define your own custom options without stepping into the code. The idea is great tho, gathering common things under one umbrella. The Template Editor has also gotten a big overhaul and i can't say i'm sorry for that. The new one is great and will also make working with it a lot easier. Things like setting Standard values and Masters are neatly accessible now. Also, the way you can add things to the template and edit the template from the content editor is quite cool. I hate to sound like an evangelist, but it's hard not to. It's awesome. So it's still a Beta version and has it's share of bugs, but i'm impressed, and that doesn't happen very often. Hat's off to the team at Sitecore, this version will shake the foundations of CMS systems for a long time. Haven't yet written a portal for this version, but that's probably going to be tonight then since i can't sleep in this heat. Don't get me wrong tho, summer is heaps better than the cold of winter, but i wouldn't mind having a full nights rest every now and then.. oh well.. more updates later..

Monday, July 10, 2006

5.3 Beta

Well, it's here, the beta release of v5.3. Time to see if it lives up to my expectations or not, but something tells me it will.. and more. For those of you with access to sdn5 and curiosity to satisfy, run on over there and download it..

Friday, July 07, 2006

5.3 - Follow Up

Lars Nielsen at Sitecore just made my day (and, seeing that it's friday today it couldn't have been done much better), so, i reckon i'll have to have a beer later in his honor. My plans for a few days of r&r (some call it vacation, but i think vacation is when you have to much time on your hands to know what to do with) are safe and in no apparent danger. Quick thing about portlets: if you've ever added a contextmenu to a listview in the xaml itself and then used it, you'll notice it magically vanishes after the list is refreshed. well, there's a work-around for that as well. Assuming the code looks something like the following:
protected Listview BudgetList; // more nice stuff that you're using.. protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) { // some code here to load it all if you have any.. } }
All you'll actually really have to do here, for now (i'm sure it'll be fixed and even improved by the rate they're developing) is to add one line to the OnLoad() event:
protected Listview BudgetList; // more nice stuff that you're using.. protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Sitecore.Context.ClientPage.IsEvent) { BudgetList.ContextMenu = "show:BudgetContextMenu"; // some code here to load it all if you have any.. } }
(sorry for the crappy layout of the text, don't really have the time to edit it properly).

Thursday, July 06, 2006


Everything i've read, seen & heared about v5.3 is a step forward. It's going to be faster, better & smarter. Things are going to work better in regards to user experience. I could go on & on about all the benefits, but that'd probably be like preaching to the choir so i won't do that. There's one thing that cought my eye tho, and that one thing has me pinned against the wall:
Sitecore’s portal framework is replaced with the ASP .NET 2.0 embedded portal framework.
Perhaps for many a minor thing that'll pass without much notice, but right now that same change/update/migration, if it won't support the previous portal, only says one thing to me: cancel any upcoming vacations..

Wednesday, July 05, 2006

Internet Explorer Developer Toolbar

If you haven't tried it yet, give it a shot. Quite neat application that can prove useful when developing websites and solutions for the web in general. Some of the features: View DOM, Disable Cache/Images/Css etc, Outline Div/Table/Images etc, Resize, Clear cache for domain/all etc and a ruler. Update: If you're a heavy firefox user, go get Firebug for firefox at which offers the same functionality (if not better) for Firefox. Thanks crashie!

Get children sorted from a specific Item

Often you get stuck with things you don't want to do again and again, one of them is to bang your head against the wall trying to figure out where you wrote a icomparer that you can easily use to get a sorted ChildList. Well, after banging my head enough i wrote a small workaround using a DataContext instead. The method is pretty straight-forward, so just use it as it is or modify it to any need.
private Sitecore.Collections.ItemCollection GetChildrenSorted(Item parent, String sortby, bool sortascending, int offset, int range, string filter) { Sitecore.Web.UI.HtmlControls.DataContext dc = new DataContext(); dc.DataViewName = "Master"; return dc.DataView.GetChildren(parent, sortby, sortascending, offset, range, filter); }
So, whenever you need to get a list of items sorted a specific way just use the method in the appropriate way, maybe like the example below?
private void FillSomeListOrSomething() { // Parent Item that you want to get the children from.. Item parent = Sitecore.Configuration.Factory.GetDatabase("master").Items["/sitecore/content/home"]; if (parent.HasChildren) { foreach (Item itm in GetChildrenSorted(parent, "__created", false, 0, 0, "")) { // whatever you want to do with the sorted list of items you got back.. } } }
Maybe this is a really bad way to approach this problem, but it works for me so i'll use it for now (or until this functionality is implemented in Sitecore).

Tuesday, July 04, 2006

Problem with DataTreeview & DataContext in a portlet

If you've ever tried writing a portlet containing a DataTreeview & DataContext with the normal DefaultPortletWindow control you've probably noticed that it doesn't work all that well (surely will be fixed in a later release we hope). The problem is that you when you try to expand a node in the DataTreeview you get an error saying DataContext ”” not found. (Method: Sitecore.Web.UI:HtmlControls.Treeview.Toggle(String id)). For anyone that has actually been affected by this issue or will be in the future, there are two ways to address this issue, either programmatically or via a work-around. The programmatical approach for this by issue would be to implement all of the code relating to the DataContext and DataTreeview and, for ex, adding it to a Border control or similar in your C# code. This solution though isn't that friendly to use again in another portlet since it involves you writing all the code for yourself. The work-around is a lot more user-friendly and a solution you might want to adapt instead of writing the same code over and over again each time. In this case, all you have to do is copy the PortletWindow control, rename the control to something else, like myPortletWindow, and save it with a new name where your custom controls are located. After that, apply the new window control to your portlet xml layout replacing the standard one, and save. So, step by step: 1 – Open PortletWindow control (located at \sitecore\shell\Controls\Portal\Portlet window.xml) 2 – Change the name of the control to something else (in this case myPortletWindow) 3 – Save it somewhere (in this case I’m saving the controls under \sitecore modules\Shell\Example\Controls) 4 – Apply the new window control to the portlet xml layout that you had trouble with and save it Once you've done this you can use this window control instead of the default control without further need to manage it programmatically.