Author Archives: om

highcharts php array

https://www.freeformatter.com/json-formatter.html




$chart = '

  {
   "title": {
      "text": "Solar Employment Growth by Sector, 2010-2016"
   },
   "subtitle": {
      "text": "Source: thesolarfoundation.com"
   },
   "yAxis": {
      "title": {
         "text": "Number of Employees"
      }
   },
   "legend": {
      "layout": "vertical",
      "align": "right",
      "verticalAlign": "middle"
   },
   "plotOptions": {
      "series": {
         "label": {
            "connectorAllowed": false
         },
         "pointStart": 2010
      }
   },
   "series": [
      {
         "name": "Installation",
         "data": [
            43934,
            52503,
            57177,
            69658,
            97031,
            119931,
            137133,
            154175
         ]
      },
      {
         "name": "Manufacturing",
         "data": [
            24916,
            24064,
            29742,
            29851,
            32490,
            30282,
            38121,
            40434
         ]
      },
      {
         "name": "Sales & Distribution",
         "data": [
            11744,
            17722,
            16005,
            19771,
            20185,
            24377,
            32147,
            39387
         ]
      },
      {
         "name": "Project Development",
         "data": [
            null,
            null,
            7988,
            12169,
            15112,
            22452,
            34400,
            34227
         ]
      },
      {
         "name": "Other",
         "data": [
            12908,
            5948,
            8105,
            11248,
            8989,
            11816,
            18274,
            18111
         ]
      }
   ],
   "responsive": {
      "rules": [
         {
            "condition": {
               "maxWidth": 500
            },
            "chartOptions": {
               "legend": {
                  "layout": "horizontal",
                  "align": "center",
                  "verticalAlign": "bottom"
               }
            }
         }
      ]
   }
}
        ';

//$json = json_decode($chart, $assoc=true);
// echo '
';
   // var_export($json);
   // echo '

';
// exit();

Share

Remove GeoJSON datasource as well as entities

// 1. we can save the references to the entities that are labels in an array called 'labels'
var labels = [];


var promise = Cesium.GeoJsonDataSource.load('../../../cesiumLayers/sampledata/nextgen/World_Lables.geojson');
promise.then(function (dataSource) { 
    //viewer.dataSources.add(dataSource); 
    var entities = dataSource.entities.values; 

    for (var i = 0; i < entities.length; i++) { 
        var entity = entities[i]; 
        var abc = entity.position.getValue(); 
        var stPt = convertCartesianToCartographic(abc); 
        //entity.position = Cesium.Cartesian3.fromDegrees(stPt[0],stPt[1],stPt[2]); 

        // 2. Now, push each entity that's a label to our 'labels' array
        labels.push(viewer.entities.add({ 
            position: Cesium.Cartesian3.fromDegrees(stPt[0], stPt[1], stPt[2]), 
            label: { 
                text: entity.properties.name, 
                font: '16px Helvetica', 
                fillColor: Cesium.Color.WHITE, 
                outlineColor: Cesium.Color.BLACK, 
                outlineWidth: 5, 
                //pixelOffset : new Cartesian3(50.0, -50.0), 
                style: Cesium.LabelStyle.FILL_AND_OUTLINE, 
                translucencyByDistance: new Cesium.NearFarScalar(2.5e6, 1.0, 2.5e7, 0.0) 
            } 
        })); 
    } 
});

// some code later...

for (var i = 0; i < labels.length; i++) {
    // remove each entity that's a label
    viewer.entities.remove(labels[i]);
}
Share

cesiumjs – Removing Polyline

 

https://groups.google.com/forum/#!msg/cesium-dev/Bf9MwBgJN8w/5WfUFprBqSgJ

https://stackoverflow.com/questions/34450497/removing-polyline-in-cesium-js  Used

https://groups.google.com/forum/#!msg/cesium-dev/SLGGF3kpp_4/MvLRLVku42AJ

https://developers.google.com/web/fundamentals/primers/promises

Share

GeoJSON FeatureCollection example, geometry and properties.

        $str = '{
            "type": "FeatureCollection",
            "features": [
            {
                "type": "Feature",
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [[[-69.0062266588211,
                    9.27562217679211],
                    [-43.517945408821106,
                    -2.811371193331128],
                    [-37.014039158821106,
                    -9.795677582829732],
                    [-72.61157142049046,
                    4.701436497353403],
                    [-69.0062266588211,
                    9.27562217679211]]]
                },
                "properties": {
                    "name": "DOUBLE OAKS CENTER",
                    "address": "1326 WOODWARD AV"
                }
            },
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        -80.837753,
                        35.249801
                    ]
                },
                "properties": {
                    "name": "DOUBLE OAKS CENTER",
                    "address": "1326 WOODWARD AV"
                }
            }
            ]
        }';

http://openlayers.org/en/master/examples/geojson.html
https://google-developers.appspot.com/maps/documentation/utils/geojson/
http://geojsonlint.com/

https://gist.github.com/sgillies/1233327  –  The GeoJSON Format Specification

var viewer = new Cesium.Viewer('cesiumContainer', {
    sceneMode : Cesium.SceneMode.SCENE2D,
    timeline : false,
    animation : false
});

var dataSource = Cesium.GeoJsonDataSource.load('simplestyles.geojson');
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);

Share

Left hand panel for Cesiumjs.


»
$(function(){
	$('.slider-arrow').click(function(){
        if($(this).hasClass('show')){
	    $( ".slider-arrow, .panel" ).animate({
          left: "+=300"
		  }, 700, function() {
            // Animation complete.
          });
		  $(this).html('«').removeClass('show').addClass('hide');
        }
        else {   	
	    $( ".slider-arrow, .panel" ).animate({
          left: "-=300"
		  }, 700, function() {
            // Animation complete.
          });
		  $(this).html('»').removeClass('hide').addClass('show');    
        }
    });

});
.panel {
	width:300px;
	float:left;
	height:550px;
	background:#d9dada;
	position:relative;
	left:-300px;

}
.slider-arrow {
	padding:5px;
	width:10px;
	float:left;
	background:#d9dada;
	font:400 12px Arial, Helvetica, sans-serif;
	color:#000;
	text-decoration:none;
	position:relative;
	left:-300px;
}

https://jsfiddle.net/phpmind/2gj84235/

Share

Displaying dynamic CZML data?

var czml = [{
    "id" : "document",
    "name" : "CZML Model",
    "version" : "1.0"
}, {
    "id" : "aircraft model",
    "name" : "Cesium Air",
    "position" : {
        "cartographicDegrees" : [-77, 37, 10000]
    },
    "model": {
        "gltf" : "../../SampleData/models/CesiumAir/Cesium_Air.glb",
        "scale" : 2.0,
        "minimumPixelSize": 128
    }
}];


var updatedCzml = [{
    "id":"document",
    "name":"CZML Model",
    "version":"1.0"
},{
    "id":"aircraft model",
    "position": {
        "cartographicDegrees":
        [-139.23640674352512,24.89787519772953,48897.796695947756]
    }
}];



var czmlStream = new Cesium.CzmlDataSource();


var viewer = new Cesium.Viewer('cesiumContainer', {
        infoBox : false,
        selectionIndicator : false,
        shadows : true,
        automaticallyTrackDataSourceClocks : false
});

viewer.dataSources.add(czmlStream.load(czml));


Sandcastle.addToolbarButton('Process', function() {
    czmlStream.process(updatedCzml);


});


https://www.html5rocks.com/en/tutorials/eventsource/basics/#toc-security

https://www.howopensource.com/2014/12/introduction-to-server-sent-events/

Source – Hannah Pinkos

Share

How Alexa’s intents, utterances and slots works together ?


To create a Alexa skill, you will first define the intents. For each intent you will add utterances and slots. Utterances are phrases that invoke the intent. Slots are input data required to fulfill the intent. Lastly, you will provide the business logic necessary to execute the action.

Q. What is an Intent?

To build an Amazon skill you will identify a set of goals or ‘intents’ you want your skill to achieve.
A skill can have multiple intents. For example, a ‘BookTickets’ bot can have intents to make reservations, cancel reservations and review
reservations.

Q. What is an utterance?

An ‘utterance’ is the spoken or typed phrase to invoke an intent. For example, to invoke intent to make reservations you would define an utterance such as “Can I make a reservation?”

Q. What are slots?

To fulfill an intent, the Amazon skill needs information from the user. This information is captured in ‘slots’. For example, you would define show name and time as slots for intent to make reservations.

Share

Chat Bot comparison luis.ai vs api.ai vs wit.ai.

╔══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
║                                                  wit.ai vs api.ai vs luis.ai                                                 ║
╠══════╦════════════════════════════════════╦═════════════════════════════════════════════╦════════════════════════════════════╣
║ S.No ║               Wit.ai               ║                    Api.ai                   ║               Luis.ai              ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 1    ║ Wit.ai API is completely free      ║ Api.ai Has a paid enterprise option         ║ LUIS is in beta and free to use    ║
║      ║ with no limitations on             ║ which allows for this to be run on a        ║ 10K transactions per month         ║
║      ║ request rates.                     ║ private cloud internally and more           ║ and up to 5 requests per second    ║
║      ║                                    ║ from their services team.,Basic paid        ║ for each account.                  ║
║      ║                                    ║ version starts at 89USD per month.          ║                                    ║
║      ║                                    ║ Free account has no transaction limit       ║                                    ║
║      ║                                    ║ for month anymore.                          ║                                    ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 2    ║ Provides a nice combination        ║ Speech to Text and Text to Speech           ║ LUIS uses machine learning         ║
║      ║ of both voice recognition and      ║ capabilities, along with machine            ║ based methods to analyze           ║
║      ║ machine learning for developers.   ║ learning.                                   ║ sentences. To perform machine      ║
║      ║                                    ║                                             ║ learning, LUIS breaks an           ║
║      ║                                    ║                                             ║ utterance into "tokens".           ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 3    ║ Has two main elements to it        ║ Support of Intents, Entities, actions       ║ Supports Intents, Entities         ║
║      ║ that you set up within your        ║ and one key focus area is its “Domains”.    ║ and actions.                       ║
║      ║ app – intents and entities.        ║                                             ║                                    ║
║      ║ Actions are separated to           ║                                             ║                                    ║
║      ║ use as a combined operations.      ║                                             ║                                    ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 4    ║ Has pre-build entities like        ║ Has pre-build entities like @sys.date,      ║ Has pre-build entities             ║
║      ║ temperature, number, URLs,         ║ @sys.color, @sys.unit-currency… etc.        ║ builtin.intent.alarm,              ║
║      ║ emails, duration… etc.             ║                                             ║ builtin.intent.calendar,           ║
║      ║                                    ║                                             ║ builtin.intent.email… etc.         ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 5    ║ Doesn’t have integration module    ║ Has integration module to connect           ║ Has integration to Microsoft       ║
║      ║ to directly communicating with     ║ directly to Facebook messenger and          ║ Azure and other services, can be   ║
║      ║ Facebook messenger or other        ║ other messenger api’s. Has support for      ║ deployable in any supported        ║
║      ║ messenger APIs. but has web        ║ deploying in to heroku server, enterprise   ║ servers.                           ║
║      ║ service api to hook services.      ║ paid environment.                           ║                                    ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 6    ║ Early in 2015, joined Facebook     ║ Created by a team who built personal        ║ LUIS was introduced together with  ║
║      ║ and opened up the entire platform  ║ assistant app for major mobile platforms    ║ Microsoft Bot Framework and Skype  ║
║      ║ to be free for both public and     ║ with speech and text enabled conversations. ║ Developer Platform which can be    ║
║      ║ private instances.                 ║ acquired by google (sept 2016).             ║ used to create Skype Bots.         ║
╠══════╬════════════════════════════════════╬═════════════════════════════════════════════╬════════════════════════════════════╣
║ 7    ║ Wit.ai API for developers of iOS,  ║ Api.ai has SDKs for Android, iOS,           ║ LUIS allow building applications   ║
║      ║ Android, Node.js, Raspberry Pi,    ║ the Apple Watch, Node.js, Cordova,          ║ by using the LUIS web interface.   ║
║      ║ Ruby, Python, C, Rust and          ║ Unity, C#, Xamarin, Windows Phone,          ║ No coding needed other than the    ║
║      ║ Windows Phone. It even             ║ Python and JavaScript. It also can be       ║ ability to interpret and use the   ║
║      ║ has a JavaScript plugin for        ║ integrated with Amazon’s Echo and           ║ returned JSON in application.      ║
║      ║ front end developers.              ║ Microsoft’s Cortana.                        ║ It is also possible to use the     ║
║      ║                                    ║                                             ║ LUIS REST API for                  ║
║      ║                                    ║                                             ║ automation of applications.        ║
╚══════╩════════════════════════════════════╩═════════════════════════════════════════════╩════════════════════════════════════╝

Amazon Lex is a service for building conversational interfaces into any application using voice and text. Lex provides the advanced deep learning functionalities of automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize the intent of the text, to enable you to build applications with highly engaging user experiences and lifelike conversational interactions. With Amazon Lex, the same deep learning technologies that power Amazon Alexa are now available to any developer, enabling you to quickly and easily build sophisticated, natural language, conversational bots (“chatbots”).

https://aws.amazon.com/lex/

Share

Cesium – How to show pyramid with polygon base in CZML ?



    var czml = [
      {
        "id" : "document",
        "name" : "CZML Geometries: Polygon",
        "version" : "1.0"
      }, {
        "id" : "orangePolygon",
        "name" : "Orange polygon with per-position heights and outline",
        "polygon" : {
          "positions" : {
            "cartographicDegrees" : [
              -70.0, 35.0, 100000,
              -72.0, 37.0, 0,
              -68.0, 35.0, 0
            ]
          },
          "material" : {
            "solidColor" : {
              "color" : {
                "rgba" : [255, 100, 0, 100]
              }
            }
          },
      "extrudedHeight" : 0,
      "perPositionHeight" : true,
      "outline" : true,
      "outlineColor" : {
        "rgba" : [0, 0, 0, 255]
      }
    }
  },


    {
    "id" : "orangePolygon2",
    "name" : "Orange polygon with per-position heights and outline",
    "polygon" : {
      "positions" : {
        "cartographicDegrees" : [
          -70.0, 35.0, 100000,
          -70.0, 33.0, 0,
          -68.0, 35.0, 0
        ]
      },
      "material" : {
        "solidColor" : {
          "color" : {
            "rgba" : [255, 100, 0, 100]
          }
        }
      },
      "extrudedHeight" : 0,
      "perPositionHeight" : true,
      "outline" : true,
      "outlineColor" : {
        "rgba" : [0, 0, 0, 255]
      }
    }
  },

    {
    "id" : "orangePolygon3",
    "name" : "Orange polygon with per-position heights and outline",
    "polygon" : {
      "positions" : {
        "cartographicDegrees" : [
          -70.0, 35.0, 100000,
          -70.0, 33.0, 0,
          -72.0, 37.0, 0,
        ]
      },
      "material" : {
        "solidColor" : {
          "color" : {
            "rgba" : [255, 100, 0, 100]
          }
        }
      },
      "extrudedHeight" : 0,
      "perPositionHeight" : true,
      "outline" : true,
      "outlineColor" : {
        "rgba" : [0, 0, 0, 255]
      }
    }
  }
];

var viewer = new Cesium.Viewer('cesiumContainer');
var dataSource = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);

Share