text:
var OSRM = require('../../');
var test = require('tape');
var monaco_path = require('./constants').data_path;
var monaco_mld_path = require('./constants').mld_data_path;
var monaco_corech_path = require('./constants').corech_data_path;
var three_test_coordinates = require('./constants').three_test_coordinates;
var two_test_coordinates = require('./constants').two_test_coordinates;

test('route: routes Monaco', function(assert) {
    assert.plan(5);
    var osrm = new OSRM(monaco_path);
    osrm.route({coordinates: two_test_coordinates}, function(err, route) {
        assert.ifError(err);
        assert.ok(route.waypoints);
        assert.ok(route.routes);
        assert.ok(route.routes.length);
        assert.ok(route.routes[0].geometry);
    });
});

test('route: routes Monaco on MLD', function(assert) {
    assert.plan(5);
    var osrm = new OSRM({path: monaco_mld_path, algorithm: 'MLD'});
    osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) {
        assert.ifError(err);
        assert.ok(route.waypoints);
        assert.ok(route.routes);
        assert.ok(route.routes.length);
        assert.ok(route.routes[0].geometry);
    });
});

test('route: routes Monaco on CoreCH', function(assert) {
    assert.plan(5);
    var osrm = new OSRM({path: monaco_corech_path, algorithm: 'CoreCH'});
    osrm.route({coordinates: [[13.43864,52.51993],[13.415852,52.513191]]}, function(err, route) {
        assert.ifError(err);
        assert.ok(route.waypoints);
        assert.ok(route.routes);
        assert.ok(route.routes.length);
        assert.ok(route.routes[0].geometry);
    });
});

test('route: throws with too few or invalid args', function(assert) {
    assert.plan(3);
    var osrm = new OSRM(monaco_path);
    assert.throws(function() { osrm.route({coordinates: two_test_coordinates}) },
        /Two arguments required/);
    assert.throws(function() { osrm.route(null, function(err, route) {}) },
        /First arg must be an object/);
    assert.throws(function() { osrm.route({coordinates: two_test_coordinates}, true)},
        /last argument must be a callback function/);
});

test('route: provides no alternatives by default, but when requested it may (not guaranteed)', function(assert) {
    assert.plan(6);
    var osrm = new OSRM(monaco_path);
    var options = {coordinates: two_test_coordinates};

    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.ok(route.routes);
        assert.equal(route.routes.length, 1);
    });
    options.alternatives = true;
    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.ok(route.routes);
        assert.ok(route.routes.length >= 1);
    });
});

test('route: throws with bad params', function(assert) {
    assert.plan(11);
    var osrm = new OSRM(monaco_path);
    assert.throws(function () { osrm.route({coordinates: []}, function(err) {}) });
    assert.throws(function() { osrm.route({}, function(err, route) {}) },
        /Must provide a coordinates property/);
    assert.throws(function() { osrm.route({coordinates: null}, function(err, route) {}) },
        /Coordinates must be an array of \(lon\/lat\) pairs/);
    assert.throws(function() { osrm.route({coordinates: [[three_test_coordinates[0]], [three_test_coordinates[1]]]}, function(err, route) {}) },
        /Coordinates must be an array of \(lon\/lat\) pairs/);
    assert.throws(function() { osrm.route({coordinates: [[true, 'stringish'], three_test_coordinates[1]]}, function(err, route) {}) },
        /Each member of a coordinate pair must be a number/);
    assert.throws(function() { osrm.route({coordinates: [[213.43864,252.51993],[413.415852,552.513191]]}, function(err, route) {}) },
        /Lng\/Lat coordinates must be within world bounds \(-180 < lng < 180, -90 < lat < 90\)/);
    assert.throws(function() { osrm.route({coordinates: [[13.438640], [52.519930]]}, function(err, route) {}) },
        /Coordinates must be an array of \(lon\/lat\) pairs/);
    assert.throws(function() { osrm.route({coordinates: two_test_coordinates, hints: null}, function(err, route) {}) },
        /Hints must be an array of strings\/null/);
    assert.throws(function() { osrm.route({coordinates: two_test_coordinates, steps: null}, function(err, route) {}) });
    assert.throws(function() { osrm.route({coordinates: two_test_coordinates, annotations: null}, function(err, route) {}) });
    var options = {
        coordinates: two_test_coordinates,
        alternateRoute: false,
        hints: three_test_coordinates[0]
    };
    assert.throws(function() { osrm.route(options, function(err, route) {}) },
        /Hint must be null or string/);
});

test('route: routes Monaco using shared memory', function(assert) {
    assert.plan(2);
    var osrm = new OSRM();
    osrm.route({coordinates: two_test_coordinates}, function(err, route) {
        assert.ifError(err);
        assert.ok(Array.isArray(route.routes));
    });
});

test('route: routes Monaco with geometry compression', function(assert) {
    assert.plan(2);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.equal('string', typeof route.routes[0].geometry);
    });
});

test('route: routes Monaco without geometry compression', function(assert) {
    assert.plan(4);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        geometries: 'geojson'
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.ok(Array.isArray(route.routes));
        assert.ok(Array.isArray(route.routes[0].geometry.coordinates));
        assert.equal(route.routes[0].geometry.type, 'LineString');
    });
});

test('Test polyline6 geometries option', function(assert) {
    assert.plan(6);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        continue_straight: false,
        overview: 'false',
        geometries: 'polyline6',
        steps: true
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.routes);
        assert.equal(first.routes.length, 1);
        assert.notOk(first.routes[0].geometry);
        assert.ok(first.routes[0].legs[0]);
        assert.equal(typeof first.routes[0].legs[0].steps[0].geometry, 'string');
    });
});

test('route: routes Monaco with speed annotations options', function(assert) {
    assert.plan(17);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        continue_straight: false,
        overview: 'false',
        geometries: 'polyline',
        steps: true,
        annotations: ['speed']
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.routes);
        assert.ok(first.routes[0].legs.every(function(l) { return Array.isArray(l.steps) && l.steps.length > 0; }));
        assert.equal(first.routes.length, 1);
        assert.notOk(first.routes[0].geometry);
        assert.ok(first.routes[0].legs[0]);
        assert.ok(first.routes[0].legs.every(l => { return l.steps.length > 0; }), 'every leg has steps');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation;}), 'every leg has annotations');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation.speed;}), 'every leg has annotations for speed');
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.weight; }), 'has no annotations for weight')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.datasources; }), 'has no annotations for datasources')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.duration; }), 'has no annotations for duration')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.distance; }), 'has no annotations for distance')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.nodes; }), 'has no annotations for nodes')

        options.overview = 'full';
        osrm.route(options, function(err, full) {
            assert.ifError(err);
            options.overview = 'simplified';
            osrm.route(options, function(err, simplified) {
                assert.ifError(err);
                assert.notEqual(full.routes[0].geometry, simplified.routes[0].geometry);
            });
        });
    });
});

test('route: routes Monaco with several (duration, distance, nodes) annotations options', function(assert) {
    assert.plan(17);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        continue_straight: false,
        overview: 'false',
        geometries: 'polyline',
        steps: true,
        annotations: ['duration', 'distance', 'nodes']
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.routes);
        assert.ok(first.routes[0].legs.every(function(l) { return Array.isArray(l.steps) && l.steps.length > 0; }));
        assert.equal(first.routes.length, 1);
        assert.notOk(first.routes[0].geometry);
        assert.ok(first.routes[0].legs[0]);
        assert.ok(first.routes[0].legs.every(l => { return l.steps.length > 0; }), 'every leg has steps');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation;}), 'every leg has annotations');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation.distance;}), 'every leg has annotations for distance');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation.duration;}), 'every leg has annotations for durations');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation.nodes;}), 'every leg has annotations for nodes');
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.weight; }), 'has no annotations for weight')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.datasources; }), 'has no annotations for datasources')
        assert.notOk(first.routes[0].legs.every(l => { return l.annotation.speed; }), 'has no annotations for speed')

        options.overview = 'full';
        osrm.route(options, function(err, full) {
            assert.ifError(err);
            options.overview = 'simplified';
            osrm.route(options, function(err, simplified) {
                assert.ifError(err);
                assert.notEqual(full.routes[0].geometry, simplified.routes[0].geometry);
            });
        });
    });
});

test('route: routes Monaco with options', function(assert) {
    assert.plan(11);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        continue_straight: false,
        overview: 'false',
        geometries: 'polyline',
        steps: true,
        annotations: true
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.routes);
        assert.ok(first.routes[0].legs.every(function(l) { return Array.isArray(l.steps) && l.steps.length > 0; }));
        assert.equal(first.routes.length, 1);
        assert.notOk(first.routes[0].geometry);
        assert.ok(first.routes[0].legs[0]);
        assert.ok(first.routes[0].legs.every(l => { return l.steps.length > 0; }), 'every leg has steps');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation;}), 'every leg has annotations');

        options.overview = 'full';
        osrm.route(options, function(err, full) {
            assert.ifError(err);
            options.overview = 'simplified';
            osrm.route(options, function(err, simplified) {
                assert.ifError(err);
                assert.notEqual(full.routes[0].geometry, simplified.routes[0].geometry);
            });
        });
    });
});

test('route: routes Monaco with options', function(assert) {
    assert.plan(11);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        continue_straight: false,
        overview: 'false',
        geometries: 'polyline',
        steps: true,
        annotations: true
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.routes);
        assert.ok(first.routes[0].legs.every(function(l) { return Array.isArray(l.steps) && l.steps.length > 0; }));
        assert.equal(first.routes.length, 1);
        assert.notOk(first.routes[0].geometry);
        assert.ok(first.routes[0].legs[0]);
        assert.ok(first.routes[0].legs.every(l => { return l.steps.length > 0; }), 'every leg has steps');
        assert.ok(first.routes[0].legs.every(l => { return l.annotation;}), 'every leg has annotations');

        options.overview = 'full';
        osrm.route(options, function(err, full) {
            assert.ifError(err);
            options.overview = 'simplified';
            osrm.route(options, function(err, simplified) {
                assert.ifError(err);
                assert.notEqual(full.routes[0].geometry, simplified.routes[0].geometry);
            });
        });
    });
});

test('route: invalid route options', function(assert) {
    assert.plan(8);
    var osrm = new OSRM(monaco_path);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        continue_straight: []
    }, function(err, route) {}); },
        /must be boolean/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        alternatives: []
    }, function(err, route) {}); },
        /must be boolean/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        geometries: true
    }, function(err, route) {}); },
        /Geometries must be a string: \[polyline, polyline6, geojson\]/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        overview: false
    }, function(err, route) {}); },
        /Overview must be a string: \[simplified, full, false\]/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        overview: false
    }, function(err, route) {}); },
        /Overview must be a string: \[simplified, full, false\]/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        overview: 'maybe'
    }, function(err, route) {}); },
        /'overview' param must be one of \[simplified, full, false\]/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        geometries: 'maybe'
    }, function(err, route) {}); },
        /'geometries' param must be one of \[polyline, polyline6, geojson\]/);
    assert.throws(function() { osrm.route({
        coordinates: [[NaN, -NaN],[Infinity, -Infinity]]
    }, function(err, route) {}); },
        /Lng\/Lat coordinates must be valid numbers/);
});

test('route: integer bearing values no longer supported', function(assert) {
    assert.plan(1);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        bearings: [200, 250],
    };
    assert.throws(function() { osrm.route(options, function(err, route) {}); },
        /Bearing must be an array of \[bearing, range\] or null/);
});

test('route: valid bearing values', function(assert) {
    assert.plan(4);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        bearings: [[200, 180], [250, 180]],
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.ok(route.routes[0]);
    });
    options.bearings = [null, [360, 180]];
    osrm.route(options, function(err, route) {
        assert.ifError(err);
        assert.ok(route.routes[0]);
    });
});

test('route: invalid bearing values', function(assert) {
    assert.plan(6);
    var osrm = new OSRM(monaco_path);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: [[400, 180], [-250, 180]],
    }, function(err, route) {}) },
        /Bearing values need to be in range 0..360, 0..180/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: [[200], [250, 180]],
    }, function(err, route) {}) },
        /Bearing must be an array of/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: [[400, 109], [100, 720]],
    }, function(err, route) {}) },
        /Bearing values need to be in range 0..360, 0..180/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: 400,
    }, function(err, route) {}) },
        /Bearings must be an array of arrays of numbers/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: [[100, 100]],
    }, function(err, route) {}) },
        /Bearings array must have the same length as coordinates array/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        bearings: [Infinity, Infinity],
    }, function(err, route) {}) },
        /Bearing must be an array of \[bearing, range\] or null/);
});

test('route: routes Monaco with hints', function(assert) {
    assert.plan(5);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
    };
    osrm.route(options, function(err, first) {
        assert.ifError(err);
        assert.ok(first.waypoints);
        var hints = first.waypoints.map(function(wp) { return wp.hint; });
        assert.ok(hints.every(function(h) { return typeof h === 'string'; }));

        options.hints = hints;

        osrm.route(options, function(err, second) {
            assert.ifError(err);
            assert.deepEqual(first, second);
        });
    });
});

test('route: routes Monaco with null hints', function(assert) {
    assert.plan(1);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        hints: [null, null]
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
});

test('route: throws on bad hints', function(assert) {
    assert.plan(2);
    var osrm = new OSRM(monaco_path);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        hints: ['', '']
    }, function(err, route) {})}, /Hint cannot be an empty string/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        hints: [null]
    }, function(err, route) {})}, /Hints array must have the same length as coordinates array/);
});

test('route: routes Monaco with valid radius values', function(assert) {
    assert.plan(3);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        radiuses: [100, 100]
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
    options.radiuses = [null, null];
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
    options.radiuses = [100, null];
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
});

test('route: throws on bad radiuses', function(assert) {
    assert.plan(3);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        radiuses: [10, 10]
    };
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        radiuses: 10
    }, function(err, route) {}) },
        /Radiuses must be an array of non-negative doubles or null/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        radiuses: ['magic', 'numbers']
    }, function(err, route) {}) },
        /Radius must be non-negative double or null/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        radiuses: [10]
    }, function(err, route) {}) },
        /Radiuses array must have the same length as coordinates array/);
});

test('route: routes Monaco with valid approaches values', function(assert) {
    assert.plan(3);
    var osrm = new OSRM(monaco_path);
    var options = {
        coordinates: two_test_coordinates,
        approaches: [null, 'curb']
    };
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
    options.approaches = [null, null];
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
    options.approaches = ['unrestricted', null];
    osrm.route(options, function(err, route) {
        assert.ifError(err);
    });
});

test('route: throws on bad approaches', function(assert) {
    assert.plan(4);
    var osrm = new OSRM(monaco_path);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        approaches: 10
    }, function(err, route) {}) },
        /Approaches must be an arrays of strings/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        approaches: ['curb']
    }, function(err, route) {}) },
        /Approaches array must have the same length as coordinates array/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        approaches: ['curb', 'test']
    }, function(err, route) {}) },
        /'approaches' param must be one of \[curb, unrestricted\]/);
    assert.throws(function() { osrm.route({
        coordinates: two_test_coordinates,
        approaches: [10, 15]
    }, function(err, route) {}) },
        /Approach must be a string: \[curb, unrestricted\] or null/);
});


text:
<!DOCTYPE html>

ANCHOR

redpajama_set_name: RedPajamaGithub


text:
package com.spotify.helios.servicescommon.statistics;

import static com.codahale.metrics.MetricRegistry.name;

import com.codahale.metrics.Histogram;
import com.codahale.metrics.MetricRegistry;
import com.google.common.collect.Maps;
import com.spotify.helios.servicescommon.MasterRequestMetrics;
import java.util.Map;

public class MasterMetricsImpl implements MasterMetrics {
  private static final String TYPE = "master";

  private final Map<String, MasterRequestMetrics> requestMetrics = Maps.newConcurrentMap();

  private final Histogram jobsInJobListHist;
  private final Histogram eventsInJobHistoryHist;
  private final String group;
  private final MetricRegistry registry;

  public MasterMetricsImpl(final String group,
                           final MetricRegistry registry) {
    this.group = group;
    this.registry = registry;

    eventsInJobHistoryHist = registry.histogram(name(group, TYPE + "_events_in_job_history"));
    jobsInJobListHist = registry.histogram(name(group, TYPE + "_jobs_in_job_list"));
  }

  @Override
  public void success(final String name) {
    request(name).success();
  }

  @Override
  public void failure(final String name) {
    request(name).failure();
  }

  @Override
  public void badRequest(final String name) {
    request(name).userError();
  }

  private MasterRequestMetrics request(final String name) {
    MasterRequestMetrics metrics = requestMetrics.get(name);
    if (metrics == null) {
      metrics = new MasterRequestMetrics(group, TYPE, name, registry);
      requestMetrics.put(name, metrics);
    }
    return metrics;
  }

  @Override
  public void clientVersion(final String version) {
    final String name = name(group, TYPE + "_meter_client_version", version);
    registry.meter(name).mark();
  }

  @Override
  public void jobsInJobList(final int count) {
    jobsInJobListHist.update(count);
  }

  @Override
  public void jobsHistoryEventSize(final int count) {
    eventsInJobHistoryHist.update(count);
  }
}


text:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;

using Khronos;

// ReSharper disable CheckNamespace
// ReSharper disable InconsistentNaming
// ReSharper disable JoinDeclarationAndInitializer

namespace OpenGL
{
	public partial class Egl
	{
		/// <summary>
		/// [EGL] Value of EGL_NATIVE_PIXMAP_KHR symbol.
		/// </summary>
		[RequiredByFeature("EGL_KHR_image")]
		[RequiredByFeature("EGL_KHR_image_pixmap")]
		public const int NATIVE_PIXMAP_KHR = 0x30B0;

	}

}


text:
/**
 * @fileOverview This test specs runs tests on the ,jsdoc-config.json file of repository. It has a set of strict tests
 * on the content of the file as well. Any change to .jsdoc-config.json must be accompanied by valid test case in this
 * spec-sheet.
 */

const expect = require('chai').expect;

describe('JSDoc configuration', function () {
    var fs = require('fs'),

        json,
        content,
        jsdocConfigPath = './.jsdoc-config.json';

    it('should exist', function (done) {
        fs.stat(jsdocConfigPath, done);
    });

    it('should have readable content', function () {
        expect(content = fs.readFileSync(jsdocConfigPath).toString(), 'Should have readable content').to.be.ok;
    });

    it('should have valid JSON content', function () {
        expect(json = JSON.parse(content), 'Should have valid JSON content').to.be.ok;
    });

    describe('tags', function () {
        it('should allow unknown tags', function () {
            expect(json.tags.allowUnknownTags, 'Should allow unknown tags').to.be.ok;
        });

        it('should have jsdoc and closure dictionaries', function () {
            expect(json.tags.dictionaries).to.eql(['jsdoc', 'closure']);
        });
    });

    describe('source', function () {
        it('should have an include pattern', function () {
            expect(json.source.includePattern).to.equal('.+\\.js(doc)?$');
        });

        it('should have an exclude pattern', function () {
            expect(json.source.excludePattern).to.equal('(^|\\/|\\\\)_');
        });
    });

    describe('plugins', function () {
        it('should have the markdown plugin', function () {
            expect(json.plugins, 'Should use the markdown plugin').to.include('plugins/markdown');
        });
    });

    describe('templates', function () {
        it('should not have clever links', function () {
            expect(json.templates.cleverLinks).to.be.false;
        });

        it('should not have monospace links', function () {
            expect(json.templates.monospaceLinks).to.be.false;
        });

        it('should highlight tutorial code', function () {
            expect(json.templates.highlightTutorialCode).to.be.ok;
        });
    });

    describe('opts', function () {
        it('should use the Postman JSDoc theme', function () {
            expect(json.opts.template).to.equal('./node_modules/postman-jsdoc-theme');
        });

        it('should use UTF-8 encoding', function () {
            expect(json.opts.encoding).to.equal('utf8');
        });

        it('should create documentation in out/docs', function () {
            expect(json.opts.destination).to.equal('./out/docs');
        });

        it('should recurse', function () {
            expect(json.opts.recurse).to.be.ok;
        });

        it('should have a valid readme', function () {
            expect(json.opts.readme, 'Should use a valid readme').to.equal('README.md');
        });
    });

    describe('markdown', function () {
        it('should have a gfm parser', function () {
            expect(json.markdown.parser, 'Should use the gfm markdown parser').to.equal('gfm');
        });

        it('should have jsdoc and closure dictionaries', function () {
            expect(json.markdown.hardwrap).to.be.false;
        });
    });
});


text:
class CorbTestInstance : public pp::Instance {
 public:
  explicit CorbTestInstance(PP_Instance instance) : pp::Instance(instance) {}
  ~CorbTestInstance() override {}

  void HandleMessage(const pp::Var& message_data) override {
    if (!message_data.is_string())
      return;

    std::string msg = message_data.AsString();
    const std::string kRequestUrlMsgPrefix("requestUrl: ");
    if (msg.substr(0, kRequestUrlMsgPrefix.size()) == kRequestUrlMsgPrefix) {
      // This is for NetworkServiceRestartBrowserTest.Plugin test.
      std::string url = msg.substr(kRequestUrlMsgPrefix.size());
      RequestURLAndPostResponseBody(url);
    }
  }

 private:
  void RequestURLAndPostResponseBody(const std::string& url) {
    pp::URLLoader loader(this);

    const PPB_URLLoaderTrusted* url_loader_trusted_interface = nullptr;
    url_loader_trusted_interface = static_cast<const PPB_URLLoaderTrusted*>(
        pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE));
    url_loader_trusted_interface->GrantUniversalAccess(loader.pp_resource());

    pp::URLRequestInfo request(this);
    request.SetURL(url);
    request.SetAllowCrossOriginRequests(true);

    std::ostringstream msg_builder;
    std::string response_body;
    int result = OpenURLRequest(this->pp_instance(), &loader, request,
                                PP_OPTIONAL, &response_body);
    if (result == PP_OK) {
      msg_builder << "requestUrl: "
                  << "RESPONSE BODY: " << response_body;
    } else {
      msg_builder << "requestUrl: "
                  << "PPAPI ERROR: " << result;
    }

    PostMessage(pp::Var(msg_builder.str()));
  }
};

class CorbTestModule : public pp::Module {
 public:
  CorbTestModule() : pp::Module() {}
  virtual ~CorbTestModule() {}

  virtual pp::Instance* CreateInstance(PP_Instance instance) {
    return new CorbTestInstance(instance);
  }
};

namespace pp {

Module* CreateModule() {
  return new CorbTestModule();
}

}  // namespace pp


text:
#include "lb_storage_cleanup.h"

#if !defined(__LB_SHELL__FOR_RELEASE__)

#include <algorithm>
#include <string>
#include <vector>

#include "external/chromium/base/file_util.h"

#include "lb_globals.h"

using file_util::FileEnumerator;

namespace LB {

namespace {

// Maximum number of newest log files that will be kept
const size_t kNumLogsToKeep = 10;

// Maximum number of newest tracing files that will be kept
const size_t kNumTracesToKeep = 5;

// Maximum number of crash dump files that will be kept
const size_t kNumDumpsToKeep = 5;

typedef std::pair<base::Time, FilePath> FileEntry;

// Used to sort FileEntries by time (newer first)
struct FileEntryCompare {
  bool operator()(const FileEntry& e1, const FileEntry& e2) const {
    return e1.first > e2.first;
  }
};

void CleanFiles(const char* path, const char* ext, size_t max_files_to_keep,
                std::vector<FileEntry>* cleaned_files) {
  std::vector<FileEntry> files;

  FileEnumerator iter(FilePath(path), false, FileEnumerator::FILES);
  for (FilePath file = iter.Next(); !file.empty(); file = iter.Next()) {
    if (ext && !file.MatchesExtension(ext))
      continue;

    FileEnumerator::FindInfo info;
    iter.GetFindInfo(&info);
    files.push_back(std::make_pair(iter.GetLastModifiedTime(info), file));
  }

  if (files.size() <= max_files_to_keep)
    return;

  // Sort by creation time, newer come first
  std::sort(files.begin(), files.end(), FileEntryCompare());

  for (std::vector<FileEntry>::iterator it = files.begin() + max_files_to_keep;
       it != files.end(); ++it) {
    FilePath path = it->second;
    file_util::Delete(path, false);
  }

  if (cleaned_files) {
    cleaned_files->insert(cleaned_files->end(),
                          files.begin() + max_files_to_keep, files.end());
  }
}

}  // namespace

StorageCleanupThread::StorageCleanupThread()
    : SimpleThread("LB::StorageCleanupThread") {
}

StorageCleanupThread::~StorageCleanupThread() {
  Join();
}

void StorageCleanupThread::Run() {
  const char* logging_path = GetGlobalsPtr()->logging_output_path;

  // Clean log files
  CleanFiles(logging_path, ".log", kNumLogsToKeep, NULL);

  // Clean tracing files
  CleanFiles(logging_path, ".json", kNumTracesToKeep, NULL);

  // Clean crash dump files
  std::vector<FileEntry> cleaned_files;
  CleanFiles(logging_path, ".dmp", kNumDumpsToKeep, &cleaned_files);

  // Crash dumps have accompanying text files so we clean them too
  for (size_t i = 0; i < cleaned_files.size(); ++i) {
    const FileEntry& entry = cleaned_files[i];

    FilePath path = entry.second.ReplaceExtension(".txt");
    if (file_util::PathExists(path)) {
      file_util::Delete(path, false);
    }
  }
}

}  // namespace LB

#endif  // !defined(__LB_SHELL__FOR_RELEASE__)


text:
package com.sxt.base.common;

import java.io.Serializable;
import java.math.BigDecimal;

public class InvestDto implements Serializable{
	private static final long serialVersionUID = 1L;
	private String productId;
	private BigDecimal investMoney;
	private String ip;
	private String systemTradeNo;
	private String rewardId;
	private Integer uid;
	private Integer type;
	public String getProductId() {
		return productId;
	}
	public void setProductId(String productId) {
		this.productId = productId;
	}
	public BigDecimal getInvestMoney() {
		return investMoney;
	}
	public void setInvestMoney(BigDecimal investMoney) {
		this.investMoney = investMoney;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getSystemTradeNo() {
		return systemTradeNo;
	}
	public void setSystemTradeNo(String systemTradeNo) {
		this.systemTradeNo = systemTradeNo;
	}
	public String getRewardId() {
		return rewardId;
	}
	public void setRewardId(String rewardId) {
		this.rewardId = rewardId;
	}
	public Integer getUid() {
		return uid;
	}
	public void setUid(Integer uid) {
		this.uid = uid;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public InvestDto(String productId, BigDecimal investMoney, String ip,
			String systemTradeNo, String rewardId, Integer uid, Integer type) {
		super();
		this.productId = productId;
		this.investMoney = investMoney;
		this.ip = ip;
		this.systemTradeNo = systemTradeNo;
		this.rewardId = rewardId;
		this.uid = uid;
		this.type = type;
	}

}


text:
require 'spec_helper'

RSpec.describe Gitlab::Sanitizers::SVG do
  let(:scrubber) { Gitlab::Sanitizers::SVG::Scrubber.new }
  let(:namespace) { double(Nokogiri::XML::Namespace, prefix: 'xlink', href: 'http://www.w3.org/1999/xlink') }
  let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace, value: '#awesome_id') }

  describe '.clean' do
    let(:input_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'unsanitized.svg') }
    let(:data) { File.read(input_svg_path) }
    let(:sanitized_svg_path) { File.join(Rails.root, 'spec', 'fixtures', 'sanitized.svg') }
    let(:sanitized) { File.read(sanitized_svg_path) }

    it 'delegates sanitization to scrubber' do
      expect_next_instance_of(Gitlab::Sanitizers::SVG::Scrubber) do |instance|
        expect(instance).to receive(:scrub).at_least(:once)
      end
      described_class.clean(data)
    end

    it 'returns sanitized data' do
      expect(described_class.clean(data)).to eq(sanitized)
    end
  end

  context 'scrubber' do
    describe '#scrub' do
      let(:invalid_element) { double(Nokogiri::XML::Node, name: 'invalid', value: 'invalid') }
      let(:invalid_attribute) { double(Nokogiri::XML::Attr, name: 'invalid', namespace: nil) }
      let(:valid_element) { double(Nokogiri::XML::Node, name: 'use') }

      it 'removes an invalid element' do
        expect(invalid_element).to receive(:unlink)

        scrubber.scrub(invalid_element)
      end

      it 'removes an invalid attribute' do
        allow(valid_element).to receive(:attribute_nodes) { [invalid_attribute] }
        expect(invalid_attribute).to receive(:unlink)

        scrubber.scrub(valid_element)
      end

      it 'accepts valid element' do
        allow(valid_element).to receive(:attribute_nodes) { [namespaced_attr] }
        expect(valid_element).not_to receive(:unlink)

        scrubber.scrub(valid_element)
      end

      it 'accepts valid namespaced attributes' do
        allow(valid_element).to receive(:attribute_nodes) { [namespaced_attr] }
        expect(namespaced_attr).not_to receive(:unlink)

        scrubber.scrub(valid_element)
      end
    end

    describe '#attribute_name_with_namespace' do
      it 'returns name with prefix when attribute is namespaced' do
        expect(scrubber.attribute_name_with_namespace(namespaced_attr)).to eq('xlink:href')
      end
    end

    describe '#unsafe_href?' do
      let(:unsafe_attr) { double(Nokogiri::XML::Attr, name: 'href', namespace: namespace, value: 'http://evilsite.example.com/random.svg') }

      it 'returns true if href attribute is an external url' do
        expect(scrubber.unsafe_href?(unsafe_attr)).to be_truthy
      end

      it 'returns false if href atttribute is an internal reference' do
        expect(scrubber.unsafe_href?(namespaced_attr)).to be_falsey
      end
    end

    describe '#data_attribute?' do
      let(:data_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: nil, value: 'gitlab is awesome') }
      let(:namespaced_attr) { double(Nokogiri::XML::Attr, name: 'data-gitlab', namespace: namespace, value: 'gitlab is awesome') }
      let(:other_attr) { double(Nokogiri::XML::Attr, name: 'something', namespace: nil, value: 'content') }

      it 'returns true if is a valid data attribute' do
        expect(scrubber.data_attribute?(data_attr)).to be_truthy
      end

      it 'returns false if attribute is namespaced' do
        expect(scrubber.data_attribute?(namespaced_attr)).to be_falsey
      end

      it 'returns false if not a data attribute' do
        expect(scrubber.data_attribute?(other_attr)).to be_falsey
      end
    end
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/cv_me_one"
    android:layout_width="match_parent"
    android:layout_height="80dp"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp"
    android:layout_marginTop="140dp"
    android:background="@color/md_white_1000"
    android:elevation="3dp">

    <LinearLayout
        android:baselineAligned="false"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <RelativeLayout
            android:id="@+id/rl_life_time"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_file_time"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="6dp"
                android:src="@mipmap/icon_time" />

            <TextView
                android:id="@+id/tv_file_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/iv_file_time"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="8dp"
                android:textColor="@color/md_grey_900"
                android:textSize="14sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="4dp"
                android:text="@string/time_recommend_life"
                android:textColor="@color/md_grey_500"
                android:textSize="12sp" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rl_life_recommend_book"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_book_name"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="6dp"
                android:src="@mipmap/icon_book" />

            <TextView
                android:id="@+id/tv_book_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/iv_book_name"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="8dp"
                android:textColor="@color/md_grey_900"
                android:textSize="14sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="4dp"
                android:text="@string/book_recommend_life"
                android:textColor="@color/md_grey_500"
                android:textSize="12sp" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rl_life_recommend_style"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_style_name"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="6dp"
                android:src="@mipmap/icon_life" />

            <TextView
                android:id="@+id/tv_style_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/iv_style_name"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="8dp"
                android:textColor="@color/md_grey_900"
                android:textSize="14sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="4dp"
                android:text="@string/style_recommend_life"
                android:textColor="@color/md_grey_500"
                android:textSize="12sp" />

        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/rl_life_recommend_view"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <ImageView
                android:id="@+id/iv_view_name"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="6dp"
                android:src="@mipmap/icon_view" />

            <TextView
                android:id="@+id/tv_view_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/iv_view_name"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="8dp"
                android:textColor="@color/md_grey_900"
                android:textSize="14sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="4dp"
                android:text="@string/view_recommend_life"
                android:textColor="@color/md_grey_500"
                android:textSize="12sp" />

        </RelativeLayout>

    </LinearLayout>

</android.support.v7.widget.CardView>


text:
_controllers.controller('ModulesCtrl',
	function($scope, $ionicActionSheet, $ionicModal, $stateParams, modules_mgr){
		var _self	=	this,
			_company = window.localStorage['BO_company'] || false;

		$scope._item	=	{};
		_self.modList = [];
		_self.reorder	=	false;

		modules_mgr.query(_company).then(function(result){//
			_self.modList	=	result;
		});

		_self.moveItem = function(item, fromIndex, toIndex) {
			_self.modList.splice(fromIndex, 1);
			_self.modList.splice(toIndex, 0, item);
		};

		_self.done_RO = function() {
			var new_order	=	[];

			angular.forEach(_self.modList, function(value, key) {
				  this.push({'id': value.id, 'order': key });
			}, new_order);

			modules_mgr.order(new_order);

			_self.reorder=!_self.reorder;
		};

		 // Triggered on a button click, or some other target
		_self.show_AS = function(item) {

		   // Show the action sheet
		   $ionicActionSheet.show({
		     buttons: [
		       { text: '<b>Re-order</b>' },
		       { text: 'Edit' }
		     ],
		     titleText: 'Modify menu',
		     cancelText: 'Cancel',
		     cancel: function() {
		          // add cancel code..
		        },
		     buttonClicked: function(index) {
		    	 if(index==0){
		    		 _self.reorder=!_self.reorder;
		    	 }
		    	 if(index==1){
		    		 $scope._item	=	item;
		    		 $scope.openModal(item);
		    	 }
		       return true;
		     }
		   });
		}

		/*
		 *MODAL
		*/
		$scope.modal = {};

		$scope.openModal = function(item){
			$ionicModal.fromTemplateUrl('bo/modules/form.html', {scope:$scope, animation: 'slide-in-up'})
			.then(function(modal) {
			    $scope.modal = modal;
			    $scope.modal.show();
			});
		}

		$scope.closeModal = function(){
			$scope.modal.remove();
			$scope._item	=	{};
		}

});
/*
 *
 */
_controllers.controller('moduleFormCtrl',
	function($scope, modules_mgr){
		var _self	=	this;

		_self.m_form	=	$scope._item;
		_self.win_title	=	_self.m_form._title;

		//
		_self.form_process	=	function(){
			modules_mgr.upt_item( _self.m_form );
			$scope.closeModal();
		}

	});


text:
import httplib2
import urllib
import json
import re
import sys

class Transport:
    """
    Abstract representation of a transport class. Defines
    the supported API methods
    """

    endpoint = "platform.clickatell.com"

    def __init__(self):
        """
        Construct a new transportation instance.

        :param boolean secure: Should we try and use a secure connection
        """
        pass

    def merge(self, *args):
        """
        Merge multiple dictionary objects into one.

        :param variadic args: Multiple dictionary items

        :return dict
        """
        values = []

        for entry in args:
            values = values + list(entry.items())

        return dict(values)

    def parseResponse(self, response):
        """
        Parse the response from json.
        Remapping error code and messages to be a level higher
        """
        response['body'] = json.loads(response['body'])
        response['messages'] = response['body']['messages']
        response['error'] = response['body']['error']
        del response['body']
        return response

    def request(self, action, data={}, headers={}, method='GET'):
        """
        Run the HTTP request against the Clickatell API

        :param str  action:     The API action
        :param dict data:       The request parameters
        :param dict headers:    The request headers (if any)
        :param str  method:     The HTTP method

        :return: The request response
        """
        http = httplib2.Http()
        body = urllib.urlencode(data) if (sys.version_info[0] < 3) else urllib.parse.urlencode(data)
        url = 'https://' + self.endpoint + '/' + action
        url = (url + '?' + body) if (method == 'GET') else url
        resp, content = http.request(url, method, headers=headers, body=json.dumps(data))
        return self.merge(resp, {'body': content})

    def sendMessage(self, to, message, extra={}):
        """
        Send a message.

        :param list     to:         The number you want to send to (list of strings, or one string)
        :param string   message:    The message you want to send
        :param dict     extra:      Any extra parameters (see Clickatell documentation)

        :return dict
        :raises NotImplementedError
        """
        raise NotImplementedError()


text:
<?php

/**
 * @file
 * Definition of Drupal\text\TextProcessed.
 */

namespace Drupal\text;

use Drupal\Core\TypedData\TypedDataInterface;
use Drupal\Core\TypedData\TypedData;
use Drupal\Core\TypedData\ReadOnlyException;
use InvalidArgumentException;

/**
 * A computed property for processing text with a format.
 *
 * Required settings (below the definition's 'settings' key) are:
 *  - text source: The text property containing the to be processed text.
 */
class TextProcessed extends TypedData {

  /**
   * The text property.
   *
   * @var \Drupal\Core\TypedData\TypedDataInterface
   */
  protected $text;

  /**
   * The text format property.
   *
   * @var \Drupal\Core\TypedData\TypedDataInterface
   */
  protected $format;

  /**
   * Overrides TypedData::__construct().
   */
  public function __construct(array $definition, $name = NULL, TypedDataInterface $parent = NULL) {
    parent::__construct($definition, $name, $parent);

    if (!isset($definition['settings']['text source'])) {
      throw new InvalidArgumentException("The definition's 'source' key has to specify the name of the text property to be processed.");
    }
  }

  /**
   * Overrides TypedData::setContext().
   */
  public function setContext($name = NULL, TypedDataInterface $parent = NULL) {
    parent::setContext($name, $parent);
    if (isset($parent)) {
      $this->text = $parent->get($this->definition['settings']['text source']);
      $this->format = $parent->get('format');
    }
  }

  /**
   * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
   */
  public function getValue($langcode = NULL) {

    if (!isset($this->text)) {
      throw new InvalidArgumentException('Computed properties require context for computation.');
    }

    $field = $this->parent->getParent();
    $entity = $field->getParent();
    $instance = field_info_instance($entity->entityType(), $field->getName(), $entity->bundle());

    if (!empty($instance['settings']['text_processing']) && $this->format->getValue()) {
      return check_markup($this->text->getValue(), $this->format->getValue(), $entity->language()->id);
    }
    else {
      // If no format is available, still make sure to sanitize the text.
      return check_plain($this->text->getValue());
    }
  }

  /**
   * Implements \Drupal\Core\TypedData\TypedDataInterface::setValue().
   */
  public function setValue($value, $notify = TRUE) {
    if (isset($value)) {
      // @todo This is triggered from DatabaseStorageController::invokeFieldMethod()
      // in the case of case of non-NG entity types.
      // throw new ReadOnlyException('Unable to set a computed property.');
    }
  }

}


text:
Back

Pull To Refresh

Yellow Submarine

Beatles

Don't Stop Me Now

Queen

Billie Jean

Michael Jackson

Just pull page down to let the magic happen.
Note that pull-to-refresh feature is optimised for touch and native iOS scrolling so it may not work on desktop browser.


text:
/*
 * ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c is automatically generated from
 * ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c.cxxcodebuilder,
 * using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
 * Edits to ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c will be lost.
 *
 * To update ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c:
 *   rake nginx
 *
 * To force regeneration of ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c:
 *   rm -f src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c
 *   rake src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c
 */

#include "ManifestGeneration.h"

static void
set_manifest_autogenerated_global_conf_defaults(manifest_gen_ctx_t *ctx) {
    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_abort_on_startup_error",
        sizeof("passenger_abort_on_startup_error") - 1,
        0);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_log_level",
        sizeof("passenger_log_level") - 1,
        3);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_log_file",
        sizeof("passenger_log_file") - 1,
        "Nginx's global error log",
        sizeof("Nginx's global error log") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_disable_log_prefix",
        sizeof("passenger_disable_log_prefix") - 1,
        0);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_data_buffer_dir",
        sizeof("passenger_data_buffer_dir") - 1,
        "$TMPDIR, or if not given, /tmp",
        sizeof("$TMPDIR, or if not given, /tmp") - 1);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_socket_backlog",
        sizeof("passenger_socket_backlog") - 1,
        2048);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_core_file_descriptor_ulimit",
        sizeof("passenger_core_file_descriptor_ulimit") - 1,
        "The ulimits environment under which Nginx was started",
        sizeof("The ulimits environment under which Nginx was started") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_disable_security_update_check",
        sizeof("passenger_disable_security_update_check") - 1,
        0);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_disable_anonymous_telemetry",
        sizeof("passenger_disable_anonymous_telemetry") - 1,
        0);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_instance_registry_dir",
        sizeof("passenger_instance_registry_dir") - 1,
        "Either /var/run/passenger-instreg, $TMPDIR, or /tmp (see docs)",
        sizeof("Either /var/run/passenger-instreg, $TMPDIR, or /tmp (see docs)") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_spawn_dir",
        sizeof("passenger_spawn_dir") - 1,
        "Either $TMPDIR or /tmp",
        sizeof("Either $TMPDIR or /tmp") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_turbocaching",
        sizeof("passenger_turbocaching") - 1,
        1);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_user_switching",
        sizeof("passenger_user_switching") - 1,
        1);

    add_manifest_options_container_static_default_str(ctx,
        ctx->global_config_container,
        "passenger_default_user",
        sizeof("passenger_default_user") - 1,
        "nobody",
        sizeof("nobody") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_default_group",
        sizeof("passenger_default_group") - 1,
        "The primary group of passenger_default_user",
        sizeof("The primary group of passenger_default_user") - 1);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_max_pool_size",
        sizeof("passenger_max_pool_size") - 1,
        6);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_pool_idle_time",
        sizeof("passenger_pool_idle_time") - 1,
        300);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_response_buffer_high_watermark",
        sizeof("passenger_response_buffer_high_watermark") - 1,
        134217728);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_stat_throttle_rate",
        sizeof("passenger_stat_throttle_rate") - 1,
        10);

    add_manifest_options_container_static_default_bool(ctx,
        ctx->global_config_container,
        "passenger_show_version_in_header",
        sizeof("passenger_show_version_in_header") - 1,
        1);

    add_manifest_options_container_dynamic_default(ctx,
        ctx->global_config_container,
        "passenger_app_file_descriptor_ulimit",
        sizeof("passenger_app_file_descriptor_ulimit") - 1,
        "passenger_core_file_descriptor_ulimit",
        sizeof("passenger_core_file_descriptor_ulimit") - 1);

    add_manifest_options_container_static_default_uint(ctx,
        ctx->global_config_container,
        "passenger_max_instances_per_app",
        sizeof("passenger_max_instances_per_app") - 1,
        0);

}

static void
set_manifest_autogenerated_app_conf_defaults(manifest_gen_ctx_t *ctx, PsgJsonValue *options_container) {
    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_ruby",
        sizeof("passenger_ruby") - 1,
        "ruby",
        sizeof("ruby") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_python",
        sizeof("passenger_python") - 1,
        "python",
        sizeof("python") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_nodejs",
        sizeof("passenger_nodejs") - 1,
        "node",
        sizeof("node") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_app_env",
        sizeof("passenger_app_env") - 1,
        "production",
        sizeof("production") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_friendly_error_pages",
        sizeof("passenger_friendly_error_pages") - 1,
        "On if passenger_app_env is development, off otherwise",
        sizeof("On if passenger_app_env is development, off otherwise") - 1);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_min_instances",
        sizeof("passenger_min_instances") - 1,
        1);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_start_timeout",
        sizeof("passenger_start_timeout") - 1,
        90);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_user",
        sizeof("passenger_user") - 1,
        "See the user account sandboxing rules",
        sizeof("See the user account sandboxing rules") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_group",
        sizeof("passenger_group") - 1,
        "See the user account sandboxing rules",
        sizeof("See the user account sandboxing rules") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_app_group_name",
        sizeof("passenger_app_group_name") - 1,
        "passenger_app_root plus passenger_app_env",
        sizeof("passenger_app_root plus passenger_app_env") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_app_root",
        sizeof("passenger_app_root") - 1,
        "Parent directory of the associated Nginx virtual host's root directory",
        sizeof("Parent directory of the associated Nginx virtual host's root directory") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_debugger",
        sizeof("passenger_debugger") - 1,
        0);

    add_manifest_options_container_static_default_int(ctx,
        options_container,
        "passenger_max_preloader_idle_time",
        sizeof("passenger_max_preloader_idle_time") - 1,
        300);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_spawn_method",
        sizeof("passenger_spawn_method") - 1,
        "'smart' for Ruby apps, 'direct' for all other apps",
        sizeof("'smart' for Ruby apps, 'direct' for all other apps") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_direct_instance_request_address",
        sizeof("passenger_direct_instance_request_address") - 1,
        "127.0.0.1",
        sizeof("127.0.0.1") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_load_shell_envvars",
        sizeof("passenger_load_shell_envvars") - 1,
        1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_preload_bundler",
        sizeof("passenger_preload_bundler") - 1,
        0);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_max_request_queue_size",
        sizeof("passenger_max_request_queue_size") - 1,
        100);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_app_type",
        sizeof("passenger_app_type") - 1,
        "Autodetected",
        sizeof("Autodetected") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_startup_file",
        sizeof("passenger_startup_file") - 1,
        "Autodetected",
        sizeof("Autodetected") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_restart_dir",
        sizeof("passenger_restart_dir") - 1,
        "tmp",
        sizeof("tmp") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_abort_websockets_on_process_shutdown",
        sizeof("passenger_abort_websockets_on_process_shutdown") - 1,
        1);

    add_manifest_options_container_static_default_int(ctx,
        options_container,
        "passenger_force_max_concurrent_requests_per_process",
        sizeof("passenger_force_max_concurrent_requests_per_process") - 1,
        -1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_app_log_file",
        sizeof("passenger_app_log_file") - 1,
        "passenger_log_file",
        sizeof("passenger_log_file") - 1);

}

static void
set_manifest_autogenerated_loc_conf_defaults(manifest_gen_ctx_t *ctx, PsgJsonValue *options_container) {
    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_enabled",
        sizeof("passenger_enabled") - 1,
        0);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_max_requests",
        sizeof("passenger_max_requests") - 1,
        0);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_headers_hash_max_size",
        sizeof("passenger_headers_hash_max_size") - 1,
        512);

    add_manifest_options_container_static_default_uint(ctx,
        options_container,
        "passenger_headers_hash_bucket_size",
        sizeof("passenger_headers_hash_bucket_size") - 1,
        64);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_ignore_client_abort",
        sizeof("passenger_ignore_client_abort") - 1,
        0);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_buffer_response",
        sizeof("passenger_buffer_response") - 1,
        0);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_buffer_size",
        sizeof("passenger_buffer_size") - 1,
        "4k|8k",
        sizeof("4k|8k") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_buffers",
        sizeof("passenger_buffers") - 1,
        "8 4k|8k",
        sizeof("8 4k|8k") - 1);

    add_manifest_options_container_dynamic_default(ctx,
        options_container,
        "passenger_busy_buffers_size",
        sizeof("passenger_busy_buffers_size") - 1,
        "8k|16k",
        sizeof("8k|16k") - 1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_request_buffering",
        sizeof("passenger_request_buffering") - 1,
        1);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_intercept_errors",
        sizeof("passenger_intercept_errors") - 1,
        0);

    add_manifest_options_container_static_default_int(ctx,
        options_container,
        "passenger_request_queue_overflow_status_code",
        sizeof("passenger_request_queue_overflow_status_code") - 1,
        503);

    add_manifest_options_container_static_default_int(ctx,
        options_container,
        "passenger_spawn_exception_status_code",
        sizeof("passenger_spawn_exception_status_code") - 1,
        500);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_buffer_upload",
        sizeof("passenger_buffer_upload") - 1,
        0);

    add_manifest_options_container_static_default_bool(ctx,
        options_container,
        "passenger_sticky_sessions",
        sizeof("passenger_sticky_sessions") - 1,
        0);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_sticky_sessions_cookie_name",
        sizeof("passenger_sticky_sessions_cookie_name") - 1,
        "_passenger_route",
        sizeof("_passenger_route") - 1);

    add_manifest_options_container_static_default_str(ctx,
        options_container,
        "passenger_sticky_sessions_cookie_attributes",
        sizeof("passenger_sticky_sessions_cookie_attributes") - 1,
        "SameSite=Lax; Secure;",
        sizeof("SameSite=Lax; Secure;") - 1);

}


text:
package com.productfoundry.akka.cqrs.project

import com.productfoundry.akka.cqrs.publish.EventSubscriber

/**
 * Projects events onto a projection.
 */
trait Projector extends EventSubscriber with ProjectionUpdateHandler {

  /**
   * Uniquely identifies a projection created by the projector.
   */
  def projectionId: String

  /**
   * Default receive behavior.
   */
  override def receive: Receive = receivePublishedEvent

  /**
   * Partial function to handle published aggregate event records.
   */
  override def eventReceived: ReceiveEventRecord = project

  /**
   * Projects a single event record.
   */
  def project: ReceiveEventRecord

  /**
   * Handle a projected update.
   * @param update to handle.
   */
  override def handleProjectedUpdate(update: ProjectionUpdate): Unit = {}
}


text:
class GameScene : public Scene
{
public:
    GameScene() {};

    void Start() override;
    void Update(float dt) override;

private:

    float _mAngle = 0;
    float _mMarsAngle = 0;
};

#endif // GAMESCENE_H


text:
import { take, call, put, select, takeLatest } from 'redux-saga/effects';
// import { takeLatest } from 'redux-saga';
import { LOGIN_REQUEST } from './constants';
import {
  loginSuccess,
} from './actions';

import {
  authLogin,
} from '../../api';

export default function* watchLoginRequest() {
  yield takeLatest(LOGIN_REQUEST, fetchLogin);
}

function* fetchLogin(action) {
  console.log(action.data)
  try {
    const result = yield call(authLogin, action.data);
    yield put(loginSuccess(result));
  } catch (e) {
    console.log(e);
  }
}


text:
import * as $ from 'pandora-dollar';
import {MsgSendStrategyPayload, DEFAULT_LOGGER_CONFIG, RotationStrategy, ILogger, MsgHeartbeatPayload, HEARTBEAT_TIME, LoggerConfig, MsgReloadPayload, MsgPkg, MESSENGER_ACTION_SERVICE, SOCKET_FILE_NAME} from './domain';
import Path = require('path');
import assert = require('assert');
import {MessengerClient, default as Messenger} from 'pandora-messenger';
import {EnvironmentUtil} from 'pandora-env';
import {EggLogger} from 'egg-logger';
import {EventEmitter} from 'events';
import {EmitterTransport} from './EmitterTransport';

/**
 * Class LoggerManager
 */
export class LoggerManager extends EventEmitter {

  protected messengerClient: MessengerClient;
  protected loggerMap: Map<string, any> = new Map();
  protected envUtil = EnvironmentUtil.getInstance();

  connectRotator = false;
  constructor(options?: {
    connectRotator?: boolean;
    heartbeatTime?: number;
  }) {
    super();
    options = options || {};

    if(options.heartbeatTime) {
      this.heartbeatTime = options.heartbeatTime;
    }
    let isUnitTest = false;
    try {
      isUnitTest = this.envUtil.is('test');
    } catch(err) {
      // console.error(err);
    }
    options.connectRotator = !!(options.connectRotator && !isUnitTest && !process.env.DO_NOT_CONNECT_MONITOR && !process.env.PANDORA_DEV);

    if(options.connectRotator) {
      this.connectRotator = true;
      this.messengerClient = Messenger.getClient({
        name: SOCKET_FILE_NAME,
        unref: true,
        reConnectAtFirstTime: true
      });
      this.messengerClient.on(MESSENGER_ACTION_SERVICE, (message: MsgPkg) => {
        if(message.type === 'logger-reload') {
          const payload: MsgReloadPayload = <MsgReloadPayload> message.payload || {};
          const uuid = payload.uuid;
          this.reload(uuid);

          return;
        }
      });

      this.messengerClient.ready(() => {
        this.startHeartbeatWhile().catch((err) => {
          console.error(err);
        });
      });
    }
  }

  protected heartbeatTime: number = HEARTBEAT_TIME;
  protected async startHeartbeatWhile(): Promise<void> {
    while (true) {
      for(let uuid of this.loggerMap.keys()) {
        try {
          this.messengerClient.send(MESSENGER_ACTION_SERVICE, <MsgPkg> {
            type: 'logger-heartbeat',
            payload: <MsgHeartbeatPayload> {
              uuid: uuid
            }
          });
        } catch (err) {
          console.error(err);
        }
      }

      await new Promise((resolve) => {
        const timer = setTimeout(resolve, this.heartbeatTime);
        timer.unref();
      });

    }
  }

  public createLogger(loggerName, loggerConfig: LoggerConfig): ILogger {

    loggerConfig = Object.assign({}, DEFAULT_LOGGER_CONFIG, loggerConfig);

    const uuid = $.genereateUUID();
    const fileName = loggerConfig.name ? loggerConfig.name : loggerName + '.log';
    const filePath = Path.join(loggerConfig.dir, fileName);
    const newLogger = new EggLogger({
      file: filePath,
      level: loggerConfig.level,
      consoleLevel: loggerConfig.stdoutLevel,
      eol: loggerConfig.eol
    });
    newLogger.set('emitter', new EmitterTransport({
      level: loggerConfig.emitterLevel,
      eol: loggerConfig.eol,
      loggerName, fileName, filePath
    }, this));
    this.loggerMap.set(uuid, newLogger);
    this.sendRotationStrategy({
      uuid: uuid,
      file: filePath,
      type: loggerConfig.type,
      rotateDuration: loggerConfig.rotateDuration,
      maxFileSize: loggerConfig.maxFileSize,
      maxFiles: loggerConfig.maxFiles,
    });

    return newLogger;

  }

  protected sendRotationStrategy(strategy: RotationStrategy) {

    if(this.connectRotator) {
      this.messengerClient.ready(() => {
        this.messengerClient.send(MESSENGER_ACTION_SERVICE, <MsgPkg> {
          type: 'logger-send-strategy',
          payload: <MsgSendStrategyPayload> {
            strategy: strategy
          }
        });
      });
    }

  }

  protected reload(uuid?) {
    assert(!uuid || this.loggerMap.has(uuid), `Could not found logger uuid ${uuid}`);
    if(uuid) {
      const logger = this.loggerMap.get(uuid);
      logger.reload();
    } else {
      for( let logger of this.loggerMap.values() ) {
        logger.reload();
      }
    }
  }
}


text:
package com.gemstone.gemfire.admin.jmx.internal;

import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.modeler.AttributeInfo;
import org.apache.commons.modeler.OperationInfo;
import org.apache.commons.modeler.ManagedBean;

/**
 * Extends ManagedBean to allow for dynamically creating new instances of
 * ManagedBean based on an existing instance of ManagedBean.
 *
 * @author  Kirk Lund
 * @since 5.0.1
 */
public class DynamicManagedBean extends org.apache.commons.modeler.ManagedBean {
  private static final long serialVersionUID = 4051924500150228160L;

  public DynamicManagedBean(ManagedBean managed) {
    super();

    this.attributes = managed.getAttributes();
    this.className = managed.getClassName();
    this.constructors = managed.getConstructors();
    this.description = managed.getDescription();
    this.domain = managed.getDomain();
    this.group = managed.getGroup();
    this.name = managed.getName();
    this.fields = managed.getFields();
    this.notifications = managed.getNotifications();
    this.operations = managed.getOperations();
    this.type = managed.getType();

    /* we don't use modelerType and it's nice to remove it to keep the list of
       attributes cleaned up...*/
    removeAttribute("modelerType");
  }

  /**
   * Removes an attribute from this ManagedBean's attribute descriptor list.
   *
   * @param name the attribute to be removed
   */
  public void removeAttribute(String name) {
    if (name == null || name.length() < 1) {
      return;
    }
    synchronized (this.attributes) {
      List attributesList = new ArrayList(this.attributes.length);
      for (int i = 0; i < this.attributes.length; i++) {
        if (!name.equals(this.attributes[i].getName())) {
          attributesList.add(this.attributes[i]);
        }
      }
      this.attributes = (AttributeInfo[])
          attributesList.toArray(new AttributeInfo[attributesList.size()]);

      /* super.info should be nulled out anytime the structure is changed,
       * such as altering the attributes, operations, or notifications
       *
       * however super.info is private, so we need the following hack to cause
       * the super class to null it out for us...
       */
      setType(this.type); // causes this in super: "this.info = null;"
    }
  }

  /**
   * Removes the operation with the given name from thie
   * ManageBean's operation descriptor list.
   *
   * @since 4.0
   */
  public void removeOperation(String name) {
    if (name == null || name.length() < 1) {
      return;
    }

    synchronized (operations) {
      List operationsList = new ArrayList(this.operations.length);
      for (int i = 0; i < this.operations.length; i++) {
        if (!name.equals(this.operations[i].getName())) {
          operationsList.add(this.operations[i]);
        }
      }
      this.operations = (OperationInfo[])
          operationsList.toArray(new OperationInfo[operationsList.size()]);

      /* super.info should be nulled out anytime the structure is changed,
       * such as altering the operations, operations, or notifications
       *
       * however super.info is private, so we need the following hack to cause
       * the super class to null it out for us...
       */
      setType(this.type); // causes this in super: "this.info = null;"
    }
  }

  /**
   * Return a string representation of this managed bean.
   */
  @Override
  public String toString() {
    StringBuffer sb = new StringBuffer("DynamicManagedBean[");
    sb.append("name=");
    sb.append(name);
    sb.append(", className=");
    sb.append(className);
    sb.append(", description=");
    sb.append(description);
    if (group != null) {
      sb.append(", group=");
      sb.append(group);
    }
    sb.append(", type=");
    sb.append(type);
    sb.append(", attributes=");
    sb.append(Arrays.asList(attributes));
    sb.append("]");
    return (sb.toString());
  }
}


text:
package de.dpunkt.myaktion.monitor.ws;

import de.dpunkt.myaktion.model.Donation;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for sendDonation complex type.
 *

 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <complexType name="sendDonation">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="arg0" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         <element name="arg1" type="{http://ws.monitor.myaktion.dpunkt.de/}donation" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sendDonation", propOrder = {
        "arg0",
        "arg1"
})
public class SendDonation {

    protected Long arg0;
    protected Donation arg1;

    /**
     * Gets the value of the arg0 property.
     *
     * @return possible object is
     * {@link Long }
     */
    public Long getArg0() {
        return arg0;
    }

    /**
     * Sets the value of the arg0 property.
     *
     * @param value allowed object is
     *              {@link Long }
     */
    public void setArg0(Long value) {
        this.arg0 = value;
    }

    /**
     * Gets the value of the arg1 property.
     *
     * @return possible object is
     * {@link Donation }
     */
    public Donation getArg1() {
        return arg1;
    }

    /**
     * Sets the value of the arg1 property.
     *
     * @param value allowed object is
     *              {@link Donation }
     */
    public void setArg1(Donation value) {
        this.arg1 = value;
    }

}


text:
<?php

use yii\helpers\Html;
use digi\metronic\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model common\models\Tree */
/* @var $form digi\metronic\widgets\ActiveForm */
?>

<?php $form = ActiveForm::begin(); ?>

Note:  fields marked with asterisk (*) are required.

    <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'slug')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'link')->textInput(['maxlength' => 255]) ?>

    <?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>

    <?php if ($this->context->id == 'tree') { ?>

        <?= $form->field($model, 'root')->textInput() ?>

        <?= $form->field($model, 'lft')->textInput() ?>

        <?= $form->field($model, 'rgt')->textInput() ?>

        <?= $form->field($model, 'lvl')->textInput() ?>

        <?= $form->field($model, 'icon')->textInput(['maxlength' => 255]) ?>

        <?= $form->field($model, 'icon_type')->textInput() ?>

        <?= $form->field($model, 'active')->textInput() ?>

        <?= $form->field($model, 'selected')->textInput() ?>

        <?= $form->field($model, 'disabled')->textInput() ?>

        <?= $form->field($model, 'readonly')->textInput() ?>

        <?= $form->field($model, 'visible')->textInput() ?>

        <?= $form->field($model, 'collapsed')->textInput() ?>

        <?= $form->field($model, 'movable_u')->textInput() ?>

        <?= $form->field($model, 'movable_d')->textInput() ?>

        <?= $form->field($model, 'movable_l')->textInput() ?>

        <?= $form->field($model, 'movable_r')->textInput() ?>

        <?= $form->field($model, 'removable')->textInput() ?>

        <?= $form->field($model, 'removable_all')->textInput() ?>
    <?php } ?>

            <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => 'btn green']) ?>
            <?= Html::resetButton('Reset', ['class' => 'btn default']) ?>

<?php ActiveForm::end(); ?>


text:
package datasafer.backup;

import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import datasafer.backup.dao.PermissaoDao;
import datasafer.backup.dao.utility.Carregador;
import datasafer.backup.dao.utility.Modificador;
import datasafer.backup.model.Backup;
import datasafer.backup.model.Estacao;
import datasafer.backup.model.Operacao;
import datasafer.backup.model.Permissao;
import datasafer.backup.model.Usuario;

@Service
public class Inicializador {

	@Autowired
	private Modificador modificador;
	@Autowired
	private Carregador carregador;

	@Autowired
	private PermissaoDao permissaoDao;

	@PostConstruct
	private void popula() throws NoSuchFieldException {

		System.out.println("==== Inicializando ====");
		Usuario usuario_admin = carregador.obtemEntidade(Usuario.class, "login", "admin");
		if (usuario_admin == null) {
			usuario_admin = new Usuario();

			usuario_admin.setArmazenamento(0L);
			usuario_admin.setLogin("admin");
			usuario_admin.setNome("Administrador");
			usuario_admin.setEmail("admin@admin.com");
			usuario_admin.setSenha("admin");
			usuario_admin.setAtivo(true);

			try {
				modificador.insere(null, null, null, "usuarios", usuario_admin);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		populaUsuarios(null, usuario_admin);
	}

	public void populaUsuarios(	Usuario solicitante,
								Usuario superior) throws NoSuchFieldException {

		System.out.println(" ==== POPULA ==== ");

		for (String nome : Arrays.asList(	"Giovanni Campaner",
											"Henrique Francisco da Silva",
											"Sheila Barreto",
											"Fellipe Thufik Costa",
											"Felipe Lemes Discher",
											"Hugo Henrique")) {
			List<String> nomes = Arrays.asList(nome	.toLowerCase()
													.split(" "));
			String login = nomes.get(0);
			for (int i = 1; i < nomes.size(); i++) {
				login += nomes	.get(i)
								.charAt(0);
			}

			Usuario usuario = carregador.obtemEntidade(Usuario.class, "login", login);
			if (usuario == null) {
				usuario = new Usuario();
				usuario.setNome(nome);
				usuario.setEmail(login + "@gmail.com");
				usuario.setArmazenamento(10000000L);
				usuario.setLogin(login);
				usuario.setSenha(login);
				usuario.setAtivo(true);

				usuario.setProprietario(superior);

				try {
					modificador.insere(solicitante, superior, superior, "usuarios", usuario);

					permissaoDao.inserirPermissao(usuario, new Permissao(solicitante, superior, null, Permissao.Tipo.VISUALIZAR, true));
					permissaoDao.inserirPermissao(usuario, new Permissao(solicitante, superior, null, Permissao.Tipo.EDITAR, true));
					permissaoDao.inserirPermissao(usuario, new Permissao(solicitante, superior, null, Permissao.Tipo.INSERIR, true));
					permissaoDao.inserirPermissao(usuario, new Permissao(solicitante, superior, null, Permissao.Tipo.REMOVER, true));
				} catch (Exception e) {
					e.printStackTrace();
				}
				// permissaoDao.inserirPermissao(superior, new
				// Permissao(solicitante, usuario, null,
				// Permissao.Tipo.VISUALIZAR, false));
				// permissaoDao.inserirPermissao(superior, new
				// Permissao(solicitante, usuario, null, Permissao.Tipo.EDITAR,
				// false));
				// permissaoDao.inserirPermissao(superior, new
				// Permissao(solicitante, usuario, null, Permissao.Tipo.INSERIR,
				// false));
				// permissaoDao.inserirPermissao(superior, new
				// Permissao(solicitante, usuario, null, Permissao.Tipo.REMOVER,
				// false));

				populaEstacoes(solicitante, usuario);
			}
		}
	}

	public void populaEstacoes(	Usuario solicitante,
								Usuario gerenciador) throws NoSuchFieldException {

		List<String> tiposDispositivos = Arrays.asList("PC", "Desktop", "Computador", "Notebook", "Netbook", "Laptop");
		List<String> nomesDispositivos = Arrays.asList("Trabalho", "Escola", "Casa", "Escritório", "Banheiro", "Quarto", "Sala");
		List<String> separadores = Arrays.asList("-", "_", ".", " ");

		Random gerador = new Random();

		for (int n = gerador.nextInt(5) + 5; n > 0; n--) {
			int tipo_index = gerador.nextInt(tiposDispositivos.size());
			int nome_index = gerador.nextInt(nomesDispositivos.size());
			int separador_index = gerador.nextInt(separadores.size());

			String nome_estacao = tiposDispositivos.get(tipo_index) + separadores.get(separador_index) + nomesDispositivos.get(nome_index);

			Estacao estacao = carregador.obtemEntidade(Estacao.class, "nome", nome_estacao);
			if (estacao == null) {
				estacao = new Estacao();
				estacao.setNome(nome_estacao);

				try {
					modificador.insere(solicitante, gerenciador, gerenciador, "estacoes", estacao);
				} catch (Exception e) {
					e.printStackTrace();
				}

				populaBackups(solicitante, gerenciador, estacao);
			}
		}
	}

	public void populaBackups(	Usuario solicitante,
								Usuario proprietario,
								Estacao estacao) throws NoSuchFieldException {

		List<String> nomes_backups = Arrays.asList(	"Meus arquivos",
													"Minhas fotos",
													"Arquivos",
													"Fotos",
													"Imagens",
													"Meus videos",
													"Videos",
													"Midia",
													"Programas",
													"Importante",
													"Coisas importantes",
													"Arquivos importantes",
													"Software",
													"Banco de dados",
													"DB",
													"Apresentações",
													"Planilhas",
													"Planilhas importantes");

		Random gerador = new Random();

		for (int n = gerador.nextInt(5) + 5; n > 0; n--) {
			String nomeBackup = nomes_backups.get(gerador.nextInt(nomes_backups.size()));

			Backup backup = carregador.obtemEntidade(Backup.class, "proprietario", proprietario, "estacao", estacao, "nome", nomeBackup);
			if (backup == null) {
				backup = new Backup();
				backup.setNome(nomeBackup);

				backup.setIntervalo(new Long(gerador.nextInt(1000000)));

				backup.setInicio(Timestamp.from(LocalDateTime	.now().plusDays(gerador.nextInt(60))
																.toInstant(ZoneOffset.UTC)));
				backup.setPasta("C:\\" + nomeBackup	.toLowerCase()
													.replace(' ', '_'));

				try {
					modificador.insere(solicitante, proprietario, estacao, "backups", backup);
				} catch (Exception e) {
					e.printStackTrace();
				}

				populaOperacoes(solicitante, proprietario, estacao, backup);
			}
		}
	}

	public void populaOperacoes(Usuario solicitante,
								Usuario proprietario,
								Estacao estacao,
								Backup backup) {

		Random gerador = new Random();

		for (int n = gerador.nextInt(10) + 5; n > 0; n--) {

			Operacao operacao = new Operacao();
			operacao.setData(Timestamp.from(LocalDateTime	.now().plusDays(gerador.nextInt(365))
															.toInstant(ZoneOffset.UTC)));
			operacao.setStatus(Operacao.Status.values()[gerador.nextInt(Operacao.Status.values().length)]);
			operacao.setTamanho((long) gerador.nextInt(10000000));

			try {
				modificador.insere(solicitante, null, backup, "operacoes", operacao);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

	}

}