Questions tagged [circular-reference]

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

A circular reference is a series of references where the last object references the first, resulting in a closed loop.

Circular references can appear in computer programming when one piece of code requires the result from another, but that code needs the result from the first.

Information is taken from Wikipedia, more information available there.

758 questions
4
votes
4 answers

Cross referencing assemblies

I have three projects in my .net solution. The main project and two class library projects. I have found out that I need to cross reference the class library projects. Can I do that? Is it safe or there are some considerations?
4
votes
3 answers

Jackson bidirectional relationship (One-to-many) not working

I'm using Spring(xml+annotations), Hibernate(annotations) in this web service project. The database relationship diagram, models, expected and actual output are given below, Database Table…
liwevire
  • 782
  • 2
  • 9
  • 21
4
votes
1 answer

c# - How do self-referencing classes or circular-referencing classes within same assembly compile successfully

I would like to know how C# and .Net compiler is able to successfully compile a self-referenced class or circular referenced classes within same assembly. Consider the following code is present within the same assembly. class X{ X x; } class Y{ Z z;…
4
votes
0 answers

Passing objects with circular reference to XPC services

I would like to pass objects with circular to an XPC service. Let's say that I have an object class Course a Teacher and an array of Student. Student have also a reference to the Teacher. The XPC protocol signatures contain any combination of the…
Martin Delille
  • 11,360
  • 15
  • 65
  • 132
4
votes
1 answer

Why doesn't Visual Studio warn about a circular initialisation of a static string?

A silly but probably not-so-uncommon error when I replaced a string literal by a static string was leading to something like the following code snippet which is probably almost never intended and trivial to spot, even for a machine: public partial…
4
votes
2 answers

Symfony 3.0.4 Circular reference detected during serialization with FOSRestBundle

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…
Kevlar
  • 376
  • 5
  • 15
4
votes
4 answers

Using the `==` operator on circularly defined dictionaries

Python allows dictionaries to be compared with == import copy child = {'name': 'child'} parent_1 = {'name': 'parent', 'child': child} parent_2 = copy.deepcopy(parent_1) print(parent_1 == parent_2) Prints True, as you would expect it to. Python…
MackM
  • 2,906
  • 5
  • 31
  • 45
4
votes
1 answer

Nested closures and captured variables

I have this example with nested closures which demonstrates memory leak use v5.10; use strict; package Awesome; sub new { bless {steps => [], surprise => undef}, shift; } sub say { print "awesome: ", $_[1], "\n"; } sub prepare { my…
Oleg G
  • 925
  • 4
  • 12
4
votes
2 answers

Microsoft Visual Studio 2012 C++ Circular Reference

I have a question to ask. Is it possible for projects to reference each other under a same solution? For example, both projects A and B have their own exported functions. Project A references Project B and Project B references Project A. Both…
Wallace
  • 293
  • 1
  • 9
  • 18
4
votes
2 answers

Access sql query Circular Reference error

I'm creating a sql select query for an access database, and receiving a circular reference error, because my alias name is the same as a column name in my expression. Here is the fragment of my query: switch([CULET]='N','NONE', [CULET]='S',…
user228058
  • 465
  • 1
  • 7
  • 22
4
votes
1 answer

How can I make a Spring Boot project with multiple data sources?

I'm working on a Spring Boot/Spring Batch project, and I need to configure two data sources. One is an in-memory hsqldb database used for tracking transactions. The other is a regular MySQL database which will be updated by my ItemWriters. The…
slamci
  • 424
  • 1
  • 5
  • 13
4
votes
1 answer

What happens if you append a list to itself?

What will happen if I try to append a list to itself? # Let's say empty list is created. some_list = [] # Now, append it with self some_list.append(some_list) # Output shows [[...]] on iPython console. What does this mean? Does some_list become…
Aashish P
  • 1,894
  • 5
  • 22
  • 36
4
votes
1 answer

Forward declaration of struct for Boost graph typedef c++

Short problem description: Basically I want struct Type; typedef container MyType; struct Type{ MyType::sometype member; } Now, how do I do this? Actual problem: For the Boost Succesive Shortest Path algorithm, I need to have my forward…
Sanchises
  • 847
  • 4
  • 22
4
votes
2 answers

How to check for circular references in PHP when recursively parsing an associative array?

I created this array with a circular reference: $arr = array(1 => 'one', 2 => 'two'); $arr[3] = &$arr; I have a function that recursively prints out the values in an array, but I really couldn't solve the problem of creating a circular reference…
Trindaz
  • 17,029
  • 21
  • 82
  • 111
4
votes
1 answer

Overwriting object instance does not release memory?

I have a python object which is essentially a collection of other object instances. You can append other objects to it (which it just stores in a list). It is created when reading a file, eg: def file_reader(file): obj = MyCollection() for…
jramm
  • 6,415
  • 4
  • 34
  • 73