text:
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Management.Monitor.Management.Models;
using System;
using System.Collections.Generic;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Insights.Autoscale
{
    /// <summary>
    /// Create an autoscale profile
    /// </summary>
    [Cmdlet(VerbsCommon.New, "AzureRmAutoscaleProfile"), OutputType(typeof(AutoscaleProfile))]
    public class NewAzureRmAutoscaleProfileCommand : MonitorCmdletBase
    {
        private const string AddAutoscaleProfileNoScheduleParamGroup = "CreateWithoutScheduledTimes";
        private const string AddAutoscaleProfileFixDateParamGroup = "CreateWithFixedDateScheduling";
        private const string AddAutoscaleProfileRecurrenceParamGroup = "CreateUsingRecurrentScheduling";

        #region Cmdlet parameters

        /// <summary>
        /// Gets or sets the name
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileNoScheduleParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the profile")]
        [ValidateNotNullOrEmpty]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the default capacity
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileNoScheduleParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The default capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The default capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The default capacity for the profile")]
        [ValidateNotNullOrEmpty]
        public string DefaultCapacity { get; set; }

        /// <summary>
        /// Gets or sets the maximum capacity
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileNoScheduleParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The maximum capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The maximum capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The maximum capacity for the profile")]
        [ValidateNotNullOrEmpty]
        public string MaximumCapacity { get; set; }

        /// <summary>
        /// Gets or sets the minimum capacity
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileNoScheduleParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The minimum capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The minimum capacity for the profile")]
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The minimum capacity for the profile")]
        [ValidateNotNullOrEmpty]
        public string MinimumCapacity { get; set; }

        /// <summary>
        /// Gets or sets the start of the time window
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The start time for the schedule")]
        public DateTime StartTimeWindow { get; set; }

        /// <summary>
        /// Gets or sets the end of the time window
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The end time for the schedule")]
        public DateTime EndTimeWindow { get; set; }

        /// <summary>
        /// Gets or sets the timezone of the time window
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The time zone time for the schedule")]
        [ValidateNotNullOrEmpty]
        public string TimeWindowTimeZone { get; set; }

        /// <summary>
        /// Gets or sets the recurrence frequency
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The recurrence frequency for the setting")]
        public RecurrenceFrequency RecurrenceFrequency { get; set; }

        /// <summary>
        /// Gets or sets the ScheduleDays
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule days for the recurrence")]
        [ValidateNotNull]
        [Alias("ScheduleDays")]
        public List<string> ScheduleDay { get; set; }

        /// <summary>
        /// Gets or sets the ScheduleHours
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule hours for the recurrence")]
        [ValidateNotNull]
        [Alias("ScheduleHours")]
        public List<int?> ScheduleHour { get; set; }

        /// <summary>
        /// Gets or sets the ScheduleMinutes
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule minutes for the recurrence")]
        [ValidateNotNull]
        [Alias("ScheduleMinutes")]
        public List<int?> ScheduleMinute { get; set; }

        /// <summary>
        /// Gets or sets the ScheduleTimeZone
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule timezone for the recurrence")]
        public string ScheduleTimeZone { get; set; }

        /// <summary>
        /// Gets or sets the Rules
        /// </summary>
        [Parameter(ParameterSetName = AddAutoscaleProfileNoScheduleParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The rules for the setting")]
        [Parameter(ParameterSetName = AddAutoscaleProfileFixDateParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The rules for the setting")]
        [Parameter(ParameterSetName = AddAutoscaleProfileRecurrenceParamGroup, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The rules for the setting")]
        [ValidateNotNullOrEmpty]
        [Alias("Rules")]
        public List<ScaleRule> Rule { get; set; }

        #endregion

        /// <summary>
        /// Executes the Cmdlet. This is a callback function to simplify the exception handling
        /// </summary>
        protected override void ProcessRecordInternal()
        { }

        /// <summary>
        /// Execute the cmdlet
        /// </summary>
        public override void ExecuteCmdlet()
        {
            this.WriteIdentifiedWarning(
                cmdletName: "New-AzureRmAutoscaleProfile",
                topic: "Parameter name change",
                message: "The parameter plural names for the parameters will be deprecated in a future breaking change release in favor of the singular versions of the same names.");
            AutoscaleProfile profile = this.CreateSettingProfile();
            WriteObject(profile);
        }

        /// <summary>
        /// Create an autoscale profile based on the properties of the object
        /// </summary>
        /// <returns>An autoscale profile based on the properties of the object</returns>
        public AutoscaleProfile CreateSettingProfile()
        {
            return new AutoscaleProfile
            {
                Name = this.Name ?? string.Empty,
                Capacity = new ScaleCapacity()
                {
                    DefaultProperty = this.DefaultCapacity,
                    Minimum = this.MinimumCapacity,
                    Maximum = this.MaximumCapacity,
                },

                // NOTE: "always" is specify by a null value in the FixedDate value with null ScheduledDays(Minutes, Seconds)
                // Premise: Fixed date schedule and recurrence are mutually exclusive, but they can both be missing so that the rule is always enabled.
                // Assuming dates are validated by the server
                FixedDate = this.ScheduleDay == null && (this.StartTimeWindow != default(DateTime) || this.EndTimeWindow != default(DateTime))
                        ? new TimeWindow()
                        {
                            Start = this.StartTimeWindow,
                            End = this.EndTimeWindow,
                            TimeZone = this.TimeWindowTimeZone,
                        }
                        : null,
                Recurrence = this.ScheduleDay != null ? this.CreateAutoscaleRecurrence() : null,
                Rules = this.Rule,
            };
        }

        /// <summary>
        /// Create a Recurrence based on the properties of this object
        /// </summary>
        /// <returns>A Recurrence created based on the properties of this object</returns>
        public Recurrence CreateAutoscaleRecurrence()
        {
            return new Recurrence()
            {
                Frequency = this.RecurrenceFrequency,
                Schedule = this.CreateRecurrentSchedule()
            };
        }

        private RecurrentSchedule CreateRecurrentSchedule()
        {
            // Assuming validation is done by the server
            return new RecurrentSchedule()
            {
                Days = this.ScheduleDay,

                Hours = this.ScheduleHour,
                Minutes = this.ScheduleMinute,
                TimeZone = this.ScheduleTimeZone,
            };
        }
    }
}


text:
package t1000647

package object foo {
  implicit def scala2ActorRef(ref: ScalaActorRef): ActorRef =
    ref.asInstanceOf[ActorRef]
}

redpajama_set_name: RedPajamaGithub


text:
author: miky
comments: true
date: 2009-12-22 18:39:17+00:00
layout: post
slug: canonrobo
title: Canon…¿robo?
categories: day-by-day
---

Un buen día te encuentras haciendo un presupuesto porque alguna criatura de la naturaleza ha decidido acabar con un lector de DVD. Así que habrá que repararlo, o mejor dicho, comprar otro. Y te encuentras en una tesitura similar a la siguiente:

  * Lector/Grabador de DVD interno: 16€

  * IVA: 2,5€

  * Canon: 3,4€

Algo no funciona aquí. ¿Me están diciendo que tengo que pagar por una unidad lectora de DVD 3,4€ (lo que supone un 21% del aparato) por si acaso lo utilizamos para grabar CDs de Ramoncín? Por si no lo había comentado, la unidad servirá para que pequeños de 3 años empiecen a utilizar los ordenadores con juegos (¡originales!) educativos.

No niego que seguramente se necesite regular la sociedad de la información en el aspecto de los derechos intelectuales, pero desde luego, ESTA NO ES LA FORMA. ¿Dónde reclamo el dinero? ¿Ahora que he pagado puedo utilizar el lector para instruir a mi pequeña banda de 3añeros piratillas de forma totalmente legal?


text:
const int MAXDATA = 65534;

int main(int argc, char *argv[]) {

    unsigned short echoServPort = 12345;

    try {
        UDPSocket sock(echoServPort);
        uint8_t data[MAXDATA];
        string sourceAddress;              // Address of datagram source
        unsigned short sourcePort;         // Port of datagram source
        int bytesRcvd = sock.recvFrom(data, MAXDATA, sourceAddress, sourcePort);
        while(bytesRcvd > 0) {
            ByteBuffer buffer(data, bytesRcvd);
            int count = buffer.readInt();
            printf("Received buffer with %d properties\n", count);
            for (int n = 0; n < count; n++) {
                string name = buffer.readString();
                string value = buffer.readString();
                printf("%s=%s\n", name.c_str(), value.c_str());
            }
            bytesRcvd = sock.recvFrom(data, MAXDATA, sourceAddress, sourcePort);
        }
    } catch (SocketException &e) {
        cerr << e.what() << endl;
        exit(1);
    }

    return 0;
}


text:
Typeaheads typeahead.js

    mgcrea.ngStrap.typeahead

Examples

Add quick, dynamic typeahead functionality with any form text input.

Plugin dependency

Selects require the tooltip module and parseOptions helper module to be loaded.

Live demo

$scope.selectedState = "{{selectedState}}";
$scope.states = {{states}};

$scope.selectedIcon = "{{selectedIcon}}";
$scope.icons = "{{icons}}";

$scope.selectedAddress = "{{selectedAddress}}";

    <form class="form-inline" role="form">

         State
        <input type="text" class="form-control" ng-model="selectedState" bs-options="state for state in states" placeholder="Enter state" bs-typeahead>

        Icon
        <input type="text" class="form-control" ng-model="selectedIcon" data-min-length="0" data-html="1" data-auto-select="true" data-animation="am-flip-x" bs-options="icon as icon.label for icon in icons" placeholder="Enter icon" bs-typeahead>

         Address (async via maps.googleapis.com)
        <input type="text" class="form-control" ng-model="selectedAddress" data-animation="am-flip-x" bs-options="address.formatted_address as address.formatted_address for address in getAddress($viewValue)" placeholder="Enter address" bs-typeahead>

    </form>

Usage

Append a bs-typeaheadattribute to any element to enable the directive.

Available items are specified using the bs-options attribute. This attribute uses AngularJS ngOptions array data source syntax.

Breaking Change

If you are using AngularStrap prior to version 2.2.0, please use ng-options instead of bs-options.

The module exposes a $typeaheadservice

Available for programmatic use (mainly in directives as it requires a DOM element).

          var myTypeahead = $typeahead(element, {controller: someModelController});

Options

Options can be passed via data-attributes on the directive or as an object hash to configure the service. For data attributes, append the option name to data-, as in data-animation="".

This module supports exotic placement options!

You can position your typeahead in corners (such as bottom-left) or any other combination two.

Exotic placement options are not part of the Bootstrap's core, to use them you must use bootstrap-additions.css from the BootstrapAdditions project. This project being not yet fully released, meanwhile, you can use the development snapshot compiled for theses docs.

          Name
          type
          default
          description

          animation
          string
          am-fade
          apply a CSS animation powered by ngAnimate

          placement
          string
          'bottom-left'

            how to position the typeahead - top | bottom | left | right | auto, or any combination like bottom-left or auto bottom-left.

            When "auto" is specified, it will dynamically reorient the typeahead. For example, if placement is "auto left", the typeahead will display to the left when possible, otherwise it will display right.

          trigger
          string
          'focus'
          how typeahead is triggered - click | hover | focus | manual

          html
          boolean
          false
          replace ng-bind with ng-bind-html, requires ngSanitize to be loaded

          delay
          number | object
          0

delay showing and hiding the typeahead (ms) - does not apply to manual trigger type

If a number is supplied, delay is applied to both hide/show

Object structure is:
              delay: { show: 500, hide: 100 }

          container
          string | false
          false

Appends the typeahead to a specific element. Example:
              container: 'body'. This option is particularly useful in that it allows you to position the typeahead in the flow of the document near the triggering element - which will prevent the typeahead from floating away from the triggering element during a window resize.

          template
          path | id
          '$typeahead'

If provided, overrides the default template, can be either a remote URL or a cached template id.

          limit
          number
          6

The max number of items to display in the dropdown.

          minLength
          number
          1

The minimum character length needed before triggering autocomplete suggestions.

          autoSelect
          boolean
          false

Whether or not the first match will automatically be selected upon typing.

          comparator
          string
          ''

The name of the comparator function which is used in determining a match.

          id
          string
          ''

            The typeahead instance id for usage in event handlers.

          watchOptions
          boolean
          false

            Whether or not the suggestions collection should be watched for changes.

          trimValue
          boolean
          true

            If provided and set to false, overrides the default behavior of automatically trimming spaces from inputs. (Added in 2.2.4)

Default options

You can override global defaults for the plugin with $typeaheadProvider.defaults

          angular.module('myApp')
          .config(function($typeaheadProvider) {
            angular.extend($typeaheadProvider.defaults, {
              animation: 'am-flip-x',
              minLength: 2,
              limit: 8
            });
          })


text:
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const ink_1 = require("ink");
const ink_link_1 = __importDefault(require("ink-link"));
const ink_spinner_1 = __importDefault(require("ink-spinner"));
const config_1 = require("../config");
const fs = __importStar(require("fs"));
const util_1 = require("util");
const api_1 = require("../api");
const gen_1 = require("../../generators/gen");
const templates_1 = require("../../templates");
const path_1 = require("path");
const package_json_1 = require("../../../package.json");
const index_1 = require("../index");
const error_1 = require("./error");
const figures_1 = __importDefault(require("figures"));
const init_1 = require("./init");
const readFile = util_1.promisify(fs.readFile);
const readdir = util_1.promisify(fs.readdir);
const writeFile = util_1.promisify(fs.writeFile);
const unlink = util_1.promisify(fs.unlink);
var Steps;
(function (Steps) {
    Steps[Steps["UpdatePlan"] = 0] = "UpdatePlan";
    Steps[Steps["ClearFiles"] = 1] = "ClearFiles";
    Steps[Steps["Generation"] = 2] = "Generation";
    Steps[Steps["After"] = 3] = "After";
    Steps[Steps["Done"] = 4] = "Done";
})(Steps || (Steps = {}));
exports.Build = ({ config: currentConfig, configPath, production, update, anonymousId, analyticsProps, onDone, }) => {
    const [step, setStep] = react_1.useState(Steps.UpdatePlan);
    const [trackingPlans, setTrackingPlans] = react_1.useState([]);
    const [config, setConfig] = react_1.useState(currentConfig);
    const { exit } = ink_1.useApp();
    const onNext = () => setStep(step + 1);
    function withNextStep(f) {
        return (arg) => {
            f(arg);
            setStep(step + 1);
        };
    }
    react_1.useEffect(() => {
        if (step === Steps.Done) {
            onDone ? onDone() : exit();
        }
    }, [step]);
    // If a typewriter.yml hasn't been configured yet, drop the user into the init wizard.
    if (!config) {
        return (react_1.default.createElement(init_1.Init, { config: config, configPath: configPath, onDone: setConfig, anonymousId: anonymousId, analyticsProps: analyticsProps }));
    }
    return (react_1.default.createElement(ink_1.Box, { marginBottom: 1, marginTop: 1, flexDirection: "column" },
        react_1.default.createElement(exports.UpdatePlanStep, { config: config, configPath: configPath, update: update, step: step, onDone: withNextStep(setTrackingPlans) }),
        react_1.default.createElement(exports.ClearFilesStep, { config: config, configPath: configPath, step: step, onDone: onNext }),
        react_1.default.createElement(exports.GenerationStep, { config: config, configPath: configPath, production: production, trackingPlans: trackingPlans, step: step, onDone: onNext }),
        react_1.default.createElement(exports.AfterStep, { config: config, configPath: configPath, step: step, onDone: onNext })));
};
// Load a Tracking Plan, either from the API or from the `plan.json` file.
exports.UpdatePlanStep = ({ config, configPath, update, step, onDone, }) => {
    const [trackingPlans, setTrackingPlans] = react_1.useState([]);
    // The various warning states we enter while loading Tracking Plans:
    const [failedToFindToken, setFailedToFindToken] = react_1.useState(false);
    const [fellbackToUpdate, setFellbackToUpdate] = react_1.useState(false);
    const [apiError, setAPIError] = react_1.useState();
    const { handleFatalError, handleError } = react_1.useContext(error_1.ErrorContext);
    const { isRunning, isDone } = useStep(step, Steps.UpdatePlan, loadTrackingPlans, onDone);
    function loadTrackingPlans() {
        return __awaiter(this, void 0, void 0, function* () {
            const loadedTrackingPlans = [];
            for (const trackingPlanConfig of config.trackingPlans) {
                // Load the local copy of this Tracking Plan, we'll either use this for generation
                // or use it to identify what changed with the latest copy of this Tracking Plan.
                const previousTrackingPlan = yield api_1.loadTrackingPlan(configPath, trackingPlanConfig);
                // If we don't have a copy of the Tracking Plan, then we would fatal error. Instead,
                // fallback to pulling down a new copy of the Tracking Plan.
                if (!update && !previousTrackingPlan) {
                    setFellbackToUpdate(true);
                }
                // If we are pulling the latest Tracking Plan (npx typewriter), or if there is no local
                // copy of the Tracking Plan (plan.json), then query the API for the latest Tracking Plan.
                let newTrackingPlan = undefined;
                if (update || !previousTrackingPlan) {
                    // Attempt to read a token and use it to update the local Tracking Plan to the latest version.
                    const token = yield config_1.getToken(config, configPath);
                    if (token) {
                        try {
                            newTrackingPlan = yield api_1.fetchTrackingPlan({
                                id: trackingPlanConfig.id,
                                workspaceSlug: trackingPlanConfig.workspaceSlug,
                                token,
                            });
                        }
                        catch (error) {
                            handleError(error);
                            if (error_1.isWrappedError(error)) {
                                setAPIError(error.description);
                            }
                            else {
                                setAPIError('API request failed');
                            }
                        }
                        if (newTrackingPlan) {
                            // Update plan.json with the latest Tracking Plan.
                            yield api_1.writeTrackingPlan(configPath, newTrackingPlan, trackingPlanConfig);
                        }
                    }
                    else {
                        setFailedToFindToken(true);
                    }
                }
                newTrackingPlan = newTrackingPlan || previousTrackingPlan;
                if (!newTrackingPlan) {
                    handleFatalError(error_1.wrapError('Unable to fetch Tracking Plan from local cache or API'));
                    return null;
                }
                const { events } = newTrackingPlan.rules;
                const trackingPlan = {
                    name: newTrackingPlan.display_name,
                    url: api_1.toTrackingPlanURL(newTrackingPlan.name),
                    path: trackingPlanConfig.path,
                    trackCalls: events
                        // Typewriter doesn't yet support event versioning. For now, we just choose the most recent version.
                        .filter(e => events.every(e2 => e.name !== e2.name || e.version >= e2.version))
                        .map(e => (Object.assign({}, e.rules, { title: e.name, description: e.description }))),
                };
                loadedTrackingPlans.push({
                    trackingPlan,
                    deltas: api_1.computeDelta(previousTrackingPlan, newTrackingPlan),
                });
                setTrackingPlans(loadedTrackingPlans);
            }
            return loadedTrackingPlans.map(({ trackingPlan }) => trackingPlan);
        });
    }
    const s = config.trackingPlans.length > 1 ? 's' : '';
    const stepName = isDone ? `Loaded Tracking Plan${s}` : `Loading Tracking Plan${s}...`;
    return (react_1.default.createElement(Step, { name: stepName, isRunning: isRunning, isDone: isDone },
        update && react_1.default.createElement(Note, null,
            "Downloading the latest version",
            s,
            " from Segment..."),
        fellbackToUpdate && (react_1.default.createElement(Note, { isWarning: true }, "No local copy of this Tracking Plan, fetching from API.")),
        failedToFindToken && (react_1.default.createElement(Note, { isWarning: true },
            "No valid API token, using local ",
            s ? 'copies' : 'copy',
            " instead.")),
        !!apiError && (react_1.default.createElement(Note, { isWarning: true },
            apiError,
            ". Using local ",
            s ? 'copies' : 'copy',
            " instead.")),
        trackingPlans.map(({ trackingPlan, deltas }) => (react_1.default.createElement(ink_1.Box, { flexDirection: "column", key: trackingPlan.url },
            react_1.default.createElement(Note, null,
                "Loaded ",
                react_1.default.createElement(ink_link_1.default, { url: trackingPlan.url }, trackingPlan.name),
                ' ',
                (deltas.added !== 0 || deltas.modified !== 0 || deltas.removed !== 0) && (react_1.default.createElement(react_1.default.Fragment, null,
                    "(",
                    react_1.default.createElement(ink_1.Color, { grey: deltas.added === 0, green: deltas.added > 0 },
                        deltas.added,
                        " added"),
                    ",",
                    ' ',
                    react_1.default.createElement(ink_1.Color, { grey: deltas.modified === 0, yellow: deltas.modified > 0 },
                        deltas.modified,
                        " modified"),
                    ",",
                    ' ',
                    react_1.default.createElement(ink_1.Color, { grey: deltas.removed === 0, red: deltas.removed > 0 },
                        deltas.removed,
                        " removed"),
                    ")"))))))));
};
exports.ClearFilesStep = ({ config, configPath, step, onDone }) => {
    const { handleFatalError } = react_1.useContext(error_1.ErrorContext);
    const { isRunning, isDone } = useStep(step, Steps.ClearFiles, clearGeneratedFiles, onDone);
    function clearGeneratedFiles() {
        return __awaiter(this, void 0, void 0, function* () {
            const errors = yield Promise.all(config.trackingPlans.map((trackingPlanConfig) => __awaiter(this, void 0, void 0, function* () {
                const path = config_1.resolveRelativePath(configPath, trackingPlanConfig.path);
                yield config_1.verifyDirectoryExists(path);
                try {
                    yield clearFolder(path);
                }
                catch (error) {
                    return error_1.wrapError('Failed to clear generated files', error, `Failed on: '${trackingPlanConfig.path}'`, error.message);
                }
            })));
            const error = errors.find(error => error_1.isWrappedError(error));
            if (error) {
                handleFatalError(error);
                return null;
            }
        });
    }
    // clearFolder removes all typewriter-generated files from the specified folder
    // except for a plan.json.
    // It uses a simple heuristic to avoid accidentally clobbering a user's files --
    // it only clears files with the "this file was autogenerated by Typewriter" warning.
    // Therefore, all generators need to output that warning in a comment in the first few
    // lines of every generated file.
    function clearFolder(path) {
        return __awaiter(this, void 0, void 0, function* () {
            const fileNames = yield readdir(path, 'utf-8');
            for (let fileName of fileNames) {
                const fullPath = path_1.join(path, fileName);
                try {
                    const contents = yield readFile(fullPath, 'utf-8');
                    if (contents.includes(templates_1.SEGMENT_AUTOGENERATED_FILE_WARNING)) {
                        yield unlink(fullPath);
                    }
                }
                catch (error) {
                    // Note: none of our generators produce folders, but if we ever do, then we'll need to
                    // update this logic to handle recursively traversing directores. For now, we just ignore
                    // any directories.
                    if (error.code !== 'EISDIR') {
                        throw error;
                    }
                }
            }
        });
    }
    const stepName = isDone ? 'Removed generated files' : 'Removing generated files...';
    return react_1.default.createElement(Step, { name: stepName, isRunning: isRunning, isDone: isDone });
};
exports.GenerationStep = ({ config, configPath, production, trackingPlans, step, onDone, }) => {
    const { isRunning, isDone } = useStep(step, Steps.Generation, generate, onDone);
    function generate() {
        return __awaiter(this, void 0, void 0, function* () {
            for (const trackingPlan of trackingPlans) {
                // Generate the client:
                const files = yield gen_1.gen(trackingPlan, {
                    client: config.client,
                    typewriterVersion: package_json_1.version,
                    isDevelopment: !production,
                });
                // Write it out to the specified directory:
                for (var file of files) {
                    const path = config_1.resolveRelativePath(configPath, trackingPlan.path, file.path);
                    yield config_1.verifyDirectoryExists(path, 'file');
                    yield writeFile(path, file.contents, {
                        encoding: 'utf-8',
                    });
                }
            }
        });
    }
    const s = config.trackingPlans.length > 1 ? 's' : '';
    const stepName = isDone ? `Generated client${s}` : `Generating client${s}...`;
    return (react_1.default.createElement(Step, { name: stepName, isRunning: isRunning, isDone: isDone },
        react_1.default.createElement(Note, null,
            "Building for ",
            production ? 'production' : 'development'),
        trackingPlans.map(trackingPlan => (react_1.default.createElement(Note, { key: trackingPlan.url },
            react_1.default.createElement(ink_link_1.default, { url: trackingPlan.url }, trackingPlan.name))))));
};
exports.AfterStep = ({ config, configPath, step, onDone }) => {
    const { handleError } = react_1.useContext(error_1.ErrorContext);
    const [error, setError] = react_1.useState();
    const { isRunning, isDone } = useStep(step, Steps.After, after, onDone);
    const afterScript = config.scripts ? config.scripts.after : undefined;
    function after() {
        return __awaiter(this, void 0, void 0, function* () {
            if (afterScript) {
                try {
                    yield config_1.runScript(afterScript, configPath, config_1.Scripts.After);
                }
                catch (error) {
                    if (error_1.isWrappedError(error)) {
                        handleError(error);
                        setError(error);
                    }
                    else {
                        throw error;
                    }
                }
            }
        });
    }
    const stepName = isDone ? 'Cleaned up' : 'Running clean up script...';
    return (react_1.default.createElement(Step, { name: stepName, isRunning: isRunning, isDone: isDone, isSkipped: !afterScript },
        afterScript && react_1.default.createElement(Note, null, afterScript),
        error && (react_1.default.createElement(react_1.default.Fragment, null,
            react_1.default.createElement(Note, { isWarning: true }, error.description),
            error.notes
                .filter(n => !!n)
                .map(n => (react_1.default.createElement(Note, { isWarning: true, key: n }, n)))))));
};
function useStep(step, thisStep, f, onDone) {
    const { handleFatalError } = react_1.useContext(error_1.ErrorContext);
    const isRunning = step === thisStep;
    function runStep() {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                const result = yield f();
                // If a fatal error occurred, return null to skip any further updates to this component.
                if (result !== null) {
                    onDone(result);
                }
            }
            catch (error) {
                handleFatalError(error_1.toUnexpectedError(error));
            }
        });
    }
    react_1.useEffect(() => {
        if (isRunning) {
            runStep();
        }
    }, [isRunning]);
    return {
        isRunning,
        isDone: step > thisStep,
    };
}
const Step = ({ name, isSkipped, isRunning, isDone, children }) => {
    const { debug } = react_1.useContext(index_1.DebugContext);
    if (isSkipped) {
        return null;
    }
    return (react_1.default.createElement(ink_1.Box, { flexDirection: "column" },
        react_1.default.createElement(ink_1.Color, { white: true },
            react_1.default.createElement(ink_1.Box, { width: 3, justifyContent: "flex-end" }, isDone ? (react_1.default.createElement(ink_1.Color, { green: true }, " \u2714")) : isRunning ? (debug ? (figures_1.default.ellipsis) : (react_1.default.createElement(ink_spinner_1.default, { type: "dots" }))) : ('')),
            react_1.default.createElement(ink_1.Box, { marginLeft: 1, width: 70 }, name)),
        (isRunning || isDone) && children));
};
const Note = ({ isWarning, children }) => {
    return (react_1.default.createElement(ink_1.Text, { italic: true },
        react_1.default.createElement(ink_1.Color, { grey: !isWarning, yellow: !!isWarning },
            react_1.default.createElement(ink_1.Box, { marginLeft: 4 }, isWarning ? '⚠' : '↪'),
            react_1.default.createElement(ink_1.Box, { marginLeft: 2, width: 80, textWrap: "wrap" }, children))));
};
//# sourceMappingURL=build.js.map


text:
package de.seven.fate.message.bo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;

@Data
@EqualsAndHashCode
@JsonIgnoreProperties(ignoreUnknown = true)
public class MessageBO implements Serializable {

    private Long id;

    private String description;

    private String image;

    private Date pubDate;

    private String type;

    private String title;
}


text:
/**
 ***********************************************************************************************************************
 * @file  palElfReader.h
 * @brief PAL Elf utility class declarations.
 * SEE: Section 1 in https://www.uclibc.org/docs/elf-64-gen.pdf for an overview of the ELF format.
 ***********************************************************************************************************************
 */

#pragma once

#include "palAssert.h"
#include "palElf.h"
#include "palHashBaseImpl.h"
#include "palInlineFuncs.h"
#include <iterator>

namespace Util
{
namespace ElfReader
{

using Elf::FileHeader;
using Elf::MachineType;
using Elf::NoteTableEntryHeader;
using Elf::RelTableEntry;
using Elf::RelaTableEntry;
using Elf::SectionHeader;
using Elf::SectionHeaderType;
using Elf::SymbolTableEntry;

// 8 byte alignment for notes according to Elf64 spec.
// However, in practice it is 4 bytes (readelf gets confused by 8)
constexpr uint32 NoteAlignment = 4;

typedef uint16 SectionId;

class Notes;

/**
 ***********************************************************************************************************************
 * @brief A thin wrapper to facilitate access of ELF files.
 ***********************************************************************************************************************
 */
class Reader
{
    friend class Section;

public:
    explicit Reader(const void* pData) : m_pData(pData)
    {
        PAL_ASSERT(pData != nullptr);
        PAL_ASSERT_MSG(VoidPtrIsPow2Aligned(m_pData, alignof(FileHeader)),
            "Invalid alignment, not allowed to cast");
        PAL_ASSERT_MSG(GetHeader().ei_data == Util::Elf::ElfLittleEndian,
            "Elf reader can only read little endian elfs");
    }
    const void* GetData() const { return m_pData; }

    // File information
    const FileHeader& GetHeader() const { return *static_cast<const FileHeader*>(m_pData); }
    MachineType GetTargetMachine() const { return static_cast<MachineType>(GetHeader().e_machine); }

    // Section information
    uint16 GetNumSections() const { return GetHeader().e_shnum; }
    const SectionHeader& GetSection(SectionId i) const;
    SectionHeaderType GetSectionType(SectionId i) const { return static_cast<SectionHeaderType>(GetSection(i).sh_type); }
    const char* GetSectionName(SectionId i) const;

    const void* GetSectionData(SectionId i) const
    {
        return VoidPtrInc(m_pData, static_cast<size_t>(GetSection(i).sh_offset));
    }

    /// Searches a section by its name.
    ///
    /// @returns The found section or 0 if it was not found.
    SectionId FindSection(const char* pName) const;

    /// Looks up the data for the given symbol and fills out a pointer to it.
    ///
    /// @param [in]  symbol  The symbol to find.
    /// @param [out] ppData  Is filled out with a pointer to the indicated symbol's value.
    ///
    /// @returns Fails if the symbol has no associated section or the ELF is malformed.
    Result GetSymbol(const Elf::SymbolTableEntry& symbol, const void** ppData) const;

    /// Copy the data of the given symbol into a buffer.
    ///
    /// @param [in]  symbol  The symbol to copy.
    /// @param [out] pSize   The size of the symbol. Is only written if pBuffer is null.
    /// @param [out] pBuffer A buffer for storing the symbol data. If null, pSize will be written.
    ///
    /// @returns Fails if the symbol has no associated section or the ELF is malformed.
    Result CopySymbol(const Elf::SymbolTableEntry& symbol, size_t* pSize, void* pBuffer) const;

private:
    const void* m_pData;
};

/**
 ***********************************************************************************************************************
 * @brief Iterator for traversal of notes in a note section.
 *
 * Supports forward traversal.
 ***********************************************************************************************************************
 */
class NoteIterator
{
public:
    /// Checks if the current note is within bounds of the note section.
    ///
    /// @returns True if the current element this iterator is pointing to is within the permitted range.
    bool IsValid() const;

    /// Returns the note the iterator is currently pointing to as a reference.
    ///
    /// @warning This may cause an access violation if the iterator is not valid.
    ///
    /// @returns The element the iterator is currently pointing to.
    const NoteTableEntryHeader& GetHeader() const
    {
        PAL_ASSERT(IsValid());
        return *m_pData;
    }

    const void* GetName() const;
    const void* GetDescriptor() const;

    /// Advances the iterator to point to the next element.
    ///
    /// @warning Does not do bounds checking.
    void Next();

private:
    NoteIterator(const Notes& notes, const NoteTableEntryHeader* pData) : m_notes(notes), m_pData(pData) {}

    const Notes&                m_notes;
    const NoteTableEntryHeader* m_pData;

    // Although this is a transgression of coding standards, it means that Notes does not need to have a public
    // interface specifically to implement this class. The added encapsulation this provides is worthwhile.
    friend class Notes;
};

/**
 ***********************************************************************************************************************
 * @brief An iterable wrapper for notes in an ELF note section.
 ***********************************************************************************************************************
 */
class Notes
{
public:
    Notes(const Reader& reader, SectionId section) : m_reader(reader), m_section(section)
    {
        PAL_ASSERT_MSG(m_reader.GetSectionType(m_section) == SectionHeaderType::Note,
            "Expected a note section but got something else");
    }

    const SectionHeader& GetHeader() const { return m_reader.GetSection(m_section); }
    NoteIterator Begin() const;
    NoteIterator End() const;

private:
    const Reader& m_reader;
    const SectionId m_section;
};

/**
 ***********************************************************************************************************************
 * @brief An iterable wrapper for symbols in an ELF symbol table.
 ***********************************************************************************************************************
 */
class Symbols
{
public:
    Symbols(const Reader& reader, SectionId section);

    const SectionHeader& GetHeader() const { return m_reader.GetSection(m_section); }
    SectionId GetStringSection() const { return static_cast<SectionId>(m_reader.GetSection(m_section).sh_link); }
    uint64 GetNumSymbols() const { return GetHeader().sh_size / sizeof(SymbolTableEntry); }

    const SymbolTableEntry& GetSymbol(uint64 i) const;

    const char* GetSymbolName(uint64 i) const { return GetStringSectionData() + GetSymbol(i).st_name; }
    const void* GetSymbolData(uint64 i) const
    {
        return VoidPtrInc(m_reader.GetSectionData(GetSymbol(i).st_shndx),
            static_cast<size_t>(GetSymbol(i).st_value));
    }

    Elf::SymbolTableEntryType GetSymbolType(uint64 i) const
    {
        return static_cast<Elf::SymbolTableEntryType>(GetSymbol(i).st_info.type);
    }

private:
    const char* GetStringSectionData() const
    {
        return static_cast<const char*>(m_reader.GetSectionData(GetStringSection()));
    }

    const Reader& m_reader;
    const SectionId m_section;
};

/**
 ***********************************************************************************************************************
 * @brief An iterable wrapper for symbols in an ELF relocation table.
 ***********************************************************************************************************************
 */
class Relocations
{
public:
    Relocations(const Reader& reader, SectionId section);

    /// If relocations in thi section have an explicit addend.
    bool IsRela() const { return m_reader.GetSectionType(m_section) == SectionHeaderType::Rela; }

    const SectionHeader& GetHeader() const { return m_reader.GetSection(m_section); }
    /// The section where the relocations from this section should be performed.
    SectionId GetDestSection() const { return static_cast<SectionId>(GetHeader().sh_info); }
    /// The symbols which are referenced in the relocations
    SectionId GetSymbolSection() const { return static_cast<SectionId>(GetHeader().sh_link); }

    /// This can be called even if this section is a Rela section
    const RelTableEntry& GetRel(uint64 i) const;

    /// Must only be called if this is a Rela section.
    const RelaTableEntry& GetRela(uint64 i) const;

    Elf::SymbolTableEntryType GetRelocationType(uint64 i) const
    {
        return static_cast<Elf::SymbolTableEntryType>(GetRel(i).r_info.type);
    }

    uint64 GetNumRelocations() const { return m_reader.GetSection(m_section).sh_size / GetEntrySize(); }

private:
    size_t GetEntrySize() const;

    const Reader& m_reader;
    const SectionId m_section;
};

} // ElfReader
} // Util


text:
//
// Copyright (c) 2004-2011 Jaroslaw Kowalski <jaak@jkowalski.net>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
//   this list of conditions and the following disclaimer in the documentation
//   and/or other materials provided with the distribution.
//
// * Neither the name of Jaroslaw Kowalski nor the names of its
//   contributors may be used to endorse or promote products derived from this
//   software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

namespace NLog.UnitTests.Config
{
    using System;
    using NLog.Time;
    using Xunit;

    public class TimeConfigurationTests : NLogTestBase, IDisposable
    {
        public void Dispose()
        {
            TimeSource.Current = new FastLocalTimeSource();
        }

        [Fact]
        public void DefaultTimeSourceTest()
        {
            Assert.IsType(typeof(FastLocalTimeSource), TimeSource.Current);
            CreateConfigurationFromString("<nlog />");
            Assert.IsType(typeof(FastLocalTimeSource), TimeSource.Current);
        }

        [Fact]
        public void AccurateLocalTest()
        {
            TestTimeSourceConfiguration<AccurateLocalTimeSource>("AccurateLocal");
        }

        [Fact]
        public void AccurateUtcTest()
        {
            TestTimeSourceConfiguration<AccurateUtcTimeSource>("AccurateUTC");
        }

        [Fact]
        public void FastLocalTest()
        {
            TestTimeSourceConfiguration<FastLocalTimeSource>("FastLocal");
        }

        [Fact]
        public void FastUtcTest()
        {
            TestTimeSourceConfiguration<FastUtcTimeSource>("FastUTC");
        }

        void TestTimeSourceConfiguration<T>(string type)
            where T : TimeSource
        {
            Assert.IsType(typeof(FastLocalTimeSource), TimeSource.Current);
            CreateConfigurationFromString(@"
                <nlog>
                    <time type='" + type + @"' />
                </nlog>");
            Assert.IsType(typeof(T), TimeSource.Current);
        }
    }
}


text:
/*
 * Mavuno: A Hadoop-Based Text Mining Toolkit
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You may
 * obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

package edu.isi.mavuno.util;

import org.apache.hadoop.io.Text;

/**
 * @author metzler
 *
 */
public class TypedTextSpan {
	// span type
	public final Text type = new Text();

	// span text
	public final Text text = new Text();

	// span start and end character offsets
	public int start;
	public int end;

	public TypedTextSpan(Text type, Text text, int start, int end) {
		if(type != null) {
			this.type.set(type);
		}
		if(text != null) {
			this.text.set(text);
		}
		this.start = start;
		this.end = end;
	}

	@Override
	public int hashCode() {
		return toString().hashCode();
	}

	@Override
	public boolean equals(Object o) {
		if(o == null) {
			return false;
		}
		return toString().compareTo(o.toString()) == 0;
	}

	@Override
	public String toString() {
		StringBuffer buf = new StringBuffer();

		buf.append("[type: ");
		buf.append(type);
		buf.append(", text: ");
		buf.append(text);
		buf.append(", start: ");
		buf.append(start);
		buf.append(", end: ");
		buf.append(end);
		buf.append(']');

		return buf.toString();
	}
}


text:
package opennlp.tools.chunker;

import java.io.IOException;
import java.io.ObjectStreamException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import opennlp.model.AbstractModel;
import opennlp.model.EventStream;
import opennlp.model.MaxentModel;
import opennlp.model.TrainUtil;
import opennlp.tools.util.BeamSearch;
import opennlp.tools.util.ObjectStream;
import opennlp.tools.util.Sequence;
import opennlp.tools.util.SequenceValidator;
import opennlp.tools.util.Span;
import opennlp.tools.util.TrainingParameters;
import opennlp.tools.util.model.ModelUtil;

/**
 * The class represents a maximum-entropy-based chunker.  Such a chunker can be used to
 * find flat structures based on sequence inputs such as noun phrases or named entities.
 */
public class ChunkerME implements Chunker {

  public static final int DEFAULT_BEAM_SIZE = 10;

  /**
   * The beam used to search for sequences of chunk tag assignments.
   */
  protected BeamSearch<String> beam;

  private Sequence bestSequence;

  /**
   * The model used to assign chunk tags to a sequence of tokens.
   */
  protected MaxentModel model;

  /**
   * Initializes the current instance with the specified model and
   * the specified beam size.
   *
   * @param model The model for this chunker.
   * @param beamSize The size of the beam that should be used when decoding sequences.
   * @param sequenceValidator  The {@link SequenceValidator} to determines whether the outcome
   *        is valid for the preceding sequence. This can be used to implement constraints
   *        on what sequences are valid.
   * @deprecated Use {@link #ChunkerME(ChunkerModel, int)} instead
   *    and use the {@link ChunkerFactory} to configure the {@link SequenceValidator} and {@link ChunkerContextGenerator}.
   */
  public ChunkerME(ChunkerModel model, int beamSize, SequenceValidator<String> sequenceValidator,
      ChunkerContextGenerator contextGenerator) {
    this.model = model.getChunkerModel();
    beam = new BeamSearch<String>(beamSize, contextGenerator, this.model, sequenceValidator, 0);
  }

  /**
   * Initializes the current instance with the specified model and
   * the specified beam size.
   *
   * @param model The model for this chunker.
   * @param beamSize The size of the beam that should be used when decoding sequences.
   * @param sequenceValidator  The {@link SequenceValidator} to determines whether the outcome
   *        is valid for the preceding sequence. This can be used to implement constraints
   *        on what sequences are valid.
   * @deprecated Use {@link #ChunkerME(ChunkerModel, int)} instead
   *    and use the {@link ChunkerFactory} to configure the {@link SequenceValidator}.
   */
  public ChunkerME(ChunkerModel model, int beamSize,
      SequenceValidator<String> sequenceValidator) {
    this(model, beamSize, sequenceValidator,
        new DefaultChunkerContextGenerator());
  }

  /**
   * Initializes the current instance with the specified model and
   * the specified beam size.
   *
   * @param model The model for this chunker.
   * @param beamSize The size of the beam that should be used when decoding sequences.
   */
  public ChunkerME(ChunkerModel model, int beamSize) {
    this.model = model.getChunkerModel();
    ChunkerContextGenerator contextGenerator = model.getFactory().getContextGenerator();
    SequenceValidator<String> sequenceValidator = model.getFactory().getSequenceValidator();
    beam = new BeamSearch<String>(beamSize, contextGenerator, this.model, sequenceValidator, 0);
  }

  /**
   * Initializes the current instance with the specified model.
   * The default beam size is used.
   *
   * @param model
   */
  public ChunkerME(ChunkerModel model) {
    this(model, DEFAULT_BEAM_SIZE);
  }

  /**
   * Creates a chunker using the specified model.
   *
   * @param mod The maximum entropy model for this chunker.
   */
  @Deprecated
  public ChunkerME(MaxentModel mod) {
    this(mod, new DefaultChunkerContextGenerator(), DEFAULT_BEAM_SIZE);
  }

  /**
   * Creates a chunker using the specified model and context generator.
   *
   * @param mod The maximum entropy model for this chunker.
   * @param cg The context generator to be used by the specified model.
   */
  @Deprecated
  public ChunkerME(MaxentModel mod, ChunkerContextGenerator cg) {
    this(mod, cg, DEFAULT_BEAM_SIZE);
  }

  /**
   * Creates a chunker using the specified model and context generator and decodes the
   * model using a beam search of the specified size.
   *
   * @param mod The maximum entropy model for this chunker.
   * @param cg The context generator to be used by the specified model.
   * @param beamSize The size of the beam that should be used when decoding sequences.
   */
  @Deprecated
  public ChunkerME(MaxentModel mod, ChunkerContextGenerator cg, int beamSize) {
    beam = new BeamSearch<String>(beamSize, cg, mod);
    this.model = mod;
  }

  @Deprecated
  public List<String> chunk(List<String> toks, List<String> tags) {
    bestSequence =
        beam.bestSequence(toks.toArray(new String[toks.size()]), new Object[] { tags.toArray(new String[tags.size()]) });
    return bestSequence.getOutcomes();
  }

  public String[] chunk(String[] toks, String[] tags) {
    bestSequence = beam.bestSequence(toks, new Object[] {tags});
    List<String> c = bestSequence.getOutcomes();
    return c.toArray(new String[c.size()]);
  }

  public Span[] chunkAsSpans(String[] toks, String[] tags) {
    String[] preds = chunk(toks, tags);
    return ChunkSample.phrasesAsSpanList(toks, tags, preds);
  }

  @Deprecated
  public Sequence[] topKSequences(List<String> sentence, List<String> tags) {
    return topKSequences(sentence.toArray(new String[sentence.size()]),
        tags.toArray(new String[tags.size()]));
  }

  public Sequence[] topKSequences(String[] sentence, String[] tags) {
    return beam.bestSequences(DEFAULT_BEAM_SIZE, sentence,
        new Object[] { tags });
  }

  public Sequence[] topKSequences(String[] sentence, String[] tags, double minSequenceScore) {
    return beam.bestSequences(DEFAULT_BEAM_SIZE, sentence, new Object[] { tags },minSequenceScore);
  }

  /**
   * Populates the specified array with the probabilities of the last decoded sequence.  The
   * sequence was determined based on the previous call to chunk.  The
   * specified array should be at least as large as the numbe of tokens in the previous call to chunk.
   *
   * @param probs An array used to hold the probabilities of the last decoded sequence.
   */
  public void probs(double[] probs) {
    bestSequence.getProbs(probs);
  }

    /**
     * Returns an array with the probabilities of the last decoded sequence.  The
     * sequence was determined based on the previous call to chunk.
     * @return An array with the same number of probabilities as tokens were sent to chunk
     * when it was last called.
     */
  public double[] probs() {
    return bestSequence.getProbs();
  }

  public static ChunkerModel train(String lang, ObjectStream<ChunkSample> in,
      TrainingParameters mlParams, ChunkerFactory factory) throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream es = new ChunkerEventStream(in, factory.getContextGenerator());

    AbstractModel maxentModel = TrainUtil.train(es, mlParams.getSettings(),
        manifestInfoEntries);

    return new ChunkerModel(lang, maxentModel, manifestInfoEntries, factory);
  }

  /**
   * @deprecated Use
   *             {@link #train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters, ChunkerFactory)}
   *             instead.
   */
  public static ChunkerModel train(String lang, ObjectStream<ChunkSample> in,
      ChunkerContextGenerator contextGenerator, TrainingParameters mlParams)
  throws IOException {

    Map<String, String> manifestInfoEntries = new HashMap<String, String>();

    EventStream es = new ChunkerEventStream(in, contextGenerator);

    AbstractModel maxentModel = TrainUtil.train(es, mlParams.getSettings(), manifestInfoEntries);

    return new ChunkerModel(lang, maxentModel, manifestInfoEntries);
  }

  /**
   * @deprecated use {@link #train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)}
   * instead and pass in a TrainingParameters object.
   */
  public static ChunkerModel train(String lang, ObjectStream<ChunkSample> in,
      int cutoff, int iterations, ChunkerContextGenerator contextGenerator)
      throws IOException {
    return train(lang, in, contextGenerator, ModelUtil.createTrainingParameters(iterations, cutoff));
  }

  /**
   * Trains a new model for the {@link ChunkerME}.
   *
   * @param in
   * @param cutoff
   * @param iterations
   *
   * @return the new model
   *
   * @throws IOException
   *
   * @deprecated use {@link #train(String, ObjectStream, ChunkerContextGenerator, TrainingParameters)}
   * instead and pass in a TrainingParameters object.
   */
  @Deprecated
  public static ChunkerModel train(String lang, ObjectStream<ChunkSample> in, int cutoff, int iterations)
      throws IOException, ObjectStreamException {
    return train(lang, in, cutoff, iterations, new DefaultChunkerContextGenerator());
  }
}


text:
var express = require( "express" );
var githubAuth = require( "../../index" );

// ===============================
// == APPLICATION CONFIGURATION ==
// ===============================
// Fill in the following data to get this example to run

// Don't have a GitHub application yet?
// Create one at https://github.com/settings/applications/new
var clientId = "your GitHub application's client id";
var clientSecret = "your GitHub application's client secret";
var callbackUrl = "/route/to/your-GitHub-application-callback-URL";
var port = 5000;

// =======================
// == APPLICATION LOGIC ==
// =======================

// Initialize the Express application
// The application must have sessions enabled
var app = express();
app.use( express.cookieParser() );
app.use( express.cookieSession({
	secret: "your secret goes here"
}));

// Initialize the GitHub OAuth client
var gha = githubAuth.createClient({
	id: clientId,
	secret: clientSecret
});

// Add the route for the GitHub authorization callback
// The path must match authorization callback URL for the GitHub application
app.get( callbackUrl, gha.handshake );

// Create a standard route which doesn't require any authorization
app.get( "/", function( request, response ) {
	response.send( "Welcome! Would you like to view a page with " +
		"required authorization or " +
		"optional authorization?" );
});

// Create a route which requires authorization
app.get( "/required", gha.authorize, function( request, response ) {
	var accessToken = gha.users[ request.sessionID ].accessToken;
	response.send( "Your access token is " + accessToken );
});

// Create a route with optional authorization
app.get( "/optional", function( request, response ) {
	gha.isAuthorized( request, function( error, isAuthorized ) {
		if ( error ) {
			response.send( 500 );
		}

		var name = isAuthorized ?
			gha.users[ request.sessionID ].accessToken :
			"anonymous";

		response.send( "Hello, " + name );
	});
});

// Start listening for requests
app.listen( port );


text:
<?php
namespace ARIPD\UserBundle\Repository;

use Doctrine\ORM\EntityRepository;

class MessageRepository extends EntityRepository {
	public function getMessagesByConsumerExceptC3($consumer_id) {
		return $this->createQueryBuilder('m')->select('m')
				->where('m.consumer = ?1')->andWhere('m.statusConsumer != ?2')
				->setParameter(1, $consumer_id)->setParameter(2, 'C3')
				->addOrderBy('m.createdAt', 'DESC')->getQuery()->getResult();
	}

	public function updateStatusConsumer($consumer_id, $id, $status) {
		return $this->getManager()
				->createQuery(
						"UPDATE ARIPD\UserBundle\Entity\Message m SET m.statusConsumer= ?3 WHERE m.consumer =?1 AND m.id = ?2")
				->setParameter(1, $consumer_id,
						\Doctrine\DBAL\Types\Type::INTEGER)
				->setParameter(2, $id, \Doctrine\DBAL\Types\Type::INTEGER)
				->setParameter(3, $status, \Doctrine\DBAL\Types\Type::STRING)
				->execute();
	}

	public function updateStatusProducer($producer_id, $id, $status) {
		return $this->getManager()
				->createQuery(
						"UPDATE ARIPD\UserBundle\Entity\Message m SET m.statusProducer= ?3 WHERE m.producer =?1 AND m.id = ?2")
				->setParameter(1, $producer_id,
						\Doctrine\DBAL\Types\Type::INTEGER)
				->setParameter(2, $id, \Doctrine\DBAL\Types\Type::INTEGER)
				->setParameter(3, $status, \Doctrine\DBAL\Types\Type::STRING)
				->execute();
	}

	public function setAsRead($consumer_id, $id) {
		$messsage = $this->find($id);
		if ($messsage->getStatusConsumer() == 'C1')
			$this->updateStatusConsumer($consumer_id, $id, 'C2');
	}

	public function deleteFake($mode, $user_id, $id) {
		if ($mode == 'consumer') {
			return $this->updateStatusConsumer($user_id, $id, 'C3');
		} elseif ($mode == 'producer') {
			return $this->updateStatusProducer($user_id, $id, 'P3');
		}
	}

}


text:
<?php

class Assesment_model extends CI_Model {

    function __construct() {
        parent::__construct();
        $this->load->helper('url');
    }

    function get_num_rows() {
        $query = $this->db->get('students_assessments');
        return $query->num_rows();
    }

    function search($sort_by, $sort_order, $per_page, $offset) {
        $this->db->order_by($sort_by, $sort_order);
        $this->db->limit($per_page, $offset);
        $this->db->join('subjects', 'subjects.subject_id=students_assessments.sa_subject_id');
        $this->db->join('students', 'students.student_id=students_assessments.sa_student_id');
        $q = $this->db->get('students_assessments');
        return $q->result_array();
    }

    function edit_subject($student_id, $subject_id, $lectures, $exercises, $assesment) {

        $data = array(
            'sa_assesment' => $assesment,
            'sa_workload_lectures' => $lectures,
            'sa_workload_exercises' => $exercises
        );
        $this->db->where('sa_subject_id', $subject_id);
        $this->db->where('sa_student_id', $student_id);
        $this->db->update('students_assessments', $data);

        if ($this->db->affected_rows() == 1) {
            return true;
        } else {
            return false;
        }
    }

    function get_students($student_id) {
        $this->db->select('student_id,student_fname,student_lname');
        $this->db->from('students');
        $this->db->where('student_id', $student_id);
        $q = $this->db->get();
        return $q->result_array();
    }

    function get_subjects($subject_id) {
        $this->db->select('subject_id,subject_name');
        $this->db->from('subjects');
        $this->db->where('subject_id', $subject_id);
        $q = $this->db->get();
        return $q->result_array();
    }

}


text:
<tool id="busco" name="Busco" profile="20.01" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@">
    <description>assess genome assembly and annotation completeness</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">busco</requirement>
        <requirement type="package" version="1.32">tar</requirement>
        <requirement type="package" version="1">fonts-conda-ecosystem</requirement>
    </requirements>
    <version_command>busco --version</version_command>
    <command><![CDATA[
if [ -z "\$AUGUSTUS_CONFIG_PATH" ] ; then BUSCO_PATH=\$(dirname \$(which busco)) ; export AUGUSTUS_CONFIG_PATH=\$(realpath \${BUSCO_PATH}/../config) ; fi &&
cp -r "\$AUGUSTUS_CONFIG_PATH/" augustus_dir/ &&
export AUGUSTUS_CONFIG_PATH=`pwd`/augustus_dir/ &&

#if $busco_mode.mode == 'geno' and $busco_mode.use_augustus.use_augustus_selector == 'yes' and $busco_mode.use_augustus.aug_prediction.augustus_mode == 'history':
    ## Using an augustus model from history, we need to unzip it and let augustus find it
    mkdir -p 'augustus_dir/species/' &&
    tar -C 'augustus_dir/species/' -xzf '${busco_mode.use_augustus.aug_prediction.augustus_model}' &&
#end if

busco
--in '${input}'
--lineage_dataset '${lineage_dataset}'
--update-data
--mode '${busco_mode.mode}'
--out busco_galaxy
--cpu \${GALAXY_SLOTS:-4}
--evalue ${adv.evalue}
--limit ${adv.limit}

#if $adv.auto_lineage:
    $adv.auto_lineage
#end if
#if $busco_mode.mode == 'geno' and $busco_mode.use_augustus.use_augustus_selector == 'yes':

    ${busco_mode.use_augustus.long}
    --augustus

    #if $busco_mode.use_augustus.aug_prediction.augustus_mode == 'builtin':
        --augustus_species '${busco_mode.use_augustus.aug_prediction.augustus_species}'
    #else if $busco_mode.use_augustus.aug_prediction.augustus_mode == 'history':
        --augustus_species local
    #end if
#end if

#if $adv.outputs and 'image' in $adv.outputs:
    &&
    mkdir BUSCO_summaries
    &&
    ls -l busco_galaxy/run_*/ &&
    cp busco_galaxy/short_summary.*.txt BUSCO_summaries/
    &&
    generate_plot.py -wd BUSCO_summaries -rt specific
#end if

]]>    </command>
    <inputs>
        <param type="data" name="input" format="fasta" label="Sequences to analyse" help="Can be an assembled genome or transcriptome (DNA), or protein sequences from an annotated gene set." />
        <conditional name="busco_mode">
            <param argument="--mode" type="select" label="Mode">
                <option value="geno">Genome assemblies (DNA)</option>
                <option value="tran">Transcriptome assemblies (DNA)</option>
                <option value="prot">annotated gene sets (protein)</option>
            </param>
            <when value="geno">
                <conditional name="use_augustus">
                    <param name="use_augustus_selector" type="select" label="Use Augustus instead of Metaeuk">
                        <option value="yes">Yes, use Augustus</option>
                        <option value="no" selected="true">Use Metaeuk</option>
                    </param>
                    <when value="no" />
                    <when value="yes">
                        <conditional name="aug_prediction">
                            <param name="augustus_mode" type="select" label="Augustus species model">
                                <option value="no" selected="true">Use the default species for selected lineage</option>
                                <option value="builtin">Use another predefined species model</option>
                                <option value="history">Use a custom species model</option>
                            </param>
                            <when value="no" />
                            <when value="history">
                                <param name="augustus_model" type="data" format="augustus" label="Augustus model" />
                            </when>
                            <when value="builtin">
                                <param name="augustus_species" type="select" label="Augustus species model">
                                    <expand macro="augustus_species" />
                                </param>
                            </when>
                        </conditional>
                        <param argument="--long" type="boolean" checked="false" truevalue="--long" falsevalue="" label="Optimization mode Augustus self-training" help="Adds considerably to run time, but can improve results for some non-model organisms" />
                    </when>
                </conditional>
            </when>
            <when value="tran" />
            <when value="prot" />
        </conditional>

        <param argument="--lineage_dataset" type="select" label="Lineage">
            <expand macro="lineages" />
        </param>

            <param argument="--evalue" type="float" value="0.001" min="0" max="1" label="E-value cutoff for BLAST searches." />
            <param argument="--limit" type="integer" value="3" label="How many candidate regions to consider" />
            <param name="auto_lineage" type="select" optional="true" label="Run auto-lineage to find optimal lineage path">
                <option value="--auto-lineage">Run auto-lineage to find optimum lineage path</option>
                <option value="--auto-lineage-prok">Run auto-lineage just on non-eukaryote trees to find optimum lineage path</option>
                <option value="--auto-lineage-euk">Run auto-placement just on eukaryote tree to find optimum lineage path</option>
            </param>
            <param name="outputs" type="select" optional="true" multiple="true" label="Which outputs should be generated">
                <option value="short_summary">short summary text</option>
                <option value="missing">list with missing IDs</option>
                <option value="image">summary image</option>
            </param>

    </inputs>
    <outputs>
        <data name='busco_sum' format='txt' label="${tool.name} on ${on_string}: short summary" from_work_dir="busco_galaxy/run_*/short_summary.txt">
            <filter>adv['outputs'] and 'short_summary' in adv['outputs']</filter>
        </data>
        <data name='busco_table' format='tabular' label="${tool.name} on ${on_string}: full table" from_work_dir="busco_galaxy/run_*/full_table.tsv" />
        <data name='busco_missing' format='tabular' label="${tool.name} on ${on_string}: missing buscos" from_work_dir="busco_galaxy/run_*/missing_busco_list.tsv">
            <filter>adv['outputs'] and 'missing' in adv['outputs']</filter>
        </data>
        <data name='summary_image' format='png' label="${tool.name} on ${on_string}: summary image" from_work_dir="BUSCO_summaries/busco_figure.png">
            <filter>adv['outputs'] and 'image' in adv['outputs']</filter>
        </data>
    </outputs>
    <tests>
        <test expect_num_outputs="3">
            <param name="input" value="genome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="geno" />
                <conditional name="use_augustus">
                    <param name="use_augustus_selector" value="yes" />
                </conditional>
            </conditional>

                <param name="outputs" value="short_summary,missing" />

            <output name="busco_sum" file="genome_results/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="genome_results/full_table" compare="diff" lines_diff="4" />
            <output name="busco_missing" file="genome_results/missing_buscos_list" compare="diff" lines_diff="4">
                <assert_contents>
                    <has_text text="# BUSCO version is: @TOOL_VERSION@" />
                </assert_contents>
            </output>
        </test>
        <test expect_num_outputs="4">
            <param name="input" value="proteome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="prot" />
            </conditional>

                <param name="outputs" value="short_summary,missing,image" />

            <output name="busco_sum" file="proteome_results/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="proteome_results/full_table" compare="diff" lines_diff="4" />
            <output name="busco_missing" file="proteome_results/missing_buscos_list" compare="diff" lines_diff="4" />
            <output name="summary_image" file="proteome_results/summary.png" compare="sim_size" />
        </test>
        <test expect_num_outputs="4">
            <param name="input" value="transcriptome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="tran" />
            </conditional>

                <param name="auto_lineage" value="--auto-lineage" />
                <param name="outputs" value="short_summary,missing,image" />

            <output name="busco_sum" file="transcriptome_results/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="transcriptome_results/full_table" compare="diff" lines_diff="4" />
            <output name="busco_missing" file="transcriptome_results/missing_buscos_list" compare="diff" lines_diff="4" />
            <output name="summary_image" file="transcriptome_results/summary.png" compare="sim_size" />
        </test>
        <test expect_num_outputs="2">
            <param name="input" value="genome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="geno" />
                <conditional name="use_augustus">
                    <param name="use_augustus_selector" value="yes" />
                    <conditional name="aug_prediction">
                        <param name="augustus_mode" value="builtin" />
                        <param name="augustus_species" value="human" />
                    </conditional>
                </conditional>
            </conditional>

                <param name="outputs" value="short_summary" />

            <output name="busco_sum" file="genome_results/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="genome_results/full_table" compare="diff" lines_diff="4" />
        </test>
        <test expect_num_outputs="3">
            <param name="input" value="genome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="geno" />
                <conditional name="use_augustus">
                    <param name="use_augustus_selector" value="yes" />
                    <conditional name="aug_prediction">
                        <param name="augustus_mode" value="history" />
                        <param name="augustus_model" value="local.tar.gz" ftype="augustus" />
                    </conditional>
                </conditional>
            </conditional>

                <param name="outputs" value="short_summary,missing" />

            <output name="busco_sum" file="genome_results/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="genome_results/full_table" compare="diff" lines_diff="4" />
            <output name="busco_missing" file="genome_results/missing_buscos_list" compare="diff" lines_diff="4" />
        </test>
        <test expect_num_outputs="4">
            <param name="input" value="genome.fa" />
            <param name="lineage_dataset" value="arthropoda_odb10" />
            <conditional name="busco_mode">
                <param name="mode" value="geno" />
                <conditional name="use_augustus">
                    <param name="use_augustus_selector" value="no" />
                </conditional>
            </conditional>

                <param name="outputs" value="short_summary,missing,image" />

            <output name="busco_sum" file="genome_results_metaeuk/short_summary" compare="diff" lines_diff="4" />
            <output name="busco_table" file="genome_results_metaeuk/full_table" compare="diff" lines_diff="4" />
            <output name="busco_missing" file="genome_results_metaeuk/missing_buscos_list" compare="diff" lines_diff="4" />
            <output name="summary_image" file="genome_results_metaeuk/summary.png" compare="sim_size" />
        </test>
    </tests>
    <help><![CDATA[

BUSCO: assessing genome assembly and annotation completeness with Benchmarking Universal Single-Copy Orthologs
--------------------------------------------------------------------------------------------------------------

Interpreting the results
^^^^^^^^^^^^^^^^^^^^^^^^

BUSCO_ attempts to provide a quantitative assessment of the completeness in terms of the expected gene content of a
genome assembly, transcriptome, or annotated gene set. The results are simplified into categories of Complete
and single-copy, Complete and duplicated, Fragmented, or Missing BUSCOs.

BUSCO completeness results make sense only in the context of the biology of your organism.
You have to understand whether missing or duplicated genes are of biological or technical origin.
For instance, a high level of duplication may be explained by a recent whole duplication event
(biological) or a chimeric assembly of haplotypes (technical).
Transcriptomes and protein sets that are not filtered for isoforms will lead to a high proportion of duplicates.
Therefore you should filter them before a BUSCO analysis.
Finally, focusing on specific tissues or specific life stages and conditions in a transcriptomic experiment
is unlikely to produce a BUSCO-complete transcriptome. In this case, consistency across your samples
is what you will be aiming for.

For more information please refer to the Busco_ `user guide <https: / /busco.ezlab.org /busco_userguide.html#interpreting-the-results>`_
.

.. _BUSCO: http://busco.ezlab.org/

    ]]>    </help>
    <expand macro="citations" />
</tool>


text:
[![Open in Cloud Shell][shell_img]][shell_link]

[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=endpoints/bookstore-grpc-transcoding/README.md

This example demonstrates how to implement a gRPC server
with Google Cloud Endpoints and HTTP/JSON Transcoding.

## Installing the dependencies using virtualenv:

    virtualenv bookstore-env
    source bookstore-env/bin/activate

Install all the Python dependencies:

    pip install -r requirements.txt

Install the [gRPC libraries and tools](http://www.grpc.io/docs/quickstart/python.html#prerequisites)

## Running the Server Locally

To run the server:

    python bookstore_server.py

The `-h` command line flag shows the various settings available.

## Running the Client Locally

To run the client:

    python bookstore_client.py

As with the server, the `-h` command line flag shows the various settings
available.

## Generating a JWT token from a service account file

To run the script:

    python jwt_token_gen.py --file=account_file --audiences=audiences --issuer=issuer

The output can be used as "--auth_token" for bookstore_client.py

## Regenerating the Protocol Buffer and gRPC API stubs

The bookstore gRPC API is defined by `bookstore.proto`
The API client stubs and server interfaces are generated by tools.

To make it easier to get something up and running, we've included the generated
code in the sample distribution.  To modify the sample or create your own gRPC
API definition, you'll need to update the generated code. To do this, once the
gRPC libraries and tools are installed, run:

    GOOGLEAPIS=/path/to/googleapis
    git clone https://github.com/googleapis/googleapis $GOOGLEAPIS

    python -m grpc.tools.protoc \
        --include_imports \
        --include_source_info \
        --proto_path=. \
        --proto_path=$GOOGLEAPIS \
        --python_out=. \
        --grpc_python_out=. \
        --descriptor_set_out=api_descriptor.pb \
        bookstore.proto


text:
<?php
/*
Title		: SMOF
Description	: Slightly Modified Options Framework
Version		: 1.4.0
Author		: Syamil MJ
Author URI	: http://aquagraphite.com
License		: WTFPL - http://sam.zoy.org/wtfpl/
Credits		: Thematic Options Panel - http://wptheming.com/2010/11/thematic-options-panel-v2/
		 	  KIA Thematic Options Panel - https://github.com/helgatheviking/thematic-options-KIA
		 	  Woo Themes - http://woothemes.com/
		 	  Option Tree - http://wordpress.org/extend/plugins/option-tree/
*/

/**
 * Definitions
 *
 * @since 1.4.0
 */
$theme_version = '';

if ( function_exists( 'wp_get_theme' ) ) {
	if ( is_child_theme() ) {
		$temp_obj  = wp_get_theme();
		$theme_obj = wp_get_theme( $temp_obj->get( 'Template' ) );
	}
	else {
		$theme_obj = wp_get_theme();
	}

	$theme_version = $theme_obj->get( 'Version' );
	$theme_name    = $theme_obj->get( 'Name' );
	$theme_uri     = $theme_obj->get( 'ThemeURI' );
	$author_uri    = $theme_obj->get( 'AuthorURI' );
}
else {
	$theme_data    = get_theme_data( TEMPLATEPATH.'/style.css' );
	$theme_version = $theme_data['Version'];
	$theme_name    = $theme_data['Name'];
	$theme_uri     = $theme_data['ThemeURI'];
	$author_uri    = $theme_data['AuthorURI'];
}

define( 'SMOF_VERSION', '1.4.0' );
define( 'ADMIN_PATH', TEMPLATEPATH . '/admin/' );
define( 'ADMIN_DIR', get_template_directory_uri() . '/admin/' );
define( 'LAYOUT_PATH', ADMIN_PATH . '/layouts/' );
define( 'THEMENAME', $theme_name );
/* Theme version, uri, and the author uri are not completely necessary, but may be helpful in adding functionality */
define( 'THEMEVERSION', $theme_version );
define( 'THEMEURI', $theme_uri );
define( 'THEMEAUTHORURI', $author_uri );

define( 'OPTIONS', $theme_name.'_options' );
define( 'BACKUPS', $theme_name.'_backups' );

/**
 * Required action filters
 *
 * @uses add_action()
 *
 * @since 1.0.0
 */
global $pagenow;

if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' )
	add_action( 'admin_head', 'of_option_setup' );

add_action( 'admin_head', 'optionsframework_admin_message' );
add_action( 'admin_init', 'optionsframework_admin_init' );
add_action( 'admin_menu', 'optionsframework_add_admin' );
add_action( 'init', 'optionsframework_mlu_init' );

/**
 * Required Files
 *
 * @since 1.0.0
 */
require_once ADMIN_PATH . 'functions/functions.load.php';
require_once ADMIN_PATH . 'classes/class.options-machine.php';

/**
 * AJAX Saving Options
 *
 * @since 1.0.0
 */
add_action( 'wp_ajax_of_ajax_post_action', 'of_ajax_callback' );


text:
/**
 * @ag-grid-community/core - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components
 * @version v25.0.1
 * @link http://www.ag-grid.com/
 * @license MIT
 */
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var context_1 = require("../context/context");
var beanStub_1 = require("../context/beanStub");
var dom_1 = require("../utils/dom");
var keyCode_1 = require("../constants/keyCode");
var StandardMenuFactory = /** @class */ (function (_super) {
    __extends(StandardMenuFactory, _super);
    function StandardMenuFactory() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    StandardMenuFactory.prototype.registerGridComp = function (gridPanel) {
        this.gridPanel = gridPanel;
    };
    StandardMenuFactory.prototype.hideActiveMenu = function () {
        if (this.hidePopup) {
            this.hidePopup();
        }
    };
    StandardMenuFactory.prototype.showMenuAfterMouseEvent = function (column, mouseEvent) {
        var _this = this;
        this.showPopup(column, function (eMenu) {
            _this.popupService.positionPopupUnderMouseEvent({
                column: column,
                type: 'columnMenu',
                mouseEvent: mouseEvent,
                ePopup: eMenu
            });
        }, mouseEvent.target);
    };
    StandardMenuFactory.prototype.showMenuAfterButtonClick = function (column, eventSource) {
        var _this = this;
        this.showPopup(column, function (eMenu) {
            _this.popupService.positionPopupUnderComponent({
                type: 'columnMenu',
                eventSource: eventSource,
                ePopup: eMenu,
                keepWithinBounds: true,
                column: column
            });
        }, eventSource);
    };
    StandardMenuFactory.prototype.showPopup = function (column, positionCallback, eventSource) {
        var _this = this;
        var filterWrapper = this.filterManager.getOrCreateFilterWrapper(column, 'COLUMN_MENU');
        var eMenu = document.createElement('div');
        eMenu.setAttribute('role', 'presentation');
        dom_1.addCssClass(eMenu, 'ag-menu');
        this.tabListener = this.addManagedListener(eMenu, 'keydown', function (e) { return _this.trapFocusWithin(e, eMenu); });
        filterWrapper.guiPromise.then(function (gui) { return eMenu.appendChild(gui); });
        var hidePopup;
        var bodyScrollListener = function (event) {
            // if h scroll, popup is no longer over the column
            if (event.direction === 'horizontal' && hidePopup) {
                hidePopup();
            }
        };
        this.eventService.addEventListener('bodyScroll', bodyScrollListener);
        var closedCallback = function (e) {
            _this.eventService.removeEventListener('bodyScroll', bodyScrollListener);
            column.setMenuVisible(false, 'contextMenu');
            var isKeyboardEvent = e instanceof KeyboardEvent;
            if (_this.tabListener) {
                _this.tabListener = _this.tabListener();
            }
            if (isKeyboardEvent && eventSource && dom_1.isVisible(eventSource)) {
                var focusableEl = _this.focusController.findTabbableParent(eventSource);
                if (focusableEl) {
                    focusableEl.focus();
                }
            }
        };
        var addPopupRes = this.popupService.addPopup({
            modal: true,
            eChild: eMenu,
            closeOnEsc: true,
            closedCallback: closedCallback
        });
        if (addPopupRes) {
            this.hidePopup = hidePopup = addPopupRes.hideFunc;
        }
        filterWrapper.filterPromise.then(function (filter) {
            // need to make sure the filter is present before positioning, as only
            // after filter it is visible can we find out what the width of it is
            positionCallback(eMenu);
            if (filter.afterGuiAttached) {
                filter.afterGuiAttached({ container: 'columnMenu', hidePopup: hidePopup });
            }
        });
        column.setMenuVisible(true, 'contextMenu');
    };
    StandardMenuFactory.prototype.trapFocusWithin = function (e, menu) {
        if (e.keyCode !== keyCode_1.KeyCode.TAB ||
            e.defaultPrevented ||
            this.focusController.findNextFocusableElement(menu, false, e.shiftKey)) {
            return;
        }
        e.preventDefault();
        this.focusController.focusInto(menu, e.shiftKey);
    };
    StandardMenuFactory.prototype.isMenuEnabled = function (column) {
        // for standard, we show menu if filter is enabled, and the menu is not suppressed
        return column.isFilterAllowed();
    };
    __decorate([
        context_1.Autowired('filterManager')
    ], StandardMenuFactory.prototype, "filterManager", void 0);
    __decorate([
        context_1.Autowired('popupService')
    ], StandardMenuFactory.prototype, "popupService", void 0);
    __decorate([
        context_1.Autowired('focusController')
    ], StandardMenuFactory.prototype, "focusController", void 0);
    StandardMenuFactory = __decorate([
        context_1.Bean('menuFactory')
    ], StandardMenuFactory);
    return StandardMenuFactory;
}(beanStub_1.BeanStub));
exports.StandardMenuFactory = StandardMenuFactory;

//# sourceMappingURL=standardMenu.js.map


text:
layout: post
title: 占位
category: 生活
tags:
keywords:
description:
---