Add content on to the beginning of something (usually a file).
Questions tagged [prepend]
497 questions
3
votes
2 answers
Running ruby method around existing specified method
I've got an existing library comprised of many services which all respond to the method execute each method does it's logic
class BaseService
def execute
raise NotImplementedError
end
end
class CreateUserService < BaseService
def…

skukx
- 617
- 5
- 15
3
votes
1 answer
Prepend a form field response in Angular 2
I'm building a registration form in Angular 2 that asks a user to provide their website's URL before submitting.
When the form is submitted, I need the provided URL to be in the style of "http://www.google.com". To steer the user towards that…

colinturner
- 31
- 2
3
votes
2 answers
How to PREPEND text to a file in Swift or Objective C?
Please note that I'm not asking how to append texts at the end of the file. I'm asking how to prepend texts to the beginning of file.
let handle = try FileHandle(forWritingTo: someFile)
//handle.seekToEndOfFile() // This is for…

7ball
- 2,183
- 4
- 26
- 61
3
votes
1 answer
How to monkey-patch an ActionView module via prepend?
If you include a module Foo in a class SomeClass, then prepend that module with another module Bar, any method-overwriting inside Bar will not take effect in SomeClass. Example:
module Foo
def some_method
puts 'In Foo'
end
end
class…

Alexander Popov
- 23,073
- 19
- 91
- 130
3
votes
1 answer
Automatically add prefix to custom exception
I'm quite iffy when it comes to C++ std:exception handling. Here's some sample code I found on the web, which I currently use.
class MyBaseException : public std::exception
{
public:
explicit MyBaseException(const std::string & message)
:…

ThermoX
- 277
- 3
- 11
3
votes
0 answers
Prepending to module that gets included/extended
I'm moving from using Module#alias_method_chain to Module#prepend.
But there is one situation where I cannot achieve the same functionality
Suppose I have a library code (two libraries actually, one of which enhances another)
# Library 1
object =…

Roman Usherenko
- 4,659
- 4
- 17
- 14
3
votes
3 answers
adding space in an output file with out having to read the entire thing first
Question: How do you write data to an already existing file at the beginning of the file with out writing over what's already there and with out reading the entire file into memory? (e.g. prepend)
Info:
I'm working on a project right now where the…

Narcolapser
- 5,895
- 15
- 46
- 56
3
votes
1 answer
Prepending this PHP File
I'm a little stuck attempting to prepend this document with PHP.
Please see below for the code itself.
" . "\r\n" . "" .…

GlenRitchie
- 85
- 5
3
votes
2 answers
jQuery Prepend an Image
I am trying to add a prepend of an image and then define it's attributes. Little confused as how to do this - currently I have the following but it's not working. The HTML is

Tom
- 305
- 1
- 4
- 6
3
votes
2 answers
C# Prepend 40 bytes onto stream
I am trying to send a FileStream of a file.
But I now want to add 40 byte Checksum to the start.
How can I do this? Ive tried creating my own stream class to concatinate two streams.. And Ive looked at stream writers.
Surely they must be an easy…

IAmGroot
- 13,760
- 18
- 84
- 154
3
votes
1 answer
error_log in the same directory as included files?
I've researched different methods and directives including:
auto_prepend_file
.user.ini files
getcwd()
debug_backtrace()
And I can't seem to find a way to change the path of the error_log to log in the same path as the file being…

DWils
- 390
- 1
- 4
- 16
3
votes
1 answer
Android: Prepend LinearLayout programmatically
I created a layout in my application that includes the followings:
main_layout (FrameLayout, fills whole screen)
-> includes: main_interface (LinearLayout, height/width fills parent)
Now I want to add another LinearLayout in the main_layout BEFORE…

Tobias Baumeister
- 2,107
- 3
- 21
- 36
3
votes
1 answer
Python: Generate new URLs for links stored in a string
I have dynamically-generated strings which contain HTML links. For example, the string might contain:
You can visit Stack Overflow or

sullivanmatt
- 740
- 7
- 15
3
votes
1 answer
using variable in prepend img src
I have a img source I'm trying to prepend but I'm trying to use the variable "id" in the source. I'm having trouble modifying this snippet of code to do that.
$('#photo_850').prepend('
');
thanks for helping me with this

loriensleafs
- 2,205
- 9
- 37
- 71
3
votes
2 answers