Tuesday, May 26, 2015

Control with no placeholder listed still renders on the page


Do not be alarmed! Even though I was when I started working on a bug for a client and looked at the Presentation Details on a Sitecore item that had a control with no placeholder. But when I took the control off the page content was gone. Conclusion was obvious - it was THAT very control that made certain things happen on the page. But how was it "attached" if there is no placeholder it goes into?





It was actually listed in the Placeholder field in the Data section on the sublayout item itself.



This is convenient and dangerous at the same time. Convenient because anywhere this control is used it would "know" to be placed in the same placeholder. Dangerous because you might intend to use a different placeholder but the same control in various places on the site.

Monday, May 18, 2015

Extra html tags breaking the page in WFFM 2.3

We all pay attention to a little red asterisk that means "field is required". But once in a while when the form is large or you are not paying attention it takes a couple of attempts to fill everything out correctly. And that's when the page breaks if you are filling out a checkbox list field on a WFFM form.

Suppose I have a form similar to this:


If I pick at least one option under Sample Options checkboxlist and leave of the required fields blank (i.e.City) and click Submit I would get a typical "required field" error. But if I click Submit again and leave any required field blank one more time I get the following exception:


This happens due to the code in Sitecore.Form.Web.UI.Controls.ListControl class inside assembly Sitecore.Forms.Custom, Version=2.3.0.0.


I made a custom class that overwrites the ListControl and doesn't have those tags in it. And the CheckboxList, also a custom one, inherits from it. This bug is fixed in the next version of WFFM (2.4).

Tuesday, April 28, 2015

Naming things right. Sitecore MVC with Glass.

I  have recently encountered a problem with Glass RenderLink method. Idea was simple. I had a template with a General Link field which I intended to render in a View. But the method did not work. No exceptions thrown, simply no rendering happening. After some digging around I noticed that in the codegen Glass file, in the interface that inherits from IGlassBase, the type of the field was incorrect. Instead of being


I was a custom project-specific one, name exactly what the template was named - "Link"


This template name "Link" is what caused the problem. Being so generic it caused Glass to assume it was a project custom type. Once the template was renamed (name should not be so generic) the field type was correct and the RenderLink method worked fine.


Monday, February 9, 2015

Opening PDF files on Windows 8.1


For some unknown reason I was having a hard time opening PDF files on my machine (Windows 8.1).




I updated the Reader, I restarted my machine - in other words tried all the simple things that would come to mind. After some googling around I found out that there is a service that needs to be running to make that happen - Remote Procedure Call (RPC) locator. It should be listed as manual and it should be running. Mine wasn't. Turned it on. Problem solved.



I am not fully sure how RPC is related to PDF's but it is possible that there are issues with application compatibility.

Saturday, January 3, 2015

THINK BIG Sitecore 8 Mongo DB.

The time has come to start experimenting with Sitecore 8 and its powerful Analytics. Download is available here: https://dev.sitecore.net/en/Downloads/Sitecore_Experience_Platform/8_0/Sitecore_Experience_Platform_8_0.aspx

Since I chose to use SIM to install it I had to rename the zip file to "sitecore 8.0 rev. 141212"

I was particularly interested in Experience Profile where I can obtain a wealth of information about a specific visitor: their goals met, their score, value per visit, pages visited, etc, etc, etc. My assumption was that there would be some out of the box visitor information, at least a list of visitors. But the list was blank. The problem was that to use any Sitecore analytics I had to wire up the Mongo DB first.

Instructions I followed came from


There was a problem I encountered with installation.




Because I was only testing it on my local environment I could skip several steps in the process, such as moving the Mongo DB folder to another location or setting it up as a service. Setting up as a service allows automatic start of the Mongo DB when I power up my machine. But if you don't mind manually running the exe file then it's not an issue. The connection strings were set up automatically which was a bonus. 

The next step was to install MongoVue (http://www.mongovue.com/) It allows visualization into the database after you add a connection. 


I set a simple goal (home page visit event) and went to the site in the browser. The next step is going to Sitecore dashboard and click on Experience Profile. From there you can navigate to any visitor (provided there are some).



The overview tab on a visitor detail page is where achieved goals are listed (under Latest Events). 



One more thing. I needed set the session timeout to 1 min instead of the default 20 minutes in the web config file. Otherwise I'd have to wait for 20 minutes for analytics data to be reflected in the profile. 

<sesstionState mode="InProc" cookieless="false" timeout="1">

Tuesday, December 2, 2014

Let's "dotStep" into their code


I've used dotPeek for a while to look at source code of third party decompiled assemblies but this time I decided to experiment with actually stepping into their code. There are numerous resources out there, such as

https://confluence.jetbrains.com/display/NETCOM/dotPeek+Symbol+Server+and+PDB+Generation
http://msdn.microsoft.com/en-us/library/ms241613.aspx

and many others. Setting up Visual Studio options is straightforward until you feel you know enough to change things a bit. That's what I did and that's what caused me some trouble. BUT by going through that helped me understand the process better.



In the above diagram there are two paths: one for symbols cache directory in Visual Studio Tools > Options > Debug and the other in dotPeek. They have to match. The other crucial moment is if you choose Automatically Load symbols for "only specified modules" you have to make sure you spell the dll's name correctly. In the example above it is the Sitecore kernel and it has to contain the extension (.dll).

Many blogs omit describing the step of actually setting a breakpoint in decompiled source code. You can see it in the above image (notes in blue). Debug > New Breakpoint > Break and function and then type in the method name with the namespace and class (for example: Sitecore.Security.Accounts.IsAuthenticated). And hit F5. The process takes a while even if you have only Specified assemblies checked in VS and same in dotPeek. Patience better be your main virtue...and vuala - you get your breakpoint hit! Congratulations! You can now verify that's it's not YOUR code that breaks everything. it's THEIRS, you know what I mean? ;) Enjoy!


Wednesday, November 5, 2014

A little birdie told (tweeted) me

Out of the box Social Connected module has 5 social networks you can use: Facebook, LinkedIn, Google, Twitter and Social Marketer. I am not familiar with the fifth one so I decided to experiment with the first 4. Here is the summary of my success/failures/findings.

Facebook. Login was straightforward to implement out of the box. See my earlier blog for details. Posting goal messages to a FB timeline is not available unless publish_actions permission is requested by the app. In order to obtain this one has to submit the app for approval and that involves completing more steps than I wanted to because the main advantages of the Social module are:

1. Easy registration process
2. Obtaining wealth of personal information from Facebook for personalization on the site

I have those two at my disposal and decided to stop right there.

Twitter. Did not get the Login to work. I suspect (have not confirmed yet) that it's related to fact that the url is local. See notes on Google several lines down. I  have a feeling they are related.

LinkedIn. Login functionality was a snap. Getting personal data. Nice and easy.

Google does not allow local urls for login. Rules are rules. Nothing I can do.