parent-child

MySQL: Calculate depth in a parent-child model?

As title says: How do I calculate a node's depth in a parent-child model? I'll need the depth to, among other things, create the indent in my list (coded with PHP). Thank you in advance. ...

Hibernate @OneToMany with mappedBy (parent-child) relationship and cache problem

Hi, everybody. I have this problem for a long time now, I have searched the web and SO in and out and didn't find a solution yet. I hope you can help me on that. I have a parent-child relationship between two entities like the following: @Entity public class Parent { // ... @OneToMany(mappedBy = "parent", fetch = FetchType.LA...

Accessing document.body of parent window from within IFrame

I have a script in an iframe that listens for movements of the mouse from document.body as follows: $(document.body).addEvent('mousemove',this.refresh.bind(this)); This works fine from within the IFrame, but I want to also track that the mouse is being moved outside of the Iframe. Anyway to do this? I am using MooTools. ...

WPF Displaying Parent Child relationship

I can't wrap my head around how to accomplish rendering this public class Shape{} public class Circle: Shape{} public class Square: Shape { public List<Circle> CircleList{ get; private set; } } I have a List that holds Shape objects, now what I want to accomplish is having each object rendered in a grid. If the object is a Squar...

Ruby/Rails - Implicitly create a parent record when creating a child record?

Ok this is a bit unusual, but I have a series of data collection forms that save data to their respective models. What I want to do is auto insert a common parent (activity/event log - separate model) record that will be common to each form. (All forms will save an implicit record in this model, before saving the child record). So the sa...

MS ACCESS - Hierachical tree sort

I'm struggling with a sorting problem. I've got a table which is as follows: aspect_id (int) aspect_text (memo) root_id (int) which has as a foreign key a aspect_id I've got a non cyclic tree with the following dummy data: aspect_id aspect_text root_id 1 root null 2 aspect1 1 3 aspect2 ...

traversing classes using Jquery

Hi, I'm brand new at working with Jquery, this is actually my first real project with it, and I'm having a little bit of trouble. Here is my HTML: Edit: alright, I fleshed out the code, and included where the function is being called. <tr><th scope="row"><?php echo $box_name[$i] ?></th> <td> <div class="parent_div"> <d...

Get list of parent and child records with multiple entries with criteria - SQL 2005

Hi, I have parent / child tables: parent table: id | description 1 | Alexandra 2 | Natalia child table: id | id_parent | description 1 | 1 | Programmer 2 | 1 | Surgery 3 | 2 | Programmer 4 | 2 | IT How to return set of record according filters, like if we want to get all records with "Programm...

What is the correct way to change properties in a parent form from a child form?

I was just wondering if I'm doing this the correct way. I have 2 forms a parent form and a child form (options dialog). To change a property in my parent form from my child form I use code like this: // Create an array of all rich textboxes on the parent form. var controls = this.Owner.Controls.OfType<RichTextBox>(); foreach (var item ...

Wordpress: Can one page have two parents?

I am developing a small site using Wordpress.org and would like multiple parents to share a child page. The purpose is that users coming to the site will for example associate "Rental Assistance" child page with the "Programs" parent and the "Housing" parent. EDIT: I do not want to simply duplicate the content since this is redundant a...

Is it bad practice to construct a child class with a parent object?

I have a search class that I am using to fetch results from two different sources and combine them together. The Search class is the parent and has two children A and B which extend Search. In the Search class, I have a method called fetch() which instantiates the two child objects to get their results. It looks something like this: ...

Linq to Entities - Retrieve entity with "self-reference" from Stored Procedure

I can't quite figure this out. I have a table called Employee with and Id field. The table also contains a ManagerId field which has a foreign key pointing to the Employee's Id field. When I add the table as an entity to my entity data model it creates the new Employee entity with an EmployeeChildren collection element and an EmployeePar...

C# Threads - Parent Access Problem

my aim is that in the function "Dummy" i can change the controls like labels etc of the form from which the thread is initiating..how to do it..please don't suggest completely different strategies or making a worker class etc...modify this if you can Thread pt= new Thread(new ParameterizedThreadStart(Dummy2)); private...

sql server 2005 query - random child rows of UNIQUE random parent rows

I got a parent table 'ProductCategory' and a child table 'Product'. I have this query that returns 3 random products: SELECT TOP (3) ProductId FROM Product ORDER BY NEWID(); I want to enhance that query to achieve that all the products are from different product categories. So the query to get unique categories would be: SELE...

Checking existence of lazy loaded child without getting/loading in Fluent NHibernate

This should be easy, but I can't seem to figure it out... How can I check if a child on an entity exists without actually getting or fetching it? The child is lazy loaded right now.. so I have two entities: class A { public virtual int Id { get; set; } public virtual B Child { get; set; } } class B { public virtual int Id ...

jquery hover and nested lists.

I really need someone's help. this is what i'm trying to do to .. http://www.chohoh.com/pcs/hoverthing.html now I need to change the font to #fff on the 'month, day and info' when you hover over the element. people keep giving me hints. "child" i've googled (child, jquery, hover) and I'm not finding anything related to what i'm lookin...

Accessing parent iframe from a childs iframe

Okay, I have an html page with two iframes on it so. ------------------------------------------------- | PARENT | | | | | | [iframe1 id=i1 name=i1] | | ...

return parent child data through sql

Hi, I am in a situation where I want to return a list of article objects. The properties of Article object looks as follows. private int _articleId; private string _articleName; private List<Tag> _tags; Now as you can see the article object has a property called _tags which is a list of type "Tag". Now assuming that I want to retur...

Referencing Parent in Cocoa

My question is about how to access the TabBarController from within one of its viewControllers. Imagine a mainClass.m that adds tabBarController which has two viewControllers - viewController1 and viewController2. In viewController1.m there is a game. When the game is over, viewController1.m wants to tell tabBarController to displ...

Childs and parents and the famous garbage collector in actionscript-3

Once again a question about the garbage collector in actionscript-3: If I have a master container: var masterContainer:Sprite = new Sprite(); And then I add a child to this container: var childImage:Sprite = new Sprite(); masterContainer.addChild(childImage); addChild(masterContainer); And, I then decided to let the garbage collec...