CCRepeatForever do not repeat action in sequence - cocos2d-x

i have some code sentences
CCSequence* seq2 = CCSequence::create(CCCallFunc::create(_clawNode, callfunc_selector(ClawNode::swing))
, CCDelayTime::create(1.6)
, CCCallFunc::create(_clawNode, callfunc_selector(ClawNode::dig))
, CCDelayTime::create(0.1)
, NULL
);
_clawNode->runAction(CCRepeatForever::create(seq2));
The problem is that the CCRepeatForever do not repeat action in sequence, it just do it 1 time. Anyone knows how to fix this issue?
Any help would be appreciated!

Selector target object in CCCallFunc should be CCLayer in which your node is added. Therefore you should use like :
CCSequence* seq2 = CCSequence::create(CCCallFunc::create(this, callfunc_selector(ClawNode::swing))
, CCDelayTime::create(1.6)
, CCCallFunc::create(this, callfunc_selector(ClawNode::dig))
, CCDelayTime::create(0.1)
, NULL
);
_clawNode->runAction(CCRepeatForever::create(seq2));
Apart from this your code is fine. You might check if anywhere else if you are stopping actions of the Node in callback functions.

Related

How to do if else condition in laravel when else case is need to skip

Actually I don't want to check the else condition of below code and status 1 is compulsory only in the case of co_order_paymenttype_id is 1( both are in same table)
this is my code
DeliveryOrder::where('cb_order_type' , 0)->whereRaw('IF (`co_order_paymenttype_id` = 1,
`status` = 1,`status` = 0)')->paginate($page);
Ok as I commented above if you don't need else then it's not the case that you should use if statment.
you shoud use only where to get your needs and to make that in laravel you need to use advanced where
DeliveryOrder::where('cb_order_type' , 0)->where(function($query){
$query->where('co_order_paymenttype_id', 1)
->where('status' = 1);
})->paginate($page);
if you need to and any other condition you need to change it as you want, you can add another orWhere for expample.
please read the documentaion in the link above.

Remove All Unnecessary Whitespaces from JSON String with regex (in AutoHotKey)

How do I remove ALL unnecessary white-spaces from a JSON String (in AutoHotkey)?
I assume that I need to use regExReplace with some clever regex in order to NOT touch the white-spaces that are part of the values.
A simple example would be:
Before:
g_config :=
{
FuzzySearch:{
enable: true,
keysMAXperEntry : 6,
o = {
keyString: "Hello World"
}
}
} ;
After: g_config:={FuzzySearch:{enable:true,keysMAXperEntry:6,o={keyString:"Hello World"}}};
Basically, I'm looking for a way to minify and pack the string as tight as possible without changing any data.
first I tried searching [\n]+ and replace with "" (nothing). Developed here:
https://www.regextester.com/?fam=106988
the same here
https://regex101.com/r/dZnHaZ/1
Best try: Then I reused this
https://www.codeproject.com/Questions/1230349/Remove-extra-space-in-json-string
to:
https://regex101.com/r/EYFHy9/4
Problem: this regEx also removes the spaces in a value.
Is it even better to do?
Along the lines of what #Aaron mentioned, here is some slow-as-hell AHK code that will look at each individual character and remove it if it's a space or line break, except between quotes. It starts at your cursor and ends once there is nothing left to copy (or rather, one second after).
;;; For speed? Maybe?? ...It's still slow :(
ListLines Off
SetBatchLines , -1
SetKeyDelay , -1 , -1
SetMouseDelay , -1
SetDefaultMouseSpeed , 0
SetWinDelay , -1
SetControlDelay , -1
SendMode , Input
f1::
Loop
{
clipboard := ""
Send , +{right}^c
ClipWait , 1
If ErrorLevel
Break
bT := ( clipboard = """" ) ? !bT : bT
Send , % ( !bT && ( clipboard = "`r`n" || clipboard = A_Space || clipboard = A_Tab )) ? "{del}" : "{right}"
}
Return

Adding Html tag into the title of the Tree query in Oracle APEX

I have a requirement to make few text in the title of my tree query in Oracle APEX to bold by adding b tag. But when i do that, the tag is displayed at the front end. My query is as mentioned below. I do not want to see the b tag, rather i want the text enclosed by b tag to be bold. Please help.
SELECT
CASE
WHEN CONNECT_BY_ISLEAF = 1 THEN 0
WHEN level = 1 THEN 1
ELSE -1
END
AS status,
level,
CASE
WHEN level = 1 THEN questions
ELSE '<b>' -- Comes in the front end which i do not want
|| flow_condition
|| '</b>'
|| ' - '
|| questions
END
AS title,
NULL AS icon,
question_id AS value,
NULL AS tooltip,
--null as link
apex_page.get_url(
p_page => 401,
p_items => 'P401_QUESTION_ID',
p_values => question_id,
p_clear_cache => 401
) AS link
FROM
(
SELECT
mmq.*,
mmm.flow_condition
FROM
msd_mc_questions mmq
LEFT OUTER JOIN msd_mc_par_chld_mapping mmm ON (
mmq.parent_id = mmm.parent_question_id
AND
mmq.question_id = mmm.child_question_id
)
)
START WITH
parent_id IS NULL
CONNECT BY
PRIOR question_id = parent_id
ORDER SIBLINGS BY questions
Struggled with this for hours but then found a solution via jQuery. Create a dynamic action that on page load and executes javascript. Find all items with class .a-TreeView-label (assuming that's the class name at runtime that you get as well - check to be sure) and loop over them and for each one, replace its text with itself. This forces it to re-render as HTML. My code in the javascript task:
$(".a-TreeView-label").each(function(index){
$(this).replaceWith($(this).text());
});
On the item attribute "Escape special characters" change to "No"

Jython - anyone got an idea why this Action isn't doing what I want?

This is about unit testing (using Python's unittest module). I'm trying to implement, programmatically, the user's pressing "F2" to start editing the cell of a JTable.
The utility method "run_in_edt" wraps the passed method in a Runnable and then runs it using invokeAndWait, rather than invokeLater.
def test_can_edit_table_date(self):
main_frame = FTCase2.app.main_frame
dates_table = main_frame.dates_table
def start_editing():
dates_table.requestFocus()
f2_key_stroke = javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_F2, 0 )
im = dates_table.getInputMap( javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT )
action_value = im.get( f2_key_stroke )
self.assertEqual( action_value, 'startEditing' )
am = dates_table.actionMap
self.f2_action = am.get( action_value )
self.assertIsNotNone( self.f2_action )
sel_row = dates_table.selectedRow
self.assertNotEqual( sel_row, -1 )
self.assertTrue( dates_table.isCellEditable( sel_row, 0 ))
self.start_editing_action_event = java.awt.event.ActionEvent( dates_table,
java.awt.event.ActionEvent.ACTION_FIRST, 'X' )
self.f2_action.actionPerformed( self.start_editing_action_event )
# dates_table.editCellAt( sel_row, 0 )
# self.assertTrue( dates_table.editing )
_utils.run_in_edt( start_editing )
# time.sleep( 1 )
def write_string_in_cell_editor():
self.assertTrue( dates_table.editing )
cell_editor = dates_table.cellEditor
self.assertIsNotNone( cell_editor )
cell_value = cell_editor.cellEditorValue
cell_editor.component.text = "mouse"
self.f2_action.actionPerformed( self.start_editing_action_event)
_utils.run_in_edt( write_string_in_cell_editor )
The problem: "dates_table.editing" always comes out false... and getting the cell editor returns None. I have also tried putting a sleep between these two Runnables, just in case it was a question of "events having to bubble up/down"...
NB I also tried with a more sensible value as the 3rd param of ActionEvent, such as action_value (i.e. 'startEditing'). No joy.
I can of course do:
dates_table.editCellAt( sel_row, 0 )
... with this uncommented, what's interesting is that, in the second method here, I set the JTextField's ("editor delegate") text to "mouse", and then "press F2" by using the action.actionPerformed... and... it works, in the sense that in my table cell renderer I allow only dates values or None, not strings, so an AssertionError is raised. Meaning that I have managed to simulate an F2 key press (NB although the name of this action is "startEditing", it also stops an editing session, in real life as in testing).
... I could content myself with using editCellAt, and having ascertained that F2 has the right entry in the right InputMap, and that the value is pops out is an Action (could be checked) with the name "startEditing", which is proven to be capable of ending an edit, I could just content myself with that.
But I so hate it when my understanding is revealed to be less than good! I want to know WHY this doesn't work...
Found the answer and put it here for reference.
My requestFocus() action on the JTable did indeed leave selection on the right row, but without any selection of the (single) column. Even when running as normal (not testing) the JTable column did not initially respond to F2. It was puzzling to me why the cell was not initially surrounded by a heavy black border. The answer was therefore to put this line after the requestFocus line:
dates_table.setColumnSelectionInterval( 0, 0 )

understanding and using hasOwnProperty

Can someone explain to me how to assign and use hasOwnProperty. I did search the web for a decent example but somehow didnt find any even at adobe( or maybe Im to "smart" to understand what it is saying )
so what Im trying to do is to set a propertie onto a MovieClip and after that to see if it exists.
var myMC:MovieClip = new MovieClip();
myMC.hasOwnProperty( "someRandomText" );
this.addChild( myMC );
if( myMC.hasOwnProperty( "someRandomText" ) ) trace(" yes it has it ")
else trace( "nothing here" )
output: nothing here
what am I doing wrong ?
and also :) how do I null/remove it after I add it to the MC
hasOwnProperty() checks whether an object has a property of that name. Basically, it'll return true if a property has an instance name matching the string.
The reason hasOwnProperty("someRandomText") returns false in your code is simply because myMC.someRandomText does not exist. Your second line seems to try making it but that's not what the function does.
A better test would be:
if( myMC.hasOwnProperty( "width" ) ) trace(" yes it has it ");
else trace( "nothing here" );
All MovieClips have a width property so this should return true. I haven't tested it but it should work.
The definition on the AS3 Reference is pretty much the best explanation you can get.