text:
package com.culabs.nfvo.model.db;

public class DBRoutingTable {
    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.routing_table_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private String routing_table_id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.name
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private String name;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.vpc_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private String vpc_id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.routing_table_index
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private Integer routing_table_index;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.tenant_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private String tenant_id;

    /**
     * This field was generated by MyBatis Generator.
     * This field corresponds to the database column routing_table.status
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    private String status;

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.routing_table_id
     *
     * @return the value of routing_table.routing_table_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public String getRouting_table_id() {
        return routing_table_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.routing_table_id
     *
     * @param routing_table_id the value for routing_table.routing_table_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setRouting_table_id(String routing_table_id) {
        this.routing_table_id = routing_table_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.name
     *
     * @return the value of routing_table.name
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public String getName() {
        return name;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.name
     *
     * @param name the value for routing_table.name
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.vpc_id
     *
     * @return the value of routing_table.vpc_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public String getVpc_id() {
        return vpc_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.vpc_id
     *
     * @param vpc_id the value for routing_table.vpc_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setVpc_id(String vpc_id) {
        this.vpc_id = vpc_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.routing_table_index
     *
     * @return the value of routing_table.routing_table_index
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public Integer getRouting_table_index() {
        return routing_table_index;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.routing_table_index
     *
     * @param routing_table_index the value for routing_table.routing_table_index
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setRouting_table_index(Integer routing_table_index) {
        this.routing_table_index = routing_table_index;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.tenant_id
     *
     * @return the value of routing_table.tenant_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public String getTenant_id() {
        return tenant_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.tenant_id
     *
     * @param tenant_id the value for routing_table.tenant_id
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setTenant_id(String tenant_id) {
        this.tenant_id = tenant_id;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method returns the value of the database column routing_table.status
     *
     * @return the value of routing_table.status
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public String getStatus() {
        return status;
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method sets the value of the database column routing_table.status
     *
     * @param status the value for routing_table.status
     *
     * @mbggenerated Tue Apr 28 19:19:52 CST 2015
     */
    public void setStatus(String status) {
        this.status = status;
    }
}


text:
/*  LR(1) Parser - recognizes the language of a context-free grammar
    @(#) $Id$
    2022-02-10: LF only
    2016-05-29: Java generics
    2005-02-25, Georg Fischer
*/
/*
 * Copyright 2006 Georg Fischer <dr dot georg dot fischer at gmail dot com>
 *
 * 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 org.teherba.jextra.parse;
import  org.teherba.jextra.parse.BaseParser;
import  org.teherba.jextra.Parm;
import  org.teherba.jextra.gener.Grammar;
import  org.teherba.jextra.gener.Item;
import  org.teherba.jextra.gener.Production;
import  org.teherba.jextra.gener.State;
import  org.teherba.jextra.gener.StateTable;
import  org.teherba.jextra.scan.Scanner;
import  org.teherba.jextra.scan.Symbol;
import  org.teherba.jextra.trans.SemAction;
import  java.util.ArrayList;

/** LR(1) Parser - recognizes the language of a context-free
 *  grammar; utilizes a deterministic push-down stack automaton.
 *  @author Georg Fischer
 */
public class LR1Parser extends BaseParser {
    public final static String CVSID = "@(#) $Id$";

    /** push-down stack for states */
    protected ArrayList<State> stack;

    /** Constructor - central LR(1) parsing algorithm
     *  utilizing a push-down stack of states
     *  @param tab LR(1) table of parser states
     *  @param fileName path/name of the source file, "" = STDIN
     */
    public LR1Parser(StateTable tab, String fileName) {
        super(tab, fileName);
        stack = new ArrayList<State>(128);
        state = stateTable.getStartState();
    } // Constructor(Table, String)

    /** Constructor - allocate new {@link Table}, {@link Grammar} and {@link Scanner} objects
     *  @param fileName path/name of the source file, "" = STDIN
     */
    public LR1Parser(String fileName) {
        super(fileName);
    } // Constructor(String)

    /** Determines the next state of the parser.
     *  This dummy version reads over all symbols without
     *  any state change.
     *  @return true (false) if the sentence of the language
     *  was (not yet) accepted
     */
    @Override
    protected boolean transition() {
        boolean accepted = false;
        Item item = state.delta(symbol);
        switch (item.getAction()) {
            case Item.SHIFT:
                state = item.getSuccessor();
                stack.add(state); // PUSH state
                break;
            case Item.REDUCE:
                Production prod = item.getProduction();
                int top = stack.size();
                int newTop = top - prod.size();
                while (-- top >= newTop) {
                    state = (State) stack.remove(top); // POP right side
                } // while popping
                symbol = prod.getLeftSide();
                readOff = false;
                break;
            case Item.ERROR:
                error(state.getId(), symbol.getEntity());
                // ignore symbol
                break;
            case Item.ACCEPT:
                System.out.println("<accept />" + Parm.getNewline());
                accepted = true;
                break;
        } // switch action
        return accepted;
    } // transition

    /** Test Frame: read a sentence of the grammar
     *  and print its structure tree
     *  @param args command line arguments:
     *

     *
input filename

     *

     */
    public static void main (String args[]) {
        LR1Parser parser = new LR1Parser(args[0]);
        parser.parse();
        System.out.println(parser.getGrammar().legible());
    } // main

} // LR1Parser

redpajama_set_name: RedPajamaGithub


text:
package elasta.composer.respose.generator.impl;

import elasta.composer.respose.generator.JsonArrayResponseGenerator;
import io.vertx.core.json.JsonArray;

/**
 * Created by sohan on 6/30/2017.
 */
final public class JsonArrayResponseGeneratorImpl<T> implements JsonArrayResponseGenerator<T> {
    @Override
    public JsonArray apply(T t) throws Throwable {
        return ((JsonArray) t);
    }
}


text:
{% if page.comments %}

        Please enable JavaScript to view the comments powered by Disqus.

{% endif %}


text:
package tap.sample;

import tap.CommandOptions;
import tap.Pipe;
import tap.Tap;
import tap.TapMapper;
import tap.TapReducer;
import tap.core.*;

//groupBy indicates the grouping for presentation to reducer.  sortby indicates how records should be sorted, i.e.,
//which fields are part of the key.  if groupBy is not set to anything then by default the grouping at the 'key' level.
//more logically we should require the groupBy be specified and change sort to subsort.
public class SortTestAvroInput {

    public static void main(String[] args) throws Exception {
    	String a[] = { "-o", "/tmp/sorttest", "-i", "share/test_data.avro", "-f" };
    	CommandOptions o = new CommandOptions(a);
        /* Set up a basic pipeline of map reduce */
        Tap wordcount = new Tap(o).named("wordcount");
        /* Parse options - just use the standard options - input and output location, time window, etc. */

        if (o.input == null) {
            System.err.println("Must specify input directory");
            return;
        }
        if (o.output == null) {
            System.err.println("Must specify output directory");
            return;
        }

        wordcount.createPhase().reads(o.input).writes(o.output).map(Mapper.class).groupBy("group").sortBy("extra, subsort").reduce(Reducer.class);

        wordcount.make();
    }

    public static class key {
        public String group;
        public String extra;
        public String subsort;
    }

    public static class Mapper extends TapMapper<key,key> {

    	private key outrec = new key();
        @Override
        public void map(key in, Pipe<key> out) {

            out.put(in);
        }
    }

    public static class Reducer  extends TapReducer<key,key> {
    	private key outrec = new key();

        @Override
        public void reduce(Pipe<key> in, Pipe<key> out) {
        	System.out.println("**************");
            for (key rec : in) {

            	outrec.group = rec.group;
            	outrec.extra = rec.extra;
            	outrec.subsort = rec.subsort;
            	System.out.println("REDUCER::" + outrec.group + " " + outrec.extra + " " + outrec.subsort);
                out.put(outrec);
            }

        }

    }

}


text:
ActiveRecord::Schema.define(version: 20150305204311) do

  create_table "users", force: :cascade do |t|
    t.string   "name"
    t.string   "avatar_url"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

end


text:
using System;
using System.Collections.Generic;
using AppStudio.DataProviders;
using AppStudio.Uwp.Navigation;
using Windows10News.ViewModels;

namespace Windows10News.Config
{
    public abstract class PageConfigBase
    {
        public string Title { get; set; }
    }

    public class ListPageConfig<T> : PageConfigBase where T : SchemaBase
    {
        public string PageTitle { get; set; }
        public NavigationInfo ListNavigationInfo { get; set; }
        public Func<T, NavigationInfo> DetailNavigation { get; set; }
        public Action<ItemViewModel, T> LayoutBindings { get; set; }
        public OrderType OrderType { get; set; }
    }

    public class DetailPageConfig<T> : PageConfigBase where T : SchemaBase
    {
        public List<Action<ItemViewModel, T>> LayoutBindings { get; set; }
        public List<ActionConfig<T>> Actions { get; set; }
    }
}


text:
StartScreen_Module::StartScreen_Module(Engine& engine) noexcept :
	Engine_Module(engine)
{
}

void StartScreen_Module::initialize()
{
	Engine_Module::initialize();
	m_engine.getManager_Messages().statement("Loading Module: Starting Screen...");

	// Create Main Menu
	auto startMenu = std::make_shared<StartMenu>(m_engine);
	m_startMenu = startMenu;
}

void StartScreen_Module::deinitialize()
{
	m_engine.getManager_Messages().statement("Unloading Module: Starting Screen...");

	m_startMenu.reset();
}

void StartScreen_Module::frameTick(const float& deltaTime)
{
	m_engine.getModule_Physics().frameTick(m_world, deltaTime);
	m_engine.getModule_Graphics().renderWorld(m_world, deltaTime);
}

void StartScreen_Module::showStartMenu()
{
	m_engine.setMouseInputMode(Engine::MouseInputMode::NORMAL);
	m_engine.getModule_UI().clear();
	m_engine.getModule_UI().pushRootElement(m_startMenu);
	m_engine.getModule_UI().setFocusMap(std::dynamic_pointer_cast<StartMenu>(m_startMenu)->getFocusMap());
}


text:
from airflow import DAG
from airflow.providers.cncf.kubernetes.operators import kubernetes_pod
from airflow.providers.google.cloud.transfers import gcs_to_bigquery

default_args = {
    "owner": "Google",
    "depends_on_past": False,
    "start_date": "2021-03-01",
}

with DAG(
    dag_id="bls.unemployment_cps",
    default_args=default_args,
    max_active_runs=1,
    schedule_interval="@daily",
    catchup=False,
    default_view="graph",
) as dag:

    # Run CSV transform within kubernetes pod
    transform_csv = kubernetes_pod.KubernetesPodOperator(
        task_id="transform_csv",
        startup_timeout_seconds=600,
        name="unemployment_cps",
        namespace="composer",
        service_account_name="datasets",
        image_pull_policy="Always",
        image="{{ var.json.bls.container_registry.run_csv_transform_kub }}",
        env_vars={
            "SOURCE_URLS": '["gs://pdp-feeds-staging/Bureau/unemployment_list_join.csv","gs://pdp-feeds-staging/Bureau_new/ln.csv"]',
            "SOURCE_FILES": '["files/data1.csv","files/data2.csv"]',
            "TARGET_FILE": "files/data_output.csv",
            "TARGET_GCS_BUCKET": "{{ var.value.composer_bucket }}",
            "TARGET_GCS_PATH": "data/bls/unemployment_cps/data_output.csv",
            "PIPELINE_NAME": "unemployment_cps",
            "JOINING_KEY": "series_id",
            "TRIM_SPACE": '["series_id","value","footnote_codes","series_title"]',
            "CSV_HEADERS": '["series_id","year","period","value","footnote_codes","date","series_title"]',
        },
        resources={
            "request_memory": "12G",
            "request_cpu": "2",
            "request_ephemeral_storage": "10G",
        },
    )

    # Task to load CSV data to a BigQuery table
    load_to_bq = gcs_to_bigquery.GCSToBigQueryOperator(
        task_id="load_to_bq",
        bucket="{{ var.value.composer_bucket }}",
        source_objects=["data/bls/unemployment_cps/data_output.csv"],
        source_format="CSV",
        destination_project_dataset_table="bls.unemployment_cps",
        skip_leading_rows=1,
        allow_quoted_newlines=True,
        write_disposition="WRITE_TRUNCATE",
        schema_fields=[
            {"name": "series_id", "type": "STRING", "mode": "required"},
            {"name": "year", "type": "INTEGER", "mode": "NULLABLE"},
            {"name": "period", "type": "STRING", "mode": "NULLABLE"},
            {"name": "value", "type": "FLOAT", "mode": "NULLABLE"},
            {"name": "footnote_codes", "type": "STRING", "mode": "NULLABLE"},
            {"name": "date", "type": "DATE", "mode": "NULLABLE"},
            {"name": "series_title", "type": "STRING", "mode": "NULLABLE"},
        ],
    )

    transform_csv >> load_to_bq


text:
var moment = require('moment');

module.exports = function (orm, db) {
  var Filme = db.define('filme', {
    cartaz             : { type: 'text', required: false },
    titulo             : { type: 'text', size: 255, required: true },
    tituloOriginal     : { type: 'text', size: 255, required: false },
    sinopse            : { type: 'text', required: true },
    trailer            : { type: 'text', size: 255, required: false },
    diretor            : { type: 'text', size: 255, required: false },
    duracao            : { type: 'text', size: 20, required: true },
    ano                : { type: 'text', size: 255, required: false },
    pais               : { type: 'text', size: 80, required: false },
    classificacao      : { type: 'text', size: 80, required: true },
    imdbUrl            : { type: 'text', size: 255, required: false },
    imdbNota           : { type: 'text', size: 10, required: false },
    metacriticUrl      : { type: 'text', size: 255, required: false },
    metacriticNota     : { type: 'text', size: 10, required: false },
    rottenTomatoesUrl  : { type: 'text', size: 255, required: false },
    rottenTomatoesNota : { type: 'text', size: 10, required: false },
    ativo              : { type: 'boolean', defaultValue: true, required: true },
    dataHora           : { type: 'date', required: true, time: true }
  },
  {
    hooks: {
      beforeValidation: function () {
        this.dataHora = new Date();
      }
    },
    validations: {
      /* cidade: [
        orm.enforce.ranges.length(1, undefined, "Digite pelo menos um número"),
        orm.enforce.ranges.length(undefined, 20, "Este campo não pode conter mais que 20 números")
      ],
      grupo: [
        orm.enforce.ranges.length(1, undefined, "Digite pelo menos um número"),
        orm.enforce.ranges.length(undefined, 20, "Este campo não pode conter mais que 20 números")
      ] */
    },
    methods: {
      /* serialize: function () {
        var comments;

        if (this.comments) {
          comments = this.comments.map(function (c) { return c.serialize(); });
        } else {
          comments = [];
        }

        return {
          id        : this.id,
          title     : this.title,
          body      : this.body,
          createdAt : moment(this.createdAt).fromNow(),
          comments  : comments
        };
      } */
    }
  });
};


text:
package reaper.model;

/**
 *
 * @author zaraka
 */
public class EdgeAbstract {

}


text:
class SubnetManagerTest : public ::testing::Test
{
public:
  virtual void SetUp() {}
};

// TEST_F(SubnetManagerTest, constructor){
// std::shared_ptr<MockSpaCommunicator> com = std::make_shared<MockSpaCommunicator>();
// EXPECT_CALL(*com, listen(testing::_)).Times(1);
// SubnetManager manager(com);
// }


text:
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 23.2.3.1
description: >
    Set.prototype.add ( value )

    17 ECMAScript Standard Built-in Objects

includes: [propertyHelper.js]
---*/

assert.sameValue(
    typeof Set.prototype.add,
    "function",
    "`typeof Set.prototype.add` is `'function'`"
);

verifyNotEnumerable(Set.prototype, "add");
verifyWritable(Set.prototype, "add");
verifyConfigurable(Set.prototype, "add");


text:
#define LOG_CLASS "RtpPacket"

#include "../Include_i.h"

STATUS createRtpPacket(UINT8 version, BOOL padding, BOOL extension, UINT8 csrcCount, BOOL marker, UINT8 payloadType, UINT16 sequenceNumber,
                       UINT32 timestamp, UINT32 ssrc, PUINT32 csrcArray, UINT16 extensionProfile, UINT32 extensionLength, PBYTE extensionPayload,
                       PBYTE payload, UINT32 payloadLength, PRtpPacket* ppRtpPacket)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    PRtpPacket pRtpPacket = (PRtpPacket) MEMALLOC(SIZEOF(RtpPacket));
    CHK(pRtpPacket != NULL, STATUS_NOT_ENOUGH_MEMORY);
    pRtpPacket->pRawPacket = NULL;
    pRtpPacket->rawPacketLength = 0;
    CHK_STATUS(setRtpPacket(version, padding, extension, csrcCount, marker, payloadType, sequenceNumber, timestamp, ssrc, csrcArray, extensionProfile,
                            extensionLength, extensionPayload, payload, payloadLength, pRtpPacket));

CleanUp:
    if (STATUS_FAILED(retStatus) && pRtpPacket != NULL) {
        freeRtpPacket(&pRtpPacket);
        pRtpPacket = NULL;
    }

    if (pRtpPacket != NULL) {
        *ppRtpPacket = pRtpPacket;
    }
    LEAVES();
    return retStatus;
}

STATUS setRtpPacket(UINT8 version, BOOL padding, BOOL extension, UINT8 csrcCount, BOOL marker, UINT8 payloadType, UINT16 sequenceNumber,
                    UINT32 timestamp, UINT32 ssrc, PUINT32 csrcArray, UINT16 extensionProfile, UINT32 extensionLength, PBYTE extensionPayload,
                    PBYTE payload, UINT32 payloadLength, PRtpPacket pRtpPacket)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;

    CHK(pRtpPacket != NULL && (extension == FALSE || extensionPayload != NULL), STATUS_NULL_ARG);

    pRtpPacket->header.version = version;
    pRtpPacket->header.padding = padding;
    pRtpPacket->header.extension = extension;
    pRtpPacket->header.csrcCount = csrcCount;
    pRtpPacket->header.marker = marker;
    pRtpPacket->header.payloadType = payloadType;
    pRtpPacket->header.sequenceNumber = sequenceNumber;
    pRtpPacket->header.timestamp = timestamp;
    pRtpPacket->header.ssrc = ssrc;
    pRtpPacket->header.csrcArray = csrcArray;
    if (extension) {
        pRtpPacket->header.extensionProfile = extensionProfile;
        pRtpPacket->header.extensionPayload = extensionPayload;
        pRtpPacket->header.extensionLength = extensionLength;
    } else {
        pRtpPacket->header.extensionProfile = 0;
        pRtpPacket->header.extensionPayload = NULL;
        pRtpPacket->header.extensionLength = 0;
    }
    pRtpPacket->payload = payload;
    pRtpPacket->payloadLength = payloadLength;
CleanUp:
    LEAVES();
    return retStatus;
}

STATUS freeRtpPacket(PRtpPacket* ppRtpPacket)
{
    ENTERS();

    STATUS retStatus = STATUS_SUCCESS;

    CHK(ppRtpPacket != NULL, STATUS_NULL_ARG);

    if (*ppRtpPacket != NULL) {
        SAFE_MEMFREE((*ppRtpPacket)->pRawPacket);
    }
    SAFE_MEMFREE(*ppRtpPacket);

CleanUp:

    CHK_LOG_ERR(retStatus);

    LEAVES();
    return retStatus;
}

STATUS createRtpPacketFromBytes(PBYTE rawPacket, UINT32 packetLength, PRtpPacket* ppRtpPacket)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    PRtpPacket pRtpPacket = (PRtpPacket) MEMALLOC(SIZEOF(RtpPacket));
    CHK(pRtpPacket != NULL, STATUS_NOT_ENOUGH_MEMORY);
    pRtpPacket->pRawPacket = rawPacket;
    pRtpPacket->rawPacketLength = packetLength;
    CHK_STATUS(setRtpPacketFromBytes(rawPacket, packetLength, pRtpPacket));

CleanUp:

    if (STATUS_FAILED(retStatus) && pRtpPacket != NULL) {
        // Release ownership of rawPacket instead of freeing rawPacket
        pRtpPacket->pRawPacket = NULL;
        freeRtpPacket(&pRtpPacket);
        pRtpPacket = NULL;
    }

    if (ppRtpPacket != NULL) {
        *ppRtpPacket = pRtpPacket;
    }

    CHK_LOG_ERR(retStatus);

    LEAVES();
    return retStatus;
}

STATUS constructRetransmitRtpPacketFromBytes(PBYTE rawPacket, UINT32 packetLength, UINT16 sequenceNum, UINT8 payloadType, UINT32 ssrc,
                                             PRtpPacket* ppRtpPacket)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    PBYTE pPayload = NULL;
    PRtpPacket pRtpPacket = (PRtpPacket) MEMALLOC(SIZEOF(RtpPacket));

    CHK(pRtpPacket != NULL, STATUS_NOT_ENOUGH_MEMORY);
    CHK_STATUS(setRtpPacketFromBytes(rawPacket, packetLength, pRtpPacket));
    pPayload = (PBYTE) MEMALLOC(pRtpPacket->payloadLength + SIZEOF(UINT16));
    CHK(pPayload != NULL, STATUS_NOT_ENOUGH_MEMORY);
    // Retransmission payload header is OSN original sequence number
    putUnalignedInt16BigEndian((PINT16) pPayload, pRtpPacket->header.sequenceNumber);
    MEMCPY(pPayload + SIZEOF(UINT16), pRtpPacket->payload, pRtpPacket->payloadLength);
    pRtpPacket->payloadLength += SIZEOF(UINT16);
    pRtpPacket->payload = pPayload;

    pRtpPacket->header.sequenceNumber = sequenceNum;
    pRtpPacket->header.ssrc = ssrc;
    pRtpPacket->header.payloadType = payloadType;
    pRtpPacket->header.padding = FALSE;
    pRtpPacket->pRawPacket = NULL;

    CHK_STATUS(createBytesFromRtpPacket(pRtpPacket, NULL, &pRtpPacket->rawPacketLength));
    CHK(NULL != (pRtpPacket->pRawPacket = (PBYTE) MEMALLOC(pRtpPacket->rawPacketLength)), STATUS_NOT_ENOUGH_MEMORY);
    CHK_STATUS(createBytesFromRtpPacket(pRtpPacket, pRtpPacket->pRawPacket, &pRtpPacket->rawPacketLength));
    pRtpPacket->payload = pRtpPacket->pRawPacket + RTP_GET_RAW_PACKET_SIZE(pRtpPacket) - pRtpPacket->payloadLength;

CleanUp:
    SAFE_MEMFREE(pPayload);
    if (STATUS_FAILED(retStatus) && pRtpPacket != NULL) {
        SAFE_MEMFREE(pRtpPacket->pRawPacket);
        freeRtpPacket(&pRtpPacket);
        pRtpPacket = NULL;
    }

    if (ppRtpPacket != NULL) {
        *ppRtpPacket = pRtpPacket;
    }
    LEAVES();
    return retStatus;
}

STATUS setRtpPacketFromBytes(PBYTE rawPacket, UINT32 packetLength, PRtpPacket pRtpPacket)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    UINT8 version;
    BOOL padding;
    BOOL extension;
    UINT8 csrcCount;
    BOOL marker;
    UINT8 payloadType;
    UINT16 sequenceNumber;
    UINT32 timestamp;
    UINT32 ssrc;
    PUINT32 csrcArray = NULL;
    UINT16 extensionProfile = 0;
    UINT16 extensionLength = 0;
    PBYTE extensionPayload = NULL;
    UINT32 currOffset = 0;

    CHK(pRtpPacket != NULL && rawPacket != NULL, STATUS_NULL_ARG);
    CHK(packetLength >= MIN_HEADER_LENGTH, STATUS_RTP_INPUT_PACKET_TOO_SMALL);

    version = (rawPacket[0] >> VERSION_SHIFT) & VERSION_MASK;
    padding = ((rawPacket[0] >> PADDING_SHIFT) & PADDING_MASK) > 0;
    extension = ((rawPacket[0] >> EXTENSION_SHIFT) & EXTENSION_MASK) > 0;
    csrcCount = rawPacket[0] & CSRC_COUNT_MASK;
    marker = ((rawPacket[1] >> MARKER_SHIFT) & MARKER_MASK) > 0;
    payloadType = rawPacket[1] & PAYLOAD_TYPE_MASK;
    sequenceNumber = getInt16(*(PUINT16) (rawPacket + SEQ_NUMBER_OFFSET));
    timestamp = getInt32(*(PUINT32) (rawPacket + TIMESTAMP_OFFSET));
    ssrc = getInt32(*(PUINT32) (rawPacket + SSRC_OFFSET));

    currOffset = CSRC_OFFSET + (csrcCount * CSRC_LENGTH);
    CHK(packetLength >= currOffset, STATUS_RTP_INPUT_PACKET_TOO_SMALL);

    if (csrcCount > 0) {
        csrcArray = (PUINT32) (rawPacket + CSRC_OFFSET);
    }

    if (extension) {
        extensionProfile = getInt16(*(PUINT16) (rawPacket + currOffset));
        currOffset += SIZEOF(UINT16);
        extensionLength = getInt16(*(PUINT16) (rawPacket + currOffset)) * 4;
        currOffset += SIZEOF(UINT16);
        extensionPayload = (PBYTE) (rawPacket + currOffset);
        currOffset += extensionLength;
    }

    CHK_STATUS(setRtpPacket(version, padding, extension, csrcCount, marker, payloadType, sequenceNumber, timestamp, ssrc, csrcArray, extensionProfile,
                            extensionLength, extensionPayload, rawPacket + currOffset, packetLength - currOffset, pRtpPacket));

CleanUp:
    LEAVES();
    return retStatus;
}

STATUS createBytesFromRtpPacket(PRtpPacket pRtpPacket, PBYTE pRawPacket, PUINT32 pPacketLength)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    UINT32 packetLength = 0;

    CHK(pRtpPacket != NULL && pPacketLength != NULL, STATUS_NULL_ARG);

    packetLength = RTP_GET_RAW_PACKET_SIZE(pRtpPacket);

    // Check if we are trying to calculate the required size only
    CHK(pRawPacket != NULL, retStatus);

    // Otherwise, check if the specified size is enough
    CHK(*pPacketLength >= packetLength, STATUS_NOT_ENOUGH_MEMORY);

    CHK_STATUS(setBytesFromRtpPacket(pRtpPacket, pRawPacket, packetLength));

CleanUp:

    if (pPacketLength != NULL) {
        *pPacketLength = packetLength;
    }

    LEAVES();
    return retStatus;
}

STATUS setBytesFromRtpPacket(PRtpPacket pRtpPacket, PBYTE pRawPacket, UINT32 packetLength)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    PRtpPacketHeader pHeader = &pRtpPacket->header;
    UINT32 packetLengthNeeded = 0;
    PBYTE pCurPtr = pRawPacket;
    UINT8 i;

    CHK(pRtpPacket != NULL && pRawPacket != NULL, STATUS_NULL_ARG);

    packetLengthNeeded = RTP_GET_RAW_PACKET_SIZE(pRtpPacket);
    CHK(packetLength >= packetLengthNeeded, STATUS_BUFFER_TOO_SMALL);
    /*
     *  0                   1                   2                   3
     *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     * |V=2|P|X|  CC   |M|     PT      |       sequence number         |
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     * |                           timestamp                           |
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     * |           synchronization source (SSRC) identifier            |
     * +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
     * |            contributing source (CSRC) identifiers             |
     * |                             ....                              |
     * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     */

    // The first byte contains the version, padding bit, extension bit, and csrc size
    *pCurPtr = ((pHeader->version << VERSION_SHIFT) | pHeader->csrcCount);
    if (pHeader->padding) {
        *pCurPtr |= (1 << PADDING_SHIFT);
    }
    if (pHeader->extension) {
        *pCurPtr |= (1 << EXTENSION_SHIFT);
    }
    pCurPtr++;

    // The second byte contains the marker bit and payload type.
    *pCurPtr = pHeader->payloadType;
    if (pHeader->marker) {
        *pCurPtr |= (1 << MARKER_SHIFT);
    }
    pCurPtr++;

    // https://tools.ietf.org/html/rfc7741#page-5
    // All integer fields in the specifications are encoded as
    //   unsigned integers in network octet order.
    putUnalignedInt16BigEndian(pCurPtr, pHeader->sequenceNumber);
    pCurPtr += SIZEOF(UINT16);

    putUnalignedInt32BigEndian(pCurPtr, pHeader->timestamp);
    pCurPtr += SIZEOF(UINT32);

    putUnalignedInt32BigEndian(pCurPtr, pHeader->ssrc);
    pCurPtr += SIZEOF(UINT32);

    for (i = 0; i < pHeader->csrcCount; i++, pCurPtr += SIZEOF(UINT32)) {
        putUnalignedInt32BigEndian(pCurPtr, pHeader->csrcArray[i]);
    }

    if (pHeader->extension) {
        // the payload must be in 32-bit words.
        CHK((pHeader->extensionLength) % SIZEOF(UINT32) == 0, STATUS_RTP_INVALID_EXTENSION_LEN);

        putUnalignedInt16BigEndian(pCurPtr, pHeader->extensionProfile);
        pCurPtr += SIZEOF(UINT16);
        putUnalignedInt16BigEndian(pCurPtr, pHeader->extensionLength / SIZEOF(UINT32));
        pCurPtr += SIZEOF(UINT16);
        MEMCPY(pCurPtr, pHeader->extensionPayload, pHeader->extensionLength);
        pCurPtr += pHeader->extensionLength;
    }

    if (pRtpPacket->payload != NULL && pRtpPacket->payloadLength > 0) {
        MEMCPY(pCurPtr, pRtpPacket->payload, pRtpPacket->payloadLength);
    }
CleanUp:
    LEAVES();
    return retStatus;
}

STATUS constructRtpPackets(PPayloadArray pPayloadArray, UINT8 payloadType, UINT16 startSequenceNumber, UINT32 timestamp, UINT32 ssrc,
                           PRtpPacket pPackets, UINT32 packetCount)
{
    ENTERS();
    STATUS retStatus = STATUS_SUCCESS;
    UINT16 sequenceNumber = startSequenceNumber;
    PBYTE curPtrInPayload = NULL;
    PUINT32 curPtrInPayloadSubLen = NULL;
    UINT32 i = 0;

    CHK(pPayloadArray != NULL && pPayloadArray->payloadLength > 0, retStatus);
    CHK(pPackets != NULL, STATUS_NULL_ARG);
    CHK(pPayloadArray->payloadSubLenSize <= packetCount, STATUS_BUFFER_TOO_SMALL);

    curPtrInPayload = pPayloadArray->payloadBuffer;
    for (i = 0, curPtrInPayloadSubLen = pPayloadArray->payloadSubLength; i < pPayloadArray->payloadSubLenSize; i++, curPtrInPayloadSubLen++) {
        CHK_STATUS(setRtpPacket(2, FALSE, FALSE, 0, i == pPayloadArray->payloadSubLenSize - 1, payloadType, sequenceNumber, timestamp, ssrc, NULL, 0,
                                0, NULL, curPtrInPayload, *curPtrInPayloadSubLen, pPackets + i));

        sequenceNumber = GET_UINT16_SEQ_NUM(sequenceNumber + 1);

        curPtrInPayload += *curPtrInPayloadSubLen;
    }

CleanUp:
    LEAVES();
    return retStatus;
}


text:
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';

var AttentionScreen = {
  get mainScreen() {
    delete this.mainScreen;
    return this.mainScreen = document.getElementById('screen');
  },

  get attentionScreen() {
    delete this.attentionScreen;
    return this.attentionScreen = document.getElementById('attention-screen');
  },

  get bar() {
    delete this.bar;
    return this.bar = document.getElementById('attention-bar');
  },

  isVisible: function as_isVisible() {
    return this.attentionScreen.classList.contains('displayed');
  },

  isFullyVisible: function as_isFullyVisible() {
    return (this.isVisible() &&
            !this.mainScreen.classList.contains('active-statusbar'));
  },

  init: function as_init() {
    window.addEventListener('mozbrowseropenwindow', this.open.bind(this), true);

    window.addEventListener('mozbrowserclose', this.close.bind(this), true);
    window.addEventListener('mozbrowsererror', this.close.bind(this), true);

    window.addEventListener('keyboardchange', this.resize.bind(this), true);
    window.addEventListener('keyboardhide', this.resize.bind(this), true);

    this.bar.addEventListener('click', this.show.bind(this));

    window.addEventListener('home', this.hide.bind(this));
    window.addEventListener('holdhome', this.hide.bind(this));
    window.addEventListener('appwillopen', this.appOpenHandler.bind(this));
    window.addEventListener('emergencyalert', this.hide.bind(this));

    window.addEventListener('will-unlock', this.screenUnlocked.bind(this));
  },

  resize: function as_resize(evt) {
    if (evt.type == 'keyboardchange') {
      if (!this.isFullyVisible())
        return;

      var keyboardHeight = KeyboardManager.getHeight();
      this.attentionScreen.style.height =
        window.innerHeight - keyboardHeight + 'px';
    } else if (evt.type == 'keyboardhide') {
      // We still need to reset the height property even when the attention
      // screen is not fully visible, or it will overrides the height
      // we defined with #attention-screen.status-mode
      this.attentionScreen.style.height = '';
    }
  },

  appOpenHandler: function as_appHandler(evt) {
    // If the user presses the home button we will still hide the attention
    // screen. But in the case of an app crash we'll keep it fully open
    if (!evt.detail.isHomescreen) {
      this.hide();
    }
  },

  // show the attention screen overlay with newly created frame
  open: function as_open(evt) {
    if (evt.detail.features != 'attention')
      return;

    // stopPropagation means we are not allowing
    // Popup Manager to handle this event
    evt.stopPropagation();

    // Canceling any full screen web content
    if (document.mozFullScreen)
      document.mozCancelFullScreen();

    // Check if the app has the permission to open attention screens
    var manifestURL = evt.target.getAttribute('mozapp');
    var app = Applications.getByManifestURL(manifestURL);

    if (!app || !this._hasAttentionPermission(app))
      return;

    // Hide sleep menu/list menu if it is shown now
    ListMenu.hide();
    SleepMenu.hide();

    // We want the user attention, so we need to turn the screen on
    // if it's off. The lockscreen will grab the focus when we do that
    // so we need to do it before adding the new iframe to the dom
    if (!ScreenManager.screenEnabled)
      ScreenManager.turnScreenOn();

    var attentionFrame = evt.detail.frameElement;
    attentionFrame.dataset.frameType = 'attention';
    attentionFrame.dataset.frameName = evt.detail.name;
    attentionFrame.dataset.frameOrigin = evt.target.dataset.frameOrigin;
    attentionFrame.dataset.manifestURL = manifestURL;

    // We would like to put the dialer call screen on top of all other
    // attention screens by ensure it is the last iframe in the DOM tree
    if (this._hasTelephonyPermission(app)) {
      this.attentionScreen.appendChild(attentionFrame);

      // This event is for SIM PIN lock module.
      // Because we don't need SIM PIN dialog during call
      // but the mozMobileConnection cardstatechange event could
      // be invoked by airplane mode toggle before the call is established.
      this.dispatchEvent('callscreenwillopen');
    } else {
      this.attentionScreen.insertBefore(attentionFrame,
                                        this.bar.nextElementSibling);
    }

    this._updateAttentionFrameVisibility();

    // Make the overlay visible if we are not displayed yet.
    // alternatively, if the newly appended frame is the visible frame
    // and we are in the status bar mode, expend to full screen mode.
    if (!this.isVisible()) {
      // Attention screen now only support portrait mode.
      screen.mozLockOrientation('portrait-primary');

      this.attentionScreen.classList.add('displayed');
      this.mainScreen.classList.add('attention');
      this.dispatchEvent('attentionscreenshow', {
        origin: attentionFrame.dataset.frameOrigin
      });
    } else if (!this.isFullyVisible() &&
      this.attentionScreen.lastElementChild === attentionFrame) {
      this.show();
    }
  },

  // Make sure visibililty state of all attention screens are set correctly
  _updateAttentionFrameVisibility: function as_updateAtteFrameVisibility() {
    var frames = this.attentionScreen.querySelectorAll('iframe');
    var i = frames.length - 1;

    // In case someone call this function w/o checking for frame first
    if (i < 0)
      return;

    // set the last one in the DOM to visible
    // The setTimeout() and the closure is used to workaround
    // https://bugzilla.mozilla.org/show_bug.cgi?id=810431
    setTimeout(function(frame) {
      frame.setVisible(true);
      frame.focus();
    }, 0, frames[i]);

    while (i--) {
      // The setTimeout() and the closure is used to workaround
      // https://bugzilla.mozilla.org/show_bug.cgi?id=810431
      setTimeout(function(frame) {
        frame.setVisible(false);
        frame.blur();
      }, 0, frames[i]);
    }
  },

  // close the attention screen overlay
  close: function as_close(evt) {
    if (!'frameType' in evt.target.dataset ||
        evt.target.dataset.frameType !== 'attention' ||
        (evt.type === 'mozbrowsererror' && evt.detail.type !== 'fatal'))
      return;

    // Check telephony permission before removing.
    var app = Applications.getByManifestURL(evt.target.dataset.manifestURL);
    if (app && this._hasTelephonyPermission(app)) {
      // This event is for SIM PIN lock module.
      // Because we don't need SIM PIN dialog during call
      // but the mozMobileConnection cardstatechange event could
      // be invoked by airplane mode toggle before the call is established.
      this.dispatchEvent('callscreenwillclose');
    }

    // Remove the frame
    var origin = evt.target.dataset.frameOrigin;
    this.attentionScreen.removeChild(evt.target);

    // We've just removed the focused window leaving the system
    // without any focused window, let's fix this.
    window.focus();

    // if there are other attention frames,
    // we need to update the visibility and show() the overlay.
    if (this.attentionScreen.querySelectorAll('iframe').length) {
      this._updateAttentionFrameVisibility();

      this.dispatchEvent('attentionscreenclose', { origin: origin });

      if (!this.isFullyVisible())
        this.show();

      return;
    }

    // There is no iframes left;
    // we should close the attention screen overlay.

    // If the the attention screen is closed during active-statusbar
    // mode, we would need to leave that mode.
    if (!this.isFullyVisible()) {
      this.mainScreen.classList.remove('active-statusbar');
      this.attentionScreen.classList.remove('status-mode');
      this.dispatchEvent('status-inactive',
        { origin: this.attentionScreen.lastElementChild.dataset.frameOrigin });
    }

    // Restore the orientation of current displayed app
    var currentApp = WindowManager.getDisplayedApp();
    if (currentApp)
      WindowManager.setOrientationForApp(currentApp);

    this.attentionScreen.classList.remove('displayed');
    this.mainScreen.classList.remove('attention');
    this.dispatchEvent('attentionscreenhide', { origin: origin });
  },

  // expend the attention screen overlay to full screen
  show: function as_show() {
    // Attention screen now only support portrait mode.
    screen.mozLockOrientation('portrait-primary');

    // leaving "status-mode".
    this.attentionScreen.classList.remove('status-mode');
    // there shouldn't be a transition from "status-mode" to "active-statusbar"
    this.attentionScreen.style.transition = 'none';

    var self = this;
    setTimeout(function nextTick() {
      self.attentionScreen.style.transition = '';

      // leaving "active-statusbar" mode,
      // with a transform: translateY() slide down transition.
      self.mainScreen.classList.remove('active-statusbar');
      self.dispatchEvent('status-inactive', {
        origin: self.attentionScreen.lastElementChild.dataset.frameOrigin
      });
    });
  },

  // shrink the attention screen overlay to status bar
  // invoked when we get a "home" event
  hide: function as_hide() {
    if (!this.isFullyVisible())
      return;

    // Restore the orientation of current displayed app
    var currentApp = WindowManager.getDisplayedApp();

    if (currentApp)
      WindowManager.setOrientationForApp(currentApp);

    // entering "active-statusbar" mode,
    // with a transform: translateY() slide up transition.
    this.mainScreen.classList.add('active-statusbar');

    // The only way to hide attention screen is the home/holdhome event.
    // So we don't fire any origin information here.
    // The expected behavior is restore homescreen visibility to 'true'
    // in the Window Manager.
    this.dispatchEvent('status-active');

    var attentionScreen = this.attentionScreen;
    attentionScreen.addEventListener('transitionend', function trWait() {
      attentionScreen.removeEventListener('transitionend', trWait);

      // transition completed, entering "status-mode" (40px height iframe)
      attentionScreen.classList.add('status-mode');
    });
  },

  dispatchEvent: function as_dispatchEvent(name, detail) {
    var evt = document.createEvent('CustomEvent');
    evt.initCustomEvent(name, true, true, detail);
    window.dispatchEvent(evt);
  },

  // If an app with an active attention screen is switched to,
  // we would need to cover it with it's attention screen.
  // Invoked when displayedApp in Window Manager changes
  // XXX should be replaced with a call that listens to appwillopen
  // TBD: display the attention screen underneath other attention screens.
  showForOrigin: function as_showForOrigin(origin) {
    if (!this.isVisible() || this.isFullyVisible())
      return;

    var attentionFrame = this.attentionScreen.lastElementChild;
    var frameOrigin = attentionFrame.dataset.frameOrigin;
    if (origin === frameOrigin) {
      this.show();
    }
  },

  screenUnlocked: function as_screenUnlocked() {
    // If the app behind the soon-to-be-unlocked lockscreen has an
    // attention screen we should display it
    var app = WindowManager.getCurrentDisplayedApp();
    this.showForOrigin(app.origin);
  },

  getAttentionScreenOrigins: function as_getAttentionScreenOrigins() {
    var attentionScreen = this.attentionScreen;
    var frames = this.attentionScreen.querySelectorAll('iframe');
    var attentiveApps = [];
    Array.prototype.forEach.call(frames, function pushFrame(frame) {
      attentiveApps.push(frame.dataset.frameOrigin);
    });
    return attentiveApps;
  },

  _hasAttentionPermission: function as_hasAttentionPermission(app) {
    var mozPerms = navigator.mozPermissionSettings;
    if (!mozPerms)
      return false;

    var value = mozPerms.get('attention', app.manifestURL, app.origin, false);

    return (value === 'allow');
  },

  _hasTelephonyPermission: function as_hasAttentionPermission(app) {
    var mozPerms = navigator.mozPermissionSettings;
    if (!mozPerms)
      return false;

    var value = mozPerms.get('telephony', app.manifestURL, app.origin, false);

    return (value === 'allow');
  }
};

AttentionScreen.init();


text:
Ionic based apps for server monitoring using sensu api, support for push notification using google cloud messaging & onesignal api

# Instruction
* install nodejs
* install ionic framework ( npm install -g ionic)
* install gulp ( npm install -g ionic )
* clone repo ( git clone https://github.com/nsulistiyawan/sensu-monitoring-app.git )
 cd sensu-monitoring-app
5. install all dependencies ( npm install, bower install )
6. gulp watch
7. changing YOUR_SENSU_URL_BASE_API, ( ONE_SIGNAL_APP_ID, GOOGLE_PROJECT_NUMBER is optional ) on www/js/app.js
8. wait until gulp task for minify and concat js is running
7. run ionic serve / ionic serve --lab, open http://localhost:8100

# Building Instruction for Android
* install Apache Cordova (npm install -g cordova)
* install Java Development Kit (JDK)
* install Apache Ant
* install Android SDK
* adding Android SDK Path, Node Path

  ```
  export PATH="$HOME/your_node_path/bin:$PATH"
  export PATH="/opt/your_android_sdk_path/tools:$PATH"
  export PATH="/opt/your_android_sdk_path:$PATH"
  export ANDROID_HOME="/your_android_sdk_path:$PATH"
  ```

* Save code above on ~/.profile file. So it will be saved on next reboot
* follow instruction at http://ionicframework.com/docs/guide/publishing.html

# Screenshot

![Overview Sensu Monitoring App](http://i.imgur.com/8eGATyo.png)
![Client List Sensu Monitoring App](http://i.imgur.com/MVy6Npn.png)
![Client Details Sensu Monitoring App](http://i.imgur.com/i3IfgGG.png)
![Silenced Event Sensu Monitoring App](http://i.imgur.com/sS02Gm4.png)


text:
<?php

namespace enshrined\svgSanitize\data;

/**
 * Class AllowedAttributes
 *
 * @package enshrined\svgSanitize\data
 */
class AllowedAttributes implements AttributeInterface
{

    /**
     * Returns an array of attributes
     *
     * @return array
     */
    public static function getAttributes()
    {
        return array(
            // HTML
            'accept','action','align','alt','autocomplete','background','bgcolor',
            'border','cellpadding','cellspacing','checked','cite','class','clear','color',
            'cols','colspan','coords','datetime','default','dir','disabled',
            'download','enctype','face','for','headers','height','hidden','high','href',
            'hreflang','id','ismap','label','lang','list','loop', 'low','max',
            'maxlength','media','method','min','multiple','name','noshade','novalidate',
            'nowrap','open','optimum','pattern','placeholder','poster','preload','pubdate',
            'radiogroup','readonly','rel','required','rev','reversed','rows',
            'rowspan','spellcheck','scope','selected','shape','size','span',
            'srclang','start','src','step','style','summary','tabindex','title',
            'type','usemap','valign','value','width','xmlns',

            // SVG
            'accent-height','accumulate','additivive','alignment-baseline',
            'ascent','azimuth','baseline-shift','bias','clip','clip-path',
            'clip-rule','color','color-interpolation','color-interpolation-filters',
            'color-profile','color-rendering','cx','cy','d','dy','dy','direction',
            'display','divisor','dur','elevation','end','fill','fill-opacity',
            'fill-rule','filter','flood-color','flood-opacity','font-family',
            'font-size','font-size-adjust','font-stretch','font-style','font-variant',
            'font-weight','image-rendering','in','in2','k1','k2','k3','k4','kerning',
            'letter-spacing','lighting-color','local','marker-end','marker-mid',
            'marker-start','max','mask','mode','min','offset','operator','opacity',
            'order','overflow','paint-order','path','points','r','rx','ry','radius',
            'restart','scale','seed','shape-rendering','stop-color','stop-opacity',
            'stroke-dasharray','stroke-dashoffset','stroke-linecap','stroke-linejoin',
            'stroke-miterlimit','stroke-opacity','stroke','stroke-width','transform',
            'text-anchor','text-decoration','text-rendering','u1','u2','viewbox',
            'visibility','word-spacing','wrap','writing-mode','x','x1','x2','y',
            'y1','y2','z',

            // MathML
            'accent','accentunder','bevelled','close','columnsalign','columnlines',
            'columnspan','denomalign','depth','display','displaystyle','fence',
            'frame','largeop','length','linethickness','lspace','lquote',
            'mathbackground','mathcolor','mathsize','mathvariant','maxsize',
            'minsize','movablelimits','notation','numalign','open','rowalign',
            'rowlines','rowspacing','rowspan','rspace','rquote','scriptlevel',
            'scriptminsize','scriptsizemultiplier','selection','separator',
            'separators','stretchy','subscriptshift','supscriptshift','symmetric',
            'voffset',

            // XML
            'xlink:href','xml:id','xlink:title','xml:space',

            // Camel Case
            "allowReorder", "attributeName", "attributeType", "autoReverse", "baseFrequency",
            "baseProfile", "calcMode", "clipPathUnits", "contentScriptType", "contentStyleType",
            "diffuseConstant", "edgeMode", "externalResourcesRequired", "filterRes",
            "filterUnits", "glyphRef", "gradientTransform", "gradientUnits", "kernelMatrix",
            "kernelUnitLength", "keyPoints", "keySplines", "keyTimes", "lengthAdjust",
            "limitingConeAngle", "markerHeight", "markerUnits", "markerWidth", "maskContentUnits",
            "maskUnits", "numOctaves", "pathLength", "patternContentUnits", "patternTransform",
            "patternUnits", "pointsAtX", "pointsAtY", "pointsAtZ", "preserveAlpha",
            "preserveAspectRatio", "primitiveUnits", "refX", "refY", "repeatCount",
            "repeatDur", "requiredExtensions", "requiredFeatures", "specularConstant",
            "specularExponent", "spreadMethod", "startOffset", "stdDeviation", "stitchTiles",
            "surfaceScale", "systemLanguage", "tableValues", "targetX", "targetY", "textLength",
            "viewBox", "viewTarget", "xChannelSelector", "yChannelSelector", "zoomAndPan",
        );
    }
}


text:
from __future__ import unicode_literals
import pytest
from prompt_toolkit.completion import Completion
from prompt_toolkit.document import Document
from pgcli.packages.function_metadata import FunctionMetadata

metadata = {
            'tables': {
                'public':   {
                                'users': ['id', 'email', 'first_name', 'last_name'],
                                'orders': ['id', 'ordered_date', 'status'],
                                'select': ['id', 'insert', 'ABC']
                            },
                'custom':   {
                                'users': ['id', 'phone_number'],
                                'products': ['id', 'product_name', 'price'],
                                'shipments': ['id', 'address', 'user_id']
                            }},
            'functions': {
                            'public': [
                                ['func1', '', '', False, False, False],
                                ['func2', '', '', False, False, False]],
                            'custom': [
                                ['func3', '', '', False, False, False],
                                ['set_returning_func',
                                    'OUT x INT', 'SETOF INT',
                                     False, False, True]],
                         },
            'datatypes': {
                            'public':   ['typ1', 'typ2'],
                            'custom':   ['typ3', 'typ4'],
                         },
            }

@pytest.fixture
def completer():

    import pgcli.pgcompleter as pgcompleter
    comp = pgcompleter.PGCompleter(smart_completion=True)

    schemata, tables, columns = [], [], []

    for schema, tbls in metadata['tables'].items():
        schemata.append(schema)

        for table, cols in tbls.items():
            tables.append((schema, table))
            columns.extend([(schema, table, col) for col in cols])

    functions = [FunctionMetadata(schema, *func_meta)
                    for schema, funcs in metadata['functions'].items()
                    for func_meta in funcs]

    datatypes = [(schema, datatype)
                    for schema, datatypes in metadata['datatypes'].items()
                    for datatype in datatypes]

    comp.extend_schemata(schemata)
    comp.extend_relations(tables, kind='tables')
    comp.extend_columns(columns, kind='tables')
    comp.extend_functions(functions)
    comp.extend_datatypes(datatypes)
    comp.set_search_path(['public'])

    return comp

@pytest.fixture
def complete_event():
    from mock import Mock
    return Mock()

def test_schema_or_visible_table_completion(completer, complete_event):
    text = 'SELECT * FROM '
    position = len(text)
    result = completer.get_completions(
        Document(text=text, cursor_position=position), complete_event)
    assert set(result) == set([
       Completion(text='public', start_position=0, display_meta='schema'),
       Completion(text='custom', start_position=0, display_meta='schema'),
       Completion(text='users', start_position=0, display_meta='table'),
       Completion(text='"select"', start_position=0, display_meta='table'),
       Completion(text='orders', start_position=0, display_meta='table')])

def test_suggested_column_names_from_shadowed_visible_table(completer, complete_event):
    """
    Suggest column and function names when selecting from table
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT  from users'
    position = len('SELECT ')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))

    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='email', start_position=0, display_meta='column'),
        Completion(text='first_name', start_position=0, display_meta='column'),
        Completion(text='last_name', start_position=0, display_meta='column'),
        Completion(text='func1', start_position=0, display_meta='function'),
        Completion(text='func2', start_position=0, display_meta='function')] +
        list(map(lambda f: Completion(f, display_meta='function'), completer.functions)) +
        list(map(lambda x: Completion(x, display_meta='keyword'), completer.keywords))
        )

def test_suggested_column_names_from_qualified_shadowed_table(completer, complete_event):
    text = 'SELECT  from custom.users'
    position = len('SELECT ')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='phone_number', start_position=0, display_meta='column'),
        Completion(text='func1', start_position=0, display_meta='function'),
        Completion(text='func2', start_position=0, display_meta='function')] +
        list(map(lambda f: Completion(f, display_meta='function'), completer.functions)) +
        list(map(lambda x: Completion(x, display_meta='keyword'), completer.keywords))
        )

def test_suggested_column_names_from_schema_qualifed_table(completer, complete_event):
    """
    Suggest column and function names when selecting from a qualified-table
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT  from custom.products'
    position = len('SELECT ')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position), complete_event))
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='product_name', start_position=0, display_meta='column'),
        Completion(text='price', start_position=0, display_meta='column'),
        Completion(text='func1', start_position=0, display_meta='function'),
        Completion(text='func2', start_position=0, display_meta='function')] +
        list(map(lambda f: Completion(f, display_meta='function'), completer.functions)) +
        list(map(lambda x: Completion(x, display_meta='keyword'), completer.keywords))
        )

def test_suggested_column_names_in_function(completer, complete_event):
    """
    Suggest column and function names when selecting multiple
    columns from table
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT MAX( from custom.products'
    position = len('SELECT MAX(')
    result = completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event)
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='product_name', start_position=0, display_meta='column'),
        Completion(text='price', start_position=0, display_meta='column')])

def test_suggested_table_names_with_schema_dot(completer, complete_event):
    text = 'SELECT * FROM custom.'
    position = len(text)
    result = completer.get_completions(
        Document(text=text, cursor_position=position), complete_event)
    assert set(result) == set([
        Completion(text='users', start_position=0, display_meta='table'),
        Completion(text='products', start_position=0, display_meta='table'),
        Completion(text='shipments', start_position=0, display_meta='table'),
        Completion(text='set_returning_func', start_position=0, display_meta='function'),
    ])
def test_suggested_column_names_with_qualified_alias(completer, complete_event):
    """
    Suggest column names on table alias and dot
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT p. from custom.products p'
    position = len('SELECT p.')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='product_name', start_position=0, display_meta='column'),
        Completion(text='price', start_position=0, display_meta='column')])

def test_suggested_multiple_column_names(completer, complete_event):
    """
    Suggest column and function names when selecting multiple
    columns from table
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT id,  from custom.products'
    position = len('SELECT id, ')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='product_name', start_position=0, display_meta='column'),
        Completion(text='price', start_position=0, display_meta='column'),
        Completion(text='func1', start_position=0, display_meta='function'),
        Completion(text='func2', start_position=0, display_meta='function')] +
        list(map(lambda f: Completion(f, display_meta='function'), completer.functions)) +
        list(map(lambda x: Completion(x, display_meta='keyword'), completer.keywords))
        )

def test_suggested_multiple_column_names_with_alias(completer, complete_event):
    """
    Suggest column names on table alias and dot
    when selecting multiple columns from table
    :param completer:
    :param complete_event:
    :return:
    """
    text = 'SELECT p.id, p. from custom.products p'
    position = len('SELECT u.id, u.')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='*', start_position=0, display_meta='column'),
        Completion(text='id', start_position=0, display_meta='column'),
        Completion(text='product_name', start_position=0, display_meta='column'),
        Completion(text='price', start_position=0, display_meta='column')])

def test_suggested_aliases_after_on(completer, complete_event):
    text = 'SELECT x.id, y.product_name FROM custom.products x JOIN custom.products y ON '
    position = len(text)
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='x', start_position=0, display_meta='table alias'),
        Completion(text='y', start_position=0, display_meta='table alias')])

def test_suggested_aliases_after_on_right_side(completer, complete_event):
    text = 'SELECT x.id, y.product_name FROM custom.products x JOIN custom.products y ON x.id = '
    position = len(text)
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='x', start_position=0, display_meta='table alias'),
        Completion(text='y', start_position=0, display_meta='table alias')])

def test_table_names_after_from(completer, complete_event):
    text = 'SELECT * FROM '
    position = len('SELECT * FROM ')
    result = set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    assert set(result) == set([
        Completion(text='public', start_position=0, display_meta='schema'),
        Completion(text='custom', start_position=0, display_meta='schema'),
        Completion(text='users', start_position=0, display_meta='table'),
        Completion(text='orders', start_position=0, display_meta='table'),
        Completion(text='"select"', start_position=0, display_meta='table'),
        ])

def test_schema_qualified_function_name(completer, complete_event):
    text = 'SELECT custom.func'
    postion = len(text)
    result = set(completer.get_completions(
        Document(text=text, cursor_position=postion), complete_event))
    assert result == set([
        Completion(text='func3', start_position=-len('func'), display_meta='function'),
        Completion(text='set_returning_func', start_position=-len('func'), display_meta='function')])

@pytest.mark.parametrize('text', [
    'SELECT 1::custom.',
    'CREATE TABLE foo (bar custom.',
    'CREATE FUNCTION foo (bar INT, baz custom.',
    'ALTER TABLE foo ALTER COLUMN bar TYPE custom.',
])
def test_schema_qualified_type_name(text, completer, complete_event):
    pos = len(text)
    result = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)
    assert set(result) == set([
        Completion(text='typ3', display_meta='datatype'),
        Completion(text='typ4', display_meta='datatype'),
        Completion(text='users', display_meta='table'),
        Completion(text='products', display_meta='table'),
        Completion(text='shipments', display_meta='table'),
        ])

def test_suggest_columns_from_aliased_set_returning_function(completer, complete_event):
    sql = 'select f. from custom.set_returning_func() f'
    pos = len('select f.')
    result = completer.get_completions(Document(text=sql, cursor_position=pos),
                                       complete_event)
    assert set(result) == set([
        Completion(text='x', start_position=0, display_meta='column')])


text:
'use strict';

/*
 *
 * Action types for income
 *
 */
export const ADD_CATEGORY = 'income/ADD_CATEGORY';
export const DELETE_CATEGORY = 'income/DELETE_CATEGORY';
export const UPDATE_CATEGORY = 'income/UPDATE_CATEGORY';
export const RECEIVE_CATEGORIES = 'income/RECEIVE_CATEGORIES';


text:
\documentclass[10pt]{testfu}

\title{MbUnit Cookbook}
\author{Jonathan de Halleux\\
mbunit.tigris.org}
\begin{document}
\initreport

\chapter{Introduction}

\begin{cs}

\end{cs}

\end{document}


text:
require 'models.Vae'
local SimpleVae, parent = torch.class('SimpleVae', 'Vae')
local c = require 'trepl.colorize'
require 'nngraph'
require 'nnutils.init'

function SimpleVae:__init(struct)
   -- build model
   self.encoder, self.decoder, self.model = self:build(struct)
   self.kld = nn.SimpleKLDCriterion()
   self.bce = nn.BCECriterion()
   self.bce.sizeAverage = false
   self.parameters, self.gradients = self.model:getParameters()
end

function SimpleVae:build(struct)
   -- construct self.encoder
   local encoder = nn.Sequential()
   encoder:add(nn.Linear(struct.x, struct.h))
   encoder:add(nn.ReLU(true))
   local mean_logvar = nn.ConcatTable()
   mean_logvar:add(nn.Linear(struct.h, struct.z))
   mean_logvar:add(nn.Linear(struct.h, struct.z))
   encoder:add(mean_logvar)
   -- construct self.decoder
   local decoder = nn.Sequential()
   decoder:add(nn.Linear(struct.z, struct.h))
   decoder:add(nn.ReLU(true))
   decoder:add(nn.Linear(struct.h, struct.x))
   decoder:add(nn.Sigmoid(true))
   -- combine the two
   local input = nn.Identity()()
   local mu, logv = encoder(input):split(2)
   local code = nn.SimpleSampler()({mu, logv})
   local recon = decoder(code)
   local model = nn.gModule({input},{mu, logv, recon})
   return encoder, decoder, model
end

function SimpleVae:feval(x, minibatch)
   local input = minibatch[1]
   if self.parameters ~= x then
      self.parameters:copy(x)
   end
   self.model:zeroGradParameters()
   -- forward
   local mu, logv, recon = unpack(self.model:forward(input))
   local kld_err = self.kld:forward(mu, logv)
   local bce_err = self.bce:forward(recon, input)
   -- backward
   local dmu, dlogv = unpack(self.kld:backward(mu, logv))
   local drecon = self.bce:backward(recon, input)
   error_grads = {dmu, dlogv, drecon}
   self.model:backward(input, error_grads)
   -- record
   local nelbo = kld_err + bce_err
   self:record(kld_err, bce_err, nelbo)
   return nelbo, self.gradients
end


text:
// Copyright 2016 Twitter. All rights reserved.
//
// 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 com.twitter.heron.scheduler.local;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;

import com.twitter.heron.proto.scheduler.Scheduler;
import com.twitter.heron.spi.common.Config;
import com.twitter.heron.spi.common.ConfigKeys;
import com.twitter.heron.spi.common.Keys;
import com.twitter.heron.spi.packing.PackingPlan;
import com.twitter.heron.spi.utils.PackingTestUtils;

public class LocalSchedulerTest {
  private static final String TOPOLOGY_NAME = "testTopology";
  private static final int NUM_CONTAINER = 2;
  private static final int MAX_WAITING_SECOND = 10;
  private static LocalScheduler scheduler;
  private Config config;
  private Config runtime;

  @Before
  public void before() throws Exception {
    scheduler = Mockito.spy(LocalScheduler.class);
    config = Mockito.mock(Config.class);
    Mockito.when(config.getStringValue(ConfigKeys.get("TOPOLOGY_NAME"))).thenReturn(TOPOLOGY_NAME);

    runtime = Mockito.mock(Config.class);
    Mockito.when(runtime.getLongValue(Keys.numContainers())).thenReturn(NUM_CONTAINER * 1L);
    scheduler.initialize(config, runtime);
  }

  @After
  public void after() throws Exception {
    scheduler.close();
  }

  @Test
  public void testClose() throws Exception {
    LocalScheduler localScheduler = new LocalScheduler();
    // The MonitorService should started
    ExecutorService monitorService = localScheduler.getMonitorService();
    Assert.assertFalse(monitorService.isShutdown());
    Assert.assertEquals(0, localScheduler.getProcessToContainer().size());

    // The MonitorService should shutdown
    localScheduler.close();
    Assert.assertTrue(monitorService.isShutdown());
  }

  @Test
  public void testOnSchedule() throws Exception {
    Mockito.doNothing().
        when(scheduler).startExecutorMonitor(Mockito.anyInt(), Mockito.any(Process.class));
    Process mockProcess = Mockito.mock(Process.class);
    Mockito.doReturn(mockProcess).
        when(scheduler).startExecutorProcess(Mockito.anyInt());

    PackingPlan packingPlan = Mockito.mock(PackingPlan.class);
    Assert.assertTrue(scheduler.onSchedule(packingPlan));
    Assert.assertTrue(scheduler.getProcessToContainer().size() > 0);

    for (int i = 0; i < NUM_CONTAINER; i++) {
      Mockito.verify(scheduler).startExecutor(i);
      Mockito.verify(scheduler).startExecutorProcess(i);
      Mockito.verify(scheduler).startExecutorMonitor(i, mockProcess);
    }
  }

  @Test
  public void testAddContainer() throws Exception {
    Mockito.when(runtime.getLongValue(Keys.numContainers())).thenReturn(2L);
    scheduler.initialize(config, runtime);

    //verify plan is deployed and containers are created
    Mockito.doNothing().
        when(scheduler).startExecutorMonitor(Mockito.anyInt(), Mockito.any(Process.class));
    Process mockProcessTM = Mockito.mock(Process.class);
    Mockito.doReturn(mockProcessTM).when(scheduler).startExecutorProcess(0);

    Process mockProcessWorker1 = Mockito.mock(Process.class);
    Mockito.doReturn(mockProcessWorker1).when(scheduler).startExecutorProcess(1);

    PackingPlan packingPlan = Mockito.mock(PackingPlan.class);
    Assert.assertTrue(scheduler.onSchedule(packingPlan));

    Mockito.verify(scheduler, Mockito.times(NUM_CONTAINER)).startExecutor(Mockito.anyInt());

    //now verify add container adds new container
    Process mockProcessWorker2 = Mockito.mock(Process.class);
    Mockito.doReturn(mockProcessWorker2).when(scheduler).startExecutorProcess(2);
    Set<PackingPlan.ContainerPlan> containers = new HashSet<>();
    Set<PackingPlan.ContainerPlan> spyContainers = Mockito.spy(containers);

    Mockito.doReturn(1).when(spyContainers).size();
    scheduler.addContainers(spyContainers);
    Mockito.verify(scheduler).startExecutor(NUM_CONTAINER);

    Process mockProcess = Mockito.mock(Process.class);
    Mockito.doReturn(mockProcess).when(scheduler).startExecutorProcess(Mockito.anyInt());
    Mockito.doReturn(2).when(spyContainers).size();
    scheduler.addContainers(spyContainers);
    Mockito.verify(scheduler).startExecutor(NUM_CONTAINER + 1);
    Mockito.verify(scheduler).startExecutor(NUM_CONTAINER + 2);
  }

  /**
   * Verify containers can be removed by Local Scheduler
   */
  @Test
  public void testRemoveContainer() throws Exception {
    final int LOCAL_NUM_CONTAINER = 6;

    Mockito.when(runtime.getLongValue(Keys.numContainers())).thenReturn(LOCAL_NUM_CONTAINER * 1L);
    scheduler.initialize(config, runtime);

    //verify plan is deployed and containers are created
    Mockito.doNothing().
        when(scheduler).startExecutorMonitor(Mockito.anyInt(), Mockito.any(Process.class));

    Process[] processes = new Process[LOCAL_NUM_CONTAINER];
    Set<PackingPlan.ContainerPlan> existingContainers = new HashSet<>();
    for (int i = 0; i < LOCAL_NUM_CONTAINER; i++) {
      processes[i] = Mockito.mock(Process.class);
      Mockito.doReturn(processes[i]).when(scheduler).startExecutorProcess(i);
      existingContainers.add(PackingTestUtils.testContainerPlan(i));
    }

    PackingPlan packingPlan = Mockito.mock(PackingPlan.class);
    Assert.assertTrue(scheduler.onSchedule(packingPlan));
    Assert.assertEquals(LOCAL_NUM_CONTAINER, scheduler.getProcessToContainer().size());
    Mockito.verify(scheduler, Mockito.times(LOCAL_NUM_CONTAINER)).startExecutor(Mockito.anyInt());

    Set<PackingPlan.ContainerPlan> containersToRemove = new HashSet<>();
    PackingPlan.ContainerPlan containerToRemove =
        PackingTestUtils.testContainerPlan(LOCAL_NUM_CONTAINER - 1);
    containersToRemove.add(containerToRemove);
    scheduler.removeContainers(containersToRemove);
    existingContainers.remove(containerToRemove);
    Assert.assertEquals(existingContainers.size(), scheduler.getProcessToContainer().size());
    Mockito.verify(processes[LOCAL_NUM_CONTAINER - 1]).destroy();
    // verify no new process restarts
    Mockito.verify(scheduler, Mockito.times(LOCAL_NUM_CONTAINER)).startExecutor(Mockito.anyInt());

    containersToRemove.clear();
    containersToRemove.add(PackingTestUtils.testContainerPlan(1));
    containersToRemove.add(PackingTestUtils.testContainerPlan(2));
    scheduler.removeContainers(containersToRemove);
    existingContainers.remove(PackingTestUtils.testContainerPlan(1));
    existingContainers.remove(PackingTestUtils.testContainerPlan(2));

    Assert.assertEquals(existingContainers.size(), scheduler.getProcessToContainer().size());
    Mockito.verify(processes[1]).destroy();
    Mockito.verify(processes[2]).destroy();
    // verify no new process restarts
    Mockito.verify(scheduler, Mockito.times(LOCAL_NUM_CONTAINER)).startExecutor(Mockito.anyInt());
  }

  @Test
  public void testOnKill() throws Exception {
    Process mockProcess = Mockito.mock(Process.class);
    scheduler.getProcessToContainer().put(mockProcess, 0);

    Assert.assertTrue(scheduler.onKill(Scheduler.KillTopologyRequest.getDefaultInstance()));
    Assert.assertEquals(0, scheduler.getProcessToContainer().size());
    Assert.assertTrue(scheduler.isTopologyKilled());
    Mockito.verify(mockProcess).destroy();
  }

  @Test
  public void testOnRestart() throws Exception {
    Process mockProcess = Mockito.mock(Process.class);

    // Restart only one container
    Scheduler.RestartTopologyRequest restartOne =
        Scheduler.RestartTopologyRequest.newBuilder().
            setTopologyName(TOPOLOGY_NAME).
            setContainerIndex(1).
            build();

    scheduler.getProcessToContainer().put(mockProcess, 0);
    // Failed to restart due to container not exist
    Assert.assertFalse(scheduler.onRestart(restartOne));

    // Happy to restart one container
    Scheduler.RestartTopologyRequest restartZero =
        Scheduler.RestartTopologyRequest.newBuilder().
            setTopologyName(TOPOLOGY_NAME).
            setContainerIndex(0).
            build();
    scheduler.getProcessToContainer().put(mockProcess, 0);
    Assert.assertTrue(scheduler.onRestart(restartZero));

    // Happy to restart all containers
    Scheduler.RestartTopologyRequest restartAll =
        Scheduler.RestartTopologyRequest.newBuilder().
            setTopologyName(TOPOLOGY_NAME).
            setContainerIndex(-1).
            build();
    scheduler.getProcessToContainer().put(mockProcess, 0);
    Assert.assertTrue(scheduler.onRestart(restartAll));
  }

  @Test
  public void testStartExecutorMonitorNotKilled() throws Exception {
    int containerId = 0;
    int exitValue = 1;
    Process containerExecutor = Mockito.mock(Process.class);
    Mockito.doReturn(exitValue).when(containerExecutor).exitValue();
    Mockito.doNothing().when(scheduler).startExecutor(Mockito.anyInt());

    // Start the process
    scheduler.getProcessToContainer().put(containerExecutor, containerId);
    scheduler.startExecutorMonitor(containerId, containerExecutor);

    // Shut down the MonitorService
    scheduler.getMonitorService().shutdown();
    scheduler.getMonitorService().awaitTermination(MAX_WAITING_SECOND, TimeUnit.SECONDS);
    // The dead process should be restarted
    Mockito.verify(scheduler).startExecutor(containerId);
    Assert.assertFalse(scheduler.isTopologyKilled());
  }

  @Test
  public void testStartExecutorMonitorKilled() throws Exception {
    int containerId = 0;
    int exitValue = 1;

    Process containerExecutor = Mockito.mock(Process.class);
    Mockito.doReturn(exitValue).when(containerExecutor).exitValue();
    Mockito.doNothing().when(scheduler).startExecutor(Mockito.anyInt());

    // Set the killed flag and the dead process should not be restarted
    scheduler.onKill(Scheduler.KillTopologyRequest.getDefaultInstance());

    // Start the process
    scheduler.getProcessToContainer().put(containerExecutor, containerId);
    scheduler.startExecutorMonitor(containerId, containerExecutor);

    // Shut down the MonitorService
    scheduler.getMonitorService().shutdown();
    scheduler.getMonitorService().awaitTermination(MAX_WAITING_SECOND, TimeUnit.SECONDS);
    // The dead process should not be restarted
    Mockito.verify(scheduler, Mockito.never()).startExecutor(Mockito.anyInt());
    Assert.assertTrue(scheduler.isTopologyKilled());
  }
}


text:
namespace content {
class RenderFrameHost;
}

namespace language {

void BindContentTranslateDriver(
    content::RenderFrameHost* render_frame_host,
    mojo::PendingReceiver<translate::mojom::ContentTranslateDriver> receiver);
}

#endif  // CHROME_BROWSER_LANGUAGE_TRANSLATE_FRAME_BINDER_H_


text:
/*
*  eXist Open Source Native XML Database
*  Copyright (C) 2001-04 Wolfgang M. Meier (wolfgang@exist-db.org)
*  and others (see http://exist-db.org)
*
*  This program is free software; you can redistribute it and/or
*  modify it under the terms of the GNU Lesser General Public License
*  as published by the Free Software Foundation; either version 2
*  of the License, or (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Lesser General Public License for more details.
*
*  You should have received a copy of the GNU Lesser General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*  $Id: ReplaceResourceAction.java 4829 2006-11-18 00:47:24Z dizzzz $
*/
package org.exist.xmldb.concurrent.action;

import java.io.File;

import junit.framework.Assert;

import org.exist.xmldb.concurrent.DBUtils;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.ResourceSet;

/**
 * Replace an existing resource.
 *
 * @author wolf
 */
public class ReplaceResourceAction extends Action {

	public final static String XML =
		"<config>" +
		"<user id=\"george\">" +
		"<phone>+49 69 888478</phone>" +
		"<email>george@email.com</email>" +
		"<customer-id>64534233</customer-id>" +
		"<bank-account>7466356</bank-account>" +
		"</user>" +
		"<user id=\"sam\">" +
		"<phone>+49 69 774345</phone>" +
		"<email>sam@email.com</email>" +
		"<customer-id>993834</customer-id>" +
		"<bank-account>364553</bank-account>" +
		"</user>" +
		"</config>";

	private final static String TEST_QUERY1 = "//user[@id = 'george']/phone[contains(., '69')]/text()";
	private final static String TEST_QUERY2 = "//user[@id = 'sam']/customer-id[. = '993834']";
	private final static String TEST_QUERY3 = "//user[email = 'sam@email.com']";

	private int count = 0;

	/**
	 * @param collectionPath
	 * @param resourceName
	 */
	public ReplaceResourceAction(String collectionPath, String resourceName) {
		super(collectionPath, resourceName);
	}

	/* (non-Javadoc)
	 * @see org.exist.xmldb.test.concurrent.Action#execute()
	 */
	public boolean execute() throws Exception {
		Collection col = DatabaseManager.getCollection(collectionPath, "admin", null);
		String xml =
			"<data now=\"" + System.currentTimeMillis() + "\" count=\"" +
			++count + "\">" + XML + "</data>";

		DBUtils.addXMLResource(col, resourceName, xml);

		ResourceSet result = DBUtils.queryResource(col, resourceName, TEST_QUERY1);
		Assert.assertEquals(1, result.getSize());
		Assert.assertEquals("+49 69 888478", result.getResource(0).getContent());

		result = DBUtils.queryResource(col, resourceName, TEST_QUERY2);
		Assert.assertEquals(1, result.getSize());

		result = DBUtils.queryResource(col, resourceName, TEST_QUERY3);
		Assert.assertEquals(1, result.getSize());
		return false;
	}
}


text:
include_recipe "mariadb-enterprise::default"

if (node['mariadb']['token'] == "")
  msg = "Enterprise token isn't specified!"
  print msg
  raise msg
end

repo = "https://downloads.mariadb.com/enterprise/#{node['mariadb']['token']}/"
case node[:platform_family]
when "debian"
  execute "Downloading package...." do
    command "wget  #{repo}/generate/#{node['mariadb']['version']}/mariadb-enterprise-repository.deb -O /tmp/mariadb-enterprise-repository.deb"
  end
  package 'mariadb-enterprise-repository' do
    source "/tmp/mariadb-enterprise-repository.deb"
    provider Chef::Provider::Package::Dpkg
    action :install
  end
  execute "Updating..." do
    command "apt-get update"
  end
when "rhel", "fedora"
  execute "Downloading package...." do
    command "wget  #{repo}/generate/#{node['mariadb']['version']}/mariadb-enterprise-repository.rpm -O /tmp/mariadb-enterprise-repository.rpm"
  end
  package 'mariadb-enterprise-repository' do
    source "/tmp/mariadb-enterprise-repository.rpm"
    provider Chef::Provider::Package::Rpm
    action :install
  end
when "suse"
  execute "Downloading package...." do
    command "wget  #{repo}/generate/#{node['mariadb']['version']}/mariadb-enterprise-repository-suse.rpm -O /tmp/mariadb-enterprise-repository.rpm"
  end
  package 'mariadb-enterprise-repository' do
    source "/tmp/mariadb-enterprise-repository.rpm"
    provider Chef::Provider::Package::Rpm
    action :install
  end
when "windows"
  arch = node[:kernel][:machine] == "x86_64" ? "winx64" : "win32"
  md5sums_file = "#{Chef::Config[:file_cache_path]}/md5sums.txt"
  remote_file "#{md5sums_file}" do
    source repo + "mariadb-enterprise/" + node['mariadb']['version'] + "/" + arch + "-packages/md5sums.txt"
  end

  file_name = "mariadb-enterprise-" + node['mariadb']['version'] + "-" + arch + ".msi"

  if File.exists?("#{md5sums_file}")
    f = File.open("#{md5sums_file}")
    f.each {|line|
      match = line.split(" ")
      if match[1].end_with?("msi")
        file_name = match[1]
        break
      end
    }
    f.close
  end

  remote_file "#{Chef::Config[:file_cache_path]}/mariadb.msi" do
    source repo + node['mariadb']['version'] + "/" + arch + "-packages/" + file_name
  end
end


text:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}

-- | Forms, using \"digestive-functors\".
module Imageboard.Web.Forms
  ( BoardForm
  , newBoard
  , editBoard
  , boardForm
  , threadControlForm

  -- * Re-exports
  , bindDigestiveSplices
  , digestiveSplices
  , getForm
  , runForm
  ) where

import Data.Char (isAlphaNum)
import qualified Data.Text as T
import Database.Esqueleto
import Text.Digestive
import Text.Digestive.Heist (bindDigestiveSplices, digestiveSplices)
import Web.Spock.Digestive (runForm)

import Imageboard.Database
import Imageboard.Web.Utils

type BoardForm ctx a = Form Text (BoardAction ctx) a

-- | New board.
--
-- TODO: file sizes, word filters, and anon names.
--
-- TODO: spoiler image should be a choice between upload new file, or
-- one used by an existing board.
newBoard :: UTCTime -> LoginId -> BoardForm ctx (Board, [(ContentType, SizeInBytes)], [(Text, Text)], [Text])
newBoard now loginid = (,,,)
  <$> boardForm (Right (now, loginid))
  <*> filetypesForm
  <*> wordreplacementsForm
  <*> anonnamesForm

  where
    filetypesForm        = pure []
    wordreplacementsForm = pure []
    anonnamesForm        = pure []

-- | Edit board.
editBoard :: BoardId -> Board -> BoardForm ctx Board
editBoard boardid board = boardForm $ Left (boardid, board)

-- | Generic form for boards. Takes an optional prior board, which is
-- used to fill in the default values if given.
boardForm :: Either (BoardId, Board) (UTCTime, LoginId) -> BoardForm ctx Board
boardForm eitherb = Board now loginid
  <$> "name"           .: validBoardName (default_ Nothing $ Just . boardName)
  <*> "title"          .: nonEmptyText   (default_ Nothing $ Just . boardTitle)
  <*> "subtitle"       .: text           (default_ Nothing $ Just . boardSubtitle)
  <*> "private"        .: bool          (Just $ default_ False boardPrivate)
  <*> "locked"         .: bool          (Just $ default_ False boardLocked)
  <*> "posterids"      .: bool          (Just $ default_ False boardPosterIds)
  <*> "filesperpost"   .: greaterThan 0 (Just $ default_ 3     boardFilesPerPost)
  <*> "linksperpost"   .: greaterThan 0 (Just $ default_ 5     boardExternalLinksPerPost)
  <*> "postmaxlen"     .: greaterThan 0 (Just $ default_ 1800  boardPostLengthLimit)
  <*> "threadsperpage" .: greaterThan 0 (Just $ default_ 10    boardThreadsPerPage)
  <*> "postsperthread" .: greaterThan 0 (Just $ default_ 5     boardPostsPerThread)
  <*> "pagelimit"      .: greaterThan 0 (Just $ default_ 10    boardPageLimit)
  <*> "bumplimit"      .: greaterThan 0 (Just $ default_ 300   boardBumpLimit)
  <*> "spoilerimage"   .: nonEmptyString (default_ Nothing $ Just . boardSpoilerImage)
  <*> "captcha"        .: bool (Just $ default_ False boardCaptcha)
  <*> "disabled"       .: bool (Just $ default_ False boardDisabled)

  where
    (now, loginid) = either ((boardCreatedAt &&& boardCreatedBy) . snd) id eitherb
    board = either Just (const Nothing) eitherb

    default_ :: a -> (Board -> a) -> a
    default_ d f = maybe d f (snd <$> board)

    -- A board name: only alphanumeric, unique, and nonempty.
    validBoardName = check "Board names must be alphanumeric" (T.all isAlphaNum)
      . checkM "Board names must be unique" uniqueName
      . nonEmptyText

    -- Check if the given name is unique, OR equal to the prior one.
    uniqueName name = fmap null . runSQL $
      select $ from $ \b -> do
        where_ (b ^. BoardName ==. val name)
        where_ $ not_ (just (b ^. BoardId) ==. val (fst <$> board))
        pure ()

-- | Thread control form: archive, bumplock, hide, lock, and sticky.
threadControlForm :: Thread -> BoardForm ctx Thread
threadControlForm thread = modthread
  <$> "archive"  .: bool (Just $ threadArchived   thread)
  <*> "bumplock" .: bool (Just $ threadBumplocked thread)
  <*> "hide"     .: bool (Just $ threadHidden     thread)
  <*> "lock"     .: bool (Just $ threadLocked     thread)
  <*> "sticky"   .: bool (Just $ threadStickied   thread)

  where
    modthread archive bumplock hide lock sticky = thread
      { threadArchived   = archive
      , threadBumplocked = bumplock
      , threadHidden     = hide
      , threadLocked     = lock
      , threadStickied   = sticky
      }

-------------------------------------------------------------------------------
-- Formlets

-- | Formlet for non-empty string field.
nonEmptyString :: Monad m => Formlet Text m String
nonEmptyString = check "Can't be empty" (not . null) . string

-- | Formlet for non-empty text field.
nonEmptyText :: Monad m => Formlet Text m Text
nonEmptyText = check "Can't be empty" (not . T.null) . text

-- | Formlet for integer which must be greater than some amount.
greaterThan :: Monad m => Int -> Formlet Text m Int
greaterThan themin = check err (>themin) . stringRead err where
  err = "Must be greater than " <> show themin


text:
<?php

namespace Wellid\Validator;

use Wellid\ValidationResult;
use Wellid\Exception\DataType;

/**
 * Description of MinLength
 *
 * @author Benedict Roeser <b-roeser@gmx.net>
 */
class MinLength implements ValidatorInterface {
    use ValidatorTrait;

    /**
     * Minimum length
     *
     * @var int
     */
    protected $min;

    /**
     * Constructor
     *
     * @param int $min Minimum length
     */
    public function __construct($min) {
        if(!is_int($min) || $min < 0) {
            throw new DataType('min', 'positive integer', $min);
        }

        $this->min = $min;
    }

    /**
     * Validates the given $value
     * Checks if the length of this string is longer then the minimum
     *
     * @param mixed $value
     * @return ValidationResult
     */
    public function validate($value) {
        if(mb_strlen($value) < $this->min) {
            return new ValidationResult(false, sprintf('Value has to have a minimum of %d characters', $this->min));
        }
        return new ValidationResult(true);
    }
}


text:
<?php

/**
 * log5php is a PHP port of the log4j java logging package.
 *
 *
This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).

 *
Design, strategies and part of the methods documentation are developed by log4j team
 * (Ceki G�lc� as log4j project founder and
 * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).

 *
 *
PHP port, extensions and modifications by VxR. All rights reserved.

 * For more information, please see {@link http://www.vxr.it/log4php/}.

 *
 *
This software is published under the terms of the LGPL License
 * a copy of which has been included with this distribution in the LICENSE file.

 *
 * @package external_Log5PHP
 * @subpackage src_main_php_Log5PHP_Appender
 */

/**
 * @ignore
 */
define('LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT', 'php://stdout');
define('LOG5PHP_LOGGER_APPENDER_CONSOLE_STDERR', 'php://stderr');

/**
 * ConsoleAppender appends log events to STDOUT or STDERR using a layout specified by the user.
 *
 *
Optional parameter is {@link $target}. The default target is Stdout.

 *
Note: Use this Appender with command-line php scripts.
 * On web scripts this appender has no effects.

 *
This appender requires a layout.

 *
 * @version $Revision: 26050 $
 * @package external_Log5PHP
 * @subpackage src_main_php_Log5PHP_Appender
 */
class Log5PHP_Appender_Console extends Log5PHP_Appender_Base
{

    /**
     * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords STDOUT and STDERR (case insensitive).
     * Default is STDOUT
     * @var string
     */
    private $target = LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT;

    /**
     * @var boolean
     */
    protected $requiresLayout = true;

    /**
     * @var mixed the resource used to open stdout/stderr
     */
    private $fp = false;

    /**
     * Set console target.
     * @param mixed $value a constant or a string
     */
    function setTarget($value)
    {
        $v = trim($value);
        if ($v == LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT or strtoupper($v) == 'STDOUT')
        {
            $this->target = LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT;
        }
        elseif ($v == LOG5PHP_LOGGER_APPENDER_CONSOLE_STDERR or strtoupper($v) == 'STDERR')
        {
            $this->target = LOG5PHP_LOGGER_APPENDER_CONSOLE_STDERR;
        }
        else
        {
            // @todo throw exception here
            $this->target = LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT;
            Log5PHP_InternalLog :: warn("Log5PHP_Appender_Console::setTarget() " .
            "Invalid target. Using '" . LOG5PHP_LOGGER_APPENDER_CONSOLE_STDOUT . "' by default.");
        }
    }

    function getTarget()
    {
        return $this->target;
    }

    function activateOptions()
    {
        Log5PHP_InternalLog :: debug("Log5PHP_Appender_Console::activateOptions()");

        $this->fp = fopen($this->getTarget(), 'w');

        if ($this->fp and $this->layout !== null)
        {
            fwrite($this->fp, $this->layout->getHeader());
        }

    }

    /**
     * @see Log5PHP_Appender_Appendable::close()
     */
    function close()
    {
        Log5PHP_InternalLog :: debug("Log5PHP_Appender_Console::close()");

        if ($this->fp and $this->layout !== null)
        {
            fwrite($this->fp, $this->layout->getFooter());
        }
        # we only want to close if the pointer is valid
        if ($this->fp)
        {
            fclose($this->fp);
        }
    }

    protected function append(Log5PHP_LogEvent $event)
    {
        if ($this->fp and $this->layout !== null)
        {
            Log5PHP_InternalLog :: debug("Log5PHP_Appender_Console::append()");

            fwrite($this->fp, $this->layout->format($event));
        }

    }
}


text:
<!DOCTYPE html>

<meta charset="UTF-8">

<title>module SimpleBioC - RDoc Documentation</title>

<link href="./css/fonts.css" rel="stylesheet">
<link href="./css/rdoc.css" rel="stylesheet">

    Home

    Pages
    Classes
    Methods

  <form action="#" method="get" accept-charset="utf-8">

      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">

  </form>

Methods

#from_xml

#from_xml_file

#from_xml_string

#merge

#to_xml

    module SimpleBioC

SimpleBioC main library

Constants

VERSION

Public Instance Methods

          from_xml(file_path, options = {})

          click to toggle source

parse a BioC XML file in the given path and convert it into a collection
instance

Arguments¶ ↑

file_path - file path for parse

options - (optional) additional options

Options¶ ↑

documents - specify IDs of documents to parse. The result will
include only the specified documents

Examples¶ ↑

collection = SimpleBioC.from_xml("./xml/everything.xml")
collection = SimpleBioC.from_xml("./xml/lemma.xml", {documents:[21785578, 21488974]})

# File lib/simple_bioc.rb, line 22
def from_xml(file_path, options = {})
  options[:documents] = options[:documents].map{|e| e.to_s} if options[:documents].kind_of?(Array)
  BioCReader.read(file_path, options)
end

          from_xml_file(file, options = {})

          click to toggle source

parse a BioC XML file and convert it into a collection instance

Arguments¶ ↑

file_path - file object for parse

options - (optional) additional options

Options¶ ↑

documents - specify IDs of documents to parse. The result will
include only the specified documents

Examples¶ ↑

file = File.open(path)
collection = SimpleBioC.from_xml(file)
collection = SimpleBioC.from_xml(file, {documents:[21785578, 21488974]})

# File lib/simple_bioc.rb, line 40
def from_xml_file(file, options = {})
  options[:documents] = options[:documents].map{|e| e.to_s} if options[:documents].kind_of?(Array)
  BioCReader.read_from_file_or_string(file, options)
end

          from_xml_string(string, options = {})

          click to toggle source

parse a BioC XML string and convert it into a collection instance

Arguments¶ ↑

string - xml string (text) for parse

options - (optional) additional options

Options¶ ↑

documents - specify IDs of documents to parse. The result will
include only the specified documents

Examples¶ ↑

content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> ..."
collection = SimpleBioC.from_xml(content)
collection = SimpleBioC.from_xml(content, {documents:[21785578, 21488974]})

# File lib/simple_bioc.rb, line 62
def from_xml_string(string, options = {})
  options[:documents] = options[:documents].map{|e| e.to_s} if options[:documents].kind_of?(Array)
  BioCReader.read_from_file_or_string(string, options)
end

          merge(dest_bioc, src_bioc)

          click to toggle source

# File lib/simple_bioc.rb, line 45
def merge(dest_bioc, src_bioc)
  return BioCMerger.merge(dest_bioc, src_bioc)
end

          to_xml(collection, options = {})

          click to toggle source

convert a collection instance to a BioC XML text. Output will return as
string

Arguments¶ ↑

collection - Collection instance to process

options - (optional) additional options

Options¶ ↑

save_with - SaveOption for Nokorigi. If you set this 0, output
has no format (no indentation, no whitespace)

Examples¶ ↑

output = SimpleBioC.to_xml(collection)
output = SimpleBioC.to_xml(collection, {save_with: 0})

# File lib/simple_bioc.rb, line 84
def to_xml(collection, options = {})
  BioCWriter.write(collection, options)
end

Validate

Generated by RDoc 4.2.0.

Based on Darkfish by Michael Granger.


text:
Thanks for reporting an issue. Mobile-enabled-background-video is so new born. If the issue isn't immediately obvious when
written in text then you must include a minimal case example of the problem on
<http://jsfiddle.net/> or something similar to help save us some time.

Thanks