circular-reference

WcfTestClient.exe not able to handle circular reference?

随声附和 提交于 2019-11-28 08:04:31
问题 I'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

Is there a way to test circular reference in JavaScript?

两盒软妹~` 提交于 2019-11-28 07:41:54
I'm making a game, and I've come across a problem... When I try to save, JSON fails and reports that circular reference is being made somewhere. I don't think it actually is, I can'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'm running a node.js server, I saw this , but I can't get it to work (it's not made as a module i can require() in my code). If you want to serialize a circular reference so you can save it, you need to make the reference

How to save an object with circular references?

女生的网名这么多〃 提交于 2019-11-28 07:32:49
问题 I want to save locally an object which has circular references. What are my options? My first thought was using HTML5 local storage but I can't stringify this object due to the circular references. Specifically I'm trying to save the DOMSelection object of the current selection. Example: var sel = window.getSelection(); var selstring = JSON.stringify(sel); // Breaks here ... localStorage.setItem("selection",selstring); The only way I could get the stringify to work now is by ignoring certain

Circular Reference with python lists

断了今生、忘了曾经 提交于 2019-11-28 02:02:29
Can someone explain this? >>> x=x[0]=[0] >>> x [[...]] >>> x is x[0] True >>> x[0][0][0][0][0][0][0] [[...]] >>> x in x True what is [...]? That's just Python telling you that you have a circular reference; it's smart enough not to enter an infinite loop trying to print it out. It's output by the method responsible for generating the representation of the structure. It represents a recursive structure, elided since it can be nested infinitely. iPython will do this: [<Recursion on list with id=38505216>] It's the same thing; the interpreter telling you that you have a recursive data structure.

How to prevent a self-referencing table from becoming circular

无人久伴 提交于 2019-11-27 23:32:06
问题 This is a pretty common problem but I haven't yet found the exact question and answer I'm looking for. I have one table that has a FK pointing to its own PK, to enable an arbitrarily deep hierarchy, like the classic tblEmployee that has a column Manager that is a FK with the PK tblEmployee.EmployeeID. Let's say in my app, the user Creates new employees Alice and Dave, with no manager because they're the CEO and President. So tblEmployee.Manager is NULL for those two records. Create new

Passing an object with circular references from server to client-side Javascript while retaining circularity

﹥>﹥吖頭↗ 提交于 2019-11-27 23:20:13
I'm trying to pass an object with circular references from node.js server to client-side javascript. Server (node.js): var object = { circular: object } //.... app.get('/', function(req, res){ res.render('index.jade', {object: object}); }); Client-side Jade/Javascript script var object = !{JSON.stringify(object)}; Here I get the error that object contains circular references. Any way to get the object in client-side javascript, with or without circular references? Douglas Crockford has a solution for this that I have successfully used to solve this problem before: Cycle.js instead of just

How to create a circularly referenced type in TypeScript?

时光怂恿深爱的人放手 提交于 2019-11-27 21:52:36
I have the following code: type Document = number | string | Array<Document>; TypeScript complains with the following error: test.ts(7,6): error TS2456: Type alias 'Document' circularly references itself. Clearly circular references are not allowed. However, I still need this kind of structure. What would be a workaround for this? Kristian Hanekamp The creator of TypeScript explains how to create recursive types here: https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540 The workaround for the circular reference is to use extends Array . In your case this would lead to

javascript, circular references and memory leaks

人盡茶涼 提交于 2019-11-27 18:23:04
From what I recall of a not too distant past, Javascript interpreters suffered from memory leaking issues when faced with circular references. Is it still the case in the latest browsers? (e.g. Chrome, FF 3.5 etc) The vast majority of leaks we talk about with JavaScript are specifically in IE6-7 when you make a reference loop between JavaScript objects and host objects like DOM nodes. In IE6 this is particularly pernicious in that you don't get the memory back when you leave the page; it's gone until you quit the browser. In IE7 clearing out the page does now return the memory, but you can

getting around circular references in Delphi [duplicate]

 ̄綄美尐妖づ 提交于 2019-11-27 14:55:15
问题 This question already has an answer here: Delphi Enterprise: how can I apply the Visitor Pattern without circular references? 4 answers Is there a way of getting around circular unit references in Delphi? Maybe a newer version of delphi or some magic hack or something? My delphi project has 100 000+ lines of code mostly based on singleton classes. I need to refactor this, but that would mean several months of "circular reference" hell :) 回答1: I've been maintaining close to a million lines of

How to use @JsonIdentityInfo with circular references?

戏子无情 提交于 2019-11-27 13:47:44
I am trying to use the @JsonIdentityInfo from Jackson 2 as described here . For testing purposes I created the following two classes: public class A { private B b; // constructor(s) and getter/setter omitted } public class B { private A a; // see above } Of course, the naive approach failes: @Test public void testJacksonJr() throws Exception { A a = new A(); B b = new B(a); a.setB(b); String s = JSON.std.asString(a);// throws StackOverflowError Assert.assertEquals("{\"@id\":1,\"b\":{\"@id\":2,\"a\":1}}", s); } Adding @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class,