64,993 questions
-4
votes
0
answers
48
views
How to filter an array of objects based on multiple properties in ES6? [duplicate]
I have spent time researching this on MDN and exploring similar questions on Stack Overflow. Most solutions cover static filtering (e.g., item.category === 'Web'), but my challenge is that the filters ...
1
vote
1
answer
82
views
How to validate attribute relative to another when instantiating class
From this answer and similar blog posts I've used the decorator method to do data validation when creating a class. But now I need to validate one attribute relative to another. E.g.:
class Planet:
...
Advice
0
votes
2
replies
76
views
How many JSON objects can you nestle into each other?
Just started learning JSON with C# and i was wondering how many objects you could nestle into another object?
My best guess would be 255.
Also, is this a common practice in actual websites? I have not ...
4
votes
2
answers
157
views
Get multiple indexes of an array at once, for comparison
I am working on a Tic_Tac_Toe project. I have an object (gameBoard) that contains an array, then I have another object that i want to create a player from to play on the board, then I have a function ...
Advice
0
votes
1
replies
81
views
Create an X word combination linked to a specific set of data
To start, here is an example:
When a messenger app wants you to share your contact information, they assign you a random 4-6 word combination (e.g. TIGER-TRUCK-FIRES-GHOST-TILES) that acts as a human ...
-2
votes
1
answer
144
views
Filtering array object that also returns indexes as well as the filtered result [closed]
I have the following code that contains an array of different book titles in subsequent objects. The code I have that filters the array is fine and returns the right information. However is there a ...
Best practices
0
votes
3
replies
70
views
javascript: `Object.create(null)` vs `{}`
Does const obj = Object.create(null) create less overhead than just const obj = {} ?
Maybe Object.create(null) even worse for performance?
If i don't need to have properties like hasOwnProperty from ...
Advice
0
votes
0
replies
58
views
how should I check effect of using ‘return as locator’ if its possible to track changes through column size after data insert?
Refer to object-relational-developers-guide/Nested Table Locators
‘For large child sets, the parent row and a locator to the child set
can be returned so that the child rows can be accessed on demand; ...
Advice
0
votes
3
replies
97
views
How to select ref OID without table object join when type is ref with OID?
Please see following statements and let me know is it possible to
have ref rowid same as other fields in mentioned select without adding
table object join which is t_tab_object here because ref is ...
Best practices
0
votes
5
replies
106
views
Option Array, locating and returning array with correct criteria
I have an object db that has one field containing SKU's that correspond to another object that contains different venues.
db.SKU = [1002,1005,1001,1008,1007];
I then have another object listing the ...
1
vote
1
answer
67
views
stripe php looping through metadata object issue
I am having problems getting the php 'foreach' to work with a Stripe object.
i can run the following command which gives me expected results:
error_log(gettype($event->data->object->metadata))...
7
votes
5
answers
912
views
Updating object properties with array elements
I have an object with nested properties. I want to update those nested properties by using an array of elements that reflect the nested sequence of the object. Also if a property does not exist, then ...
0
votes
0
answers
57
views
Required support for Detectron2 to ONNX conversion
Currently I am working on Object Detection model. I have trained a model, want to convert to ONNX format for real time inference and deploy in the field but I am unable to determine how to convert to ...
1
vote
1
answer
74
views
What does TCreate[keyof TCreate] mean in TypeScript?
I already know that that keyof TCreate produces literal union of its keys in the type TCreate. But I’m confused about what TCreate[keyof TCreate] represents.
Why do we write it this way?
How does it ...
1
vote
2
answers
237
views
how to change tag.data from Object(TagPigeon) to map
nfc_manager was recently updraded to 4.0.2. In the update, data types changed for NfcTag, as it previously was a Map<String,dynamic>, but is now an Object. I am now unable to obtain the ...
0
votes
4
answers
137
views
Number Array to Object conversion sorting the Object Keys in ascending order [closed]
I tried turn a Array of Number into an Object whose keys will be array Items and values will be true.
But i got this An object whose keys are arranged in ascending order. And The repeated No.s aren't ...
-2
votes
2
answers
99
views
Group an array of objects with a tolerance factor [closed]
I have an array of objects with a name and a value that looks like this (sorted by values):
var array = [
{ Name: "F", Value: 320 },
{ Name: "E", Value: 321 },
{ Name: ...
2
votes
1
answer
114
views
How to separate built-in object from user objects?
I'm trying to write a function TypeNameEx which will return a string which, using a call to VarType(), effectively identifies the type of a a (variant) variable, eg VarType 2 returns integer and ...
-4
votes
3
answers
112
views
Are There Hidden Dangers in Using for...in in JavaScript? [closed]
I wrote the algorithm below and asked an AI to evaluate my solution.
//TESTS:
console.log(firstNonRepeatingCharacter('abacabaz')) //c
console.log(firstNonRepeatingCharacter('aabbccdeefgghijj')) //d
...
1
vote
0
answers
29
views
Cannot index const object by known property in TypeScript [duplicate]
I have a complex but well-typed constant object such that no matter what the first and second level keys are, there is always a particular known key at the third level (in the example below, moons). ...
-2
votes
1
answer
93
views
js multiple loop - time deduction [closed]
I have an array of "shift times" and "absence times", and I'm trying to to subtract the absence time from the corresponding shift time via nested loop, to return the available ...
1
vote
3
answers
95
views
Scheme stack-like object
Trying to build a very simple stack structure :
(define (make-stack lst)
(lambda message
(case (car message)
((see) (newline) (write lst))
((empty?) (null? lst))
((push) (begin
...
1
vote
1
answer
74
views
How to override constructor of prototype/intercept object creation in JavaScript?
I would like to intercept all instance creations of EventSource. I tried the following code:
EventSource.prototype.constructor = function(url, config) {
EventSource(url, config);
console.log(&...
0
votes
0
answers
65
views
PHP Class Object Shopping Cart Data Storage Problem
H I am trying to store my shopping cart variables using Classes/Objects for integration with Klarna. The following code works great on testing but I now need the Cart (products) to be dynamically ...
1
vote
2
answers
190
views
Does the type information of an object also take up space in memory?
I'm trying to understand how type information is stored in memory.
We often say that an 8-bit value can store 2⁸ = 256 different values. But I'm wondering — when we create an object of that type, ...
2
votes
2
answers
54
views
How can I loop over object keys in Xel scripts?
I'm making a project with Xel, but I am stuck on a problem.
I want to loop through the keys of an object, and here's a minimal example of what I'm trying to get:
const strings = import("xel:...
1
vote
3
answers
129
views
How can I calculate the average amount spent per customer from an array of purchase objects in JavaScript?
I'm trying to calculate the average amount each customer has spent based on an array of purchase objects. Here's the sample data:
const purchases = [
{ customer: "Alice", amount: 250 },
{...
0
votes
1
answer
179
views
Make Min.IO on Kubernetes to send correct presigned URL to object lambda on knative
I'm having this trouble: I have a minio instance on kubernetes with my minio-dev.example.io dominio, I also have my object lambda to transform some files but this one is on Knative pod: http://object-...
-2
votes
1
answer
88
views
How to modify data before resolving a promise in Javascript [closed]
I have a database with text entries.
I want to search for the city name, and return the country.
I have an async function which returns a thenable promise.
getText('New').then(alert(result));
After ...
2
votes
2
answers
193
views
Where does the C standard say that an array is an object?
Reading the standard, I asked myself this question.Maybe I'm just being inattentive, or maybe the standard just doesn't say it directly.
The paragraph of the C17 standard(3.15 #1) says:
object
region ...
0
votes
1
answer
40
views
IndexedDB await get not returning an object
Working with IndexedDB, I have this code:
async function Get() {
const dataset=await db.result.transaction('Store1','readwrite').objectStore('Store1').get(5);
console.log(dataset);
}
I am expecting ...
-2
votes
2
answers
111
views
Get values inside JSON string
I have this JSON:
{
"result": {
"data": {
"getEstelam3Response": {
"return": {
"birthDate": "13650412",
...
0
votes
0
answers
42
views
DandB Company Standard Object Not Visible in My Salesforce Org
I have a main managed package org where fields from the standard DandBCompany object are included in the package. However, when I try to install this package in a new org, I receive an error stating ...
4
votes
2
answers
237
views
How can I prevent an object from being modified after it’s created in Java?
I’m trying to make sure an object can’t be modified after it’s created in Java. For example, in the class below, I can change the values of model and year using setters. But I want to prevent that and ...
-3
votes
3
answers
91
views
How to create list of class instances from a dictionary in python [closed]
I'm trying to refactor some code where I instantiate a lot of different classes and set their properties and wondered if I might be able to use a dictionary in some way.
Is it possible in python to ...
1
vote
1
answer
80
views
Clarification on Computed Properties [closed]
I’m studying TypeScript and came across this pattern:
type Animal = { [key: string]: number };
let Tiger: Animal = { legs: 4, age: 5, tail: 1, eyes :2 };
From what I understand, this allows adding ...
0
votes
1
answer
122
views
Creating a Map from Flatten in Terraform
Here is my issue - I have a locals code block like the below. I need to create a Map from these values (these values are used in multiple places)
locals {
object = {
1 = {
name = "...
1
vote
1
answer
268
views
Matching Card Game using JS
*{
box-sizing: border-box;
}
.clear {
clear: both;
}
section {
border: 1px solid black;
height: 200px;
width: 50%;
float: left;
}
<!DOCTYPE html>
<html lang="en">
<...
-2
votes
2
answers
95
views
How do I call the method from a class that creates other objects? [closed]
I have five classes. My Main class, a form class, two subclasses that extend the form class and a createForm class I am forced to use to create new instances of the subclass.
public class FormenFabrik ...
1
vote
1
answer
66
views
Attaching inner functions that use the same random number to related button click events js
I'm working on a game that will take a random object, and use that same random object for a series of questions/functions. I'm having trouble getting the next piece of code to run after clicking the &...
3
votes
0
answers
118
views
How to compare two Powershell objects, property by property?
I'm trying to compare to MECM outputs from $cmAppBefore = Get-CMApplication -LocalizedDisplayName $cmAppName | Select-Object * (to an after object). The objects returned are standard objects as well ...
4
votes
1
answer
83
views
C++ Makefile object file doesn't exist. It needs to be manually created
I have the following Makefile for building my C++ application :
SRC_DIR := ./src
OBJ_DIR := ./obj
INC_DIR := -I./include
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES := $(patsubst $(SRC_DIR)/%....
0
votes
1
answer
91
views
Access system object via a view whose owner is granted with grant option
I have created the following view in my database, my schema
CREATE VIEW [OMEGACA].[V_SYS_MANAGE_ACC]
AS
SELECT
name, object_id, parent_class, parent_class_desc, parent_id,
...
0
votes
0
answers
31
views
Constructor and datatype not matching in java [duplicate]
I'm relatively new to Java and object oriented programming, and I don't understand why sometimes the constructor used in declaring and object will be a subclass of the objects type instead of the ...
-3
votes
1
answer
101
views
Adding a Script to an Object from a list of Scripts during runtime in Unity
for the game I'm working on I had my groups write multiple scripts that I would be implementing into the project. Each script would contain the dialogue for the game. It was a rushed solution and very ...
0
votes
1
answer
99
views
How can I implement a bash function to read a JSON file, and assign all the data to variables, including arrays and objects? [duplicate]
I wanted to share a set of configuration data between powershell, python and bash. JSON is convenient for powershell and python, but bash does not have built-in support for JSON. Most bash JSON ...
1
vote
1
answer
65
views
Object is returning empty has some properties on expand it shows
I'm getting response as empty by checking Object.keys(response) it returns empty array but on expanding the response it looks like what shown below. Can someone help me to understand this?
This is the ...
1
vote
1
answer
114
views
Can't seem to change the values of variables in a class, keep getting the old values back
I've created a class with a couple of variables in it. I can read these variables from my functions just fine. I seem to be able to update them to new values, however when I try to get the new values ...
1
vote
1
answer
54
views
LibGDX orthographic camera movement using object?
In Java in LibGDX I'm trying to make my camera follow an object created by shaperenderer. I don't want to use a sprite, but can only find tutorials for sprites. Using spritebatch and such.
I just want ...
1
vote
2
answers
103
views
array.prototype is being applied to a non-array object (?)
I have a library with the following addition for Array types -
Array.prototype.top = function() {
return (this.length > 0) ? this[this.length-1] : null;
}
It seems to be applied to non-...