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 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.

The splice system call can be used to implement , as described in Zero-Copy in Linux with sendfile() and splice().

738 questions
6
votes
3 answers

Split array into overlapping chunks (moving subgroups)

There is a great question on how to split a JavaScript array into chunks. I'm currently using this for some statistical methods I'm writing and the answer that I'm using is as follows (although I chose not to extend the Array prototype like they…
mbeasley
  • 4,864
  • 5
  • 27
  • 39
5
votes
2 answers

DMA copy in splice()

I am new to linux kernel. And recently, i've went through the sendfile syscall in kernel 2.6.33. The following is the sequence of my journey: do_sendfile() => do_splice_direct() => splice_direct_to_actor() => do_splice_to() => do_splice_from() =>…
sliter
  • 1,063
  • 1
  • 17
  • 34
5
votes
3 answers

How to use splice in React Hooks

When I selected a ID in select box, I want to put a new name in the selected ID of the names array. I used useState and useRef, but "splice" dosen't work. I don't know how to pass the selected ID to splice function. It's so hard to me. Help me,…
나태욱
  • 51
  • 2
5
votes
4 answers

JS Array.splice return original Array and chain to it

I have a string with values like this a,b,c,d and want to remove a specific letter by index So here is what I did str.split(',').splice(1,1).toString() and this is (obviously) not working since splice is returning the values removed not the original…
Moses Schwartz
  • 2,857
  • 1
  • 20
  • 32
5
votes
2 answers

how to use splice in angular 5

I have created a table that displays data fetched from the database. The TS part that fetches the data looks something like: this._appService.getVisitData().subscribe((data) => { this.checkinTemp = data; // Calling the DT trigger to manually…
Atul Stha
  • 1,404
  • 8
  • 23
  • 46
5
votes
1 answer

Object.keys, slice and splice

So I am still learning arrays and objects, and I'm a little bit stuck. I made an example of array of objects: var something = {candy:[{name:"snickers", price:2}, {name:"bounty", price:3}, {name:"mars",…
Eleven11
  • 95
  • 1
  • 3
  • 6
5
votes
1 answer

splice can't remove the first element in javascript

In angular2, my HTML is calling removeThisForm in javascript. The event is an object of File Array. For each object in File Array, I generate a form in angular2. (click)=removeThisForm(event) In javascript, I am trying to remove the file that is…
Matt-pow
  • 946
  • 4
  • 18
  • 31
5
votes
6 answers

Alternative to array.splice in JavaScript

I am currently working on a project where I store numeric values in a JS array. After some changes it should be removed again. I currently use the array.splice method like this: function removeA(arr, element) { var index = arr.indexOf(element); …
nns
  • 61
  • 1
  • 1
  • 2
5
votes
6 answers

Java eqivalent method of "splice(a,b,...)" in JavaScript method

someArray.splice(a,b,...) method in JavaScript adds or removes items to/from array. What could be good and simple solution to implement such method in Java language? Assume we have String[] array.
Ernestas Gruodis
  • 8,567
  • 14
  • 55
  • 117
5
votes
2 answers

Invalid argument when calling linux splice()

I wanted to try out the splice syscall. I have this function - it should copy content of one file to another: static void test_splice( int in, int out ) { int i = 0, rcvd = 0; int filedes[2]; off_t off = 0; if (…
5
votes
3 answers

Is it possible to insert an element into the middle of an array in a MongoDB document?

Say I have a document in a mongo DB that looks like this: { pages: [ { elements: [ {id:1}, {id:2}, {id:3} ] }, { elements: [ …
brnt
  • 153
  • 2
  • 9
5
votes
2 answers

Do other operating systems implement the Linux system call splice?

In an application I am developing I use splice on Linux for socket-to-socket data transfer. Do other operating systems (specifically at least Windows, OS X and FreeBSD) implement splice or an equivalent solution? Is it possible to imitate…
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
4
votes
1 answer

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 performance improvement. The reason for this is…
sliter
  • 1,063
  • 1
  • 17
  • 34
4
votes
2 answers

Linux splice() returning EINVAL ("Invalid argument")

I'm trying to experiment with using splice (man 2 splice) to copy data from a UDP socket directly to a file. Unfortunately the first call to splice() returns EINVAL. The man page states: EINVAL Target file system doesn't support splicing; target…
bfallik-bamboom
  • 445
  • 5
  • 12
4
votes
4 answers

Python - regex - Splitting string before word

I am trying to split a string in python before a specific word. For example, I would like to split the following string before "path:". split string before "path:" input: "path:bte00250 Alanine, aspartate and glutamate metabolism path:bte00330…
Dyna
  • 71
  • 2
  • 5
1
2
3
49 50