NAO's eyes remain white (don't turn to blue/green) after ending a program - nao-robot

I made an app which enables NAO answering according to user input. The app runs well and exits without errors. However, after exiting the app, NAO's eyes remain white. It still listen and answer things in the basic channel properly. The eyes just don't turn to blue when it's listening and gree when it's recognizing.
Any ideas how to solve it? The eye color indication is highly usuful.

Do you ask explicitly to deactivae the visual feedback in the Speech Recognition / Dialog box ?
Try calling this method at the end of your apps:
asr = ALProxy( "ALSpeechRecognition" )
ast.setVisualExpression( True )

Related

Black dot of Death SQL potential issue

I would like to ask about a recent black dot of death that is causing crash issues on messaging apps on Android and iOS devices.
More information on this issue can be found in this video:
https://www.youtube.com/watch?v=0fepqIO57f8
I would like to know if this issue can cause a potential risk to businesses everywhere if it is inserted to database without the correct validation check? And how do we perform validation check on this because there is a lot of hidden text that is not able to be detected by normal validation I think, such as doing string validation for a text box. It might crash database if the input went through and even making a query will take forever to load because of this issue.
well, i dont think you have to worry too much about that black dot, it isnt a virus as far as im aware of in my research about it, this is how it works:
The secret to the message is not actually the black dot, but rather the blank space that comes right after it. When the WhatsApp prank message is converted to HTML, it contains repetitive instances of the "&rlm:" character, which is code for right-to-left text directional formatting.
The right-to-left text format is used for languages such as Arabic and Urdu while the more common left-to-right text format is used for languages such as English. The hidden "&rlm:" code in the black dot prank message instructs WhatsApp to change the direction of the text repeatedly, which requires a lot of processing power.

Key capture directive not working as intended in Angularjs

i am trying to capture keypress events in my angular app.
The intended functionality is that upon pressing g1 (i.e simulataneously pressing g and 1) the app should transition to state1. Upon pressing g2 the app should transition to state2 and so on.
However the app does not seem to be capturing two keypresses simulataneously. What am I missing here ?
Also is this the best way to achieve this or are there better solutions available.
You can see the plnkr here
http://plnkr.co/edit/sK0NYNDRtH4lFfteNd5O
You could pass the e.codeValue to a service/controller which then stores the keys pressed in an array.
On key press up, tell the service/controller to remove it from the "key pressed" array.
In the service/controller, you can then use your logic to see if g and 1 are in the array - if they are, do the state transition. That could work, although not 100% if it's the best way. Give it a try and let us know if it worked for you.
Javascript is single-threaded, so there is no way for the following if statement to ever run the true block:
if (x == 3 && x == 4) {
// true
} else {
// false
}
Aside from that, the real problem you're facing is that (to my knowledge) the browser does not directly expose rollover scan codes to Javascript. By the time the browser gets the keystrokes they're already de-rollovered (if that's a word).
BTW, style note: It's better to post your code here on Stack Overflow to save it for posterity for other readers to learn from. Adding a plunkr is a nice courtesy, but it's secondary.

Fastest way to capture what's on the screen in C

My goal is to write a program that would capture the screen in an efficient way.
Little twist, the screen will not be saved. My program will do various check on it (pixel's colors in some area.. etc).
The program will run in windows, and will need to take(and analyze) as many screenshot as possible per second, and will not be used in games. (That imply that I need the whole screen, like pressing prntscreen. It's not a problem if that fail in fullscreen game.)
All propositions are welcome, and I'd be glad to share any missing details.
Edit
As I wrote in the comment, capturing the screen for storing purpose is really common and easy to find.
I asked to be sure to not miss any method of capturing the screen without storing it at all.
The program will look the screen, take some decision then will quickly go to the next frame.
Perhaps look into SDL
A guick google returned this screenshot code for SDL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2000-August/011387.html

Radio buttons not selecting in old program

I wrote a large complex C program around 20(!) years go. As far as I can recall it worked fine at the time in all respects - it was probably running on windows 95.
Now I need to use it again. Unfortunately the radio buttons in it do not appear to work properly any more (the ordinary push buttons are all behaving correctly). As I click on the radio buttons, I get some feedback that windows is acknowledging my click in as much as I see a dotted line appear around the button's text and the circle of the button goes grey for as long as my finger is on the button, but when I take my finger off I see that the selected button has not changed.
My suspicion is that I was perhaps getting away with some bad practice at the time which worked with windows 95 but no longer works on newer versions of windows, but I'm struggling work out what I did wrong. Any ideas?
EDIT: Its difficult to extract the relevant code because the message handling in this program was a tangled nightmare. Many buttons were created programatically at runtime and there were different message loops working when the program was in different modes of operation. The program was a customisable environment for running certain types of experiment. It even had its own built-in interpreted language! So I'm not expecting an answer like "you should have a comma instead of a semicolon at line 47", but perhaps something more like "I observed similar symptoms once in my program and it turned out to be ..... " .. or perhaps "the fact that the dotted rectangle is appearing means that process AAA has happened, but maybe step BBB has gone wrong".
EDIT: I've managed to extract some key code which my contain an error...
char *process_messages_one_at_a_time()
{
MSG msg;
int temp;
temp = PeekMessage(&msg,winh,0,0,PM_NOREMOVE);
if (temp)
{
GetMessage (&msg, NULL, 0, 0);
if (msg.message == WM_LBUTTONUP)
{
mouse_just_released_somewhere = TRUE;
}
TranslateMessage (&msg);
DispatchMessage (&msg);
}
if (button_command_waiting)
{
button_command_waiting = FALSE;
return (button_command_string);
}
else
{
return (NULL);
}
}
There are two simple things to check when using radio buttons. First is to make sure that each has the BS_AUTORADIOBUTTON property set. The second is to make sure that the first button in the tab order and the next control after the set of buttons (typically a group box) have the WS_GROUP property set, while the other buttons have it clear.
A few suggestions:
I'd try to use spy++ to monitor the messages in that dialog box, particularly to and from the radiobutton controls. I wonder if you'll see a BM_SETCHECK that your program is sending (ie, somewhere you're unchecking the button programatically).
Any chance your code ever checks the Windows version number? I've been burned a few times with an == where I should have used a >= to ensure version checking compatibility.
Do you sub-class any controls? I don't remember, but it seems to me there were a few ways sub-classing could go wrong (and the effects weren't immediately noticeable until newer versions of Windows rolled in).
Owner-drawing the control? It's really easy to for the owner-draw to not work with newer Windows GUI styles.
Working with old code like that, the memories come back to me in bits and pieces, rather than a flood, so it usually takes some time before it dawns on me what I was doing back then.
If you just want to get the program running to use it, might I suggest "compatibility mode".
http://www.howtogeek.com/howto/windows-vista/using-windows-vista-compatibility-mode/
However, if you have a larger, expected useful life of the software, you might want to consider rewriting it. Rewriting it is not anywhere near the complexity or work of the initial write because of a few factors:
Developing the requirements of a program is a substantial part of the required work in making a software package (the requirements are already done)
A lot of the code is already written and only parts may need to be slightly refactored in order to be updated
New library components may be more stable alternatives to parts of the existing codebase
You'll learn how to write current applications with current library facilities
You'll have an opportunity to comment or just generally refactor and cleanup the code (thus making it more maintainable for the anticipated, extended life)
The codebase will be more maintainable/compatible going forward for additional changes in both requirements and operating systems (both because it's updated and because you've had the opportunity to re-understand the entire codebase)
Hope that helps...

Darg the screen in android device with MonkeyRunner?

I use python code as follow to horizontal drag the screen, but the device will response with long press event. I do not know why it is.I sincerely somebody could help me to solve this problem, thanks~!
Python code:
device.drag((380,520),(300,520),0.1,10)
I have the same issue with you in my application. My solution is just to disable the long press. Actually, what I found is not only for the 'drag', the onLongPress() would also be triggered by MoneyDevice.press(), then it fails to simulator the double-click by two calls to press().
After all, by disable Long-Press, the drag() and two press() work for me!

Resources