Questions tagged [object]
An object is any entity that can be manipulated by commands in a programming language. An object can be a value, a variable, a function, or a complex data-structure. In object-oriented programming, an object refers to an instance of a class.
object
65,099
questions
-1
votes
1
answer
33
views
Filter multi-dimensional array using key
I need help from the PHP experts there. I want to do some filters in this result. I want to filter it using the key custom_search_emp_id_11. hope there's a shorter/one liner code/function to do ...
2
votes
5
answers
113
views
How do I get the substr after a word or index in JavaScript?
I have the following element below in my DOM.
<div id="klarna-checkout-container" style="overflow-x: hidden;">
<script type="text/javascript">
/* <![CDATA[ */
(function(w,...
2
votes
3
answers
122
views
How to use 'if' in the case of that it is true if one data is included in an array by javascript?
I have a question whether this is possible or not.
For example, there is one code like below. But that code has an error for sure.
And I want to make if is true when one data is at some array.
Could ...
1
vote
2
answers
48
views
Removing certain elements from an Object in a Map
I have an object Map
Map<Integer, User> where the user's id's are mapped to User object that has id, firstName, lastName, Name, email, zipCode, country, state
How do I reduce it to a Map that ...
0
votes
1
answer
48
views
Similar `return` values when mutating objects inside array
I never had though deep about return until I was playing with some codes and encountered this nice catch.
var x = [{a:2}, {a:4}, {b:4}]
When I mutate some values inside the objects, I found same ...
1
vote
1
answer
704
views
How to interrogate a python object about its structure?
Is there a way to programmatically determine an object's structure/model, it's constituent parts, how it can be iterated and manipulated and transformed, broken down and built back up?
Trial and ...
0
votes
2
answers
126
views
How to check if an array of DOM-node text values are equal to a certain string?
The goal is to take an array of names and check if all of them are equal to e2e.
I have a collection of objects created via protractor's element.all(by.css(...). In the next step I need to check if ...
1
vote
1
answer
216
views
How does this object initialization work, for props?
I found this code, and would like an explanation of why '={}' is needed after the initializations.
What I can figure out is
1) const makes the 'props' object const (not it's contents)
2) fields such ...
6
votes
3
answers
7k
views
Avoid rerender in React caused by objects literal : how to do with variables in the object?
I read in this article React is Slow, React is Fast: Optimizing React Apps in Practice that :
In fact, each time you pass an object literal as prop to a child component, you break purity.
Alright, ...
1
vote
2
answers
49
views
Changing objects value
I am troubled by the way you can change fields in objects without actually using the operations on them.
for example say I have the following class:
public class MultisetPair {
private Object ...
32
votes
5
answers
17k
views
What is DOM? (summary and importance)
What is the Document Object Model (DOM)?
I am asking this question because I primarily worked in .NET and I only have limited experience, but I often hear more experienced developers talk about/...
0
votes
1
answer
33
views
Display all pupil data from object property of school class
I want to display all pupil data from 'pupils' which is an array of objects belonging to the School class.
I have created a new instance of the school class and a forEach loop which takes each pupil ...
0
votes
1
answer
908
views
How to render a specific object within an array, when clicking on a component, in React?
Codesandbox link.
Okay, so the high level functionality of what I want this app to do:
Upon load, you're presented with the characters on the left, and on the right an intro screen.
When a user ...
0
votes
0
answers
11
views
How does a function in python internally remember the state of mutable objects which are defined only locally? [duplicate]
def func(arg1,arg2=[]):
var = arg2
var.append(arg1)
return var
func("hello")
print("case1 output --> ",func("world"))
def func2(arg1,arg2):
var = arg2
var.append(arg1)
...
1
vote
1
answer
304
views
Powershell combine data from an array into an object
I want to get data from 2 commands and combine them into 1 object.
My goal is to get usage and cost of the Partner center. To do this I got the usage and cost with the command Get-...
-1
votes
1
answer
38
views
Problem on shuffling the order of created divs
I asked about how to shuffle the order of some created divs in JS here. And one person answered me, but when I do what he told me some divs aren't shown and other appear twice. How can I do to shuffle ...
1
vote
1
answer
32
views
Appending to attribute of a specific object, where objects are stored in a dict
I am having trouble appending an element to a list, where the list is an attribute of a custom class I have created. The object containing the list should be accessible through a dict.
For context, I ...
1
vote
1
answer
86
views
Basic error with accessing JSON data (JS functionality)
Background:
I'm trying the simple web push notifications example given in Google's documentation of the same (link: https://developers.google.com/web/fundamentals/push-notifications/subscribing-a-...
0
votes
2
answers
2k
views
Implementation of array attribute with C++ class
EDIT
I am learning C++ through a series of questions from the university I attend. Here is an excerpt of the problem in question:
A retailer shop wishes to store information about its sales. ...
0
votes
1
answer
198
views
What is the output type of cts.uris in MarkLogic?
I'm using cts.uris in my search query. I'm assigning it to a variable like:
var x = cts.uris(...);
What is the output type of x?
I'm using JSON documents in my application and want to use xdmp....
1
vote
3
answers
13k
views
How to add data to state object in react?
I created this.state.data object. Now I need to put this.state.email and this.state.password into this.state.data.email2 and this.state.data.password2
I want to create local storage. To do that I ...
0
votes
0
answers
26
views
What are these objects or nodes called in JavaScript when making a web based visualizer?
I'm setting up a road map for a project I'm working on and i cant seem to find any information on how to create a object in JavaScript that is a block of information with three or more fields.
I am ...
0
votes
3
answers
5k
views
Access object properties React-Native
I have a response from the server that looks like this
[
{
"metric":{
"id":"b66178b8-dc18-11e8-9f8b-f2801f1b9fd1",
"name":"Detector de fum bucatarie",
"...
0
votes
2
answers
80
views
Separate comma of a string but not included within brackets and parenthesis
I have a elements that has a attribute name of data-options , every element has different configurations , it is not a json formatted for readability and easy maintenance.
<table scoa-table data-...
1
vote
2
answers
1k
views
how to recursively find if object key exist?
I have the following object
acn: "02 0002 0002"
id: "random"
name: "random"
parent_domain: "parent-random"
subDomainData: {random-l3.1: {…}}
sub_domains: ["random-l3.1"]
timestamp: 1549597441
and ...
0
votes
2
answers
2k
views
How to get an object from an json array of objects based on a value inside an object in python?
I have a json array of objects that looks like this:
{
"testcases": {
"testcase": {
"custom-fields": {
"custom-field": [{
"@id": "...
-1
votes
1
answer
56
views
Why getting an item from an object returns undefined? [closed]
I am trying to get the item "Errors" from the object below:
{Id: 15, Date: "22-02-2019", Time: "22:45", Sport: "Football", Country: "United Kingdom", …}
Bet: "Win"
Bookie: "Bet365"
...
0
votes
2
answers
62
views
My function seems to be editing multiple objects
In my Sudoku Android application I have a solve function that solves a Sudoku puzzle (a CellField object). However for some reason when I clone a CellField object and I call the solve method on the ...
-1
votes
1
answer
341
views
why are my php object member variables null after instantiating them?
I'm trying to make an api in php. In this part I query my database and load the data into chuckquote objects then add those objects to an array to be encoded in json and received whenever the app ...
0
votes
1
answer
84
views
Adding to an ArrayList of objects?
Just for starters this is for school. Not looking for an answer but I'm lost when adding both the date and weight into an object and then adding that object into an arraylist.
public void addEntry(...
15
votes
1
answer
47k
views
How to unpack key,value pairs in python? [duplicate]
I'm trying to explore the Algorithmia image taggers in python.
client.algo("deeplearning/IllustrationTagger/0.2.5")
client.algo("deeplearning/InceptionNet/1.0.3")
But that's not quite relevant to ...
-2
votes
1
answer
91
views
Reference Object in Array List
updated question
Hello,
I currently have a problem understanding how Objects are referenced in Array Lists, or to be more explicit how using the get method of an array list really works.
I add 4 ...
0
votes
1
answer
97
views
Wordpress: how to grab an array value from a print_r($object)
In a Wordpress page template, I'm using:
<?php
global $wpdb;
$sql = "SELECT COUNT(`meta_key`) FROM `wp_usermeta` WHERE `meta_key` = 'mepr-address-state' && `meta_value` = 'NSW';";
...
0
votes
1
answer
14
views
Retrieve the Object values and assign it to Another one Object in ReactJS
I have to retrieve an object and assign it to another one. But in the new object, always the last item only stored.
I tried object.entries keys method but nothing worked.
code : https://codesandbox....
-3
votes
1
answer
379
views
how to combine two json array with object.assign
I want to combine these two json arrays :
mk = [ { sender: 'supporter',
title: 'test4567',
description: 'test',
time: 1550387162726,
image:
'http://185.94.99.69:9000/upload/ticket/...
0
votes
1
answer
33
views
object of class mysqli _connect could not be converted to string in line 135
when i run the code it give error of object of class mysqli_connect could not be converted to string in line 135. please some one provide me the solution of this problem.
i tried searching for ...
-6
votes
2
answers
279
views
How to parse JSON values inside nested array using JavaScript [closed]
I have an array like below provided. Now I want to get all values of "name" key with looping. How to get that?
I tried. But I can't get the correct result
dangle= [[{name:"jack",age:"20"}],
...
0
votes
0
answers
40
views
Having trouble with manipulating objects for simple operations with two fractions
I am creating a code that I want to test using jUnit testing. I want to do basic operations between two fractions such as addition, subtraction, multiplication, and division. I am having trouble ...
2
votes
1
answer
127
views
Map nested array values to Map with functionality to set Map values by array index which will be reflected in nested array by reference
Given the requirement to create a nested array or arbitrary depth, where the basic data structure is
[0, [1, [2, [3 /* , [N, [N+1, [..]]] */]]]]
or
["a", ["b", ["c", ["d" /* , [N, [N+1, [..]]] */]]...
2
votes
3
answers
2k
views
How to fix 'Objects are not valid as a React child'
Codesandbox link.
I'm getting this error when trying to use filter() through a big array of objects (defined as 'filteredCharacters'), and render only those match the id of '6' to the screen (only ...
2
votes
1
answer
63
views
How to return specific Json part as independent object?
I have Json object as shown below:
{
id : 0,
cnt: 1,
someStuff : 'lalala',
1: {
id : 1,
cnt: 2,
someStuff : 'allgood',
1: {
id : 2,
cnt: 0,
someStuff: 'nice'
...
-3
votes
2
answers
36
views
What am i doing wrong with this object method? [duplicate]
I'm trying to learn javascript objects, starting with a very basic object and I cant get it to work. Can anyone tell me why the last console.log() comes back "undefined" instead of "Bill"??
const ...
2
votes
2
answers
120
views
Resize 2d array immutably
Demo: https://jsfiddle.net/yxm9d4L0/2/
Given a 2D 3x3 array:
let arr = [
[null, null, null],
[null, {'hello': 'world'}, null],
[null, null, null]
]
and new sizes greater than current ...
0
votes
0
answers
35
views
Javascript revive destroyed object in window
Let's say that I delete a default window object/class/property like:
delete window.WebSocket
I know I can do:
nw=window.open('');
WebSocket = nw.WebSocket;
nw.close();
The question is:
is it ...
0
votes
2
answers
32
views
Playing with getter function in a js object, why my code doesn't work?
I wrote the followning code in the chromeconsole and when I hit enter it returns me the following error:
Uncaught SyntaxError: Invalid shorthand property initializer
Why?
let obj = {
p1=1,
p2=...
0
votes
0
answers
23
views
PHP overwrites an object that isn't referenced, neither do I want to alter it - just copy data [duplicate]
I've never had an issue like this before - in any language in fact.
I have an object originally from JSON. I don't want to alter this object, and will use it merely as a copy for various purposes.
...
0
votes
1
answer
52
views
str not a callable object python
I am a bit curious as to why my code is causing this error? Can someone show me some insight as a way to fix this and the reason it is raising it?
Error:
chunk += " " (16 - len(chunk) % 16)
...
2
votes
3
answers
1k
views
Why won't my images appear on the canvas?
I want to draw many different sized circles with the same image on them using a prototype. The problem is, the circles don't appear with the images drawn on them.
The circles are still there because ...
1
vote
1
answer
94
views
Console Log behaviour - Cannot read Object property
I'm building an angular web app.
In the ngOnInit of the component:
public ngOnInit() {
this.log.debug("INSTANCE", this.Instance);
this.log.debug("ACTIVITY",this.Instance.entity);
this....
1
vote
2
answers
291
views
What is this code's constructor doing?
I'm not getting what's happening in the below code. Why constructor function is enclosed inside another function and why both constructor and the function in which it is enclosed have given the same ...