First experiences with FireBird / 5.1.1

For a month of 2 or so, we didn’t start new SiteCore 5 problems.. I’m mean project ;). Too bad, you guess, but for us it means we just can finish the jobs for 2005. What also means that we can start all over with new versions, latest releases, in the start of 2006.
Couple of week ago I configured the latest 5.1.x.x release on my notebook. It was 5.1.1.14 Beta. The main reason was that I’m quite interesting in FireBird and it’s preformence against the XML-Version of SC4 and ofcourse it’s preformence against our mainly preferred database: MS-SQL. The install was quite easy, and then I just had to replace the ‘.Sql(Server)’ part in FireBird. When you look a bit further, you’ll se that SiteCore distributes an web.firebird(FireBird enabled Web.config) with it’s distribution. But even without that, the installation(check SDN) went perfect.

Yesterday I’ve also installed this version on one of our staging-servers. Installed ‘Global Adventures’ and posted the link on on our intranet so it was public for everyone here. And guess what, even the boys from YourZine, you know PHP-Boys in the same company, where impressed!
Some quotes: “It actually does work in FireFox!”, “Wow, looks good, but what can I do with it?”
Or sysop had the funniest reaction: “What is SiteCore actually? I mean, can it be interesting for me? It is an OS isn’t it?”

Well that was everything about the internal reactions. Now about FireBird:
As a matter of fact, I’m highly impressed. The staging server which is serving the pages did even get a higher load after installing FireBird and running it. That was a good start-up :).
Just copied the files(including databases) from my notebook to the server and typed the internal url ‘sitecore511’ in my browser. Boooooom there was the site!
Without any prooblems, without crashing. Just there!

Now testing the DataProvider :).
The first thing what appaers when you just shutdown your FireBird is a nullpointer ‘The device cannot be null’. As a programmer I can image lot’s of devices except the database device. But it is a Beta so I don’t really care.
Then: adding, deletiong, trying to create delete and edit linked items, etc :). Ofcourse I know those features aren’t working yet but why am I not allowed to try ;).

After 20 yellow screens I quite… It seems to be better to test that kind of cruelty on a Stable release, not a Beta…
In Junari I’m going to write a stresstest for SiteCore 5 on the different databases and servers. Then we should be able to compare the databases and versions to each other.

HowTo start working on a Sheer UI

One of the main dificulties when you want to create your (first) Sheer UI is creating a good project.
With these steps you can make an easy, clear ‘workfloor’. Ofcourse you need to have Visual Studio installed(I’m talking about version 2003 now) and you should run a SiteCore 5 local :).

– Create a garbage folder on you desktop: for example ‘My First Garbage collecting folder’
– Now… Open Visual Studio
– File > New > Project
– Select ‘Empty Project’
– Give the project the namespace you want to use. That’s what I recommendate. I would use: Sitecore.Modules.Lectric.[ModuleName]
– Change the Location to the garbage folder on your desktop
– Now click ‘Ok’
– Close you Visual Studio now

– Browse to your Garbage folder and find the folder with the name of your project
– In another window, browse to your local installed Sitecore folder.
– Copy all files on the root of the project folder(in the Garbage folder) to your local installed Sitecore folder, but leave all subfolders untouched.
– Delete the garbage folder now including subfolders
– Now start the project again by doubleclicking on the project/solution file(*.vbproj/*.csproj/*.sln).

– Wait a minute, you’ve already done a lot. Take a cup of coffee ;). You are worth it!

– The only thing you have to do is changing some of the Project Properties. Todo that, just cloick right on the project and select ‘Properties’
– Change the name of the assembly and default namespace to the ones you want. My suggection: Keep them the same as each other. When you default namespace is Sitecore.Module.Lectric.AlexSheerUI, your dll should be Sitecore.Module.Lectric.AlexSheerUI.dll so you should always be able to find delete and manipulate it!
– Also don’t forget to select the default Output Type: Library
– Then select Configuration Properties.
– On the top of your screen next to the label Configuration select ‘Debug’ from the DropDownList. Change the ouput path to bin\
– Do the same as above for the Configuration ‘Release’.

Guess you are ready now to follow the tutorial on SDN: My First Sheer UI. Ofcourse you need to have access to SDN. Just contact your partner, as long as the partner isn’t on of the Dutch partners :P.

Oh yeah, I’ve got two last hints for you fooks!
1. When you use the CodeBeside, you have to inherit your class from the baseclass: Sitecore.Web.UI.Sheer.BaseForm
2. You can access your application directly outside of the client: http://[yourhost]/sitecore/shell/sitecore/content/Applications/[yourapplication].aspx

Soon more, as I’m currently heavy working on my first colelction of cool Sheer UI’s πŸ˜‰

SiteCore Security: I do it my way – Part II

I’m starting my first serie of blogs in the third week :).
Here’s part two of my experiences with the SecurityModel. This is my reaction to the comment of Lars Nielsen:

I tried to use the SecuritySwitcher. To bad, but I couldn’t find the overloaded Constructor :(. Guess that I can find it in 5.2 or the next release of 5.1.1?
It didn’t really matter because, I guess, it will use Sitecore.Context.Domain to retrieve the UserItem from.:
Sitecore.SecurityModel.UserItem myUser = Sitecore.Context.Domain.GetUser("admin");
using(new Sitecore.SecurityModel.SecuritySwitcher(myUser))
{
//Your code
}

So to figure out if the SecuritySwitcher really uses just it’s own state-object in it’s own scope. I wrote some test code. You can download it here(for question about copyrights etc, please see the ‘Legal Notice‘).
I discovert 2 strange ‘functionalities’:
– Default the Sitecore.Context.Security.User is an empty object?! I don’t exactly can understand why this object isn’t filled. When I’m visiting a SiteCore website, I expect that by default my session would use the user ‘Anonymous’.
– When you run the code as a layout you’ll see that when you switch to the Sitecore-domain user ‘Admin’ when you are in the domain ‘Extranet’, you will stay in the domain ‘Extranet’. So Sitecore.Context.Domain.Name gives ‘Extranet’ but Sitecore.Context.Security.User.Domain.Name gives ‘Sitecore’. Isn’t this strange? The samething appears when you login to the user ‘Guest’ in the domain ‘Extranet’ and you change the ActiveWebsite to ‘shell'(so your domain changes to ‘Sitecore’), the Sitecore.Context.Security.User.Domain.Name gives still Extranet.
That’s what I’ve noticed till know.

Note: I’m using Sitecore 5.1.1.4 at the moment. I guess I’ve to upgrade to 5.1.1.8 for solving both problems :P?

SiteCore Security: I do it my way

Since, I customise Sitecore even more and more, I have to work with the SecurityModel in SiteCore.
One of the main issues, when manipulating items, is the full-control access. You can get access, in your code, to nearly everything using those two code snippets:

using (new Sitecore.SecurityModel.SecurityDisabler())
{
//your code
}

or:

string userToLogin = "admin";
Sitecore.SecurityModel.DomainAccessResult result = Sitecore.Context.Domain.Login(Sitecore.Context.Domain.GetUser(userToLogin));
if (result.Success)
{
// your code

// log out for security reasons
Sitecore.Context.Domain.Logout();
}

By myself I prefer the second option. I know it’s slower(it has to contact the database, to login and create some new object in the ‘Domain-Context’), but that’s not the reason why you should choose for the other in the first place. My argument to choose for the second version is that you will use the SecurityModel in the way it is mentiont to be used. When you need such privileges ofcourse. The security disabler kicks your ass to Redmond where they also thin that by default ‘All Access / No rights defined’ is the best way to manage your security.
Ofcourse when you are manipulating your website at any page request you’ll receive it’s better to give the Extranet domain full access to your databases πŸ˜›

Last but not least, a hint, just for free: When you are using the code above, please mention that you carefully have to select your databases! Sitecore will change your current database, after logging in not directly points to the database ‘you want’. Based on the current website, the Sitecore.Context will not change till you change the current website. For more information about current databases, default sites, etc. I would suggest you to take a look at this post of Alexander Shyba, one of the Solution Consultants of Sitecore in the Ukraine.

Media Library… cool if the files are also ‘cool’

One of our customers had a problem with it’s Media Library.
I figures out that some of the files weren’t fisically on the cms-server. So I’ve created a small script which makes it very easy for you to check out the server…
About the code, it isn’t my best code ever, but for only one and a half hour work it’s definitelly good enough :). There are lots of improvements which I want to make in the following 12 years:
– Reading the database from the website section in the web.config(the ones which are linked as content databases, for now it’s just web and master)
– Better solution for retrieving upload-directory
– Improvement of variable names, so it’s also n00b proof πŸ˜‰
– Export functionality
– Last file-editor name
– Etc…

For cool interfaces you should contact Sitecore. But for functionality, just contact me πŸ˜›

I wrote it in the namepase Sitecore.Diagnostics. So I guess it’s also on the good place.

Download it here and enjoy! Merry X-mas by the way.

Wednesday, SiteCore Hell day?!

What a day! Just finished work, correction, just home! Real work will start ;).
It was around 12 o’clock that one of our managers called me on my cellphone. Till that moment I was working on the documentation of a quite big replication-process which I’ve configured last 2 nights and some other (smaller stuff) for the same customer(server movement, software upgrades, etc :P).
Manager: “Then the call came in, big customer X does have a serious problem.”
Me: “Uhhm… urr… Well, quite busy at the moment.”
Manager: “But documents, pictures and even items aren’t displayed!”
Me(looks at the Customer’s website): “Hell, buuttt… I can see it works, check you mail dude! Here’s the link…”
Manager: “Definitelly not! Check your mail”
[Another 25 links where sent]
Me: “Can’t do anything remote and I’m also very busy… It is already plannend that I’ll go to that customer this Friday, so be calm!”
Manager: “Urrr urrr urrr”

Three hours later… Big boss comes in:
BB: “You really have to go to customer X!”
Me: “But have to finish this stuff today.”
BB: “The nicest part of my position is that I can make those decisions.”
Me: “Aight, but… I’ve got a lil’ problem… :P”

Together with the Big Boss in his super cool car to Customer X πŸ˜€ :D:
Me: “Quite nice car”
BB: “The car isn’t the problem, the problem today is the solution for X ;)”

Finally I was at Customer’s X office. There they explained me the problem:
The staging module of SiteCore does not puiblish correct and some parts(like some items) aren’t diplayed as well, or are only diplayed for 50%.
Customer: “Can you analyse the problems? Can you give us some options to fix the problem and can you fix it afterwards? Thank you! We knew we could count on LECTRIC.”
Me: “Uhhhmm yes uhhmmm yes!”

Finally I figured out that publishing didn’t looked like that was the problem. The problem of the last Staging module is quite simple: the webservice doesn’t remember the user’s session(Logged Out directly after Logging In), so the files doesn’t retrieve the right rights.
Now the second part.. All the items are available in all databases. But some pictures and linked media-items aren’t displayed, the whole field is an empty object(value string.Empty, innerXml, outerXml, etc.) and guess what.., these files(in the media library) are also unavailable on the current server. Because the Staging isn’t working… remember… πŸ˜‰
Last but not least: I forgot one detail. We are running there on SC 5.0.6.(1/2/x). Better known as SiteCore Bug Release ;). No it does work fine, actually, it did work fine for 2 months! And why fix the first SC5 site in the world, when notthing is really broken?
I have tomorrow to resolve this problem and tomorrow and because this friday and monday we have to extend their ‘Webfarm’ with another ‘Webfarm’.(keep in touch with the new licences :D) The next project will be, upgrading SiteCore… I hope…

Hope I can post the solution tomorrow…

Editting items in SC4

Yesterday, I played a lot with SiteCore 4. For some (mostly) preformence reasons, we decided to build one of the new sites in SC4.
One of our new guys, just got his first introduction to SiteCore last friday. His first task was creating a small poll module.
So I tried to help him out saving results in a content item. But it wouldn’t work so quickly. Finally I just said: I’ll firgure it out for you this damn weekend ;). So yesterday I started working on it, but after 2 hours of useless coding I quit and wrote an e-mail to support.

Here’s their answer:

IMasterItem itm = Sitecore.MasterFactory.GetItem( id );

if ( IsEmpty( itm.GetFieldValue( PUBLISH_FIELD_KEY )))

{

itm.GetLatestVersion().SetFieldValue( PUBLISH_FIELD_KEY, request.PublishIsoDate );

itm.RegisterEdited();

itm.Commit();

itm = null;

}

The only thing to do left is to publish the item. Guess that will not be the problem. ..

That’s it for now, tomorrow, I hope, more information about our first experiences with SC5 and FireBird.

New SiteCore Licensing model is a BETA?!

At my work, LECTRIC, I looked together with our Business Development guy, Bert, to the brand new licensing model of SiteCore. Especially to the option small bussiness, which is, in my eyes, more less then ideal…

Let me explain:
A basic restriction of 2000 items in Sitecore(do you count them on the master-database? Are it just content items? Are templates/masters included?) I hope we don’t have to look for possibilities to decrease the items we’ve created.
And the strangest part of this license: 1 CPU per server… Where can you get a server with just one CPU nowadays? Next to it, when I’m writing webapplications the CPU is most of the time the least interesting part. Because of this new licensing mode, I guess we have to create a new CPU based test-plan.
Bert and I also considert that offering a kind of shared hosting(several Sitecore installations on one server, somethimes the database extern on a database server) to our customers becomes very hard. For our smaller customers could that option be very interesting…

I guess this will be the best option for these customers will be from now:
– Database server(FireBird) with several SC5 (Client) installations and the Staging module configured
– Webserver(-s) with several websites, runtimes and Staging modules
As far as I can see now, the costs of these customers will be: 10.000 euro for licensing(SC Small Business, Staging Module, Runtime/Webfarm). So this means, the price of the shared hosting will be doubled.
After all, I guess, some of our customers get scared from the new licensing model. Which I think SiteCore waqsn’t mentioned to do.

When I look at the stuff above, I definitelly hope this new Licensing model is a Bèta and will be changed after the first experiences of the Partners…