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
21
votes
3 answers

Strange golang "append" behavior (overwriting values in slice)

I have this simple code: import "fmt" type Foo struct { val int } func main() { var a = make([]*Foo, 1) a[0] = &Foo{0} var b = [3]Foo{Foo{1}, Foo{2}, Foo{3}} for _, e := range b { a = append(a, &e) } for _, e…
Chao Sun
  • 655
  • 1
  • 6
  • 16
21
votes
2 answers

Append a 1d array to a 2d array in Numpy Python

I have a numpy 2D array [[1,2,3]]. I need to append a numpy 1D array,( say [4,5,6]) to it, so that it becomes [[1,2,3], [4,5,6]] This is easily possible using lists, where you just call append on the 2D list. But how do you do it in Numpy…
excavator
  • 393
  • 1
  • 5
  • 12
21
votes
4 answers

How do I replace lines in the middle of a file with Perl?

I am opening the file in append mode. I need to replace lines 2,3, and 4 in the file, and later I need to add the new data at the end of the file.
kkchaitu
  • 631
  • 2
  • 5
  • 24
21
votes
3 answers

Dynamic HTML5 Datalist

So I am having a bit of an issue getting my HTML5 Datalist to populate dynamically from a javascript array that is being populated from values of a key of an object that is being populated via rows in a MySQL database. Phew! MySQL Database => Table…
Rick Bross
  • 1,060
  • 3
  • 16
  • 39
21
votes
1 answer

Writing & Appending arrays of float to the only dataset in hdf5 file in C++

I am processing number of files, each processing of the file will output several thousand of arrays of float and I will store the data of all files in one huge dataset in a single hdf5 for further processing. The thing is currently I am confused…
Karl
  • 5,613
  • 13
  • 73
  • 107
21
votes
9 answers

jQuery append Google Adsense to div

I'm having issues with google adsense and it loading before my jQuery and killing my codes, so I thought I'd try to append the Google Adsense javascript to the appropriate div using the document ready function, here's the code I'm trying to…
SoulieBaby
  • 5,405
  • 25
  • 95
  • 145
20
votes
4 answers

Create a new list from a list when a certain condition is met

I want to make a new list from another list of words; when a certain condition of the word is met. In this case I want to add all words that have the length of 9 to a new list. I have used : resultReal = [y for y in resultVital if not len(y) <…
MSA
  • 203
  • 1
  • 2
  • 4
20
votes
2 answers

HTML Urls - how to append to the existing url

This is a stupidly easy question, however after searching for a long time I have yet to yield any results. My question is as follows. I have a webpage with the url http://domain.com/mypage/ladeda/ I have a link on this page. Page…
Thomas Clowes
  • 4,529
  • 8
  • 41
  • 73
20
votes
1 answer

Kotlin append to file

I absolutely new to Kotlin and seems I just can not get the append-to-file procedure. I have filename given by val path: String = ".....txt" I want a method in my class that takes line: String and appends it at the end of my file (on new line). My…
user3575511
  • 302
  • 1
  • 2
  • 8
20
votes
3 answers

Java overwriting an existing output file

My program is currently using FileOutputStream output = new FileOutputStream("output", true); A while loop creates the output file if it is not yet created and appends some data to this file for every iteration of the while loop using …
john stamos
  • 1,054
  • 5
  • 17
  • 36
19
votes
5 answers

jQuery DOM changes not appearing in view source

I have a simple question here. I know with jQuery you can dynamically append HTML elements in the DOM by doing stuff like $('').append('

Test

'); But my question is, why don't these elements actually appear visually in the code (when you View…
user765368
  • 19,590
  • 27
  • 96
  • 167
19
votes
2 answers

File Write - PrintStream append

I am trying to append some information into a text file, but the file only shows the last element written. There are many Engineers, but it prints to the file only the last element which is read. For example: Engineer e = new…
snnlankrdsm
  • 1,401
  • 5
  • 19
  • 29
19
votes
4 answers

jQuery: clone elements AND events

Whenever I use ajax to dynamically create new content, .clone(), append() etc, the new element looses any triggers and events I programmed =( After making copy, simple things that WORK on other elements like adding a class to , on the copied…
Omar
  • 11,783
  • 21
  • 84
  • 114
19
votes
5 answers

How to convert DataFrame.append() to pandas.concat()?

In pandas 1.4.0: append() was deprecated, and the docs say to use concat() instead. FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. Codeblock in question: def…
Stephen Stilwell
  • 518
  • 1
  • 5
  • 17
19
votes
2 answers

Append new data to partitioned parquet files

I am writing an ETL process where I will need to read hourly log files, partition the data, and save it. I am using Spark (in Databricks). The log files are CSV so I read them and apply a schema, then perform my transformations. My problem is, how…
Saman
  • 541
  • 2
  • 5
  • 11