Wednesday 27 February 2019

WSO2 DAS - Hello World!



https://www.javahelps.com/2015/11/wso2-cep-hello-world.html


WSO2 Data Analytics Server is a smart analytics platform for both real-time and batch analytics. The real-time analytics is provided through their powerful open source Complex Event Processing Engine engine Siddhi. This article focuses on the complex event processing capability of the DAS server and provides a quick start guide on how to setup an event stream and process events generated by an HTTP source.
WSO2 DAS - Hello World!
Prerequisite:
Oracle JDK 1.7 or latest
Memory – Minimum 2GB
Disk – Minimum 1 GB
For more details: Installation Prerequisites


Step 1:
Download and extract the latest version of WSO2 DAS from the official link: WSO2 Smart Analytics

Step 2:
Install Postman in Google chrome. We will use Postman to send HTTP requests to the CEP. You can use any other HTTP clients for this purpose.

Step 3:
Open your terminal in wso2das-x.x.x folder and execute the following command.
Linux users:
./bin/wso2server.sh

Windows users:
.\bin\wso2server.bat

Step 4:
Visit the "Mgt Console URL" which is printed in the Terminal. In my computer, this URL is: https://192.168.122.1:9443/carbon/ but it may vary depending on the system.

The browser may show an alert since the local server does not contain a valid HTTPS certificate, click on 'Proceed to <IP-Address>' link.

WSO2 DAS - Hello World!

Step 5:
Login to the dashboard using username: admin and password: admin.

Step 6:
Go to the Streams tab and click on “Add Event Stream” link.

WSO2 DAS - Hello World!


Step 7:
Provide the stream name as “TemperatureStream” and add a payload attribute “temp” as shown below.

WSO2 DAS - Hello World!

Step 8:
Add another stream named “PeakTemperatureStream” with a payload data “temp”.

WSO2 DAS - Hello World!

Step 9:
Open the “Execution Plans” tab and click on “Add Execution Plan” link.

WSO2 DAS - Hello World!


Step 10:
Import the TemperatureStream and Export the PeakTemperatureStream using their own names.

WSO2 DAS - Hello World!

Step 11:
Append the following query at the end of the existing query statements.
from TemperatureStream#window.timeBatch( 1 minute )
select max(temp) as temp
insert into PeakTemperatureStream
This query will collect the events from TemeratureStream and insert the maximum temperature of every minute into the PeakTemperatureStream.

WSO2 DAS - Hello World!
Validate your query expressions and add the execution plan.

Step 12:
Go to the “Receivers” tab and click on the “Add Event Receiver” link.

WSO2 DAS - Hello World!


Step 13:
Create a new HTTP event receiver to receive the TemperatureStream with a name “TemperatureReceiver” and format “json”.

WSO2 DAS - Hello World!

This receiver will receive HTTP requests and pass the event details to the TemperatureStream.

Step 14:
Now we need to create a publisher to publish the peak temperature. Go to the “Publishers” tab and click on the “Add Event Publisher” link.

WSO2 DAS - Hello World!

Step 15:
Create a new logger event publisher for PeakTemperatureStream with a name “TemperaturePublisher”.

WSO2 DAS - Hello World!

This publisher will print the events inserted into the PeakTemperatureStream using the built-in logger.

Step 16:
Now we have two event streams, an event receiver, an executor and a publisher. In Siddhi you can have multiple receivers and publishers for the same stream. Now this the time to send some events and to test the CEP engine.

Open the Postman and send few POST HTTP requests to:
http://localhost:9763/endpoints/TemperatureReceiver
with the TemperatureStream event as a JSON message. Send few numbers of requests with different temperatures.

JSON input:
{
    "event": {
        "payloadData": {
            "temp": 15.6
        }
    }
}

WSO2 DAS - Hello World!

Step 17:
Go the Terminal which is running the wso2server. At the bottom, you will see the maximum temperature value you have sent within the last minute.

WSO2 DAS - Hello World!

Note:
The query used here and the event publisher to the logger are chosen to simplify your first step. You have the freedom to try other event receivers and publishers according to your requirement.

Sunday 24 February 2019

Charts Google List jsfiddle

Pie: -  http://jsfiddle.net/veemX/2/

pie chart on GeoChart =  http://jsfiddle.net/dw29nuyp/

graph:  http://jsfiddle.net/075q5rvz/20/



geo charts:


fixed: http://jsfiddle.net/Lwm5N/1/
           http://jsfiddle.net/jnelsonin/pcLzrn6d/3/


marker: https://jsfiddle.net/doktormolle/S6vBK/

fixed Country: https://jsfiddle.net/cmoreira/tfjmtnfk/1/

zoom onclick: http://jsfiddle.net/maximua/2f4xp7w8/


Line:  http://jsfiddle.net/ovxLjqyn/

------------ -------------- -------------- -------------- -------------- -------------- -------------- --

Here are my options:

                    var options = {
                        displayMode: 'regions',
                        colorAxis: {colors: ['#33FF00','#008000']},
                        datalessRegionColor: 'red'
                    };


Here are my radio buttons (their listener is on the first message).

        <input type="radio" name="region" value="world" checked="checked">World
        <input type="radio" name="region" value="150">Europe
        <input type="radio" name="region" value="142">Asia
        <input type="radio" name="region" value="002">Africa
        <input type="radio" name="region" value="021">North America
        <input type="radio" name="region" value="005">South America
        <input type="radio" name="region" value="009">Oceania
        <input type="radio" name="region" value="145">Middle East</div>

In attachment you find the "world" map and then its zoom in "europe". As you can see, Turkey loses its data in the "europe" visualisation.

Thanks for the reply anyway ;)
------------ -------------- -------------- -------------- -------------- -------------- -------------- --



Java, Databases, Python, GUI, SQLlite in all lanugage

ZetCode brings tutorials for programmers in various areas. The main are Graphical User Interfaces, databases, and programming languages. The website's mission is to provide competent, quick and easy to understand tutorials for modern-day technologies. Subscribe to news on a mailing list or you can follow the author on Twitter,Google+, or Facebook. Get the list of all tutorials on ZetCode.

E-books

Java

GUI

Databases

Python

News

Twig tutorial written (February 24, 2019)
Java ProcessBuilder tutorial written (February 18, 2019)
Java fibonacci tutorial written (February 18, 2019)
Node Postgres tutorial written (February 17, 2019)
Document.all tutorial written (February 17, 2019)
Java split string tutorial written (February 16, 2019)
Java Files.walk tutorial written (February 15, 2019)
Java Files.list tutorial written (February 14, 2019)
Liquid.js tutorial written (February 14, 2019)
Jest tutorial written (February 7, 2019)
Axios tutorial written (February 4, 2019)
PHP Respect Validation tutorial written (February 3, 2019)
PHP Rakit Validation tutorial written (February 2, 2019)
Symfony creating routes tutorial written (January 29, 2019)
Spring @MatrixVariable tutorial written (January 22, 2019)
Spring @RequestMapping tutorial written (January 21, 2019)

Tuesday 19 February 2019

Google Charts


Quick Start

Here's a simple example of a page that displays a pie chart:

You can copy the snippet below to an .html file on your computer and open it in your browser to display the pie chart shown above:
<html>   <head>     <!--Load the AJAX API-->     <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>     <script type="text/javascript">       // Load the Visualization API and the corechart package.       google.charts.load('current', {'packages':['corechart']});       // Set a callback to run when the Google Visualization API is loaded.       google.charts.setOnLoadCallback(drawChart);       // Callback that creates and populates a data table,       // instantiates the pie chart, passes in the data and       // draws it.       function drawChart() {         // Create the data table.         var data = new google.visualization.DataTable();         data.addColumn('string', 'Topping');         data.addColumn('number', 'Slices');         data.addRows([           ['Mushrooms', 3],           ['Onions', 1],           ['Olives', 1],           ['Zucchini', 1],           ['Pepperoni', 2]         ]);         // Set chart options         var options = {'title':'How Much Pizza I Ate Last Night',                        'width':400,                        'height':300};         // Instantiate and draw our chart, passing in some options.         var chart = new google.visualization.PieChart(document.getElementById('chart_div'));         chart.draw(data, options);       }     </script>   </head>   <body>     <!--Div that will hold the pie chart-->     <div id="chart_div"></div>   </body> </html>

How About a Bar Chart?

Convert the pie chart to a bar chart by replacing
google.visualization.PieChart with
google.visualization.BarChart
in the code and reloading your browser. You may notice that the "Slices" legend is truncated. To fix this, change width to 500 from 400, save the file, and reload your browser.