Ben's Adventures in Code

Posts


Tips and Tricks: Git Check-Ignore

Published at July 25, 2017 ·  1 min read

Have you ever found yourself wondering “why in the world is git ignoring this file!?” Have you spent countless minutes combing over every line of a .gitignore to try to determine what obscure rule is preventing your file from being committed? I have something that can help! It’s called git check-ignore and it will CHANGE. YOUR. LIFE! (your results may vary)If you haven’t heard about the git check-ignore command, you’re missing out on an underappreciated git command....

Get to Know a Pipeline: GetMediaCreatorOptions

Published at May 31, 2017 ·  2 min read

Background I was building a feature the other day that involved overriding something in the Sitecore file watcher. I needed to set some custom behavior in the MediaCreator to watch for a specific file being dropped into the /upload folder. Small disclaimer: I ultimately didn’t end up using this at all, but I still learned a bit about a pipeline that I thought was kinda neat. Discovery The file watcher calls MediaCreator's FileCreated method at some point in the process....

What Helix is NOT

Published at March 31, 2017 ·  3 min read

Last week I had the pleasure of attending a workshop on Helix, presented by Derek Correia. The mindset I had going into this was “I’ve seen the presentations, I’ve been working with Helix a bit, this will be nothing new.” I was pleasantly surprised to be wrong. If you’re not already aware, Helix is Sitecore’s recommended set of design principles. You can see a live example of Helix by checking out the Habitat demo....

Octopus: Build Once, Deploy Many

Published at February 20, 2017 ·  4 min read

The Problem I had to setup a production environment for a client who had a development environment, a QA CM, two QA CD’s, a production CM, and 2 production CD’s. These machines are behind all sorts of firewalls and on different subnets. The normal robocopy procedure wouldn’t have been easy. On top of that, the build in Jenkins takes about 10 minutes to complete. Simple math: 10 minutes x 7 targets = 70 minutes....

Link Description Length Validator

Published at September 30, 2016 ·  4 min read

Today’s adventure is about custom validators. A feature I’m working on has a requirement that a link’s description must be no longer than 60 characters. I decided to look at the field validators that Sitecore comes with. The closest one I could find was the “Max Length 40” validator located at: /sitecore/system/Settings/Validation Rules/Field Rules/Sample/Max Length 40 I setup a template and slapped that validator onto the general link field and, as I expected, it didn’t work right:...

Upgrading Sitecore 6.6 to .NET 4.5

Published at July 3, 2016 ·  2 min read

Last week I had to update a Sitecore 6.6 site to .NET 4.5. The upgrade went just fine. After it was done, I flipped through the pages on the front end and everything looked fine. Next, I tried Sitecore to make sure everything was working. I clicked around the content editor for a good 15 minutes. Everything looked fine. Since I was already logged in due to the “remember me” feature, I didn’t notice at first that the login page was broken....

Automatically Resolving Home Item on an API Controller with Multiple Sites

Published at June 20, 2016 ·  2 min read

I was writing a method in a Web Api controller that was supposed to get data from a field. For now, let’s call the field “MicroSite Name”. To do so, I wrote a method that could be simplified down to this: [HttpGet] public string GetMicroSiteName() { return _sitecoreService.GetHomeItem<ISite2HomeItem>().Settings.MicroSiteName; } When I called that method from the front-end, I received a Null Reference Exception. Confused by this, I dug into it a bit further....

Sitecore Tips and Tricks: The Gutter

Published at May 30, 2016 ·  2 min read

Sitecore’s content editor has a handy feature called the gutter. The gutter shows up on the left hand side of the content editor, and is a great way of showing information about a content item at a glance. Some handy things it can show you: Item Buckets Cloned Items Personalizations Multivariant Tests My Locked Items Locked Items Workflow State Broken Links Missing Versions Publishing Warnings Presentation Overridden Let’s take a quick look at a gutter: example of a gutter...

Custom Product Sync Button

Published at April 3, 2016 ·  5 min read

Today’s adventure is about custom ribbon buttons, asynchronous commands, and progress dialogs. One of my recent projects deals with a 3rd party integration with a PIM (Product Information Management) system and Sitecore. This is not a very heavy integration. The PIM is the system of authority when it comes to a product’s description, price, color options, sizes, etc. Sitecore obtains this information via a REST API provided by the PIM. This information is fetched and transformed into Sitecore items, which we then store in a bucketed “Products” folder....

Sitecore 8 Package Installer over HTTPS

Published at February 28, 2016 ·  3 min read

Last week I was performing a deployment to our QA environment when I came across something odd. I was performing a routine content package install to Sitecore and all of the sudden I see “installation failed.” This particular package had been installed on 3 environments prior to QA, so I was confused. I dug into the logs to see if I could see the problem: ManagedPoolThread #18 14:24:01 INFO Job started: Install ManagedPoolThread #18 14:24:01 INFO Installing package: E:\inetpub\wwwroot\qa\web\Data\packages\normal-content-package....