copy

Customizing how Python's `copy` module treats my objects

From the copy documentation: Classes can use the same interfaces to control copying that they use to control pickling. [...] In order for a class to define its own copy implementation, it can define special methods __copy__() and __deepcopy__() So which one is it? __setstate__() and __getstate__() that are used when pickl...

C# Copy file to folder with permissions

Hello, I'm writing a program that, among other things, needs to copy a particular file to a network folder. Since I'm on a company network, the credentials needed to access that folder are the same as my Windows credentials. The program works if I open the folder in Explorer, provide my username and password, and then run the uploader....

Stored Procedure Replication or copying (SQL Server)

Is it posible to replicate or copy the stored procedure easy from one SQL Server to an other? ...

"cp --parents" in batch file/VBScript

How would you write this having only batch files and VBScript at your disposal in a Windows environment? find -name '*.ext' -exec cp --parents {} destination/ \; Or put it this way: Look recursively in the current folder for some filename pattern (ending with an extension called ext in the example above), Copy each of these files to...

How to copy a list in Scala

I want to shallow copy a list in Scala. I wanted to do somehing like: val myList = List("foo", "bar") val myListCopy = myList.clone But the clone method is protected. ...

Javascript - Fastest way of copying an array portion into another

I need to copy FAST a portion of an array into another, replacing it's old values. No range checkings needed. Number of items to copy: 16384 The array only contains integers benchmark code: http://codebase.es/test/copytest.htm This is my approach: var i = 0x4000>>5; // loops count var j = 0x4000; // write start index var k...

Yank lines from one file in vi ( not vim ) to another?

I'm used to VIM and usually I split screen with and open another file, yank the text into the second one. However I'm dealing with a legacy server which only has vi, how could I either open multiple files with it if it doesn't support split views or copy text from one file to another ( 2 separate vim instances I guess ). I don't think ...

java: How to make defensive copy when you only have an interface

If an object takes a reference to another object, I know it can be a good idea to make a copy of the passed-in object to preserve encapsulation. But, what if all the object knows about the object passed in is that it implements an interface? For example, if I have an object that takes an implementation of FilenameFilter in its construc...

CI Server (CruiseControl, Nant, MSbuild) copy on success

Is there a way to copy files to a (temp directory on a) stageing server only if the build and the unit tests succeed? ...

How to copy an object in objective c

I need to deep copy a custom object that has objects of its own. I've been reading around and am a bit confused as to how to inherit NSCopying and how to use NSCopyObject. Could someone help me out? Thanks for reading! ...

Clone (deep copy) Entity LINQ

Hi, I would like to deep copy an Entity and I am looking for the best way to do it. I am also concerned about performances. I plan to have all my entities implementing ICloneable where Clone() will basically shadow copy and Clone all references. For instance: [DataContract()] class MyEntity { public int id; public strin...

Python ctypes: copying Structure's contents

I want to mimic a piece of C code in Python with ctypes, the code is something like: typedef struct { int x; int y; } point; void copy_point(point *a, point *b) { *a = *b; } in ctypes it's not possible to do the following: from ctypes import * class Point(Structure): _fields_ = [("x", c_int),("y", c_int)] def copy_point(a,...

Copy text to clipboard with iPhone SDK

Hi What is the best way to copy text to the iphone's clipboard in your application, their docs are sketchy and have way too many features than what i want... i just want to set a string as the users clipboard? Sample code would be so useful! ...

event + copy + iPhone

I want the event when user pressed on copy (pop up menu) in iPhone. ...

PHP page source copy

I need to write a script that goes to a page, copies the source of the page, and stores it as a string to be outputted withing another page. I'm forced to do this due to the fact that the target page is dynamic, and apparently we need static records of that page within our internal system. I know a limited amount of php. Can anyone poi...

malloc_error_break causing C++ SIGABRT

What is wrong with my code? (I'm trying to at least get copy a file with this code in XCode (OS X 10.6 Snow Leopard.) I keep on getting a SIGABRT with an malloc_error when running: Lesson 4(796) malloc: *** error for object 0x10000a8a0: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Here's th...

how to copy a column content from my local databse to main database??

i have same table at my local database and at my live-main database. I have to copy the content of a particular column from local to main not the whole table.How can i do that in mysql??? ...

copy constructors and base classes C++

Hi, I'd like to be able to initialize a derived class from a base class, like so: class X { public: X() : m(3) {} int m; }; class Y : public X { public: Y() {} Y(const & X a) : X(a) {} }; Is there anything dangerous or unusual by doing that? I want it because I'm deserializing a bunch of objects who's type I don't...

Copy from one register to another - VIM

How to copy the contents of one register to another without pasting on clip board? I'd yanked one text and it got yanked in the default " register. Now i wan't to copy another text without deleting/overwriting " register. So I wan't to move the contents of " register to say some a or b register so that I can copy the new text inside ". H...

How can I make this code work in IE?

Hi, There are many tables in my HTML page. When a user hovers on a table, it should be automatically selected(onmouseover event) so that the user can copy(Ctrl+v) it to clipboard. I searched for a way in stackoverflow and ended up with the following code. But it only works in Firefox (window.getSelection() doesn't work in IE). How can I...