hierarchy

iOS difference between isKindOfClass and isMemberOfClass

旧巷老猫 提交于 2019-11-26 23:25:19
What is the difference between the isKindOfClass:(Class)aClass and the isMemberOfClass:(Class)aClass functions? I know it is something small like, one is global while the other is an exact class match but I need someone to specify which is which please. In Swift isKind(of aClass: AnyClass) and isMember(of aClass: AnyClass) . Sebastian Celis isKindOfClass: returns YES if the receiver is an instance of the specified class or an instance of any class that inherits from the specified class. isMemberOfClass: returns YES if, and only if, the receiver is an instance of the specified class. Most of

Convert delimited string into hierarchical JSON with JQuery

自古美人都是妖i 提交于 2019-11-26 22:46:22
问题 I have an array of strings that describe the parent/child relationship by being delimited with dashes. So, if Bob's boss was Jim and Jim's boss was Fred, Bob's entry in the array would be "Fred-Jim-Bob" and Jim's entry would be "Fred-Jim." I don't have the ability to change the way the data is coming in so I was looking for help as far as the best way of turning these values into JSON similar to this: { "name": "Fred", "children": { "name": "Jim", "children": { "name": "Bob" } } } Any help

Is it possible to create a recursive query in Access?

本秂侑毒 提交于 2019-11-26 22:40:54
I have a job table Id ParentID jobName jobStatus The root ParentID is 0. Is it possible in Access to create a query to find a root for a given job ? The database is MDB with no linked tables. The Access version is 2003. A job can be several levels grand children deep. Peter No, It isn't. Recursive queries are supported in SQL Server after SServer 2005, but not in Access. If you know the number of levels beforehand, you could write a query, but it wouldn't be a recursive one. In SQL Server, CTE (An SQL extension) is used for that : see http://blog.crowe.co.nz/archive/2007/09/06/Microsoft-SQL

Count all child nodes of hierarchical data in a table

若如初见. 提交于 2019-11-26 21:41:28
问题 I want to count number of all child nodes under any level of tree structure maintained in a table using adjacency model (parent-child key). Table structure and data looks like this: id - item- parentid 1 - A - 2 - B - 1 3 - C - 1 4 - D - 2 5 - E - 2 6 - F - 3 7 - G - 3 8 - H - 5 9 - I - 5 10 - J - 9 11 - K - 4 For example B has following child and grand child structure: B E H I J F K Now if you want to count "All child nodes of B" my answer should be 6. Any pure SQL Query based solution would

MySQL Nested Sets - How to find parent of node?

非 Y 不嫁゛ 提交于 2019-11-26 20:59:54
问题 I have your run of the mill nested set hierarchy type setup with the following columns: table name: myset columns: id, name, lft, rgt Does anyone know a query to determine the parent of a node? I read a couple places that it's handy to also have a parent_id column in your table to keep track of this, but it seems redundant and it seems like it could get out of sync with the nested set if a query was incorrectly executed when adding/removing/moving anything within the set. 回答1: Look at this

How to mix inheritance strategies with JPA annotations and Hibernate?

和自甴很熟 提交于 2019-11-26 18:49:33
According to the Hibernate Reference Documentation it should be possible to mix different inheritance mapping strategies when using Hibernate's XML-Metadata: http://docs.jboss.org/hibernate/stable/core/reference/en/html/inheritance.html#inheritance-mixing-tableperclass-tablepersubclass However, the corresponding section of the Hibernate Annotations Reference Guide does not cover that: http://docs.jboss.org/hibernate/stable/annotations/reference/en/html/entity.html#d0e1168 On the other hand, the JavaDocs suggest that mixing inheritance strategies should be possible. For instance in javax

MySQL - Recursing a tree structure

早过忘川 提交于 2019-11-26 17:48:59
问题 I have a database table which link locations together; a location can be in a location, which can be inside another location. location (<id>, ....) location_parent (<location_id>, <parent_id>) Here's the MySQL/PHP to go down for a depth of one: $sql = "SELECT id FROM se_locations_services WHERE parent_locationid IN ( SELECT location_id FROM se_locations_parent WHERE parent_id = '$locationid' )"; How do I, given a parent location, gets all its descendants locations, no matter how deep, just

How can I list all classes loaded in a specific class loader

心不动则不痛 提交于 2019-11-26 17:37:04
For debug reasons, and curiosity, I wish to list all classes loaded to a specific class loader. Seeing as most methods of a class loader are protected, what is the best way to accomplish what I want? Thanks! finnw Instrumentation.getInitiatedClasses(ClassLoader) may do what you want. According to the docs: Returns an array of all classes for which loader is an initiating loader. I'm not sure what "initiating loader" means though. If that does not give the right result try using the getAllLoadedClasses() method and manually filtering by ClassLoader. How to get an instance of Instrumentation

Flat PHP Array to Hierarchy Tree

て烟熏妆下的殇ゞ 提交于 2019-11-26 16:09:06
问题 I have an array with the following keys id parent_id name A sample array: array(7) { [0]=> array(3) { ["id"]=> string(1) "4" ["parent_id"]=> string(1) "0" ["name"]=> string(16) "Top Level Page 4" } [1]=> array(3) { ["id"]=> string(1) "5" ["parent_id"]=> string(1) "1" ["name"]=> string(19) "Second Level Page 1" } [2]=> array(3) { ["id"]=> string(1) "6" ["parent_id"]=> string(1) "2" ["name"]=> string(19) "Second Level Page 2" } [3]=> array(3) { ["id"]=> string(1) "7" ["parent_id"]=> string(1)

Tree drawing orientation

江枫思渺然 提交于 2019-11-26 16:08:32
问题 I've made a slightly modified tree using the tree layout. I needed to orient the tree right-to-left instead of the regular left-to-right orientation that's the default. What is the right and proper d3:ish way to do this? I ended up doing this by simply inverting the x coordinate after creating the layout but I feel that this is a hack. Surely there is something more elegant? I thought about doing an SVG rotation around the center but then I'd have to rotate the labels to get the text right