757
questions
2
votes
2
answers
102
views
How do I remove random elements in one-go from an array using splice in Perl?
I have an array as below :
my @arr = qw (ram sam ham dam yam fam lam cam)
I want to remove sam , yam and lam from the above array using splice.
I am using below code to do it :
# first getting the ...
0
votes
0
answers
34
views
Why is writing a file using Splice slower when done asynchronously?
I'm trying to make a program to write files efficiently from data received in a socket.
My approach here is to use the splice Linux syscall, so I made a quick program to do this, and then I tried ...
0
votes
1
answer
58
views
Split a array javascript using regular expressions
I am trying to split this array in 2 or 3 parts and stuck. This is what I have so far, if I use one of the splice lines it works but if I use all to test cases then does not. I want to:
grab ...
1
vote
1
answer
86
views
Common Lisp Looping: How did I force the loop macro not to iterate over its input list?
I wrote the code below (INFIX-LINKING-LEAFS - the last function - is the first caller with the loop). I'm sorry if it is too much code (five functions) for the purpose of answering my question. I ...
1
vote
0
answers
25
views
Excel Data input or Graph
how to visualize uniaxial cyclic loading 0→(ε=0.02↔ ε=-0.005) x20 cycleenter image description here
somewhat like this but strain control is 2% and -0.5%
stress strain graph for cyclic loading ...
-1
votes
1
answer
38
views
How to use toSpliced() without copying the type?
I want to try out the toSpliced() method:
const a = [1, 2] as const
const b = a.toSpliced(0, 1, 'hi')
This gives error: Argument of type '"hi"' is not assignable to parameter of type '1 | ...
0
votes
1
answer
39
views
best way to remove a word from an array in a react app
I'm working on a speed typing game using React and I have this function that removes the word from the array after it's either skipped or entered correctly. I think there's a better way to do it by ...
3
votes
3
answers
110
views
Based on a condition, how to remove an item from the processed array and move it to another array?
I have two arrays in my react component as follows ...
const [Selected, setSelected] = React.useState([]);
const [NonSelected, setNonSelected] = React.useState([]);
const Tmp_Selected = [
{ "...
0
votes
0
answers
27
views
Push quantity value to href query string on change event
I need to update an add to cart url every time the user selects an option from 4 select elements and push a quantity value at a specific index that matches an ID. The select elements all contain the ...
-1
votes
4
answers
99
views
Dose splice works when the second parameter is an array.length?
I want to implement a function that takes an array and some other arguments then removes the other arguments from that array.
So i used the rest parameter for the second argument then used Array.from ...
1
vote
1
answer
76
views
Google Apps Script splice method oddness
splice seems to be creating a dynamic relationship between spliced in elements and the elements they were spliced from ... ???
Say I have an array
Array = [ [1 , 2 , 3] ]
I want to duplicate this ...
0
votes
1
answer
49
views
deleteArrayElements(number = 6, startIndex = 0, everyIth =2) should delete every second element out of the first 6 elements of the passed array
Implement the function deleteArrayElements() that reads N elements from the array starting from the given start index i and deletes every x-th element within this sub-array. The parameter startIndex ...
0
votes
0
answers
31
views
Netty Splice operation not working in channelRead
I am using Splice Operation to transfer data from one inbound channel to outbound channel and vice versa using Splice operation to improve performance.
Inbound channel is between client and proxy ...
0
votes
1
answer
59
views
Vue Destroy Sortable Element
Summary
Create Panel, and add Layers to panel. When trying to delete a layer
the last layer in the panel is deleted, instead of the layer item
selected for destruction.
Full Issue:
Understanding ...
0
votes
4
answers
40
views
Javascript splice function not working when combining array elements together
I'm writing a calculator app. Buttons in html add elements to an array. When the user hits =, it will iterate through the array and combine numbers that have no mathematical symbol between them. ...
0
votes
0
answers
77
views
React Why I am getting Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'slice') Error?
I can delete dataValues without any problems, but when I try to delete dataCategories, I get the error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'slice'). The ...
0
votes
0
answers
67
views
how can you splice a string using a variable with defined indexes in Python?
I have 2 files, genomic_dna,txt and exons.txt.
The first file contains the genomic DNA sequence of interest and the second file contains the start and stop codons of the exons.
I want to import the ...
0
votes
0
answers
149
views
how to convert .ssj file or custom binary format video file into standard video file
I have a custom binary file with the .ssj extension, and I'm looking to convert it into a standard video format like MP4, AVI, or MKV. Unfortunately, there is no official documentation available for ...
2
votes
3
answers
75
views
Splice within for loop not removing selected indexes
If page reloaded, splice method returned [0]{'C'} instead of 0:{'B'}
todos = [0:{"title":"A"}, 1:{"title":"B"}, 2:{"title":"C"}] //store ...
0
votes
3
answers
79
views
Spilt items in a row to columns through pandas
I need to splits items in a row to columns on the occurence of '^' character.
This needs to done through pandas without a loop preferably
I have
0 A^
3 206-1C
4 502-2B
5 506-0.5C
6 604-1B
7 ...
0
votes
1
answer
57
views
In JS, does the result of const newArray = oldArray.splice(0) include elements added during execution?
In my JavaScript code, I have a line of code that looks like this:
const newArray = oldArray.splice(0);
My question is what happens when there are concurrent modifications to oldArray during the ...
0
votes
1
answer
38
views
Javascript Remove similar elements from an array when they match a value in another array, but only for the number of elements in 2nd array
Remove similar elements from an array when they match a value in another array, but only for the number of elements in 2nd array.
I have 2 arrays:
var items = [{quantity: 3, name: "test Item 1&...
2
votes
1
answer
1k
views
Zero copy in sockets
I am writing a network application that will transfer data between a pair of sockets.
Whenever some data is available in the source socket, it will transfer it to the destination socket and vice versa....
0
votes
1
answer
96
views
Remove, delete or turn null specific elements in a 2D array
I'm trying to utilize splice to create a copy of an array with the elements from a certain position determined by the position of the current cell in a spreadsheet and pass those on to the splice ...
0
votes
1
answer
31
views
splice objects from array and move those elements to a different element within array without mutating original
This code does kinda what I need but it mutates the original array and that is not what I want. I know this happens because I'm using splice and push.
This object has every day of the week as key and ...
0
votes
2
answers
129
views
how to remove specific numbers from a for loop in js
I'm trying too fix the problem I made a for loop that goes from 1 to 100. And I want too remove everything that haves 6 in it.
This is my code
var myarray = [];
for (var i = 1; i <= 100; i++) {
...
0
votes
1
answer
42
views
Splitting whole numbers into different cells
I'm trying to take a number and split it into other cells, so if the number is 12345 then in A1 should have 1, A2 - 2, A3 - 3, A4 - 4, A5 - 5
This is what I have so far though:
` for row in range(0,...
0
votes
0
answers
33
views
AS3 How to put a function within a Sprite and then hide the sprite?
I am a beginner programmer, making a snake game with some added features; there's a feature where I would like to remove 5 parts of the snake when it eats a certain food. So far with my attempts, i've ...
0
votes
0
answers
51
views
AS3 How to remove elements from an array using splice()
I am new to programming in general and making a snake game. I have three fruits in the stage, one for adding into the length of the snake using an push(), while the other will remove using splice(). I'...
0
votes
1
answer
37
views
Why this buffer array is 1 sample less the actual signal
I am trying to create an arrray (buffer_array) in which I push 1 sample at a time and when it gets full I remove first 50% and fill again with new sample.
I am basically using a random number to ...
0
votes
1
answer
63
views
my JavaScript todolist not deleting the last item remaining
when I add multiple items to this list, and then try to delete all, the last item remaining always stays on the page, any help?
I tried Splice() to delete each item when I click delete, and even ...
0
votes
1
answer
76
views
Delete item from array inside objects
How to delete items from an array inside objects.
It should remove all the hobbies that are dance.
I tried to use splice.
const people = [{
id: 1,
documents: [{
id: 1,
...
0
votes
3
answers
55
views
How to interchange an element between 2 arrays?
I've been trying to use the splice() and indexOf() methods on javascript for the first time, but I don't understand the parameters.
I'm trying to make a game. When you click a card, it goes up and ...
0
votes
0
answers
27
views
Splice not removing all matching elements in array [duplicate]
I want to remove every 1 in an array. The final answer should be:
[4, 0, 5, 2, 6, 7, 3, 5, 11, 9, 9]
But I get:
[4, 0, 5, 2, 6, 1, 7, 3, 5, 11, 9, 9]
My code:
<!DOCTYPE html>
<html lang=&...
-2
votes
3
answers
134
views
how to push into an index of an array without splice
splice is time complexity O(n);
I tried this version instead of splice:
which has added space complexity but i think less time complexity.
let arr = [0,1];
arr[5] = 5;
// i need to push ...
0
votes
2
answers
406
views
filtering a promise iterated result array into a new array vue js
How can I insert into a new arr promise values of an old array. A splice method required due to vue reactivity. Somehow the newArray is empty and not getting the any values.
https://codesandbox.io/s/...
1
vote
1
answer
73
views
Change Vue.js array's elements to opposite with splice
<template>
<div>
<div
v-for="(a, i) in arr"
:key="i"
:checked="a"
@...
1
vote
1
answer
39
views
Reactivity vue not rendering data with a method
<template>
<div
v-for="(a, i) in arr"
:key="i"
:checked="a"
@click="toggleItem(i)"
class="checkbox&...
2
votes
3
answers
584
views
UseEffect does not rerender when remove data out of an array only upon adding data does it rerender
import React, { useEffect, useState } from 'react'
import { HiOutlineBackspace } from "react-icons/hi";
import {MdOutlineCancel} from 'react-icons/md'
const Cart = ({toggleCart}) => {
...
0
votes
1
answer
55
views
test failes when 0 is next each other - Leetcode 283. Move Zeroes problem
I was working on the leetcode 283. move zeroes question but I got a weird test failure when there is 0 next to another 0.
Below is my code.
/**
* @param {number[]} nums
* @return {void} Do not ...
0
votes
3
answers
269
views
Erase first instance of a vowel
I'm trying to write a program that removes the first instance of each vowel from a string.
"the quick brown fox jumps over the lazy dog"
becomes
"th quck brwn fox jumps over the lzy dog&...
0
votes
1
answer
112
views
How do I use FileTemplate as a substitute for Splice to export Mathematica expressions into Fortran?
I found the Splice functionality in Mathematica quite useful in the past. I am trying to insert mathematica expressions, formatted for Fortran, into Fotran code.
Does anyone have a small working ...
-4
votes
1
answer
99
views
Why does the splice() array method always deletes all objects following the selected index in Javascript? [closed]
I'm currently studying Javascript and the teacher asked us to create a program that allows users to create, edit and delete hotels using object arrays.
I managed to created the showHotels() function ...
1
vote
1
answer
274
views
Need to find and remove the two next words from X in string
I am working on an assignment which I just cant figure out.
"Prompt the user for a positive integer. If it is, find the first word in the text which has the same length as the provided number (X)...
1
vote
5
answers
129
views
How can I remove items from an array having met specific conditions in-place?
I am working on what i thought is a simple algorithm:
Task: Look at the given array, take only the even numbers and multiply them by 2. The catch is to modify the array in its place and NOT create a ...
1
vote
3
answers
2k
views
remove elements from an array javascript
this the forth project from the odin project, all tests passed but the fifth one which required removing all elements failed and when i run the code it returns an array with half elements in original ...
1
vote
3
answers
92
views
Why isn’t splicing working for 2 consecutive elements? [duplicate]
I’m creating demonstration code for a presentation.
var fruitList = ["apple", "banana", "cherry", "durian", "elderberry", "fig", "grape&...
-2
votes
1
answer
86
views
Replacing set of elements in array with another one in JavaScript
I couldn't find here a solution here at Stackoverflow, in other case I am really sorry about duplicating similar problems.
Let's say, there is an string array:
let array = ["a", "b"...
0
votes
1
answer
34
views
Can you use a shallow copied variable in splice?
Apologies for the terrible title I didn't know how else to word it.
this is a kata im trying to complete in codeWars. Drone Fly-by.
basically the lamps parameter will be a string of 'x' characters and ...
0
votes
1
answer
691
views
ffmpeg split audio file into individual segments
I have a 00:15:24 length .mp3 file that I want to split up into three separate files, ideally using a txt file input like so:
segemnts.txt
00:00:00 00:04:55 seg1
00:04:55 00:08:41 seg2
00:08:41 00:15:...