clone

use case for clone()

I have never seen clone() method put to use in any real code. I was reading about it and felt that its use could make the code very cumbersome. is there any specific use case for the clone() method? Under what circumstances would one have to use clone() and why would the use normal conctructor not suffice? ...

How to trigger TinyMCE iframe creation/init in drupal/jQuery site for moved/cloned iframe

I am working on a jQuery-based plugin as a drupal module that will tweak the comment form for a content type so that it appears inline on clicking certain content. When I try to clone() the comment form and append it to a hidden div so that I can access it later, the TinyMCE iframe does not come with the cloning, so I'm left with an empt...

How to properly override clone method?

I need to implement a deep clone in one of my objects which has no superclass. What is the best way to handle the checked CloneNotSupportedException thrown by the superclass (which is Object)? A coworker advised me to handle it the following way: @Override public MyObject clone() { MyObject foo; try ...

Clone object to $this

Dear all, I would like to ask about PHP clone / copy object to $this variable. Currently I am new in MVC, I would like to do something like CodeIgniter. I would like to direct access to the variable. in my __construct(), i always pass the global variable inside to the new controller (class), eg. function __construct($mvc) { $t...

When (deep) Cloning, use String.Copy or str1 = str2?

When (deep) Cloning a custom object, should I use clone.str1 = String.Copy(obj.str1) or clone.str1 = obj.str1? I'd prefer the latter - shorter and quicker, but is it "safe"? I'd point to this thread, but, however, not sure what to use. ...

Entity framework - Problem when cloning entities. reference entities are cloned as wel

Hi, I have a TreeNode class with Expression. Expression has Parameter ID pointing to Parameters table. Each parameter has ParameterGroupId. I have a Copy& paste TreeNode feature. When I copy an existing node, I create a new node but using the same reference to the P (Parameter) and PG (ParameterGroup). The problem is, the new node was...

Shallow copy of a Map in Java

As I understand it, there are a couple of ways (maybe others as well) to create a shallow copy of a Map in Java: Map<String, Object> data = new HashMap<String, Object>(); Map<String, Object> shallowCopy; // first way shallowCopy = new HashMap<String, Object>(data); // second way shallowCopy = (Map<String, Object>) ((HashMap<String, Ob...

Cloning datepicker objects [JQuery]

Hey, I have an input field that I define as a datepicker through a css class. I now want to clone this input field and have it so the cloned inputs are also datepickers. After reading from various sources I was lead to believe that the following code should work but it doesn't. I was hoping maybe someone could help me figure out what I...

open-source/free borland together clone

Hi all, I was wondering if there is any open-source/free borland together clone to create uml diagrams like class diagrams, use case diagrams, sequence diagrams, etc. Many thanks ...

Keep a commit locally to clone in Git

I have two repositories. I started a project locally on my development machine, later cloned it to a testing environment on the customers server. I mimic the environment on the customers server, but for that I need to have some files (and some lines in some other files) to be only present on my local machine, but they must not appear on ...

When doing a mercurial clone over http, I get a 500 error

Hi, I set up a repository on another computer for which I want to start cloning over http. I set up apache with the directive as stated below, and in the directory I have my index.cgi file as provided by mercurial. I can clone a repository just fine if it's empty, but if it contains files, I get a 500 error. Looking at the error logs...

Why clone an MS-Access recordset?

I'm a newbie at VBA and attempting to understand someone else's code. Set rstClone = Me.RecordsetClone rstClone.MoveFirst Why does the recordset have to be cloned? Why can't the code be Me.Recordset.MoveFirst? ...

Problem cloning / fetching repository using Git plugin for Hudson on Windows

Before anybody shoots me down for this - I have already checked every appropriate thread and still not found a solution to my problem. I have Hudson with git plugin installed on windows server (not my choice) and Hudson runs as a service. Git/bin is on the path. However I cannot clone the repository. Here is a shortened display of the c...

Impossible to create interface field when copy an object

given this class definition: public class Frame { IFrameStream CapturedFrom; } I want implement Clone() method in this class, but problem is: How to create the IFrameStream field in the destination instance? - I just don't know its implementation, how to create the instance? ...

Mercurial clone operation works, but I don't have write access

Somewhere I did something silly. I was deploying my Rails app via cloning the Mercurial repo down onto my Ubuntu server. It worked the first time, and then...well, I made a small change on my dev machine, pushed the changes to the repo, and then deleted the copy on the Ubuntu server and re-cloned from the repo. The clone operation (the...

Clone() vs Copy constructor- which is recommended in java

clone method vs copy constructor in java. which one is correct solution. where to use each case? ...

Cloning items in a listbox c#

I have 2 list boxes and want to be able to copy selected items from one to the other how ever many times I want. Ive managed to do this but I have buttons on the 2nd list box that allow me to go up and down..Now when theres to items in the second list box that are the same (e.g "gills" and "gills") it doesnt behave normally and crashes. ...

Cloning a tag in javascript (plain)

Hi, I would like to clone a tag using Javascript (without using any external frameworks like jQueries, so please limit the answer to plain Javascript) Here is my requirement. Say I have a random div like the following in the document, <div id='anEmptyDiv' style="display:none"> <div> Lorem Ipsum </div> </div> And I shou...

jQuery UI: Drag and clone from original div, but keep clones

I have a div, which has jQuery UI Draggable applied. What I want to do, is click and drag that, and create a clone that is kept in the dom and not removed when dropped. Think of a deck of cards, my box element is the deck, and I want to pull cards/divs off that deck and have them laying around my page, but they would be clones of the ...

retrieve value from hashtable with clone of key; C#

I would like to know if there is any possible way to retrieve an item from a hashtable using a key that is identical to the actual key, but a different object. I understand why it is probably not possible, but I would like to see if there is any tricky way to do it. My problem arises from the fact that, being as stupid as I am, I creat...