circular-reference

JPA Bidirectional relationship - infinite loop / circular reference

与世无争的帅哥 提交于 2020-01-03 15:56:24
问题 I have a bidirectional relationship @Entity @Table(name = "facility") public class Facility implements Serializable { @Id @GeneratedValue private Long id; @OneToMany(mappedBy = "facility") private Set<Amenity> amenities; } @Entity @Table(name = "amenity") public class Amenity implements Serializable { @Id @GeneratedValue private Long id; @ManyToOne private Facility facility; } This all works fine and I can see the table is created correctly. I can add data fine through a rest endpoint and but

Why is circular dependency allowed with namespaces in c#?

百般思念 提交于 2020-01-03 09:25:34
问题 In c# you're allowed to have a statement in file a.cs (which has namespace of MyApp.A): using MyApp.B; while file b.cs (which has namespace of MyApp.B) already have the statement using MyApp.A; If a similar dependency would exist in different dll's (where a.dll has a reference to b.dll and vice versa) it wouldn't be allowed because of circular dependency error, so why is it allowed with namespaces (and compiler doesn't even produce a warning)? Isn't it a code smell to do so anyway? 回答1:

Python Delegate Pattern - How to avoid circular reference?

為{幸葍}努か 提交于 2020-01-02 06:11:30
问题 I would to ask if using the Delegate Pattern in Python would lead to circular references and if so, what would be the best way to implement it to ensure the object and its delegate will be garbage collected? In Objective C, the above problem is avoided by using a weak reference to the delegate. In C++, we don't call delete on the delegate. I've found a link to Python's weak reference module here: http://docs.python.org/library/weakref.html. It seems like a plausible approach might be to

Symfony 3.0.4 Circular reference detected during serialization with FOSRestBundle

守給你的承諾、 提交于 2020-01-02 06:10:53
问题 I'm using FOSRestBundle in a Symfony project. When it I try to handle a view, it fails during the serialization of my data with the Symfony serializer as well as with the JMSSerializer. This is the method rendering the response: DefaultController.php $em = $this->getDoctrine()->getManager('magellan'); $qb = $em->createQueryBuilder(); $query = $qb->select('h') ->from('DataBundle:Holding', 'h') ->where($qb->expr()->eq('h.id', ':holding_id')) ->setParameter('holding_id', $holding_id) ->getQuery(

Test if variable contains circular references

∥☆過路亽.° 提交于 2020-01-02 03:23:04
问题 How do you test a variable for circular references? I am using PHP's var_export() function with the return string argument set to true . I found that Warning: var_export does not handle circular references and was wondering if anyone knew of a way to test if a variable contains a circular reference so that I may use it before trying to use var_export on it. I know that var_export outputs PHP eval-able text that can be used to recreate the array and even though I am not using it for that I

I have a circular reference. How can I create a weak reference in Objective-C?

依然范特西╮ 提交于 2020-01-01 03:58:29
问题 I'm working on an iPhone application. I have an object of class Row that needs to release numerous objects of the class Block . Every Block currently has a property that retains an instance variable of class Row . @interface Block : UIImageView { Row *yCoord; } @property (nonatomic,retain) Row *yCoord; @end Every Row contains an NSMutableArray of these Blocks. @interface Row : NSObject { NSMutableArray *blocks; } -(void)addBlock:(Block*)aBlock; @end @implementation Row -(void)addBlock:(Block*

Visual Studio 2012 - Find Circular References Efficiently

ⅰ亾dé卋堺 提交于 2020-01-01 02:53:10
问题 Currently if I want to check for circular references inside a solution I select Architecture - Generate Dependency Graph - For Solution . Then from the new tab that opens I select Layout - Analyzers - Circular References Analyzer . Finally if I drill down from the individual assemblies and there are circular references I can see them highlighted in red on the graph and they also appear as warnings in the Error List. Since I intend to spot circular references even between methods of the same

Telerik MVC Grid with Ajax Binding using EntityObjects gets Circular References exception

三世轮回 提交于 2020-01-01 00:21:24
问题 I have been using Telerik MVC Grid for quite a while now and It is a great control, however, one annoying thing keeps showing up related to using the grid with Ajax Binding to objects created and returned from the Entity Framework. Entity objects have circular references, and when you return an IEnumerable from an Ajax callback it generates an exception from the JavascriptSerializer if there are circular references. This happens because the MVC Grid uses a JsonResult which in turn uses

Prevent JavaScript window.getSelection() circular reference

别来无恙 提交于 2019-12-31 03:57:26
问题 See this demo (dependent on selectionchange event which works in Chrome only at this moment): http://jsfiddle.net/fyG3H/ Select some lorem ipsum text and then focus the text input. In the console log you will see that there is a DOMSelection object. It has an anchorNode value of HTMLBodyElement while it should have one of Text . I didn't know why this was happening until I tried stringfying the selection object: http://jsfiddle.net/fyG3H/1/ This gives the following error: Uncaught TypeError:

Any nice tools for untying knots in Haskell?

坚强是说给别人听的谎言 提交于 2019-12-30 06:00:41
问题 I've a data structure with several different types of internal circular linking, making it infinite in the sense of say the cycle command. Are there any interesting modules for collapsing such structures into flat data structures that use indexing instead? I'm interested in serializing the complete data structure, both via Read and Show as well as via Data.Serialize or similar. There are obviously nice features of building a sequential index, but an index based upon hash values of memory