clone

jQuery - exchange elements location

How to excange location to childrens of same parent? I solve using this pattern of code. Is there an easier way? For example something like this: $("#id1").exchange($("#id2")); <!DOCTYPE html> <html> <head> <style> button { display:block; margin:3px; color:red; width:200px; } </style> <script src="http://...

deep copy of doctrine record

I want to make a deep copy/clone of a doctrine record in a symfony project. The existing copy($deep)-method doesn't work properly with $deep=true. For an example let's have a look at a classroom lesson. This lesson has a start and end date and between them there are several breaks. This classroom is in a buildung. lesson-break is a one...

MySQL clone a table, prune some data and then hotswap their names

We have a 8 million row MySQL table. We want to prune about 2m rows from it, remove some outdated indexes and add new ones. To achieve almost no downtime, our plan is to create a clone of the table (and lock the original), run a script (Ruby) to prune the data that we don't need anymore and finally add the new indexes. Then we would p...

How to clone git repository with specific revision/changeset?

How can I clone git repository with specific revision/changeset? Something like I usually do in Mercurial: hg clone -r 3 /path/to/repository Thanks! ...

[C++] Clone abstract base class (without meddling with derived)

Hello all. I'm experiencing a challenging problem, which has not been solvable - hopefully until now. I'm developing my own framework and therefore trying to offer the user flexibility with all the code complexity under the hood. First of all I have an abstract base class which users can implement, obviously simplified: class IStateTr...

How do you clone a BufferedImage

Hi I have an object which has many bufferedimages in it, I want to create a new object copying all the bufferedimages into the new object, but these new images may be altered and i dont want the original object images to be altered by altering the new objects images. is that clear? Is this possible to do and can anyone suggest a good w...

Unity3D :Instantiate?

How do you create a copy of an object upon mouse click in Unity3D? And also, how could I select the object to be cloned during runtime? (mouse selection preferable) Thanks in advance ...

Deep cloning Moose object with attributes that are ArrayRef[Object] and Set::Object

I've got a Moose object: class My::Game { has 'players' => (isa => 'Set::Object', ...) has 'action_sequence' => (isa => 'ArrayRef[My::Game::Action]', ...) } Now I want to be able to clone this object with a call like $game2 = $game->clone; How do I deep clone it so that the objects in the ArrayRef are cloned? And more trickily, th...

jquery clone doesn't seem to retain draggable/droppable events

Hi there, I have a row where I can drag items into it, and sort them. This all works ok. I even have a delete event on each item, so it can be removed from the row. I want an option where I can clone the row. I do this by using the clone function below: clonedrow = $("#row1").clone(true); clonedid = "row"+nextRowNumber; //nextRowNumbe...

Suggestions on Spidering/Cloning an annoying website, logins/ javascript to transverse

A friend of mine wants to collect data from an website. I recommended that spidering would be a fast way of automating the process. But when I saw the website, I found that it wasn't so simple at all. First a login with a captcha thwarts most spidering software, there is no way that I can manually log in and use the cookie to get all ot...

How to write handles for classes that don't have clone() member?

I'm following an example in Accelerated C++ and writing a simple Handle class that will act as a smart pointer. This uses the virtual ctor idiom using a virtual clone() function. So far so good. But what to do when I want to use my Handle for classes that I don't control that don't provide clone()? The method suggested in the book is to...

In PHP can someone explain cloning vs pointer reference?

To begin with, I understand programming and objects, but the following doesn't make much sense to me in PHP. In PHP we use the & operator to retrieve a reference to a variable. I understand a reference as being a way to refer to the same 'thing' with a different variable. If I say for example $b = 1; $a =& $b; $a = 3; echo $b; will...

What is the difference between pull and clone in git?

What is the difference between doing: mkdir repo cd repo git init git remote add origin git://github.com/cmcculloh/repo.git git fetch --all git pull origin master and git clone git://github.com/cmcculloh/repo.git I mean, obviously one is shorter, but other than that are they basically doing the same thing? ...

jQuery: Finding cloned child in cloned parent?

Let's say I have this jQuery extension method: $.fn.foobar = function() { var clone = this.parent().clone(); }; After I've gotten clone, how can I find the cloned child element that is the same as this? Will this work? $.fn.foobar = function() { var clone = this.parent().clone(); var cloneOfThis = clone.find(this); }; ...

JQuery UI clone Image ZIndex Problem..

the following is the code i am using to create a draggable object.But i am able to see the clone image only inside the same div where the image is located not inside other DIVs. Despite i am able to drop it and it works fine. Can someone help me. $(".image").draggable({helper: 'clone', scroll: false, zIndex: '500...

using comparators as embedded classes, the mother class (initialized in clone ) fields are not visible in the compare method

I have developed a server-to-server protocol called CCMN and different drop policies for the messages cached by each server. The PEERSIM simulator creates a template node with the CCMN protocol and then clones this template node. The CCMN class includes different data structures maintaining the states required to implement the drop po...

Cloning objects in Java [3 questions]

will the clone method of Asub be called by doing this? Or is Asub deep cloned properly? If not, is there a way to propery deep clone Asub through this kind of method? abstract class Top extends TopMost { protected Object clone() { Object obj = super.clone(); // deep copy and try catch } } abstract class A exte...

git-update-server-info not sufficient to clone remote repo?

I'd like to make a git repository available over a Nginx HTTPS server. I've set the post-commit hook to run git-update-server-info in order to update the refs for the "dumb" backend. Pulling updates over the HTTPS interface works fine, however, when initially checking out the repository it fails with: [test@test ttt]$ git clone https:...

Android views as templates

Hi, I want to create an android Layout of which I want to instantiate several copies. I understand that declaring the layout in an XML will create a single instance. Is there a way to use the XML View declaration as a 'definition' rather than a 'declaration' ? Or is it possible to clone a view ? Thanks; ...

Can't shed Java warnings when cloning vector

I have two vectors declared as a private class property: private Vector<Myobject> v1 = new Vector<Myobject>(); private Vector<Myobject> v2 = new Vector<Myobject>(); I fill up v1 with a bunch of Myobjects. I need to do a shallow clone of v1 to v2. I tried: v2 = v1.clone(); I get "unchecked or unsafe operations". I've tried all fo...