3 Things I Learned This Week (2015-01-02)

Happy New Year!

Top Posts of 2014

Lots of people are recapping the most visited pages of 2014, so here’s mine.

Using SASS With Visual Studio 2013 Essentials - Apparently its not altogether obvious how to get SASS compilation with Visual Studio. Lots of people came here from StackOverflow and google looking for answers.

Saving Changes with Entity Framework 6 is ASP.NET MVC 5 I was following a tutorial and got briefly stuck on why an update action wasn’t saving the changes back to the DB. Elaborating on the Unit of Work pattern provides clarity.

Multiple Angular Versions On The Same Page - At work we had an app that was using angular but also included a plugin that itself was using angular, although a different version. I had to isolate my angular application from the plugin. Thought not perfect, my solution did solve my immediate issue, and a few others have found it helpful as well.

Export a Global to the Window Object with Browserify - Browserify wraps all your code up in closures, but what happens when you need to export some objects for other scripts to access?

app.UseGoogleAuthentication() Does Not Accept 2 Arguments Azure Tutorial - When following an older tutorial on identity management for azure, the sample code included a line that no longer compiles. Took me awhile to figure out what the new arguments were.

Meeting Minutes are Actually Useful

I’ve started taking better meeting notes and emailing them to participants and those that couldn’t make the meeting. Keeping them in Google Docs makes them easily searchable and shareable. Its nice to have them all in one place and to be able to specifically call out TODO items that were decided on. Makes it easy to follow up and make sure people are doing what they said they would do.

Inject a custom handler into Sitecore processing

Needed to inject a global handler into a Sitecore app that could check the status of something and perform a redirect if necessary. Sitecore uses a processing pipeline behind the scenes and its pretty easy to inject a custom processor into it.

In my case, I was adding it to the httpRequestBegin pipeline, so I created a class that has a public void Process(HttpRequestArgs) method. Then I just needed to configure the class as part of the pipeline in sitecore.config.

~/MyApp.Web/Pipelines/Redirector.cs
namespace MyApp.Web { public class Redirector { public void Process(HttpRequestArgs args) { var status = GetTheStatusOfThings(); if (status == Statuses.RedirectNeeded) { args.Context.Response.Redirect(RedirectUrl); args.AbortPipeline(); } } } }
Sitecore.config
... <processor type="MyApp.Web.Pipelines.Redirector, MyApp.Web"/> ...

Note: MyApp.Web is the name of the DLL generated when I compile the MVC project.