These days

It’s quite busy these days… Our team is woking on 3 brand new projects and a sub-site one exsisting project. Two of the new projects are internet sites. One of them is the base-production for a full publication platform of one of our customers, the other one a rebuild of an exsisting site in ASP. This last production will be restyled later this year(read: end of this summer).
The last new project is my project. It’s a quite big intranet. Luckily without intergrating lots of other systems :), so I’m able to create some custom controls for our LECTRIC-Lib and create strictly defined StartUp, Deploy and Test procedures!
We’ve just released 3 projects, will review them here when I’ve got premission from our Sales-team. Our goal is 15 new Sitecore projects this year, but actually it will look more and more like we’re going to release 25 projects :P. A bit of pressure is good for a lazy programmer ;).

Lars Nielsen is in The Netherlands. He’s training some of the dutch partner-engineers and 2 of my collegues. Today, he’ll show us 5.3 Alpha and it looks like I’ll get the possibility to play with it a little. Actually can’t wait!

Tomorrow I going to shwo my Sales-collegues some stuff about .NET 2.0, the future vision of Microsoft, etc. The workshop is called ‘.NET 2.0 for salesmen’ but also our project managers are invited. When some people are interested, I can send the sheets(build with Office 2007 :D). Just contact me at LECTRIC: a-dot-degroot-at-lectric-dot-nl.
This is it for now. Bye 🙂

Publishing Errors, something about clearing cache… stupid me!

Started last week with a new Sitecore-based Intranet for a new customer. Renamed the website-name in the sites-section to intranet and from that moment I actually received error after error while publishing. Ofcourse I’ve never looked in the log-files, didn’t had any problem, so why should I ;)?
The error, talking about was the following:

Job started: Publish ‘master’ to ‘web’ (nl)|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Exception: Site “website” not found. (method: Sitecore.Publishing.HtmlCacheClearer.ClearCache(Object sender, EventArgs args)).
at Sitecore.Diagnostics.Error.Raise(String error, String method)
at Sitecore.Sites.SiteContextFactory.GetSiteInfo(String name)
at Sitecore.Publishing.HtmlCacheClearer.ClearCache(Object sender, EventArgs args)
at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
at Sitecore.Publishing.Publisher.NotifyEnd()
at Sitecore.Publishing.Publisher.Publish()
— End of inner exception stack trace —
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
— End of inner exception stack trace —
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Jobs.Job.ThreadEntry(Object state)

It couldn’t be more self explaining: System.Exception: Site “website” not found..
How to fix this? Go to your publishing events, in this case the publish:end, and rename the websites:


<handler type=”Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel” method=”ClearCache”>
<sites hint=”list”><site>website</site></sites>
</handler>
<handler type=”Sitecore.EventHandlers.CredentialCacheClearer, Sitecore.EventHandlers” method=”ClearCache”>
<sites hint=”list”><site>website</site></sites>
</handler>
</event>

So when you rename your site in the sites-section Or when you add another website, just configure this event the right way :).

Update: There’s also a cacheSizes-size section. It contains a ‘website’-node. Rename it.

Problem when delivering files to download

My collegue Martijn, have pointed me and my collegues on an issue when elivering an file to download to an user.
You have to clear the headers as Sitecore is destroying the headers oof the request. Use Request.ClearHeaders(); to make begin building your headers from scratch.

Here’s a full download script:

string extentie;
string mimetype = string.Empty;

FileStream sourceFile = null;
FileInfo myInfo = null;

try
{
myInfo = new FileInfo(Server.MapPath("/eg/path/to/file/"));"
sourceFile = myInfo.Open(FileMode.Open);
}
catch(Exception Ex)
{
Response.Write(Ex.Message);
Response.End();
}
extentie = myInfo.Extension;

switch(extentie)
{
case "pdf":
case ".pdf":
mimetype = "application/pdf";
break;
case "jpg":
case ".jpg":
mimetype = "image/JPEG";
break;
case "jpeg":
case ".jpeg":
mimetype = "image/JPEG";
break;
case "gif":
case ".gif":
mimetype = "image/GIF";
break;
case "txt":
case ".txt":
mimetype = "text/plain";
break;
case "doc":
case ".doc":
mimetype = "Application/msword";
break;
}

//Write header
Response.ClearHeaders();
Response.ContentType = mimetype;
Response.AddHeader("content-disposition","attachment; filename="+myInfo.Name);

//Write file
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
Response.End();

Search optimalisation

It’s quite easy to do some extra Search Optimalisation using Sitecore. My collegues Ruben ‘Usability’ Timmerman and Ulco Wierenga pointed me on the spaces in the URL’s. Google and MSN don’t really like spaces, they rather preffer a dash(-).
It’s quite easy to implement this. Add the following line tot the encodeNameReplacements-node:
<replace mode=”on” find=” ” replaceWith=”-” />

This one is free, for others optimalisations, you have to contact and pay Ruben and Ulco :P.

Update: Just got a reply in my email of Jakob Christensen:

Hi Alex

Fantastic!!!

I can’t see any reason why we shouldn’t put this in 5.3.

Thanks a lot!

–Jakob

Update 2: Just got another email of Jakob, it will not be implemented in Sitecore 5.3:

Hi Alex

I just put the line in the web.config and it completely destroyed the Sitecore Client. I don’t really have a clue why, but I don’t we have the time to find out why before 5.3.

So unfortunately it won’t be in 5.3

Sorry.

–Jakob

Too bad, hope Jakob finds out what’s killing it. I’ll check it out when the first dist of Sitecore 5.3 will arrive.

Sitecore and FxCop

Just started playing with FxCop and decided to create a Sitecore-Ruleset. For the people wo don’t know what FxCop actually is:
FxCop is an open source tool which makes it possible for people to analyse their code with a single click. FxCop checks your code on the most vulnabilities and the .NET Code Guidelines. A possible error generated by FxCop:

CriticalError, Certainty 95, for AssembliesShouldHaveValidStrongNames
{
Target : lectric.intranet.layouts.dll (IntrospectionTargetModule)
Resolution : “Sign ‘LECTRIC.Intranet.Layouts’ with a strong
name key.”
Help : http://www.gotdotnet.com/team/fxcop/docs/rules.aspx?version=1.35&url=/Design/AssembliesShouldHaveValidStrongNames.html (String)
Category : Microsoft.Design (String)
CheckId : CA2210 (String)
RuleFile : Design Rules (String)
Info : “Either the assembly has no strong name, an invalid
one, or the strong name is valid only because of the
computer configuration. The assembly should not be
deployed in this state. The most common causes of this
are: 1) The assembly’s contents were modified after
it was signed. 2) The signing process failed. 3) The
assembly was delay-signed. 4) A registry key existed
that allowed the check to pass (where it would not
have otherwise).”
Created : 14-5-2006 13:43:41 (DateTime)
LastSeen : 14-5-2006 14:02:56 (DateTime)
Status : Active (MessageStatus)
Fix Category : NonBreaking (FixCategories)
}

You can easily configure which rules should be used and which ones shouldn’t. For example, there are some rules about CLSCompliancy. Those are more interesting when you are creating Frameworks and not so interesting when you create solution based on Frameworks. Altough it shouldn’t be bad to leave all rules on, and look if everything passes the strict rules of FxCop.

FxCop default rules
FxCop default rules

I looked in the manual and found out that it isn’t so hard to write your own rules :)! So next weekend ;), I’m going to look how to create Sitecore rules. The week afterwards, Í’m going to start with a new project, so my goal will be to complete that project without FxCop warnings :P. Keep you guys informed.

Dividing Content and Navigation Structure

Been thinking about dividing content, navigation structures, webediting, etc. for 3 days now. What’s the issue? Well the following thing: Most of our customers definitelly want high advanced news section for example. An easy way to solve this is to create a big storage-house with ‘News-items’ divided in folders which they can create by their own(retrieving them using Sitecore XPath). So no matter how the structure of the folders are, we just create some sublayouts and show the news of this week, last week, last month, pages archives, etc. Some problems, we also have to show the news details and content has to be shared between the internet and intranet environments… What are you going to do with the nice urls? 90% of the time you are going to use something like this: http://intranet.lectric.nl/news/newsdetail.aspx?id={23456789023456789056789}. In an intranet this isn’t so bad at all. Search engines like Google will not spider the pages and you can explain it to the audience easy. But what happend when you do the same on the internet site. Right, URLs are still ugly, Search Engine optimalisation(hot item, these days) will be harder, etc.

The solution isn’t so hard. Altough I’ve to work it out, it shouldn’t be so hard.
You have to create 3 nodes:
– Internet
– Intranet
– Shared Content

Then you just have to use the __Alias__Proxy-template and create two of them pointing to the Shared Content-node in the Internet and Intranet Node. Now you’ve got your content available on both websites. Last thing you have to do is setting up security.
Make sure you’ve got for both websites it’s own domain configured in the web.config(Example: Internet uses the domain ‘Extranet’ and Internet uses the domain ‘Intranet’). Give the items in ‘Shared Content’ the right security on both domains on the everyone role.

Very last thing: Having problems now with the layouts? You can easily solve this using different devices for Intranet and Internet.

Et voìla!(That’s French ;)) Now we are sharing content without any problems and it’s secure too!
My battery is low, so for any questions, just react. I’ll test this solution very soon and come back with results, in theory it should work!

Updated: The Alias definitelly should be ‘Proxy’. Happy weekend!

Content Editor Training, The Eve After

Well, wasn’t so bad afterall :). Did my job and everybody was happy.
Now.. How to do this in a way everybody starts from zero and everybody can do the basics in Sitecore at the end of the course.

Requirements:
– Classroom with for every 2 students 1 computer
– Beamer
– Working demo-site
– Working site of the customer

Basic Editor training:
1. Introduce yourself (see the Sitecore Training Materials for Developers and Administrators)
2. Introduce the students: Names(write them down!), jobtitle, relation to the site/intranet and experience with software(like (Star/Open/Microsoft)Office, Lotus, WP, etc).
3. Introduction to ‘What’s content’. Examples, etc, why you want to create some structure in your content. Why is it usefull?
4. Introduction about Content Management in the Web-world. Show some names(Open Text, Tridion, MediaSurface, SmartSite, etc). Explain what kind of companies do use them.
5. Explain why a CMS isn’t a Document Management System, but can include it.
6. Based on the file structure in the ‘My Documents’-folder, you can easily explain what’s a tree-structure, like Sitecore has.
7. Ask your students what they now expect from Sitecore, the system they are going to work with. You can just figure out in a second if there are any questions left.

Small break.

8. Show the client, loging in into the desktop, etc. Show them what Sitecore can be in a rush. Show everything, so they got more information then they can ever store in their grey brains(changing desktop, changing UserIcon, name, etc).
9. Then just show the content editor, create a simple item and let them do it.
10. Give your students the oppotunity to play with the HTML-editor
11. Publish their changes and show them to them
12. Walk trough the options of the HTML-editor(like Word-cleanup, etc)
14. Explain the way the Content Editor is designed, where to navigate(will change in 5.3). It will be good to give them a grid with the right names just on a paper(treecrumb, etc).
15. Give the oppotunity to explore the Content Editor, deifferent viewers, etc
16. Show the Media Library, upload a picture, let them do it and insert in the pages which are created before

Break.

You can show the Webediting now, altough, if you have a structure which includes both content as the site navigation(50% of the cases, I’ve seen, good one to write an article about ;)).
After it, you can show the custom templates and applications you’ve made for this production.
Going to create some slides for this and finetune it a bit. Definitelly think I’m on the good way as I’ve seen the reactions this morning.

Content Editor Training

Finally back from vacation. Definitelly had a good time! Have been in the beautifull landscape of Val Thorens. A place where you can ski and snowboard till half may. It brought some rest and lot of inspiration to start working on lots of new stuff. Hoped to see an announcement about the first beta stage of 5.3, but guess that I’ve to wait a month or longer :P…


Alex down in the snow 🙂

Tomorrow, my first day back at the office, I have to train 8 people of an Intranet we are currently developing based on Sitecore. I’ve to instruct these guys how to work with Sitecore. At the moment we’ve some metarials but notthing like a real training/program. Tomorrow at the end of the day I definitelly hope I’ve the idea how to instruct this kind of audience in the feature.

My idea for tomorrow:
– Introduction of myself
– Introduction of the people in front of me
– Introduction to ‘Content Management’
– Sitecore, what is, what should, what’s the difference between what they expect…
– Content Editing, creating items, masters, templates, etc
– Custom Development(imports, exports)
Afternoon:
Webmaster training… How to create, manage roles, users, etc.(Kind of Administrator training but a bit of less heavy).

Tomorrow more!