splice

Join MS Word documents

What is the recommended strategy for in code to splice a set of MS Word documents together into one? Cheers Nik ...

How to remove an arbitrary element from a JavaScript array?

In my Google Maps application I can place markers on the map, and I keep a reference to each of the markers placed, along with some extra information in an array called markers. Adding markers is easy, I just push() the newly created object onto the array (markers.push(marker)); However, when it comes to removing an arbitrary marker fr...

Splicing a string indexed array in JavaScript

Gday All, I have a string indexed array that I would like to remove an item from. Consider the following example code: var arr = new Array(); arr[0] = "Zero"; arr[1] = "One"; arr[2] = "Two"; arr.splice(1, 1); for (var index in arr) document.writeln(arr[index] + " "); //This will write: Zer...

A better way to splice an arrray into an array in javascript

Is there a better way than this to splice an array into another array in javascript var string = 'theArray.splice('+start+', '+number+',"'+newItemsArray.join('","')+'");'; eval(string); ...

How can I use Linux's splice() function to copy a file to another file?

Hello--here's another question about splice(). I'm hoping to use it to copy files, and am trying to use two splice calls joined by a pipe like the example on splice's Wikipedia page. I wrote a simple test case which only tries to read the first 32K bytes from one file and write them to another: #define _GNU_SOURCE #include <fcntl.h> #in...

A question about JavaScript's slice and splice methods

I came across the following code: var f = function () { var args = Array.prototype.slice.call(arguments).splice(1); // some more code }; Basically, the result in args is an array that is a copy of the arguments without its first element. But what I can't understand exactly is why f's arguments (which is an object that holds...

Javascript splice not splicing

tl;dr; Even without my explanation one can look at the code below and the output and see something is fishy. Splice returns the index it spliced but the data remains in the array. So I have an object that's keyed almost like an array (0,1,2,3...etc). Each object key has an array value. The array is an array of objects. Here's a simp...

AS3: Splice two items in different places?

If I have an array private var temp:Array = [item1, item2, item3, item4, item5, item6, item7...etc]; and two variables for items in the array: private var firstPosition; private var secondPosition; Is there a way to remove BOTH items at once? Say, if firstPosition = item4, and secondPosition = item7...then firstPosition = temp[3...

Invalid argument when calling linux splice()

Hi 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 ( pipe( filedes ) < 0 ) { perror( "Kicha pipe" ); exit( EX...

splice() not working on correctly

I am setting a cookie for each navigation container that is clicked on. It sets an array that is joined and set the cookie value. if its clicked again then its removed from the array. It somehow buggy. It only splices after clicking on other elements. and then it behaves weird. It might be that splice is not the correct method Thanks...

javascript splice() indexing problem

I have to add some value to an array. Code for example : temp[0]=new Array("0","0"); temp[1]=new Array("0","0"); temp[2]=new Array("0","0"); temp[3]=new Array("0","0"); temp[4]=new Array("0","0"); vt=new Array("1","0"); temp.splice(3, 0, vt); temp.splice(4, 0, vt); temp[3][1]="R"; I expect this output : 1 - 0,0 2 - 0,0 3 - 0,...

(kind of) rotating and slicing elements of a container in C++

Hi, I have a std::vector that holds a Point struct (x,y,z and some other non-pointer types). These points are control points for drawing a bspline curve. I'm not having trouble drawing the curve, but complications arise when I have to close the curve, which involves adding control points (alredy existing inside the container) in certai...

Which file systems support splicing via Linux's splice(2)?

The man page for the splice system call says that splice may fail and set errno to EINVAL if: Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device Which file systems support splicing? ...

Determining whether a readable file descriptor is the read end of a pipe

I would like to use splice to zero-copy data from STDIN_FILENO to a file descriptor (which could be to a regular file, char or block device, FIFO, or anything that can be opened with open). In order to use splice, either the from file descriptor or to file descriptor must be the appropriate end of a pipe, so generally a pipe is created t...

Array splice throws error in IE

IE7 and IE8 are not letting me splice my array (Safari, Chrome, Firefox work): lzaCreateAd1.weatherArray = new Array(); var jWeatherIcon = $('.weatherIcon'); jWeatherIcon.bind('click', function (){ var targetID = $(this).attr('id') + 'Box', idVal = targetID.substr(5,1); var j...

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 TCP socket to be read from the other end of the socket. Here is the Perl program to test it: package test_pipes_2; use strict; use warnin...