When does the cq:LiveSync property gets created? - aem

Am not facing any issue but asking for general understanding.
When does the mixinType cq:LiveSync gets created?
One my AEM site, MSM works fine and ALL live copy pages are set with cq:LiveRelationship mixinType as expected.
Some pages have cq:PropertyLiveSyncCancelled and corresponding cq:propertyInheritanceCancelled property tells which all properties are cancelled. Its clear cq:PropertyLiveSyncCancelled is set when someone cancels inheritance against a property.
But few pages have cq:LiveSync property set and many dont. Trying to understand what action sets this property? and what impact it has on MSM?

Related

How to set the Assigned To when state changes in VSTS/Azure DevOps

I have an inherited process from an Agile process. The base process had the following states New, Active, Resolved, Completed. I added several new states, so now it goes New, Triaged, Active, Development Dont, IT Testing Done, Resolved, Confirmed, Completed to better match how it flows through different people.
The process has some built in State change rules, so when it goes from New to Resolved or Active to Resolved the Assigned To changes back to the Created By person. Also when it goes from Resolved back to Active it switches the assigned to back to the Resolved By user. This works fine, the problem that I have is that these state change rules only happen for these specific states.
In VSTS online I have setup some custom rules to do different things as it moves between different states, but what I can't find a way to do is to set the Assigned To field to some other person field on the Work Item. I can set it to a hard coded person, but that is not what I want. I want to do the same state change rules that already exist for the built in states on my new states.
Here is an example of some of the rules that I have set, but I cannot find a way to set the Assigned to field to another field, i.e. Created By or Resolved By.
Use the copy value from to assign the value of one field to another:
I've just been doing a similar thing and found there's also an action setting to 'Use the current user to set the value of...'
Example of this below:

MVC Default Edit View increments the id property of my model? Can't figure out why. .

I'm trying to learn web development, and I bet that this is a simple problem and that I'm overlooking something obvious.
In my default crud edit controller (generated using the MVC framework) I retrieve my model from a localDB instance using my EntityFramework's dbContext. That is sent to the View. In the debugger just before the controller call to return View(model) I can see that the Id is set to 2.
When the [post] edit controller is fired I see that the identity property is 3. I wanted to figure out why so I changed the View to display my Id property and I see that it is 3 as soon as I render the page. Last time I saw it the property was 2, now it is 3.
I don't know how to hook into any logic that would happen between the time I send off my model and when when the view is rendered.
Can anyone help me learn how to debug this so that I can figure out why my Id property is incremented when I pass the model into the view?
I don't know how EntityFramework works but I have worked with CakePHP. My advice is like this:
Usually PHP frameworks have debug mode which you can set in the configuration file (turn it on or off). Usually stack of operation executed is also displayed in debug mode or there is a simple way to do that. There's also for example in CakePHP exist function debug($yourVariable); try to search for sth. similar
It seams like not the edit happens but new row is inserted to the database. Check your database for this. I recommend to debug the id of the column being passed for edit action and check if there's the same id in the database first of all.
Hope something helps.
I figured it out. Posting here for anyone else that comes across my problem.
I tried dumping the whole model out without using any of the htmlhelper methods. (In my case I am uinging: Html.HiddenFor helper) When I did this I saw that the value in the model was what I expected it to be. So I began investigating why the helper methods might be broken. Google worked for me here :)
Turns out, when the helper methods run they first check the ModelState dictionary for the desired value. In my case I was looking for a value that was in my model object as well as the ModelState dictionary, because the name was very common: Id.
To fix the issue before I call return View(model) I call ModelState.Clear() in order to make sure there are no values in the dictionary that are in conflict. Doing this causes my page to be rendered correctly.

In CQ5, my responsive emulator devices list is empty

To start, I followed these directions exactly as it's stated: http://dev.day.com/docs/en/cq/5-6/developing/mobile/responsive.html
The problem is, despite all of that, my Devices dropdown on the sidekick in preview mode is empty.
The list works without issue in the Geometrixx Media without issue.
I made sure I set the cq:deviceGroups and the sling:OsgiConfig as required, and also included the simulator.js in the head tags.
Edit: I have found that if I set the resourceType on the root level page to geometrixx-media/components/page, which is their working demo, it works. I have completely removed all jsp and config items from that component page and it still continues to work anyways.
Does anyone know of something that is missing from the documents, and how to fix the issue?
Thanks.
This is what I did to resolve this issue:
I am going to assume your application name is jason-riis
In CRXDE|Lite create a config folder in /apps/jason-riis/
Now create a node of:
TYPE=sling:OsgiConfig
NAME=com.day.cq.wcm.mobile.core.impl.MobileEmulatorProvider-<*alias>
*alias could be anything, I gave my application name. What it does is it will get you a unique PID when you look at it in configuration Manager
If you go to your configuration manager now, you should be able to see two MobileEmulatorProvider config settings.
Add a node property to node you just created:
NAME=mobile.resourceTypes
TYPE=String[] (you have to click multi at the end of the value textbox)
VALUE=jason-riis/components/<*page>
*page is all the components that has sling:resourceSuperType of foundation/components/page and it is a multi array so it should look like this
jason-riis/components/page, jason-riis/components/widepage, jason-riis/components/newspage
I assume you already have the cq:include for simulation in your header. This makes the devices button appear in preview mode.
Last thing is, go to your website root page's jcr:content [/content/jason-riis/jcr:content] and add node property
NAME=cq:deviceGroups
TYPE=String[]
*VALUE=/etc/mobile/groups/touch, /etc/mobile/groups/smart
*If you go to this etc path in CRXDE|Lite; you will see more relevant information in jcr:content node. This will help you in creating your own custom emulator list.
You should be able to see the dropdown now, with options of iPhone and iPad and all. I know AEM docs are frustrating, let me know if there is any confusion.

EF6 only lazy works from loaded context data

Using EF 6 rc 1
Code first
Lazy loading is enabled and proxy generation is allowed (defaults).
When attempting to access navigation properties, I am finding that:
- if the referenced object was already loaded into the DbContext in some manner, the navigation property will be populated
- if the referenced object was not already loaded, the navigation property will remain null. No query attempt is made to the SQL Server DB.
This applies to collections and objects. In all cases, I have verified that the navigation properties are marked virtual.
Is this expected behaviour? I have scroured every article I could find but have found no description of this (please provide links). If not expected behaviour, what could I be doing wrong?
Thank you!
EDIT:
Because I can't post the classes I have, I've tried to reproduce this into a simple example I would be comfortable posting. The simple example, however, works as expected. I have noticed one major difference between the working example and the non-working: my non-working application produces entities that are NOT proxies. This, even though proxy generation is allowed, and I am retrieving these objects from a new context (NOT the context they were created in). I can't post the non-working code, and there's no value in posting the working code. Theories explaining why proxy classes are not being generated would be welcome!
Turned out the reason the Proxy wrapper wasn't being created is because some of the classes had the default constructor marked internal. Simply changing them to protected allowed the Proxy to be created, which then enabled lazy loading. Though I found this to be pretty obscure it is documented here: http://msdn.microsoft.com/en-us/library/vstudio/dd468057(v=vs.100).aspx

How to show previous url after user has canceled dialog with message from Activity#mayStop()?

In our app we need to check if the data is saved when we are in a particular place before navigating away from it. So the user should be able to negate a browser back button request. But by the time that the history value change event is received the url has already been changed. The History class doesn't seem to have a way to restore the url back. Anybody have any ideas?
In GWT 2.1 you get Activities and Places. And activity has a maystop method, which is exactly what you want, if I understand you correctly.
Use a window.onunload or window.onbeforeunload javascript callback to confrim/save state.
onbeforeunload example
I haven't actually implemented this behavior yet, but here is my plan and maybe it will work for you.
1) Each time you receive an onHistoryChanged event and decide to allow it, save the current historyToken in an instance variable somewhere.
2) Keep track of activity on the page that should block navigation. Use a data structure that can keep track of multiple activities, like multiple file uploads, multiple edits, etc.
3) When you receive a new onHistoryChanged event, if your data structure from #2 indicates that it's not safe to navigate, avoid changing the page and restore the historyToken that you saved in #1. I'm assuming that you can do this either by:
a) Calling History.newItem(oldHistoryToken, false) or
b) Calling History.newItem(oldHistoryToken, true) and keeping a flag to force the next onHistoryChanged to be ignored.
Again, I haven't actually implemented this so let me know how it works out.
If you have links that allow the user to leave the app and you want to prevent that as well, you'll need to also add an onbeforeunload.
Have a look at the PlaceManagerImpl class from the gwt-platform framework. Especially the onValueChange() method and the methods dealing with the onLeaveQuestion field.
Hope that helps.
In this issue report, t.broyer explains in his comment that such behavior was planned during design of Places framework. The most important part is:
mayStop was a mistake, or it should have only been called when unloading the app, not for internal navigation within the app.
So probably it's better to not use it at all...