circular-reference

Delphi: better design to avoid circular unit reference?

喜欢而已 提交于 2020-07-19 01:57:28
问题 I have a triangular mesh structure in Delphi 10. For performance reasons I store the data of the mesh's vertices, triangle faces, etc. in descendants of TList. I let the TLists do the calculations for every member of the list. For these calculations I need access to some fields of the TMesh structure. Therefore during the creation of TMesh and subsequently the creation of the lists I assign the parent TMesh to the lists. I use a forward declaration of TMesh to do so. Please see the following

About “circular reference”, I used weak_ptr but memory leak still happened

一笑奈何 提交于 2020-06-26 07:42:32
问题 I read: How to avoid memory leak with shared_ptr? I know that I need to use weak_ptr to avoid circular reference . So I created a little program to play circular reference . Following object(spyder) will be invoke class spyder { public: spyder(std::string _name): m_name(_name), finger(nullptr) { } inline const std::string ask_name() const{ return m_name; } std::shared_ptr<spyder> finger; private: std::string m_name; }; I invoke spyder in my main code with shared_ptr and weak_ptr: int main(){

Check for proper list in Common Lisp

一笑奈何 提交于 2020-04-11 05:47:05
问题 Is there a standard function in Common Lisp that can check against improper lists (i.e. circular and dotted lists) without signaling an error? list-length can check against circular lists (it returns nil for them), but signals type-error when given a dotted list. Scheme's list? traverses the whole list to make sure it is not dotted or circular; Common Lisp's listp only checks that it's given nil or a cons cell. Here's the simplest I could come up with: (defun proper-list-p (x) (not (null

Check for proper list in Common Lisp

社会主义新天地 提交于 2020-04-11 05:47:04
问题 Is there a standard function in Common Lisp that can check against improper lists (i.e. circular and dotted lists) without signaling an error? list-length can check against circular lists (it returns nil for them), but signals type-error when given a dotted list. Scheme's list? traverses the whole list to make sure it is not dotted or circular; Common Lisp's listp only checks that it's given nil or a cons cell. Here's the simplest I could come up with: (defun proper-list-p (x) (not (null

Can Python's garbage collection guarantee the reclaiming of circular referenced objects under all circumstances?

↘锁芯ラ 提交于 2020-01-23 10:43:05
问题 This question is an extension of a question I asked earlier: Python Delegate Pattern - How to avoid circular reference? After reading the replies, I decided to clarify my question, but was requested to post it separately. Here goes: A passage in the Python docs (reproduced below) states that garbaged collection is not guaranteed for circular referenced objects. A post I found here suggests the same thing. But the replies to my earlier question disagrees. So, have I misunderstood the passage

Can Python's garbage collection guarantee the reclaiming of circular referenced objects under all circumstances?

浪尽此生 提交于 2020-01-23 10:42:27
问题 This question is an extension of a question I asked earlier: Python Delegate Pattern - How to avoid circular reference? After reading the replies, I decided to clarify my question, but was requested to post it separately. Here goes: A passage in the Python docs (reproduced below) states that garbaged collection is not guaranteed for circular referenced objects. A post I found here suggests the same thing. But the replies to my earlier question disagrees. So, have I misunderstood the passage

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

百般思念 提交于 2020-01-11 12:42:16
问题 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 relationship Customer.java @Entity @Table(name="customer") public class Customer implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="customer_id", unique=true, nullable =false) long customerId; @Column(name="name")

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

江枫思渺然 提交于 2020-01-11 12:42:06
问题 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 relationship Customer.java @Entity @Table(name="customer") public class Customer implements Serializable{ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="customer_id", unique=true, nullable =false) long customerId; @Column(name="name")

Changing module variables after import

醉酒当歌 提交于 2020-01-07 08:33:30
问题 SO pyton gurus! I've just found an astonishing phenomenon that I don't understand. The problem can be best shown as code: #== kid.py ==# import dad def spam (): dad.spam() #== dad.py ==# import kid x = 1 print "body", x x = 2 def spam (): print "spam", x if __name__ == '__main__': x = 3 spam() kid.spam() print "main", x I'm using Python 2.7.3. Can you guess the output of python dad.py ? The answer is (I wish SO had a spoiler shading tag) body 1 body 1 spam 3 spam 2 main 3 . So could you

Facebook debugger reports “Circular redirect path detected” (301) on certain website

末鹿安然 提交于 2020-01-04 06:06:13
问题 Why isn't the Facebook debugger able to parse http://www.brandenburg-business-guide.de/ ? It reports 301 Circular redirect path detected . However, there is actually no redirection in place. Also apache's access.log reports no retrievals by facebook. See https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.brandenburg-business-guide.de%2F and hit Debug button. 回答1: The page does not contain any OpenGraph meta tags. Check out the documentation. Facebook scraper expects the