Thursday, February 9, 2012

Sitecore Fetch Squad

Automated crawler fetching websites and blogs from Sitecore content

Archive for February, 2009

What Experian says about Sitecore

Posted by admin On February - 18 - 2009

It’s always good to hear what customers have to say about Sitecore, especially, when it’s something like this…

The speaker highlights a very important fact about how Sitecore’s CMS solution is developed: We use customer and partner input to create what the market needs. So if you are a Sitecore customer or partner and you’d like to see certain features included in upcoming versions, contact your local Sitecore office and they will forward all your thoughts to the product management team.

Philipp Heltewig

Stockholm syndrome 2.0

Posted by admin On February - 18 - 2009
I recently completed 2 days of certification training in Stockholm. This was actually my first time instructing a developer course on my own. Remember I got certified as an instructor back in November. To start of with the hard facts, all the attendees passed the certification exam. Well done guys!   The training facilities in Kista (Stockholm’s equivalent to Silicon Valley apparently) was

Sitecore on the road

Code reviews on Sitecore

Posted by admin On February - 18 - 2009

Thomas Eldblom and I are reviewing most of the projects, we do in Pentia. The most of the things we comment on concerns C#, architecture, HTML, XSL or other general technologies, but some issues are related to the use of Sitecore. In this post I want to share the most common, most severe or most irritating issues/pitfalls I often stumble upon or look for, when doing a code review. I am glad to say, that I almost never stumble upon the most basic things, such as layouts specified directly on items, masters set on masters (SC5) etc.

·         Use of Sitecore.Context in logic

When having actual classes or general logic, I sometimes find a reference to the Sitecore.Context. Often it is a reference to Sitecore.Context.Item or Sitecore.Context.Database. This is rarely a good idea. The logic should be independent of the context it runs in. Instead you should pass in the objects you need as parameters. If you don’t do this, you’ll bind your logic to a certain context, making it unusable, if you want to use it without a context. Further logic that uses the context isn’t very testable.

 

·         Iterating over to many items

I don’t find this sort of issue very often, but it is pretty severe. The scenario is often that you have a list of all latest documents or a similar relational operation. You implement a simple XSL using “//item”. This works fine in development, but when the client starts importing or creating several thousand documents, the list doesn’t perform and brings the whole site down.

 

·         Too much logic in an XSL

Often you start out with a page type, which looks like a simple rendering. Therefore you start out creating an XSL. As you dig into the specs, you find out, that you need a lot of logic. You end up with a large amount of XSL extensions and a complex rendering. The result is a way to complex XSL, which is practically unreadable and impossible to maintain. When you have a lot of logic use a sublayout.

 

·         Reference to specific databases

Sometimes I find a reference to a specific database. For instance something like Sitecore.Configuration.Factory.GetDatabase(‘web’). Allthough it may be needed in some situations, it often gives some unintended sideeffects. Most of the time you want to operate on the context database, so you use the correct database specified in the site section in the web.config. A direct reference to the web database might cause preview functionality not to work as intended, and a direct reference to the master database might not work if you are using a staged environment.

 

·         Null reference

As Sitecore is so type weak and everything is an item, you don’t know what fields/properties the item has. No matter how experienced the developer is, I often find the use of a field of some sort, where it hasn’t been validated whether the field is null or not, resulting in a null reference exception if the input is incorrect.

 

·         Overriding standard Sitecore functionality

Sometimes a developer isn’t satisfied with the way Sitecore implements something – for instance the indexing, the site resolver, the domain etc. As Sitecore allows you to override almost everything, the developer thinks… Hey, I’ll just override the domain doing my own implementation. Although this might be necessary, it should be considered carefully. I have too many times stumbled into a problem with a custom implementation of standard functionality, either because it may be more complex than first assumed, the next developer on the project isn’t aware of it or last but not least an upgrade of Sitecore changes the requirements to the functionality.

 

I am hoping you want to share some of your experiences as well – telling what Sitecore pitfalls you often stumble upon or find very irritating.

Molten Core

The Sitecore browser-based debugger by default opens the home page of the published Web site using the publishing target database (Web). If you want to debug another page, you can navigate to that page, or enter its URL. If you want to debug in another database, you can add the sc_database query string parameter. Or you can add a command to the Content Editor ribbon to debug the selected item in the selected database:

  1. Compile the class into your project.
  2. Update the type attribute of the /configuration/command element in /App_Config/commands.config with name system:debug to reference this class and the assembly that contains it. Remember to hide all files again after adding this file to the Visual Studio project, or debugging in Visual Studio will hang.
  3. In the Sitecore Desktop, use the database selection icon to select the Core database.
  4. In the Core database, open the Content Editor and duplicate the /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Publish/Preview item as an item named Debug (or if you prefer the Debug command on the Reviewing tab instead of the Publish tab, duplicate /sitecore/content/Applications/Content Editor/Ribbons/Chunks/Proofing/Spellcheck as Debug).
  5. In the Data section of the new Debug item, set Header to Debug, Icon to Software/16×16/debug_run.png, Click to system:debug, and Tooltip to Start the debugger.
  6. In the Sitecore Desktop, be sure to use the database selection icon to select the Master database.
  7. Open the Content Editor, navigate to any item with layout details, click the Publish tab, and then in the Publish group, click the Debug command (or on the Review tab in the Proofing group).

After step 2, the default Debug command on the Sitecore menu will take you to the Master database instead of the publishing target database (Web).

You can download the code from http://resources.thedotnetcms.com/sitecorejohn/debug.zip.

John West Blogs about Sitecore

When Will Sitecore Adopt ASP.NET MVC?

Posted by admin On February - 3 - 2009

I followed the ASP.NET MVC development since it first appearance on the ALT.NET conference in the end of 2007 and as you can see from various posts, I’m a big fan of it (ASP.NET Web Development – some thoughts… -and- A Conceptual Alignment of Sitecore, ASP.NET WebForms, ASP.NET MVC and the Microsoft AJAX Client-side Library). From an architectural point of view as well as from a lead developer point of view, MVC is and has always been the best server-side pattern for web applications (and as long-standing Java EE and Rails developer I’m allowed to say that). In combination with event-driven GUI frameworks on the client side like ASP.NET AJAX, JQuery and Silverlight it should always be the first choice for every serious web developer in 2009. It is also an important building block of our Reference Application Architecture and Microsofts Application Architecture Guidance 2.0, especially in combination with WCF.

The question is now: When will Sitecore finally adopt ASP.NET MVC as supported framework? Clearly there is no doubt that the development model of ASP.NET MVC and Sitecore are even closer aligned than the development model of ASP.NET WebForms and Sitecore and that there are enormous synergistic effects by integrating both frameworks. This is true for various parts of the system, especially routing and rendering (where XSLT was – beside other reasons – chosen because "inline code" was a bad thing back than). I personally expect not only basic support for ASP.NET MVC but even a complete switch to use it as primary base framework instead of ASP.NET WebForms over the next couple of months, maybe a year.

Julius Ganns . netzkern

Sitecore and SSL

Posted by admin On February - 3 - 2009

As a Solution Architect in Sitecore you often get request ‘howto do SSL in Sitecore’. Beside of our great Shared Source SSL module, you’ve to do something on configuring the network/OS level to register the certificate.

So what’s the general idea of SSL? You want to have certain pages to execute over an encrypted connection. The most feasible solution is SSL which encrypts the data by default using a 128bit encryption. Still pretty strong these days, although I won’t be surprised if we move to 256bit somewhere in 2010. There are several traditional vendors who deliver certificates. In the Netherlands for example KPN. All register their certificates at VeriSign, a party who does take care of the strength of the encryption and the validation of newly created certificates.

Afterwards you’ve to integrate it into Sitecore. A very simple solution is to decide per item if you want to run the constructed page on SSL or not. The Shared Source component takes care of that part.

Now the infrastructure / OS ‘issue’. It seems for a several reasons that running certificates on the web application software(IIS) is very expensive. Combining encryption with page rendering is always possible in every internet server(Apache, Tomcat, IIS, etc), but all have significant disadvantages when it comes to delivery.

I often suggest to rather use a network based solution. These days’ routers, load balancers and switches have the possibility to handle https/ssl for you. As these machines are designed for passing TCP/IP packages thru, they can easily encrypt them. Beside of that, when you run into out scaling scenarios, you don’t have to manage your certificates on multiple places.

Here’s a simple diagram:

SSL Executor

In this case the SSL Executor is a Reversed Proxy, but it can also be a firewall or other network interface.

Hope this helped. :)

Note: This is a post written out of my experience as an architect in many projects. I’m involved in general in Sitecore projects, but rarely I’ve got the opportunity to ‘work’ a little outside of this boxed environment. Often these high level problems arise in project where Sitecore is involved but also in other projects. It’s never my intention to blame a vendor, although I might point out some weaknesses.

.Sitecore

Microsoft: Maybe the solution for a lot of your problems?

Posted by admin On February - 3 - 2009

Figured just out that when starting programs in my newly installed Windows 7 installation, I’m always searching for the name of the program. For those who are not familiar with ‘searching in the startmenu’, please have a look at the screenshot below and look particularly at the search box.

windows-7-start-menu

When I search for ‘Internet Explorer’ I’ll get my standard browser: IE. Searching for ‘Mozilla’ will return the browser I use for mail and feed reading(all Google).

Why am I searching for Internet Explorer or Mozilla, why not for ‘Browser’ or ‘Internet’? I can depend on the icon what to choose. It will safe me a bunch of irrelevant names to remember, but more important, it more intuitive. It will also get the discussion away from what kind of browser you’re using. Create a simple dialog which allows you to download a couple of browsers associated to it. It is more logical and less vendor specific. I think it will be the solution for the discussion bundling IE with Windows as well…

.Sitecore

Versions are dublicated and have the same version number

Posted by admin On February - 3 - 2009

Hey guys,

at the moment I’m facing a really strange and annoying issue using versions in Sitecore 6.

Version numbersIf you want to add a second version to an item, how do you do this? You go to the version tab and click “Add”, right? Yes! (Of course there are other ways,….) Unfortunately you get more than you want to have. In my case you have a new version called “2? – but two times (!). Check the screenshot.

If you look into the database directly by using a select statement:

SELECT * FROM dbo.VersionedFields

You will get the hint that the two version don’t have the same values in every field. The language field says “de-de” for a couple of items and de-DE for other ones.

After creating a support case at the official Sitecore Support we got the solution by converting the different values to the same by using the sql statement:

UPDATE dbo.VersionedFields
SET Language=’de-DE’
WHERE Language=’de-de’ COLLATE Latin1_General_BIN

… a couple of days later ….

We have the same issue again! Annoying!

The facts:

  • It cannot be a displaying bug, because:
    • I directly triggered the sqlDataApi to get the versions => 3 versions / 2 version numbers
    • I checked the sql table directly and got the versions
  • I switched the Sitecore Installation to a new and clean installation and just connected the corrupted databases => Same issue
  • I disabled the Cache.GetVersions() method (by stepping directly in it) => same result.
  • I created a new version programatically and have the same result

After the Sitecore Support searched my web.config, they pointed me to my sites config and that the language parameter got the value “de-de” (it has to be “de-DE”), but this cannot be as well. We have been working with that Config from the beginning (approx. Aug 08), but we first experienced this in Dec 08.

So, what did we changed? At the moment I’m not looking at software updates (not yet!) – I remembered that we set up the PublishAgent in the web.config with that configuration:

<agent type=”Sitecore.Tasks.PublishAgent” method=”Run” interval=”02:00:00″>
 <param desc=”source database”>master</param>
 <param desc=”target database”>web</param>
 <param desc=”mode (full or incremental)”>incremental</param>
 <param desc=”languages”>de-de</param>
</agent>

Could that corrupt our database? I’m not sure, because after solving the problem by using the sql update statement and changing the auto publish to 2 minutes I cannot reproduce this issue locally.

Okay guys, if any one have some hints just give me a buzz. I’m still trying to reproduce and solve it forever!

cheers chris