text:
import { Meteor } from 'meteor/meteor';
import { _ } from 'meteor/underscore';
import { check, Match } from 'meteor/check';
import { InfiniLoadBase } from './base.js';

/**
 * @external Map
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map}
 */
/**
 * @external Set
 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set}
 */

/**
 * Server side interface for loading collection data incrementally.
 * @extends InfiniLoadBase
 */
class InfiniLoadServer extends InfiniLoadBase {

  /**
   * Return dynamic selector object based on user info and client parameters.
   * @callback InfiniLoadServer~SelectorFactory
   * @param {String} userId
   *        The ID of the current user.
   * @param {Object} params
   *        Parameters set by client.
   * @returns {Object}
   */

  /**
   * Return dynamic sort object based on user info and client parameters.
   * @callback InfiniLoadServer~SortFactory
   * @param {String} userId
   *        The ID of the current user.
   * @param {Object} params
   *        Parameters set by client.
   * @returns {Object}
   */

  /**
   * Return dynamic fields object based on user info and client parameters.
   * @callback InfiniLoadServer~FieldsFactory
   * @param {String} userId
   *        The ID of the current user.
   * @param {Object} params
   *        Parameters set by client.
   * @returns {Object}
   */

  /**
   * Use the add callback to add affiliated documents.
   * @callback InfiniLoadServer~Affiliation
   * @param {Object} doc
   * @param {Function} add
   *        Same as 'this.added' in 'Meteor.publish'; pass the collection name as the first parameter, document ID as the second, and the document as the third.
   */

  /**
   * Configurable options for server side.
   * @typedef {Object} InfiniLoadServer~ServerOptions
   * @extends InfiniLoadBase~CommonOptions
   * @property {Object|InfiniLoadServer~SelectorFactory} [selector={}]
   *           The selector object or a factory function for generating the selector object.
   * @property {Object|InfiniLoadServer~SortFactory} [sort={}]
   *           The sort object or a factory function for generating the sort object.
   * @property {Object|InfiniLoadServer~FieldsFactory} [fields={}]
   *           The fields object or a factory function for generating the fields object.
   * @property {String|{name: String, type: String}} [timeField={name: "createTime", type: "number"}]
   *           The name and type of the field used for temporal sorting.
   *           If a 'string' is provided, it is considered the name of the field and type is the default value '"number"'.
   * @property {InfiniLoadServer~Affiliation} [affiliation=null]
   *           Use this function to add more documents to be published alongside.
   * @property {Number} [slowdown=0]
   *           How much time in milliseconds to wait before publishing data.
   */

  /**
   * Creates a new server side InfiniLoad instance for a Mongo.Collection.
   * @param {Mongo.Collection} collection
   *        The collection this InfiniLoad instance belongs to.
   * @param {InfiniLoadServer~ServerOptions} [options]
   *        Optional configurations.
   */
  constructor (collection, options = {}) {
    super(collection, options);
    const me = this;

    me._log('construct', me._inspect({ options }));

    /***************************************************************************
      Check parameters.
    ***************************************************************************/

    check(options, self._CONST.CONSTRUCT_OPTIONS_PATTERN);

    const selector = options.selector || {};
    const sort = options.sort || {};
    const fields = options.fields || {};
    const timeField = (typeof options.timeField === 'string')
                      ? { name: options.timeField }
                      : options.timeField || {};
    const timeFieldName = timeField.name || 'createTime';
    const timeFieldType = timeField.type || 'number';
    /*
     * Issues with supporting affiliation:
     *   RootCollectionCursor ==(affiliation)==> AffiliatedCollectionCursors
     *   Does this process auto-rerun?
     *   How to update AffiliatedCollectionCursors when RootCollectionCursor changes?
     */
    const affiliation = options.affiliation || null;
    const slowdown = options.slowdown || 0;

    if (self._CONST.SUPPORTED_TIME_TYPES.indexOf(timeFieldType) < 0) {
      throw new Error(`Error when initializing InfiniLoadServer ${me.id}. "${timeFieldType}" is not a supported time field type.`);
    }

    /***************************************************************************
      Initialize variables.
    ***************************************************************************/

    const getFindSelector = (typeof selector === 'function')
                            ? selector
                            : self._CONST.OP_RETURN_THIS.bind(selector);
    const getFindSort = (typeof sort === 'function')
                        ? sort
                        : self._CONST.OP_RETURN_THIS.bind(sort);
    const getFindFields = (typeof fields === 'function')
                          ? fields
                          : self._CONST.OP_RETURN_THIS.bind(fields);

    /***************************************************************************
      Publish data.
    ***************************************************************************/

    /**
     * @typedef {Object} InfiniLoadServer~SubscribeOptions
     * @property {String} requestId
     *           A unique identifier for each subscription request.
     * @property {Object} args
     *           Arguments passed to find option factories.
     * @property {Number} limit
     *           How many documents to return.
     * @property {Number} lastLoadTime
     *           Cut-off time between new and old documents.
     *           This is tracked by the client so other parameters can be changed without moving the cut-off line.
     */

    Meteor.publish(me.collectionName, function (options = {}) {
      const connection = this;
      const subscriptionId = connection._subscriptionId;
      // When userId changes the connection will be reset.
      const userId = connection.userId;
      // 'Date.now()' is faster than 'new Date().getTime()'.
      const now = Date.now();

      me._log('subscribe', me._inspect({ subscriptionId, options }));

      check(options, self._CONST.PUBLISH_OPTIONS_PATTERN);

      const requestId = options.requestId;

      if (options.quit || !requestId) {
        connection.ready();
        return;
      }

      const initialLoad = options.lastLoadTime === 0;
      me._log('initialLoad', me._inspect({ initialLoad }));

      const serverArgs = options.args || {};
      const findLimit = options.limit || 0;
      const lastLoadTime = initialLoad ? now : options.lastLoadTime;

      const findSelector = getFindSelector(userId, serverArgs);
      //! Current only support Object style sort options. Need to support array style.
      const findSort = getFindSort(userId, serverArgs);
      // Enforce sort by time field.
      findSort[timeFieldName] = -1;
      const findFields = getFindFields(userId, serverArgs);

      const findOptions = {
        'sort': findSort,
        'fields': findFields
      };

      me._log('find', me._inspect({ findSelector, findOptions }));

      const cursor = collection.find(findSelector, findOptions);

      me._log('find.count', cursor.count());

      let latestDocTime = 0,
          totalDocCount = 0,
          newDocCount = 0,
          oldDocCount = 0,
          loadedDocuments = new Map(),
          initializing = true,
          /**
           * Stores records of affiliated documents. Indexed by collection.
           * @ignore
           * @type {Map.<CollectionName, Map.<DocumentId, {BoxedDocument}>>}
           */
          affiliatedDocumentsByCollection = new Map(),
          /**
           * Stores records of affiliated documents. Indexed by core document ID.
           * @ignore
           * @type {Map.<DocumentId, Map.<CollectionName, Set.<DocumentId>>>}
           */
          affiliatedDocumentsByCoreDocId = new Map();

      // This function is passed to affiliation function since in order to add a document, multiple pieces of data are needed.
      const addAffiliatedDocument = (coreDocId, collectionName, docId, doc) => {
        check(coreDocId, String);
        check(collectionName, String);
        check(docId, String);
        check(doc, Object);
        check(doc._id, docId);

        if (!affiliatedDocumentsByCollection.has(collectionName)) {
          affiliatedDocumentsByCollection.set(collectionName, new Map());
        }
        // @type {Map.<DocumentId, {BoxedDocument}>}
        const affiliatedDocumentsInCollection = affiliatedDocumentsByCollection.get(collectionName);

        if (!affiliatedDocumentsInCollection.has(docId)) {
          const boxedDocument = {
            collectionName,
            id: docId,
            document: doc,
            references: new Set([coreDocId])
          };
          affiliatedDocumentsInCollection.set(docId, boxedDocument);
          connection.added(collectionName, docId, doc);
        } else {
          const boxedDocument = affiliatedDocumentsInCollection.get(docId);
          // boxedDocument.collectionName === collectionName
          // boxedDocument.id === docId
          // boxedDocument.references.has(coreDocId) ?
          if (!boxedDocument.references.has(coreDocId)) {
            boxedDocument.references.add(coreDocId);
          }
          // boxedDocument.document === doc ?
          if (!_.isEqual(boxedDocument.document, doc)) {
            boxedDocument.document = doc;
            connection.changed(collectionName, docId, doc);
          }
        }

        // Save index by core document ID for fast searching.

        if (!affiliatedDocumentsByCoreDocId.has(coreDocId)) {
          affiliatedDocumentsByCoreDocId.set(coreDocId, new Map());
        }
        // @type {Map.<CollectionName, Set.<DocumentId>>}
        const affiliatedDocumentsOfCoreDoc = affiliatedDocumentsByCoreDocId.get(coreDocId);

        if (!affiliatedDocumentsOfCoreDoc.has(collectionName)) {
          affiliatedDocumentsOfCoreDoc.set(collectionName, new Set());
        }
        // @type {Set.<DocumentId>}
        const affiliatedDocumentsOfCoreDocInCollection = affiliatedDocumentsOfCoreDoc.get(collectionName);
        affiliatedDocumentsOfCoreDocInCollection.add(docId);
      };

      // Removes all affiliated documents of a core document, used when the core document is being removed from the client.
      const removeAffiliatedDocuments = (coreDocId) => {
        if (affiliatedDocumentsByCoreDocId.has(coreDocId)) {
          // @type {Map.<CollectionName, Set.<DocumentId>>}
          const affiliatedDocumentsOfCoreDoc = affiliatedDocumentsByCoreDocId.get(coreDocId);

          affiliatedDocumentsOfCoreDoc.forEach((/* @type {Set.<DocumentId>} */affiliatedDocIds, /* @type {String} */collectionName) => {
            if (affiliatedDocumentsByCollection.has(collectionName)) {
              // @type {Map.<DocumentId, {BoxedDocument}>}
              const affiliatedDocumentsInCollection = affiliatedDocumentsByCollection.get(collectionName);

              affiliatedDocIds.forEach((docId) => {
                if (affiliatedDocumentsInCollection.has(docId)) {
                  const boxedDocument = affiliatedDocumentsInCollection.get(docId);

                  // Delete a reference.
                  if (boxedDocument.references.has(coreDocId)) {
                    boxedDocument.references.delete(coreDocId);
                  }

                  // If the affiliated document has no references, delete it.
                  if (boxedDocument.references.size === 0) {
                    affiliatedDocumentsInCollection.delete(docId);
                    connection.removed(boxedDocument.collectionName, boxedDocument.id);
                  }
                }
              });

              // If the collection has no document in it, delete it.
              if (affiliatedDocumentsInCollection.size === 0) {
                affiliatedDocumentsByCollection.delete(collectionName);
              }
            }
          });

          // In the end, delete this index.
          affiliatedDocumentsByCoreDocId.delete(coreDocId);
        }
      };

      const GenerateStatsDocument = () => {
        /**
         * @typedef {Object} InfiniLoadServer~StatsDocument
         * @property {String} subscriptionId
         *           The ID of the subscription.
         * @property {String} requestId
         *           The unique identifier for the subscription request.
         * @property {Number} lastLoadTime
         *           Cut-off time between new and old documents.
         * @property {Number} latestDocTime
         *           The time field value of the latest document.
         * @property {Number} totalDocCount
         *           How many documents in the collection that match the find options.
         * @property {Number} newDocCount
         *           How many documents are above than the cut-off line.
         * @property {Number} oldDocCount
         *           How many documents are below than the cut-off line.
         * @property {Number} loadedDocCount
         *           How many documents are sent to the client. This value is never larger than the find limit.
         * @property {Object} selector
         *           The final selector object used in find.
         * @property {Object} sort
         *           The final sort object used in find.
         * @property {Object} fields
         *           The final fields object used in find.
         * @property {Number} limit
         *           The find limit.
         * @property {Object} serverArgs
         *           A copy of the server parameters received from client.
         */
        return {
          subscriptionId,
          requestId,
          lastLoadTime,
          latestDocTime,
          totalDocCount,
          newDocCount,
          oldDocCount,
          loadedDocCount: loadedDocuments.size,
          selector: findSelector,
          sort: findSort,
          fields: findFields,
          limit: findLimit,
          serverArgs
        };
      };

      const addStatsDocumentToClient = () => {
        const newStatsDoc = GenerateStatsDocument();
        me._log('newStatsDoc', me._inspect({ newStatsDoc }));
        connection.added(me.collectionName, self._CONST.STATS_DOCUMENT_ID, newStatsDoc);
      };

      const changeStatsDocumentOnClient = () => {
        const newStatsDoc = GenerateStatsDocument();
        me._log('newStatsDoc', me._inspect({ newStatsDoc }));
        connection.changed(me.collectionName, self._CONST.STATS_DOCUMENT_ID, newStatsDoc);
      };

      // Queue up items to be sent to client.
      // @type {Array.<Object>}
      const itemsToSend = [],
            sortingFields = Object.keys(findSort),
            sortFunc = (a, b) => {
              // Start with the first sorting field and calculate the result.
              // If the result is inconclusive (=== 0), use the next sorting field
              //     until the result is conclusive or the sorting fields run out.

              let sortingFieldIndex = 0,
                  sortingFieldName = null,
                  sortingCondition = null,
                  result = null;
              do {
                sortingFieldName = sortingFields[sortingFieldIndex];
                sortingCondition = findSort[sortingFieldName];

                result = (a[sortingFieldName] - b[sortingFieldName]) * sortingCondition;

                sortingFieldIndex++;
              } while (result === 0 && sortingFieldIndex < sortingFields.length);

              return result;
            };

      // Important: the order in which observer goes over docs does NOT depend
      //     on findSort. In fact it's the insertion order.
      const observer = cursor.observe({
        'added': (doc) => {
          me._log('added', doc._id, me._inspect({ doc }));

          // An added document always counts towards total document count.
          totalDocCount++;

          // Time field value must be able to be converted to a number.
          let timeValue = self._getDocumentTimeValue(doc, timeFieldName, timeFieldType);

          // See if this doc is the latest on server.
          if (timeValue > latestDocTime) {
            me._log('latest document', doc._id, timeValue);
            latestDocTime = timeValue;
          }

          // If this doc is new to the client, update new document count. Otherwise update old document count.
          if (timeValue > lastLoadTime) {
            me._log('newer than client', doc._id);
            newDocCount++;
          } else {
            oldDocCount++;

            if (initializing) {
              // When initializing, queue up all old docs in itemsToSend.
              itemsToSend.push(doc);
              // Sort right now and do a quick cut-off to avoid queuing up too many items.
              itemsToSend.sort(sortFunc);
              itemsToSend.length = Math.min(itemsToSend.length, findLimit);
            } else {
              // When not initializing, do not send old docs.
            }
          }

          if (!initializing) {
            changeStatsDocumentOnClient();
          }
        },
        'changed': (newDoc, oldDoc) => {
          me._log('changed', oldDoc._id, me._inspect({ newDoc, oldDoc }));

          // Should not happen when initializing. But if it does, ignore it.
          if (initializing) {
            return;
          }

          // Assume the time field never changes so we don't need to worry about documents jumping around in the list.

          //! Need to handle the time field changes in the future.
          if (loadedDocuments.has(oldDoc._id)) {
            const cachedDoc = loadedDocuments.get(oldDoc._id);
            if (_.isEqual(cachedDoc, newDoc)) {
              me._log('no change needed for client', oldDoc._id);
            } else {
              // Send affiliated documents first.
              if (affiliation) {
                // Affiliation should use the second parameter to add documents.
                affiliation(newDoc, addAffiliatedDocument.bind(me, oldDoc._id));
              }

              me._log('updating to client', oldDoc._id);
              loadedDocuments.set(oldDoc._id, newDoc);
              connection.changed(me.collectionName, oldDoc._id, newDoc);
            }
          }
        },
        'removed': (doc) => {
          me._log('removed', doc._id, me._inspect({ doc }));

          // Should not happen when initializing. But if it does, ignore it.
          if (initializing) {
            return;
          }

          // An removed document always counts towards total document count.
          totalDocCount--;

          // Time field value must be able to be converted to a number.
          let timeValue = self._getDocumentTimeValue(doc, timeFieldName, timeFieldType);

          // If this doc is new to the client, update new document count. Otherwise update old document count.
          if (timeValue > lastLoadTime) {
            newDocCount--;
          } else {
            oldDocCount--;
            if (loadedDocuments.has(doc._id)) {
              // Send affiliated documents first.
              if (affiliation) {
                removeAffiliatedDocuments(doc._id);
              }

              me._log('removing from client', doc._id);
              loadedDocuments.delete(doc._id);
              connection.removed(me.collectionName, doc._id);
            }
          }

          changeStatsDocumentOnClient();
        }
      });

      me._log('items to send', me._inspect(itemsToSend.map((doc) => doc._id)));
      // Send documents.
      for (let i = 0, n = itemsToSend.length; i < n; ++i) {
        const doc = itemsToSend[i];

        // Send affiliated documents first.
        if (affiliation) {
          // Affiliation should use the second parameter to add documents.
          affiliation(doc, addAffiliatedDocument.bind(me, doc._id));
        }

        me._log('sending to client', doc._id);
        loadedDocuments.set(doc._id, doc);
        connection.added(me.collectionName, doc._id, doc);
      }

      initializing = false;

      connection.onStop(() => {
        observer.stop();
      });

      if (slowdown > 0) {
        Meteor._sleepForMs(slowdown);
      }

      addStatsDocumentToClient();
      connection.ready();
    });
    me._log('published');
  }

  /**
   * Static methods.
   */

  /**
   * Helper function for getting the time value from a document.
   * @private
   * @param {Object} doc
   * @param {String} fieldName
   * @param {String} fieldType
   * @returns {Number}
   */
  static _getDocumentTimeValue (doc, fieldName, fieldType) {
    return Number(doc[fieldName]);
  }

  /**
   * Getters and Setters.
   */

  /**
   * Instance methods.
   */

}
const self = InfiniLoadServer;

/**
 * Gather all constants here for easier management.
 * @private
 * @type {Object}
 */
InfiniLoadServer._CONST = _.extend({}, InfiniLoadBase._CONST, /** @lends InfiniLoadServer._CONST */{
  CONSTRUCT_OPTIONS_PATTERN: Match.ObjectIncluding({
    'selector': Match.Optional(Match.OneOf(Object, Function)),
    'sort': Match.Optional(Match.OneOf(Object, Function)),
    'fields': Match.Optional(Match.OneOf(Object, Function)),
    'timeField': Match.Optional(Match.OneOf(String, {
      'name': Match.Optional(String),
      'type': Match.Optional(String)
    })),
    'affiliation': Match.Optional(Function),
    'slowdown': Match.Optional(Number)
  }),
  PUBLISH_OPTIONS_PATTERN: Match.ObjectIncluding({
    requestId: String,
    args: Match.Optional(Object),
    lastLoadTime: Match.Optional(Number)
  }),
  SUPPORTED_TIME_TYPES: [
    'number', 'date'
  ],
  CONVERT_TIME: {
    'number' (numValue) {
      return numValue;
    },
    'date' (numValue) {
      return new Date(numValue);
    }
  }
});

/**
 * Store runtime data.
 * @private
 * @type {Object}
 */
InfiniLoadServer._DATA = _.extend({}, InfiniLoadBase._DATA, /** @lends InfiniLoadServer._DATA */{
});

export const InfiniLoad = InfiniLoadServer;


text:
<!doctype html>

		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

		<title>Pipeline.IO & You</title>

		<meta name="description" content="Pipeline.IO & You">
		<meta name="author" content="Brent Dorsey">

		<link rel="stylesheet" href="css/reveal.css">
		<link rel="stylesheet" href="css/theme/black.css">

		<link rel="stylesheet" href="lib/css/zenburn.css">

PIPELINE.IO & YOU

Enabling the hell out of our Data Scientist

Why?

Why?

Ok, Ok, Ok, Ok, Ok

Python is so last year, Unlambda is all the rage

You're just gonna have to trust me.

								“I think it is important for software to avoiding imposing a cognitive style on workers and their work.”

						<q>Edward Tufte</q>

What?

Data Science ML Pipeline

Designed by and for Data Scientist

Flexible design custom fit to your needs

Python - No Problem

Spark - No Problem

Tensorflow - No Problem

GPU - No Problem

prediction.ml

Python Web Application

Distributed Scalable API

Roles & Responsibilities

Data Scientist Responsibilities

Model Binaries

requirements.txt (PIP)

requirements_conda.txt (Conda)

model.py python module

test.sh

Publishing Models

source.ml github repo

Juypter Notebook

cli tar archive upload

						Functionality limited to development environment.
						Production models are loaded in the API Dockerfile for performance and durability.

model.py standards

model.py module instantiates model binaries

standard model.predict method

input = REST API POST body

output = model prediction

Pipeline.IO Responsibilities

Create Conda model_environment

Install PIP and Conda Requirements

Load and Cache model.py Python Module

Call model.predict and Return Model Output

Autoscale API on demand

Optionally, persist Model Output to Database

code

model.py

Python
Web Framework
Benchmarks

Loading and returning a Response

Loading Db Data and Rendering a Template

Documentation

Pipeline.IO

prediction.ml api

Load Test Demo

Happy Happy Joy Joy

redpajama_set_name: RedPajamaGithub


text:
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0

package com.google.appinventor.shared.jsonp;

import java.io.Serializable;

/**
 * Class containing information needed for a JSONP connection.
 *
 * @author lizlooney@google.com (Liz Looney)
 */
public class JsonpConnectionInfo implements Serializable {
  private int port;
  private int secret;

  /**
   * Default constructor (for GWT RPC serialization only).
   * Unfortunately this will prevent any fields from being marked as final!
   */
  public JsonpConnectionInfo() {
  }

  /**
   * Constructs a JsonpConnectionInfo with the given port and secret.
   *
   * @param port the port at which the JSONP server is listening
   * @param secret the secret number that is required in all JSONP requests
   */
  public JsonpConnectionInfo(int port, int secret) {
    this.port = port;
    this.secret = secret;
  }

  /**
   * Returns the port at which the JSONP server is listening
   */
  public int getPort() {
    return port;
  }

  /**
   * Returns the secret number that is required in all JSONP requests.
   */
  public int getSecret() {
    return secret;
  }
}


text:
window.routes = window.routes || {};

(function(window, document) {

	'use strict';

	var errorText = 'Looks like something went wrong. Please refresh the page';

	function onSubmit(e) {
		e.preventDefault();
		var el = $(this);
		var data = el.serializeArray();
		$.ajax({
			method : 'post',
			data : data,
			success : function(res) {
				var url = window.location.href + '/' + res._id;
				url = url.split("?")[0];
				url = url.replace(/([^:]\/)\/+/g, "$1");
				window.location.replace(url);

			},
			error : function(res) {
				$('.modal-content .form-description').text(errorText);
			}
		});
	}

	window.routes.types = {
		init : function() {
			$('#addPage').submit(onSubmit);
		}
	};

})(window, document);


text:
package main;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import client.renders.ModRenderRegistry;
import config.Config;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.loading.FMLPaths;

@Mod("deadlymonsters")
public class ModMain
{
	public static ModMain instance;

	public static final String MODID = "deadlymonsters";
	public static final ModItemGroup MOD_ITEMGROUP = new ModItemGroup();
	public static final Logger lOGGER = LogManager.getLogger(MODID);

	public ModMain()
	{
		instance = this;

		ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, Config.SERVER_CONFIG, "deadlymonsters.toml");

		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
		FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientRegistries);

		Config.loadConfig(Config.SERVER_CONFIG, FMLPaths.CONFIGDIR.get().resolve("deadlymonsters.toml").toString());
		MinecraftForge.EVENT_BUS.register(this);
	}

	private void setup(final FMLCommonSetupEvent event)
	{
		lOGGER.info("Setup method registered");
	}

	private void clientRegistries(final FMLClientSetupEvent event)
	{
		ModRenderRegistry.registryEntityRenders();
		lOGGER.info("Client method registered");
	}
}


text:
guffaw
======

Galois Field implementation in javascript


text:
package com.github.commons.fs;

import com.github.commons.fs.contants.FileType;

import java.io.InputStream;

/**
 * FileWriter.java
 *
 * @author zhouxiaofeng 3/31/15
 */
public interface FileWriter {

    public void writeFile(String filename, FileType type, InputStream inputStream, UserMetadata... userMetadatas);

    public void writeFile(String filename, FileType type, String url, UserMetadata... userMetadatas);

}


text:
function C() { return this };
function foo() {
  return new C() instanceof function(){};
}
%PrepareFunctionForOptimization(C);
%PrepareFunctionForOptimization(foo);
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());


text:
const program = require('commander');
const pgdeploy = require('./lib/pgdeploy.js');

const init = require('./lib/init.js');
const setupEnv = require('./lib/setupEnvironment.js');
const releases = require('./lib/releases.js');
const deploy = require('./lib/deploy.js');
const exportData = require('./lib/export.js');
const importData = require('./lib/import.js');
const test = require('./lib/test.js');

const addFunction = require('./lib/addFunction.js');
const addRelease = require('./lib/addRelease.js');
const addSchema = require('./lib/addSchema.js');
const addTable = require('./lib/addTable.js');

const addCalls = {
    addFunction,
    addRelease,
    addSchema,
    addTable
};

program.version(require('./package.json').version);

program
    .command('init')
    .description('initialize pgdeploy project')
    .option('-f, --force', 'Deletes previously initialized project')
    .action(options => init(options));

program
    .command('setup [env]')
    .description('add another database environment to manage')
    .action((env) => {
        setupEnv(env, (err) => {
            if(err) {
                pgdeploy.error(err);
            } else {
                pgdeploy.success();
            }
        });
    });

program
    .command('add [what]')
    .description('add a release or schema/table/function into latest release')
    .action((what) => {
        const latestRelease = releases.getLatestRelease();
        const directory = pgdeploy.getConfig().directory;
        const filename = `add${what.substr(0, 1).toUpperCase()}${what.substr(1).toLowerCase()}`;

        addCalls[filename](latestRelease, directory);
    });

program
    .command('deploy')
    .description('deploy the unreleased releases to environment')
    .option('-e, --env-name [value]', 'One of the environments set in pgdeploy.json')
    .option('-g, --generate [value]', 'Generate test data from one of the backups after deploy with import')
    .option('-c, --clean', 'Deletes everything in the environment database before deploy')
    .option('-d, --dry-run', 'Dry run shows you what it deploys but wont commit anything')
    .option('-v, --verbose', 'Log your release process in more detail')
    .option('-s, --single', 'Deploy only next unreleased version')
    .option('-t, --test', 'Run tests')
    .option('-n, --not-transaction', 'Deploy by committing release sql files one by one rather than as a patch in a transaction. Allows only single working file besides the release.')
    .option('-H, --host [value]', 'Host with port')
    .option('-U, --username [value]', 'Username')
    .option('-P, --password [value]', 'Password')
    .option('-D, --database [value]', 'Database name')
    .option('-f, --force', 'Force the deploy to go through without asking if one is sure even in protected environments with options sent in')
    .action(options => deploy(options));

program
    .command('export')
    .description('Export all data from tables to a local back-up')
    .action(() => exportData());

program
    .command('import')
    .option('-e, --env-name [value]', 'One of the environments set in pgdeploy.json')
    .option('-b, --backup [value]', 'Backup name from __backups')
    .description('Import data from local back-up into one of the environments database tables')
    .action((options) => {
        importData(() => {
            pgdeploy.success('All found files done');
        }, options.envName, options.backup);
    });

program
    .command('test [env]')
    .description('Run all test files')
    .action(env => test(env));

program.parse(process.argv);


text:
package org.jetbrains.idea.maven.server;

import org.jetbrains.idea.maven.server.embedder.Maven2ServerLoggerWrapper;

public class Maven2ServerGlobals {
  private static Maven2ServerLoggerWrapper myLogger;
  private static MavenServerDownloadListener myDownloadListener;

  public static Maven2ServerLoggerWrapper getLogger() {
    return myLogger;
  }

  public static MavenServerDownloadListener getDownloadListener() {
    return myDownloadListener;
  }

  public static void set(MavenServerLogger logger, MavenServerDownloadListener downloadListener) {
    myLogger = new Maven2ServerLoggerWrapper(logger);
    myDownloadListener = downloadListener;
  }
}


text:
.class Lcom/att/iqi/IQIServiceBroker$BinderService;
.super Lcom/att/iqi/IIQIService$Stub;
.source "IQIServiceBroker.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/att/iqi/IQIServiceBroker;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x2
    name = "BinderService"
.end annotation

# instance fields
.field final synthetic this$0:Lcom/att/iqi/IQIServiceBroker;

# direct methods
.method private constructor <init>(Lcom/att/iqi/IQIServiceBroker;)V
    .locals 0

    iput-object p1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-direct {p0}, Lcom/att/iqi/IIQIService$Stub;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/att/iqi/IQIServiceBroker;Lcom/att/iqi/IQIServiceBroker$BinderService;)V
    .locals 0

    invoke-direct {p0, p1}, Lcom/att/iqi/IQIServiceBroker$BinderService;-><init>(Lcom/att/iqi/IQIServiceBroker;)V

    return-void
.end method

# virtual methods
.method public registerMetricQueryCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricQueryCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1, p2}, Lcom/att/iqi/IIQIService;->registerMetricQueryCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricQueryCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public registerMetricSourcingCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricSourcingCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1, p2}, Lcom/att/iqi/IIQIService;->registerMetricSourcingCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricSourcingCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public registerProfileChangedCallback(Lcom/att/iqi/IProfileChangedCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1}, Lcom/att/iqi/IIQIService;->registerProfileChangedCallback(Lcom/att/iqi/IProfileChangedCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public shouldSubmitMetric(Lcom/att/iqi/lib/Metric$ID;)Z
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1}, Lcom/att/iqi/IIQIService;->shouldSubmitMetric(Lcom/att/iqi/lib/Metric$ID;)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v1

    return v1

    :catch_0
    move-exception v0

    const/4 v1, 0x0

    return v1
.end method

.method public submitMetric(Lcom/att/iqi/lib/Metric;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1}, Lcom/att/iqi/IIQIService;->submitMetric(Lcom/att/iqi/lib/Metric;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public unregisterMetricQueryCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricQueryCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1, p2}, Lcom/att/iqi/IIQIService;->unregisterMetricQueryCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricQueryCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public unregisterMetricSourcingCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricSourcingCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1, p2}, Lcom/att/iqi/IIQIService;->unregisterMetricSourcingCallback(Lcom/att/iqi/lib/Metric$ID;Lcom/att/iqi/IMetricSourcingCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method

.method public unregisterProfileChangedCallback(Lcom/att/iqi/IProfileChangedCallback;)V
    .locals 2
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    :try_start_0
    iget-object v1, p0, Lcom/att/iqi/IQIServiceBroker$BinderService;->this$0:Lcom/att/iqi/IQIServiceBroker;

    invoke-virtual {v1}, Lcom/att/iqi/IQIServiceBroker;->getBrokeredService()Lcom/att/iqi/IIQIService;

    move-result-object v1

    invoke-interface {v1, p1}, Lcom/att/iqi/IIQIService;->unregisterProfileChangedCallback(Lcom/att/iqi/IProfileChangedCallback;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0
.end method


text:
package org.ws4d.df.impl.runtime;

import org.ws4d.df.api.comp.InPort;
import org.ws4d.df.api.comp.PortTracer;

public class RtInitPort extends AbstractPort implements InPort, RuntimeInPort {

    // -------------------------------------------------------------------------
	// instance members
    // -------------------------------------------------------------------------

    private final Object packet;
    private final boolean isStatic;

    // -------------------------------------------------------------------------
    // constructors
    // -------------------------------------------------------------------------

    public RtInitPort(String name, RtComponent component, int index, Object packet, boolean isStatic)
            throws Exception {
        super(name, component, index);

        if (packet == null) {
            throw new Exception("packet is null");
        }

        this.packet = packet;
        this.isStatic = isStatic;
    }

    // -------------------------------------------------------------------------
    // InPort interface
    // -------------------------------------------------------------------------

    public void close() {
        super.close();
    }

    public Object receive() {
        if (isClosed()) {
            return null;
        }
        if (!isStatic) {
            close();
        }

        PortTracer tracer = component.getRtNetwork().getPortTracer();
        if (tracer != null) {
            tracer.port_recv(this, packet);
        }

        return packet;
    }

    public boolean receiveWouldBlock() {
    	return false;
    }

    public int getPacketCount() {
        return isClosed() ? 0 : 1;
    }

    public int getCapacity() {
        return 1;
    }

    public void append(Object packet) {
    }
}


text:
#include "caf/detail/try_match.hpp"

#include "caf/type_erased_tuple.hpp"

namespace caf {
namespace detail {

using pattern_iterator = const meta_element*;

bool match_element(const meta_element& me, const type_erased_tuple& xs,
                   size_t pos) {
  CAF_ASSERT(me.typenr != 0 || me.type != nullptr);
  return xs.matches(pos, me.typenr, me.type);
}

bool match_atom_constant(const meta_element& me, const type_erased_tuple& xs,
                         size_t pos) {
  CAF_ASSERT(me.typenr == type_nr<atom_value>::value);
  if (!xs.matches(pos, type_nr<atom_value>::value, nullptr))
    return false;
  auto ptr = xs.get(pos);
  return me.v == *reinterpret_cast<const atom_value*>(ptr);
}

bool try_match(const type_erased_tuple& xs,
               pattern_iterator iter, size_t ps) {
  if (xs.size() != ps)
    return false;
  for (size_t i = 0; i < ps; ++i, ++iter)
    // inspect current element
    if (!iter->fun(*iter, xs, i))
      // type mismatch
      return false;
  return true;
}

} // namespace detail
} // namespace caf


text:
package com.viviweather.android.db;

import org.litepal.crud.DataSupport;

/**
 * 类名:   Province
 *

 * 创建者:   zzw
 *

 * 创建时间:  2017/8/20 17:46
 *

 * 描述:省 数据库
 */

public class Province extends DataSupport {
    private int id;
    private String provinceName;
    private int provinceCode;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public int getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(int provinceCode) {
        this.provinceCode = provinceCode;
    }
}


text:
package org.develnext.jphp.core.tokenizer.token.expr.operator.cast;

import php.runtime.memory.StringMemory;
import php.runtime.Memory;
import org.develnext.jphp.core.tokenizer.TokenMeta;
import org.develnext.jphp.core.tokenizer.TokenType;

public class StringCastExprToken extends CastExprToken {
    public StringCastExprToken(TokenMeta meta) {
        super(meta, TokenType.T_STRING_CAST);
    }

    @Override
    public Class<?> getResultClass() {
        return String.class;
    }

    @Override
    public Memory calc(Memory o1, Memory o2) {
        return new StringMemory(o1.toString());
    }

    @Override
    public String getCode() {
        return "toString";
    }
}


text:
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.yangtypes import YANGDynClass
from pyangbind.lib.yangtypes import ReferenceType
from pyangbind.lib.base import PybindBase
from collections import OrderedDict
from decimal import Decimal
from bitarray import bitarray
import six

# PY3 support of some PY2 keywords (needs improved)
if six.PY3:
    import builtins as __builtin__

    long = int
elif six.PY2:
    import __builtin__

from . import state

class admin_group(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance - based on the path /network-instances/network-instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa-types/lsa-type/lsas/lsa/opaque-lsa/traffic-engineering/tlvs/tlv/link/sub-tlvs/sub-tlv/administrative-groups/admin-group. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: The administrative group described within the
sub-TLV
  """
    __slots__ = ("_path_helper", "_extmethods", "__bit_index", "__state")

    _yang_name = "admin-group"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__bit_index = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="bit-index",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=False,
        )
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "protocols",
                "protocol",
                "ospfv2",
                "areas",
                "area",
                "lsdb",
                "lsa-types",
                "lsa-type",
                "lsas",
                "lsa",
                "opaque-lsa",
                "traffic-engineering",
                "tlvs",
                "tlv",
                "link",
                "sub-tlvs",
                "sub-tlv",
                "administrative-groups",
                "admin-group",
            ]

    def _get_bit_index(self):
        """
    Getter method for bit_index, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/bit_index (leafref)

    YANG Description: A reference to the bit index being described
    """
        return self.__bit_index

    def _set_bit_index(self, v, load=False):
        """
    Setter method for bit_index, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/bit_index (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_bit_index is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_bit_index() directly.

    YANG Description: A reference to the bit index being described
    """
        parent = getattr(self, "_parent", None)
        if parent is not None and load is False:
            raise AttributeError(
                "Cannot set keys directly when" + " within an instantiated list"
            )

        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="bit-index",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                is_keyval=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="leafref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """bit_index must be of a type compatible with leafref""",
                    "defined-type": "leafref",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="bit-index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='leafref', is_config=False)""",
                }
            )

        self.__bit_index = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_bit_index(self):
        self.__bit_index = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="bit-index",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=False,
        )

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/state (container)

    YANG Description: State parameters relating to the administrative
groups being described for the link
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the administrative
groups being described for the link
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)""",
                }
            )

        self.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

    bit_index = __builtin__.property(_get_bit_index)
    state = __builtin__.property(_get_state)

    _pyangbind_elements = OrderedDict([("bit_index", bit_index), ("state", state)])

from . import state

class admin_group(PybindBase):
    """
  This class was auto-generated by the PythonClass plugin for PYANG
  from YANG module openconfig-network-instance-l2 - based on the path /network-instances/network-instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa-types/lsa-type/lsas/lsa/opaque-lsa/traffic-engineering/tlvs/tlv/link/sub-tlvs/sub-tlv/administrative-groups/admin-group. Each member element of
  the container is represented as a class variable - with a specific
  YANG type.

  YANG Description: The administrative group described within the
sub-TLV
  """
    __slots__ = ("_path_helper", "_extmethods", "__bit_index", "__state")

    _yang_name = "admin-group"

    _pybind_generated_by = "container"

    def __init__(self, *args, **kwargs):

        self._path_helper = False

        self._extmethods = False
        self.__bit_index = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="bit-index",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=False,
        )
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

        load = kwargs.pop("load", None)
        if args:
            if len(args) > 1:
                raise TypeError("cannot create a YANG container with >1 argument")
            all_attr = True
            for e in self._pyangbind_elements:
                if not hasattr(args[0], e):
                    all_attr = False
                    break
            if not all_attr:
                raise ValueError("Supplied object did not have the correct attributes")
            for e in self._pyangbind_elements:
                nobj = getattr(args[0], e)
                if nobj._changed() is False:
                    continue
                setmethod = getattr(self, "_set_%s" % e)
                if load is None:
                    setmethod(getattr(args[0], e))
                else:
                    setmethod(getattr(args[0], e), load=load)

    def _path(self):
        if hasattr(self, "_parent"):
            return self._parent._path() + [self._yang_name]
        else:
            return [
                "network-instances",
                "network-instance",
                "protocols",
                "protocol",
                "ospfv2",
                "areas",
                "area",
                "lsdb",
                "lsa-types",
                "lsa-type",
                "lsas",
                "lsa",
                "opaque-lsa",
                "traffic-engineering",
                "tlvs",
                "tlv",
                "link",
                "sub-tlvs",
                "sub-tlv",
                "administrative-groups",
                "admin-group",
            ]

    def _get_bit_index(self):
        """
    Getter method for bit_index, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/bit_index (leafref)

    YANG Description: A reference to the bit index being described
    """
        return self.__bit_index

    def _set_bit_index(self, v, load=False):
        """
    Setter method for bit_index, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/bit_index (leafref)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_bit_index is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_bit_index() directly.

    YANG Description: A reference to the bit index being described
    """
        parent = getattr(self, "_parent", None)
        if parent is not None and load is False:
            raise AttributeError(
                "Cannot set keys directly when" + " within an instantiated list"
            )

        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=six.text_type,
                is_leaf=True,
                yang_name="bit-index",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                is_keyval=True,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="leafref",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """bit_index must be of a type compatible with leafref""",
                    "defined-type": "leafref",
                    "generated-type": """YANGDynClass(base=six.text_type, is_leaf=True, yang_name="bit-index", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, is_keyval=True, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='leafref', is_config=False)""",
                }
            )

        self.__bit_index = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_bit_index(self):
        self.__bit_index = YANGDynClass(
            base=six.text_type,
            is_leaf=True,
            yang_name="bit-index",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            is_keyval=True,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="leafref",
            is_config=False,
        )

    def _get_state(self):
        """
    Getter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/state (container)

    YANG Description: State parameters relating to the administrative
groups being described for the link
    """
        return self.__state

    def _set_state(self, v, load=False):
        """
    Setter method for state, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/administrative_groups/admin_group/state (container)
    If this variable is read-only (config: false) in the
    source YANG file, then _set_state is considered as a private
    method. Backends looking to populate this variable should
    do so via calling thisObj._set_state() directly.

    YANG Description: State parameters relating to the administrative
groups being described for the link
    """
        if hasattr(v, "_utype"):
            v = v._utype(v)
        try:
            t = YANGDynClass(
                v,
                base=state.state,
                is_container="container",
                yang_name="state",
                parent=self,
                path_helper=self._path_helper,
                extmethods=self._extmethods,
                register_paths=True,
                extensions=None,
                namespace="http://openconfig.net/yang/network-instance",
                defining_module="openconfig-network-instance",
                yang_type="container",
                is_config=False,
            )
        except (TypeError, ValueError):
            raise ValueError(
                {
                    "error-string": """state must be of a type compatible with container""",
                    "defined-type": "container",
                    "generated-type": """YANGDynClass(base=state.state, is_container='container', yang_name="state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/network-instance', defining_module='openconfig-network-instance', yang_type='container', is_config=False)""",
                }
            )

        self.__state = t
        if hasattr(self, "_set"):
            self._set()

    def _unset_state(self):
        self.__state = YANGDynClass(
            base=state.state,
            is_container="container",
            yang_name="state",
            parent=self,
            path_helper=self._path_helper,
            extmethods=self._extmethods,
            register_paths=True,
            extensions=None,
            namespace="http://openconfig.net/yang/network-instance",
            defining_module="openconfig-network-instance",
            yang_type="container",
            is_config=False,
        )

    bit_index = __builtin__.property(_get_bit_index)
    state = __builtin__.property(_get_state)

    _pyangbind_elements = OrderedDict([("bit_index", bit_index), ("state", state)])


text:
#import <JavaScriptCore/JSValue.h>

@interface JSValue (StructSupport)
+ (id)valueWithSize:(struct CGSize)arg1 inContext:(id)arg2;
+ (id)valueWithRect:(struct CGRect)arg1 inContext:(id)arg2;
+ (id)valueWithRange:(struct _NSRange)arg1 inContext:(id)arg2;
+ (id)valueWithPoint:(struct CGPoint)arg1 inContext:(id)arg2;
- (struct CGSize)toSize;
- (struct CGRect)toRect;
- (struct _NSRange)toRange;
- (struct CGPoint)toPoint;
@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you 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 the following location:

      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.

-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

    <bean id="usernameAttribute" class="java.lang.String">
        <constructor-arg type="java.lang.String" value="mail" />
    </bean>

    <bean id="ldapUserDetailsService" class="org.jasig.cas.userdetails.LdapUserDetailsService"
          c:factory-ref="provisioningConnectionFactory"
          c:roleSearchExecutor-ref="searchExecutorRole"
          c:userSearchExecutor-ref="searchExecutorUser"
          c:userAttributeName="mail"
          c:roleAttributeName="uugid" />

    <bean id="searchExecutorUser" class="org.ldaptive.SearchExecutor"
          p:baseDn="${ldap.baseDn}"
          p:searchFilter="${ldap.user.searchFilter}"
          p:returnAttributes-ref="userDetailsUserAttributes" />

    <bean id="searchExecutorRole" class="org.ldaptive.SearchExecutor"
          p:baseDn="${ldap.role.baseDn}"
          p:searchFilter="${ldap.role.searchFilter}"
          p:returnAttributes-ref="userDetailsRoleAttributes" />

    <util:list id="userDetailsUserAttributes">
        <value>mail</value>
    </util:list>

    <util:list id="userDetailsRoleAttributes">
        <value>uugid</value>
    </util:list>

</beans>


text:
Clazz.declarePackage ("javajs.swing");
c$ = Clazz.decorateAsClass (function () {
this.component = null;
this.colspan = 0;
this.rowspan = 0;
this.textAlign = 0;
this.c = null;
Clazz.instantialize (this, arguments);
}, javajs.swing, "Cell");
Clazz.makeConstructor (c$,
function (btn, c) {
this.component = btn;
this.colspan = c.gridwidth;
this.rowspan = c.gridheight;
this.c = c;
}, "javajs.swing.JComponent,javajs.swing.GridBagConstraints");
Clazz.defineMethod (c$, "toHTML",
function (id) {
var style = this.c.getStyle (false);
return "<td id='" + id + "' " + (this.colspan < 2 ? "" : "colspan='" + this.colspan + "' ") + style + ">" + this.component.toHTML () + "	";
}, "~S");


text:
namespace DM.MovieApi.MovieDb.People;

public enum MediaType
{
    Unknown,
    Movie,
    TV,
}

[DataContract]
public class PersonInfo
{
    // TODO: (K. Chase) [2016-07-10] Update all POCO's to explicitly name the Id property, i.e,. PersonId, MovieId, TVShowId.
    [DataMember( Name = "id" )]
    public int Id { get; set; }

    [DataMember( Name = "name" )]
    public string Name { get; set; }

    [DataMember( Name = "adult" )]
    public bool IsAdultFilmStar { get; set; }

    [DataMember( Name = "known_for" )]
    public IReadOnlyList<PersonInfoRole> KnownFor { get; set; }

    [DataMember( Name = "profile_path" )]
    public string ProfilePath { get; set; }

    [DataMember( Name = "popularity" )]
    public double Popularity { get; set; }

    public PersonInfo()
    {
        KnownFor = Array.Empty<PersonInfoRole>();
    }

    public override string ToString()
        => $"{Name} ({Id})";
}

[DataContract]
public class PersonInfoRole
{
    // TODO: (K. Chase) [2016-07-10] Break into type for Movie and TV w/ a custom serializer.
    // re: see TVShowName v MovieTitle (and related)

    /// <summary>
    /// The MovieId or TVShowId as defined by the value of <see cref="MediaType"/>.
    /// </summary>
    [DataMember( Name = "id" )]
    public int Id { get; set; }

    [DataMember( Name = "media_type" )]
    public MediaType MediaType { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is TV.
    /// </summary>
    [DataMember( Name = "name" )]
    public string TVShowName { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is TV.
    /// </summary>
    [DataMember( Name = "original_name" )]
    public string TVShowOriginalName { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is Movie.
    /// </summary>
    [DataMember( Name = "title" )]
    public string MovieTitle { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is Movie.
    /// </summary>
    [DataMember( Name = "original_title" )]
    public string MovieOriginalTitle { set; get; }

    [DataMember( Name = "backdrop_path" )]
    public string BackdropPath { get; set; }

    [DataMember( Name = "poster_path" )]
    public string PosterPath { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is Movie.
    /// </summary>
    [DataMember( Name = "release_date" )]
    public DateTime MovieReleaseDate { get; set; }

    /// <summary>
    /// Only populated when <see cref="MediaType"/> is TV.
    /// </summary>
    [DataMember( Name = "first_air_date" )]
    public DateTime TVShowFirstAirDate { get; set; }

    [DataMember( Name = "overview" )]
    public string Overview { get; set; }

    [DataMember( Name = "adult" )]
    public bool IsAdultThemed { get; set; }

    [DataMember( Name = "video" )]
    public bool IsVideo { get; set; }

    [DataMember( Name = "genre_ids" )]
    internal IReadOnlyList<int> GenreIds { get; set; }

    public IReadOnlyList<Genre> Genres { get; set; }

    [DataMember( Name = "original_language" )]
    public string OriginalLanguage { get; set; }

    [DataMember( Name = "popularity" )]
    public double Popularity { get; set; }

    [DataMember( Name = "vote_count" )]
    public int VoteCount { get; set; }

    [DataMember( Name = "vote_average" )]
    public double VoteAverage { get; set; }

    [DataMember( Name = "origin_country" )]
    public IReadOnlyList<string> OriginCountry { get; set; }

    public PersonInfoRole()
    {
        GenreIds = Array.Empty<int>();
        Genres = Array.Empty<Genre>();
        OriginCountry = Array.Empty<string>();
    }

    public override string ToString()
    {
        return MediaType == MediaType.Movie
            ? $"Movie: {MovieTitle} ({Id} - {MovieReleaseDate:yyyy-MM-dd})"
            : $"TV: {TVShowName} ({Id} - {TVShowFirstAirDate:yyyy-MM-dd})";
    }
}


text:
(function($) {

/**
 * Find all properties of 'object' of the format ':event:query' and .bind
 * the associated function to an element that matches 'query' for 'event'.
 *
 * See ui.osw_conversation[':click:.send_message'] for an example.
 *
 * FIXME this should be a widget mixin or something.
 *
 */
$.osw_controller = function( widget ) {

	// bind all events
	$.each(widget, $.proxy(function(k, v) {
		var parts = k.split(':', 3);
		if( parts.length == 3 && parts[0] == '' ) {
			this.element.find( parts[2] ).bind( parts[1], $.proxy( v, this ) );
		}
	}, widget));
}

/**
 * This is a generic conversation view. It registers message and presence handlers
 * upon creation, which cause any relevent events to be displayed right away.
 *
 * Requires: strophe.js, jquery.jqote2.js
 *
 * Options:
 * - partner (string, required, default: none.)
 *     The JID of the conversation partner. May be full or bare.
 * - connection (Strophe.Connection, required, default: none.)
 *     The StropheJS connection to use for sending/receiving packets.
 * - template (string|jQuery|lambda, default: #template_ui_osw_conversation)
 *     The jQuote2 template to use from the view. This must exist at the time of instantiation.
 *
 * Methods:
 * - none
 *
 * Events:
 * - none
 *
 * Example:
 *  $("
").osw_conversation( {partner: '...', connection: ... } );
 */

$.widget( "ui.osw_conversation", {

	'options' : {
		'connection' : null,
		'partner' : null,
		'template' : '#template_ui_osw_conversation'
	},

	'_create' : function() {
		// create elements
		this.element.jqotepre( this.options.template, {
			partner: this.options.partner
		});

		// register all protocol handlers
		var handlers = [
			this.options.connection.addHandler( $.proxy(this._messageReceived, this), null, "message", "chat", null, null, null),
			this.options.connection.addHandler( $.proxy(this._presenceReceived, this), null, "presence", null, null, null, null)
		];

		this.element.data('handlers', handlers);

		$.osw_controller( this );
	},

	'destroy' : function() {
		var handlers = this.element.data('handlers');

		$.each(handlers, $.proxy(function(i, h) {
			this.options.connection.removeHandler( h );
		}, this));
	},

	':click:.send_message' : function(event, ui) {
		var body = this.element.find(".outgoing_text").val();

		var msg = $msg({
			'to' : this.options.partner,
			'type' : 'chat'
			}).c('body').t( body );

		this.options.connection.send( msg.tree() );

		// cleanup.
		this.element.find( '.incoming_text' ).append( '
You: ' + body + '
' );
		this.element.find(".outgoing_text").val('');
	},

	'_messageReceived' : function(msg) {
		try {
			// FIXME script injection may be possible.
			this.element.find( '.incoming_text' ).append( '
Them: ' + $(msg).find('body').text()+'
' );
		} finally {
			return true;
		}
	},

	'_presenceReceived' : function(pres) {
		try {
			// FIXME script injection may be possible.
			this.element.find( '.incoming_text' ).append( '
Presence: ' + $(pres).attr('type')+'
' );
		} finally {
			return true;
		}
	}

});

// Not used for now.
$.widget( "ui.osw_roster", {
	options: {
		connection: null
	},

	_template: $.jqotec('

'),
	_groupTemplate: $.jqotec('<li class="group" id="<%= this.id %>"><%= this.group_name %>

'),
	_entryTemplate: $.jqotec('<li class="entry" id="<%= this.id %>"><%= this.alias %>
'),

	_create: function() {

		this.options.connection.roster.registerCallback( this._received_roster );
	},
	_init: function() {
		$(this.element).jqotesub( this._template, {} );
	},
	destroy: function() {

	},

	addgroup: function(group) {
		return $(this.element)
			.jqoteapp( this._groupTemplate, {
			id: this._groupElId(group),
			group_name: group
		} );
	},

	addentry: function(group, jid) {
		return $( '#' + this._groupElId(group) + " > .entries" )
			.jqoteapp( this._entryTemplate, {
				id: this._entryElId(group, jid),
				alias: jid
			});
	},

	groupEl: function(group) {
		return $( '#' + this._groupElId(group) );
	},

	entryEl: function(group, jid) {
		return $( '#' + this._entryElId(group, jid) );
	},

	_received_roster: function(items) {
		alert("got roster");
	},

	_groupElId: function(group) {
		// TODO find a fast hashing function
		return MD5.hexdigest("group." + group);
	},
	_entryElId: function(group, jid) {
		// TODO find a fast hashing function
		return MD5.hexdigest("entry." + group + "." + jid);
	}

});

/**
 * A generic activity publisher. It simply has an input textbox and a button
 * that call the proper methods on the osw plugin.
 *
 * Requires: strophe.osw.js
 *
 * Options:
 * - connection (Strophe.Connection, required, default: none.)
 *     The StropheJS connection to use for sending/receiving packets.
 * - template (string|jQuery|lambda, default: #template_ui_osw_activitypublish)
 *     The jQuote2 template to use from the view. This must exist at the time of instantiation.
 *
 * Methods:
 * - none
 *
 * Events:
 * - none
 *
 * Example:
 *  $("
").osw_activitypublish( {connection: ... } );
 */
$.widget("ui.osw_activitypublish", {
	'options' : {
		'connection' : null,
		'template' : '#template_ui_osw_activitypublish'
	},

	'_create' : function() {
		$(this.element).jqoteapp(this.options.template, {});

		$.osw_controller( this );
	},

	':submit:.form' : function() {
		try {
			var status = $(this.element).find(".status").val();
			$(this.element).find(".status").val('');

			this.options.connection.osw.publishActivity( status );
		} finally {
			return false;
		}
	},

});

/**
 * Displays activities for all users that are currently subscribed to. It is designed
 * to have a template for each object type, as well as a main template. It should
 * also have one for viewing an ACL.
 *
 * It registers events to update the view automatically through pubsub notices
 * and the inbox.
 *
 * Requires: strophe.osw.js
 *
 * Options:
 * - connection (Strophe.Connection, required, default: none.)
 *     The StropheJS connection to use for sending/receiving packets.
 * - template (string|jQuery|lambda, default: #template_ui_osw_activityview)
 *     The jQuote2 template to use from the view. This must exist at the time of instantiation.
 * - activityTemplate (string|jQuery|lambda, default: #template_ui_osw_activityview_activity)
 *     The jQuote2 template to use from the view. This must exist at the time of instantiation.
 *
 * Methods:
 * - refresh()
 *     Clears the view and makes a new call to connection.osw.inbox(), which
 *     then populate the view through the handlers.
 * - append(activity)
 *     Appends an activity to the view. JSON format as returned by the osw event.
 *
 * Events:
 * - none
 *
 * Example:
 *  $("
").osw_activityview( {connection: ... } );
 */
$.widget( "ui.osw_activityview", {
	'options' : {
		'connection' : null,
		'template' : '#template_ui_osw_activityview',
		'activityTemplate' : '#template_ui_osw_activityview_activity'
	},

	// TODO generalize. hash the type or something.
	'_objectTemplate': {
		'http://onesocialweb.org/spec/1.0/object/status': $.jqotec('
Status: <%= this.obj.status %>
'),
		'http://onesocialweb.org/spec/1.0/object/picture': $.jqotec('
Picture: <%= this.obj.picture %>
'),
		'' : $.jqotec('
Unknown object type: <%= this.obj.objectType %>
'),
	},

	'_create' : function() {
		var self = this;

		$(this.element).jqoteapp( this.options.template );

		this.options.connection.osw.callbacks.received_activity.add( this._osw_activity_callback, this );

	},

	'_init' : function() {

	},

	'refresh' : function() {
		$(".activities", this).html("");

		this.options.connection.osw.inbox();
	},

	'append' : function(act) {
		var actId = MD5.hexdigest( act.id );

		// add the activity to the beginning of the stream
		$(this.element).find(".activities").jqotepre(this.options.activityTemplate, {
			id: actId,
			act: act
		});

		$.each(act.objects, $.proxy(function(i, obj) {
			var template = this._objectTemplate.hasOwnProperty( obj.objectType ) ?
				obj.objectType : '';

			// attach the object to the activity.
			$("#" + actId + " > .objects").jqoteapp( this._objectTemplate[ template ], {
				obj: obj
			});
		}, this));
	},

	'_osw_activity_callback' : function( act ) {
		this.append( act );
	}
});

})(jQuery);


text:
System.getValue :	; val in ebx, returns in ecx
	imul ebx, 4
	add ebx, System.valueLocations
	mov ecx, [ebx]
	mov ecx, [ecx]
ret

System.valueLocations :
	dd Graphics.VESA_MODE, Graphics.SCREEN_WIDTH, Graphics.SCREEN_HEIGHT, Graphics.bytesPerPixel, Guppy.totalRAM, Guppy.usedRAM, Clock.tics, Graphics.CARDNAME, ProgramManager.PnumCounter, DisplayMode


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/file.h>
#include <winpr/synch.h>
#include <winpr/library.h>
#include <winpr/collections.h>

#include <freerdp/addin.h>
#include <freerdp/build-config.h>
#include <freerdp/client/channels.h>

#include "tables.h"

#include "addin.h"

#include <freerdp/channels/log.h>
#define TAG CHANNELS_TAG("addin")

extern const STATIC_ENTRY_TABLE CLIENT_STATIC_ENTRY_TABLES[];

void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABLE* table,
                                                  const char* identifier)
{
	int index = 0;
	STATIC_ENTRY* pEntry;
	pEntry = (STATIC_ENTRY*)&table->table[index++];

	while (pEntry->entry != NULL)
	{
		if (strcmp(pEntry->name, identifier) == 0)
		{
			return (void*)pEntry->entry;
		}

		pEntry = (STATIC_ENTRY*)&table->table[index++];
	}

	return NULL;
}

void* freerdp_channels_client_find_static_entry(const char* name, const char* identifier)
{
	int index = 0;
	STATIC_ENTRY_TABLE* pEntry;
	pEntry = (STATIC_ENTRY_TABLE*)&CLIENT_STATIC_ENTRY_TABLES[index++];

	while (pEntry->table != NULL)
	{
		if (strcmp(pEntry->name, name) == 0)
		{
			return freerdp_channels_find_static_entry_in_table(pEntry, identifier);
		}

		pEntry = (STATIC_ENTRY_TABLE*)&CLIENT_STATIC_ENTRY_TABLES[index++];
	}

	return NULL;
}

extern const STATIC_ADDIN_TABLE CLIENT_STATIC_ADDIN_TABLE[];

static FREERDP_ADDIN** freerdp_channels_list_client_static_addins(LPCSTR pszName,
                                                                  LPCSTR pszSubsystem,
                                                                  LPCSTR pszType, DWORD dwFlags)
{
	size_t i, j;
	DWORD nAddins;
	FREERDP_ADDIN** ppAddins = NULL;
	STATIC_SUBSYSTEM_ENTRY* subsystems;
	nAddins = 0;
	ppAddins = (FREERDP_ADDIN**)calloc(128, sizeof(FREERDP_ADDIN*));

	if (!ppAddins)
	{
		WLog_ERR(TAG, "calloc failed!");
		return NULL;
	}

	ppAddins[nAddins] = NULL;

	for (i = 0; CLIENT_STATIC_ADDIN_TABLE[i].name != NULL; i++)
	{
		FREERDP_ADDIN* pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));

		if (!pAddin)
		{
			WLog_ERR(TAG, "calloc failed!");
			goto error_out;
		}

		sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s", CLIENT_STATIC_ADDIN_TABLE[i].name);
		pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
		pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
		pAddin->dwFlags |= FREERDP_ADDIN_NAME;
		ppAddins[nAddins++] = pAddin;
		subsystems = (STATIC_SUBSYSTEM_ENTRY*)CLIENT_STATIC_ADDIN_TABLE[i].table;

		for (j = 0; subsystems[j].name != NULL; j++)
		{
			pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));

			if (!pAddin)
			{
				WLog_ERR(TAG, "calloc failed!");
				goto error_out;
			}

			sprintf_s(pAddin->cName, ARRAYSIZE(pAddin->cName), "%s",
			          CLIENT_STATIC_ADDIN_TABLE[i].name);
			sprintf_s(pAddin->cSubsystem, ARRAYSIZE(pAddin->cSubsystem), "%s", subsystems[j].name);
			pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
			pAddin->dwFlags |= FREERDP_ADDIN_STATIC;
			pAddin->dwFlags |= FREERDP_ADDIN_NAME;
			pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
			ppAddins[nAddins++] = pAddin;
		}
	}

	return ppAddins;
error_out:
	freerdp_channels_addin_list_free(ppAddins);
	return NULL;
}

static FREERDP_ADDIN** freerdp_channels_list_dynamic_addins(LPCSTR pszName, LPCSTR pszSubsystem,
                                                            LPCSTR pszType, DWORD dwFlags)
{
	int index;
	int nDashes;
	HANDLE hFind;
	DWORD nAddins;
	LPSTR pszPattern;
	size_t cchPattern;
	LPCSTR pszAddinPath = FREERDP_ADDIN_PATH;
	LPCSTR pszInstallPrefix = FREERDP_INSTALL_PREFIX;
	LPCSTR pszExtension;
	LPSTR pszSearchPath;
	size_t cchSearchPath;
	size_t cchAddinPath;
	size_t cchInstallPrefix;
	FREERDP_ADDIN** ppAddins;
	WIN32_FIND_DATAA FindData;
	cchAddinPath = strnlen(pszAddinPath, sizeof(FREERDP_ADDIN_PATH));
	cchInstallPrefix = strnlen(pszInstallPrefix, sizeof(FREERDP_INSTALL_PREFIX));
	pszExtension = PathGetSharedLibraryExtensionA(0);
	cchPattern = 128 + strnlen(pszExtension, MAX_PATH) + 2;
	pszPattern = (LPSTR)malloc(cchPattern + 1);

	if (!pszPattern)
	{
		WLog_ERR(TAG, "malloc failed!");
		return NULL;
	}

	if (pszName && pszSubsystem && pszType)
	{
		sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-%s-%s.%s",
		          pszName, pszSubsystem, pszType, pszExtension);
	}
	else if (pszName && pszType)
	{
		sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client-?-%s.%s",
		          pszName, pszType, pszExtension);
	}
	else if (pszName)
	{
		sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "%s-client*.%s", pszName,
		          pszExtension);
	}
	else
	{
		sprintf_s(pszPattern, cchPattern, FREERDP_SHARED_LIBRARY_PREFIX "?-client*.%s",
		          pszExtension);
	}

	cchPattern = strnlen(pszPattern, cchPattern);
	cchSearchPath = cchInstallPrefix + cchAddinPath + cchPattern + 3;
	pszSearchPath = (LPSTR)malloc(cchSearchPath + 1);

	if (!pszSearchPath)
	{
		WLog_ERR(TAG, "malloc failed!");
		free(pszPattern);
		return NULL;
	}

	CopyMemory(pszSearchPath, pszInstallPrefix, cchInstallPrefix);
	pszSearchPath[cchInstallPrefix] = '\0';
	NativePathCchAppendA(pszSearchPath, cchSearchPath + 1, pszAddinPath);
	NativePathCchAppendA(pszSearchPath, cchSearchPath + 1, pszPattern);
	free(pszPattern);
	hFind = FindFirstFileA(pszSearchPath, &FindData);
	free(pszSearchPath);
	nAddins = 0;
	ppAddins = (FREERDP_ADDIN**)calloc(128, sizeof(FREERDP_ADDIN*));

	if (!ppAddins)
	{
		FindClose(hFind);
		WLog_ERR(TAG, "calloc failed!");
		return NULL;
	}

	if (hFind == INVALID_HANDLE_VALUE)
		return ppAddins;

	do
	{
		char* p[5];
		FREERDP_ADDIN* pAddin;
		nDashes = 0;
		pAddin = (FREERDP_ADDIN*)calloc(1, sizeof(FREERDP_ADDIN));

		if (!pAddin)
		{
			WLog_ERR(TAG, "calloc failed!");
			goto error_out;
		}

		for (index = 0; FindData.cFileName[index]; index++)
			nDashes += (FindData.cFileName[index] == '-') ? 1 : 0;

		if (nDashes == 1)
		{
			/* <name>-client.<extension> */
			p[0] = FindData.cFileName;
			p[1] = strchr(p[0], '-') + 1;
			strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
			pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
			pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
			pAddin->dwFlags |= FREERDP_ADDIN_NAME;
			ppAddins[nAddins++] = pAddin;
		}
		else if (nDashes == 2)
		{
			/* <name>-client-<subsystem>.<extension> */
			p[0] = FindData.cFileName;
			p[1] = strchr(p[0], '-') + 1;
			p[2] = strchr(p[1], '-') + 1;
			p[3] = strchr(p[2], '.') + 1;
			strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
			strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
			pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
			pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
			pAddin->dwFlags |= FREERDP_ADDIN_NAME;
			pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
			ppAddins[nAddins++] = pAddin;
		}
		else if (nDashes == 3)
		{
			/* <name>-client-<subsystem>-<type>.<extension> */
			p[0] = FindData.cFileName;
			p[1] = strchr(p[0], '-') + 1;
			p[2] = strchr(p[1], '-') + 1;
			p[3] = strchr(p[2], '-') + 1;
			p[4] = strchr(p[3], '.') + 1;
			strncpy(pAddin->cName, p[0], (p[1] - p[0]) - 1);
			strncpy(pAddin->cSubsystem, p[2], (p[3] - p[2]) - 1);
			strncpy(pAddin->cType, p[3], (p[4] - p[3]) - 1);
			pAddin->dwFlags = FREERDP_ADDIN_CLIENT;
			pAddin->dwFlags |= FREERDP_ADDIN_DYNAMIC;
			pAddin->dwFlags |= FREERDP_ADDIN_NAME;
			pAddin->dwFlags |= FREERDP_ADDIN_SUBSYSTEM;
			pAddin->dwFlags |= FREERDP_ADDIN_TYPE;
			ppAddins[nAddins++] = pAddin;
		}
		else
		{
			free(pAddin);
		}
	} while (FindNextFileA(hFind, &FindData));

	FindClose(hFind);
	ppAddins[nAddins] = NULL;
	return ppAddins;
error_out:
	FindClose(hFind);
	freerdp_channels_addin_list_free(ppAddins);
	return NULL;
}

FREERDP_ADDIN** freerdp_channels_list_addins(LPCSTR pszName, LPCSTR pszSubsystem, LPCSTR pszType,
                                             DWORD dwFlags)
{
	if (dwFlags & FREERDP_ADDIN_STATIC)
		return freerdp_channels_list_client_static_addins(pszName, pszSubsystem, pszType, dwFlags);
	else if (dwFlags & FREERDP_ADDIN_DYNAMIC)
		return freerdp_channels_list_dynamic_addins(pszName, pszSubsystem, pszType, dwFlags);

	return NULL;
}

void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
{
	size_t index;

	if (!ppAddins)
		return;

	for (index = 0; ppAddins[index] != NULL; index++)
		free(ppAddins[index]);

	free(ppAddins);
}

extern const STATIC_ENTRY CLIENT_VirtualChannelEntryEx_TABLE[];

BOOL freerdp_channels_is_virtual_channel_entry_ex(LPCSTR pszName)
{
	size_t i;

	for (i = 0; CLIENT_VirtualChannelEntryEx_TABLE[i].name != NULL; i++)
	{
		const STATIC_ENTRY* entry = &CLIENT_VirtualChannelEntryEx_TABLE[i];

		if (!strncmp(entry->name, pszName, MAX_PATH))
			return TRUE;
	}

	return FALSE;
}

PVIRTUALCHANNELENTRY freerdp_channels_load_static_addin_entry(LPCSTR pszName, LPCSTR pszSubsystem,
                                                              LPCSTR pszType, DWORD dwFlags)
{
	const STATIC_ADDIN_TABLE* table = CLIENT_STATIC_ADDIN_TABLE;
	if (!pszName)
		return NULL;

	for (; table->name != NULL; table++)
	{
		if (strncmp(table->name, pszName, MAX_PATH) == 0)
		{
			if (pszSubsystem != NULL)
			{
				const STATIC_SUBSYSTEM_ENTRY* subsystems = table->table;

				for (; subsystems->name != NULL; subsystems++)
				{
					/* If the pszSubsystem is an empty string use the default backend. */
					if ((strnlen(pszSubsystem, 1) ==
					     0) || /* we only want to know if strnlen is > 0 */
					    (strncmp(subsystems->name, pszSubsystem, MAX_PATH) == 0))
					{
						if (pszType)
						{
							if (strncmp(subsystems->type, pszType, MAX_PATH) == 0)
								return (PVIRTUALCHANNELENTRY)subsystems->entry;
						}
						else
						{
							return (PVIRTUALCHANNELENTRY)subsystems->entry;
						}
					}
				}
			}
			else
			{
				if (dwFlags & FREERDP_ADDIN_CHANNEL_ENTRYEX)
				{
					if (!freerdp_channels_is_virtual_channel_entry_ex(pszName))
						return NULL;
				}

				return (PVIRTUALCHANNELENTRY)table->entry;
			}
		}
	}

	return NULL;
}


text:
There are many ways that you can contribute to the ConnectTheDots project:

* Submit a bug
* Submit a code fix for a bug
* Submit code to add a new device or sensor to the project, or modify existing device code
* Submit code to add a new device gateway to the project, or modify existing gateway code (e.g. in a different programming language)
* Submit code or configuration for storing or analyzing the data in Azure
* Submit a new website design
* Submit additions or modifications to the documentation
* Submit a feature request

The key design principle is that the code makes it easy for people to get data from sensors into Azure and to utilize IoT services in Azure such as Azure Stream Analytics and Machine Learning.

## Contributing Code
To contribute code you need to issue a Pull Request. All code submissions will be reviewed and tested by the team, and those that meet a high bar for both quality and design/roadmap appropriateness will be merged into the source. You must sign a [Contribution License Agreement](https://cla.msopentech.com/) ([CLA](https://cla.msopentech.com/)) before submitting a Pull Request. To complete the CLA, you will need to submit the request via the form and then electronically sign the CLA when you receive the email containing the link to the document.

This needs to only be done once, for your first contribution to the ConnectTheDots project.


text:
Titanium.UI.setBackgroundColor('#000');

var tabGroup = Titanium.UI.createTabGroup({});

var win1 = Titanium.UI.createWindow({
    url: 'table_view.js',
    title:'Tab 1',
    backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
    window:win1
});

win1.hideTabBar();

tabGroup.addTab(tab1);
tabGroup.open();


text:
module NotifyUser
  class Unsubscribe < ActiveRecord::Base
    self.table_name = "notify_user_unsubscribes"

    # The user to send the notification to
    belongs_to :target, polymorphic: true

    validates_presence_of :target_id, :target_type, :target, :type

    validates :type, :uniqueness => {:scope => [:target_type, :target_id]}

    self.inheritance_column = :_type_disabled

    if Rails.version.to_i < 4
      attr_accessible :target, :type, :group_id
    end

    def self.for_target(target)
      where(target_id: target.id)
      .where(target_type: target.class.base_class)
    end

    def self.toggle_status(target, type)
      if NotifyUser::Unsubscribe.has_unsubscribed_from?(target, type)
        NotifyUser::Unsubscribe.subscribe(target, type)
      else
        NotifyUser::Unsubscribe.unsubscribe(target,type)
      end
    end

    def self.unsubscribe(target, type, group_id=nil)
      ## creates unsubscribe object if it doesn't already exist
      unless exists?(target_id: target.id, target_type: target.class.base_class,
        type: type, group_id: group_id)
        create(target: target, type: type, group_id: group_id)
      end
    end

    def self.subscribe(target, type, group_id=nil)
      #deletes unsubscribe object in essence subscribing a user
      where(target_id: target.id)
      .where(target_type: target.class.base_class)
      .where(type: type, group_id: group_id).destroy_all
    end

    ## checks to see if you've unsubscribed from the overall notification type
    ## before checking you've unsubscribed from the specific group_id
    def self.has_unsubscribed_from?(target, type, group_id=nil, channel_name=nil)
      return true if where(target_id: target.id, target_type: target.class.base_class).where(type: type).any?
      return true if where(target_id: target.id, target_type: target.class.base_class, type: type, group_id: group_id).any? if group_id
      return true if where(target_id: target.id, target_type: target.class.base_class, type: channel_name).any? if channel_name
      false
    end

    def self.has_unsubscribed_from(target, type, group_id=nil)
      where(target_id: target.id)
      .where(target_type: target.class.base_class)
      .where(type: type, group_id: group_id)
    end

  end
end


text:
// import Promise from 'bluebird';
const mongoose = require('mongoose');
const httpStatus = require('http-status');
const APIError = require('../helpers/APIError');

const Schema = mongoose.Schema;

/**
 * Message Schema
 */
const MessageSchema = new Schema({
  sender_id: {
    type: Schema.Types.ObjectId,
    ref: 'User'
	},
	receivers_id: [{
		type: Schema.Types.ObjectId,
		ref: 'User'
	}],
  group_id: {
    type: Schema.Types.ObjectId,
		ref: 'Group'
  },
  type: {
    type: String,
    default: 'txt'
  },
  txt: {
    type: String
  },
  attachments: [{
    type: Schema.Types.ObjectId,
    ref: 'FsFile'
  }],
  seenReceivers_id: [{
		type: Schema.Types.ObjectId,
		ref: 'User'
	}],
  receivedReceivers_id: [{
    type: Schema.Types.ObjectId,
    ref: 'User'
  }],
  sendAt: {
    type: Date,
    default: Date.now
  }
});

/**
 * @typedef Message
 */
module.exports = mongoose.model('Message', MessageSchema, 'messages');