hierarchy

How can I split my javascript code into separate files?

假如想象 提交于 2019-12-20 08:31:02
问题 I'm reading the Javascript Guide from Mozilla And when they contrasted JS to Java , It got me thinking, Java code is easily split up with each class in his own file. after futher search , I understand that the same can be accomplished in JS with namespacing and module pattern - I messed around with it but got very confused ( especially with calling a constructor declared in File1.js into File2.js ) so here is the hierarchy: But i just can't figure out how to properly make it works how do i

Hierarchy Visual Design

与世无争的帅哥 提交于 2019-12-20 05:40:49
问题 I have a hierarchy of categories, where a category can have a single parent (and you can have multiple levels of children.) I'm investigating ways to display this information to the user and it seems like a basic vanilla tree layout is the most intuitive way to go. But I'm wondering if anyone can suggest other approaches. The requirements would be, 1) clearly demonstrate to the user the list's parent / child relationships 2) allow the user to easily move items around (whether by drag and drop

Category hierarchy from array(cat id => parent id)

 ̄綄美尐妖づ 提交于 2019-12-20 04:25:11
问题 i am trying to create a multidimensional array hierarchy from a simple array which contains pairs of category ids and parent ids. The categories can be a parent and a subcategory at the same time. The base categories have a parent of 0 (=no parent). For example: # cat_id => parent_id $initialArray = array( 1 => 0, 2 => 1, 3 => 2, 4 => 0, 5 => 4, 6 => 0 ); From this, i'd like to get an array that represents a structure like this: 1 2 3 4 5 6 I will not know the contents of $initialArray

rearrange a php array into a nested hierarchical array

怎甘沉沦 提交于 2019-12-20 03:52:15
问题 How can I transform array#1 into the array#2 structure using php ? The first Array is the results of a database query on a list of Organisms, each organism is classified with it's Order, Family, Genus, Species. Hierarchically Species are the child classifications of various Genus, and Genus classifications are child classifications of various Families etc . In namespace terms you could read it like so: item at index[ 0] ---> Hemiptera.Miridae.Kanakamiris item at index[ 1] ---> Hemiptera

How to be notified that a composite's child received/lost focus?

跟風遠走 提交于 2019-12-20 02:34:10
问题 I have an SWT Composite that I need to pass to some other code which will add children to it at will. Is there any way to be notified that a child of the composite received and lost focus? Just to make sure it's clear, I cannot add listeners to each child, because I'm not in charge of creating those controls. A child could be added at any time. 回答1: As noted by Favonius, you can hook layout events like SWT.Resize to determine when you're being painted and recompute your child hierarchy,

Hierarchy in SQL server 2005 with XML

半世苍凉 提交于 2019-12-20 02:26:14
问题 I wonder is there anyway to select hierarchy in SQL server 2005 and return xml format? I have a database with a lot of data (about 2000 to 3000 records), and i am now using a function in SQL server 2005 to retrieve the data in hierarchy and return an XML but it seems not perfect because it's too slow when there is a lot of data Here is my function Database ID Name Parent Order Function CREATE FUNCTION [dbo].[GetXMLTree] ( @PARENT bigint ) RETURNS XML AS BEGIN RETURN /* value */ (SELECT [ID]

Attempt to present UIAlertController on UIViewController whose view is not in the window hierarchy

吃可爱长大的小学妹 提交于 2019-12-19 08:03:12
问题 I'm trying to check the UIAlertController in iOS 9 for my sample application and while run it then I had found warning in console. I'm using Xcode 7 and Objective C. Please find the below warning message in console. Warning: Attempt to present < UIAlertController: 0x7fb1bb5be040 > on < ViewController: 0x7fb1bb5aef30 > whose view is not in the window hierarchy! Please find the below code for more information. UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"My Alert"

Storing folder hierarchy in relational database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-19 08:01:07
问题 I have objects representing folders and I'm wondering if they should be represented in the database. On the one hand it seems like the easiest way would be to not represent folder objects and just store a path value for objects contained in a folder. Problems I see with this is that you can't persist an folder whose descendants do not contain any items, which isn't too big of a deal. Also I don't have a clear idea of how to load the folder hierarchy to display (such as in a TreeView) without

Storing Hierarchical Data (MySQL) for Referral Marketing

天大地大妈咪最大 提交于 2019-12-19 07:28:40
问题 I need to have a 5 levels hierarchy for the users registered to a website. Every user is invited by another, and I need to know all descendants for a user. And also ancestors for a user. I have in mind 2 solution. Keeping a table with relationships this way. A closure table: ancestor_id descendant_id distance 1 1 0 2 2 0 3 3 0 4 4 0 5 5 0 6 6 0 2 3 1 Having this table for relationships. Keeping in a table 5 levels ancestors. A "ancestors" table: user_id ancestor_level1_id ancestor_level2_id

PHP/MySQL - building a nav menu hierarchy

随声附和 提交于 2019-12-18 17:32:10
问题 So the final menu will look something like this: Item B Item B-1 Item B-1-2 Item B-1-1 Item A SubItem A-1 SubItem A-2 Item C Based on the following DB records: id menu_title parent_menu_id menu_level weight 1 Item A 0 1 1 2 Item B 0 1 0 3 Item C 0 1 2 4 SubItem A-2 1 2 1 5 Item B-1 2 2 0 6 Item B-1-1 5 3 1 7 SubItem A-1 1 2 0 8 Item B-1-2 5 3 0 How would I go about displaying? My guess is it'll involve storing all the items into a multidimensional array, then looping through it somehow... 回答1