clone

Unit Testing a clone method with Moq in C#

I have some basic classes with cloning methods: public class SimpleClass { public int ValueA { get; set; } public string ValueB { get; set; } public ulong ValueC { get; set; } public SimpleClass TypedClone() { var item = new SimpleClass { ValueA = this.ValueA, ValueB = this....

What is the easiest way to clone a webservice?

I'm working on a project where we will be connecting to a Oracle webservice using .NET (c#). The only thing is that we will build our client from our office location, but our customer will not give us remote access to their web service (company policy, etc). So our solution was to visit our customer on-site and 'clone' their webservice ...

How can I automatically retain aliases when cloning a git repository?

I have a bunch of handy aliases set up in the config file for my git repository. I will occasionally clone this repository (e.g. onto my laptop), but the clone does not included any of the aliases I've set up, presumably because the clone does not copy the git config file where the aliases are stored. I would, however, like to have thes...

Are there any alternatives to implementing Clone in Java?

In my Java project, I have a vector of various types of Traders. These different types of traders are subclasses of the Trader class. Right now, I have a method that takes a Trader as an argument and stores it 50 or so times in the vector. I am having problems because storing the same object 50 times is just storing 50 references of the ...

how to add different clone objects to the HashTable in c#?

i pass a key and object to a class instaance that needs to clone that object and store it in hastable along with the key. How can i do it??? ...

Efficient cloning of cached objects

We have an application that performs comparisons on data objects to determine if one version of the object is different than another. Our application also does some extensive caching of these objects, and we've run into a bit of a performance issue when it comes to doing these comparisons. Here's the workflow: Data item 1 is the curre...

Cloning with generics

Once upon a time there was a class: public class Scope<C extends Cloneable & Comparable<C>> implements Comparable<Scope<C>>, Cloneable, Serializable { private C starts; private C ends; ... @SuppressWarnings("unchecked") @Override public Object clone() { Scope<C> scope; try { scope = (Scope<C>...

Can not clone mercurial (hg) repository via http.

I can't clone my repository via http: abort: 'http://MYREPO' does not appear to be an hg repository! Firstly, I created a new repo by hg init MYREPO followed by adding some file and commit. The dir with my repo is password protected but there is no sign of problem because of it, I tried both methods of cloning: (on my local machine) ...

Flash duplication of an Object - Cloning library?

This is probably a very simple question, I just don't have the foggiest how to go about it. I have an Object that I want to duplicate, and don't know how to go about it. Here's my attempt: var myObj = new ObjectClass(); var duplicate = myObj; duplicate = null; myObj.function(); // Error: Null reference The ObjectClass is very large, ...

how to clone a solidbrush in GDI+ C++

I am using gdi+ and c++. I have a question about SolidBrush. How To clone a SolidBrush? SolidBrush* oldBrush xxx; Brush* newBrush = oldBrush->Clone(); I found newBrush is a Brush Object. Which mean if I use dynamic_cast<SolidBrush>(newBursh), I will always get NULL. I read the .h file of gdi+ SolidBrush seems used Brush's virtual Clo...

Program Deployment and Cloning Environment

Hi... I'm developing a java program on my machine. When I want to test, I first try small test cases on my machine but then I want to run this program with real data. A small test would be to look at one file from the linux kernel and a "real" test would be to look at an entire kernel... But I would like to run multiple "real" tests at...

Jquery: draggable clone

Hello. When I make a draggable clone and drop it in a droppable I cannot drag it again. How do I do that. Secondly I can only figure out how to us .append to add the clone to the droppable. But then it snap to the top most left corner after any exsisting element and not the drop position. $(document).ready(function() { $("#containe...

Need File Input Element cloned from 1 form into another via PHP & Javascript

Ok, I have an in template function that get's submitted via method="POST". But I can't submit this normally, since this is all I want submitted, and there is already a tag defined above the code and than below the code, closing the form with that must remain there. Since, there is no way to have forms inside of forms, I am using Jav...

Implementing Clone() method in base class

Here's a Clone() implementation for my class: MyClass^ Clone(){ return gcnew MyClass(this->member1, this->member2); } Now I have about 10 classes derived from MyClass. The implementation is the same in each case. Owing to the fact that I need to call gcnew with the actual class name in each case, I am required to creat...

What's the most straightforward way to clone an empty, *bare* git repository?

I've just finished cruising the Google search results that contain all the email rants about how stupid it is that git can't clone an empty repository. Some kind soul even submitted a patch. Until git is upgraded, what is the simplest, most straightforward method to clone an empty, bare git repository? The ideal solution will support ...

jQuery: add clone to container

Hello. Is there other ways to add a cloned element to an container than: $(".product").draggable({ helper: 'clone' }); $("#container").append(ui.draggable.clone()); append just puts the element after the last element in #container. I want to decide where the position should be. ...

Is it possible to clone html element objects in JavaScript / JQuery?

Hi, i am looking for some tipps how to solve my problem. I habe a html element (like select box input field) in a table. Now i want to copy the object and generate a new one out of the copy, and that with JavaScript or jQuery. I think this should work somehow but i´m a little bit clueless at the moment. Something like this (pseudo co...

Java: Is clone() really ever used? What about defensive copying in getters/setters?

Do people practically ever use defensive getters/setters? To me, 99% of the time you intend for the object you set in another object to be a copy of the same object reference, and you intend for changes you make to it to also be made in the object it was set in. If you setDate(Date dt) and modify dt later, who cares? Unless I want some b...

Clone Java NamingEnumeration?

Hey Folks, Just wondering if there is a way to clone a NamingEnumeration in Java? My program searches an LDAP server for people and it can take a few seconds to complete. To get the number of results I am using the following: NamingEnumeration results = null; NamingEnumeration results2 = null; results = ctx.search("", "("+searchAt+"="...

How to copy an ancestor to a descendant

Let's say I have an animal and now I want to make it a dog. How do I go about doing this in java? Right now I have a constructor that looks like public Dog(Animal animal) { this.setProperty(animal.getProperty); ... } While this works, it's fragile. Any other suggestions? ...