NAO robot behaviors activate without being triggered - nao-robot

NAO robot behaviors trigger without being prompted by user. Sometimes seems to get stuck in some kind of loop where it constantly activates random behaviors without listening to the user at all.
Behaviors are made in the Choregraph SDK. I have trigger phrases set and trigger condition is something of the like shown below. I have tried removing and reinstalling behaviors, but the problem persists.
('Launchpad/numPeopleZone1'>0 ~ 5) & ('Launchpad/PreviousBehavior' != '<activity-name>/behavior_1')
I expect the behaviors to only trigger when users say trigger phrases, but they trigger on their own, often nonstop, ignoring user input.

After some more work I realized what the problem was. NEVER set trigger conditions. They allow the robot to launch activities autonomously (without user input), which made a mess of my project. Trigger conditions should only be set if you want your robot to start doing the activity on its own.

Related

Saving form data as user types (React/Postgres)

Given a simple textbox to answer a question, how would you go about saving answers as the user types? Assuming that the answer is upserted.
Using a somewhat naive example of an onChange handler and saving answers using an API within that onChange, I ran into two problems:
Sends what seems to be too many patch requests from client to API since it's every time the input textbox answer changes.
If using postgres upsert or creating your own, then the second request made by the onChange handler may not see the first if the user is typing quickly, creating duplicate records for that textbox (two answers for one question)
I need to execute queries beforehand to get necessary relationship values before updating, so the HTTP wait time is fairly long. Fixing this now, but seems to not address the above two issues.
I thought of only saving once the user presses spacebar, but that seems hacky. Normally of course I'd save after clicking a submit button, but in this case it must be as the user types.
Any suggestions / comments? Cheers.
EDIT:
Also tried saving within onBlur.. But this doesn't always get called depending on where the user clicks.
Does it have to patch the data for every keypress or can you use a delay?
For instance...
User starts typing: Register the event, set a timeout for say 3 seconds
If the user keeps typing: reset that timeout back to the full 3s
If the user pauses typing + 3s passes: patch the data with new value
When the user resumes typing: set another timeout

How to create Clearcase trigger for only one user?

I would like to make a trigger that only executes for a single user(myself). The reason, is so that I don't "break the build".
Longer explanation: I'm trying to sandbox a Clearcase trigger to automatically apply an attribute to an element when it is checked in, and I don't want to accidentally create a trigger that applies to all developers and potentially ruin everybody's day with the prototype(what works on the first try?).
I see the -nus/ers option which seems to exclude users in the list. I suppose I could comma separate a list of all users, excepting myself. Is this what I'm looking for?
The best sources of information about triggers are listed here, and then EV (Environment Variables) are mentioned in mktrype man page.
Check for isntance:
CLEARCASE_USER
The user who issued the command that caused the trigger to fire; derived from the UNIX or Linux real user ID or the Windows user ID.
If the user id somehow doesn't work, you could consider other environment variables:
CLEARCASE_SNAPSHOT_PN
Your script can control if the user id is yours, and if not, abort.
The path to the root of the snapshot view directory in which the operation that caused the trigger to fire took place.
If your script detect that the path isn't the exact one expected (ie your snapshot view from which your triggered your script), said trigger script would abort.

Keeping repository synced with multiple clients

I have a WPF application that uses entity framework. I am going to be implementing a repository pattern to make interactions with EF simple and more testable. Multiple clients can use this application and connect to the same database and do CRUD operations. I am trying to think of a way to synchronize clients repositories when one makes a change to the database. Could anyone give me some direction on how one would solve this type of issue, and some possible patterns that would be beneficial for this type of problem?
I would be very open to any information/books on how to keep clients synchronized, and even be alerted of things other clients are doing(The only thing I could think of was having a server process running that passes messages around). Thank you
The easiest way by far to keep every client UI up to date is just to simply refresh the data every so often. If it's really that important, you can set a DispatcherTimer to tick every minute when you can get the latest data that is being displayed.
Clearly, I'm not suggesting that you refresh an item that is being edited, but if you get the fresh data, you can certainly compare collections with what's being displayed currently. Rather than just replacing the old collection items with the new, you can be more user friendly and just add the new ones, remove the deleted ones and update the newer ones.
You could even detect whether an item being currently edited has been saved by another user since the current user opened it and alert them to the fact. So rather than concentrating on some system to track all data changes, you should put your effort into being able to detect changes between two sets of data and then seamlessly integrating it into the current UI state.
UPDATE >>>
There is absolutely no benefit from holding a complete set of data in your application (or repository). In fact, you may well find that it adds detrimental effects, due to the extra RAM requirements. If you are polling data every few minutes, then it will always be up to date anyway.
So rather than asking for all of the data all of the time, just ask for what the user wants to see (dependant on which view they are currently in) and update it every now and then. I do this by simply fetching the same data that the view requires when it is first opened. I wrote some methods that compare every property of every item with their older counterparts in the UI and switch old for new.
Think of the Equals method... You could do something like this:
public override bool Equals(Release otherRelease)
{
return base.Equals(otherRelease) && Title == otherRelease.Title &&
Artist.Equals(otherRelease.Artist) && Artists.Equals(otherRelease.Artists);
}
(Don't actually use the Equals method though, or you'll run into problems later). And then something like this:
if (!oldRelease.Equals(newRelease)) oldRelease.UpdatePropertyValues(newRelease);
And/Or this:
if (!oldReleases.Contains(newRelease) oldReleases.Add(newRelease);
I'm guessing that you get the picture now.

What are the exit codes used by RASPHONE.exe?

Due to a major time constraint, need to stick with invoking rasphone.exe from my c program, rather than best approach of using RAS API's. From my code, when the rasphone pop's up a dialler window to the user, if the user click's on cancel button, i have to stop blocking another set of code.
Ultimately, i need to handle the rasphone returns to control my code flow based on the Success/Failure-Cancel. How to do this? Also, is there any other possibility for silent dialling without any popup?I hope no, as its discussed.

winforms textbox Ctrl-Backspace to Delete Whole Word & Spaces

I found an article here:
Winforms Textbox - Using Ctrl-Backspace to Delete Whole Word
to delete the whole word in a textbox while holding ctrl+backspace, but I noticed that if you don't implement the app.config modifications like so:
<configuration>
<appSettings>
<add key="SendKeys" value="SendInput" />
</appSettings>
</configuration>
that only the current word will be removed and the process of backspacing will be interrupted. For instance, if I typed in "Tim tom" and then used the ctrl + backspace trick, "tom" would be deleted, interrupting any backspace operation and leaving "Tom ".
If you do use the app.config modification, however, "tom" would successfully be removed and backspace operations would continue, but without continuing to remove whole words, as if you were just holding the backspace button.
Does anyone know what causes this or how to fix it?
Your application is choosing a different behavior of sending keypress equivalents to the application.
The historical exposition why the two protocols exist is explained here:
The SendKeys class has been updated for the .NET Framework 3.0 to
enable its use in applications that run on Windows Vista. The enhanced
security of Windows Vista (known as User Account Control or UAC)
prevents the previous implementation from working as expected. The
SendKeys class is susceptible to timing issues, which some developers
have had to work around. The updated implementation is still
susceptible to timing issues, but is slightly faster and may require
changes to the workarounds. The SendKeys class tries to use the
previous implementation first, and if that fails, uses the new
implementation. As a result, the SendKeys class may behave differently
on different operating systems. Additionally, when the SendKeys class
uses the new implementation, the SendWait method will not wait for
messages to be processed when they are sent to another process.
The timing issues mentioned here concern especially continued control of application by characters, not just one character at a time. They include
difficulty in synchronizing typing rate
making sure that the right window receives the input when the app is opening dialogs
making sure that the right app receives the input even when the user meddles with close buttons
However, the real reason between the SendKeys behavior change was not programmer friendliness (which did not improve significantly), but security.
It is definitely a good idea to set the SendKeys parameter to specify the desired behavior. You don't want your application to mysteriously start behaving differently just because UAC was turned on or off.

Resources