hierarchy

Implementing NSCopying in Subclass of Subclass

余生颓废 提交于 2019-11-30 08:06:19
I have a small class hierarchy that I'm having trouble implementing copyWithZone: for. I've read the NSCopying documentation, and I can't find the correct answer. Take two classes: Shape and Square . Square is defined as: @interface Square : Shape No surprise there. Each class has one property, Shape has a "sides" int, and Square has a "width" int. The copyWithZone: methods are seen below: Shape - (id)copyWithZone:(NSZone *)zone { Shape *s = [[Shape alloc] init]; s.sides = self.sides; return s; } Square - (id)copyWithZone:(NSZone *)zone { Square *s = (Square *)[super copyWithZone:zone]; s

Increasing gap between nodes of my D3 tree layout

一世执手 提交于 2019-11-30 07:33:55
As shown in the diagram, I am trying to increase the gap between last nodes on either side of the tree layout as they are overlapping Is there any way to do it in D3? { "name": "", "type": "network", "children": [{ "name": "", "type": "lb", "children": [{ "name": "", "type": "mm", "id": "app", "connServer": "s", "size": 3938 }] }, { "name": "", "type": "vm", "children": [{ "name": "", "type": "container", "children": [{ "name": "", "type": "appServer", "id": "app1", "connServer": "db1", "size": 3938 }] }, { "name": "", "type": "container", "children": [{ "name": "", "type": "webServer", "id":

SQL Server 2008 Hierarchy Data Type Performance?

浪尽此生 提交于 2019-11-30 06:46:08
How does SQL Server 2008's Hierarchy data type perform compared to using the hierarchy implementation described by Joe Celko here: http://www.intelligententerprise.com/001020/celko.jhtml ? I've used Celko's method in the past with great results - but don't want to implement it for a new project unless it's better than what Microsoft has provided in SQL Server 2008. So far, I've only found a single reasonably interesting article on the topic. HierarchyId is much faster than any self-made self-referencing table solution: http://www.sqlservercentral.com/articles/SQL+Server+2008/62204/ I vaguely

Get all parents for a child

北城以北 提交于 2019-11-30 06:06:19
I want to retrieve the parentid of an id, if that parentid has a parent again retrieve it, and so on. Kind of hierarchy table. id----parentid 1-----1 5-----1 47894--5 47897--47894 am new to sql server and tried, some queries like: with name_tree as ( select id, parentid from Users where id = 47897 -- this is the starting point you want in your recursion union all select c.id, c.parentid from users c join name_tree p on p.id = c.parentid -- this is the recursion ) select * from name_tree; It is giving me only one row. and also I want to insert these records into a temporary table variable. How

Get the level of a hierarchy

放肆的年华 提交于 2019-11-30 05:26:39
I have an array of objects, Where each object has an id and a ParentId property (so they can be arranged in trees). They are in no particular order. Please note that the id 's and parentId 's will not be integers, they will be strings (just wanted to have the sample code cleaner..) There is only one root: lets say its id :1 The data looks like so: data = [ { id:"id-2", parentId:"id-3" }, { id:"id-4", parentId:"2" }, { id:"id-3", parentId:"id-4" }, { id:"id-5", parentId:"id-4" }, { id:"id-6", parentId:"id-1" }, { id:"id-7", parentId:"id-1" } // and so on... ] I am looking for a efficient way to

SQL Data Hierarchy

浪尽此生 提交于 2019-11-30 02:22:15
I have looked through a few SQL hierarchy tutorials, but none of them made much sense for my application. Perhaps I am just not understanding them correctly. I'm writing a C# ASP.NET application and I would like to create a tree view hierarchy from SQL data. This is how the hierarchy would work: SQL TABLE ID | Location ID | Name _______| __________ |_____________ 1331 | 1331 | House 1321 | 1331 | Room 2141 | 1321 | Bed 1251 | 2231 | Gym If the ID and Location ID are the same, this would determine the top Parent. Any Children of that Parent would have the same Location ID as the Parent. Any

Multiple parents tree (or digraph) implementation sql server 2005

纵然是瞬间 提交于 2019-11-29 23:24:03
问题 I need to implement a multi-parented tree (or digraph) onto SQL Server 2005. I've read several articles, but most of them uses single-parented trees with a unique root like the following one. -My PC -Drive C -Documents and Settings -Program Files -Adobe -Microsoft -Folder X -Drive D -Folder Y -Folder Z In this one, everything derives from a root element (My PC). In my case, a child could have more than 1 parent, like the following: G A \ / B / \ X C / \ D E \ / F So I have the following code:

How should a REST URL schema look like for a tree hierarchy?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 22:59:10
Let's assume that I have stores, shelves in a store, and products on a shelf. So in order to get a list of products on a shelf in a store, I'd use the following request: GET http://server/stores/123/shelves/456/products From here, how would I get an individual product? Should I use: GET http://server/products/789 Or: GET http://server/stores/123/shelves/456/products/789 The first method is more concise, since once you get a list of products, you don't really care which store it belongs to if you just want to view the details for a particular product. However, the second method is more logical,

C# algorithm for generating hierarchy

早过忘川 提交于 2019-11-29 20:30:19
I've got a text file that looks like this: { Id = 1, ParentId = 0, Position = 0, Title = "root" } { Id = 2, ParentId = 1, Position = 0, Title = "child 1" } { Id = 3, ParentId = 1, Position = 1, Title = "child 2" } { Id = 4, ParentId = 1, Position = 2, Title = "child 3" } { Id = 5, ParentId = 4, Position = 0, Title = "grandchild 1" } I'm looking for a generic C# algorithm that will create an object hierarchy from this. A "Hierarchize" function, if you will, that turns this data into an object hierarchy. Any ideas? edit I've already parsed the file into .NET objects: class Node { public int Id {

Smooth transitioning between tree, cluster, radial tree, and radial cluster layouts

倖福魔咒の 提交于 2019-11-29 19:39:23
For a project, I need to interactively change hierarchical data layout of a visualization - without any change of the underlying data whatsoever. The layouts capable of switching between themselves should be tree, cluster, radial tree, and radial cluster. And transitioning should be preferably an animation. I thought that would be relatively easy task with D3 . I started, but I got lost in translations and rotations, data bindings, and similar, so I am asking you for help. Also, probably I am doing something not in the spirit of D3, which is bad since I am seeking a clean solution. I put