circular-dependency

Circular dependency - Injecting objects that are directly depended on each other

这一生的挚爱 提交于 2019-12-30 08:14:41
问题 I have used Dice PHP DI container for quite a while and it seems the best in terms of simplicity of injecting dependencies. From Dice Documentation: class A { public $b; public function __construct(B $b) { $this->b = $b; } } class B { } $dice = new \Dice\Dice; $a = $dice->create('A'); var_dump($a->b); //B object However, when you have to use objects that are directly dependent on each other, the finall result is server error, because of the infinite loop . Example: class A { public $b; public

Is this a Circular dependency?

…衆ロ難τιáo~ 提交于 2019-12-30 03:10:30
问题 is this code a example of circular dependency? package expr; import sheet.Sheet public class AdressExpr implements Expr { private Address address; private Sheet sheet; public double value(Sheet sheet) { return sheet.value(address); } } public interface Expr { public double value(Sheet sheet); } public class Adress { // omissions } package sheet; import expr.Address; import expr.Expr; public class Sheet implements SuperSheet { private Map <Address, Expr> map; public double value(Address

Exception to the Rule of Three?

╄→гoц情女王★ 提交于 2019-12-30 02:48:12
问题 I've read a lot about the C++ Rule of Three. Many people swear by it. But when the rule is stated, it almost always includes a word like "usually," "likely," or "probably," indicating that there are exceptions. I haven't seen much discussion of what these exceptional cases might be -- cases where the Rule of Three does not hold, or at least where adhering to it doesn't offer any advantage. My question is whether my situation is a legitimate exception to the Rule of Three. I believe that in

Circular Dependency in Backbone / RequireJS Nested List

≯℡__Kan透↙ 提交于 2019-12-29 05:29:04
问题 I'm setting up a nested categories structure in Backbone with RequireJS. In this structure, a categories collection contains category models, and a single category model can contain a categories collection. Unfortunately this seems to cause the dreaded circular dependencies problem in RequireJS. I have read the docs on RequireJS (http://requirejs.org/docs/api.html#circular) however I am finding the explanation with 'a' and 'b' confusing. Here is my code, which is causing the problem: define([

Are circular references acceptable in database?

♀尐吖头ヾ 提交于 2019-12-28 11:53:14
问题 When are circular references acceptable in database? Theoretical and practical, any help is appreciated. 回答1: Records which point to other records are useful in a database. Sometimes these records form a cycle. This might still be useful. The only real annoyance in practice is avoiding violating the constraints. For example, if you have a user and transaction table, the user might have a pointer to his last transaction. You need to insert the transaction first, then update the last

C circular dependency

十年热恋 提交于 2019-12-28 03:07:18
问题 I have this problem with circular dependency in C , I looked around the other questions about this topic but really couldn't find the answer. I have this first struct named vertex: #ifndef MapTest_vertex_h #define MapTest_vertex_h #include "edgelist.h" //includes edgelist because it's needed typedef struct { char* name; float x, y; edgelist* edges; } vertex; #endif The second struct is the edgelist which is included by the vertex. #ifndef edgelist_h #define edgelist_h #include "edge.h" /

Template multiple definition issue

我的未来我决定 提交于 2019-12-25 08:20:54
问题 I want to use some of my own template classes within my dll project. In order to do so it was suggested here that I still separate my class template declaration from its definition by including the definition of my class's header file (as a .inl file). The class I'm trying to accomplish this with is my own vector class which will just wrap the std::vector class. Example of class setup below: Vector.h #pragma once #include <vector> namespace BlazeFramework { template<typename type> class

Circular dependency in models with sqlalchemy

帅比萌擦擦* 提交于 2019-12-25 06:02:21
问题 I'm creating a webapp which uses SQLAlchemy to access the database. I'm getting stuck with two models which are referencing to each other and ending up in an circular import which throws the following exception: --- SNIPP --- (output modified to hide software name) File "/opt/promethium/service/opt/xxxx/lib/python/api/server/server.py", line 11, in <module> from api.server.controllers import * File "/opt/promethium/service/opt/xxxx/lib/python/api/server/controllers/__init__.py", line 3, in

Circular dependency in models with sqlalchemy

风格不统一 提交于 2019-12-25 06:02:08
问题 I'm creating a webapp which uses SQLAlchemy to access the database. I'm getting stuck with two models which are referencing to each other and ending up in an circular import which throws the following exception: --- SNIPP --- (output modified to hide software name) File "/opt/promethium/service/opt/xxxx/lib/python/api/server/server.py", line 11, in <module> from api.server.controllers import * File "/opt/promethium/service/opt/xxxx/lib/python/api/server/controllers/__init__.py", line 3, in

Python Circular dependencies, unable to link variable to other file

ⅰ亾dé卋堺 提交于 2019-12-25 05:01:29
问题 I am working on a program that allows me to directly edit a word document through a tkinter application. I am trying to link the tkinter input from my gui file to my main file so that I can execute my docx functions. When I try to execute my code this way, it tells me that entry in entry.get() is not defined. When I try to import this from main, I receive a circular import error. main.py from docx import Document from docx.shared import Inches import os os.chdir("\\Users\\insanepainz\Desktop"