text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/appwidget_dark_bg_clickable"
    android:divider="@drawable/appwidget_divider"
    android:orientation="horizontal"
    android:showDividers="middle" >

    <ImageView
        android:id="@+id/widget_app_icon"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginLeft="12dp"
        android:contentDescription="@string/app_name"
        android:src="@mipmap/ic_app_color_48dp"
        android:visibility="gone" />

    <LinearLayout
        android:id="@+id/widget_button_balance"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_weight="3"
        android:background="@drawable/appwidget_button_left"
        android:focusable="true"
        android:gravity="left|center_vertical"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dp"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/widget_wallet_prefix"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical" />

            <TextView
                android:id="@+id/widget_wallet_balance_btc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="4sp"
                android:ellipsize="none"
                android:fadingEdge="horizontal"
                android:fadingEdgeLength="12dp"
                android:singleLine="true"
                android:textColor="@color/fg_network_significant"
                android:textSize="@dimen/font_size_large" />
        </LinearLayout>

        <TextView
            android:id="@+id/widget_wallet_balance_local"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="12dp"
            android:ellipsize="none"
            android:fadingEdge="horizontal"
            android:fadingEdgeLength="12dp"
            android:singleLine="true"
            android:textColor="@color/fg_network_insignificant"
            android:textSize="@dimen/font_size_normal" />
    </LinearLayout>

    <ImageButton
        android:id="@+id/widget_button_request"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/appwidget_button_center"
        android:contentDescription="@string/button_request_coins"
        android:src="@drawable/ic_send_flipped_white_24dp" />

    <ImageButton
        android:id="@+id/widget_button_send"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/appwidget_button_center"
        android:contentDescription="@string/button_send_coins"
        android:src="@drawable/ic_send_white_24dp" />

    <ImageButton
        android:id="@+id/widget_button_send_qr"
        android:layout_width="0px"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/appwidget_button_right"
        android:contentDescription="@string/button_scan"
        android:src="@drawable/ic_photo_camera_white_24dp" />

</LinearLayout>


text:
Based on [Camel Servlet REST and Apache Tomcat example](https://github.com/apache/camel/tree/master/examples/camel-example-servlet-rest-tomcat).

##Prerequisites
Before using this archetype be sure to have w1 kernel modules loaded. Consult [camel-temperature](https://github.com/px3/silverspoon/tree/devel/camel-temperature) documentation for more details

##Running
You can try the example from Maven using

    mvn jetty:run

Once jetty is running you can reach the main page at `http://localhost:8080/${artifactId}`

redpajama_set_name: RedPajamaGithub


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* global cp*, Table, Ball, Wall, Occluder, Goal */

// Variables for timing
var TIMEPERSTEP = .025;
var TIMEPERPOLL = .1;
var MAXDISPTIME = 5;

var assert = function(value, message)
{
	if (!value) {
		throw new Error('Assertion failed: ' + message);
	}
};

Button = function(color, elemname, txt, font) {
    this.color = color;
    this.ele = document.getElementById(elemname);
    this.ctx = this.ele.getContext('2d');
    this.txt = txt;

    // Setup the drawing
    var wid = this.ele.width;
    var hgt = this.ele.height;
    $('#'+elemname).css({'border-color':this.color});

    var boxleft = 0;

    this.ctx.fillStyle = color;
    this.ctx.strokeStyle = 'black';
    this.ctx.fillRect(boxleft,0,wid,hgt);
    //this.ctx.strokeRect(boxleft,0,this.boxwid,hgt);

    if (font === undefined)
        font = '30px Times New Roman bold';
    this.ctx.font = font;
    this.ctx.fillStyle = 'black';
    this.ctx.textAlign = 'center';
    this.ctx.textBaseline = 'middle';
    this.ctx.fillText(this.txt, boxleft + wid/2, hgt/2);

    this.draw();
};

Button.prototype.draw = function(clear) {
    if (typeof(clear)==='undefined') clear = false;
    if (clear) this.ctx.clearRect(0,0,this.ele.width,this.ele.height);
    else {
        //this.ctx.fillStyle = this.color;
        //this.ctx.fillRect(0,0,this.ele.width,this.ele.height);
        this.ctx.fillStyle = 'black';
        this.ctx.fillText(this.txt, this.ele.width/2, this.ele.height/2);
    }
};

ScoreDisp = function(elemname) {
    this.ele = document.getElementById(elemname);
    this.ctx = this.ele.getContext('2d');
    this.score = 0;
};

ScoreDisp.prototype.add = function(sc) {
    this.score += sc;
};
ScoreDisp.prototype.draw = function() {
    var ewid = this.ele.width;
    var ehgt = this.ele.height;

    this.ctx.clearRect(0,0,this.ele.width,this.ele.height);

    this.ctx.font = '20px Times New Roman bold';
    this.ctx.fillStyle = 'black';
    this.ctx.textAlign = 'center';
    this.ctx.textBaseline = 'top';
    this.ctx.fillText('Score:',ewid/2,0);

    this.ctx.textBaseline = 'bottom';
    this.ctx.fillText(this.score, ewid/2,ehgt);

};
ScoreDisp.prototype.reset = function() {
    this.score = 0;
};

TrialCounter = function(elemname) {
    this.ele = document.getElementById(elemname);
    this.ctx = this.ele.getContext('2d');
    this.count = 1;
    this.numtrials = 1;
    this.display = false;
};

TrialCounter.prototype.incr = function() {
    this.count += 1;
};
TrialCounter.prototype.setnumtrials = function(numtrials) {
    this.numtrials = numtrials;
}
TrialCounter.prototype.draw = function() {
    if (!this.display) return;

    var ewid = this.ele.width;
    var ehgt = this.ele.height;

    this.ctx.clearRect(0,0,this.ele.width,this.ele.height);

    this.ctx.font = '20px Times New Roman bold';
    this.ctx.fillStyle = 'black';
    this.ctx.textAlign = 'center';
    this.ctx.textBaseline = 'top';
    this.ctx.fillText('Trial:',ewid-40,0);

    this.ctx.textBaseline = 'bottom';
    this.ctx.fillText(this.count+'/'+this.numtrials,ewid-40,ehgt);
    this.ctx.fillStyle = 'white';

};
TrialCounter.prototype.reset = function() {
    this.count = 1;
};

/**
 *
 * @param {array} keys - array of keys to keep track of (using jquery numbering)
 * @param {function} onkeypress - a function that takes in the key pressed and gets called when
 *                           one of the tracked keys is pressed
 * @param {function} onkeyrelease - like onkeypress, but for when a key is released
 * @returns {KeyHandler}
 */
KeyHandler = function(keys, onkeypress, onkeyrelease) {
    this.keys = keys;
    this.state = {};
    for (i=0;i<keys.length;i++) {
        this.state[keys[i]] = false;
    }

    this.onkp = onkeypress;
    this.onkr = onkeyrelease;

    // Set handlers
    var that = this;
    var k;
    $(document).keydown(function(event) {
        k = event.which;
        if (that.keys.indexOf(k+"") > -1) {
            if (that.state[k] === false) {
                that.state[k] = true;
                that.onkp(k);
            }
        }
    });
    $(document).keyup(function(event) {
        k = event.which;
        if (that.keys.indexOf(k+"") > -1) {
            that.state[k] = false;
            that.onkr(k);
        }
    });
};
KeyHandler.prototype.getstate = function() {return this.state;};
KeyHandler.prototype.setpress = function(fn) {this.onkp = fn;};
KeyHandler.prototype.setrelease = function(fn) {this.onkr = fn;};

TIME_BEGIN = 0.3;
TIME_END = 2.0;

Trial = function(table, textbox, leftbtn, rightbtn, score, trcounter, yesonleft) {
    this.yol = yesonleft;
    this.tbele = tbele = document.getElementById(table);
    if (yesonleft) {lbtxt = 'Yes: Z'; rbtxt = 'No: M';}
    else {lbtxt = 'No: Z'; rbtxt = 'Yes: M';}
    this.txtele = document.getElementById(textbox);
    this.txtbox = new Button(WHITE,textbox,'Can the ball reach the goal?','26px Times New Roman bold');
    this.lbtn = new Button(BLACK,leftbtn,lbtxt);
    this.rbtn = new Button(BLACK,rightbtn,rbtxt);
    this.score = new ScoreDisp(score);
    this.trcounter = new TrialCounter(trcounter);
    this.reachresponse = NORESPONSE;
    this.resptime = -1;
    this.goalreachable = false;
    this.motioncond = 1;
    this.done = false;
    this.paused = false;

    assert(tbele.getContext,'No support for canvases!');

    this.tb = new Table('tmp',tbele.width,tbele.height,tbele);

    this.keymap = {
        32: 'space',
        77: 'm',
        90: 'z'
    };
    // Initialize handler with no functions
    this.keyhandler = new KeyHandler(
        Object.keys(this.keymap),
        function(k) {},
        function(k) {});

};
Trial.prototype.loadTrial = function(trfile) {
    this.tb = loadTrial(trfile,this.tbele);
    this.done = false;
    this.reachresponse = NORESPONSE;
    this.resptime = -1;
};
Trial.prototype.loadFromTList = function(trname, trlist) {
    this.tb = trlist.loadTrial(trname, this.tbele);
    this.done = false;
    this.reachresponse = NORESPONSE;
    this.resptime = -1;
};
Trial.prototype.draw = function(flash) {
    if (flash === 'undefined')
        flash = true;

    this.tb.draw();
    this.txtbox.draw(true);
    this.txtbox.draw();
    this.lbtn.draw(flash);
    this.rbtn.draw(flash);
    this.score.draw();
    this.trcounter.draw();
};
Trial.prototype.step = function(dt) {
    var e = this.tb.step(dt);
    // Do event handling here
    this.draw();
    return e;
};
Trial.prototype.gettrialsteps = function(dt) {
    var tableclone = this.tb.clone();

    var nsteps = 0;
    var e = 0;
    while (e === 0) { e = tableclone.step(dt); nsteps++; }
    return nsteps;
};
Trial.prototype.gettrialgoal = function(dt) {
    var tableclone = this.tb.clone();

    var e = 0;
    while (e === 0)
        e = tableclone.step(dt);
    return e;
};

Trial.prototype.displaytext = function(text, textcol, bkcol,hideall) {
    if (typeof(bkcol)==='undefined') bkcol = "white";
    if (typeof(textcol)==='undefined') textcol = "black";
    if (text.substring(0,6) === "<span>") htmtext = text;
    else htmtext = "<span>"+text+"</span>";
    var wid = this.tbele.width;
    var hgt = this.tbele.height;
    $("#"+this.tbele.id).hide(0);
    if (typeof(hideall)!== "undefined" & hideall) {
        $("#"+this.txtbox.ele.id).hide(0);
        $("#"+this.lbtn.ele.id).hide(0);
        $("#"+this.score.ele.id).hide(0);
        $("#"+this.rbtn.ele.id).hide(0);
        $("#"+this.trcounter.ele.id).hide(0);
    }

    tf = $('#textfield');
    tf.html(htmtext);
    tf.css({'background-color':bkcol,'color':textcol});
    tf.show(0);

};
Trial.prototype.hidetext = function() {
    $("#"+this.tbele.id).show(0);

    $("#"+this.txtbox.ele.id).show(0);
    $("#"+this.lbtn.ele.id).show(0);
    $("#"+this.score.ele.id).show(0);
    $("#"+this.rbtn.ele.id).show(0);
    $("#"+this.trcounter.ele.id).show(0);
    $('#textfield').hide(0);
};
Trial.prototype.showinstruct = function(text,textcol,bkcol, callback, hideall) {
    this.displaytext(text,textcol,bkcol,hideall);
    // Wait until a click
    var that = this;
    this.keyhandler.setpress(function(k) {
        if (k===32) {
            that.hidetext();
            that.keyhandler.setpress(function(k) {});
            callback();
        }
    });
};

Trial.prototype.replaceText = function(newtext,textcol,bkcol) {
    this.oldtext = $('#textfield').html();
    this.displaytext(newtext,textcol,bkcol);
};

Trial.prototype.restoreText = function(textcol,bkcol) {
    this.displaytext(this.oldtext,textcol,bkcol);
    this.oldtext = '';
};

Trial.prototype.writenewscore = function(newscore,showscore) {
    var tx1 = "You earned " + newscore + " points on this trial";
    var tx2 = "Press spacebar to continue";

    var ctx = this.tbele.getContext('2d');
    ctx.font = "30px Times New Roman";
    ctx.fillStyle = 'black';
    ctx.strokeStyle = 'black';
    ctx.textAlign = 'center';

    var newwid = 10 + Math.max(ctx.measureText(tx1).width,ctx.measureText(tx2).width);

    var centx = this.tbele.width/2;
    var centy = this.tbele.height/2;

    ctx.clearRect(centx - newwid/2, centy - 37.5, newwid, 75);
    ctx.strokeRect(centx - newwid/2, centy - 37.5, newwid, 75);

    if (typeof(showscore) === 'undefined' || !showscore) {
        ctx.textBaseline = 'top';
        ctx.fillText(tx1,centx,centy - 32.5);
        ctx.textBaseline = 'bottom';
        ctx.fillText(tx2,centx,centy + 32.5);
    }
    else {
        ctx.textBaseline = 'middle';
        ctx.fillText(tx2,centx,centy);
    }
};

Trial.prototype.showtrial = function(dt,displaytime,responsetime,maxtime,callback,showscore) {
    var that = this;
    // store trial ball vel
    var vel = this.tb.ball.getvel();

    // function to be called after subject response
    var finishtrial = function() {
        that.keyhandler.setpress(function(k) {});

        // set ball vel back to original, if it was set to 0
        if (that.motioncond == 0) {
            that.tb.ball.setvel(vel['x'], vel['y']);
	}
        // if goal is not reachable, make ending display shorter
        if (!that.goalreachable) {
            maxtime = MAXDISPTIME;
        }

        // display trial ending for feedback at triple speed
        var pev = 0;
        interid = setInterval(function () {
            pev = that.tb.step(dt,maxtime);

            that.draw(true);

            if (pev !== 0) { // Time up
                clearInterval(interid);

                // Update score
                if (that.reachresponse === NORESPONSE) {
                    score = 0;
                }
                else if (that.goalreachable !== that.reachresponse) {
                    score = -10;
                }
                else {
                    score = 100 * (1 - (that.resptime-TIME_BEGIN)/(TIME_END-TIME_BEGIN));
                    score = Math.round(Math.max(Math.min(score,100),0));
                }
                that.score.add(score);
                that.draw(true);
                that.writenewscore(score,showscore);
                that.done = true;
                that.lastscore = score;

                that.keyhandler.setpress(function(k) {
                    if (k===32) {
                        that.hidetext();
                        that.keyhandler.setpress(function(k) {});
                        callback();
                    }
                });

            }
        }, dt*1000 / 3);
    };

    // function to be called after trial display, to wait for response
    var waitresponse = function() {
        // Flash something to sinalize beginning of response period
        that.draw(false);

        var timeoutid;
        var start = new Date();
        that.keyhandler.setpress(function(k) {
            if (k===77) {
                that.keyhandler.setpress(function(k) {});
                clearTimeout(timeoutid);
                that.resptime = (new Date() - start) / 1000;
                if (that.yol) that.reachresponse = false;
                else that.reachresponse = true;
                finishtrial();
            }
            else if (k===90) {
                that.keyhandler.setpress(function(k) {});
                clearTimeout(timeoutid);
                that.resptime = (new Date() - start) / 1000;
                if (that.yol) that.reachresponse = true;
                else that.reachresponse = false;
                finishtrial();
            }
        });
        // Possible race condition, multiple calls to finishtrial
        timeoutid = setTimeout(finishtrial, responsetime*1000);
    };

    // set ball vel by motion condition
    this.tb.ball.setvel(vel['x']*this.motioncond, vel['y']*this.motioncond);
    // display trial
    var pev = 0;
    interid = setInterval(function () {
        pev = that.tb.step(dt,displaytime);

        that.draw(true);

        if (pev !== 0) {
            assert(pev === TIMEUP, "Oddly, your trial ended too soon");
            clearInterval(interid);
            waitresponse();
        }
    }, dt*1000);
};

// Keep only the correct goal, either in (goalreachable is true),
// or out (goalreachable is false)
Trial.prototype.choosegoal = function(goalreachable) {
    if (goalreachable)
        if (this.tb.goals[0].onret === GREENGOAL)
            this.tb.goals.splice(1, 1);
        else
            this.tb.goals.splice(0, 1);
    else
        if (this.tb.goals[0].onret === GREENGOAL)
            this.tb.goals.splice(0, 1);
        else
            this.tb.goals.splice(1, 1);

    this.tb.goals[0].color = RED;
};

Trial.prototype.isgoalreachable= function() {
    return this.goalreachable;
};

Trial.prototype.runtrial = function(dt,displaytime,responsetime,maxtime,callback,motioncond,goalcond,showscore) {
    if (typeof(goalcond) === 'undefined')
        goalcond = (Math.random() < 0.5);
    this.goalreachable = (goalcond != 'out');
    this.choosegoal(this.goalreachable);

    // assign motion condition value
    if (motioncond === 'static')
        this.motioncond = 0;
    else if (motioncond === 'forward')
        this.motioncond = 1;
    else if (motioncond === 'reverse')
        this.motioncond = -1;
    else // generate random motion condition if undefined, one of {-1,0,1}
        this.motioncond = Math.floor(Math.random()*3)-1;

    var that = this;
    var runfn = function() {that.showtrial(dt,displaytime,responsetime,maxtime,callback,showscore);};
    this.showinstruct('Press the spacebar to begin','black','lightgrey',runfn, true);
};


text:
$(function(){
    function pageLoad(){

        //newmamap.init('#new-market-svg');
        $('.chzn-select').select2();
        $("#wizard").bootstrapWizard({onTabShow: function(tab, navigation, index) {
            var $total = navigation.find('li').length;
            var $current = index+1;
            var $percent = ($current/$total) * 100;
            var $wizard = $("#wizard");
            $wizard.find('.progress-bar').css({width:$percent+'%'});

            if($current >= $total) {
                $wizard.find('.pager .next').hide();
                $wizard.find('.pager .finish').show();
                $wizard.find('.pager .finish').removeClass('disabled');
            } else {
                $wizard.find('.pager .next').show();
                $wizard.find('.pager .finish').hide();
            }
        }});

    }

    pageLoad();

    PjaxApp.onPageLoad(pageLoad);
});

function maNewController($scope){
    newmamap.init('#new-market-svg');

    $scope.marketarea = {};
    $scope.geouint = 'tract';
    $('#gtfs-select').on('change',function(){
        gtfsID = parseInt($('#gtfs-select').val());
        if(typeof gtfsID === 'number'){
           $.ajax('/gtfs/'+gtfsID+'/routes')
           .done(function(data) {
                $scope.marketarea.origin_gtfs = gtfsID;
                $scope.routes = {};
                $scope.marketarea.routes = [];

                data.forEach(function(route) {

                    $('#routes-select')
                        .append($('<option>', {
                            value : route.route_id,
                            text  : route.route_short_name
                        })
                    )
                    $scope.routes[route.route_id] = route.route_short_name;
                });

                $('#add-route-btn').on('click',function(){
                    $('#new-market-error-div').hide();
                    console.log('rotue added');

                    if($scope.marketarea.routes.indexOf($('#routes-select').val()) === -1){
                        newmamap.getRouteData($('#gtfs-select').val(), $('#routes-select').val(),function(tracts,center){
                            console.log('route returned');
                            $scope.marketarea.zones = tracts;
                            $scope.marketarea.center = center;
                            $scope.$apply();
                        });

                        $scope.marketarea.routes.push($('#routes-select').val());
                        $scope.$apply();
                    }

                })
            })
           .fail(function(err) { console.log('/gtfs/'+gtfsID+'/routes error',err); })
        }
    });

    $scope.removeRoute = function(index,id){
        $scope.marketarea.routes.splice(index,1);
        newmamap.removeRoute(id,function(){
            $scope.marketarea.zones = tracts;
            $scope.marketarea.center = center;
            $scope.$apply();
        })
        //$scope.appl
    }

    $scope.createMarketarea = function(){
        io.socket.post('/marketarea',$scope.marketarea,function(data){
            console.log('Created!',data);
            window.location = '/marketarea/'+data.id;
        });
    }
}

(function() {
    var newmamap = {};

    var svg,
        width,
        height;

    var zoom,
        projection,
        path,
        paths;

    var tracts,
        activeTracts = {},
        tractsCollection = {
            type: "FeatureCollection",
            features: []
        };

    var marketAreaTracts = {
            type: "FeatureCollection",
            features: []
        },
        marketAreaTractsList = [];

    function zoomed() {
        projection.scale(zoom.scale())
            .translate(zoom.translate());

        paths.attr('d', path);
    }

    newmamap.init = function(svgID) {

        d3.json('/data/tracts.json', function(error, data) {
            tracts = data;

            data.features.forEach(function(d, i) {
                activeTracts[d.properties.geoid] = {index: i, count: 0};
            })
        })

        width = $('.tab-content').width()-15;
        height =  width;

        zoom = d3.behavior.zoom()
            .scale(1<<17)
            .translate([width/2, height/2])
            .scaleExtent([1<<12, 1<<20])
            .on("zoom", zoomed);

        projection = d3.geo.albers()
            .translate(zoom.translate())
            .scale(zoom.scale());

        path = d3.geo.path()
            .projection(projection);

        svg = d3.select(svgID)
            .attr('width', width)
            .attr('height', height)
            .call(zoom)
            .on("dragstart", function() {
                d3.event.sourceEvent.stopPropagation(); // silence other listeners
            });

        svg.append('rect')
            .attr('width', width)
            .attr('height', height)
            .attr('fill', '#fff')
    }

    newmamap.getRouteData = function(gtfsID, routeID,cb) {
        var route = '/marketarea/'+gtfsID+'/'+routeID+'/route_geo';

        d3.json(route, function(error, data) {
            // data = topojson.feature(data, data.objects.states);

            //console.log('get routes data',data);
            findIntersectingMarketAreas(data, routeID);

            draw(data, 'route-'+routeID, 'route');

            var b = d3.geo.bounds(marketAreaTracts);
            var center = [(b[0][0]+b[1][0])/2,(b[0][1]+b[1][1])/2];

            //console.log('get route collisions',marketAreaTractsList);

            cb(marketAreaTractsList,center);
        })
    }

    function findIntersectingMarketAreas(route, increment) {
        if (!tracts) {
            return console.log("tracts data not loaded!");
        }

        var routeBounds = path.bounds(route),
            collection = {
                type: "FeatureCollection",
                features: []
            };

        tracts.features.forEach(function(tract) {
            var tractBounds = path.bounds(tract);

            if (boundsCollision(routeBounds, tractBounds)) {
                activeTracts[tract.properties.geoid].count += increment;
            }
        })

        for (var key in activeTracts) {
            if (activeTracts[key].count > 0) {
                collection.features.push(tracts.features[activeTracts[key].index]);
            }
        }

        collection.features.forEach(function(feat){
            if(marketAreaTractsList.indexOf(feat.properties.geoid) === -1){
               marketAreaTractsList.push(feat.properties.geoid);
               marketAreaTracts.features.push(feat);
            }
        });

        zoomToBounds(collection);

        draw(collection, 'market-group', 'market');
    }

    function zoomToBounds(collection) {

        var bounds = path.bounds(collection),
            wdth = bounds[1][0] - bounds[0][0],
            hght = bounds[1][1] - bounds[0][1],

            k = Math.min(width/wdth, height/hght),
            scale = zoom.scale()*k*0.95;

        projection.scale(scale);
        zoom.scale(scale);

        var centroid = path.centroid(collection),
            translate = projection.translate();

        projection.translate([translate[0] - centroid[0] + width / 2,
                             translate[1] - centroid[1] + height / 2]);

        zoom.translate(projection.translate());
    }

    function boundsCollision(route, tract) {
        var routeRect = {left: route[0][0], top: route[0][1], width: route[1][0] - route[0][0], height: route[1][1] - route[0][1]};

        var tractRect = {left: tract[0][0], top: tract[0][1], width: tract[1][0] - tract[0][0], height: tract[1][1] - tract[0][1]};

        var xCollision =  ((routeRect.left <= tractRect.left) && (routeRect.left + routeRect.width > tractRect.left)) ||
                          ((routeRect.left > tractRect.left) && (routeRect.left < tractRect.left + tractRect.width));

        var yCollision = ((routeRect.top <= tractRect.top) && (routeRect.top + routeRect.height > tractRect.top)) ||
                         ((routeRect.top > tractRect.top) && (routeRect.top < tractRect.top + tractRect.height));

        return xCollision && yCollision;
    }

    function draw(data, groupID, type) {

        var group = svg.selectAll('#'+groupID)
            .data([data], function() { return groupID; });

        group.enter().append('g')
            .attr('id', groupID);

        group.exit().remove();

        var lines = group.selectAll('path')
            .data(data.features)

        lines.enter().append('path')

        lines.attr('class', type);

        lines.exit().remove();

        paths = svg.selectAll('path').attr('d', path);
    }

    newmamap.removeRoute = function(routeID, cb) {
        d3.selectAll('#route-'+routeID)
            .each(function(data) {
                findIntersectingMarketAreas(data, -1);
            })
            .remove();

        var b = d3.geo.bounds(marketAreaTracts);
        var center = [(b[0][0]+b[1][0])/2,(b[0][1]+b[1][1])/2];

        cb(marketAreaTractsList,center);
    }

    this.newmamap = newmamap;
})()


text:
package org.microg.gms.maps.vtm.bitmap;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.IOException;

public class AssetBitmapDescriptor extends AbstractBitmapDescriptor {
    private String assetName;

    public AssetBitmapDescriptor(String assetName) {
        this.assetName = assetName;
    }

    @Override
    protected Bitmap generateBitmap(Context context) {
        try {
            return BitmapFactory.decodeStream(context.getAssets().open(assetName));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}


text:
{% extends "bookmarkbook/note_list_base.html" %}

{% block content%}

<div id="content-main">
<div>
{% include "bookmarkbook/notes/linkagenotedisplay.html" %}
</div>
</div>
{% endblock %}


text:
'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var echartsLib = _interopDefault(require('echarts/lib/echarts'));
require('echarts/lib/component/tooltip');
require('echarts/lib/component/legend');
var constants = require('./constants');
var utilsLite = require('utils-lite');
var numerify = _interopDefault(require('numerify'));

var Loading = { render: function render() {
    var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "v-charts-component-loading" }, [_c('div', { staticClass: "loader" }, [_c('div', { staticClass: "loading-spinner" }, [_c('svg', { staticClass: "circular", attrs: { "viewBox": "25 25 50 50" } }, [_c('circle', { staticClass: "path", attrs: { "cx": "50", "cy": "50", "r": "20", "fill": "none" } })])])])]);
  }, staticRenderFns: []
};

var DataEmpty = { render: function render() {
    var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "v-charts-data-empty" }, [_vm._v(" 暂无数据 ")]);
  }, staticRenderFns: []
};

var _extends = Object.assign || function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i];

    for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key];
      }
    }
  }

  return target;
};

var STATIC_PROPS = ['initOptions', 'loading', 'dataEmpty', 'judgeWidth', 'widthChangeDelay'];

var core = {
  render: function render(h) {
    return h('div', {
      class: [utilsLite.camelToKebab(this.$options.name || this.$options._componentTag)],
      style: this.canvasStyle
    }, [h('div', {
      style: this.canvasStyle,
      ref: 'canvas'
    }), h(DataEmpty, {
      style: { display: this.dataEmpty ? '' : 'none' }
    }), h(Loading, {
      style: { display: this.loading ? '' : 'none' }
    }), this.$slots.default]);
  },

  props: {
    data: { type: [Object, Array], default: function _default() {
        return {};
      }
    },
    settings: { type: Object, default: function _default() {
        return {};
      }
    },
    width: { type: String, default: 'auto' },
    height: { type: String, default: '400px' },
    beforeConfig: { type: Function },
    afterConfig: { type: Function },
    afterSetOption: { type: Function },
    afterSetOptionOnce: { type: Function },
    events: { type: Object },
    grid: { type: [Object, Array] },
    colors: { type: Array },
    tooltipVisible: { type: Boolean, default: true },
    legendVisible: { type: Boolean, default: true },
    legendPosition: { type: String },
    markLine: { type: Object },
    markArea: { type: Object },
    markPoint: { type: Object },
    visualMap: { type: [Object, Array] },
    dataZoom: { type: [Object, Array] },
    toolbox: { type: [Object, Array] },
    initOptions: { type: Object, default: function _default() {
        return {};
      }
    },
    title: [Object, Array],
    legend: [Object, Array],
    xAxis: [Object, Array],
    yAxis: [Object, Array],
    radar: Object,
    tooltip: Object,
    axisPointer: [Object, Array],
    brush: [Object, Array],
    geo: [Object, Array],
    timeline: [Object, Array],
    graphic: [Object, Array],
    series: [Object, Array],
    backgroundColor: [Object, String],
    textStyle: [Object, Array],
    animation: Object,
    theme: Object,
    themeName: String,
    loading: Boolean,
    dataEmpty: Boolean,
    extend: Object,
    judgeWidth: { type: Boolean, default: false },
    widthChangeDelay: { type: Number, default: 300 },
    tooltipFormatter: { type: Function },
    resizeable: { type: Boolean, default: true },
    resizeDelay: { type: Number, default: 200 },
    changeDelay: { type: Number, default: 0 },
    setOptionOpts: { type: [Boolean, Object], default: true }
  },

  watch: {
    data: {
      deep: true,
      handler: function handler(v) {
        if (v) {
          this.changeHandler();
        }
      }
    },

    settings: {
      deep: true,
      handler: function handler(v) {
        if (v.type && this.chartLib) this.chartHandler = this.chartLib[v.type];
        this.changeHandler();
      }
    },

    width: 'nextTickResize',
    height: 'nextTickResize',

    events: {
      deep: true,
      handler: function handler() {
        this.createEventProxy();
      }
    },

    theme: {
      deep: true,
      handler: function handler(v) {
        this.themeChange(v);
      }
    },

    themeName: function themeName(v) {
      this.themeChange(v);
    }
  },

  computed: {
    canvasStyle: function canvasStyle() {
      return {
        width: this.width,
        height: this.height,
        position: 'relative'
      };
    },
    chartColor: function chartColor() {
      return this.colors || this.theme && this.theme.color || constants.DEFAULT_COLORS;
    }
  },

  methods: {
    dataHandler: function dataHandler() {
      if (!this.chartHandler) return;
      var data = this.data;
      var _data = data,
          _data$columns = _data.columns,
          columns = _data$columns === undefined ? [] : _data$columns,
          _data$rows = _data.rows,
          rows = _data$rows === undefined ? [] : _data$rows;

      var extra = {
        tooltipVisible: this.tooltipVisible,
        legendVisible: this.legendVisible,
        echarts: this.echarts,
        color: this.chartColor,
        tooltipFormatter: this.tooltipFormatter,
        _once: this._once
      };
      if (this.beforeConfig) data = this.beforeConfig(data);

      var options = this.chartHandler(columns, rows, this.settings, extra);
      if (options) {
        if (typeof options.then === 'function') {
          options.then(this.optionsHandler);
        } else {
          this.optionsHandler(options);
        }
      }
    },
    nextTickResize: function nextTickResize() {
      var _this = this;

      this.$nextTick(function (_) {
        _this.echarts.resize();
      });
    },
    resize: function resize() {
      this.echarts.resize();
    },
    optionsHandler: function optionsHandler(options) {
      var _this2 = this;

      if (this.legendPosition && options.legend) {
        options.legend[this.legendPosition] = 10;
        if (~['left', 'right'].indexOf(this.legendPosition)) {
          options.legend.top = 'middle';
          options.legend.orient = 'vertical';
        }
      }
      if (!this.themeName) options.color = this.chartColor;
      var echartsSettings = ['grid', 'dataZoom', 'visualMap', 'toolbox', 'title', 'legend', 'xAxis', 'yAxis', 'radar', 'tooltip', 'axisPointer', 'brush', 'geo', 'timeline', 'graphic', 'series', 'backgroundColor', 'textStyle'];
      echartsSettings.forEach(function (setting) {
        if (_this2[setting]) options[setting] = _this2[setting];
      });
      if (this.animation) {
        Object.keys(this.animation).forEach(function (key) {
          options[key] = _this2.animation[key];
        });
      }
      if (this.markArea || this.markLine || this.markPoint) {
        var marks = {
          markArea: this.markArea,
          markLine: this.markLine,
          markPoint: this.markPoint
        };
        var series = options.series;
        if (utilsLite.getType(series) === '[object Array]') {
          series.forEach(function (item) {
            _this2.addMark(item, marks);
          });
        } else if (utilsLite.getType(series) === '[object Object]') {
          this.addMark(series, marks);
        }
      }

      // extend sub attribute
      if (this.extend) {
        Object.keys(this.extend).forEach(function (attr) {
          var value = _this2.extend[attr];
          if (~attr.indexOf('.')) {
            // eg: a.b.c a.1.b
            utilsLite.set(options, attr, value);
          } else if (typeof value === 'function') {
            // get callback value
            options[attr] = value(options[attr]);
          } else {
            // mixin extend value
            if (utilsLite.isArray(options[attr]) && utilsLite.isObject(options[attr][0])) {
              // eg: [{ xx: 1 }, { xx: 2 }]
              options[attr].forEach(function (option, index) {
                options[attr][index] = _extends({}, option, value);
              });
            } else if (utilsLite.isObject(options[attr])) {
              // eg: { xx: 1, yy: 2 }
              options[attr] = _extends({}, options[attr], value);
            } else {
              options[attr] = value;
            }
          }
        });
      }

      if (this.afterConfig) options = this.afterConfig(options);
      var setOptionOpts = this.setOptionOpts;
      if (this.settings.bmap || this.settings.amap) setOptionOpts = false;
      this.echarts.setOption(options, setOptionOpts);
      this.$emit('ready', this.echarts);
      if (!this._once['ready-once']) {
        this._once['ready-once'] = true;
        this.$emit('ready-once', this.echarts);
      }
      if (this.judgeWidth) this.judgeWidthHandler(options);
      if (this.afterSetOption) this.afterSetOption(this.echarts);
      if (this.afterSetOptionOnce && !this._once['afterSetOptionOnce']) {
        this._once['afterSetOptionOnce'] = true;
        this.afterSetOptionOnce(this.echarts);
      }
    },
    judgeWidthHandler: function judgeWidthHandler(options) {
      var _this3 = this;

      var echarts = this.echarts,
          widthChangeDelay = this.widthChangeDelay;

      if (this.$el.clientWidth) {
        echarts && echarts.resize();
      } else {
        this.$nextTick(function (_) {
          if (_this3.$el.clientWidth) {
            echarts && echarts.resize();
          } else {
            setTimeout(function (_) {
              echarts && echarts.resize();
              if (!_this3.$el.clientWidth) {
                console.warn(' Can\'t get dom width or height ');
              }
            }, widthChangeDelay);
          }
        });
      }
    },
    addMark: function addMark(seriesItem, marks) {
      Object.keys(marks).forEach(function (key) {
        if (marks[key]) {
          seriesItem[key] = marks[key];
        }
      });
    },
    init: function init() {
      if (this.echarts) return;
      var themeName = this.themeName || this.theme || constants.DEFAULT_THEME;
      this.echarts = echartsLib.init(this.$refs.canvas, themeName, this.initOptions);
      if (this.data) this.changeHandler();
      this.createEventProxy();
      if (this.resizeable) window.addEventListener('resize', this.resizeHandler);
    },
    addWatchToProps: function addWatchToProps() {
      var _this4 = this;

      var watchedVariable = this._watchers.map(function (watcher) {
        return watcher.expression;
      });
      Object.keys(this.$props).forEach(function (prop) {
        if (!~watchedVariable.indexOf(prop) && !~STATIC_PROPS.indexOf(prop)) {
          var opts = {};
          if (~['[object Object]', '[object Array]'].indexOf(utilsLite.getType(_this4.$props[prop]))) {
            opts.deep = true;
          }
          _this4.$watch(prop, function () {
            _this4.changeHandler();
          }, opts);
        }
      });
    },
    createEventProxy: function createEventProxy() {
      var _this5 = this;

      // 只要用户使用 on 方法绑定的事件都做一层代理,
      // 是否真正执行相应的事件方法取决于该方法是否仍然存在 events 中
      // 实现 events 的动态响应
      var self = this;
      var keys = Object.keys(this.events || {});
      keys.length && keys.forEach(function (ev) {
        if (_this5.registeredEvents.indexOf(ev) === -1) {
          _this5.registeredEvents.push(ev);
          _this5.echarts.on(ev, function (ev) {
            return function () {
              if (ev in self.events) {
                for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
                  args[_key] = arguments[_key];
                }

                self.events[ev].apply(null, args);
              }
            };
          }(ev));
        }
      });
    },
    themeChange: function themeChange(theme) {
      this.clean();
      this.echarts = null;
      this.init();
    },
    clean: function clean() {
      if (this.resizeable) window.removeEventListener('resize', this.resizeHandler);
      this.echarts.dispose();
    }
  },

  created: function created() {
    var _this6 = this;

    this.echarts = null;
    this.registeredEvents = [];
    this._once = {};
    this.resizeHandler = utilsLite.debounce(function (_) {
      _this6.echarts && _this6.echarts.resize();
    }, this.resizeDelay);
    this.changeHandler = utilsLite.debounce(function (_) {
      _this6.dataHandler();
    }, this.changeDelay);
    this.addWatchToProps();
  },
  mounted: function mounted() {
    this.init();
  },
  beforeDestroy: function beforeDestroy() {
    this.clean();
  },

  _numerify: numerify
};

module.exports = core;


text:
import nock from 'nock';
import config from 'config';
import { Moment } from 'moment';
import qs from 'qs';

export const createGLADRADDGeostoreURLSubscriptionBody = (subscription: Record<string, any>, beginDate: Moment, endDate: Moment, bodyData: Record<string, any> = {}) => {
    const mapURLIntactForestQueryString = {
        lang: subscription.language,
        map: btoa(JSON.stringify({
            canBound: true,
            datasets: [
                {
                    dataset: 'bfd1d211-8106-4393-86c3-9e1ab2ee1b9b',
                    layers: [
                        '8e4a527d-1bcd-4a12-82b0-5a108ffec452'
                    ],
                    timelineParams: {
                        startDateAbsolute: beginDate.format('YYYY-MM-DD'),
                        endDateAbsolute: endDate.format('YYYY-MM-DD'),
                        startDate: beginDate.format('YYYY-MM-DD'),
                        endDate: endDate.format('YYYY-MM-DD'),
                        trimEndDate: endDate.format('YYYY-MM-DD')
                    }
                },
                {
                    dataset: 'intact-forest-landscapes',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'intact-forest-landscapes'
                    ]
                }
            ],
            basemap: {
                value: 'planet',
                color: '',
                name: 'latest',
                imageType: 'analytic'
            }
        })),
        mainMap: btoa(JSON.stringify({
            showAnalysis: true
        }))
    };
    const mapURLPrimaryForestQueryString = {
        lang: subscription.language,
        map: btoa(JSON.stringify({
            canBound: true,
            datasets: [
                {
                    dataset: 'bfd1d211-8106-4393-86c3-9e1ab2ee1b9b',
                    layers: [
                        '8e4a527d-1bcd-4a12-82b0-5a108ffec452'
                    ],
                    timelineParams: {
                        startDateAbsolute: beginDate.format('YYYY-MM-DD'),
                        endDateAbsolute: endDate.format('YYYY-MM-DD'),
                        startDate: beginDate.format('YYYY-MM-DD'),
                        endDate: endDate.format('YYYY-MM-DD'),
                        trimEndDate: endDate.format('YYYY-MM-DD')
                    }
                },
                {
                    dataset: 'primary-forests',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'primary-forests-2001'
                    ]
                }
            ],
            basemap: {
                value: 'planet',
                color: '',
                name: 'latest',
                imageType: 'analytic'
            }
        })),
        mainMap: btoa(JSON.stringify({
            showAnalysis: true
        }))
    };
    const mapURLPeatQueryString = {
        lang: subscription.language,
        map: btoa(JSON.stringify({
            canBound: true,
            datasets: [
                {
                    dataset: 'bfd1d211-8106-4393-86c3-9e1ab2ee1b9b',
                    layers: [
                        '8e4a527d-1bcd-4a12-82b0-5a108ffec452'
                    ],
                    timelineParams: {
                        startDateAbsolute: beginDate.format('YYYY-MM-DD'),
                        endDateAbsolute: endDate.format('YYYY-MM-DD'),
                        startDate: beginDate.format('YYYY-MM-DD'),
                        endDate: endDate.format('YYYY-MM-DD'),
                        trimEndDate: endDate.format('YYYY-MM-DD')
                    }
                },
                {
                    dataset: 'malaysia-peat-lands',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'malaysia-peat-lands-2004'
                    ],
                    iso: 'MYS'
                },
                {
                    dataset: 'indonesia-forest-moratorium',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'indonesia-forest-moratorium'
                    ],
                    iso: 'IDN'
                },
                {
                    dataset: 'indonesia-peat-lands',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'indonesia-peat-lands-2012'
                    ],
                    iso: 'IDN'
                }
            ],
            basemap: {
                value: 'planet',
                color: '',
                name: 'latest',
                imageType: 'analytic'
            }
        })),
        mainMap: btoa(JSON.stringify({
            showAnalysis: true
        }))
    };
    const mapURLWDPAQueryString = {
        lang: subscription.language,
        map: btoa(JSON.stringify({
            canBound: true,
            datasets: [
                {
                    dataset: 'bfd1d211-8106-4393-86c3-9e1ab2ee1b9b',
                    layers: [
                        '8e4a527d-1bcd-4a12-82b0-5a108ffec452'
                    ],
                    timelineParams: {
                        startDateAbsolute: beginDate.format('YYYY-MM-DD'),
                        endDateAbsolute: endDate.format('YYYY-MM-DD'),
                        startDate: beginDate.format('YYYY-MM-DD'),
                        endDate: endDate.format('YYYY-MM-DD'),
                        trimEndDate: endDate.format('YYYY-MM-DD')
                    }
                },
                {
                    dataset: 'wdpa-protected-areas',
                    opacity: 1,
                    visibility: true,
                    layers: [
                        'wdpa-protected-areas'
                    ]
                }
            ],
            basemap: {
                value: 'planet',
                color: '',
                name: 'latest',
                imageType: 'analytic'
            }
        })),
        mainMap: btoa(JSON.stringify({
            showAnalysis: true
        }))
    };

    const alertLinkQueryString = {
        lang: subscription.language,
        map: btoa(JSON.stringify({
            canBound: true,
            datasets: [
                {
                    dataset: 'bfd1d211-8106-4393-86c3-9e1ab2ee1b9b',
                    layers: [
                        '8e4a527d-1bcd-4a12-82b0-5a108ffec452'
                    ],
                    timelineParams: {
                        startDateAbsolute: beginDate.format('YYYY-MM-DD'),
                        endDateAbsolute: endDate.format('YYYY-MM-DD'),
                        startDate: beginDate.format('YYYY-MM-DD'),
                        endDate: endDate.format('YYYY-MM-DD'),
                        trimEndDate: endDate.format('YYYY-MM-DD')
                    }
                },
                {
                    dataset: '0b0208b6-b424-4b57-984f-caddfa25ba22',
                    layers: [
                        'b45350e3-5a76-44cd-b0a9-5038a0d8bfae',
                        'cc35432d-38d7-4a03-872e-3a71a2f555fc'
                    ]
                }
            ],
            basemap: {
                value: 'planet',
                color: '',
                name: 'latest',
                imageType: 'analytic'
            }
        })),
        mainMap: btoa(JSON.stringify({
            showAnalysis: true
        }))
    };

    return {
        value: 400,
        month: beginDate.format('MMMM'),
        year: beginDate.format('YYYY'),
        week_of: beginDate.format('DD MMM'),
        week_start: beginDate.format('DD/MM/YYYY'),
        week_end: endDate.format('DD/MM/YYYY'),
        glad_count: 400,
        alert_count: 400,
        priority_areas: {
            intact_forest: 100,
            primary_forest: 100,
            peat: 100,
            protected_areas: 100,
            plantations: 0,
            other: 0
        },
        formatted_alert_count: '400',
        formatted_priority_areas: {
            intact_forest: '100',
            primary_forest: '100',
            peat: '100',
            protected_areas: '100',
            plantations: '0',
            other: '0'
        },
        alert_link: `${config.get('gfw.flagshipUrl')}/map/aoi/${subscription.id}?${qs.stringify(alertLinkQueryString)}`,
        dashboard_link: `${config.get('gfw.flagshipUrl')}/dashboards/aoi/${subscription.id}?lang=${subscription.language}&category=forest-change&utm_source=hyperlink&utm_medium=email&utm_campaign=ForestChangeAlert`,
        map_url_intact_forest: `${config.get('gfw.flagshipUrl')}/map/aoi/${subscription.id}?${qs.stringify(mapURLIntactForestQueryString)}`,
        map_url_primary_forest: `${config.get('gfw.flagshipUrl')}/map/aoi/${subscription.id}?${qs.stringify(mapURLPrimaryForestQueryString)}`,
        map_url_peat: `${config.get('gfw.flagshipUrl')}/map/aoi/${subscription.id}?${qs.stringify(mapURLPeatQueryString)}`,
        map_url_wdpa: `${config.get('gfw.flagshipUrl')}/map/aoi/${subscription.id}?${qs.stringify(mapURLWDPAQueryString)}`,
        area_ha_sum: "40",
        intact_forest_ha_sum: "10",
        primary_forest_ha_sum: "10",
        peat_ha_sum: "10",
        wdpa_ha_sum: "10",
        downloadUrls: {
            csv: `${config.get('dataApi.url')}/dataset/gfw_integrated_alerts/latest/download/csv?sql=SELECT latitude, longitude, wur_radd_alerts__date, wur_radd_alerts__confidence FROM data WHERE wur_radd_alerts__date >= '${beginDate.format('YYYY-MM-DD')}' AND wur_radd_alerts__date <= '${endDate.format('YYYY-MM-DD')}'&geostore_origin=rw&geostore_id=423e5dfb0448e692f97b590c61f45f22`,
            json: `${config.get('dataApi.url')}/dataset/gfw_integrated_alerts/latest/download/json?sql=SELECT latitude, longitude, wur_radd_alerts__date, wur_radd_alerts__confidence FROM data WHERE wur_radd_alerts__date >= '${beginDate.format('YYYY-MM-DD')}' AND wur_radd_alerts__date <= '${endDate.format('YYYY-MM-DD')}'&geostore_origin=rw&geostore_id=423e5dfb0448e692f97b590c61f45f22`
        },
        glad_alert_type: "RADD deforestation alerts",
        layerSlug: "glad-radd",
        alert_name: subscription.name,
        selected_area: 'Custom Area',
        unsubscribe_url: `${config.get('apiGateway.externalUrl')}/v1/subscriptions/${subscription.id}/unsubscribe?redirect=true&lang=${subscription.language}`,
        subscriptions_url: `${config.get('gfw.flagshipUrl')}/my-gfw?lang=${subscription.language}`,
        help_center_url_manage_areas: `${config.get('gfw.flagshipUrl')}/help/map/guides/manage-saved-areas?lang=${subscription.language}`,
        help_center_url_save_more_areas: `${config.get('gfw.flagshipUrl')}/help/map/guides/save-area-subscribe-forest-change-notifications?lang=${subscription.language}`,
        help_center_url_investigate_alerts: `${config.get('gfw.flagshipUrl')}/help/map/guides/investigate-forest-change-satellite-imagery?lang=${subscription.language}`,
        alert_date_begin: beginDate.format('YYYY-MM-DD'),
        alert_date_end: endDate.format('YYYY-MM-DD'),
        ...bodyData
    };
};

export const mockGLADRADDISOQuery = () =>
    nock(config.get('dataApi.url'))
        .get('/dataset/gadm__integrated_alerts__iso_daily_alerts/latest/query')
        .query((data) => data.sql && data.sql.includes('iso = \'BRA\''))
        .matchHeader('x-api-key', config.get('dataApi.apiKey'))
        .matchHeader('origin', config.get('dataApi.origin'))
        .reply(200, {
            data: [
                {
                    wdpa_protected_area__iucn_cat: 'Category 1',
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: true,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: true,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: true,
                    alert__count: 100,
                    alert_area__ha: 10,
                }
            ],
            status: 'success'
        });

export const mockGLADRADDAdm1Query = () =>
    nock(config.get('dataApi.url'))
        .get('/dataset/gadm__integrated_alerts__adm1_daily_alerts/latest/query')
        .query((data) => data.sql && data.sql.includes('iso = \'BRA\'') && data.sql.includes('adm1 = \'1\''))
        .matchHeader('x-api-key', config.get('dataApi.apiKey'))
        .matchHeader('origin', config.get('dataApi.origin'))
        .reply(200, {
            data: [
                {
                    wdpa_protected_area__iucn_cat: 'Category 1',
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: true,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: true,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: true,
                    alert__count: 100,
                    alert_area__ha: 10,
                }
            ],
            status: 'success'
        });

export const mockGLADRADDAdm2Query = () =>
    nock(config.get('dataApi.url'))
        .get('/dataset/gadm__integrated_alerts__adm2_daily_alerts/latest/query')
        .query((data) => data.sql && data.sql.includes('iso = \'BRA\'') && data.sql.includes('adm1 = \'1\'') && data.sql.includes('adm2 = \'2\''))
        .matchHeader('x-api-key', config.get('dataApi.apiKey'))
        .matchHeader('origin', config.get('dataApi.origin'))
        .reply(200, {
            data: [
                {
                    wdpa_protected_area__iucn_cat: 'Category 1',
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: true,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: true,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: true,
                    alert__count: 100,
                    alert_area__ha: 10,
                }
            ],
            status: 'success'
        });

export const mockGLADRADDWDPAQuery = () =>
    nock(config.get('dataApi.url'))
        .get('/dataset/wdpa_protected_areas__integrated_alerts__daily_alerts/latest/query')
        .query((data) => data.sql && data.sql.includes('wdpa_protected_area__id = \'1\''))
        .matchHeader('x-api-key', config.get('dataApi.apiKey'))
        .matchHeader('origin', config.get('dataApi.origin'))
        .reply(200, {
            data: [
                {
                    wdpa_protected_area__iucn_cat: 'Category 1',
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: true,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: true,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: true,
                    alert__count: 100,
                    alert_area__ha: 10,
                }
            ],
            status: 'success'
        });

export const mockGLADRADDGeostoreQuery = (times: number = 1) =>
    nock(config.get('dataApi.url'))
        .get('/dataset/geostore__integrated_alerts__daily_alerts/latest/query')
        .query((data) => data.sql && data.sql.includes('geostore__id = \'423e5dfb0448e692f97b590c61f45f22\''))
        .matchHeader('x-api-key', config.get('dataApi.apiKey'))
        .matchHeader('origin', config.get('dataApi.origin'))
        .times(times)
        .reply(200, {
            data: [
                {
                    wdpa_protected_area__iucn_cat: 'Category 1',
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: true,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: true,
                    is__ifl_intact_forest_landscape_2016: false,
                    alert__count: 100,
                    alert_area__ha: 10,
                },
                {
                    wdpa_protected_area__iucn_cat: null,
                    is__umd_regional_primary_forest_2001: false,
                    is__peatland: false,
                    is__ifl_intact_forest_landscape_2016: true,
                    alert__count: 100,
                    alert_area__ha: 10,
                }
            ],
            status: 'success'
        });


text:
package org.entirej.applicationframework.tmt.renderers.item;

import java.io.Serializable;

import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.rap.rwt.template.Cell;
import org.eclipse.rap.rwt.template.Template;
import org.eclipse.rap.rwt.template.TextCell;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.entirej.applicationframework.tmt.application.EJTMTImageRetriever;
import org.entirej.applicationframework.tmt.renderer.interfaces.EJTMTAppItemRenderer;
import org.entirej.applicationframework.tmt.renderers.item.definition.interfaces.EJTMTButtonItemRendererDefinitionProperties;
import org.entirej.applicationframework.tmt.table.EJTMTAbstractTableSorter;
import org.entirej.applicationframework.tmt.utils.EJTMTItemRendererVisualContext;
import org.entirej.applicationframework.tmt.utils.EJTMTVisualAttributeUtils;
import org.entirej.framework.core.data.EJDataRecord;
import org.entirej.framework.core.interfaces.EJScreenItemController;
import org.entirej.framework.core.properties.EJCoreVisualAttributeProperties;
import org.entirej.framework.core.properties.definitions.interfaces.EJFrameworkExtensionProperties;
import org.entirej.framework.core.properties.interfaces.EJItemProperties;
import org.entirej.framework.core.properties.interfaces.EJScreenItemProperties;

public class EJTMTButtonItemRenderer implements EJTMTAppItemRenderer, FocusListener, Serializable
{
    protected EJFrameworkExtensionProperties  _rendererProps;
    protected EJScreenItemController          _item;
    protected EJItemProperties                _itemProperties;
    protected EJScreenItemProperties          _screenItemProperties;
    private String                            _registeredItemName;
    protected boolean                         _activeEvent = true;
    protected Button                          _button;
    private boolean                           _isValid     = true;
    protected EJTMTItemRendererVisualContext  _visualContext;

    private EJCoreVisualAttributeProperties   _visualAttributeProperties;
    protected EJCoreVisualAttributeProperties _initialVAProperties;

    @Override
    public void refreshItemRendererProperty(String propertyName)
    {
    }

    @Override
    public void validationErrorOccurred(boolean error)
    {

    }

    @Override
    public void refreshItemRenderer()
    {

    }

    @Override
    public boolean useFontDimensions()
    {
        return false;
    }

    protected boolean controlState(Control control)
    {
        return control != null && !control.isDisposed();

    }

    @Override
    public void initialise(EJScreenItemController item, EJScreenItemProperties screenItemProperties)
    {
        _item = item;
        _itemProperties = _item.getReferencedItemProperties();
        _screenItemProperties = item.getProperties();
        _rendererProps = _itemProperties.getItemRendererProperties();
    }

    @Override
    public void setLabel(String label)
    {
        if (controlState(_button))
        {
            _button.setText(label == null ? "" : label);
        }
    }

    @Override
    public void setHint(String hint)
    {
        if (controlState(_button))
        {
            _button.setToolTipText(hint == null ? "" : hint);
        }
    }

    @Override
    public EJScreenItemController getItem()
    {
        return _item;
    }

    public EJItemProperties getItemProperties()
    {
        return _itemProperties;
    }

    @Override
    public Control getGuiComponent()
    {
        return _button;
    }

    @Override
    public Label getGuiComponentLabel()
    {
        return null;
    }

    @Override
    public void clearValue()
    {
    }

    @Override
    public String getRegisteredItemName()
    {
        return _registeredItemName;
    }

    @Override
    public Object getValue()
    {

        return null;

    }

    @Override
    public boolean isEditAllowed()
    {
        if (controlState(_button))
        {
            return _button.isEnabled();
        }

        return false;
    }

    @Override
    public boolean isVisible()
    {

        if (controlState(_button))
        {
            return _button.isVisible();
        }

        return false;
    }

    @Override
    public boolean isMandatory()
    {
        return false;
    }

    @Override
    public boolean isValid()
    {
        if (_isValid)
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    @Override
    public void gainFocus()
    {
        if (controlState(_button))
        {
            _button.forceFocus();
        }
    }

    @Override
    public void setEditAllowed(boolean editAllowed)
    {
        if (controlState(_button))
        {
            _button.setEnabled(editAllowed);
        }
    }

    @Override
    public void setInitialValue(Object value)
    {
    }

    @Override
    public void setRegisteredItemName(String name)
    {
        _registeredItemName = name;
    }

    @Override
    public void setValue(Object value)
    {

    }

    @Override
    public void setVisible(boolean visible)
    {
        if (controlState(_button))
        {
            _button.setVisible(visible);
        }
    }

    @Override
    public void setMandatory(boolean mandatory)
    {
    }

    @Override
    public void enableLovActivation(boolean activate)
    {
    }

    @Override
    public boolean valueEqualsTo(Object value)
    {
        return false;
    }

    @Override
    public void setVisualAttribute(EJCoreVisualAttributeProperties visualAttributeProperties)
    {
        _visualAttributeProperties = visualAttributeProperties != null ? visualAttributeProperties : _initialVAProperties;
        if (!controlState(_button))
        {
            return;
        }
        refreshBackground();
        refreshForeground();
        refreshFont();
    }

    @Override
    public EJCoreVisualAttributeProperties getVisualAttributeProperties()
    {
        return _visualAttributeProperties;
    }

    private void refreshBackground()
    {
        Color background = EJTMTVisualAttributeUtils.INSTANCE.getBackground(_visualAttributeProperties);
        if (controlState(_button))
        {
            _button.setBackground(background != null ? background : _visualContext.getBackgroundColor());
        }
    }

    private void refreshForeground()
    {
        Color foreground = EJTMTVisualAttributeUtils.INSTANCE.getForeground(_visualAttributeProperties);
        if (controlState(_button))
        {
            _button.setForeground(foreground != null ? foreground : _visualContext.getForegroundColor());
        }
    }

    private void refreshFont()
    {
        if (controlState(_button))
        {
            _button.setFont(EJTMTVisualAttributeUtils.INSTANCE.getFont(_visualAttributeProperties, _visualContext.getItemFont()));
        }
    }

    @Override
    public String toString()
    {
        StringBuffer buffer = new StringBuffer();
        buffer.append("ButtonItem:\n");
        buffer.append("  RegisteredItemName: ");
        buffer.append(_registeredItemName);
        buffer.append("\n");
        buffer.append("  Button: ");
        buffer.append(_button);
        buffer.append("  Label: ");
        buffer.append("null");

        return buffer.toString();
    }

    @Override
    public void focusGained(FocusEvent event)
    {
        _item.itemFocusGained();
        if (controlState(_button))
        {
            _button.forceFocus();
        }
    }

    @Override
    public void focusLost(FocusEvent event)
    {
        _item.itemFocusLost();
    }

    @Override
    public void createComponent(Composite composite)
    {

        String pictureName = _itemProperties.getItemRendererProperties().getStringProperty(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_PICTURE);
        String alignmentProperty = _rendererProps.getStringProperty(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_ALIGNMENT);
        if (alignmentProperty == null)
        {
            alignmentProperty = _rendererProps.getStringProperty("ALLIGNMENT");
        }

        String hint = _screenItemProperties.getHint();
        String label = _screenItemProperties.getLabel();
        int style = SWT.PUSH;
        style = getComponentStyle(alignmentProperty, style);

        _button = newButton(composite, style);

        setHint(hint);
        setLabel(label);

        if (pictureName != null && pictureName.trim().length() > 0)
        {
            _button.setImage(EJTMTImageRetriever.get(pictureName));
        }

        _button.setData(_item.getReferencedItemProperties().getName());
        _button.addFocusListener(this);
        _button.addSelectionListener(new SelectionAdapter()
        {
            @Override
            public void widgetSelected(SelectionEvent e)
            {
                if (_activeEvent)
                {
                    _item.executeActionCommand();
                }
            }
        });

        _visualContext = new EJTMTItemRendererVisualContext(_button.getBackground(), _button.getForeground(), _button.getFont());
    }

    protected int getComponentStyle(String alignmentProperty, int style)
    {
        if (alignmentProperty != null && alignmentProperty.trim().length() > 0)
        {
            if (alignmentProperty.equals(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_ALIGNMENT_LEFT))
            {
                style = style | SWT.LEFT;
            }
            else if (alignmentProperty.equals(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_ALIGNMENT_RIGHT))
            {
                style = style | SWT.RIGHT;
            }
            else if (alignmentProperty.equals(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_ALIGNMENT_CENTER))
            {
                style = style | SWT.CENTER;
            }
        }
        return style;
    }

    @Override
    public void createLable(Composite composite)
    {

    }

    protected Button newButton(Composite composite, int style)
    {
        boolean hideBorder = _itemProperties.getItemRendererProperties().getBooleanProperty(EJTMTButtonItemRendererDefinitionProperties.PROPERTY_HIDE_BORDER,
                false);
        if (hideBorder)
        {
            style = style | SWT.FLAT;
        }

        return new Button(composite, style);
    }

    @Override
    public ColumnLabelProvider createColumnLabelProvider(final EJScreenItemProperties item, EJScreenItemController controller)
    {
        return new ColumnLabelProvider()
        {

            @Override
            public Color getBackground(Object element)
            {
                EJCoreVisualAttributeProperties properties = getAttributes(item, element);
                if (properties != null)
                {
                    Color background = EJTMTVisualAttributeUtils.INSTANCE.getBackground(properties);
                    if (background != null)
                    {
                        return background;
                    }
                }
                return super.getBackground(element);
            }

            @Override
            public Color getForeground(Object element)
            {
                EJCoreVisualAttributeProperties properties = getAttributes(item, element);
                if (properties != null)
                {
                    Color foreground = EJTMTVisualAttributeUtils.INSTANCE.getForeground(properties);
                    if (foreground != null)
                    {
                        return foreground;
                    }
                }
                return super.getForeground(element);
            }

            private EJCoreVisualAttributeProperties getAttributes(final EJScreenItemProperties item, Object element)
            {
                EJCoreVisualAttributeProperties properties = null;
                if (element instanceof EJDataRecord)
                {
                    EJDataRecord record = (EJDataRecord) element;
                    properties = record.getItem(item.getReferencedItemName()).getVisualAttribute();
                }
                if (properties == null)
                {
                    properties = _visualAttributeProperties;
                }
                return properties;
            }

            @Override
            public Font getFont(Object element)
            {
                EJCoreVisualAttributeProperties properties = getAttributes(item, element);
                if (properties != null)
                {
                    return EJTMTVisualAttributeUtils.INSTANCE.getFont(properties, super.getFont(element));

                }
                return super.getFont(element);
            }

            @Override
            public String getText(Object element)
            {
                return _screenItemProperties.getLabel();
            }

        };
    }

    @Override
    public EJTMTAbstractTableSorter getColumnSorter(EJScreenItemProperties item, EJScreenItemController controller)
    {
        return null;
    }

    @Override
    public void setInitialVisualAttribute(EJCoreVisualAttributeProperties va)
    {
        this._initialVAProperties = va;
        setVisualAttribute(va);
    }

    @Override
    public boolean isReadOnly()
    {
        return true;
    }

    @Override
    public Cell<? extends Cell<?>> createColumnCell(EJScreenItemProperties item, EJScreenItemController controller, Template template)
    {
        TextCell textCell = new TextCell(template);
        textCell.setText(_screenItemProperties.getLabel());
        return textCell;
    }
}


text:
Spring boot中文官方文档 https://qbgbook.gitbooks.io/spring-boot-reference-guide-zh

1. Business requirement
参考: http://www.qcloud.com/product/nlp.html  在线分析演示
* How to save login user info in session ?
* One simple CRUD function need controller,service, domain, repository and jsp file...

2. UI with Bootstrap


text:
        Create a playlist
        <input type="text" maxlength="40" />

Add music to your playlists here


text:
package li.vin.net;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;
import rx.Observable;
import rx.schedulers.Schedulers;

public final class VinliApp {
  private final Devices mDevices;
  private final Diagnostics mDiagnostics;
  private final Rules mRules;
  private final Events mEvents;
  private final Locations mLocations;
  private final Snapshots mSnapshots;
  private final Vehicles mVehicles;
  private final Subscriptions mSubscriptions;
  private final Users mUsers;
  private final Trips mTrips;
  private final Dummies mDummies;
  private final Distances mDistances;
  private final Messages mMessages;
  private final Collisions mCollisions;
  private final ReportCards mReportCards;
  private final Notifications mNotifications;

  private final Gson mGson;

  private final String mAccessToken;

  private OkHttpClient client;

  public GsonBuilder gsonBuilder() {
    final GsonBuilder gsonB = new GsonBuilder();

    Device.registerGson(gsonB);
    Rule.registerGson(gsonB);
    Event.registerGson(gsonB);
    Subscription.registerGson(gsonB);
    Vehicle.registerGson(gsonB);
    Message.registerGson(gsonB);
    Page.registerGson(gsonB);
    TimeSeries.registerGson(gsonB);
    ObjectRef.registerGson(gsonB);
    Location.registerGson(gsonB);
    Coordinate.registerGson(gsonB);
    Snapshot.registerGson(gsonB);
    Notification.registerGson(gsonB);
    User.registerGson(gsonB);
    Trip.registerGson(gsonB);
    DistanceList.registerGson(gsonB);
    Odometer.registerGson(gsonB);
    OdometerTrigger.registerGson(gsonB);
    Dtc.registerGson(gsonB);
    StreamMessage.ParametricFilter.registerGson(gsonB);
    StreamMessage.GeometryFilter.registerGson(gsonB);
    Message.registerGson(gsonB);
    Collision.registerGson(gsonB);
    ReportCard.registerGson(gsonB);
    BatteryStatus.registerGson(gsonB);
    Dummy.registerGson(gsonB);

    return gsonB;
  }

  /*package*/ Observable<? extends Page<? extends VinliItem>> pagingPageObservable(
      Class itemClz, String link) {
    if (Device.class.equals(itemClz)) {
      return mDevices.devicesForUrl(link.replaceFirst(VinliEndpoint.PLATFORM.getUrl(), ""));
    }
    if (Dtc.Code.class.equals(itemClz)) {
      return mDiagnostics.rawCodesForUrl(link.replaceFirst(VinliEndpoint.DIAGNOSTICS.getUrl(), ""));
    }
    if (Rule.class.equals(itemClz)) {
      return mRules.rulesForUrl(link.replaceFirst(VinliEndpoint.RULES.getUrl(), ""));
    }
    if (Subscription.class.equals(itemClz)) {
      return mSubscriptions.subscriptionsForUrl(link.replaceFirst(VinliEndpoint.EVENTS.getUrl(), ""));
    }
    if (Vehicle.class.equals(itemClz)) {
      return mVehicles.vehiclesForUrl(link.replaceFirst(VinliEndpoint.PLATFORM.getUrl(), ""));
    }
    throw new RuntimeException(String.format(
        "no paging observable for %s : %s", link, itemClz.getSimpleName()));
  }

  /*package*/ Observable<? extends TimeSeries<? extends VinliItem>> pagingTsObservable(
      Class itemClz, String link) {
    if (Message.class.equals(itemClz)) {
      return mMessages.messagesForUrl(link.replaceFirst(VinliEndpoint.TELEMETRY.getUrl(), ""));
    }
    if (Snapshot.class.equals(itemClz)) {
      return mSnapshots.snapshotsForUrl(link.replaceFirst(VinliEndpoint.TELEMETRY.getUrl(), ""));
    }
    if (Location.LocationTimeSeriesAdapter.class.equals(itemClz)) {
      return mLocations.locationsForUrl(link.replaceFirst(VinliEndpoint.TELEMETRY.getUrl(), ""));
    }
    if (Collision.class.equals(itemClz)) {
      return mCollisions.collisionsForUrl(link.replaceFirst(VinliEndpoint.SAFETY.getUrl(), ""));
    }
    if (Dtc.class.equals(itemClz)) {
      return mDiagnostics.codesForUrl(link.replaceFirst(VinliEndpoint.DIAGNOSTICS.getUrl(), ""));
    }
    if (Odometer.class.equals(itemClz)) {
      return mDistances.odometerReportsForUrl(link.replaceFirst(VinliEndpoint.DISTANCE.getUrl(), ""));
    }
    if (OdometerTrigger.class.equals(itemClz)) {
      return mDistances.odometerTriggersForUrl(link.replaceFirst(VinliEndpoint.DISTANCE.getUrl(), ""));
    }
    if (Event.class.equals(itemClz)) {
      return mEvents.eventsForUrl(link.replaceFirst(VinliEndpoint.EVENTS.getUrl(), ""));
    }
    if (Notification.class.equals(itemClz)) {
      return mNotifications.notificationsForUrl(link.replaceFirst(VinliEndpoint.EVENTS.getUrl(), ""));
    }
    if (ReportCard.class.equals(itemClz)) {
      return mReportCards.reportCardsForUrl(link.replaceFirst(VinliEndpoint.BEHAVIORAL.getUrl(), ""));
    }
    if (Trip.class.equals(itemClz)) {
      return mTrips.tripsForUrl(link.replaceFirst(VinliEndpoint.TRIPS.getUrl(), ""));
    }
    if (Dummy.class.equals(itemClz)) {
      return mDummies.dummiesForUrl(link.replaceFirst(VinliEndpoint.DUMMY.getUrl(), ""));
    }
    throw new RuntimeException(String.format(
        "no paging observable for %s : %s", link, itemClz.getSimpleName()));
  }

  /*package*/ static OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();

  /*protected*/ VinliApp(@NonNull String accessToken) {
    mAccessToken = accessToken;

    HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
      @Override public void log(String message) {
        Log.d("VinliNet", message);
      }
    });
    loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BASIC);

    client = clientBuilder.build().newBuilder()
        .addInterceptor(new OauthInterceptor(accessToken))
        .addInterceptor(loggingInterceptor)
        .readTimeout(60, TimeUnit.SECONDS)
        .connectTimeout(60, TimeUnit.SECONDS)
        .writeTimeout(60, TimeUnit.SECONDS)
        .build();

    mGson = gsonBuilder().create();
    final GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create(mGson);
    RxJavaCallAdapterFactory rxJavaCallAdapterFactory =
        RxJavaCallAdapterFactory.createWithScheduler(Schedulers.io());

    final Retrofit platformAdapter = new Retrofit.Builder().baseUrl(VinliEndpoint.PLATFORM.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build();

    mDevices = platformAdapter.create(Devices.class);
    mVehicles = platformAdapter.create(Vehicles.class);

    mDiagnostics = new Retrofit.Builder().baseUrl(VinliEndpoint.DIAGNOSTICS.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Diagnostics.class);

    mRules = new Retrofit.Builder().baseUrl(VinliEndpoint.RULES.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Rules.class);

    final Retrofit eventsAdapter = new Retrofit.Builder().baseUrl(VinliEndpoint.EVENTS.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build();

    mEvents = eventsAdapter.create(Events.class);
    mSubscriptions = eventsAdapter.create(Subscriptions.class);
    mNotifications = eventsAdapter.create(Notifications.class);

    final Retrofit telemAdapter = new Retrofit.Builder().baseUrl(VinliEndpoint.TELEMETRY.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build();

    mLocations = telemAdapter.create(Locations.class);
    mSnapshots = telemAdapter.create(Snapshots.class);
    mMessages = telemAdapter.create(Messages.class);

    mUsers = new Retrofit.Builder().baseUrl(VinliEndpoint.AUTH.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Users.class);

    mTrips = new Retrofit.Builder().baseUrl(VinliEndpoint.TRIPS.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Trips.class);

    mDistances = new Retrofit.Builder().baseUrl(VinliEndpoint.DISTANCE.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Distances.class);

    mCollisions = new Retrofit.Builder()
            .baseUrl(VinliEndpoint.SAFETY.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Collisions.class);

    mReportCards = new Retrofit.Builder()
            .baseUrl(VinliEndpoint.BEHAVIORAL.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(ReportCards.class);

    mDummies = new Retrofit.Builder()
            .baseUrl(VinliEndpoint.DUMMY.getUrl())
        .client(client)
        .addConverterFactory(gsonConverterFactory)
        .addCallAdapterFactory(rxJavaCallAdapterFactory)
        .build()
        .create(Dummies.class);

  }

  public String getAccessToken() {
    return mAccessToken;
  }

  public Observable<Page<Device>> devices() {
    return mDevices.devices(null, null);
  }

  /**
   * Pass null for default
   */
  public Observable<Page<Device>> devices(@Nullable Integer limit, @Nullable Integer offset) {
    return mDevices.devices(limit, offset);
  }

  public Observable<Device> device(@NonNull String deviceId) {
    return mDevices.device(deviceId).map(Wrapped.<Device>pluckItem());
  }

  public Observable<Vehicle> vehicle(@NonNull String vehicleId) {
    return mVehicles.vehicle(vehicleId).map(Wrapped.<Vehicle>pluckItem());
  }

  public Observable<Dtc.Code> diagnoseDtcCode(String number) {
    return mDiagnostics.diagnose(number).flatMap(Page.<Dtc.Code>allItems());
  }

  public Observable<User> currentUser() {
    return mUsers.currentUser().map(Wrapped.<User>pluckItem());
  }

  public Observable<Trip> trip(@NonNull String tripId) {
    return mTrips.trip(tripId).map(Wrapped.<Trip>pluckItem());
  }

  public Observable<Rule> rule(@NonNull String ruleId) {
    return mRules.rule(ruleId).map(Wrapped.<Rule>pluckItem());
  }

  public Observable<Collision> collision(@NonNull String collisionId){
    return mCollisions.collision(collisionId).map(Wrapped.<Collision>pluckItem());
  }

  public Observable<Subscription> subscription(@NonNull String subscriptionId) {
    return mSubscriptions.subscription(subscriptionId).map(Wrapped.<Subscription>pluckItem());
  }

  public Observable<Odometer> odometerReport(@NonNull String odometerId){
    return mDistances.odometerReport(odometerId).map(Wrapped.<Odometer>pluckItem());
  }

  public Observable<OdometerTrigger> odometerTrigger(@NonNull String odometerTriggerId) {
    return mDistances.odometerTrigger(odometerTriggerId).map(Wrapped.<OdometerTrigger>pluckItem());
  }

  public Observable<ReportCard> reportCard(@NonNull String reportCardId){
    return mReportCards.reportCard(reportCardId).map(Wrapped.<ReportCard>pluckItem());
  }

  public Observable<Message> message(@NonNull String messageId){
    return mMessages.message(messageId).map(Wrapped.<Message>pluckItem());
  }

  public Observable<Notification> notification(@NonNull String notificationId){
    return mNotifications.notification(notificationId).map(Wrapped.<Notification>pluckItem());
  }

  public Observable<Event> event(@NonNull String eventId){
    return mEvents.event(eventId).map(Wrapped.<Event>pluckItem());
  }

  public Observable<Page<Dummy>> dummy(@Nullable Integer limit, @Nullable Integer offset) {
    return mDummies.dummies(limit, offset);
  }

  public Observable<Dummy.Run> run(@NonNull String dummyId) {
    return mDummies.currentRun(dummyId).map(Wrapped.<Dummy.Run>pluckItem());
  }

  /*package*/ Devices devicesSvc() {
    return mDevices;
  }

  /*package*/ Vehicles vehicles() {
    return mVehicles;
  }

  /*package*/ Rules rules() {
    return mRules;
  }

  /*package*/ Events events() {
    return mEvents;
  }

  /*package*/ Locations locations() {
    return mLocations;
  }

  /*package*/ Snapshots snapshots() {
    return mSnapshots;
  }

  /*package*/ Subscriptions subscriptions() {
    return mSubscriptions;
  }

  /*package*/ Trips trips() {
    return mTrips;
  }

  /*package*/ Distances distances() {
      return mDistances;
  }

  /*package*/ Messages messages(){
    return mMessages;
  }

  /*package*/ Diagnostics diagnostics(){
    return mDiagnostics;
  }

  /*package*/ Collisions collisions(){
    return mCollisions;
  }

  /*package*/ ReportCards reportCards(){
    return mReportCards;
  }

  /*package*/ Notifications notifications(){
    return mNotifications;
  }

  /*package*/ Gson gson() {
    return mGson;
  }

  /*package*/ Dummies dummies() {
    return mDummies;
  }

  private static final class OauthInterceptor implements Interceptor {
    private static final String AUTH = "Authorization";
    private final String mBearer;

    public OauthInterceptor(String accessToken) {
      mBearer = "Bearer " + accessToken;
    }

    @Override public Response intercept(Interceptor.Chain chain) throws IOException {
      Request original = chain.request();

      Request request = original.newBuilder().header(AUTH, mBearer).build();

      return chain.proceed(request);
    }
  }
}


text:
package com.google.common.collect;

import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.client.rpc.SerializationStreamReader;
import com.google.gwt.user.client.rpc.SerializationStreamWriter;

/**
 * This class contains static utility methods for writing {@code Multiset} GWT
 * field serializers. Serializers should delegate to
 * {@link #serialize(SerializationStreamWriter, Multiset)} and to either
 * {@link #instantiate(SerializationStreamReader, ImmutableMultiset.Builder)} or
 * {@link #populate(SerializationStreamReader, Multiset)}.
 *
 * @author Chris Povirk
 */
final class Multiset_CustomFieldSerializerBase {
  static ImmutableMultiset<Object> instantiate(
      SerializationStreamReader reader,
      ImmutableMultiset.Builder<Object> builder)
      throws SerializationException {
    int distinctElements = reader.readInt();
    for (int i = 0; i < distinctElements; i++) {
      Object element = reader.readObject();
      int count = reader.readInt();
      builder.addCopies(element, count);
    }
    return builder.build();
  }

  static Multiset<Object> populate(
      SerializationStreamReader reader, Multiset<Object> multiset)
      throws SerializationException {
    int distinctElements = reader.readInt();
    for (int i = 0; i < distinctElements; i++) {
      Object element = reader.readObject();
      int count = reader.readInt();
      multiset.add(element, count);
    }
    return multiset;
  }

  static void serialize(SerializationStreamWriter writer, Multiset<?> instance)
      throws SerializationException {
    int entryCount = instance.entrySet().size();
    writer.writeInt(entryCount);
    for (Multiset.Entry<?> entry : instance.entrySet()) {
      writer.writeObject(entry.getElement());
      writer.writeInt(entry.getCount());
    }
  }

  private Multiset_CustomFieldSerializerBase() {}
}


text:
package com.alipay.api.domain;

import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;

/**
 * 口碑广告系统二维码内容详情
 *
 * @author auto create
 * @since 1.0, 2017-02-15 13:57:59
 */
public class KbAdvertContentCodec extends AlipayObject {

	private static final long serialVersionUID = 5658644564728921933L;

	/**
	 * 二维码广告内容
	 */
	@ApiField("url")
	private String url;

	public String getUrl() {
		return this.url;
	}
	public void setUrl(String url) {
		this.url = url;
	}

}


text:
'''
Created on Nov 28, 2011

This module is Arelle's COM server controller

(This module can be a pattern for custom integration of Arelle into an application.
It is provided for future referenced but not used in the production code.
It cannot be used in cx_freeze or py2app installer-built deployment, but must be used as source code.
Future source-code plugins may possibly use this mechanism.)

@author: Mark V Systems Limited
(c) Copyright 2011 Mark V Systems Limited, All rights reserved.
'''
from arelle import PythonUtil # define 2.1 or 3.2 string types
import gettext, time, datetime, os, shlex, sys, traceback
from optparse import OptionParser
from arelle import Cntlr
import logging
import datetime

debugging = 0
useDispatcher = None

def main():
    gettext.install("arelle") # needed for options messages
    import win32com.server.register
    if '--debug' in sys.argv:
        global debugging, useDispatcher
        debugging = 1
        from win32com.server.dispatcher import DefaultDebugDispatcher
        useDispatcher = DefaultDebugDispatcher
    win32com.server.register.UseCommandLine(CntlrComServer, debug=debugging)

class CntlrComServer(Cntlr.Cntlr):
    _public_methods_ = [ 'Load' ]
    _public_attrs_ = [ ]
    _readonly_attrs_ = [ ]
    _reg_progid_ = "Arelle.XbrlServer"
    _reg_clsid_ = "{C0E35073-789A-406B-B93B-3C5698CE4314}"
    _reg_desc_ = "Arelle Open Source XBRL COM Server"

    def __init__(self, logFileName=None):
        #super(CntlrComServer, self).__init__(logFileName=logFileName if logFileName else "logToPrint",
        #                 logFormat="[%(messageCode)s] %(message)s - %(file)s %(sourceLine)s")
        print (sys.path)
        self.startedAt = datetime.datetime.now().microsecond
        self.last = "({0})".format(self.startedAt)
        pass

    def Load(self, url):
        last = self.last
        self.last = url
        return "inst: {0} this: {1}  prev: {2}".format(self.startedAt, url, last)


text:
package namespaces

import (
	"os"
	"os/exec"

	"github.com/docker/libcontainer"
)

type CreateCommand func(container *libcontainer.Config, console, rootfs, dataPath, init string, childPipe *os.File, args []string) *exec.Cmd


text:
Event

Post a new Event

  <form class="form-inline" role="form" ng-submit="addEvent()">

  </form>


text:
import traceback
import epdb

class @NAME@Error(Exception):
    "Base class"

class InvalidYamlFound(@NAME@Error):
    "Raised when YAML is invalid"

class RepositoryError(@NAME@Error):
    "Raised when a repository error is caught"

class TemplateNotFound(@NAME@Error):
    "Raise when a template is not found"

def debugExceptHook(type, value, tb):
    print "T-Rex Hates %s" % type.__name__
    print str(type)
    traceback.print_exception(type, value, tb)
    epdb.post_mortem(tb)


text:
package org.drools.testcoverage.common.model;

public class PersonWithSpecificEquals {

    private String name;
    private int age;

    public PersonWithSpecificEquals(final String name, final int age) {
        super();
        this.name = name;
        this.age = age;
    }

    public int getAge() {
        return age;
    }

    public void setAge(final int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + age;
        result = PRIME * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    public boolean equals(final Object obj) {
        if ( this == obj ) return true;
        if ( obj == null ) return false;
        if ( getClass() != obj.getClass() ) return false;
        final PersonWithSpecificEquals other = (PersonWithSpecificEquals) obj;
        if ( age != other.age ) return false;
        if ( name == null ) {
            return other.name == null;
        } else {
            return name.equals(other.name);
        }
    }

}