Questions tagged [parent]

In an oriented tree, the parent is the previous node before the node of interest. The word parent can then be used in countless abstractions of computer science. The container of contained graphic or logic items can be called a parent. The inherited class in OOP can be called the parent.

2914 questions
26
votes
3 answers

Difference between restrict_with_exception and restrict_with_error

Can anyone tell me the difference between these two ways when dealing with object whose parent key is destroyed? What practical reason makes you choose one from the other?
Eric Chuhao Chan
  • 367
  • 1
  • 3
  • 5
26
votes
4 answers

Is it possible to adopt a process?

Process A fork()s process B. Process A dies and therefore init adopts B. A watchdog creates process C. Is it somehow possible for C to adopt B from init? Update: Or would it even be possible to have C adopt B directly (when A dies), if C were…
alk
  • 69,737
  • 10
  • 105
  • 255
24
votes
3 answers

How to cast parent into child in Java

I am doing this: Child child = (Child)parent; Which gives me an error, I found it isn't possible to do it like this. I don't know exactly why, but I think it should be possible, if Child class inherits from Parent class, it contains the Parent…
likaa
  • 273
  • 1
  • 2
  • 7
24
votes
8 answers

jQuery select descendants, including the parent

Consider the following HTML:
I should be changed red
I should not be changed red.
I should be changed red.
Given a DOM…
Sam
  • 6,167
  • 6
  • 26
  • 24
24
votes
2 answers

Reference $(this).parent with class name of 'x'

In jquery, how can I refer to the parent of $(this) element with a class of 'abc'?
d-_-b
  • 21,536
  • 40
  • 150
  • 256
23
votes
2 answers

Getting the parent node attributes in XSL

In my XML I have the following: someResult Now in the XSL within a loop I can do the following:
ingh.am
  • 25,981
  • 43
  • 130
  • 177
23
votes
1 answer

Android: Making changes to a button's parent view

I have a RelativeLayout with a button inside it. Once the user clicks on that button, I would like to change the background of the parent view (RelativeLayout). I know I can do this by storing the parent view in a variable or setting a tag on the…
user496854
  • 6,461
  • 10
  • 47
  • 84
23
votes
5 answers

Most elegant way to find node's predecessors with networkX

I'm working on a graphical model project with python using NetworkX. NetworkX provides simple and good functionality using dictionaries: import networkx as nx G = nx.DiGraph() # a directed graph G.add_edge('a', 'b') print G['a'] # prints {'b':…
user
  • 7,123
  • 7
  • 48
  • 90
22
votes
4 answers

How to get windows batch's parent folder

I'm writing a batch file, I need to get the parent folder of this bat file. Is it possibile? NB I mean the parent folder of the batch file not of the current directory of the prompt calling that batch. Thanks
Tobia
  • 9,165
  • 28
  • 114
  • 219
22
votes
4 answers

Opposite to jQuery's .Closest (Top/Far-Most?)

I have a code with lots of submenus that share the same class name. Here's a structure: .menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .sub-menu .elem .elem .sub-menu Note that .sub-menu may be infinite…
Dzhuneyt
  • 8,437
  • 14
  • 64
  • 118
21
votes
9 answers

ExpandableListView - How to set divider only between parent elements

I want to put divider only between parent elements. When i set android:divider="@drawable/divider" android creates divider between parent elements, but creates divider between child elements too. When i add android:childDivider="@color/transparent"…
Plamen Nikolov
  • 4,177
  • 3
  • 23
  • 24
21
votes
5 answers

jQuery what instead $(this).parent().children()

Just a quick example:

$('input').click(function(){ $(this).parent().children('span').text('Suprise!'); …

Mr Sooul
  • 659
  • 2
  • 9
  • 19
21
votes
2 answers

What is parent for in Qt?

Almost every QtWidgets class can have parent. And usually it's optional to set parent at object initialization. For example,If I create a class that inherits QWidget class, I will do the following on the constructor: Widget::Widget(QWidget* parent):…
Mas Bagol
  • 4,377
  • 10
  • 44
  • 72
20
votes
2 answers

Get other child that shares parent with the current view

I'm creating a table in which each row contains text as well as a button. Now when that button is pressed I want to call an event that uses the value of the text next to the button. How can I access the content of that TextView? I can get the…
Lars
  • 523
  • 1
  • 6
  • 20
20
votes
2 answers

Python subprocess get children's output to file and terminal?

I'm running a script that executes a number of executables by using subprocess.call(cmdArgs,stdout=outf, stderr=errf) when outf/errf is either None or a file descriptor (different files for stdout/stderr). Is there any way I can execute each exe…
user515766
  • 349
  • 2
  • 5
  • 7