I have two objects and I want to merge them, but it should not replace the object.  var x = {'one':1, 'two': {'b': 2, 'c': 3}} var y = {'two': {'b': 4}}   When I merge them The out put should be :  {'one':1, 'two': {'b': 4, 'c': 3}}
614
I need to be able to merge two (very simple) JavaScript objects at runtime.  For example I'd like to:  var obj1 = { food: 'pizza', car: 'ford' } var obj2 = { animal: 'dog' }  obj1.merge(obj2);  //obj1 now has three properties: food, car, and animal   Does anyone have a script for this or know of a built in way to do this?  I do not need recursion, and I do not need to merge functions, just methods on flat objects.
2911
I have an array of Foo objects. How do I remove the second element of the array?  I need something similar to RemoveAt() but for a regular array.
106925
Is it possible to copy an object in Illustrator so that if you make a change in any of them the changes will apply in both? Actually I have this situation where I have a lot of instances of the same object and I need to be faster on changes and copy-ing again and again is not a proper solution, but consumes a lot fo time.  Thank you for your time!
7083
I need to  an object to . I'm using . Is there a "standard" way to do this?  My specific situation: I have an array defined as shown below:  var countries = new Array(); countries[0] = 'ga'; countries[1] = 'cd'; ...   and I need to turn this into a string to pass to  like this:  $.ajax({     type: "POST",     url: "Concessions.aspx/GetConcessions",     data: "{'countries':['ga','cd']}", ...
60856
I have a string that looks like this:  "Name1=Value1;Name2=Value2;Name3=Value3"   Is there a built-in class/function in Python that will take that string and construct a dictionary, as though I had done this:  dict = {     "Name1": "Value1",     "Name2": "Value2",     "Name3": "Value3" }   I have looked through the modules available but can't seem to find anything that matches.    Thanks, I do know how to make the relevant code myself, but since such smallish solutions are usually mine-fields waiting to happen (ie. someone writes: Name1='Value1=2';) etc. then I usually prefer some pre-tested function.  I'll do it myself then.
103964
How can I make an object show up on different layers without having to copy it? E.g. I have an object animated and I want it to show up on multiple layers.
23846
I am trying to create a script that will allow me to generate a list and store it in the blend file. The list starts out blank and then strings get added to the list, resulting in: [&quot;test1&quot;,&quot;test2&quot;,&quot;test3&quot;] I create a PropertyGroup Class for the enum, define a new scene property as a CollectionProperty type with access to that enum Class, before appending a new item into the enum: import bpy  class item_set(bpy.types.PropertyGroup):     myItems = []     enums = bpy.props.EnumProperty(name=&quot;My Items&quot;, items=myItems) bpy.utils.register_class(item_set)  bpy.types.Scene.myItemSet = bpy.props.CollectionProperty(type=item_set)      newItem = bpy.context.scene.myItemSet.add() newItem.myItems.append(&quot;test&quot;)    I need to be able to add items to the list, save the blend file, re-open the file, run the script again and retrieve the list from the scene. However, the  states:  One thing to keep in mind is that after saving and reloading your blend-file, your new property will have disappeared...    ...To make the values you assigned in a previous session available again, you need to redefine the property. So after reopening the blend-file you need to rerun: bpy.types.Object.myProperty = bpy.props.StringProperty()   I can do the appending into and retrieval of the property values absolutely fine upon an initial run, but as the documentation states, the property is unavailable when trying to view it's contents on a reload of the file (after having run the script, saved and re-opened the file), but I am unsure how to redefine it without clearing all it's values. If I redefined the scene property, it would presumably also need the enum Class to be available, which would currently set myItems back to [] (empty). Do I need to change the way I am initially setting the items in the class or am I on entirely the wrong track with all of this? All I need to do is store a list in the blend file, so if there is a better way please let me know. Thanks. (I would hope, eventually, to be able to store sub lists [[&quot;a&quot;,&quot;b&quot;],[&quot;c&quot;,&quot;d&quot;],[&quot;e&quot;,&quot;f&quot;]], I'm just trying to get normal lists to work first.)
588
JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function.  How do you do the reverse, and add a function to an "object"?  This works:  var foo = function() { return 1; }; foo.baz = "qqqq";   At this point, foo() calls the function, and foo.baz has the value "qqqq".  However, if you do the property assignment part first, how do you subsequently assign a function to the variable?  var bar = { baz: "qqqq" };   What can I do now to arrange for bar.baz to have the value "qqqq" and bar() to call the function?
89
I'm not that into dynamic programming languages but I've written my fair share of JavaScript code. I never really got my head around this prototype-based programming, does any one know how this works? var obj = new Object(); obj.prototype.test = function() { alert('Hello?'); }; var obj2 = new obj(); obj2.test();  I remember a lot discussion I had with people a while back (I'm not exactly sure what I'm doing) but as I understand it, there's no concept of a class. It's just an object, and instances of those objects are clones of the original, right? But what is the exact purpose of this &quot;.prototype&quot; property in JavaScript? How does it relate to instantiating objects? Update: correct way var obj = new Object(); // not a functional object obj.prototype.test = function() { alert('Hello?'); }; // this is wrong!  function MyObject() {} // a first class functional object MyObject.prototype.test = function() { alert('OK'); } // OK  Also these  really helped a lot.
53384
If I want to use objects as the keys for a Dictionary, what methods will I need to override to make them compare in a specific way?  Say I have a a class which has properties:  class Foo {     public string Name { get; set; }     public int FooID { get; set; }      // elided }    And I want to create a:  Dictionary&lt;Foo, List&lt;Stuff&gt;&gt;   I want Foo objects with the same FooID to be considered the same group.  Which methods will I need to override in the Foo class?  To summarize: I want to categorize Stuff objects into lists, grouped by Foo objects. Stuff objects will have a FooID to link them to their category.
19901
...where each object also has references to other objects within the same array?  When I first came up with this problem I just though of something like   var clonedNodesArray = nodesArray.clone()   would exist and searched for info on how to clone objects in javascript. I did find a  on StackOverflow (answered by the very same @JohnResig) and he pointed out that with jQuery you could do  var clonedNodesArray = jQuery.extend({}, nodesArray);   to clone an object. I tried this though, this only copies the references of the objects in the array. So if I   nodesArray[0].value = "red" clonedNodesArray[0].value = "green"   the value of both nodesArray[0] and clonedNodesArray[0] will turn out to be "green". Then I tried  var clonedNodesArray = jQuery.extend(true, {}, nodesArray);   which deep copies an Object, but I got "too much recursion" and "control stack overflow" messages from both Firebug and Opera Dragonfly respectively.  How would you do it? Is this something that shouldn't even be done? Is there a reusable way of doing this in Javascript?
27944
I know how to successfully duplicate an object by using  bpy.ops.object.add_named(name = 'TemplateObjectName')   If the template object named 'TemplateObjectName' has animations, particle systems and modifiers attached to it, the previous call will create a duplicate object that also has those components. However, if I duplicate an object using   template_object = bpy.data.objects['TemplateObjectName'] new_object = bpy.data.objects.new('NewObjectName', template_object.data) collection.objects.link(new_object)   how do I attach the template object's animation, modifiers, particle systems...?
118039
I've been working happily with Blender all this week and last, performing hundreds of operations, many booleans, and getting good results in a rudimentary model for a small enclosure.     Today I've renamed the file to v2, and started to make a couple of changes.  I'm just removing some material using a simple shape to create insets and a boolean difference operation.  Suddenly, though, the 'difference' is behaving like a 'union' and vice-versa.  I thought I'd forgotten something overnight, and tried it on two other simple objects in the same design, with the same result. I then opened a new design with just two cubes and tried it there, where it works without error.  Quit, back to my own design v2, and still the behavior is swapped.     I've restarted Blender a couple of times.  Moving on to trying more renaming, rebooting tests etc.  Is this a known issue, am I missing something obvious? Is there a work-around that someone can suggest.   (I'm using ver 2.70 on Mac OS 10.8.5)
2464
I'm creating side skirts for a truck and I am duplicating the frames I want. The problem is it's making the duplicated object into another object. How do I put it into the same one?
22706
I'm learning how to use the mirror modifier and I am having some trouble.  When I apply the modifier to my object I don't see a mirrored version of it.  What am I doing wrong?
107998
Is it like...  var obj = new Object();  obj.function1 = function(){     //code }   or something like that?
1704
This has always confused me. It seems like this would be nicer:  my_list = ["Hello", "world"] print(my_list.join("-")) # Produce: "Hello-world"   Than this:  my_list = ["Hello", "world"] print("-".join(my_list)) # Produce: "Hello-world"   Is there a specific reason it is like this?