Questions tagged [append]

To append is to join or add on to the end of something.

Append is an operation usually defined on 1D data structures (e.g., , , , , etc.).
The append operation adds an element to the end of the data structure, consequently, increasing its size by one.

11138 questions
15
votes
2 answers

Capacity of slices in Go

I have a question about the below code package main import "fmt" func main() { var a []int printSlice("a", a) // append works on nil slices. a = append(a, 0) printSlice("a", a) // the slice grows as needed. a =…
Maksat Yalkabov
  • 548
  • 1
  • 8
  • 19
15
votes
1 answer

Could not convert javascript argument

After trying to append some code to a div layer I received the following error and don't know why. uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild]" nsresult: "0x80570009…
a11hard
  • 1,904
  • 4
  • 19
  • 41
15
votes
3 answers

Row bind Julia data frames

How do I append one data frame to another, akin to SQL's union or R's rbind? Say I have data frames A and B defined as follows. A = DataFrame(x = [1, 2, 3], y = [4, 5, 6]) B = DataFrame(x = [4, 5, 6], y = [7, 8, 9]) One way to approach this would…
Alex A.
  • 5,466
  • 4
  • 26
  • 56
15
votes
2 answers

python appending a value to a sublist

I'm running into a problem in my program and I'm not sure what I'm doing wrong. To start I created an empty list of lists. For example: >>> Lists = [[]]*12 which gives: >>> Lists [[], [], [], [], [], [], [], [], [], [], [], []] However, when…
user2165857
  • 2,530
  • 7
  • 27
  • 39
15
votes
1 answer

Appending a string variable to a fixed string in Perl

I have a variable that is entered at a prompt: my $name = <>; I want to append a fixed string '_one'to this (in a separate variable). E.g. if $name = Smith then it becomes 'Smith_one' I have tried several various ways which do not give me the…
dgBP
  • 1,681
  • 6
  • 27
  • 42
14
votes
3 answers

Trouble inserting a rails partial using JQuery

The following line of code: $("#comments_<%=@comment.post.id %>").append("<%= escape_javascript(render :partial => 'posts/comment', :locals => { :comment => @comment }) %>"); Is supposed to instert a partial as html inside the coments_xx div…
Diego Ocampo
  • 141
  • 1
  • 3
14
votes
5 answers

Write to the middle of an existing binary file c++

I'm trying to open a binary file for writing without erasing the content. But I do not want to write to eof. I want to write to a specific position in file. Here is a litte example: ofstream out("test.txt", ios::binary | ios::app); for(int i = 0; i…
Jonny Schubert
  • 1,393
  • 2
  • 18
  • 39
14
votes
3 answers

Pandas dataframe creating multiple rows at once via .loc

I can create a new row in a dataframe using .loc(): >>> df = pd.DataFrame({'a':[10, 20], 'b':[100,200]}, index='1 2'.split()) >>> df a b 1 10 100 2 20 200 >>> df.loc[3, 'a'] = 30 >>> df a b 1 10.0 100.0 2 20.0 200.0 3 30.0…
Zhang18
  • 4,800
  • 10
  • 50
  • 67
14
votes
3 answers

List manipulation performance in Haskell

I am currently learning Haskell and I am curious about the following: If I add an element to a list in Haskell, Haskell returns a (completely?) new list, and doesn't manipulate the original one. Now let's say I have a list of a million elements and…
Robin
  • 1,170
  • 1
  • 10
  • 21
14
votes
4 answers

Write to an existing file without overwriting what is in it using VB6?

I need to write to a text file to record a set of scores. Every time I write to the text file, it overwrites what was originally in the file. Can someone tell me how to not let it overwrite what is there or how to make it start writing in an empty…
Emma
  • 149
  • 1
  • 1
  • 3
14
votes
2 answers

Difference between put(...) and append(...) for a SparseArray?

I just want to know what is the difference between put(...) and append(...) for a SparseArray ? From the official documentation : append(...) : Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing…
Skyost
  • 1,429
  • 1
  • 16
  • 31
14
votes
4 answers

C++ - How to append a char to char*?

I've tried so may ways on the Internet to append a character to a char* but none of them seems to work. Here is one of my incomplete solution: char* appendCharToCharArray(char * array, char a) { char* ret = ""; if (array!="") { …
sonlexqt
  • 6,011
  • 5
  • 42
  • 58
14
votes
5 answers

Append to the top of a large file: bash

I have a nearly 3 GB file that I would like to add two lines to the top of. Every time I try to manually add these lines, vim and vi freeze up on the save (I let them try to save for about 10 minutes each). I was hoping that there would be a way to…
Stephopolis
  • 1,765
  • 9
  • 36
  • 65
14
votes
5 answers

jQuery and append without adding space

I have the code:
Menu 1Menu 2
Note: between the span tags don't have spaces. If I use: $('.message').append('Menu 3'); The append adds a space in the line. Is there any other…
André Golvea
  • 187
  • 2
  • 8
14
votes
3 answers

How to append strings to other strings in a data set?

I want to append several strings in a data set with custom strings. Example Content of Dataset: Test1 Test2 Test3 Result after appending: Test1.com Test2.com Test3.com Would I have to use regex to parse to the end of each Test[n] to be able to…
t1red
  • 175
  • 1
  • 2
  • 8