Skip to main content

All Questions

Tagged with
3 votes
1 answer
91 views

Merge discrete integer intervals

What it does The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
FromTheStackAndBack's user avatar
1 vote
1 answer
140 views

Transform an array into object and set index for an unique key in javascript

I have a method that merges keys and indexes from an array into an object. I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler. Goal get an array of objects ...
wittgenstein's user avatar
2 votes
1 answer
389 views

Generating random number of randomly sized Squares/Rectangles using numpy arrays

I made classes to use in generating square/rectangular shapes on a texture. ...
Nyos's user avatar
  • 21
1 vote
1 answer
418 views

Best way to cherry pick objects from array of objects

With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
Álvaro's user avatar
  • 177
2 votes
2 answers
125 views

Complex Filter in one Opration

I am working on a Data-based application. I wrote a code to filter the table. The table has String and Numbers. I some filter ...
Rohit Nishad's user avatar
2 votes
0 answers
54 views

editing the array I've included instead of editing the file of included array php

In order to reduce time complexity, instead of loading (and then dumping to use it for later) the whole file into an array (It would be O(n) with n=number of lines), I have saved it as array into a ...
Matteo's user avatar
  • 21
6 votes
2 answers
503 views

Usage of Factory pattern for maintaing bookshelf having books, magazine and notes

I have tried to achieve the following task using Factory Pattern with PHP version 7.0. Define the classes and their methods (including parameters and return types) for a system that consist of a ...
ashofphoenix's user avatar
2 votes
2 answers
47 views

Combine data from array of objects

I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new ...
Álvaro's user avatar
  • 177
1 vote
2 answers
767 views

Recursively find data in array of objects

On this script I look up properties in an array of objects. There is an original array of strings list to get the objects that match the ...
Álvaro's user avatar
  • 177
1 vote
1 answer
4k views

Add / Overwrite an object in an array

I am trying to overwrite an object in an array if the title property exists, otherwise just push it to the array. I found two approaches and I wonder which one is ...
Álvaro's user avatar
  • 177
6 votes
1 answer
357 views

JavaScript: A drawing program in OOP

I made a little drawing program in OOP. The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each ...
Joji's user avatar
  • 325
1 vote
1 answer
105 views

JavaScript, looping, and functional approach

Data Structure coming back from the server ...
FNMT8L9IN82's user avatar
5 votes
1 answer
12k views

React hooks update array of object

I have declared a react hook which will contain an array of object as follows: const [rowDataTracker, setRowDataTracker] = useState([]); Now I need to update the ...
kukuha's user avatar
  • 53
3 votes
1 answer
55 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
Nɪsʜᴀɴᴛʜ ॐ's user avatar
2 votes
2 answers
315 views

Console dice game

I wrote a simple dice game with the purpose to practice arrays and classes. I would like some critique on my code structure and quality - as well as thoughts on my thoughts to improve it. Here's the ...
shaggy's user avatar
  • 41

15 30 50 per page
1
2 3 4 5