children

Children in the same Model - CakePHP

My table 'Post' has field: id, name, content, post_id When i create new post, the field 'post_id'=0, but when I "answer" to Post, the field 'post_id' get id off answered post ID. My question is, how get post by slug field width post_id=0 (parent) and get his children with 'post_id' = parent.id in one query? ...

Trouble with error #1067: Implicit coercion of a value of type String to an unrelated type XML - AS3

Hi all, I'm building a small flash-based language translator. I am cross-referencing children of an XML parent node once the user types in a word or phrase into the text field. The result will be a translation of that word or phrase returned to the output_txt text field. The problem is, Flash gives me this error regarding the value typ...

How to add children of an ItemsControl where the children should decide their own position in Wpf?

Hey all I am using a wpf slider to display the time line in a video player. I need to add an ItemControl of some sort on top of this so that I can add buttons on the time line on certain positions in the time line (the buttons will hold their own position relative to the parent ItemsControl). What ItemsControl container should I use wh...

MATLAB for kids?

My seven-years old expresses large interest in computers (well, who doesn't? :). Since I'm mostly program in MATLAB, I'm thinking why not to teach him MATLAB. We did a small project with him (he had to solve as many simple arithmetic problems as possible in a limited time) and he get pretty excited. I coded, he watched and then tested. H...

What things can I teach a group of children about programming in one day?

I'm running a day for 30 kids aged 11-18 about computer game programming. They have all opted to do it, but they have no experience at all of programming. My main aim is for them to learn a few things: programming is hard/challenging programming is something they can learn to do being a computer games programmer != playing games all da...

Jquery: How to affect parent WHILE not children?

Hi, Is there a way to not affect children that are inside a parent when the parent is being changed? <p>old text <a class="mylink">old link text</a></p> $("a.mylink").click(function() { $(this).parent().text("new text for p"); $(this).text("new link text for a"); }); }); The above seems to get rid of the link tex...

Career day in kindergarten: how to demonstrate programming in 20 minutes?

Original Question I was invited to the kindergarten group of my elder daughter to talk and answer the kids' questions about my profession. There are 26 kids of age 4-6 in the group, plus 3 teachers who are fairly scared of anything related to programming and IT themselves, but bold enough to learn new tricks. I would have about 20-30 mi...

C#/mono: get list of child processes on Windows and Linux

Hi all. I have the code below for getting a list of child processes on windows by interop'ing with ntdll. Is there an equivalent to 'NtQueryInformationProcess' on Linux, which get's me the process id of the parent of a specified process (like pbi.InheritedFromUniqueProcessId)? I need the code to run on Linux through Mono so hopefully I a...

Python-daemon doesn't kill its kids

When using python-daemon, I'm creating subprocesses likeso: import multiprocessing class Worker(multiprocessing.Process): def __init__(self, queue): self.queue = queue # we wait for things from this in Worker.run() ... q = multiprocessing.Queue() with daemon.DaemonContext(): for i in xrange(3): Worker(q) ...

Subsonic, child records, and collections

Hi, I've been working with subsonic for a few weeks now, and it is working really well. However, I've just run into an issue with child objects with additional partial properties. Some of it is probably me just not understanding the .Net object lifecycle. I have an object - search. This has a few properties like permissions and stuff, ...

how do I find the number of xml children in AS3

so live docs says this for calling .lenght() on an XML object For XML objects, this method always returns the integer 1. The length() method of the XMLList class returns a value of 1 for an XMLList object that contains only one value. i called it on an xml that looked like this: <xml> <picture>1</picture> <picture>2</pictu...

Rails, Deleting Children without Deleting Parent using :has_many

I have a model called MyContainer, which :has_many MyObjects. I want to delete all the MyObjects in the container without having to delete the MyContainer. My model does have :dependent => :destroy, however I don't want to have to delete and re-create the object because it is slower. Something like this does not work: @obj = MyContai...

Capture a keyup event at application level in WPF

Hi I have an application built in wpf. At the base level I have a usercontrol and on that usercontrol are many components. I want to be able to capture a key press event on my usercontrol even if the focus is on one of the children. Using PreviewKeyUp doesn't seem to do the trick. Thanks, Matt. ...

How do I make this loop all children recursively?

I have the following: for (var i = 0; i < children.length; i++){ if(hasClass(children[i], "lbExclude")){ children[i].parentNode.removeChild(children[i]); } }; I would like it to loop through all children's children, etc (not just the top level). I found this line, which seems to do that: for(var m = n.firstChild; m != nu...

How do I fork a maximum of 5 child processes of the parent at any one time?

I have the following code, which I'm trying to only allow a maximum of 5 children to run at a time, but I can't figure out how to decrement the child count when a child exits. struct { char *s1; char *s2; } s[] = { {"one", "oneB"}, {"two", "twoB"}, {"three", "thr4eeB"}, {"asdf", "3th43reeB"}, {"asdfasdf", "thr33eeB"}, ...

In Python BeautifulSoup How to move tags

I have a partially converted XML document in soup coming from HTML. After some replacement and editing in the soup, the body is essentially - <Text...></Text> # This replaces <a href..> tags but automatically creates the </Text> <p class=norm ...</p> <p class=norm ...</p> <Text...></Text> <p class=norm ...</p> and so forth. I nee...

jQuery - fade out when clicking on parent element (and not the parents children)?

I've got the following code on my page, and what i'm trying to do is that when a user clicks outside the #loginBox, i want the entire #loginOverlay to fadeout. But i can't achieve this effect without having the fadeout triggered by clicking on #loginBox... It's placed on the bottom of the page, and i have a link on the page that trigger...

jquery ui sortable serialize from children

I want to send an Array with image paths and captions to a PHP script after I sorted the images. I can do 'serialize' or 'toArray' on the lists, but how to get the attributes from the img tag? <ul class="gallery"> <li id="li-1"> <img src="tn/001.jpg" alt="first caption" /> </li> <li mycaption="some caption" id="li-2"...

WPF: Binding items added to UserControl's exposed children

I have a user control that allows items to be added to it by exposing a Grid's Children property. Any control I add shows up fine but when I try to bind a property on the added item to a control in the main window nothing happens (example): <TextBox Name="txtTest" Text="Success!" /> <mycontrols:CustomUserControl.ExposedGridChildren> ...

Using JQuery to get text of a div that's a child of a header to replace a different header

Hello all, I'm trying to get the text contents of a .div('.child#') child of my event.target('h6.class'), and replace my other headers('h1.replacHeader#') using this script below... $('h6.HeaderToBeClicked').click(function(event) { var $target = $(this); $('.replaceHeader1').replaceWith("<h1 class='replaceHeader1'>" + $target.c...