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.

0
votes
5answers
44 views

How to filter data with lodash

I have code as follows: data = [ {id: "15130", state: "INITIAL"}, {id: "15129", state: "LOCKED"}, {id: "10314", state: "APPROVED"}, {id: "51", state: "APPROVED"}, {id: "10313", state: "...
0
votes
0answers
18 views

Hi, using Java how can i return a 2D character array from a method that is taking in a String? [duplicate]

I am attempting to print out a 2D array in a main class by passing a string through the isValidTicTacToeBoardString(String str) that shows a board of X's and O's (tic tac toe) by using a string. Any ...
-2
votes
2answers
33 views

object index sorting in javascript

I would like to sort the object indexing like array.sort Input is "a":{"label":"0",isEnabled":false,"status":1}, "1":{"label":"1",isEnabled":false,"status":1}, "$":{"label":"2",isEnabled":false,"...
0
votes
3answers
38 views

Count the occurence of each words in a string and put it in an object

I need to get the total count of each word in a string . I wanted to achieve it using reducer since i am a beginner in the reduce method i could not solve it . getWordOccurence = (str1) => { ...
0
votes
1answer
39 views

Irritating object keys and there values from 1 line of an object with es6?

I have a object with one line of keys and there values. I am trying to map these keys and display the values. productObj = {id:0, name:"toy", price:10, description:null, inventory:7 } ...
0
votes
0answers
11 views

Changing a value in a matrix then adding to a stack but two values added are the same in stack?

So I'm trying to load up my Stack which is just the regular implementation used for a Stack as in it's a list and when I add I use the append function. I'm trying to add two matrices each differs by ...
-1
votes
0answers
18 views

Why am I not getting content of HttpErrorResponse object? 500 error unauthorized

Goal: I want to know why I am getting a 500 error for a specific method in my C# WebApi that is used in my Angular app. Calls to the API work for others methods/controllers. Background: I have a ...
0
votes
1answer
20 views

Bracket Notation is Accessing Object With Quotation Marks

I'm accessing an object using bracket notation in javascript. For some reason it's placing the value with quotation marks... NOT what I want. console.log(positions) { element: null, ...
0
votes
0answers
40 views

Understanding pointers in java [duplicate]

I'm a first year IT student and I'm working on some queue implementations in Java. I have a question about pointers in Java, specifically the "this.x" where "x" is the object in hand.(If this. isn't a ...
0
votes
0answers
30 views

How to add model objects into an array in Laravel? [on hold]

I have made a model in Laravel called customField, a user can add custom fields. The Resource/CRUD controller works fine. normally you can just do $customFields = customField::all(); to make an array ...
0
votes
4answers
48 views

Why cannot we have constructor with name different from class names as long as they are unique

I understand that Java imposes a restriction that class name should be same as constructor name. Why is this restriction imposed? Why cannot I have a constructor of the class with a different name ...
3
votes
3answers
49 views

Write a nested filter in one line

Assume this const someList = Immutable.fromJS([ {'id': 2, foo: 'puppet'}, {'id': 4, foo: 'kitten'} ]); //Then I filter like so const entry = someList.filter(elem => { return ...
1
vote
1answer
16 views

How to Omit “DELETE” many properties from an Object?

I have two methods that return the following types Pick<T, K> and Omit<T, K> where Omit is type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>. I have some ...
0
votes
0answers
24 views

Removing object from game in Java

i have a class called "Handler" which is full of getters and setters and it includes in it code which adds and removes object, it looks like this: public void addObject (GameObject object) { ...
-4
votes
1answer
34 views

How to convert class objects to named tuples?

I really want to use namedtuples instead of class objects class objects class ZoneFileObject(object): def __init__( self, descriptor='', name='', ...
1
vote
2answers
35 views

Why I recive this message “this.getNewsFeedLook is not a function”, when that is a function [duplicate]

I knew there is a lot of articles about this theme, but I wanna know about my code, why this.getNewsFeedLook() Is it not a function? define(["jquery"], function ($) { let objectNews = { ...
0
votes
1answer
29 views

I want to calculate all of the values of the previous month and compare them to the current month

I'm using laravel for my backend and vue components to build my frontend. My goal is to grab all the data from the totals table with the type of: 'tips' and compare my current month of entries to my ...
2
votes
3answers
58 views

Matlab method as a property

Is there a way to write a Matlab class that has one of its own methods as a property? I'm writing simulation code in which the class's method (which is effectively a physics equation) might change in ...
1
vote
2answers
45 views

Counting occurrence of values in an array of objects in another array of objects

I need to create a Graphql query that outputs data from two arrays of objects. The arrays are: const authors = [ { name: 'Robert Martin', id: 'afa51ab0-344d-11e9-a414-719c6709cf3e',...
0
votes
2answers
50 views

How to overcome foreach loop for list object dynamically

I'm swapping my values in List Object on some conditions and update List Object value. Currently, what I'm doing is - Looping on each object through List - Check If condition is net - Swap values ...
1
vote
2answers
57 views

How to prototype on object instance that is not Object or Function?

Extending Object class is not recommended, so I try to extend an object, for example: var obj = {'a': 1, 'b': 2, 'c': 3}; Here the object literal {'a': 1, 'b': 2, 'c': 3} is same as new Object({'a': ...
0
votes
2answers
68 views

How do I merge two objects in Java?

For my homework assignment I need to merge two objects in Java. I have to create a method void mergeTrains(Train other) that will add all of the locomotives and cars from the other train to the ...
2
votes
1answer
29 views

What does classname functionname(const classname & objectname) means?

I have an assigment where we should do resistor calculations (series and parallel) using the following class : class R1 { protected: double R , cost_in_euro ; string unit ; public : R1(...
0
votes
3answers
27 views

created a hash and when using length function it is returning undefined

Following is code to generate a hash and now I am trying to iterate over hash but no luck let intArr = [2, 2, 3, 4, 4, 3, 3] let cntArr = {}; for (let index in intArr) { cntArr[intArr[...
1
vote
2answers
53 views

Pointer to vector of objects losing their value

I have a project I've been developing for my master's thesis. In this project, I have a parent class called node and some other children classes, for example, the class AND. And I also have a class ...
0
votes
6answers
42 views

Get last value of a continuous repeated property in object

I have this array of transactions: const transactions = [ { service: 'Some Text Assignment #1', phase: 'Assignment' }, { service: 'Some Text Processing #1', phase: 'Processing' ...
0
votes
4answers
45 views

How to use lodash filter and map in one string

I have code which use 2 lodash method filter and map const filtered_holidays = filter(holidays, day => day.holiday === 1); const type_calendar_holidays = map(filtered_holidays, 'day'); How to ...
1
vote
1answer
40 views

Python - How to replace boolean value if less than a certain number?

Working on creating my own objects and classes, and am attempting to write a method that will check a number from an object and if found to be less than 50, it will replace the boolean value for ...
0
votes
1answer
15 views

Python Object should pretend to be None or empty

I have a python class that has certain values. This class is just a wrapper class that is used as a datacontainer inside another class object. When I have any variable in python, I can check if it ...
1
vote
1answer
83 views

How to tell which key called a function in javascript

If I have an object with multiple keys calling the same function and this function is implemented outside its scope, how to determine which key called this function? For example: function tellYourAge(...
-1
votes
1answer
19 views

How can i print a list object and get a list without ' '?

I mean, if I have the list objects ['hello' , 'how', 'are', 'you'] and I want to convert to [hello, how, are, you]. Thanks!
1
vote
0answers
33 views

Can't get an information inside an response object

I'm loading a saved search and trying to get some specific information from the results. I've tried many ways to get and handle the results, some of them worked, but not automatically. Worked ...
0
votes
1answer
41 views

Combining arraylists of different object types into one

I have some arraylists which contain objects (for a paint like program) based on a constructor in a class, and wish to put them all in the same arraylist rather so each item redraws in order. ive ...
0
votes
0answers
42 views

What is the difference in copying obj like obj1(obj2) and obj1 = obj2 in C++. Assuming copy constructor is defined in the program [duplicate]

I am learning and using copy constructors for my project and I got confused by the two types of creating objects which will call copy constructors. I want to know the difference between these two ...
0
votes
2answers
29 views

How can I filter empty values from an object in PHP [duplicate]

I am trying to filter out empty entries in an object. For example an object like this: stdClass Object ( [maten0] => stdClass Object ( [XXS] => [XS] => ...
0
votes
0answers
10 views

Copy object to objectCopy

I try to copy object to objectCopy. How to do that ? Object obj = new Object(); org.omg.CORBA.ORB orb = null; Object objCopy = Util.copyObject(obj, orb); Orb is null, that is why this operation ...
8
votes
6answers
206 views

Create new array with two columns from old array

I have an array as follows: items = [ {"year": 2010, "month": 11, "day":23} {"year": 2009, "month": 10, "day":15} {"year": 2009, "month": 10, "day":10} //added after my edit below ] I would like to ...
-1
votes
4answers
56 views

How to split an array to separate subsequent similar items in JavaScript

I have an array like this var array = [ { category: 'smart phone', name: 'Samsung Galaxy Note 4', color: 'golden', index: '1' }, { category: 'smart phone', name: '...
0
votes
2answers
29 views

How to get row & cell in object

I have object from combobox.DataSource and I need to use DisplayMember and ValueMember inside the object or data source if I can. I want also to loop through this data and I don't know how because can'...
0
votes
1answer
48 views

Order in which properties are added to array.reduce() return object

Can anyone explain why the final output is the same in different uses of array.reduce() function? In the first instance, the sample array is reduced directly whereas, in the second example, the ...
0
votes
1answer
61 views

How to create a new property for an existing object?

I can't create a new property for an existing object. I have a feeling it's because of what the sequelize library returns when you call one of it's pre-built query methods. I tried to create the new ...
2
votes
0answers
50 views

Return an object method with the object context on JS (ES3)

I have this code: function Selector(){ this.name ='Selector'; this.select = function(fName){ return this[fName] } this.funcOne = function(arg){ console.log(arg + ...
0
votes
1answer
20 views

How to manage nested object with React Native State

I am trying to build a water reminder app. I have 4 screens and I am using react-navigation Home (that I allow users to increase their amount drink that day and display how much water they drunk) ...
-2
votes
3answers
57 views

what is a best way to replace undefined with 0 inside object?

here is example object: values inside object not actually called value1, value2, etc they all have different names data is data obtained from api. let object = { id: '1', gen: { value1: ...
0
votes
2answers
41 views

Add object and array for same properties

var obj = {x:{y: {a: 1, b:2}}, p: 11} var arr = [{x: {y: {c: 3}}},{x: {y: {d: 4}}}] it can be done by lodash merge(obj, ...arr) but I don't want to use lodash merge method outputObj = {x:{y: {a: 1, ...
0
votes
1answer
36 views

JS : Create a json with dynamic keys and values

Let's say i have 2 arrays of possible numerical values : var reg = [1000, 1010, 2050]; var ag = [100, 101, 102]; I want to create a object/json of the kind : [ 1000 : [100, 101], 1010 : [100, 101, ...
-3
votes
5answers
74 views

Cannot access keys inside Object [duplicate]

I'm trying to access the value of a key inside a Javascript object. My object currently looks like: const options = { "account.country": getCountry, "account.phone": getPhone, } When I console....
1
vote
4answers
57 views

Ignore null values while using .find()

I'm using javascript's .find() method to search for values in my array. I am getting the following error: Uncaught TypeError: Cannot read property 'toUpperCase' of null which is occurring at this line:...
1
vote
8answers
49 views

Javascript findIndex for duplicate values

JavaScript findIndex returns the very first finded index in case of duplicate values const arr = [{a: 10, b: 20, c: 30},{a: 15, b: 25, c: 32},{a: 10, b: 23, c: 350}] const index = arr.findIndex(...
1
vote
2answers
46 views

Postman test to check part of object value

I have a response in JSON, I would like to test part of the object value to ensure the file is in zip format Please find the JSON example code below: { "outputFile": "https://xxx.xxx.xxx/7896a007-...

http://mssss.yulina-kosm.ru