botframework - How to include Adaptive card inside the carousel - carousel

Did anybody tried to include adaptivecards inside a carousel?
I am using nodejs sdk of botframework.

I believe what you are looking for is included in this example inside the botbuild-samples repository.
in this example this is how the cards are built:
function getCardsAttachments(session) {
return [
new builder.HeroCard(session)
.title('Azure Storage')
.subtitle('Offload the heavy lifting of data center management')
.text('Store and help protect your data. Get durable, highly available data storage across the globe and pay only for what you use.')
.images([
builder.CardImage.create(session, 'https://learn.microsoft.com/en-us/aspnet/aspnet/overview/developing-apps-with-windows-azure/building-real-world-cloud-apps-with-windows-azure/data-storage-options/_static/image5.png')
])
.buttons([
builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/storage/', 'Learn More')
]),
new builder.ThumbnailCard(session)
.title('DocumentDB')
.subtitle('Blazing fast, planet-scale NoSQL')
.text('NoSQL service for highly available, globally distributed apps—take full advantage of SQL and JavaScript over document and key-value data without the hassles of on-premises or virtual machine-based cloud database options.')
.images([
builder.CardImage.create(session, 'https://learn.microsoft.com/en-us/azure/documentdb/media/documentdb-introduction/json-database-resources1.png')
])
.buttons([
builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/documentdb/', 'Learn More')
]),
new builder.HeroCard(session)
.title('Azure Functions')
.subtitle('Process events with a serverless code architecture')
.text('An event-based serverless compute experience to accelerate your development. It can scale based on demand and you pay only for the resources you consume.')
.images([
builder.CardImage.create(session, 'https://msdnshared.blob.core.windows.net/media/2016/09/fsharp-functions2.png')
])
.buttons([
builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/functions/', 'Learn More')
]),
new builder.ThumbnailCard(session)
.title('Cognitive Services')
.subtitle('Build powerful intelligence into your applications to enable natural and contextual interactions')
.text('Enable natural and contextual interaction with tools that augment users\' experiences using the power of machine-based intelligence. Tap into an ever-growing collection of powerful artificial intelligence algorithms for vision, speech, language, and knowledge.')
.images([
builder.CardImage.create(session, 'https://msdnshared.blob.core.windows.net/media/2017/03/Azure-Cognitive-Services-e1489079006258.png')
])
.buttons([
builder.CardAction.openUrl(session, 'https://azure.microsoft.com/en-us/services/cognitive-services/', 'Learn More')
])
];
}
And this is how they ae sent as a carousel:
var bot = new builder.UniversalBot(connector, function (session) {
var cards = getCardsAttachments();
// create reply with Carousel AttachmentLayout
var reply = new builder.Message(session)
.attachmentLayout(builder.AttachmentLayout.carousel)
.attachments(cards);
session.send(reply);
});

Related

Tools for geospatial data visualization with custom 3D models

I need a tool that does geospatial data visualization, but which will also allow me to import, or to create custom 3D models (e.g. to import .gltf files).
Kepler.gl seems a great choice for geospatial data visualization, yet I couldn't find the way to import certain .gltf file and I am not sure this is even possible in kepler.gl.
Any recommendations?
Have you explored the latest version of threebox?? It enables you to add as many models and 3D layers as you want on top of Mapbox using their support for 3D objects through CustomLayerInterface with only a few lines of code
map.on('style.load', function () {
map.addLayer({
id: 'custom_layer',
type: 'custom',
renderingMode: '3d',
onAdd: function (map, mbxContext) {
window.tb = new Threebox(
map,
mbxContext,
{ defaultLights: true }
);
var options = {
obj: '/3D/soldier/soldier.glb',
type: 'gltf',
scale: 1,
units: 'meters',
rotation: { x: 90, y: 0, z: 0 } //default rotation
}
tb.loadObj(options, function (model) {
soldier = model.setCoords(origin);
tb.add(soldier);
})
},
render: function (gl, matrix) {
tb.update();
}
});
})
And you can do much more...
- 3D models built-in and custom animations
- Full raycast support MouseOver/Mouseout, Selected, Drag&Drop, Drag&Rotate, Wireframe
- CSS2D Tooltips and Labels that consider altitude
- Three.js and Mapbox cameras sync with depth adjustment
- Include geolocated models of monuments with sunlight & shadows build-in support
- Optimized to load thousands of 3D objects

Meteor(React) : GPS based tracking for checkout

Created a application(iOS) using Meteor-react framework for car rental parking. I wants to track the drivers mobile using GPS. So that I can detect his checkout status. I need to calculate distance between parking space and drivers location once check-in so that I can send push messages to driver whether he is about to check-out. Before going for a actual development for GPS based checkout need a suggestion is it really possible? What will be the pron and cons?
Right-now I am going through npm package "gps-tracking" which is a GPS listener.
Below code I have added in /server/gps.js
var gps = require("gps-tracking");
var options = {
'debug' : true, //We don't want to debug info
automatically. We are going to log everything manually so you can
check what happens everywhere
'port' : 8000,
'device_adapter' : "TK103"
}
var server = gps.server(options,function(device,connection){
console.log(options);
console.log(device);
console.log(connection);
device.on("connected",function(data){
console.log("I'm a new device connected");
return data;
});
device.on("login_request",function(device_id,msg_parts){
console.log('Hey! I want to start transmiting my position. Please accept me. My name is '+device_id);
this.login_authorized(true);
console.log("Ok, "+device_id+", you're accepted!");
});
device.on("ping",function(data){
//this = device
console.log("I'm here: "+data.latitude+", "+data.longitude+" ("+this.getUID()+")");
//Look what informations the device sends to you (maybe velocity, gas level, etc)
//console.log(data);
return data;
});
device.on("alarm",function(alarm_code,alarm_data,msg_data){
console.log("Help! Something happend: "+alarm_code+"
("+alarm_data.msg+")");
});
//Also, you can listen on the native connection object
connection.on('data',function(data){
//echo raw data package
//console.log(data.toString());
})
});
Thanks in advance!

How do you import a FBX/OBJ model into a Babylon scene?

I am in the process of learning BabylonJS.
How do you add a 3D model into an already existing BabylonJS scene? I have a scene of a building and I want to add a grand piano into the interior of the building. The piano is a 3d model in OBJ and FBX form.
Thanks!
You've got to use the Assets Manager.
const assetsManager = new BABYLON.AssetsManager(scene);
const meshTask = assetsManager.addMeshTask('piano task', '', './assets/', 'piano.obj');
meshTask.onSuccess = (task) => {
const pianoMesh = task.loadedMeshes[0];
// Do something with the mesh here
}
assetsManager.load();
If your mesh is in the .OBJ format, then you'll need to use babylonjs-loaders.
Hello you have several options:
Import it in Blender or 3dsMax or Unity and export it using one of the supported exporters: https://github.com/BabylonJS/Babylon.js/tree/master/Exporters
Use the FBX exporter: https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/FBX
Use the OBJ loader: https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview%20release/loaders/babylon.objFileLoader.js
I do not know if your question is of some importance still for you but you could also try the very good FBX2glTf converter
https://github.com/facebookincubator/FBX2glTF
It can even handle blend shapes, materials, draco-compression etc. It's easy to build and works very fast. Maybe you give that thing a try.

Is there a way to implement some sort of auto translation in an react native app?

I know this isn't google, but I wasn't able to find anything usefull and maybe you can give me some advice.
What I am looking for is some way to add an auto translation to strings in my react native application.
Right now I am using a workaround in which I translate some of the most common words manually - since that doesn't cover the whole language the outcome looks pretty unsatisfying :)
You could use react-native-i18n.
var I18n = require('react-native-i18n');
var Demo = React.createClass({
render: function() {
return (
<Text>{I18n.t('greeting')}</Text>
)
}
});
// Enable fallbacks if you want `en-US` and `en-GB` to fallback to `en`
I18n.fallbacks = true;
I18n.translations = {
en: {
greeting: 'Hi!'
},
fr: {
greeting: 'Bonjour!'
}
}
take user phone OS language using device info
https://www.npmjs.com/package/react-native-device-info#getdevicelocale
or using
I18n = require('react-native-i18n')
locale = I18n.currentLocale()
then Use power translator
https://www.npmjs.com/package/react-native-power-translator
//set your device language as a Target_Language on app start
TranslatorConfiguration.setConfig('Provider_Type', 'Your_API_Key','Target_Language', 'Source_Language');
//Fill with your own details
TranslatorConfiguration.setConfig(ProviderTypes.Google, 'xxxx','fr');
Use it as a component
<PowerTranslator text={'Engineering physics or engineering science refers to the study of the combined disciplines of physics'} />
add-on :
Use redux store or async storage to store all your string on first app start.
Then use translated text from store or storage.
IT will save your api bill as you have fixed strings.
sir for auto-translate. you can create one component where you can pass all strings (text) in your app, And use '#aws-sdk/client-translate' for translation, it's very fast and also works on dynamic data \
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-translate/index.html
https://www.npmjs.com/package/#aws-sdk/client-translate

How to use localstorage in Titanium/Alloy?

I am very new to Appcelerator/Titanium. Can anyone tell me how to use localstorage function in Alloy (Titanium). (Not getting any good solution on Web).
Thanks! :)
Titanium Alloy has a customized implemntación Backbone. This means that titanium uses Backbone for many things, but at the same time some important features have been left out.
One of the most used parts of Backbone by Titanium are models, while that not identical to those ofrese the js framework, they have lots of things in common.
To work with data models must define an adapter (this can be localStorage, sql, properties or custom sync adapters)
If you want to work with localStorage, your model should look something like this:
exports.definition = {
config: {
"defaults": {
"first_name": "",
"last_name": "",
"phone": "",
"email": ""
},
"adapter": {
"type": 'localStorage',
"collection_name": 'user'
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {
}); // end extend
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
}); // end extend
return Collection;
}
};
to manipulate the data then you should use:
Create data
model = Alloy.createModel('user', {first_name: 'Pedro', last_name: Picapiedra});
// or model.save();
Alloy.Collections.user.add(model);
Read data
callection = Alloy.Collections.user.fetch()
model = Alloy.Collections.user.get(modelId)
Update data
user.set({
first_name : 'Pablo',
last_name : 'Marmol',
});
user.save();
Delete data
model.destroy();
collection.remove(model);
For more information:
Titanium Sync & apadters
Backbone Sync, collections, models & etc
See https://wiki.appcelerator.org/display/guides/Working+with+Local+Data+Sources for general guide.
Accessing files is done through the Ti.Filesystem. See documentation at http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Filesystem . You should also see the kitchen sink example, as it shows hot to read/write file https://github.com/appcelerator/KitchenSink/blob/master/Resources/ui/common/platform/filesystem.js.
If you simply want to store some data locally, many people use sqlite database. See http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Database .
The simplest way is to use properties. It is limited, but for many people that is enough. http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.App.Properties