Convert dictionary key to object name in Python

I've got a dictionary whose keys are country names, and its values are an object of the class Country, which has several attributes (population, area, etc.). For example: {"Chile":Country(17000000,124234,...)} However, when I try to reach a countr...
more »

2017-10-04 23:10 (0) Answers

Get PHP class property from array

I have an array looking something like this: Array ( [0] => my_val_one [1] => my_val_two ) I then have an object looking something like this: stdClass Object ( [id] => 123123 [name] => my_name [m...
more »

2017-10-03 15:10 (2) Answers

Comparing Object class to generic types

How can I compare the treeNodes to the generic type passed to the method? class TreeNode <E extends Comparable<E>> { Object data; TreeNode <E> leftChild; TreeNode <E> rightChild; public TreeNode(Object obj) ...
more »

2017-10-02 07:10 (0) Answers

Push to javascript object provides wrong result

I'm trying to create a sortable javascript object, but when I push to the object instead of creating a new object it creates 2 of the first objects. I have created a jsFiddle to better display what is going on at https://jsfiddle.net/chasiv/9ee2cxvu...
more »

2017-09-29 21:09 (0) Answers

Need to iterate over the last two objects

I have object array with values as follows, { [ {foo: a, bar: b} ] } I need to check if the last two value of an array object member of foo at least contains one 'x', so when the data is added like this, { [ {foo: a, bar: b}, {foo:...
more »

2017-09-28 13:09 (1) Answers

How to check if object supports method in vba?

Is it possible to check whether an object supports a certain method without an error handler in VBA? I've found numerous duplicates asking the question for for example JavaScript and Symphony2, but not yet in VBA. I would like to use a .sendkeys "{...
more »

2017-09-26 21:09 (1) Answers

Assigning new value to object property

I need to figure out how to update the user with a new email. I've assigned a current email in the user object but need the function to change the object property of email. I've done what I know and can't seem to figure out what I need to put in the ...
more »

2017-09-24 23:09 (1) Answers

Adding objects to the DisplayList using variable

Im trying to add objects to the displaylist, but for my project it would be good if i could run one piece of code that could place 1 of 5 objects onto the screen. Currently the code works if I put in the name of the object, but fails if I try to give...
more »

2017-09-24 18:09 (1) Answers

classes and Loop inside python

i am trying my first code in python writing classes and objects.. here is the code: class Order: def __init__(self,A): self.a= A def user1(self): x = len(self.a) i =0 while i < x: value = A[i] y = valu...
more »

2017-09-23 07:09 (1) Answers

php shorthand to append to object

I'm pulling through data from my database and wish to add an object to the end of each item. The following code works, but I'm assuming there's a better way than repeating all the info and adding to a new object. $cs = $client->contact()->...
more »

2017-09-21 14:09 (2) Answers

How to get JSON from URL in PHP

I am doing an Ajax call with this set of data: "type":"alter", "param":{ "key1":"value1", "key2":"value2" } In PHP, I handle this by: • Getting file_get_contents('php://input'): type=alter&param%5Bkey1%5D=value1&param%5Bkey2%5D...
more »

2017-09-20 17:09 (1) Answers

Python - Grandparents methods (genes)

I'm currently making a simple script that let's me control multiple (32) switches and routers trough a Access server. I already made a class that initiates the serial connection Anyway, my question is how do I use an inherited method? I have a grand...
more »

2017-09-20 15:09 (1) Answers

Trying to utilize an array of objects in C#

I am trying to load an array of objects from my database for use later in the program. I have defined the object within a class (LocObject) and attempted to load the array within a loop. I have come up with the following issue in my c# code: using S...
more »

2017-09-19 04:09 (0) Answers

Pushing an element into an object

I'm new to React, but I'm pretty sure this question is more related to Javascript than React. I want to push a custom element into an object that has already been made in React, without triggering a forceUpdate(). I want to push fullName to the pers...
more »

2017-09-17 11:09 (3) Answers

Convert JsonString int values to string in Swift

{ "value" : 1234, "value2" : 123456 } convert it to { "value" : "123456", "value2" : "123456" } I am using ObjectMapper class , my aim is to parseJSON to Mapper class . But now the response has changed due to certain need. Initially all the...
more »

2017-09-16 08:09 (1) Answers