How to check if two containers are linked properly? - docker

I have 3 containers, say their names are A, B, C.
Their definition, now that I tried to link them together (using the key links), is attached at the end of the question.
How can I test that this linking worked properly?
{
'A': {
'run_args': {
'name': 'A',
'detach': 'True',
'volumes': {
'/var/run/datadog': {'bind': '/var/run/datadog', 'mode': 'rw'}
},
'ports': {'30000/tcp': '30000', '30010/tcp': '30010'},
'restart_policy': {'name': 'always'},
'log_config': {'type': 'syslog'},
'command': A_cmd,
'links': {'B': 'B', 'C': 'C'}
}
},
'B': {
'run_args': {
'name': 'B',
'detach': True,
'volumes': {
'/etc/salt': {'bind': '/etc/salt', 'mode': 'rw'},
'/var/run/datadog': {'bind': '/var/run/datadog', 'mode': 'rw'}
},
'ports': {'8080/tcp': '80'},
'restart_policy': {'name': 'always'},
'command': B_cmd,
'tty': True,
'links': {'A': 'A', 'C': 'C'}
}
},
'C': {
'run_args': {
'name': 'C',
'detach': True,
'volumes': {
'/etc/salt': {'bind': '/etc/salt', 'mode': 'rw'},
'/var/run/datadog': {'bind': '/var/run/datadog', 'mode': 'rw'}
},
'ports': {'33000/tcp': '33000'},
'restart_policy': {'name': 'always'},
'command': C_cmd,
'tty': True,
'links': {'A': 'A', 'B': 'B'}
}
}
}

ping container names from another container. If they are linked then it will respond.

Related

Getting Unsuccessful webhook call: Failed to translate JSON to ExecuteHttpResponse for table in #assistant/conversation

I am trying to show a table in my cloud function using the new #assistant/conversation with the array of data but when i test the action i am getting the error as below
Unsuccessful webhook call: Failed to translate JSON to ExecuteHttpResponse
But when i check the logs i am getting the row values like below
{
"responseJson": {
"session": {
"id": "ABwppHE5M8EGlWf3YmpUUGPQ5xxHh-cb2QYyF_YUarZbF_jXq-Ad2iKDtyI8XAyvWPp4hHnQockBWMZuQA",
"params": {},
"languageCode": ""
},
"prompt": {
"override": false,
"content": {
"table": {
"button": {},
"columns": [
"Date",
"Time",
"Place"
],
"image": {},
"rows": [
"20-10-2020",
"11:20",
"Test"
],
"subtitle": "",
"title": ""
}
}
}
}
}
Here is the implementation of my adding table in the conv
const tempDatas = ['20-10-2020', '11:20', 'Test'];
conv.add(
new Table({
dividers: true,
columns: ['Date', 'Time', 'Place'],
rows: tempDatas
})
);
I have used the same logic in google-actions plugin there it works fine.I have imported the Table like below
const { conversation, Table } = require('#assistant/conversation');
Fixed the issue. The structure provided by the new actions builder is little different with the old one
New Structure:
conv.add(new Table({
'title': 'Table Title',
'subtitle': 'Table Subtitle',
'image': ASSISTANT_LOGO_IMAGE,
'columns': [{
'header': 'Column A',
}, {
'header': 'Column B',
}, {
'header': 'Column C',
}],
'rows': [{
'cells': [{
'text': 'A1',
}, {
'text': 'B1',
}, {
'text': 'C1',
}],
}, {
'cells': [{
'text': 'A2',
}, {
'text': 'B2',
}, {
'text': 'C2',
}],
}, {
'cells': [{
'text': 'A3',
}, {
'text': 'B3',
}, {
'text': 'C3',
}],
}],
}));
You can simplify it like below that is the solution for my above issue
const tableRows = [];
tablesRows.push({ 'cells': [{ 'text': moment(data.date).format('DD-MM-YYYY') }, { 'text': data.time }, { 'text': data.place }] });
conv.add(new Table({
'columns': [{
'header': 'Date',
}, {
'header': 'Time',
}, {
'header': 'Place',
}],
'rows': tablesRows,
}));
For more info visit conversation components

Outlook REST API returns events without start and end dates

When requesting GET https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events the response (for some events) does not have a Start and End date.
The full structure for such events is as follows:
{
'OriginalStartTimeZone': None,
'End': {
'TimeZone': 'tzone://Microsoft/Utc',
'DateTime': '0001-01-01T00:00:00.0000000Z'
},
'HasAttachments': False,
'ResponseRequested': True,
'ShowAs': 'Free',
'Recurrence': None,
'Start': {
'TimeZone': 'tzone://Microsoft/Utc',
'DateTime': '0001-01-01T00:00:00.0000000Z'
},
'BodyPreview': '',
'AllowNewTimeProposals': True,
'Location': {...},
'Attendees': [...],
'TransactionId': None,
'Type': 'SingleInstance',
'ResponseStatus': {
'Response': 'NotResponded',
'Time': '0001-01-01T00:00:00Z'
},
'Body': {...},
'OnlineMeeting': None,
'IsRoomRequested': False,
'OnlineMeetingProvider': 'Unknown',
'IsCancelled': False,
'IsAllDay': False,
'ReminderMinutesBeforeStart': 0,
'Subject': '...',
'Categories': [],
'LastModifiedDateTime': '2020-03-11T18:31:15.548Z',
'AutoRoomBookingOptions': None,
'OriginalEndTimeZone': None,
'CreatedDateTime': '2020-03-11T18:34:34.259429Z',
'IsOnlineMeeting': False,
'#odata.id': '...',
'IsDraft': False,
'WebLink': '...',
'ChangeKey': '...',
'SeriesMasterId': None,
'IsOrganizer': True,
'iCalUId': None,
'AutoRoomBookingStatus': 'None',
'Locations': [],
'Id': '...',
'IsReminderOn': False,
'Calendar#odata.associationLink': '...',
'Calendar#odata.navigationLink': '...',
'Importance': 'Normal',
'Organizer': {...},
'#odata.etag': '...',
'Sensitivity': 'Normal',
'OnlineMeetingUrl': None
}
Is this normal behavior? If so, how can this be displayed?
How can I create such an event to reproduce it?

Flutter map.addAll() results in failure

I got the following List<Map> in Flutter:
List<Map<String, dynamic>> recipeList = [
{
'name': 'rec1',
'id': 1,
'img': 'images/recipe.jpg',
'ingredients': [{
'name': 'salt',
'amount': '1',
'unit': '1',
},
{
'name': 'flour',
'amount': '100',
'unit': 'g',
},
{
'name': 'water',
'amount': '100',
'unit': 'g',
},
{
'name': 'milk',
'amount': '100',
'unit': 'g',
},],
},]
I pass it down through several Widgets and at some point I want to add the key value pair {'didBuy':false} to every Map inside the ingredients list (which is basically recipeList['ingredients']).
Thus I call:
List<Map<String, dynamic>> resultList = recipeList['ingredients'].map((elem) {
elem.addAll({'didBuy': false});
print(elem);
}).toList();
Unfortunately the following error message results: Dart Error: Unhandled exception:type '_InternalLinkedHashMap<String, bool>' is not a subtype of type 'Map<String, String>' of 'other'.
Does anybody know what is the correct way to add something to a map, without getting this error message?
Edited the question to be more precise.
EDIT2:
After calling the type of the List explicitly inside the Map as Hadrien suggested, I can add the key value pair with the boolean. Long term I want to fetch the data from the Internet, so I defined a RecipeObj:
class RecipeObj{
String name;
int id;
String img;
List<Map<String, dynamic>> ingredients;
RecipeObj(this.name, this.id, this.img, this.ingredients);
}
Here I explicitly state the type of the ingredients attribute, so I thought I could get of the explicit calling inside the (main) recipeList. But after passing the ingredients attribute down through some widgets, flutter recognizes it as List<Map<String, String>>, although I define it everywhere as an List<Map<String, dynamic>>, why is that?
dart infer the type of your ingredients list with Map<String, String>
you can specify the type by yourself inside your list
'ingredients': <Map<String, dynamic>>[ {
'name': 'salt',
'amount': '1',
'unit': '1',
},
or build a new Map<String, dynamic> inside your map function
List<Map<String, dynamic>> resultList = recipeList['ingredients'].map((elem) {
final map = Map<String, dynamic>.from(elem);
map.addAll({'didBuy': false});
return map;
}).toList();
This should do
List<Map<String,dynamic>> recipeList = [
at least if recipeList and ingredients point at the same collection instance.
var ingredients = recipeList;
Is this what you need?
void main() {
List<Map> recipeList = [
{
'name': 'rec1',
'id': 1,
'img': 'images/recipe.jpg',
'ingredients': [{
'name': 'salt',
'amount': '1',
'unit': '1',
},
{
'name': 'flour',
'amount': '100',
'unit': 'g',
},
{
'name': 'water',
'amount': '100',
'unit': 'g',
},
{
'name': 'milk',
'amount': '100',
'unit': 'g',
},]
},];
print("[DATA BEFORE ANY CHANGE]");
print("recipeList.length=${recipeList.length}");
print("recipeList[0][\"ingredients\"]=${recipeList[0]["ingredients"]}");
print("recipeList[0][\"ingredients\"].last=${recipeList[0]["ingredients"].last}");
print("recipeList[0][\"ingredients\"].length=${recipeList[0]["ingredients"].length}");
// no recipe is worth if it doesn't contain chocolate
recipeList[0]["ingredients"].add({
'name': 'cocoa powder',
'amount': '200',
'unit': 'g',
});
print("\n\n[DATA AFTER ADD]");
print("recipeList[0][\"ingredients\"].last=${recipeList[0]["ingredients"].last}");
print("recipeList[0][\"ingredients\"].length=${recipeList[0]["ingredients"].length}");
}
OUTPUT
[DATA BEFORE ANY CHANGE]
recipeList.length=1
recipeList[0]["ingredients"]=[{name: salt, amount: 1, unit: 1}, {name: flour, amount: 100, unit: g}, {name: water, amount: 100, unit: g}, {name: milk, amount: 100, unit: g}]
recipeList[0]["ingredients"].last={name: milk, amount: 100, unit: g}
recipeList[0]["ingredients"].length=4
[DATA AFTER ADD]
recipeList[0]["ingredients"].last={name: cocoa powder, amount: 200, unit: g}
recipeList[0]["ingredients"].length=5

openlayers 3 try to load geojson object

Im a bit new to workng with openlayers 3.
im trying to load a geojson object in openlayers 3 but it display the center only point[0,0], which not even in my geojson object, where im i going wrong.
the code is below:
//CREATE A BASE LAYER
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
// create a source from the feature
var source = new ol.source.GeoJSON(
({
object:
{
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {'name': 'EPSG:3857'}
},
'features': [
{
'type': 'Feature',
//'properties': {'id': 63},
'geometry': {
'type': 'Point',
'coordinates': [12, 12]
}
},
{
'type': 'Feature',
'properties': {'id': 62},
'geometry': {
'type': 'Point',
'coordinates': [35.0, 1.0]}
},
{
'type': 'Feature',
'properties': {'id': 61},
'geometry': {
'type': 'Point',
'coordinates': [34.0, 0.0]}
},
{
'type': 'Feature',
'properties': {
'id': 56
},
'geometry': {
'type': 'Point',
'coordinates': [33.0, 33.0]
}
}
]
}
})
);
// CREATE THE LAYER WITH THE DATA
var vectorLayer = new ol.layer.Vector({
source: source
});
// create an openlayers map object
var map = new ol.Map({
target: attrs.id,
layers: [raster,vectorLayer],
view: new ol.View({
//projection:'EPSG:4326',
center:[0,0],
zoom:2
})
});
}
i figured it out, i had to do a reprojection of my geojson object,
openlayers3 by default uses epsg:3857,so does my base map which is openstreetmap i.e projected coordinate system, so i had to turn my geojson to a projected system since it was coming in using the longitude and latitudes i.e. geographical coordinate system.(geojson is always espg:4326)
var source = new ol.source.GeoJSON({
object:{
'type': 'FeatureCollection',
'crs': {
'type': 'name',
'properties': {'name': 'EPSG:4326'}
},
'features': [
{
'type': 'Feature',
//'properties': {'id': 63},
'geometry': {
'type': 'Point',
'coordinates': [12, 12]
}
},
{
'type': 'Feature',
'properties': {'id': 62},
'geometry': {
'type': 'Point',
'coordinates': [35.0, 1.0]}
},
{
'type': 'Feature',
'properties': {'id': 61},
'geometry': {
'type': 'Point',
'coordinates': [34.0, 0.0]}
},
{
'type': 'Feature',
'properties': {
'id': 56
},
'geometry': {
'type': 'Point',
'coordinates': [33.0, 33.0]
}
}
]
},
projection: 'EPSG:3857'
}
);

Highcharts redraw not working with alignTicks

I have updated from version 2.1.6 to 4.0.4 and I have problem with refreshing the alignTicks option.
I start with the property at true and then I set it to false via a button.
From true to false the graph is only updated after a windows resize or if I disable/enable one set of data. From false back to true then it work correctly...
Here an example:
chart = new Highcharts.Chart({
'chart': {
'renderTo': 'graph',
'type': 'line',
'zoomType': 'x',
'alignTicks': true
},
'tooltip': {
'formatter': function () {
var d = new Date(this.x);
return 'Time: <b>' + ('0' + d.getUTCHours()).slice( - 2) + ':' + ('0' + d.getUTCMinutes()).slice( - 2) + ':' + ('0' + d.getUTCSeconds()).slice( - 2) + '</b><br/> Value: <b>' + this.y + '</b>';
}
},
'credits': false,
'title': {
'text': 'Date: 04-11-2014 - Location: Locale'
},
'xAxis': {
'type': 'datetime'
},
'yAxis': [
{
'title': {
'text': 'SK_angle',
'style': {
'color': '#4572A7'
}
},
'labels': {
'style': {
'color': '#4572A7'
}
},
'opposite': false,
'allowDecimals': true
},
{
'title': {
'text': 'EL_angle',
'style': {
'color': '#AA4643'
}
},
'labels': {
'style': {
'color': '#AA4643'
}
},
'opposite': true,
'allowDecimals': true
},
{
'title': {
'text': 'Software Status',
'style': {
'color': '#89A54E'
}
},
'labels': {
'style': {
'color': '#89A54E'
}
},
'opposite': false,
'allowDecimals': false
}
],
'series': [
{
'color': '#4572A7',
'name': 'SK_angle',
'yAxis': 0,
'data': [
[1415064918000,305.89],
[1415064919000,335.0],
[1415064923000,306.05],
]
},
{
'color': '#AA4643',
'name': 'EL_angle',
'yAxis': 1,
'data': [
[1415064918000,37.87],
[1415064919000,37.2],
[1415064923000,37.9],
]
},
{
'color': '#89A54E',
'name': 'Software Status',
'yAxis': 2,
'data': [
[1415064918000,1362],
[1415064919000,1362],
[1415064923000,1256],
]
}
]
});
$('#scaleAlign').click(function() {
if (chart.options.chart.alignTicks) {
chart.options.chart.alignTicks = false;
$('#scaleAlign').attr('value','Align Scale');
}
else {
chart.options.chart.alignTicks = true;
$('#scaleAlign').attr('value','Unalign Scale');
}
chart.isDirtyBox = true;
chart.redraw();
});
http://jsfiddle.net/04Lffe0r/3/
Update the code like this: http://jsfiddle.net/04Lffe0r/4/
By adding this:
chart.series[0].isDirty = true;
Because the series should be set as dirty for the chart to redraw.

Resources