clone

Cloning WPF controls and object hierarchies

*爱你&永不变心* 提交于 2020-01-04 15:31:12
问题 I have some problems cloning an object hierarchie. It's a toolkit for modelling applications, the toolbox contains class instances as prototypes. But I'm having a hard time cloning these :) The following code shows the problem: public abstract class Shape { protected List<UIElement> elements; private Canvas canvas; ... public Canvas getCanvas() { ... }; } public class MovableShape : Shape { protected ... propertyA; private ... propertyXY; ... } public abstract class AbstractLayout :

jQuery UI - Clone droppable/sortable list after drop event

你。 提交于 2020-01-04 14:36:30
问题 Basically I have a list of draggable items and initially one droppable element for them to be dragged into. When an item is dragged into the droppable, the droppable is cloned (before the item is appended) and appended as a new droppable area. Take a look at this stripped down fiddle: http://jsfiddle.net/DKBU9/1/ (omitted sortable()) HTML <ul id="draggables"> <li>foo1</li> <li>foo2</li> <li>foo3</li> </ul> <ul class="droppable new"> </ul> JS $('#draggables > li').draggable({ appendTo:

Cloning queue in c#

倖福魔咒の 提交于 2020-01-04 09:55:34
问题 I have the following code: Queue<string> oldQueue = new Queue<string>(); oldQueue.Enqueue("One"); oldQueue.Enqueue("Two"); oldQueue.Enqueue("Three"); Queue newQueue = oldQueue; string newString = newQueue.Dequeue(); The problem is that once I Dequeue the item from newQueue , the item is also Dequeued from oldQueue . Is there a way to "clone" a queue in a way that removing an item from one queue will keep it's clone queue unchanged? 回答1: Queue is a reference type, so newQueue and oldQueue

Aptana 3, GitHub can clone but can't commit

谁都会走 提交于 2020-01-04 06:35:41
问题 I am very new to GitHub and I am using Aptana 3 on Ubuntu. I was able to clone a repository for GitHub by using file/import/Git Repository When I added files to the local repo and I tried to commit I get this error. Unhandled event loop exception No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)] How do I commit to GitHub in Aptana? 回答1: The SO answer "How to set up internal browser for Aptana on Linux" lists some solution. Check also your version of Aptana vs. JDK (32 or 64

Polymer Clone Objects

倾然丶 夕夏残阳落幕 提交于 2020-01-04 06:20:15
问题 How can we clone an object in Polymer? Example this.colorsAsc.push({color: 'red'}); this.colorsDesc = this.colorsAsc.reverse(); this.colorsDesc[0].color = 'blue'; // Both will be blue doing this I can do it in these many functionalities What is the most efficient way to deep clone an object in JavaScript? but I wonder if there is a way in Polymer to do that? Angular does it https://docs.angularjs.org/api/ng/function/angular.copy 回答1: You can try the following hack: this.colorsDesc = JSON

jQuery clone() copies data…sometimes…?

不羁岁月 提交于 2020-01-04 05:19:23
问题 Using the sample below, I have a tr that I am duplicating. It contains a jQuery autocomplete . The first time it is cloned, the auto complete functionality does not work because the attached data("items") is null. The second time the Add button is clicked, the autocomplete works. Thereafter, clicking Add once again produces a non-functioning autocomplete. Adding a breakpoint inside of the makeAutoComplete function shows that items is always null except for when clicking Add the second time!

Empty file input from .clone()

不想你离开。 提交于 2020-01-04 04:12:07
问题 I'm trying to clone a file input form, which every time I select a file then click "add more" to clone the file input, but it has copied the selected file in the input. <input type="file" /> <span id="add-more-files">Add more</span> jQuery: $('#add-more-files').click(function() { var cloned = $(this).prev().clone(); $(cloned).insertBefore($(this)); }); Demo: jsFiddle. Now whenever you select a file before cloning the previous, you can see it has the same file selected, I need it to be empty

“Java concurrency in practice” - cached thread-safe number factorizer (Listing 2.8)

Deadly 提交于 2020-01-03 09:41:13
问题 In the following code (copied from Java Concurrency in Practice Chapter 2, section 2.5, Listing 2.8): @ThreadSafe public class CachedFactorizer implements Servlet { @GuardedBy("this") private BigInteger lastNumber; @GuardedBy("this") private BigInteger[] lastFactors; @GuardedBy("this") private long hits; @GuardedBy("this") private long cacheHits; public synchronized long getHits() { return hits; } public synchronized double getCacheHitRatio() { return (double) cacheHits / (double) hits; }

“Java concurrency in practice” - cached thread-safe number factorizer (Listing 2.8)

别说谁变了你拦得住时间么 提交于 2020-01-03 09:41:07
问题 In the following code (copied from Java Concurrency in Practice Chapter 2, section 2.5, Listing 2.8): @ThreadSafe public class CachedFactorizer implements Servlet { @GuardedBy("this") private BigInteger lastNumber; @GuardedBy("this") private BigInteger[] lastFactors; @GuardedBy("this") private long hits; @GuardedBy("this") private long cacheHits; public synchronized long getHits() { return hits; } public synchronized double getCacheHitRatio() { return (double) cacheHits / (double) hits; }

jQuery to update select list

不羁的心 提交于 2020-01-03 04:35:10
问题 I have a form where a user can submit a form to indicate which systems need to be updated. In the form, they can dynamically add systems to the form so I do not have unique ids available. In the form, they have to select a platform (unix, hp, wintel, etc) and then the corresponding model to accompany the selected platform - think chained select. When the first selected list in an "item" is changed, an ajax call is made to obtain the values for the 2nd select list. How can I update the 2nd