I suppose it is possible to find the leaves of a particular node.
The first line of my code works, the second returns an empty object {}
What am I doing wrong? Thanks!
console.log( cy.nodes().leaves().jsons() );
console.log( cy.nodes("[id='1.1']").leaves().jsons() );
Selectors can't have metacharacters, like .. You need to escape them. Refer to http://js.cytoscape.org/#selectors/notes-amp-caveats
Related
I am using _.findIndex which returns me an array, which needs to be pushed to array. How can I do this?
$scope.filtersRequested[_.findIndex( $scope.filtersRequested, {
'codeColumnName': $scope.refData[idx].codeColumnName
} )].filterCondition = strWhere;
If I understand correctly, you'd like to set filterCondition on a specific value. Since you use lodash, you'd better use _.set which is safe (i.e. does not fail if the first arg is undefined) and _.find (to get access to the relevant request). Hence, I'd suggest you do:
_.set(
_.find( $scope.filtersRequested, {'codeColumnName': $scope.refData[idx].codeColumnName} ) ,
'filterCondition', strWhere
);
If an element was found, the _.set will operate on it, otherwise, it will gracefully ignore it.
I tried to access the following value in an multidimensional array:
var temp = allSliderData[i]['slider_full'][j].path;
and it works fine, but the following not
var temp2 = allSliderData[i]['slider_thumbs'][j].285x255;
with the answer
"SyntaxError: identifier starts immediately after numeric literal"
I now tried escapings, array functions .. this message is good known in stackoverflow .. but still no luck.
Could anybody help out?
THANKS!!
Something like that won't work. You can't have a property named "2" there. What exactly do you want to do?
the idea is to take a word and sub out all specified letters for another letter.
Any help on how to make this kind of function work?
The last array_push is not being called because you're returning before. Change it to:
array_push($stepsinchain, $subed);
return $subed;
Since $subed is never stored in the $stepsinchain array, due to the return being before, you're not able to access previous alternations.
array_push is also slower and not recommended when entering one element in an array. Instead, use
$stepsinchain[] = $subed;
It is also much faster as documented at http://www.php.net/manual/en/function.array-push.php#Hcom83388
Here's a chunk of code that WORKS when it's on the main timeline:
var DysonTarget:String = "S"+(random(40)+1);
this[DysonTarget].MyType = "Dyson Sphere";
this[DysonTarget].gotoAndStop(this[DysonTarget].MyType);
It's choosing a number between 1 and 40, adding an S before it, and going into one of forty movie clips on the main stage with instance name S1, S2. . . S40 etc. Then it will display an image in the chosen clip. But to make this truly work the way I want to, I have to put the above code inside a movie clip. So I tried this, after declaring my variable on the main stage:
_root.this[DysonTarget].MyType = "Dyson Sphere";
_root.this[DysonTarget].gotoAndStop(this[DysonTarget].MyType);
It didn't compile, the error message said "Expected a field name after the '.' operator. Trying it with _parent returned the same message. With _level0 didn't work at all, and placing the _root and _parent inside the bracket didn't work either. I haven't been able to find any answer online because trying to type "this" into a search is too vague to return an answer about the actual command.
. . .help me :(
A friend of mine who is a software developer helped me on this one. Here's what we figured out:
First you declare variable DysonTarget on the main timeline:
var DysonTarget:String = "S" + (random(40)+1);
Then inside the movie clip, use this:
_level0[DysonTarget].MyType = "Dyson Sphere';
_level0[_level0.DysonTarget].gotoAndStop(_level0[_level0.DysonTarget].MyType);
I've tried this a few other ways, and the above method is the only one that works the way it's supposed to. But it works! My impression is the brackets tell it to look for an object named what the variable is set to, rather than an object with the same name as the variable.
I'm reading the couchapp tutorial http://couchapp.org/page/evently-do-it-yourself-ii-state and am confused on two points (I don't like being told answers without knowing why they are what they are):
$ cat data.js
function(e) {
$$(this).toppings = [];
}
What's the "e" parameter in data.js?
What exactly does the $$(this) function return, and how do I find out more about it? Is it solely user-definable state, or are there methods or special state parameters that I need to know about?
You can find more about $$() in this post from wycats, as reported in the sources.
I don't use Evently any more, so I don't remember what the e parameter is. However you can easily check it using Firebug.