{"id":6938,"date":"2014-05-11T17:47:56","date_gmt":"2014-05-11T17:47:56","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/problem-about-circular-reference-collection-of-common-programming-errors\/"},"modified":"2014-05-11T17:47:56","modified_gmt":"2014-05-11T17:47:56","slug":"problem-about-circular-reference-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/problem-about-circular-reference-collection-of-common-programming-errors\/","title":{"rendered":"problem about circular-reference-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/196439db37b40bbd20479e11606b78d2?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nqehgt<br \/>\n.net f# abstract-class circular-dependency circular-reference<br \/>\nConsider the two abstract classes alpha and beta:[&lt;AbstractClass&gt;] type alpha () =abstract member foo: beta-&gt;beta[&lt;AbstractClass&gt;] and beta () = \/\/***abstract member bar: alphaIf I try to compile that I get an error, on the line indicated with * * *:error FS0010: Unexpected keyword &#8216;and&#8217; in interactionAnd if I write:[&lt;AbstractClass&gt;] type alpha () =abstract member foo: beta-&gt;betaand beta () =abstract member bar: alphathen I get:error FS0365: No implementation was giv<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/effcd0e6eb810c7536a339e22326d1a4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nNicholas Cloud<br \/>\nentity-framework ef-code-first sql-server-ce code-first circular-reference<br \/>\nHere is the approx. code I am working with.public class Note {public virtual Customer Customer { get; set; }public virtual User User { get; set; }public ICollection&lt;NoteComment&gt; Comments { get; set; } }public class NoteComment {public virtual User User { get; set; } }public class User {public ICollection&lt;Note&gt; Notes { get; set; } }public class Customer {}\/\/ &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;public class OurDataContext {private void ConfigureNotes(DbModelBuilder modelBuilder) {mod<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3843a17bd0d3e16b8e1b9f918b11df8d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nEagleFox<br \/>\nc# json asp.net-mvc-3 extjs circular-reference<br \/>\nThis question is a part of my original post here Get Data Into Extjs GridPanelBelow is my Controller that reads data from sql db and then I am trying to encode the result as JSON and send the data back to my gridview.jspublic JsonResult writeRecord() \/\/public string writeRecord(){Response.Write(&#8220;Survey Completed!&#8221;);SqlConnection conn = DBTools.GetDBConnection(&#8220;ApplicationServices2&#8221;);string sqlquery = &#8220;SELECT Q1, Q2, Q3, Q4, Improvements, Comments FROM myTable&#8221;;SqlDataAdapter cmd = new SqlDataAda<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1aa48f7606f5b08595b0a0356a61e8b6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJohn Saunders<br \/>\nwcf circular-reference wcftestclient<br \/>\nI&#8217;m working on a wcf project. Some of my services return objects that contain circular references. The serialization of these objects is handled through setting IsReference to true on DataContract attribute, so everything works fine if i write code to call those services. But for simple testing, it seems more preferable to me to use the GUI interface WcfTestClient.exe, and it turns out that WcfTestClient fails to display circularly referenced objects.I know trying to display objects which contai<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/85a5102b87ae9f2d5fa2c64a634b3538?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDADU<br \/>\njavascript selection circular-reference<br \/>\nSee 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&#8217;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: Converti<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/752ab49b23de2a3621742db1d1f6d33d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nastonish<br \/>\njavascript json circular-reference<br \/>\nhere is my object with sample dataObject {map: Array[10], health: 100, ai: Array[4]} ai: Array[4] 0: THREE.Object3D 1: THREE.Object3D 2: THREE.Object3D 3: THREE.Object3D length: 4 __proto__: Array[0] health: 100 map: Array[10]not able to find out why it gives this error.. anyone help??<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/eea12bb48fbb9cc2512e6cf89e257dc6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\ndaveywc<br \/>\njson knockout.js breeze circular-reference<br \/>\nI have an ASP.Net MVC SPA using the Hot Towel template i.e. breezejs, knockout, entity framework (code first), durandal etc.In my EF model I have a class named &#8220;Section&#8221; that has a self referencing association. Each section belongs to a &#8220;Document&#8221; and each Section also has a collection of &#8220;Items&#8221;:public class Section : CommonBase{&#8230;public Guid DocumentId { get; set; }public Document Document { get; set; }&#8230;public List&lt;Item&gt; Items { get; set; }public Guid? ParentId { get; set; }public Se<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/07d5093a301371b79c1ea44a069f1330?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nyannbane<br \/>\njavascript json node.js serverside-javascript circular-reference<br \/>\nI&#8217;m making a game, and I&#8217;ve come across a problem&#8230; When I try to save, JSON fails and reports that circular reference is being made somewhere. I don&#8217;t think it actually is, I can&#8217;t see it, so is there an algorithm or anything which could tell me where it is exactly (between which objects and stuff)? Also, is there a JSON alternative that can save circular reference? I&#8217;m running a node.js server, I saw this, but I can&#8217;t get it to work (it&#8217;s not made as a module i can require() in my code).<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1acb47a728c7c8a186647dcfaa2b5865?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAshleysBrain<br \/>\nc++ header definition circular-reference<br \/>\nIs there any way to declare these classes in a header file without indirection?\/\/ Forwards declaration of B class B;class A { public:\/\/ Default parameter referring to B. May return its parameterconst B&amp; func(const B&amp; b = B()); };class B { public:\/\/ B ctorsB() {}B(const B&amp;) {}\/\/ B has A as a memberA a; };Visual C++ 2008 tells me with this:error C2514: &#8216;B&#8217; : class has no constructorsand points to the forward declaration of B (&#8220;class B;&#8221;) and obviously can&#8217;t see B&#8217;s constructors below.<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fc62b586b7a6e298551ac69188390bb8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njcolebrand<br \/>\nnode.js v8 circular-reference<br \/>\nIn Nodejs, when I console.log a req object, what does [Circular] mean?Here&#8217;s an example console.log(req) against a basic nodejs example. Notice the request.socket._readWatcher.socket is a [Circular]. Does that mean it refers to itself? How can I dereference that?{ socket: { bufferSize: 0,fd: 7,type: &#8216;tcp4&#8217;,allowHalfOpen: true,_readWatcher: { socket: [Circular],callback: [Function: onReadable] },destroyed: false,readable: true,_writeQueue: [],_writeQueueEncoding: [],_writeQueueFD: [],_writeQueueC<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8e38328b8f8ad57e1ab5fd6c825e60cb?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nTivie<br \/>\njavascript circular-reference<br \/>\nPlease consider the following codevar factory = function (element, opts) {var MutationObserverController = function (element, opts) {var defaults = {subtree: true,childList: true,characterData: true};this.options = $.extend({}, defaults, opts);this.watchedElement = element;this.observer = new MutationObserver(this.mutationObserver);this.observer.context = this;\/\/console.log(this.observer); \/\/-&gt;THIS LINE};MutationObserverController.prototype.connect = function () {this.observer.observe(this.wa<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/150a6fea61bd679fac2f60429ab3d391?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nHatagashira<br \/>\njson stackoverflow libgdx circular-reference<br \/>\nI&#8217;m getting a StackOverflowError when trying to write an object to json with com.badlogic.gdx.utils.Json, which is based on jsonbeans. The object and all objects it references only contain primitive variables like float, boolean, int, etc except for references to a ShapeRenderer. Multiple objects all reference the same ShapeRenderer. There are some circular references (objects both having a reference to each other) but i assume it should be able to handle that.What could be the cause of these er<\/li>\n<\/ul>\n<p>Web site is in building<\/p>\n<p>I discovery a place to host code\u3001demo\u3001 blog and websites.<br \/>\nSite access is fast but not money<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.m5zn.com\/newuploads\/2014\/01\/30\/jpg\/e7da807964b1fff.jpg\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>qehgt .net f# abstract-class circular-dependency circular-reference Consider the two abstract classes alpha and beta:[&lt;AbstractClass&gt;] type alpha () =abstract member foo: beta-&gt;beta[&lt;AbstractClass&gt;] and beta () = \/\/***abstract member bar: alphaIf I try to compile that I get an error, on the line indicated with * * *:error FS0010: Unexpected keyword &#8216;and&#8217; in interactionAnd if I write:[&lt;AbstractClass&gt;] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6938","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6938"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6938\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}