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,157
questions
0
votes
0
answers
18
views
windows powershell causing compile error stating object does not exist [closed]
I created a simple hello world powershell script that when I attempt to run the script in the powershell i get this error
cd : Cannot find path 'C:\Users\JohnZalubski\destkop' because it does not ...
-3
votes
0
answers
37
views
my function that returns an object of methods keeps returning undefined (react-native) [duplicate]
while trying to make a document editor like word (it's a very basic editor) I tried to use classes but what I wanted didn't work and so I created a big function that returns 2 variables and a method ...
-4
votes
0
answers
51
views
JS convert array to object of objects [closed]
I want to create a function in Javascript to adapt my output for my component.
I have this input :
const t1 = [
"children1",
"children2-2",
"children3-1",
"...
0
votes
0
answers
14
views
Vuejs - Primevue - Filter the property of an array of object in a Datatable Column
I'm new to Primevue, Here is my exapmle:
User object :
User {
username: 'test',
email: '[email protected]',
id: 1,
role: {
id: 1,
name: 'Admin',
description:...
-6
votes
0
answers
62
views
Questions about object pointers and memory management [closed]
//test.h
#ifndef TEST_H_
#define TEST_H_
#include<iostream>
class ABC
{
private:
char mode;
public:
ABC(char m);
ABC(const ABC & a);
ABC(){mode='0';};
virtual ~...
1
vote
1
answer
26
views
How to subscribe to object node with OPCUA using Python?
I want to subscribe to an Object node in Python.
I want to output the values of variable nodes of the object node in datachange_notification. Is it possible?
If there is a way, please let me know.
I ...
0
votes
2
answers
41
views
Which method to use for Laravel Collection to find a Date between two DateTime
$period = new DatePeriod(
new DateTime('2024-03-20 00:00:00'),
new DateInterval('P1D'),
new DateTime('2024-03-28 23:59:59')
);
$suppliersInfo = OrderProduct::whereNotNull('brand')
-...
0
votes
0
answers
77
views
Do we need to clear class to prevent memory leak?
In the following script, this class is used to store a lot of Geojsons object (for google maps api):
class MapService {
private layers: Map<string, google.maps.Data> = new Map()
...
-1
votes
2
answers
40
views
keep getting TypeError: array.push is not a function when trying to push an object into an existing array with objects
I'm learning about localStorage and I'm trying to build a basic shopping cart function. The process is:
user clicks on "Add To Cart" button.
If localStorage("shoppingCart") doesn'...
-3
votes
0
answers
90
views
Returning a string vs returning an array in java [duplicate]
Consider below two code snippets showing java functions
Snip 1:
public String greet() {
return "hello";
}
Snip 2:
public String[] greetings() {
return new String[]{"hello", ...
-4
votes
0
answers
32
views
What is the difference between instance, object, class object and instance object in python? [closed]
I'm trying to get a clear understanding of some fundamental concepts in Python, specifically related to classes and objects. While I have a basic understanding, the terminology sometimes confuses me. ...
-3
votes
1
answer
58
views
Javascript Object Array, Iterate over only one object
I have a javascript array object. I want to find the result of a single array. The following code does what I want but always iterates over the whole array. How can I achieve the same on just one ...
0
votes
1
answer
47
views
Referencing an object in Rust
I'd like to reference an object slow_uart which was defined outside of the loop:
fn main() -> ! {
// .....
// Initializations
let slow_bdrate = <Rate<u32, 1, 1>>::Hz(...
0
votes
2
answers
52
views
Definition of the term "value of an object" in CPython
Is it possible to give a formal definition of the term "value of an object" in CPython? After briefly reading some reference articles and Python tutorials, I came to the conclusion that in ...
2
votes
1
answer
45
views
Scala initialization order object vs. val
In the following program an object is reported as null, even though it is clearly initialized.
class MyClass()
class MyOtherClass(c: MyClass)
object Foo {
val myClass = new MyClass()
object ...
0
votes
0
answers
11
views
property accessory containing everything in javascript [duplicate]
I have this kind of javascript property.
currencies.EUR.name: "Euro"
Between dot notation EUR could be something else like USD. With javascript how could I change that to something like ...
4
votes
1
answer
55
views
Behavior of object.__new__ Python dunder. What is happening under the hood?
I'm experimenting with metaprogramming in Python (CPython 3.10.13) and noticed some weird behavior with object.__new__ (well, weird to me, at least). Take a look at the following experiment (not ...
-4
votes
0
answers
36
views
javascript objects change menu options [closed]
with javascipt, how do you create an user menu with different options using an object a for loop and a switch?
Create 3 different cellPhones objects: cell1, cell2 and cell3
Every object has this ...
2
votes
2
answers
96
views
Is there a way to search an array of arrays for matching properties and if they match, make sure they aren't in adjacent positions?
I have been wracking my brain for a week on this problem and would appreciate any help or suggestions. I have a form that collects the users first name, last name and song. It stores those values in ...
1
vote
1
answer
32
views
How do I conditionally deep merge objects in JavaScript with multiple keys
The project I am working on is a trilingual dictionary. I have a database of words, and each word contains (among other things) an array of spelling variations and an array of objects representing ...
0
votes
2
answers
42
views
Filter array of object with another array of objects boolean property
i have dropdown values at frontend as follows. You can see the first 2 values Mar and May are checked based off the checked property in dropdownValues below.
let dropdownValues = [
{key: 'Mar', ...
1
vote
2
answers
97
views
Is Overriding Methods From An Object Possible? C++
I was wondering if it is possible to override a method of an object
ex:
class Object{
public:
void Foo(){
//do something
}
};
Object* obj = new Object();
obj->Foo() {
//do something else
}
...
0
votes
1
answer
31
views
Change and/or delete instances of a class by referencing them through variables [duplicate]
Sorry if this is a stupid question, but I think I'm missing some crucial knowledge on how classes work
in Python.
Say, for example, that I'm re-inventing the wheel by implementing a list data ...
-1
votes
0
answers
23
views
Pygame, object balloon won't move [duplicate]
I've written a program following a PDF which my teacher sent us to do over the summer (it is not a homework). However as I follow this through I encountered a problem where the balloons won't move. ( ...
0
votes
0
answers
7
views
Invoking a window getting selected text
I wanted to display a 'simpler' text to help supplement kids reading exercise. As an example - as an example the text may read :
Johnny went to school and he surreptitiously ate his lunch early. I ...
0
votes
3
answers
40
views
Removing an array object from main Object
I am trying to remove an array object based on value of array object property by using JSONATA transform function but the array object is not getting removed. If pmtDtls.lnAprvlStatus ='D', the object ...
0
votes
0
answers
30
views
Filter array of objects by comparing it with another array of objects [closed]
I have an array of objects coming from backend as shown below.
let input = [
{month: "Dec", count: "45"},
{month: "Mar", count: "12"},
{month: &...
0
votes
1
answer
16
views
Does python 3.12 allows to append items from the list to tuple, I am trying this but getting error TYPEERROR: 'tuple' object is not callable
Please find the below code, once I execute this code I am getting 'tuple' object is not callable error please give the solution, thanks in advance.
`mytuple = ("apple", "banana", &...
0
votes
2
answers
68
views
How do you Define and Call an object
Class Salesman has 3 attributes: salesman, sales_id, and years_worked.
I would like to define bonus, using the years_worked. I want to add "$" for each year worked.
How do I def bonus()?
...
0
votes
2
answers
75
views
Need advice returning an instance of object using a pointer - bad_alloc at memory location?
I'm having some trouble trying to return an instance from a list of instances from a function.
I have a set where I store instances of my Student class. I'm trying to return an instance from the "...
0
votes
0
answers
18
views
Matplotlib pyplot y-axis ticks label to get more distant
matplotlib, object api in use to plot, plot type step
Low cardinality of y-axis variable. Two ticks that level too close to each other - their labels are visually joined. Attaching the screenshot ...
0
votes
0
answers
12
views
How can I call a method within the same object literal where it's defined in JavaScript? [duplicate]
const objTest = {
testFunctionToDoubleAValue: (testParameter) => testParameter * 2,
testValue: 1,
testValueDoubled: testFunctionToDoubleAValue(1),
}
I tried to access a function inside the ...
0
votes
0
answers
9
views
Trying to create a new dive utilizing the keys of each object in an array of objects in local storage
I'm having trouble creating a new div for each object in the local storage array of objects. I have a form that's input values are added as objects into local storage, which holds an array of all the ...
-1
votes
0
answers
44
views
Functions involving other classes? [duplicate]
Currently I have two classes, the student and roster class. The roster class has an array of pointers that point towards the memory addresses of student class objects. Each student class has multiple ...
-3
votes
1
answer
34
views
HTML e JS use Simple Collapsible and include text form file togheter
i need idea for my problem.
I would like to use two combined functions in simple HTML.
Use the COLLAPSIBLE buttons to make a text imported from a TXT file appear... this is my code but it doesn't hide ...
1
vote
2
answers
260
views
How to dereference an object pointer?
Currently I have a student class and a roster class. The roster class is holding an array of pointers that point towards objects of the student class.
student* RosterArray[20];
cR.RosterArray[0] = &...
2
votes
1
answer
32
views
Extract JSON array from object (redshift)
I need to extract data from an array nested inside an object (let's say the column it lives in is metadata). It looks like the following:
{
"name": "abc",
"references&...
-3
votes
0
answers
32
views
Javascript add an object to an array of objects for a certain property [duplicate]
Sorry if the title is not properly worded. My question is this one, I have an array of objects:
[
{ "id": "11", "name": "First", "exercises": [] },
...
1
vote
1
answer
17
views
Django: Request object attributs options doesn't show up
I have started first time using django.
When creating a function view, I wanted to see what are the atributes of the object request (method, etc) and I excpected that VSC will show all options for ...
1
vote
2
answers
57
views
Can't dynamically import using "from x import y"
I am writing a function to check if the importing file/module contains any error. The function for some reasons failed when I use the module name as a variable.
Works
def importfile1():
try:
...
1
vote
0
answers
11
views
Filtering of keys of nested objects [duplicate]
I am trying to filter the keys of objects which are empty(i,e with value '') and if there is nested object with keys empty that should also get filtered. The method i am using is filtering keys at ...
0
votes
1
answer
43
views
Text from mongodbisn't being displayed to page
I'm making a chat app project and am having problems with displaying the data from my local mongoDB database to the page.
Specifically i'm trying to display the sender, message and timestamp which is ...
-3
votes
1
answer
96
views
Return type of a method in java and why use it? [closed]
interface Copyable{
Object copy();
}
class Book implements Copyable{
String bookName;
String bookID;
public Book(String bookName,String bookID){
this.bookID = bookID ;
...
0
votes
1
answer
34
views
Mapping through an object
I'm coding using javascript & react. I have an object named "rates" I'm trying to map through:
{
"M": {
"lab": {
"S": "50%"...
0
votes
0
answers
22
views
How To Change Property of an Object with a function [duplicate]
I'm currently trying to change the property of my Book object, here's the code:
const myLibrary = [];
function Book(title, author, pages, read) {
this.title = title;
this.author = author;
...
0
votes
1
answer
43
views
getting error when modifying the javascript property using Object.defineProperty()
obj = [{
prop11: 'value1',
prop21: 'value2'
},
{
prop12: 'value1',
prop22: 'value2'
},
{
key3: {}
}
];
obj.forEach(element => {
Object.defineProperty(obj.key3, '...
0
votes
0
answers
24
views
How can i list root objects JavaScript [duplicate]
So I have several objects and classes in my script tag
const Main = {}
const App = {}
class Game {}
let state = 777
etc. I'd like to list them.
I've tried
Object.keys(Object.getOwnPropertyDescriptors(...
-1
votes
1
answer
41
views
How come I'm running into an error after all the enemies are defeated, shouldn't it have ended?
I'm making a program using java, and the particular issue I ran into was in the battle method, where the program runs into an error after all the enemies are defeated. I tried to alter it a couple ...
0
votes
0
answers
30
views
Why are the handler values different for variables assigned reactive data within variables declared with computed() in Vue.js?
I am working on a project using Vue.js. In the code below, ListDataList is declared as a computed property, so it is called whenever the reactive data store.getters['management/banners'] assigned to ...
-2
votes
3
answers
93
views
How to instantiate an object in one class with arguments from another class? [duplicate]
I'm working on a program that uses 3 classes, one is the main driver, one is a Player class and one is a Roster class. The Player class has no default constructor and has an overloaded constructor ...