Posts

Showing posts from 2013

Using Sitecore.Logging to send emails

BACKGROUND In this post I will show you how to send an email using the Sitecore.Logging namespace. If you want to get straight to the code here you go ! PROBLEM WE NEED TO SOLVE Do you need to send emails when something happens in your Sitecore website?  For example, if you get a critical error and want to email this to a distribution list?       Using Sitecore.Diagnostics you can log this error to the Sitecore log, but you still need that email sent to get someone working on the issue asap! Many solutions exist to fit this need.  You can use System.Net, you can use nLog or a plethora of other logging systems. But why not use what you already have with Sitecore?    Sitecore went ahead and wrapped up the log4net code inside their own dll,  Sitecore.Logging.dll.    You can use your favorite .NET decompiler to look at the code.    I use Telerik's Just Decompile to look under the hood of the Sitecore.Logging.dll.   Remember, adding another dll to the application domain take

Conditional caching components in Sitecore MVC

Image
I'm writing this post to help remember why I chose a particular solution and to hopefully help anyone else in the same scenario. I will start off by stating the problem I needed to solve, a couple options I reviewed and why I chose a particular solution.  We are using Sitecore 7.0 and since Sitecore 7.0 requires ASP.NET MVC 3 we are using ASP.NET MVC 3.   We are also using Glass Mapper and love it :-). PROBLEM:    Users came to me with a late requirement.  They want the ability to add renderings above and below an items content.   The renderings they want must access the database each time they are rendered to show accurate data. How can we efficiently handle this situation without making major changes to the current design? BACKGROUND:    Our items are made from a template that has four sections.  (Other sections exist but for this discussion these sections are the only ones relevant).   Each section consists of the following fields,  Content ,  Active  and  Style .

I'm in love with MODx

BACKGROUND By day I am a .NET developer writing C# windows and web applications.    I very much enjoy the .NET space.    My professional experience with a CMS tool has been with Sitecore.  I have the certifications and scars to prove my expertise :-).    I am impressed with how Sitecore works and how it works for my company. By night I do websites for small businesses helping them achieve a web presence with limited budgets.  Enter the open source space. I have created sites in Joomla, Wordpress and Wild Apricot CMS tools.   I have played with Umbraco as well but most small businesses already have a hosting presence and it is on a linux host.   That closes the door to the .NET space.   No worries, I enjoy working with all technologies. DRUPAL IS EASY, FUN, PRODUCTIVE? I recently started working on a simple site for a client.   They had approximately 15 pages of static html to put into a CMS tool. The layout of each page was a simple two column layout, where the width

Our Git workflow and Build Process - Part 2

Image
In a previous post I discussed our Git workflow.   In this post I am going to discuss how our build process works with our Git workflow. To recap here is our build process, Figure 1 Figure 1 As we work on features we are always in a feature branch.  So for example, web-11 is an actual feature branch that we completed.   So when we worked on web-11 we committed changes to it.   As we commit two git hooks come in to play. Here is a picture of the git hooks, Figure 2 Figure 2 These hooks are installed manually into the repositories hooks folder.   Both of these hooks are simple .NET 4.0 console applications.    To ensure that Git can call the hooks you need to remove the file extension (remove . exe ). commit-msg hook The commit-msg hook simply adds the name of the feature branch into the commit message.    I put the feature branch name at the end of the commit message in between pipe characters, just for easy parsing.  So |web-11| will be at the end of the commit

Our Git Workflow and Build Processes

Image
The purpose of this post is to document how my team is using Git.  I will discuss our Git workflow and how we use git hooks to streamline our build process.  We use Bamboo for our build processes and I will discuss how we automate our builds (including database code) using Bamboo and Git.    We develop with Microsoft tools, so just a caveat, although the workflow could apply to anyone, just wanted to give you a heads up in case you come from the world of linux and want to stop reading now :-). Standing on the shoulders of others First I want to give thanks and credit to a couple resources.  The following links were invaluable for me; This post over at nvie.com described a branching model that is close to ours. Understanding tracking and remote tracking branches was cleared up for me by this post over at gitguys.com Our Git workflow Here is a picture to get us started. Figure 1 feature branches We create a new feature branch for each issue we work.  So whet

Speeding up our website - My experiences with Sitecore

Have you ever ran YSlow or PageSpeed against your site and you get poor grades in the following categories Make fewer http requests Minify javascript and css Compress components with gzip. Our site got poor grades for these items and my initial response was who cares.  Bandwidth is almost unlimited anymore and we are conditioned to sites taking a few seconds to load. I had this who cares attitude until I started actually profiling our site and realizing that minimal changes could make a big difference in user experience.   Instead of our site taking 5 - 8 seconds to load it could take less than 5 seconds to load. Also, as a developer I typically never involve myself in the http request pipeline from the browser perspective.  I'm abstracted from that, especially being a .net developer, we are abstracted by many things.    But, making the site perform well from a browser perspective is just as important as making your code algorithms perform well.    Think about i