circular-reference

Java Swing layout manager circular reference being set twice

和自甴很熟 提交于 2019-12-11 18:54:41
问题 Can anybody explain why circular reference is being set twice in the followig code? //declare panel this.cntnrPnl = new JPanel(); //define layout manager for the panel - but why circ ref? this.cntnrPnl.setLayout(new BoxLayout(this.cntnrPnl, BoxLayout.Y_AXIS)); Why is it necessary to link the BoxLayout back to the JPanel container explicitly instead of JPanel.setLayout doing the setting itself behind the scene and using a setter from BoxLayout for code compactness? E.g.: this.cntnrPnl

Circular reference using IoC

元气小坏坏 提交于 2019-12-11 14:57:24
问题 I am using windsor castle as my IoC container, and has run in to a bit of a problem. First of all - i know about: Castle Windsor: How to prevent circular references in factory-created objects were the created objects refers back to the factory But since circular reference is considered as "Code Smell" and i should consider refactoring app architecture i am asking anyway. I have very similar situation: public class OperationsFactory { private GeneralSettingsManager m_generalSettings; private

Can I trigger PHP garbage collection to happen automatically if I have circular references?

微笑、不失礼 提交于 2019-12-11 12:07:38
问题 I seem to recall a way to setup the __destruct for a class in such a way that it would ensure that circular references would be cleaned up as soon as the outside object falls out of scope. However, the simple test I built seems to indicate that this is not behaving as I had expected/hoped. Is there a way to setup my classes in such a way that PHP would clean them up correctly when the outermost object falls out of scope? I am not looking for alternate ways to write this code, I am looking for

Destroy an circular-reference instance in typescript?

大城市里の小女人 提交于 2019-12-11 04:23:39
问题 Say I have code like following: class A { b: B; constructor() { this.b = new B(this); } } class B { a: A; constructor(a: A) { this.a = a; } } let a= new A() When I want to destroy instance of a: 1 Should I just a=null; or a.b.a=null; a=null; ? 2 Is there any way to write code to test results? Say some code to detect instance number of some class in the memory? 回答1: If there's no reference to a or b it will be marked as unreachable by the garbage collector and be cleaned together, you don't

ServiceStack.Text serialize circular references

ⅰ亾dé卋堺 提交于 2019-12-10 19:59:38
问题 I need to serialize an object graph like this: public class A { public B Link1 {get;set;} } public class B { public A Link2 {get;set;} } So that the json only gets two instances, but is deserialized correctly again. E.g. using a meta Id or something similiar. I know that there is a way in Json.NET as described here: http://note.harajuku-tech.org/serializing-circular-references-with-jsonnet with meta ids. Is there a similiar feature in ServiceStack.Text Json Serializer? Otherwise, is it

Circular References and ScriptIgnore problems

纵饮孤独 提交于 2019-12-10 16:06:55
问题 I have several BusinessObject classes that refer to each other and I need to serialize one in a JsonResponse and return it to my view. I keep getting a circular reference exception and I cannot get rid of it. I have placed the [ScriptIgnore()] decorator on every property that is not a simple data type property and I am still getting the exception. I cant figure out where the problem is, as I am blocking the serializer from just about everything and it is still blowing up on me. Is there any

Best solution for EF 4.1 + MVC + JSON circular reference exception?

£可爱£侵袭症+ 提交于 2019-12-10 15:57:59
问题 I'm using EF 4.1 Database First approach, with T4 template generating my POCO classes in separate assembly. I have repositories for fetching data, and service layer which is used for communication with UI. I was trying to make cascading dropdowns. I'm new in MVC and EF 4.1, so I searched stackoverflow for possible solutions. This is sample viewmodel class: public class MyViewModel { public int CustomerId { get; set; } public string CustomerName { get; set; } public IEnumerable<Phone> Phones {

INSERT in TABLES with circular references SQL

依然范特西╮ 提交于 2019-12-10 14:33:48
问题 I have 2 tables: Empleados(**numEmpl**, nombre, apellido, sexo, telefono, salario, numDept) Departamentos(**numDept**, nombreDept, numDirect) In departamentos: numEmpl is primary key numDept is foreign key reference to Departamentos(numDept). In departamentos: numDept is the primary key And numDirect is foreign key reference to Empleados (numEmpl) So there is a circular reference. First of all I created the Tables: CREATE TABLE EMPLEADOS(numEmpl primary key, nombre, apellido, sexo, telefono,

Nesting Views within Views in backbone js

折月煮酒 提交于 2019-12-10 01:47:38
问题 I'm working with backbone.js building some complex view relationships, and I'm wondering if there are any problems from a javascript performance standpoint of doing something that looks like this: var viewOne = Backbone.View.extend({ tagName : 'li', initialize : function() { this.v2 = new viewTwo({parent:this}); }, clickHideOne : function() { $(this.el).removeClass('selected'); } }); var viewTwo = Backbone.View.extend({ tagName : 'a', initialize : function() { this.bind('click', this

a design to avoid circular reference in this scenario

こ雲淡風輕ζ 提交于 2019-12-08 13:15:04
问题 Here is our dependency tree: BigApp -> Child Apps -> Libraries ALL of our components are HEAVILY using one of the Libraries as above ( LibA). But it has a ‘few’ public methods that require classes from ‘higher-level’ assemblies and we want to avoid CIRCULAR references. What do you propose as a good design for this? 回答1: One typical way of avoiding such things is by creating an interface that doesn't depend on anything. Then BigApp and LibA can both depend on the interface. BigApp can supply a