ActionwithAction and ActionwithDuration method giving error - cocos2d-x

I have an old code .I am trying to port it to new version of Cocos2dx It is giving me errors in the following lines.
CCSequence * pulseSequence = CCSequence::actionOneTwo(CCFadeIn::actionWithDuration(1), CCFadeOut::actionWithDuration(1));
CCRepeatForever* repeatAction = CCRepeatForever::actionWithAction(pulseSequence);
In ActiononeTwo, ActionwithDuration, and ActionwithAction method.It is telling me they are not the part of CCSequence.

CCSequence * pulseSequence = CCSequence::createWithTwoActions(CCFadeIn::create(1), CCFadeOut::create(1));
CCRepeatForever* repeatAction = CCRepeatForever::create(pulseSequence);
This should work.

Related

TypeError: 'cv2.face_EigenFaceRecognizer' object is not callable

I ran into an error which i do not know where and what is causing it.
Please i need help.
def train(self,images,lables, recogType=0):
self.images = images
self.lables = np.array(lables)
'arg = recogType:[cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()'
recogs = cv2.face.LBPHFaceRecognizer_create(),cv2.face.FisherFaceRecognizer_create(),cv2.face.EigenFaceRecognizer_create()
self.recognizer = recogs[recogType]()
self.recognizer.train(self.images,self.lables)
The specific problem is with this line:
self.recognizer = recogs[recogType]()
By placing braces () on the end, you are trying to call the recognizer, as the error says. Change this to
self.recognizer = recogs[recogType]
//Disclaimer - there may be other problems.

How to store an image in MySQL using MFC ODBC?

I'm getting the error message
error:Conversion is not supported
How to store an image in MySQL using MFC ODBC?
This is my code so far:
Cperson person;
person.Open();
person.MoveLast();
person.AddNew();
CFile fileImage;
CFileStatus fileStatus;
fileImage.Open(_T("hihi.jpg"), CFile::modeRead);
fileImage.GetStatus(fileStatus);
person.m_Image.m_dwDataLength = fileStatus.m_size;
HGLOBAL hGlobal = GlobalAlloc(GPTR, fileStatus.m_size);
person.m_Image.m_hData = GlobalLock(hGlobal);
fileImage.Read(person.m_Image.m_hData, fileStatus.m_size);
person.SetFieldDirty(&person.m_Image);
person.SetFieldNull(&person.m_Image, FALSE);
person.Update();
GlobalUnlock(hGlobal);
fileImage.Close();
person.Close();
//m_Image is CLongBinary
What can I do?
Error in line 'person.Update();'
Try ReadHuge instead of Raad, for more than 64k ReadHuge can be used,
fileImage.ReadHuge(person.m_Image.m_hData, fileStatus.m_size);

Find the co-ordinates of matching image using sikuli in java

I need to get the co-ordinates of matched image within the actualImage so that I can perform operations on it. However, I tried below two approaches,but both doesn't seem to work:
Approach 1:
Using below, I'm able to find a match but co-ordinates returned are just the width & height of image to be matched(which I already know). I want to get the position of the same within actual image.
BufferedImage actualImg = ImageIO.read(new File("C:/Images/SrcImg.PNG"));
ImageTarget actualTgt = new ImageTarget(actualImg);
BufferedImage searchImg = ImageIO.read(new File("C:/Images/TgtImg.PNG"));
ImageTarget searchTgt = new ImageTarget(searchImg);
ScreenRegion scrReg = new StaticImageScreenRegion(actualTgt.getImage());
ScreenRegion resReg = scrReg.find(searchTgt);
ScreenLocation center = resReg.getCenter();
System.out.println(":getElementFromImage: x_loc,y_loc =["+center.getX()+","+center.getY()+"]");
Approach 2:
In below code I tried with sikulix Finder. However, with this src.hasNext() returned true BUT src.next() threw nullpointer exception.Not sure what is the problem here:
Finder src = new Finder("C:/Images/SrcImg.PNG");
Pattern pat = new Pattern("C:/Images/TgtImg.PNG").similar(0.5);
src.find(pat);
Match m;
while( src.hasNext())
m = src.next();
src.destroy();
java.lang.NullPointerException
at org.sikuli.script.Finder.next(Finder.java:484)
at com.work.ImageFinder.main(ImageFinder.java:38)
I already spent good amount of time to make this work. Any help would be much appreciated.
Thanks!
It works fine after passing the Region to Finder like below:
Finder src = new Finder("C:/Images/SrcImg.PNG", new Region(0,0,<width>,<height>))
Pattern pat = new Pattern("C:/Images/TgtImg.PNG").similar(0.5);
src.find(pat);
Match m;
while( src.hasNext())
m = src.next();
src.destroy();
More details can be found below link:
Is it possible to use Sikuli to assert that images are the same in GUI-less mode?

JSON Parse error: Unrecognized token '<'

I am getting this error (as per Safari's Web inspector) but I cannot see why. Most reports of this error suggest that it is reading a HTML tag somewhere ... but I cannot see it.
var oReq = new XMLHttpRequest(); //New request object
oReq.onload = function() {
document.getElementById("myConsole").innerHTML = this.responseText;
myData = JSON.parse(this.responseText);
...
The third line of code dumps the responseText onto my webpage (into a DIV called 'myConsole'). This shows what I believe to be standard JSON code ... and contains no '<' characters.
The second line of code tries to parse the responseText and give the '<' token error.
The php data source looks like this:
$rowCount = 0;
do { $rowCount += 1;
$dbCurrentRow = $resultSet->fetch_assoc();
$seats[$rowCount]['room'] = $dbCurrentRow['Room'];
$seats[$rowCount]['seat'] = $dbCurrentRow['Seat'] * 1;
$seats[$rowCount]['x'] = $dbCurrentRow['x'] * 1;
$seats[$rowCount]['y'] = $dbCurrentRow['y'] * 1;
$seats[$rowCount]['name'] = "Joe Bloggs";
$seats[$rowCount]['adno'] = "01234";
$seats[$rowCount]['ev6'] = true;
$seats[$rowCount]['eal'] = true;
$seats[$rowCount]['dpLast'] = "LS";
$seats[$rowCount]['dpCurrent'] = "WA";
$seats[$rowCount]['dpTarget'] = "TG";
$seats[$rowCount]['ma'] = 2 * 1;
} while ($rowCount < $resultSet->num_rows);
echo json_encode($seats);
and the JSON output is this:
{"1":{"room":"35","seat":1,"x":0,"y":0,"name":"Joe
Bloggs","adno":"01234","ev6":true,"eal":true,"dpLast":"LS","dpCurrent":"WA","dpTarget":"TG","ma":2},"2":{"room":"35","seat":2,"x":30,"y":60,"name":"Joe
Bloggs","adno":"01234","ev6":true,"eal":true,"dpLast":"LS","dpCurrent":"WA","dpTarget":"TG","ma":2},"3":{"room":"35","seat":3,"x":60,"y":0,"name":"Joe
Bloggs","adno":"01234","ev6":true,"eal":true,"dpLast":"LS","dpCurrent":"WA","dpTarget":"TG","ma":2},"4":{"room":"35","seat":4,"x":90,"y":90,"name":"Joe
Bloggs","adno":"01234","ev6":true,"eal":true,"dpLast":"LS","dpCurrent":"WA","dpTarget":"TG","ma":2}}
I do not believe it to be a server timing issue since it 'myConsole' dump precedes the error and works fine. It does not look like the JSON is faulty even with a 2d array. The strange thing is if I take the JSON output and save it as 'testDataSample.php' and link my main page directly to it then the same output works flawlessly.
//oReq.open("get", "testDataSample.php", false); //Text JSON output works fine
oReq.open("get", "getData.php", false); // Live from Server ... '<' error
oReq.send();
Any suggestions as to what is wrong, or how I would track this down would be most welcome.
Thank you.
Thank you raghav710 :-)
The console log showed it ... I had some comments at the top of the dataSource.php file which were being included in the echo.
Writing this to my web page ... they were ignored and invisible ... which means I could not see them, and could not see the difference between the two outputs; parsing the comments JSON caused the choke.
I have removed all of the comments at the top of my datasource.php and it work instantly.
Thank you again.

Calling an instance from a symbol

I'm trying to get this line to work, and it just won't do it. Can't figure it out.
pumpkinPage.this ["textBox" + i] = currentGuess;
That doesn't work, but if I do it like this
pumpkinPage.textBox0 = currentGuess;
it works fine. How do I get the first line to work?
What error are you getting?
Assuming pumkinPage is a dynamic object (Object, MovieClip etc), pumpkinPage["textBox" + i] = currentGuess; should work.