SecurityError: Error #2152, cant switch to Full Screen mode - fullscreen

Here my code:
private function onSwitchFullScreen(event:Event):void{
try {
switch (VariablesGenerales._flash_stage.displayState) {
case StageDisplayState.FULL_SCREEN:
// si on est déjà en FULL SCREEN, on se remet en normal
VariablesGenerales._flash_stage.displayState = StageDisplayState.NORMAL;
trace(">>>>> SWITCH TO NORMAL SCREEN");
break;
default:
// si on est pas en full screen, on passe en plein écran
VariablesGenerales._flash_stage.displayState = StageDisplayState.FULL_SCREEN;
trace(">>>>> SWITCH TO FULL SCREEN");
break;
}
} catch (err:SecurityError) {
// ignore
trace(">>>>> FAIL TO SET FULLSCREEN");
}
}
as in other post of this problem, i have, Flash player 11.5+, i have set allowFullScreen mode to 'true' everywhere it is mentionned and i still cant turn my project in fullscreen, i get 'FAIL TO SET FULLSCREEN'.
I execute it in web, not in standalone.
Any idea? Thx!

Related

create a json dynamically in node js

I have a problem with creating a json dynamically. I retrieve the data of a sent json:
body.value look like :
{
hubspotProperty: 'question3',
response: 'Nous utilisons un google drive mais il est très peu utilisé'
},
{
hubspotProperty: 'question2',
response: 'Nous complétons le CRM quand nous avons ' +
'le temps et au bon vouloir du commercial'
},
{
hubspotProperty: 'question1',
response: "Nous n'avons aucun processus " +
"automatisé et nous n'en voyons pas " +
"l'intérêt"
}
]
but I want the hubspot property to be the key of the new json and the response to be my I don't now how I can do this .
Help me please
Bonjour, the simplest way to make json:
var someValue = "Jean"
var jsonString = `{"nom":"${someValue}"}`
Take care of the "backwards ticks" `
Regarding the json which comes in to you:
var exampleJson = `{ "hubspotProperty": "question3" }`
It is this easy ...
var args = JSON.parse(exampleJson)
var value = args.hubspotProperty
console.log("it's done .. " + value)

Firestore import data-file is not correct saved (ä,ö,ü,á are shown as symbols)

i try to import some data in my firestore, this works quite well.
The data are german, english and spanish languages, so I have á,í, ä,...
My .json file is correct and when i opened it via xcode and vs code everything looks fine.. When i start my import and take a look at my database, those letters will be replaced by icons...
And i dont know why ... Does anybody know how to fix this?
As an example this is my .json :
{
"exercisesTest" : [
{
"exercises": "a_01",
"description_d": "Stell dich schulterbreit hin und stütz deine Hände in die Hüfte. Senk deinen Oberkörper ab, so als wolltest du dich auf einen Stuhl setzen. Achte darauf, dass deine Füße während der ganzen Bewegung immer fest am Boden bleiben und sich immer über den Fußgelenken befinden.",
"description_e": "Take a stance with your feet shoulder-width apart and put your hands on your hips. Lower your upper body as if you were sitting on a chair. Make sure that your feet remain firmly on the ground during the whole movement. Your knees should always be above the ankles.",
"description_s": "Ponte en posición con los pies separados a la anchura de los hombros y pon las manos sobre las caderas. Baja la parte superior del cuerpo como si estuvieras sentado en una silla. Asegúrate de que tus pies permanezcan firmemente en el suelo durante todo el movimiento. Las rodillas deben estar siempre por encima de los tobillos."}]}
and this is my firebase db...
Import will be done by my .js file and works fine, except the icons :p
const admin = require('./node_modules/firebase-admin');
const serviceAccount = require("./serviceAccountKey.json");
const data = require("./data.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "xxxx"
});
data && Object.keys(data).forEach(key => {
const nestedContent = data[key];
if (typeof nestedContent === "object") {
Object.keys(nestedContent).forEach(docTitle => {
admin.firestore()
.collection(key)
.doc(docTitle)
.set(nestedContent[docTitle])
.then((res) => {
console.log("Document successfully written!");
})
.catch((error) => {
console.error("Error writing document: ", error);
});
});
}
});
Thanks for your help!
Okay, i deleted my whole .json file and create a new one with a different csv to json - now it works...
used this csv to json + validator
https://csvjson.com/json_validator

Change day/month language in DialogFlow bot

I'm creating an assistant for an italian restaurant using DialogFlow.
I've set the language to spanish, and everything seems to go fine, but when i show the final date of the reservation it is shown in english (Friday and May in attached picture's case).
Is it possible to change it?
This is the code that generates the above particular response to a table booking process:
function createBooking(agent) {
let guests = agent.parameters.comensales;
let time = new Date(agent.parameters.time);
let date = new Date(agent.parameters.date);
let bookingDate = new Date(date);
var numeroReserva = Math.random().toString(16).slice(2, 8).toUpperCase();
bookingDate.setHours(time.getHours());
bookingDate.setMinutes(time.getMinutes());
let now = new Date();
if (guests < 1){
agent.add('You need to reserve a table for at least one person. Please try again!');
} else if (bookingDate < now){
agent.add(`No puedes reservar una fecha pasada. Por favor, inténtalo de nuevo!`);
} else if (bookingDate.getFullYear() > now.getFullYear()) {
agent.add(`No puedes hacer una reserva para ${bookingDate.getFullYear()} todavía. Por favor, elige una fecha en ${now.getFullYear()}.`);
} else {
let timezone = parseInt(agent.parameters.time.toString().slice(19,22));
bookingDate.setHours(bookingDate.getHours() + timezone);
agent.add(`Perfecto. He reservado una mesa para ${guests} el ${bookingDate.toString().slice(0,21)}`);
agent.add(`Tu código de reserva es: ${numeroReserva}`);
agent.add('Nos vemos pronto!');
agent.add('Buon appetito!');
}
}
The code running the fulfillment runs within Google's compute infrastructure which has a default locale/language of US English. When a request arrives for fullfilment from Dialog flow, that request carries with it the language that we are to use to respond. See the languageCode in the Webhook Request JSON. When we use the APIs in Node.js, it looks like this data is available in the agent.locale property.
Looking at the JavaScript Date object, we seem to have a method on it called toLocaleString() which converts a date/time into a string but additionally supplies the language (locale) to be used to create the language specific content and format. If we put all this together, we might find that the following code line may work:
agent.add(`Perfecto. He reservado una mesa para ${guests} el ${bookingDate.toLocalString(agent.locale).slice(0,21)}`);
This may take a few tests to get right. I'd start by logging agent.locale as a test to ensure that it has the value we expect/hope.
It's late but for those who face with this problem. You know you can do it like this:
let options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',
hour12: false, hour: 'numeric', minute: 'numeric' };
var curr_date = new Date();
agent.add(`Sono le ` + curr_date.toLocaleString('it-IT', options));
If someone likes to use moment.js
you can add library to your project from fulfillment inline editor.
Go to Fulfillment, click on "package.json"
add the following lines in dependencies
"moment": "^2.24.0",
"moment-timezone": "^0.5.31"
Then back to index.js and add the following line to import it
const moment = require('moment-timezone');
and then you can handle like this in your function
if(agent.locale === 'en'){
moment.locale('en-US');
agent.add(`Now is ` + moment().tz(your_time_zone).format('LLLL'));
}
else if(agent.locale === 'it-IT' || agent.locale === 'it'){
moment.locale('it');
agent.add(`Sono le ` + moment().tz(your_time_zone).format('LLLL'));
}
The sample of response is " Sono le martedì 20 ottobre 2020 15:30"
or "Now is Tuesday, October 20, 2020 3:31 PM"

Google Assistant / Ask for a Place is not working :(

I try to request an address using conv.ask(new Place(options)) but it does not seem to work.
Google correctly asks the user for permission, but he never understands any address.
Google : Pour vous livrer, je dois d'abord vérifier votre position. Est-ce que je peux récupérer cette information depuis votre compte Google ?
Me : oui
Google : A quelle adresse souhaitez-vous être livré ?
Me : 2 rue Paul Prouteau 92250
Google : Excusez-moi, A quelle adresse souhaitez-vous être livré ?
Me : A mon domicile
Google : Je n'ai toujours pas compris. Dites par exemple : "23 rue Faidherbe à Paris". A quelle adresse souhaitez-vous être livré ?
Me : 23 rue Faidherbe à Paris
Google : Malheureusement, je ne peux pas vous aider.
I created my intent on Dialogflow and hosted my code on Firebase Spark plan.
app.intent('ask_for_place_detail', (conv) => {
const options = {
context: 'Pour vous livrer',
prompt: 'A quelle adresse souhaitez-vous être livré ?',
};
conv.ask(new Place(options));
});
app.intent('ask_for_place_confirmation', (conv, params, place, status) => {
if (!place) return conv.ask(`Désolé, nous n'avons pas trouvé d'addresse`);
// the place also carries formattedAddress, and coordinates fields
const {name} = place;
if (place.name) conv.ask(`ok, on vous livre à ${name}`);
});
I do not see any error in the logs and I think I have enabled the correct Google Map APIs.
Can you help me ?
Make sure your place confirmation intent has the following event "actions_intent_PLACE"
Helper functions need respective events to be handled in the intents while designing in the Dialogflow or other NLP frameworks. If you are using Dialogflow, add this event.
I duplicate my action in English and it's works in the simulator!
So, there is maybe a bug with the French version.

Cocos2dx 3.4 - manipulating user input

I am working on a breakout-type game using Cocos2dx.
I need to make a highscore table. After the game is finished, I'd like to display a page, where player types his username into text field.
I don't know how to add the user input into variable, so I can manipulate it later (mainly saving along with score to display it on the selected scene).
What is the simplest way of doing so?
Approach One:
If you just need to handle keyboard as key-event, It's as easy as these below lines of code:
HelloWorld::init()
{
...
auto keyboardListener = EventListenerKeyboard::create();
keyboardListener->onKeyPressed = [](EventKeyboard::KeyCode keyCode, Event* event)
{
switch (keyCode)
{
case EventKeyboard::KeyCode::KEY_UP_ARROW: /*Jump maybe*/ break;
case EventKeyboard::KeyCode::KEY_DOWN_ARROW: /*Crouch maybe*/ break;
case EventKeyboard::KeyCode::KEY_RIGHT_ARROW: /*Move Right maybe*/ break;
case EventKeyboard::KeyCode::KEY_LEFT_ARROW: /*Move Left maybe*/ break;
}
};
_eventDispatcher->addEventListenerWithSceneGraphPriority(keyboardListener, this);
...
return true;
}
I think it's clear enough not to need any extra description.
Approach Two: if you need an input box that user/player can enter string with keyboard and you get what is entered, I recommend to use TextField which is available in cocos2d v3 ( and with some difficulty in v2) and has a full functionality. You can create and initial one of them as:
auto textField = cocos2d::ui::TextField::create("hint: enter here","Arial" , 30);
textField->setTextHorizontalAlignment(cocos2d::TextHAlignment::CENTER);
textField->setTextVerticalAlignment(cocos2d::TextVAlignment::CENTER);
textField->setColor(Color3B(100,100,100));
textField->setMaxLength(10);
textField->setMaxLengthEnabled(true);
textField->setTouchAreaEnabled(true);
textField->setTouchSize(Size(200,400));
textField->setPosition(...);
textField->addEventListener(CC_CALLBACK_2(HelloWorld::textFieldEvent, this));
this->addChild(textField, 10);
You can get entered data any time with std::string enteredData= textField->getString();
You can also do something when user entering text with two event as :
void HelloWorld::textFieldEvent(Ref *pSender, cocos2d::ui::TextField::EventType type)
{
switch (type)
{
case cocos2d::ui::TextField::EventType::ATTACH_WITH_IME:
{
textField->setColor(Color3B::BLACK);
// or whatever elese
break;
}
case cocos2d::ui::TextField::EventType::DETACH_WITH_IME:
{
textField->setColor(Color3B(100,100,100));
// or whatever elese
break;
}
}
}
Enjoy !

Resources