Questions tagged [splice]

splice copies data between two file descriptors of which one must be a pipe. Effectively, this is equivalent to a userland function that performs a read/write operation to and from a kernel-owned buffer.

splice
135 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
608 views

Why splice with sockets cannot improve performance without DMA?

In Wikipedia's introduction to splice, I found: When using splice() with sockets, the network controller (NIC) must support DMA. When the NIC does not support DMA then splice() will not deliver any ...
sliter's user avatar
  • 1,083
3 votes
1 answer
137 views

Random splice image from image array and call function when array = empty

Currently I am trying to make a scratch card game using html, javascripts and css. The math random fucntion work well but i want to add splice and call function when array become empty. However it ...
Yi foong Chan's user avatar
3 votes
0 answers
607 views

how to implement splice_read for a character device file with uncached DMA buffer

I have a character device driver. It includes a 4MB coherent DMA buffer. The buffer is implemented as a ring buffer. I also implemente the splice_read call for the driver to improve the performance. ...
yun wang's user avatar
3 votes
0 answers
142 views

What are the semantics of splice(2) when the source file changes after splicing?

I'm trying to figure out the semantics of splice(2) (man page here). Let's say I've got a regular file on disk, and I want to write a portion of its current contents into a pipe (actually into /dev/...
jacobsa's user avatar
  • 6,117
2 votes
3 answers
1k views

How to remove empty arrays in a nested array/object?

I have an array of objects that have array within themselves. I want to loop through the object and delete any empty arrays that I have. The object is shown below: let a=[{children:[{children:[1,2]},{...
Hassan Raza's user avatar
2 votes
0 answers
62 views

Is syscall splice atomic if only PIPE_BUF bytes is copied?

I know that writing less than or equal to PIPE_BUF bytes to pipe is atomic. However there isn't any document on whether doing this using splice has the same behavior. I wonder is it guaranteed that ...
JiaHao Xu's user avatar
  • 2,588
2 votes
2 answers
75 views

Algorithm for sorting array of numbers into sets

I have a n array of n objects like so: [{'item1': 144}, {'item2': 0}, {'item3': 366}, {'item4': 15}, {'item6': 366}, {'item7': 19}, {'item8': 211}, {'item9': 121}] The item values are 0-n. ...
Rick Sanches's user avatar
2 votes
1 answer
771 views

using splice with socket may cause starvation

I'm writing a TCP proxy, using edge-triggered epoll to monitor fd, splice to transmit data. Here is the problem: How do I know the socket receive buffer is empty? For example, if you call read(2) ...
Nifury's user avatar
  • 65
2 votes
3 answers
206 views

Using splice with an array of strings

I have an array of strings. I want to ckhek if in the array there are strings of blanks only and remove them. To this purpose I've written the following code that trims the blanks and should then ...
Beppe's user avatar
  • 21
2 votes
0 answers
1k views

splice() from pipe to TCP buffered?

xpost from linuxquestions.org, sorry... I wrote a small test program to see if a simple proxy would benefit from using splice() but it always takes 200ms for the data that I spliced from a pipe to a ...
bennymack's user avatar
1 vote
0 answers
242 views

How to use the splice and binary search on the data to delete and search

I am trying to the splice method but it is not working properly want to delete one user but it is deleting 2. Also want to add the binary search button this is the requirement for binary search ...
KILLER's user avatar
  • 21
1 vote
1 answer
127 views

Re-use vmsplice buffer when not gifting to kernel

I am trying to understand how vmsplice works, especially when it comes to buffer re-use. In the example below, I have passed no flag so normally vmsplice should be blocking and the kernel is not "...
NougatRillettes's user avatar
1 vote
3 answers
275 views

Removing an element with splice getting error

I am solving problem in Codewars as a practice. I have a question which asks to remove a character if it is included in a string. In my case the character is '!'. My code is: function ...
tsetsko's user avatar
  • 43
1 vote
2 answers
82 views

How do I splice an item from a variable?

I feel like this should be so easy, but for the life of me I can't get it to work. Print Bill's salary from the my_list object shown below. my_list = [{'Tom': 20000, 'Bill': 12000}, ['car', 'laptop', '...
SHANNON NIX's user avatar
1 vote
1 answer
63 views

indexOf give alternate return from same value after using splice

I make a function that checks if an array has a certain value. If yes, then move it to the first element. If no, write that value as the first element. I use splice as a mean to both remove and add ...
Kuro DCupu's user avatar
1 vote
0 answers
128 views

Write to multiple file descriptors with minimal syscalls

I have a REST API that also serves SSE's to send events to clients. The expected load can be anywhere up to 10k concurrent. Luckily since the client never sends data we don't have to worry about ...
Killpot's user avatar
  • 125
1 vote
1 answer
89 views

Sequentially splice values in array

I'm trying to add data.addRows() positions in google.visualization.LineChart that needs multiple array of 2 values in one array, where first value need to be 0 to 127: /data.addRows([ [...
A.J. Hart's user avatar
  • 143
1 vote
0 answers
334 views

How can i fix this? Splice is not a function Vuex

I want to remove an Id in an array of id in events of the user in vuex. Here is the code my mutation REMOVE_USER_EVENT (state, payload) { state.user.events.splice(payload, 1) } it says splice ...
Peter Parker's user avatar
1 vote
3 answers
3k views

removing an index from an array of objects in react.js always removes the last index

I'm having an issue with removing an index from an array of objects in react.js. I have a table which displays the name and value of the data from the state. Each row will have a button to delete it ...
user2032522's user avatar
1 vote
1 answer
468 views

VueJS Typescript WebPack, impossible to remove object from array with splice or delete

i try to remove a object from array in vueJS but this is impossible. I tyr a lot of thing and read some solution on stackoverflow but nothing work for me. I have a fake list like this in my vue.html ...
Espinasse's user avatar
1 vote
4 answers
2k views

jQuery - remove items in array using splice, but return array with remaining items, not with the removed item

I'm having a major problem trying to do something that is very simple. I'm pushing elements into an array based on the value of a select element. I'm pushing elements in fine, but if the user changes ...
Ian's user avatar
  • 23
1 vote
2 answers
1k views

How to edit and delete from json after displayed to a page

Hello, I am extremely new to javascript and json and I am trying to edit and remove my JSON object from after it is displayed to the page. Here is my html enter code here <body> <!-- ...
user9083297's user avatar
1 vote
0 answers
28 views

Apply filter using AngularJS that eliminates some options in array

My e-commerce site sends back all options for USPS and UPS shipping + rates via an API. These are all the options a customer sees at checkout: US Postal Ground $XX.XX USPS Priority Mail Express 1-Day™...
Andy's user avatar
  • 21
1 vote
0 answers
66 views

fixed length Vector can be spliced without throwing an exception -- is this intentional?

According to Adobe documentation, if a Vector has been set to have a fixed length then fixed (Boolean) : Indicates whether the length property of the Vector can be changed. If the value is true, ...
jpwrunyan's user avatar
  • 530
1 vote
0 answers
283 views

Why does a custom splice function outperform native splice when the array size is lower than 3-5000?

I'm writing an implementation of A* path-finding for a game, and are trying to find the fastest way of inserting values into an array of integers. I've made a custom splice function, and tested it ...
LongInt's user avatar
  • 1,759
1 vote
1 answer
53 views

I think I am using the splice method incorrectly

I am trying to solve a problem and I have having a hard time getting the answer from my splice method. I am trying to pull out all the odd numbers from an array, put them in order, and place them back ...
jcs1977's user avatar
  • 245
1 vote
0 answers
330 views

AngularJS In ng-repeat splice the last object of an array and it removes the properties of a form tag

In my AngularJS app, I use ng-repeat to display rows of records. When the user removes the last record in the array, it removes the custom properties on the form tag. This is breaking all of the ...
CMLee's user avatar
  • 137
1 vote
1 answer
1k views

Angularjs splice array of objects inside of an object always removes last object

I have an object which contains an array of objects called "blocks": $scope.microsite = { images: [ {url: "https://unsplash.it/800/400/?image=20"}, {url: "https://unsplash.it/800/...
Mobiliseme's user avatar
1 vote
1 answer
1k views

Python Sound Splicing

I am working on a program that takes in an audio file, locates and then removes any silence from the file. At this point the program runs, but when we play the returned sound, it is simply a slowed ...
user3386133's user avatar
0 votes
1 answer
31 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 ...
Taariq Elliott's user avatar
0 votes
0 answers
24 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 ...
Mat's user avatar
  • 1
0 votes
1 answer
46 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 ...
Avissa Taghizadeh's user avatar
0 votes
0 answers
24 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 ...
nakulmatta's user avatar
0 votes
0 answers
62 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 ...
user's user avatar
  • 1
0 votes
0 answers
60 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 ...
Bismah Ghafoor's user avatar
0 votes
0 answers
87 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 ...
rawan's user avatar
  • 1
0 votes
1 answer
39 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,...
kim james's user avatar
0 votes
0 answers
31 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 ...
webdog's user avatar
  • 13
0 votes
0 answers
48 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'...
webdog's user avatar
  • 13
0 votes
1 answer
34 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 ...
Greyfrog's user avatar
  • 986
0 votes
0 answers
106 views

How can i drag and drop nested lists in React?

I have a list of items that can be dragged and dropped, and it's working fine. However, I'm having trouble dragging and dropping grouped elements across the index. The array comes as it is shown in ...
Leandro F.'s user avatar
0 votes
1 answer
55 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 ...
Ahmed Anwer's user avatar
0 votes
3 answers
49 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 ...
GrimmTVT's user avatar
0 votes
1 answer
43 views

What is the correct syntax for my 'if' logic in my Javascript code if there is nothing left to splice from an array?

I'm new to JavaScript coding and I'm drawing a blank on what to write for a particular eventuality. I'm writing a quiz for a coding course project. The quiz has 11 questions and the code is designed ...
Jon Slack's user avatar
0 votes
2 answers
54 views

Process array of objects to return least priced per product using JavaScript

Given an array of objects, containing products. A single object contains a single product offer. Products can have a identical productId, while offerId are unique for each product. Process the data to ...
d4nospice's user avatar
0 votes
2 answers
34 views

Push spliced array to empty array in JavaScript

I want to iterate over an array and consecutively push them into another array after adding the first n numbers: let arr = [] let iniArr = [...Array(9).keys()].map(item=>1) let push = iniArr.slice(...
József Kiss's user avatar
0 votes
1 answer
28 views

Does anyone know the meaning and what he makes?

I don't know what this [0] in the mudarPosicao function, can someone explain it to me? var array = ["CAIO", "ARIADNE", "LETICIA", "SOFIA", "ENRIQUE", &...
Jorge Lucas's user avatar
0 votes
1 answer
170 views

Javascript Array.splice stopped working correctly in my Angular project

I was working on a project in Angular 4 and needed to batch through an array of ids. I would send the removed items to an Observable function, and when the subscription returned I would check the ...
kepcrom's user avatar
0 votes
0 answers
570 views

Scratch card game for e-commerce

This is a scratch card game I modify using script from https://jennamolby.com/interactive-scratch-and-win-landing-page-tutorial/ . I was trying to make a scratch card game that plan to use on a e-...
Yi foong Chan's user avatar
0 votes
0 answers
37 views

Online splice array progress

This is a javascript for a scratch card game. So far I want to make it to have one user can only scratch the game once. There are 3 var for example so it will be like after 3 seperate user scratch it, ...
Yi foong Chan's user avatar