Search on descendants of an element

The advantage of separating the child from the child css selector would only be if you’d like to use the parent for something else. Otherwise, it’s slightly faster to do it in one call, like expect(element(‘#parent_1 > .red’)).toBe(‘red’); since Protractor doesn’t need to make two calls to the browser in this case. Another reason to … Read more

How can I rename files with Grunt, based on the respective file’s parent folder name?

This can be done using the grunt-contrib-copy plugin. The main thing to note is that you can change the destination programmatically by using a rename function (which takes in the destination and source of each file). Here is a (somewhat brittle) sample Gruntfile.js that should copy to your desired structure: module.exports = function(grunt) { // … Read more

Are child processes created with fork() automatically killed when the parent is killed?

No. If the parent is killed, children become children of the init process (that has the process id 1 and is launched as the first user process by the kernel). The init process checks periodically for new children, and waits for them (thus freeing resources that are allocated by their return value). The question was … Read more

Why is forEach not working for children?

Because .children contains an HTMLCollection [MDN], not an array. An HTMLCollection object is an array-like object, which exposes a .length property and has numeric properties, just like arrays, but it does not inherit from Array.prototype and thus is not an array. You can convert it to an array using Array.prototype.slice: var children = [].slice.call(document.getElementById(…).children); ECMAScript … Read more

CSS :: child set to change color on parent hover, but changes also when hovered itself

Update The below made sense for 2013. However, now, I would use the :not() selector as described below. CSS can be overwritten. DEMO: http://jsfiddle.net/persianturtle/J4SUb/ Use this: .parent { padding: 50px; border: 1px solid black; } .parent span { position: absolute; top: 200px; padding: 30px; border: 10px solid green; } .parent:hover span { border: 10px solid … Read more

get parent’s view from a layout

The getParent method returns a ViewParent, not a View. You need to cast the first call to getParent() also: RelativeLayout r = (RelativeLayout) ((ViewGroup) this.getParent()).getParent(); As stated in the comments by the OP, this is causing a NPE. To debug, split this up into multiple parts: ViewParent parent = this.getParent(); RelativeLayout r; if (parent == … Read more

How to specify the parent query field from within a subquery in MySQL?

How about: $query = “SELECT p1.id, (SELECT COUNT(1) FROM post_table p2 WHERE p2.parent_id = p1.id) as num_children FROM post_table p1 WHERE p1.parent_id = 0”; or if you put an alias on the p1.id, you might say: $query = “SELECT p1.id as p1_id, (SELECT COUNT(1) FROM post_table p2 WHERE p2.parent_id = p1.id) as num_children FROM post_table … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)