Posts

Showing posts with the label CodeYourWay

How to implement Cross-Site In-Session Sitecore Analytics

Image
I came across this weird scenario wherein we were migrating old legacy project coded in Vb.net into Sitecore. So during this process, we had to migrate in a prioritized manner which made difficult to share analytics across two different projects. So I have just noted down what I did in order to accomplish the same. Assume we have a scenario with two different projects which are utilized for same Website (Some pages in Sitecore and Some pages in any other framework ). Let's Assume Sitecore Project named as " CodeYourWaySitecore " and other project named as  " CodeYourWayLegacy " For  CodeYourWaySitecore  and  CodeYourWayLegacy  (“ CodeYourWayLegacy.demo.com ” and “ CodeYourWayLegacy.demo.com ”)  are hosted on different websites.   By default in session, analytics work for each individual site.  Identifying and merging contacts at the end of the session allows for post-session interactions(assuming the contacts have been identified) but does nothing to add

AngularJs -Effective way to Monitor Changes to Model data

Image
The two-way data binding in AngularJS is very powerful, especially when there is a direct mapping of input data to view-model-data. But, when the data mapping requires some translation, interpretation, or validation, you need to get your hands a little dirty - you need to get more involved in how data changes are propagated within your Controller(s). As this has happened to me, I've been forced to think more deeply about my AngularJS application architecture; and, as a result, I've found that my life is often simplified (in the long term) by calling a directive to watch before I bind the data to View model. Factory To Monitor Changes This is easiest and effective way because of these reasons : 1) I just need to call a Trigger Method with scope which should be monitored 2) Once the data is retrieved from Ajax call , I just Initialize the data 3) If there are any changes to bound data on the form and user tries to navigate to another page, I get Confirm box on the

C# 7.0 Potential Features – Local Functions

Image
Thoughts on C# 7.0 Local Functions. Potential Features - Local Functions Frankly, when I first tried this, I thought that it's just a nice and compact way of defining local helpers. In fact, it's much more interesting and useful feature. Today I'm going to explore and explain it in more details. Let's  start with a brief overview of the current situation. Before Local Functions Private methods The first option that existed in C# 1 is having a private method. That’s a clean and simple solution. It has few issues, though. PrintMe might have no sense outside of ThatTime method, but it’s accessible for every other method inside the class. It will be taken into account by IntelliSense. Func and Action We can try to hide our helper inside the scope of ThatTime method by converting it to Func<int, string>: Any disadvantages ?? Yep, a lot. The call is unnecessary expensive: it will produce  more all

Make it Easy by Angular-JS Directive to Format or Filter Date

Image
There is always a havoc on handling dates in the application either it's java /dot net or angular . So here is the best way I found in order to overcome the problem . Date Directive Here I am going to explain about angular date filtering concept and how to  use filtering concept to filter Date across your application.It is always better to create a date.js file for those filtering concept.  The advantage of this is you can very easily filter the data anywhere in your view by just placing directive. This can be achieved by using following code in your module defined, for example : CYW.date below. angular.module('CYW.date', []) .filter('stringToDate', function () { return function (input) { /// gets Date input, if not, returns null. Also sets the date to /// correct format if (!input) return null; var date = moment(input); return date.isValid() ? date.format('MM/DD/YYYY') : null; }; }