I am using Velocity to check if a string ends with a particular value, but I cannot get it to behave. I am using $element.elementType.endsWith("startevent"), which will print true or false correctly, but when I put it into an #if(), it behaves as if it were always true. I have even tried adding .booleanValue() == 1, .booleanValue() == true, and even .booleanValue().toString() == "true". Nothing seems to work. What gives?!
Related
The script is intended to break the loop on XButton1, but fails.
I am a newbie in AHK scripting and a really simple script I made is not working as intended. I googled it and it works on everyone.
ended = false
XButton1::
ended = true
return
$XButton2::
ended = false
Loop
{
if (ended = true)
{
break
}
MouseClick left
Sleep 10
}
return
It was supposed to click infinitely until Mouse4 (XButton1) is pressed. But it does not stop when I click it.
I also checked other StackOverflow posts and nothing solved it.
Your code uses legacy-syntax which was a major headache for me (and I believe many others) when I was starting with AHK.
To make your code work change:
if (ended = true)
to
if (ended = "true")
Consider switching to := (SetExpression) instead of =
For example:
ended = false
should become
ended := false
I'm new to Groovy and came to Groovy and grails from Java.
I cannot explain this:
boolean boolVar = false
if (boolVar) {
print "ok"
}
but code execution run inside "if" block, nut boolVar is false
debugger session screenshot
I think the screenshot is a bit wrong as you have nothing after the condition so intelliJ highlight this line but it does not execute it, it seems it goes to the block but it does not print the ok, can you show the result of the run window ?
for example add this to your code
boolean boolVar = false
def output = "I start here"
if (boolVar) {
output += "\noops in loop"
println "ok"
}
print output
only I start here is being printed
I'm not sure I get it by 100%, did you try this?
boolean boolVar = false
if (!boolVar) {
println "ok"
}
if(boolVar) and if(boolVar == true) is the same
1.) Remove all breakpoints from your project (Run->View Breakpoints and delete all breakpoints)
2.) Clean the target directory.
3.) Add a new breakpoint at the "print" statement and check if it works now.
I am programming a game on XCode's SpriteKit. I have a variable NodeGamePlay (an SKNode) and I set it to NodeGamePlay.paused=true when I hit a pause button. I have tracked this through various NSLog statements scattered throughout my code and when I set NodeGamePlay.paused=true, the game actually pauses, but it seems to somewhat arbitrarily unpause itself (I don't even have a NodeGamePlay.paused=false anywhere in the code).
Anyways, I have not had any success tracking down when this is getting changed incorrectly to paused=false. I tried using the "watch variable" feature, to watch the variable NodeGamePlay, but the debug won't stop/alert me that NodeGamePlay switches between true & false. I was wondering if there is some method of tracking THIS property and having the debug stop as soon as the value is changed?
Setting .paused == TRUE on children nodes in Sprite Kit produces some odd behavior in my experience, at least in iOS 7, because when a parent node has its .paused set to FALSE, it sets all of its child nodes .paused to FALSE, etc.
So it creates a scenario where you need to override setPaused on your NodeGamePlay class to check a different flag to see if it should allow .paused to be set to FALSE when its parent calls it.
-(void)setPaused:(BOOL)paused
{
if (paused == NO && self.iAmAllowedToUnPauseWhenParentTellsMe == NO) {
return;
}
[super setPaused:paused];
}
if (isGameOne == TRUE and isGameTwo == FALSE){
x.view.frame = xGraph->theGraph.frame;
y.view.frame = yGraph->theGraph.frame;
} else {
/*remove above frame here*/
}
Above is my script i am working with. When isGameOne is true, i want it to attach x.view.frame to xGraph->theGraph.frame; And same for 'y', but this works fine.
What i am having an issue with is understanding how i would remove x.view.frame the frame if isGameOne is not true (false).
I am sure its probably something really easy to do, but i am still getting my hand dirty with objective-c. Sorry for my ignorance
Cheers
=========[ How to do this ]========
I actually have a button that quits game one, so inside the gameOne method i have
if (isGameOne == TRUE and isGameTwo == FALSE){
x.view.frame = xGraph->theGraph.frame;
y.view.frame = yGraph->theGraph.frame;
}
inside my quit button method i added:
isGameTwo = TRUE;
isGameOne = FALSE;
if (isGameOne == FALSE and isGameTwo == TRUE) {
/* code to remove *DoodlePad from *Grap */
[xDoodlePad.view setHidden:YES];
[yDoodlePad.view setHidden:YES];
}
It depends on what you are doing with those frames. If you want them to be moved to another location on the screen, you could predefine that frame elsewhere and assign it, or you could use CGRectMake to create a specific frame right there.
If you are wanting to hide/show the views based on this condition, you should already have the appropriate frames set before the conditional and just call setHidden on the views with the appropriate argument.
Note that CGRects are structs, so there is assignment of the value itself taking place. You are not maintaining a reference to the other frame.
Is it possible to turn off the row selection feature on Flexigrid?
It's somewhat annoying when you haven't implemented anything that makes use of the selection.
Unfortunately Mr Flibble's accepted answer does not stop all selection capability, it merely restricts it to one row.
To disable it completely, add a new property to the $.extend block (around line 20)
// apply default properties
p = $.extend({
<SNIP>
onSubmit: false, // using a custom populate function
disableSelect: true
Then in the .click section of the row (around line 754) add a check for the property
$(this)
.click(
function (e)
{
var obj = (e.target || e.srcElement); if (obj.href || obj.type) return true;
if (p.disableSelect) return true;
$(this).toggleClass('trSelected');
if (p.singleSelect) $(this).siblings().removeClass('trSelected');
}
)
Turns out you need to change the singleSelect property to true.
singleSelect: true
I know this thread is a bit old but I came upon it looking for the same thing. The singleSelect didn't work for me as I didn't want to be able to select any row. I found that I could remove any row selection with a single line of code:
$('.grid tr').unbind('click');
This a course removes all bindings on the table row so if you needed the binding you won't have it unless you rebind later but I needed to remove any and all row selection on my table. I didn't need to touch the flexigrid code to do so which I liked a bit more than previous answers.