I have two collections:  Group = {   users: [Array_of_User] }  User = {   name: _string_ }   I'm listing groups ans I'm trying to know in the template if a user is in the groups:  mytemplate.js  Template.mytemplate.helpers({   groups: function(){       return Groups.find();   },   currentUsername: 'test' });   mytemplate.html  &lt;template name="main"&gt;   &lt;ul&gt;     {{#each groups}}     &lt;li&gt;       {{#if [the group contains currentUsername] }}       contains       {{else}}       doesn't contain       {{/if}}     &lt;/li&gt;     {{/each}}   &lt;/ul&gt; &lt;/template&gt;   The question is: what can I put on the helpers and instead of [the group contains currentUsername] to make it work?  Also, I'm not saying this is the way to do it. I'm open to any suggestions even if it means I have to change a lot.
717
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) {     for (var i = 0; i &lt; a.length; i++) {         if (a[i] === obj) {             return true;         }     }     return false; }  Is there a better and more concise way to accomplish this?
122930
I'm comparing two list given in the list to see if the item.name exists in both for loop. If not then add into a list to show the error for the missing names.  set&lt;id&gt; setAssetIds = new set&lt;id&gt;(); list&lt;Asset_Store__c&gt;  assets = [select id,name......]; for(Asset_Store__c item : assets ) {     setAssetIds.add(item.id);  }   list&lt;Meter__c&gt;  meters = [select id,name......where id in : setAssetIds];  //now comparing the two lists for(Asset_Store__c a : assets) {    for(Meter__c m : meters)    {      if(a.Name != m.Name)      {        //not matched...        break;      }     } }   the problem with the above approach is that, its not finding the correct name.
75219
My issue is that I have two lists that I would like to move with their data.  While I am able to save both as templates and then upload to the new site, none of the lookup columns in my parent table are populated with data now.  Can this be done?
95434
How I can pass a form to twig template in Drupal 8?  For example, I get this:  a form: mymodule/src/Form/MyForm.php  Then on my Controller:  public function myController() {      ??????      return [         '#theme' =&gt; 'mytemplate',         ??????         ]; }   mytemplate.html.twig  {{ ????? }}
65255
If I have a template (say a generic letter) that is filled in with various pieces of data (say, the name of the addressee), what is a general term for those pieces of data?  For example:  Dear {firstname}, This is just a friendly reminder that the book {booktitle} will be due on {duedate}. Thank you.   What would I refer to {firstname}, {booktitle} and {duedate} as?
53128
How can I verify if the list I'm trying to retrieve in Javascript really exists?  My code is:  function Search() {  var context = SP.ClientContext.get_current(); this.site = context.get_site(); this.web = context.get_web(); context.load(this.site); context.load(this.web); context.executeQueryAsync(     Function.createDelegate(this, this.onQuerySucceededSearch),     Function.createDelegate(this, this.onQueryFailedSearch) ); }  function onQuerySucceededSearch() { var Cliente = document.getElementById("Ribbon.TabCliente.Ricerca.CercaCliente").value; var Ufficio = document.getElementById("Ribbon.TabCliente.Ricerca.CercaUfficio").value; var Commessa = document.getElementById("Ribbon.TabCliente.Ricerca.CercaCommessa").value;  var listaEsiste = web.get_lists().getByTitle(Cliente);  alert(Cliente + Ufficio + Commessa);  if ((Cliente != undefined) &amp;&amp; (listaEsiste != undefined)) {     var doveAndare = "myurl" + Cliente + "/" + Cliente;     if (Ufficio != undefined) {         doveAndare += '?&amp;amp;FilterField10=SvDUfficio&amp;amp;FilterValue10=' + Ufficio;     }     this.location = doveAndare; } else {     var doveAndare = "myurl?"     if (Cliente != undefined) {         doveAndare += "?&amp;amp;Cliente:" + Cliente;     }     if (Ufficio != undefined) {         doveAndare += "Ufficio:" + Ufficio;     }     if (Commessa != undefined) {         doveAndare += "Commessa:" + Commessa;     }     this.location = doveAndare; } }   function onQueryFailedSearch(sender, args) { this.statusID = SP.UI.Status.addStatus("Search:",     "Fallimento: " + args.get_message() + " &lt;a href='#' onclick='javascript:closeStatus();return false;'&gt;Close&lt;/a&gt;.", true); SP.UI.Status.setStatusPriColor(this.statusID, "red"); }   myList is always != null, even if the list doesn't exist!  Another question... I have the web object, how could I get the url?
97268
I am creating a bone, and then a collection with a specific name if it does not exist, with the following function: def make_collection(collection_name):     if collection_name in bpy.data.collections:         return bpy.data.collections[collection_name]     else:         new_collection = bpy.data.collections.new(collection_name)         bpy.context.scene.collection.children.link(new_collection)         return new_collection  The collection is linked to the master collection so it's on the top of the hierarchy, and now i try link it to the collection. I create the collection: root = make_collection(&quot;bat&quot;)  and later on in the code, i create a bone (although is an empty since it's a standalone bone), and i try to link it like this: bpy.ops.object.empty_add(type='CUBE') bone = bpy.context.active_object bone.name = data[i].name #bpy.ops.collection.objects_add_active(collection=root) root.objects.link(bone)  Even though it's called root, root is not the master collection, just to clarify. The result is the following:  It's the same empty i created, that appears twice in both collections. Although an idea would be to just delete other collections, 2 will appear still, one in the master collection, and one in the collection i created. Also it's the same item since, if i click one, both get selected at the same time, so there's only one empty in the scene, i just can choose where to click it from. Now the problem is i'm doing this with several objects in a loop, so i  would be basically duplicating the object list twice, and that's pretty redundant. If i don't use the root.objects.link code at all, the objects would just be on the master collection, but i want them to be on the collection i specifically created. Is there any way to fix this? I'm not sure why it appears on both collections and i'm very confused. I'm fairly new with the blender API, so i'm not sure what i'm doing wrong. Thanks for reading!
100235
How to create a Collection inside another existing Collection with Python?
90864
I very rarely meet any other programmers!  My thought when I first saw the token was "implies that" since that's what it would read it as in a mathematical proof but that clearly isn't its sense.  So how do I say or read "=>" as in:-  IEnumerable&lt;Person&gt; Adults = people.Where(p =&gt; p.Age &gt; 16)   Or is there even an agreed way of saying it?
18976
Is it possible to write a template that changes behavior depending on if a certain member function is defined on a class?  Here's a simple example of what I would want to write:  template&lt;class T&gt; std::string optionalToString(T* obj) {     if (FUNCTION_EXISTS(T-&gt;toString))         return obj-&gt;toString();     else         return "toString not defined"; }   So, if class T has toString() defined, then it uses it; otherwise, it doesn't. The magical part that I don't know how to do is the "FUNCTION_EXISTS" part.
98518
Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the pets list has no elements. What I'm ending up with is a list of 0 elements. I assume that this is because an inner-join is taking place. What I want to end up with is a list of 3 elements (the 3 Person objects) with null data filled in for the missing elements. i.e. a Left-Join. Is this possible?  Person magnus = new Person { Name = "Hedlund, Magnus" }; Person terry = new Person { Name = "Adams, Terry" }; Person charlotte = new Person { Name = "Weiss, Charlotte" };  //Pet barley = new Pet { Name = "Barley", Owner = terry }; //Pet boots = new Pet { Name = "Boots", Owner = terry }; //Pet whiskers = new Pet { Name = "Whiskers", Owner = charlotte }; //Pet daisy = new Pet { Name = "Daisy", Owner = magnus };  List&lt;Person&gt; people = new List&lt;Person&gt; { magnus, terry, charlotte }; //List&lt;Pet&gt; pets = new List&lt;Pet&gt; { barley, boots, whiskers, daisy }; List&lt;Pet&gt; pets = new List&lt;Pet&gt;();  // Create a list of Person-Pet pairs where  // each element is an anonymous type that contains a // Pet's name and the name of the Person that owns the Pet. var query =     people.Join(pets,                 person =&gt; person,                 pet =&gt; pet.Owner,                 (person, pet) =&gt;                     new { OwnerName = person.Name, Pet = pet.Name }).ToList();
89335
I'm diving into visualforce and the standard controller for the first time and having trouble iterating over a single opportunity's related records. The below code produces an error:  &lt;apex:page standardController="Opportunity"&gt; &lt;apex:pageBlock title="{!Opportunity.name}"&gt;     &lt;apex:pageBlockSection title="{!Opportunity.Id}"&gt;         &lt;apex:repeat value="{!Opportunity.Custom_object__c}" var="c"&gt;             &lt;apex:pageBlockSectionItem&gt;                 {!c.Name}             &lt;/apex:pageBlockSectionItem&gt;         &lt;/apex:repeat&gt;     &lt;/apex:pageBlockSection&gt; &lt;/apex:pageBlock&gt;&lt;/apex:page&gt;   The error I'm receiving is as follows:  Error: Unknown property 'String.Name'   I take from this that the Visualforce is not interpreting the {!c.Name} as the array of objects I thought it was but instead as a string. I am able to save the file when I remove {!c.Name} which makes me think that  is correct but, on the other hand, when substituting value="{!Opportunity.Account}" the code correctly retrieves the related Account. My instinct is that I'm not referencing the related child-objects correctly. I've been banging my head for a bit of time and was wondering if someone could provide some insight as to what is going on?
16494
When you pass a collection like list, array to another function in python, does it make a copy of it, or is it just a pointer?
16413
How can expression functions similar to Visualforce and Lightning Aura Components be achieved within lightning web components?   For example, &lt;template if:true={index % 5 == 0}&gt;&lt;br&gt;&lt;/template&gt; expression index % 5 == 0 is not compyling at all.  accountList.html  &lt;template&gt;     &lt;template if:true={accounts.data}&gt;         &lt;template for:each={accounts.data} for:item='item' for:index='index'&gt;             &lt;!--LWC DOES NOT SUPPORT EXPRESSION FUNCTIONS--&gt;             &lt;!--&lt;template if:true={index % 5 == 0}&gt;&lt;br&gt;&lt;/template&gt;--&gt;             {item}         &lt;/template&gt;     &lt;/template&gt; &lt;/template&gt;   accountList.js  import {LightningElement, wire} from 'lwc'; import getAccounts from '@salesforce/apex/TestController.getAccounts';  export default class AccountList extends LightningElement {      @wire(getAccounts) accounts;  }   Since LWC doesn't support Expression Functions, I'd like to know how to implement them.
73427
How can i check if a list has certain string in salesforce. For example I have : anotherList which is from controller and has  this value [NAME_A, NAME_B, NAME_C]  Then in my page:      &lt;apex:repeat var="list" value="{!tesList}"&gt;         &lt;input type="checkbox" style="display:{!IF(CONTAINS(anotherList, list['name']), '','none')}" value="{!list['name']}" /&gt;     &lt;/apex:repeat&gt;   But i got an error saying that Error: Incorrect parameter type for function 'CONTAINS()'. Expected Text, received Object  So parameters should only be Strings right? But how can i do something like this in Visualforce page?  &lt;!-- JSTL sample --&gt;     &lt;c:forEach var="list" items="${testList}"&gt;             &lt;c:if test="${fn:contains(anotherList, list.name)}"&gt;                 &lt;input type="checkbox"  value="${list.name}" /&gt;             &lt;/c:if&gt;     &lt;/c:forEach&gt;
96389
I am using JSLink to change view of a custom list using this code,  (function () {     var overrideCtx = {};     overrideCtx.Templates = {};     overrideCtx.BaseViewID = 2;     overrideCtx.ListTemplateType = 17774;     overrideCtx.OnPreRender = preRenderHandler17774;     overrideCtx.OnPostRender = postRenderHandler17774;     SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx); })();   Both preRender and postRender functions need to get some resources from a custom file which has been added to 15 hive "Resources" folder, Now I can use this code to get resources, but I am not sure how to best get resources here,  SP.SOD.executeOrDelayUntilScriptLoaded(function () {   SP.SOD.registerSod("demoresources",      "/_layouts/15/ScriptResx.ashx?name=demoresources&amp;culture=" +      STSHtmlEncode(Strings.STS.L_CurrentUICulture_Name));     SP.SOD.executeFunc("demoresources", 'Res', function () {     alert(Res.helloWorld);   }); }, "strings.js");   Where is the best to place this code in above ?     And how can I get culture in preRender method ? as this is undefinied   String.STS.L_CurrentUICul...
93897
If I have a template function, for example like this:  template&lt;typename T&gt; void func(const std::vector&lt;T&gt;&amp; v)   Is there any way I can determine within the function whether T is a pointer, or would I have to use another template function for this, ie:  template&lt;typename T&gt; void func(const std::vector&lt;T*&gt;&amp; v)   Thanks