text:
PTagCloud TTagCloud::GetFromDocStrWgtPrV(const TStrFltPrV& DocStrWgtPrV,
 const int& TopWords=25, const double& TopWordsWgtSumPrc=1.0){
  PTagCloud TagCloud=TTagCloud::New();
  // create bow
  PSwSet SwSet=TSwSet::GetSwSet(swstEn523);
  PStemmer Stemmer=TStemmer::GetStemmer(stmtPorter);
  PBowDocBs BowDocBs=TBowDocBs::New(SwSet, Stemmer, NULL);
  TIntFltPrV DocIdWgtPrV(DocStrWgtPrV.Len(), 0);
  for (int DocN=0; DocN<DocStrWgtPrV.Len(); DocN++){
    TStr DocNm=TInt(DocN).GetStr();
    TStr DocStr=DocStrWgtPrV[DocN].Val1;
    double DocWgt=DocStrWgtPrV[DocN].Val2;
    int DocId=BowDocBs->AddHtmlDoc(DocNm, TStrV(), DocStr);
    DocIdWgtPrV.Add(TIntFltPr(DocId, DocWgt));
  }
  // create word-weights
  TBowWordWgtType WordWgtType=bwwtNrmTFIDF; // define weighting
  PBowDocWgtBs BowDocWgtBs=TBowDocWgtBs::New(BowDocBs, WordWgtType, 0, 0);
  // create concept vector
  PBowSim BowSim=TBowSim::New(bstCos); // similarity object
  TIntV AllDIdV; BowDocBs->GetAllDIdV(AllDIdV);
  PBowSpV ConceptSpV=TBowClust::GetConceptSpV(BowDocWgtBs, BowSim, AllDIdV, 1, DocIdWgtPrV);
  // get word-vector
  ConceptSpV->GetWordStrWgtPrV(BowDocBs, TopWords, TopWordsWgtSumPrc, TagCloud->WordStrWgtPrV);
  // word placement
  TagCloud->PlaceWords();
  // return
  return TagCloud;
}

void TTagCloud::PlaceWords(){
  int Words=WordStrWgtPrV.Len();
  TGksRectV RectV(Words);
  // assign rectangles to words
  for (int WordN=0; WordN<Words; WordN++){
    RectV[WordN].X1=0; RectV[WordN].Y1=0;
    RectV[WordN].X2=WordStrWgtPrV[WordN].Val1.Len(); RectV[WordN].Y2=1;
  }
  // reduce size of rectangles to appropriate size
  forever {
    double AreaSum=0; double MxY=0;
    for (int WordN=0; WordN<Words; WordN++){
      RectV[WordN].X2*=0.9; RectV[WordN].Y2=0.9;
      AreaSum+=RectV[WordN].X2*RectV[WordN].Y2;
      MxY=(WordN==0) ? RectV[WordN].Y2 : TFlt::GetMx(MxY, RectV[WordN].Y2);
    }
    if ((AreaSum<0.25)&&(MxY<1)){
      break;}
  }
}

void TTagCloud::Dump(){
  // print tag-cloud
  for (int WordN=0; WordN<WordStrWgtPrV.Len(); WordN++){
    printf("[%s:%.2f] ", WordStrWgtPrV[WordN].Val1.CStr(), WordStrWgtPrV[WordN].Val2);
  }
}


text:
module.exports = new (function() {

  /**
   * Given an element name, returns that element object
   *
   * @param {Object} parent The parent page or section
   * @param {string} elementName Name of element
   * @returns {Object} The element object
   */
  function getElement(parent, elementName) {
    elementName = elementName.substring(1);
    if (!(elementName in parent.elements)) {
      throw new Error(elementName + ' was not found in "' + parent.name +
        '". Available elements: ' + Object.keys(parent.elements));
    }
    return parent.elements[elementName];
  }

  /**
   * Given a section name, returns that section object
   *
   * @param {Object} parent The parent page or section
   * @param {string} sectionName Name of section
   * @returns {Object} The section object
   */
  function getSection(parent, sectionName) {
    sectionName = sectionName.substring(1);
    if (!(sectionName in parent.section)) {
      throw new Error(sectionName + ' was not found in "' + parent.name +
        '". Available sections: ' + Object.keys(parent.sections));
    }
    return parent.section[sectionName];
  }

  /**
   * Calls use(Css|Xpath|Recursion) command
   *
   * Uses `useXpath`, `useCss`, and `useRecursion` commands.
   *
   * @param {Object} client The Nightwatch instance
   * @param {string} desiredStrategy (css selector|xpath|recursion)
   * @returns {null}
   */
  function setLocateStrategy(client, desiredStrategy) {
    var methodMap = {
      xpath : 'useXpath',
      'css selector' : 'useCss',
      recursion : 'useRecursion'
    };

    if (desiredStrategy in methodMap) {
      client.api[methodMap[desiredStrategy]]();
    }
  }

  /**
   * Creates a closure that enables calling commands and assertions on the page or section.
   * For all element commands and assertions, it fetches element's selector and locate strategy
   *  For elements nested under sections, it sets 'recursion' as the locate strategy and passes as its first argument to the command an array of its ancestors + self
   *  If the command or assertion is not on an element, it calls it with the untouched passed arguments
   *
   * @param {Object} parent The parent page or section
   * @param {function} commandFn The actual command function
   * @param {string} commandName The name of the command ("click", "containsText", etc)
   * @param {Boolean} [isChaiAssertion]
   * @returns {function}
   */
  function makeWrappedCommand(parent, commandFn, commandName, isChaiAssertion) {
    return function() {
      var args = Array.prototype.slice.call(arguments);
      var prevLocateStrategy = parent.client.locateStrategy;
      var elementCommand = isElementCommand(args);

      if (elementCommand) {
        var firstArg;
        var desiredStrategy;
        var callbackIndex;
        var originalCallback;
        var elementOrSectionName = args.shift();
        var getter = (isChaiAssertion && commandName === 'section') ? getSection : getElement;
        var elementOrSection = getter(parent, elementOrSectionName);
        var ancestors = getAncestorsWithElement(elementOrSection);

        if (ancestors.length === 1) {
          firstArg = elementOrSection.selector;
          desiredStrategy = elementOrSection.locateStrategy;
        } else {
          firstArg = ancestors;
          desiredStrategy = 'recursion';
        }

        setLocateStrategy(parent.client, desiredStrategy);
        args.unshift(firstArg);

        // if a callback is being used with this command, wrap it in
        // a function that allows us to restore the locate strategy
        // to its original value before the callback is called

        callbackIndex = findCallbackIndex(args);
        if (callbackIndex !== -1) {
          originalCallback = args[callbackIndex];

          args[callbackIndex] = function callbackWrapper() {

            // restore the locate strategy directly through client.locateStrategy.
            // setLocateStrategy() can't be used since it uses the api commands
            // which get added to the command queue and will not update the
            // strategy in time for the callback which is getting immediately
            // called after

            parent.client.locateStrategy = prevLocateStrategy;
            return originalCallback.apply(parent.client.api, arguments);
          };
        }
      }

      var c = commandFn.apply(parent.client, args);
      if (elementCommand) {
        setLocateStrategy(parent.client, prevLocateStrategy);
      }
      return (isChaiAssertion ? c : parent);
    };
  }

  /**
   *
   * @param {Array} args
   * @return {boolean}
   */
  function isElementCommand(args) {
    return (args.length > 0) && (args[0].toString().indexOf('@') === 0);
  }

  /**
   * Identifies the location of a callback function within an arguments array.
   *
   * @param {Array} args Arguments array in which to find the location of a callback.
   * @returns {number} Index location of the callback in the args array. If not found, -1 is returned.
   */
  function findCallbackIndex(args) {

    if (args.length === 0) {
      return -1;
    }

    // callbacks will usually be the last argument. waitFor methods allow an additional
    // message argument to follow the callback which will also need to be checked for.

    // last argument

    var index = args.length - 1;
    if (typeof args[index] === 'function') {
      return index;
    }

    // second to last argument (waitfor calls)

    index--;
    if (typeof args[index] === 'function') {
      return index;
    }

    return -1;
  }

  /**
   * Retrieves an array of ancestors of the supplied element. The last element in the array is the element object itself
   *
   * @param {Object} element The element
   * @returns {Array}
   */
  function getAncestorsWithElement(element) {
    var elements = [];
    function addElement(e) {
      elements.unshift(e);
      if (e.parent && e.parent.selector) {
        addElement(e.parent);
      }
    }
    addElement(element);
    return elements;
  }

  /**
   * Adds commands (elements commands, assertions, etc) to the page or section
   *
   * @param {Object} parent The parent page or section
   * @param {Object} target What the command is added to (parent|section or assertion object on parent|section)
   * @param {Object} commands
   * @returns {null}
   */
  function applyCommandsToTarget(parent, target, commands) {

    Object.keys(commands).forEach(function(commandName) {
      if (isValidAssertion(commandName)) {
        target[commandName] = target[commandName] || {};

        var isChaiAssertion = commandName === 'expect';
        var assertions = commands[commandName];

        Object.keys(assertions).forEach(function(assertionName) {
          target[commandName][assertionName] = addCommand(target[commandName], assertions[assertionName], assertionName, parent, isChaiAssertion);
        });
      } else {
        target[commandName] = addCommand(target, commands[commandName], commandName, parent, false);
      }
    });
  }

  function addCommand(target, commandFn, commandName, parent, isChaiAssertion) {
    if (target[commandName]) {
      parent.client.results.errors++;
      var error = new Error('The command "' + commandName + '" is already defined!');
      parent.client.errors.push(error.stack);
      throw error;
    }

    return makeWrappedCommand(parent, commandFn, commandName, isChaiAssertion);
  }

  function isValidAssertion(commandName) {
    return ['assert', 'verify', 'expect'].indexOf(commandName) > -1;
  }

  /**
   * Entrypoint to add commands (elements commands, assertions, etc) to the page or section
   *
   * @param {Object} parent The parent page or section
   * @param {function} commandLoader function that retrieves commands
   * @returns {null}
   */
  this.addWrappedCommands = function (parent, commandLoader) {
    var commands = {};
    commands = commandLoader(commands);
    applyCommandsToTarget(parent, parent, commands);
  };

})();

redpajama_set_name: RedPajamaGithub


text:
  Écordal est
       un village
       situé dans le département des Ardennes en Champagne-Ardenne. On dénombrait 299 habitants en 2008.

Le parc d'habitations, à Écordal, se décomposait en 2011 en deux appartements et 159 maisons soit
 un marché relativement équilibré.

Si vous envisagez de emmenager à Écordal, vous pourrez facilement trouver une maison à acheter.

À proximité de Écordal sont positionnées géographiquement les villes de
Saint-Loup-Terrier située à 5 km, 160 habitants,
Rilly-sur-Aisne située à 5 km, 108 habitants,
Guincourt localisée à 4 km, 97 habitants,
Attigny localisée à 5 km, 1 184 habitants,
Charbogne située à 2 km, 210 habitants,
Saint-Lambert-et-Mont-de-Jeux localisée à 3 km, 187 habitants,
 entre autres. De plus, Écordal est située à seulement 29 km de Charleville-Mézières.


text:
<?php

namespace Umc\Base\Block\Adminhtml\Module\Edit\Tab;

use Magento\Backend\Block\Widget\Tab\TabInterface;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\Phrase;
use Magento\Framework\Registry;
use Umc\Base\Api\Data\EntityInterface;
use Umc\Base\Config\Form as FormConfig;
use Umc\Base\Block\Adminhtml\EntityFactory as EntityBlockFactory;

/**
 * @api
 */
class Entities extends AbstractTab implements TabInterface
{
    /**
     * @var EntityBlockFactory
     */
    protected $entityBlockFactory;

    /**
     * @var string
     */
    protected $entityBlockTemplate;

    /**
     * @param Context $context
     * @param Registry $registry
     * @param FormFactory $formFactory
     * @param FormConfig $formConfig
     * @param string $entityCode
     * @param EntityBlockFactory $entityBlockFactory
     * @param string $entityBlockTemplate
     * @param array $data
     */
    public function __construct(
        Context $context,
        Registry $registry,
        FormFactory $formFactory,
        FormConfig $formConfig,
        $entityCode,
        EntityBlockFactory $entityBlockFactory,
        $entityBlockTemplate,
        array $data = []
    ) {
        $this->entityBlockFactory  = $entityBlockFactory;
        $this->entityBlockTemplate = $entityBlockTemplate;
        parent::__construct($context, $registry, $formFactory, $formConfig, $entityCode, $data);
    }

    /**
     * Prepare label for tab
     *
     * @return string
     */
    public function getTabLabel()
    {
        return __('Entities');
    }

    /**
     * Prepare title for tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return $this->getTabLabel();
    }

    /**
     * Can show tab in tabs
     *
     * @return boolean
     */
    public function canShowTab()
    {
        return true;
    }

    /**
     * Tab is hidden
     *
     * @return boolean
     */
    public function isHidden()
    {
        return false;
    }

    /**
     * get the current entities
     *
     * @return \Umc\Base\Api\Data\EntityInterface[]
     */
    public function getEntities()
    {
        /** @var \Umc\Base\Api\Data\ModuleInterface $module */
        if ($module = $this->_coreRegistry->registry('current_module')) {
            return $module->getEntities();
        }
        return [];
    }

    /**
     * @param string $increment
     * @param null|EntityInterface $entity
     * @return \Umc\Base\Block\Adminhtml\Entity
     */
    public function getEntityBlock($increment, EntityInterface $entity = null)
    {
        $entityBlock = $this->entityBlockFactory->create();
        $entityBlock->setTemplate($this->entityBlockTemplate);
        $entityBlock->setEntity($entity);
        $entityBlock->setData('increment', $increment);
        return $entityBlock;
    }
}


text:
import uuid from "uuid";
import App from "../../app";
import DMXFixture from "./DMXFixture";

export default class DMXSet {
  class: "DMXSet" = "DMXSet";
  id: string;
  name: string;
  fixtureIds: string[];
  constructor(params: Partial<DMXSet> = {}) {
    this.id = params.id || uuid.v4();
    this.name = params.name || "DMX Set";
    this.fixtureIds = params.fixtureIds || [];
  }
  static exportable = "dmxSets";
  serialize({addData}) {
    const filename = `${this.name}.dmxSet`;
    const data = {...this, fixtures: this.fixtures};
    addData("dmxSets", data);
    return filename;
  }
  static import(data: DMXSet) {
    // Extract and load the fixtures
    const fixtureIds = data.fixtures.map(f => {
      const fixture = new DMXFixture({...f, id: null});
      App.dmxFixtures.push(fixture);
      return fixture.id;
    });
    const dmxSet = new DMXSet({...data, fixtureIds, id: null});
    App.dmxSets.push(dmxSet);
  }
  get fixtures() {
    return this.fixtureIds
      .map(id => App.dmxFixtures.find(f => f.id === id))
      .filter(Boolean);
  }
  setName(name: string) {
    this.name = name;
  }
  setFixtures(fixtures: string[]) {
    this.fixtureIds = fixtures;
  }
}


text:
package org.sparklinedata.druid

import org.apache.spark.rdd.RDD
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference, ExprId}
import org.apache.spark.sql.sources.{BaseRelation, TableScan}
import org.apache.spark.sql.types.{DataType, StructField, StructType}
import org.apache.spark.sql.{Row, SQLContext}
import org.joda.time.Interval
import org.sparklinedata.druid.metadata.DruidRelationInfo

case class DruidOperatorAttribute(exprId : ExprId, name : String, dataType : DataType,
                                  tf: String = null)

/**
 *
 * @param q
 * @param intervalSplits
 * @param outputAttrSpec attributes to be output from the RawDataSourceScanExec. Each output attribute is
 *                       based on an Attribute in the originalPlan. The association is based
 *                       on the ExprId.
 */
case class DruidQuery(q : QuerySpec,
                      useSmile : Boolean,
                      queryHistoricalServer : Boolean,
                      numSegmentsPerQuery : Int,
                      intervalSplits : List[Interval],
                       outputAttrSpec :Option[List[DruidOperatorAttribute]]
                       ) {

  def this(q : QuerySpec,
           useSmile : Boolean = true,
           queryHistoricalServer : Boolean = false,
           numSegmentsPerQuery : Int = -1) =
    this(q, useSmile, queryHistoricalServer, numSegmentsPerQuery,
      q.intervalList.map(Interval.parse(_)), None)

  private def schemaFromQuerySpec(dInfo : DruidRelationInfo) : StructType = {
    q.schemaFromQuerySpec(dInfo)
  }

  private def schemaFromOutputSpec : StructType = {
    val fields : List[StructField] = outputAttrSpec.get.map {
      case DruidOperatorAttribute(eId, nm, dT, tf) => new StructField(nm, dT)
    }
    StructType(fields)
  }

  def schema(dInfo : DruidRelationInfo) : StructType =
    outputAttrSpec.map(o => schemaFromOutputSpec).getOrElse(schemaFromQuerySpec(dInfo))

  private def outputAttrsFromQuerySpec(dInfo : DruidRelationInfo) : Seq[Attribute] = {
    schemaFromQuerySpec(dInfo).fields.map { f =>
      AttributeReference(f.name, f.dataType)()
    }
  }

  private def outputAttrsFromOutputSpec : Seq[Attribute] = {
    outputAttrSpec.get.map {
      case DruidOperatorAttribute(eId, nm, dT, tf) => AttributeReference(nm, dT)(eId)
    }
  }

  def outputAttrs(dInfo : DruidRelationInfo) : Seq[Attribute] =
    outputAttrSpec.map(o => outputAttrsFromOutputSpec).getOrElse(outputAttrsFromQuerySpec(dInfo))

  def getValTFMap(): Map[String, String] = {
    val m = new scala.collection.mutable.HashMap[String, String]
    for ( lstOA <- outputAttrSpec; oa <- lstOA if oa.tf != null) {
      m += oa.name -> oa.tf
    }
    m.toMap
  }
}

case class DruidRelation (val info : DruidRelationInfo,
                                       val dQuery : Option[DruidQuery])(
  @transient val sqlContext: SQLContext)
  extends BaseRelation with TableScan {
  /*
   pass in
   - connection info to druid (host,port, dataSource, params)
   - sourceDF
   - a mapping from srcDF columns to Druid dims + metrics
   - optionally a  Druid Query
   */

  override val needConversion: Boolean = false

  override def schema: StructType =
    dQuery.map(_.schema(info)).getOrElse(info.sourceDF(sqlContext).schema)

  def buildInternalScan : RDD[InternalRow] =
    dQuery.map(new DruidRDD(sqlContext, info, _)).getOrElse(
      info.sourceDF(sqlContext).queryExecution.toRdd
    )

  override def buildScan(): RDD[Row] =
    buildInternalScan.asInstanceOf[RDD[Row]]

  override def toString : String = {
    if (dQuery.isDefined) {
      s"DruidQuery(${System.identityHashCode(dQuery)}): ${Utils.queryToString(dQuery.get)}"
    } else {
      info.toString
    }
  }
}


text:
// <copyright file="Endpoint.cs" company="Rambalac">
// Copyright (c) Rambalac. All rights reserved.
// </copyright>

using System;

// ReSharper disable InconsistentNaming
#pragma warning disable SA1600 // Elements must be documented
#pragma warning disable SA1300 // Element must begin with upper-case letter
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
namespace Azi.Amazon.CloudDrive.JsonObjects
{
    public class Endpoint
    {
        public DateTime lastCalculated { get; } = DateTime.UtcNow;

        public bool customerExists { get; set; }

        public string contentUrl { get; set; }

        public string metadataUrl { get; set; }
    }
}
#pragma warning restore SA1600 // Elements must be documented
#pragma warning restore SA1300 // Element must begin with upper-case letter
#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member


text:
namespace SharpDX.DirectSound
{
    /// <summary>
    /// The <see cref="SharpDX.DirectSound"/> namespace provides a managed DirectSound API.
    /// </summary>
    /// <msdn-id>ee416960</msdn-id>
    /// <unmanaged>DirectSound</unmanaged>
    /// <unmanaged-short>DirectSound</unmanaged-short>
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    class NamespaceDoc
    {
    }
}


text:
namespace System.Activities
{
    using System;
    using System.Activities.Expressions;
    using System.Activities.Runtime;
    using System.Activities.XamlIntegration;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.Linq.Expressions;
    using System.Runtime;
    using System.Windows.Markup;
    using System.Diagnostics.CodeAnalysis;

    public abstract class OutArgument : Argument
    {
        internal OutArgument()
        {
            this.Direction = ArgumentDirection.Out;
        }

        [SuppressMessage(FxCop.Category.Design, FxCop.Rule.ConsiderPassingBaseTypesAsParameters,
            Justification = "Subclass needed to enforce rules about which directions can be referenced.")]
        public static OutArgument CreateReference(OutArgument argumentToReference, string referencedArgumentName)
        {
            if (argumentToReference == null)
            {
                throw FxTrace.Exception.ArgumentNull("argumentToReference");
            }

            if (string.IsNullOrEmpty(referencedArgumentName))
            {
                throw FxTrace.Exception.ArgumentNullOrEmpty("referencedArgumentName");
            }

            return (OutArgument)ActivityUtilities.CreateReferenceArgument(argumentToReference.ArgumentType, ArgumentDirection.Out, referencedArgumentName);
        }

        [SuppressMessage(FxCop.Category.Design, FxCop.Rule.ConsiderPassingBaseTypesAsParameters,
            Justification = "Subclass needed to enforce rules about which directions can be referenced.")]
        public static OutArgument CreateReference(InOutArgument argumentToReference, string referencedArgumentName)
        {
            if (argumentToReference == null)
            {
                throw FxTrace.Exception.ArgumentNull("argumentToReference");
            }

            if (string.IsNullOrEmpty(referencedArgumentName))
            {
                throw FxTrace.Exception.ArgumentNullOrEmpty("referencedArgumentName");
            }

            // Note that we explicitly pass Out since we want an OutArgument created
            return (OutArgument)ActivityUtilities.CreateReferenceArgument(argumentToReference.ArgumentType, ArgumentDirection.Out, referencedArgumentName);
        }
    }

    [ContentProperty("Expression")]
    [TypeConverter(typeof(OutArgumentConverter))]
    [ValueSerializer(typeof(ArgumentValueSerializer))]
    public sealed class OutArgument<T> : OutArgument
    {
        public OutArgument(Variable variable)
            : this()
        {
            if (variable != null)
            {
                this.Expression = new VariableReference<T> { Variable = variable };
            }
        }

        public OutArgument(DelegateArgument delegateArgument)
            : this()
        {
            if (delegateArgument != null)
            {
                this.Expression = new DelegateArgumentReference<T> { DelegateArgument = delegateArgument };
            }
        }

        public OutArgument(Expression<Func<ActivityContext, T>> expression)
            : this()
        {
            if (expression != null)
            {
                this.Expression = new LambdaReference<T>(expression);
            }
        }

        public OutArgument(Activity<Location<T>> expression)
            : this()
        {
            this.Expression = expression;
        }

        public OutArgument()
            : base()
        {
            this.ArgumentType = typeof(T);
        }

        [DefaultValue(null)]
        public new Activity<Location<T>> Expression
        {
            get;
            set;
        }

        internal override ActivityWithResult ExpressionCore
        {
            get
            {
                return this.Expression;
            }
            set
            {
                if (value == null)
                {
                    this.Expression = null;
                    return;
                }

                if (value is Activity<Location<T>>)
                {
                    this.Expression = (Activity<Location<T>>)value;
                }
                else
                {
                    // We do not verify compatibility here. We will do that
                    // during CacheMetadata in Argument.Validate.
                    this.Expression = new ActivityWithResultWrapper<Location<T>>(value);
                }
            }
        }

        public static implicit operator OutArgument<T>(Variable variable)
        {
            return FromVariable(variable);
        }

        public static implicit operator OutArgument<T>(DelegateArgument delegateArgument)
        {
            return FromDelegateArgument(delegateArgument);
        }

        public static implicit operator OutArgument<T>(Activity<Location<T>> expression)
        {
            return FromExpression(expression);
        }

        public static OutArgument<T> FromVariable(Variable variable)
        {
            if (variable == null)
            {
                throw FxTrace.Exception.ArgumentNull("variable");
            }
            return new OutArgument<T>(variable);
        }

        public static OutArgument<T> FromDelegateArgument(DelegateArgument delegateArgument)
        {
            if (delegateArgument == null)
            {
                throw FxTrace.Exception.ArgumentNull("delegateArgument");
            }
            return new OutArgument<T>(delegateArgument);
        }

        public static OutArgument<T> FromExpression(Activity<Location<T>> expression)
        {
            if (expression == null)
            {
                throw FxTrace.Exception.ArgumentNull("expression");
            }

            return new OutArgument<T>(expression);
        }

        // Soft-Link: This method is referenced through reflection by
        // ExpressionUtilities.TryRewriteLambdaExpression.  Update that
        // file if the signature changes.
        public new Location<T> GetLocation(ActivityContext context)
        {
            if (context == null)
            {
                throw FxTrace.Exception.ArgumentNull("context");
            }

            ThrowIfNotInTree();

            return context.GetLocation<T>(this.RuntimeArgument);
        }

        // Soft-Link: This method is referenced through reflection by
        // ExpressionUtilities.TryRewriteLambdaExpression.  Update that
        // file if the signature changes.
        public new T Get(ActivityContext context)
        {
            return Get<T>(context);
        }

        public void Set(ActivityContext context, T value)
        {
            if (context == null)
            {
                throw FxTrace.Exception.ArgumentNull("context");
            }

            ThrowIfNotInTree();

            context.SetValue(this, value);
        }

        internal override Location CreateDefaultLocation()
        {
            return Argument.CreateLocation<T>();
        }

        internal override void Declare(LocationEnvironment targetEnvironment, ActivityInstance activityInstance)
        {
            targetEnvironment.DeclareTemporaryLocation<Location<T>>(this.RuntimeArgument, activityInstance, true);
        }

        internal override bool TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor)
        {
            Fx.Assert(this.Expression != null, "This should only be called for non-empty bindings.");

            if (this.Expression.UseOldFastPath)
            {
                Location<T> argumentValue = executor.ExecuteInResolutionContext<Location<T>>(targetActivityInstance, this.Expression);
                targetEnvironment.Declare(this.RuntimeArgument, argumentValue.CreateReference(true), targetActivityInstance);
                return true;
            }
            else
            {
                targetEnvironment.DeclareTemporaryLocation<Location<T>>(this.RuntimeArgument, targetActivityInstance, true);
                return false;
            }
        }
    }
}


text:
#include <system_error>

#include "read_private.h"
#include "file_mapper.h"

namespace safs
{

buffered_io::buffered_io(const logical_file_partition &partition_, thread *t,
		const safs_header &header, int flags): io_interface(t, header), partition(
			partition_), fds(partition.get_num_files())
{
	this->flags = flags;

	for (int i = 0; i < partition.get_num_files(); i++) {
		int ret;
		fds[i] = open(partition.get_file_name(i).c_str(), flags);
		if (fds[i] < 0) {
			char err_msg[128];
			snprintf(err_msg, sizeof(err_msg),
					"open %s", partition.get_file_name(i).c_str());
			perror(err_msg);
			throw std::system_error(std::make_error_code((std::errc) errno),
					"open");
		}
		ret = posix_fadvise(fds[i], 0, 0, POSIX_FADV_RANDOM);
		if (ret < 0)
			perror("posix_fadvise");
	}
}

io_status buffered_io::access(char *buf, off_t offset, ssize_t size, int access_method) {
	ASSERT_EQ(get_thread(), thread::get_curr_thread());
	int fd;
	if (fds.size() == 1)
		fd = fds[0];
	else {
		struct block_identifier bid;
		partition.map(offset / PAGE_SIZE, bid);
		fd = fds[bid.idx];
		offset = bid.off * PAGE_SIZE;
	}
	ssize_t ret;
	// TODO I need to make sure all data is read or written to the file.
	if (access_method == WRITE)
		ret = pwrite(fd, buf, size, offset);
	else
		ret = pread(fd, buf, size, offset);
	io_status status;
	if (ret < 0)
		status = IO_FAIL;
	else
		status = IO_OK;
	status.set_priv_data(ret);
	return status;
}

}


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

     Copyright 2014-2016 CyberVision, Inc.

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.

-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/endpoint_delete"
        android:id="@+id/textView" />
</LinearLayout>


text:
package net.sweet.test.dao;

import java.util.List;

import net.sweet.test.submit.reader.FinancialICBasicMthReaderTestCase;

import org.springframework.jdbc.core.JdbcTemplate;

import com.gtm.cpims.dao.BsFinancialICBasicMthDAO;
import com.gtm.cpims.model.BsFinancialicbasicmth;

public class DaoTestCase extends FinancialICBasicMthReaderTestCase {
	private BsFinancialICBasicMthDAO bsFinancialICBasicMthDao;

	private JdbcTemplate jdbcTemplate;

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

	public void test_query() {
		List list = bsFinancialICBasicMthDao.getAll();
		int count = bsFinancialICBasicMthDao.getAll().size();

		if (count > 0) {
			BsFinancialicbasicmth data = (BsFinancialicbasicmth) list.get(0);
		}
		// Logger.debug("bsareadao query test:" + count);
	}

	public void test_save() {
		BsFinancialicbasicmth data = new BsFinancialicbasicmth();
		data.setBankno("A");
		data.setBankname("A");
		data.setDuring("A");
		System.out.println(data.getD10());
		bsFinancialICBasicMthDao.save(data);

	}

	public void setBsFinancialICBasicMthDao(
			BsFinancialICBasicMthDAO bsFinancialICBasicMthDao) {
		this.bsFinancialICBasicMthDao = bsFinancialICBasicMthDao;
	}
}


text:
$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))

require 'rubygems'
require 'bbc/programmes'

Spira.add_repository(:default, RDF::Repository)

programmes = BBC::Programmes.search('The Wire').each do |programme|
  puts "#{programme.pid}: #{programme.title}"
end


text:
Title: Cake Visual Studio Code Extension Release 1.0.0
Published: 1/12/2020
Tags:
- cake
- visual studio code
- extension
- release
---

The 1.0.0 release of the Cake Extension for Visual Studio Code has been a little while in the making, but I am excited to finally get it released.  There have been some amazing contributions to it from the community, so huge thanks for all the help!

## Release Notes

### Features

- [__#99__](https://github.com/cake-build/cake-vscode/issues/99) Add DocumentSymbolProvider for Cake Scripts to enable breadcrumb and outline functionality
- [__#81__](https://github.com/cake-build/cake-vscode/issues/81) Add descriptions and enum values to vscode cake settings on package.json
- [__#32__](https://github.com/cake-build/cake-vscode/issues/32) Add ProblemMatcher to new TaskProvider

### Bugs

- [__#354__](https://github.com/cake-build/cake-vscode/issues/354) "debug task" codelens doesn't work
- [__#308__](https://github.com/cake-build/cake-vscode/issues/308) Cannot read property 'Tools' of undefined while trying to debug
- [__#105__](https://github.com/cake-build/cake-vscode/issues/105) Clicking "run task" should also save the file if needed
- [__#93__](https://github.com/cake-build/cake-vscode/issues/93) Adding a tool/addin from the commandlet reformats the cake file

### Improvements

- [__#461__](https://github.com/cake-build/cake-vscode/issues/461) cake.taskRunner.launchCommand still defaults to using a bootstrapper
- [__#460__](https://github.com/cake-build/cake-vscode/issues/460) When installing .Net Global Tool check if newer version exists and prompt for installation
- [__#456__](https://github.com/cake-build/cake-vscode/pull/472) Bump adm-zip from 0.5.0 to 0.5.1
- [__#454__](https://github.com/cake-build/cake-vscode/pull/454) Bump typescript from 4.0.5 to 4.1.2
- [__#438__](https://github.com/cake-build/cake-vscode/issues/438) "Run Task" shows potentially confusing options, when multiple cake files are present
- [__#432__](https://github.com/cake-build/cake-vscode/issues/432) Ability to download bootstrappers for all supported runners
- [__#429__](https://github.com/cake-build/cake-vscode/issues/429) 'Add [tool|addin] from nuget' should save the Cake script if it's already open.
- [__#420__](https://github.com/cake-build/cake-vscode/pull/420) Bump xml2js from 0.4.19 to 0.4.23
- [__#409__](https://github.com/cake-build/cake-vscode/issues/409) Does not support Bootstrapping for .NET Core Tool out of box
- [__#376__](https://github.com/cake-build/cake-vscode/issues/376) Debug should use Cake.Tool instead of Cake.CoreCLR
- [__#339__](https://github.com/cake-build/cake-vscode/pull/339) Bump request from 2.88.0 to 2.88.2
- [__#143__](https://github.com/cake-build/cake-vscode/issues/143) Allow for files other then build.ps1/build.sh

### Security

- [__#401__](https://github.com/cake-build/cake-vscode/pull/401) Bump node-fetch from 2.6.0 to 2.6.1
- [__#392__](https://github.com/cake-build/cake-vscode/pull/392) [Security] Bump lodash from 4.17.15 to 4.17.20
- [__#285__](https://github.com/cake-build/cake-vscode/pull/285) [Security] Bump https-proxy-agent from 2.2.1 to 2.2.3

## Release Video

Here is a short video highlighting what is included in this release:

<iframe width="560" height="315" src="https://www.youtube.com/embed/7Ba-pAHzO9w" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


text: Workflow to rapidly search TCGA data for microbial presence.


text:
/**
 * @file
 * @brief		Filesystem interface.
 */

#ifndef __IO_FS_H
#define __IO_FS_H

#include <io/file.h>

#include <kernel/fs.h>

#include <lib/atomic.h>
#include <lib/avl_tree.h>
#include <lib/radix_tree.h>
#include <lib/refcount.h>

#include <sync/mutex.h>

#include <object.h>

struct fs_mount;
struct fs_node;
struct fs_dentry;
struct vm_cache;

/** Structure containing a filesystem mount option. */
typedef struct fs_mount_option {
	const char *name;		/**< Argument name. */
	const char *value;		/**< Argument value (can be NULL). */
} fs_mount_option_t;

/** Filesystem type description structure. */
typedef struct fs_type {
	list_t header;			/**< Link to types list. */

	const char *name;		/**< Short name of the filesystem type. */
	const char *description;	/**< Long name of the type. */
	refcount_t count;		/**< Number of mounts using this type. */

	/**
	 * Check whether a device contains this FS type.
	 *
	 * Checks whether a device contains this FS type. If this method is
	 * not provided, then it is assumed that the FS does not use a backing
	 * device, and one will not be passed to the mount() method.
	 *
	 * @param device	Handle to device to check.
	 * @param uuid		If not NULL, the function should only return
	 *			true if the filesystem also has this UUID.
	 *
	 * @return		Whether the device contains this FS type.
	 */
	bool (*probe)(object_handle_t *device, const char *uuid);

	/**
	 * Mount an instance of this FS type.
	 *
	 * Mount an instance of this FS type. It is guaranteed that the device
	 * will contain the correct FS type when this is called, as the probe()
	 * operation is called prior to this. This function should fill in the
	 * root directory entry structure pointed to by the mount structure
	 * with the ID of the root node and any flags it wishes to set on the
	 * entry.
	 *
	 * @param mount		Mount structure for the mount.
	 * @param opts		Array of options passed to the mount call.
	 * @param count		Number of options in the array.
	 *
	 * @return		Status code describing result of the operation.
	 */
	status_t (*mount)(struct fs_mount *mount, fs_mount_option_t *opts,
		size_t count);
} fs_type_t;

extern status_t fs_type_register(fs_type_t *type);
extern status_t fs_type_unregister(fs_type_t *type);

/** Mount operations structure. */
typedef struct fs_mount_ops {
	/**
	 * Unmount a filesystem.
	 *
	 * Unmounts an instance of this filesystem type. All nodes will be been
	 * freed. This function should free up any data allocated in the mount()
	 * method. The flush() operation is not called before this function as
	 * unmounting will likely need to change filesystem metadata and flush
	 * again, so calling flush() beforehand would be wasteful.
	 *
	 * @param mount		Filesystem being unmounted.
	 */
	void (*unmount)(struct fs_mount *mount);

	/** Flush changes to filesystem metadata.
	 * @param mount		Mount to flush.
	 * @return		Status code describing result of the operation. */
	status_t (*flush)(struct fs_mount *mount);

	/** Read a node from the filesystem.
	 * @param mount		Mount to obtain node from.
	 * @param node		Node structure to fill in with node details.
	 *			Contains ID of the node to read.
	 * @return		Status code describing result of the operation. */
	status_t (*read_node)(struct fs_mount *mount, struct fs_node *node);
} fs_mount_ops_t;

/** Structure containing details of a mounted filesystem. */
typedef struct fs_mount {
	mutex_t lock;			/**< Lock to protect structure. */

	unsigned flags;			/**< Flags for the mount. */
	fs_mount_ops_t *ops;		/**< Mount operations. */
	void *private;			/**< Filesystem type private data. */
	object_handle_t *device;	/**< Handle to device that the filesystem resides on. */

	avl_tree_t nodes;		/**< Tree mapping node IDs to node structures. */
	struct fs_dentry *root;		/**< Root directory entry. */
	struct fs_dentry *mountpoint;	/**< Directory that this mount is mounted on. */
	list_t used_entries;		/**< List of all used entries. */
	list_t unused_entries;		/**< List of all unused entries. */

	mount_id_t id;			/**< Mount ID. */
	fs_type_t *type;		/**< Filesystem type. */
	list_t header;			/**< Link to mounts list. */
} fs_mount_t;

extern fs_mount_t *root_mount;

/** Node operations structure. */
typedef struct fs_node_ops {
	/**
	 * Free a node.
	 *
	 * This function is called when the node is being freed and should free
	 * any data allocated for it by the filesystem type. If the node's link
	 * count has reached 0, this function should remove it from the
	 * filesystem. Note that you should not check the FS_NODE_REMOVED flag
	 * to see if the node should be removed, instead check the filesystem's
	 * own link count, as this flag can be used internally by the FS layer
	 * when the node has not actually been removed from the FS.
	 *
	 * @param node		Node to free.
	 */
	void (*free)(struct fs_node *node);

	/** Flush changes to node metadata.
	 * @param node		Node to flush.
	 * @return		Status code describing result of the operation. */
	status_t (*flush)(struct fs_node *node);

	/**
	 * Create a new node.
	 *
	 * Creates a new node as a child of an existing directory. The supplied
	 * entry structure contains the name of the entry to create, and the
	 * supplied node structure contains the attributes for the new node
	 * (type, security attributes, etc). This function should fill in the
	 * remainder of both of these structures as though lookup() and
	 * read_node() had been called on each of them.
	 *
	 * @param parent	Directory to create in.
	 * @param entry		Entry structure for the new entry.
	 * @param node		Node structure.
	 * @param target	For symbolic links, the target of the link.
	 *
	 * @return		Status code describing result of the operation.
	 */
	status_t (*create)(struct fs_node *parent, struct fs_dentry *entry,
		struct fs_node *node, const char *target);

	/**
	 * Create a hard link.
	 *
	 * Creates a hard link in a directory to an existing node. This function
	 * should fill in any flags it wishes on the directory entry, as with
	 * create(). Note that it may be possible that an unlink takes place
	 * at the same time as a link on the same node, so when incrementing
	 * the node link count this function should check whether it was 0
	 * and clear the FS_NODE_REMOVED flag if it was.
	 *
	 * @param parent	Directory to create link in.
	 * @param entry		Entry structure for the new entry.
	 * @param node		Existing node to link to.
	 *
	 * @return		Status code describing result of the operation.
	 */
	status_t (*link)(struct fs_node *parent, struct fs_dentry *entry,
		struct fs_node *node);

	/**
	 * Remove an entry from a directory.
	 *
	 * Removes an entry from a directory. If the link count of the node
	 * that the entry refers to reaches 0, the filesystem should set the
	 * FS_NODE_REMOVE flag on the node, but not remove it from the
	 * filesystem as it may still be in use. This will cause the node to be
	 * freed as soon as it has no users, and it should then be removed by
	 * the free() method.
	 *
	 * If the node being removed is a directory, this function should ensure
	 * that it is empty aside from . and .. entries, and return
	 * STATUS_NOT_EMPTY if it isn't.
	 *
	 * @param parent	Directory containing the entry to remove.
	 * @param entry		Entry in the directory being removed.
	 * @param node		Node that the entry refers to.
	 *
	 * @return		Status code describing result of the operation.
	 */
	status_t (*unlink)(struct fs_node *parent, struct fs_dentry *entry,
		struct fs_node *node);

	/** Get information about a node.
	 * @param node		Node to get information on.
	 * @param info		Information structure to fill in. */
	void (*info)(struct fs_node *node, file_info_t *info);

	/** Modify the size of a file.
	 * @param node		Node being resized.
	 * @param size		New size of the node.
	 * @return		Status code describing result of the operation. */
	status_t (*resize)(struct fs_node *node, offset_t size);

	/** Look up a directory entry.
	 * @param node		Node to look up in.
	 * @param entry		Entry structure containing entry name to look
	 *			up, node ID should be set by this function.
	 * @return		Status code describing result of the operation. */
	status_t (*lookup)(struct fs_node *node, struct fs_dentry *entry);

	/** Read the target of a symbolic link.
	 * @param node		Node to read from.
	 * @param targetp	Where to store pointer to string (must be
	 *			allocated using a kmalloc()-based function)
	 *			containing link target.
	 * @return		Status code describing result of the operation. */
	status_t (*read_symlink)(struct fs_node *node, char **targetp);

	/**
	 * File handle operations.
	 */

	/** Open a handle to a node.
	 * @param handle	New handle structure.
	 * @return		Status code describing result of the operation. */
	status_t (*open)(file_handle_t *handle);

	/** Close a handle to a node.
	 * @param handle	File handle structure. */
	void (*close)(file_handle_t *handle);

	/** Perform I/O on a file.
	 * @param handle	File handle structure.
	 * @param request	I/O request.
	 * @return		Status code describing result of the operation. */
	status_t (*io)(file_handle_t *handle, struct io_request *request);

	/** Get the data cache for a file.
	 * @param handle	Handle that the cache is needed for.
	 * @return		Pointer to node's VM cache. If this function is
	 *			provided, it is assumed that this function will
	 *			always succeed, otherwise it is assumed that
	 *			the file cannot be memory-mapped. */
	struct vm_cache *(*get_cache)(file_handle_t *handle);

	/** Read the next directory entry.
	 * @note		It is up to the filesystem implementation to
	 *			store the current offset into the directory.
	 *			It can make use of the offset field in the
	 *			handle to do so. This field is set to 0 when
	 *			the handle is opened and when rewind_dir() is
	 *			called on it, otherwise it is not modified.
	 * @param handle	File handle structure.
	 * @param entryp	Where to store pointer to directory entry
	 *			structure (must be allocated using a
	 *			kmalloc()-based function).
	 * @return		Status code describing result of the operation. */
	status_t (*read_dir)(file_handle_t *handle, dir_entry_t **entryp);
} fs_node_ops_t;

/** Structure containing details of a filesystem node. */
typedef struct fs_node {
	file_t file;			/**< File object header. */

	refcount_t count;		/**< Number of references to the node. */
	node_id_t id;			/**< ID of the node. */
	atomic_t flags;			/**< Flags for the node. */

	fs_node_ops_t *ops;		/**< Node operations. */
	void *private;			/**< Filesystem type private data. */
	fs_mount_t *mount;		/**< Mount that the node resides on. */

	avl_tree_node_t tree_link;	/**< Link to node tree. */
	list_t unused_link;		/**< Link to global unused node list. */
} fs_node_t;

/** Flags for a filesystem node. */
#define FS_NODE_KEEP		(1<<0)	/**< Do not remove the node. */
#define FS_NODE_REMOVED		(1<<1)	/**< Node should be freed as soon as no longer needed. */

/** Atomically set a flag on a filesystem node.
 * @param node		Node to set flag on.
 * @param flag		Flag to set. */
static inline void fs_node_set_flag(fs_node_t *node, uint32_t flag) {
	atomic_or(&node->flags, flag);
}

/** Atomically clear a flag on a filesystem node.
 * @param node		Node to clear flag on.
 * @param flag		Flag to clear. */
static inline void fs_node_clear_flag(fs_node_t *node, uint32_t flag) {
	atomic_and(&node->flags, ~flag);
}

/** Check if a node is read only.
 * @param node		Node to check.
 * @return		Whether the node is read only. */
static inline bool fs_node_is_read_only(fs_node_t *node) {
	return (node->mount && node->mount->flags & FS_MOUNT_READ_ONLY);
}

/** Structure containing a directory entry. */
typedef struct fs_dentry {
	mutex_t lock;			/**< Lock to protect the entry. */

	/**
	 * Reference count.
	 *
	 * The directory entry reference count holds the actual number of users
	 * of the entry. It does not count references by child entries. An
	 * entry is placed on the unused list and made freeable once it has no
	 * references and no children.
	 */
	refcount_t count;

	unsigned flags;			/**< Flags for the entry. */
	char *name;			/**< Name of the entry. */
	node_id_t id;			/**< Node ID that the entry refers to. */
	fs_mount_t *mount;		/**< Mount that the entry resides on. */

	/**
	 * Node that the entry refers to.
	 *
	 * When an entry is in use (its reference count is non-zero), its node
	 * pointer is valid. The node pointer is invalid when the reference
	 * count is 0, i.e. no open handles refer to entry and it is not in
	 * use by any in-progress lookup.
	 */
	fs_node_t *node;

	struct fs_dentry *parent;	/**< Parent entry. */
	radix_tree_t entries;		/**< Tree of name to entry mappings. */
	fs_mount_t *mounted;		/**< Filesystem mounted on this entry. */
	list_t mount_link;		/**< Link to mount unused entry list. */
	list_t unused_link;		/**< Link to global unused entry list. */
} fs_dentry_t;

/** Flags for a directory entry. */
#define FS_DENTRY_KEEP		(1<<0)	/**< Do not remove the entry. */

extern void fs_dentry_retain(fs_dentry_t *entry);
extern void fs_dentry_release(fs_dentry_t *entry);

/**
 * Kernel interface.
 */

extern status_t fs_open(const char *path, uint32_t rights, uint32_t flags,
	unsigned create, object_handle_t **handlep);

extern status_t fs_create_dir(const char *path);
extern status_t fs_create_fifo(const char *path);
extern status_t fs_create_symlink(const char *path, const char *target);

extern status_t fs_read_symlink(const char *path, char **targetp);

extern status_t fs_mount(const char *device, const char *path, const char *type,
	uint32_t flags, const char *opts);
extern status_t fs_unmount(const char *path, unsigned flags);

extern status_t fs_path(object_handle_t *handle, char **pathp);
extern status_t fs_info(const char *path, bool follow, file_info_t *info);
extern status_t fs_link(const char *path, const char *source);
extern status_t fs_unlink(const char *path);
extern status_t fs_rename(const char *source, const char *dest);
extern status_t fs_sync(void);

/**
 * Initialization/shutdown functions.
 */

extern void fs_init(void);
extern void fs_shutdown(void);

#endif /* __IO_FS_H */


text:
A wrapper around Marketo's REST API.

## Usage

### Installation

```
npm install --save node-marketo-rest
```

### Creating a connection

You will first need to obtain your OAuth information from Marketo, they have a [guide out](http://developers.marketo.com/documentation/rest/authentication/) to get you started. In short, you will need to get the endpoint url, identity url, client id and client secret.

```js
var Marketo = require('node-marketo-rest');

var marketo = new Marketo({
  endpoint: 'https://123-ABC-456.mktorest.com/rest',
  identity: 'https://123-ABC-456.mktorest.com/identity',
  clientId: 'client id',
  clientSecret: 'client secret'
});

marketo.lead.find('id', [2, 3])
  .then(function(data, resp) {
    // data is:
    // {
    //   requestId: '17787#149c01d54b8',
    //   result: [{
    //     id: 2,
    //     updatedAt: '2014-11-13 15:25:36',
    //     createdAt: '2014-11-13 15:25:36',
    //     ...
    //   }, {
    //     id: 3,
    //     updatedAt: '2014-11-13 16:22:03',
    //     createdAt: '2014-11-13 16:22:03',
    //     ...
    //   }],
    //   success: true
    // }
  });
```

### Pagination

When a specific call results in a lot of elements, you will have to paginate to get all of the data. For example, getting all the leads in a large list will likely exceed the maximum batch size of 300. When this happens, you can check for the existence of the `nextPageToken` and use it in the next call:

```js
marketo.list.getLeads(1)
  .then(function(data) {
    if (data.nextPageToken) {
      // preserve the nextPageToken for use in the next call
    }
  });
```

If you want a less manual process, the result comes with a convenient `nextPage` function that you can use. This function only exists if there's additional data:

```js
marketo.list.getLeads(1)
  .then(function(page1) {
    // do something with page1

    if (page1.nextPageToken) {
      return page1.nextPage();
    }
  })
  .then(function(page2) {
    // do something with page2
  });
```

### Stream

Instead of getting data back inside of the promise, you can also turn the response into a stream by using the `Marketo.streamify` function. This will emit the results one element at a time. If the result is paginated, it will lazily load all of the pages until it's done:

```js
// Wraping the resulting promise
var resultStream = Marketo.streamify(marketo.list.getLeads(1))

resultStream
  .on('data', function(lead) {
    // do something with lead
  })
  .on('error', function(err) {
    // log the list error. Note, the stream closes if it encounters an error
  })
  .on('end', function() {
    // end of the stream
  });
```

Since the data is lazily loaded, you can stop the stream and will not incur additional API calls:

```js
var count = 0;

resultStream
  .on('data', function(data) {
    if (++count > 20) {
      // Closing stream, this CAN be called multiple times because the
      // buffer of the queue may already contain additional data
      resultStream.endMarketoStream();
    }
  })
  .on('end', function() {
    // count here CAN be more than 20
    console.log('done, count is', count);
  });
```

# Test

### Generating a replay for a test

The initial run of the test has to be run against an actual API, the run (when
in recording mode) should capture the API request/response data, which will then
be used for future calls. What makes this a little tricky is Marketo API
endpoints are unique per account, so we have to convert the captured data to
something else for future purposes. We also need to remove credentials from
these captures as well. Anyway, here's the annoying process of generating data:

##### Running against the actual API

The test looks at 4 environment variables when running, they are:

- `MARKETO_ENDPOINT`
- `MARKETO_IDENTITY`
- `MARKETO_CLIENT_ID`
- `MARKETO_CLIENT_SECRET`

After setting these variables, run `npm run testRecord`.

##### Stripping sensitive information

Run the script `./scripts/strip-fixtures.sh`, which will convert the unique
Marketo host over to `123-abc-456.mktorest.com` in addition to removing the
capture that contains sensitive client id/secret file.

##### Copy the data

The data should now be moved over to `fixtures/123-abc-456.mktorest.com-443`,
preferably with a useful name so it's easier to keep track of in the future.

##### Tip

We are using mocha to run the test, you can run a single test so that you
generate only the needed data. To do so, you append `only` to a test:

```js
    // on a single unit test
    it.only('test description', function() {})

    // or an entire describe
    describe.only('test description', function() {})
```

One more thing to note is that once we've processed the raw data, `node-replay`
will not be able to map it back to the original raw request. This means that if
you run `npm run testRecord`, you will be generating requests against Marketo's
API directly. I highly recommend using `only`.


text:
package vg.civcraft.mc.cbanman.ban;

import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.bukkit.command.CommandSender;

import vg.civcraft.mc.cbanman.CBanManagement;
import vg.civcraft.mc.cbanman.utils.UUIDFetcher;

public class AsyncUnban implements Runnable {
	private final CBanManagement plugin;
	private final List<String> names;
	private final CommandSender sender;

	public AsyncUnban(CBanManagement plugin, List<String> names){
		this.plugin = plugin;
		this.names = names;
		this.sender = null;
	}
	public AsyncUnban(CBanManagement plugin, List<String> names, CommandSender sender){
		this.plugin = plugin;
		this.names = names;
		this.sender = sender;
	}

	@Override
	public void run() {
		Map<String, UUID> responce = null;
		UUIDFetcher fetcher = new UUIDFetcher(names);
		try{
			responce = fetcher.call();
		} catch (Exception e){
			responce = null;
		}
		if (responce == null){
			if (sender !=null)
				sender.sendMessage("Failed to async unban");
			return;
		}
		SyncUnban suban = new SyncUnban(plugin, responce, sender);
		plugin.getServer().getScheduler().runTask(plugin, suban);
	}

}


text:
<?php

namespace Doctrine\DBAL;

use function sprintf;

/**
 * Doctrine\DBAL\ConnectionException
 *
 * @psalm-immutable
 */
class SQLParserUtilsException extends DBALException
{
    /**
     * @param string $paramName
     *
     * @return SQLParserUtilsException
     */
    public static function missingParam($paramName)
    {
        return new self(
            sprintf('Value for :%1$s not found in params array. Params array key should be "%1$s"', $paramName)
        );
    }

    /**
     * @param string $typeName
     *
     * @return SQLParserUtilsException
     */
    public static function missingType($typeName)
    {
        return new self(
            sprintf('Value for :%1$s not found in types array. Types array key should be "%1$s"', $typeName)
        );
    }
}


text:
<?php

namespace LasseRafn\Economic\FilterOperators;

class NotInOperator implements FilterOperatorInterface
{
	public $queryString = '$nin:';
}


text:
<?php

namespace Users\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

use Zend\Authentication\AuthenticationService;
use Zend\Authentication\Adapter\DbTable as DbTableAuthAdapter;

use Users\Form\RegisterForm;
use Users\Form\RegisterFilter;

use Users\Model\User;
use Users\Model\UserTable;

use Zend\Mail;

class GroupChatController extends AbstractActionController
{
	protected $storage;
	protected $authservice;

	protected function getAuthService()
	{
		if (! $this->authservice) {
			$this->authservice = $this->getServiceLocator()->get('AuthService');
		}

		return $this->authservice;
	}

	protected function getLoggedInUser()
	{
		$userTable = $this->getServiceLocator()->get('UserTable');
		$userEmail = $this->getAuthService()->getStorage()->read();
		$user = $userTable->getUserByEmail($userEmail);

		return $user;
	}

	protected function sendMessage($messageTest, $fromUserId)
	{
		$chatMessageTG = $this->getServiceLocator()->get('ChatMessagesTableGateway');
		$data = array(
			'user_id' => $fromUserId,
			'message'  => $messageTest,
			'stamp' => NULL
		);
		$chatMessageTG->insert($data);

		return true;
	}

	public function indexAction()
	{
		$user = $this->getLoggedInUser();
		$request = $this->getRequest();
		if ($request->isPost()) {
			$messageTest = $request->getPost()->get('message');
			$fromUserId = $user->id;
			$this->sendMessage($messageTest, $fromUserId);
			// to prevent duplicate entries on refresh
			return $this->redirect()->toRoute('users/group-chat');
		}

		//Prepare Send Message Form
		$form    = new \Zend\Form\Form();

		$form->add(array(
			'name' => 'message',
			'attributes' => array(
				'type'  => 'text',
				'id' => 'messageText',
				'required' => 'required'
			),
			'options' => array(
				'label' => 'Message',
			),
		));

		$form->add(array(
            'name' => 'submit',
            'attributes' => array(
                'type'  => 'submit',
                'value' => 'Send'
            ),
		));

		$form->add(array(
			'name' => 'refresh',
			'attributes' => array(
				'type'  => 'button',
				'id' => 'btnRefresh',
				'value' => 'Refresh'
			),
		));

		$viewModel  = new ViewModel(array('form' => $form, 'userName' => $user->name));
		return $viewModel;
	}

	public function messageListAction()
	{
		$userTable = $this->getServiceLocator()->get('UserTable');

		$chatMessageTG = $this->getServiceLocator()->get('ChatMessagesTableGateway');
		$chatMessages = $chatMessageTG->select();

		$messageList = array();
		foreach($chatMessages as $chatMessage) {
			$fromUser = $userTable->getUser($chatMessage->user_id);
			$messageData = array();
			$messageData['user'] = $fromUser->name;
			$messageData['time'] = $chatMessage->stamp;
			$messageData['data'] = $chatMessage->message;
			$messageList[] = $messageData;
		}

		$viewModel  = new ViewModel(array('messageList' => $messageList));
		$viewModel->setTemplate('users/group-chat/message-list');
		$viewModel->setTerminal(true);
		return $viewModel;
	}

	public function sendOfflineMessageAction()
	{
		$userTable = $this->getServiceLocator()->get('UserTable');
		$allUsers = $userTable->fetchAll();
		$usersList = array();
		foreach($allUsers as $user) {
			$usersList[$user->id] = $user->name . '(' . $user->email . ')';
		}

		$user = $this->getLoggedInUser();
		$request = $this->getRequest();
		if ($request->isPost()) {
			$msgSubj = $request->getPost()->get('messageSubject');
			$msgText = $request->getPost()->get('message');
			$toUser = $request->getPost()->get('toUserId');
			$fromUser = $user->id;
			$this->sendOfflineMessage($msgSubj, $msgText, $fromUser, $toUser);
			// to prevent duplicate entries on refresh
			return $this->redirect()->toRoute('users/group-chat',
									array('action' => 'sendOfflineMessage'));
		}

		//Prepare Send Message Form
		$form    = new \Zend\Form\Form();
        $form->setAttribute('method', 'post');
        $form->setAttribute('enctype','multipart/form-data');

		$form->add(array(
			'name' => 'toUserId',
			'type'  => 'Zend\Form\Element\Select',
			'attributes' => array(
				'type'  => 'select',
			),
			'options' => array(
				'label' => 'To User',
			),
		));

		$form->add(array(
			'name' => 'messageSubject',
			'attributes' => array(
				'type'  => 'text',
				'id' => 'messageSubject',
				'required' => 'required'
			),
			'options' => array(
				'label' => 'Subject',
			),
		));

		$form->add(array(
			'name' => 'message',
			'attributes' => array(
				'type'  => 'textarea',
				'id' => 'message',
				'required' => 'required'
			),
			'options' => array(
				'label' => 'Message',
			),
		));

		$form->add(array(
			'name' => 'submit',
			'attributes' => array(
				'type'  => 'submit',
				'value' => 'Send'
			),
			'options' => array(
				'label' => 'Send',
			),
		));

		$form->get('toUserId')->setValueOptions($usersList);
		$viewModel  = new ViewModel(array('form' => $form,
									'userName' => $user->name));
		return $viewModel;
	}

	protected function sendOfflineMessage($msgSubj, $msgText, $fromUserId, $toUserId)
	{
		$userTable = $this->getServiceLocator()->get('UserTable');
		$fromUser = $userTable->getUser($fromUserId);
		$toUser = $userTable->getUser($toUserId);

		$mail = new Mail\Message();
		$mail->setFrom($fromUser->email, $fromUser->name);
		$mail->addTo($toUser->email, $toUser->name);
		$mail->setSubject($msgSubj);
		$mail->setBody($msgText);

		$transport = new Mail\Transport\Sendmail();
		$transport->send($mail);

		return true;
	}

}


text:
package com.suscipio_solutions.consecro_mud.Races;
import java.util.List;
import java.util.Vector;

import com.suscipio_solutions.consecro_mud.Areas.interfaces.Area;
import com.suscipio_solutions.consecro_mud.Items.interfaces.RawMaterial;
import com.suscipio_solutions.consecro_mud.MOBS.interfaces.MOB;
import com.suscipio_solutions.consecro_mud.core.CMath;

public class Unique extends StdRace
{
	@Override public String ID(){	return "Unique"; }
	@Override public String name(){ return "Unique"; }
	@Override public int shortestMale(){return 64;}
	@Override public int shortestFemale(){return 60;}
	@Override public int heightVariance(){return 12;}
	@Override public int lightestWeight(){return 100;}
	@Override public int weightVariance(){return 100;}
	@Override public long forbiddenWornBits(){return 0;}
	@Override public String racialCategory(){return "Unique";}
	@Override public boolean fertile(){return false;}

	//  							  an ey ea he ne ar ha to le fo no gi mo wa ta wi
	private static final int[] parts={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
	@Override public int[] bodyMask(){return parts;}

	private final int[] agingChart={0,0,0,0,0,YEARS_AGE_LIVES_FOREVER,YEARS_AGE_LIVES_FOREVER,YEARS_AGE_LIVES_FOREVER,YEARS_AGE_LIVES_FOREVER};
	@Override public int[] getAgingChart(){return agingChart;}

	protected static Vector<RawMaterial> resources=new Vector<RawMaterial>();
	@Override public int availabilityCode(){return Area.THEME_FANTASY|Area.THEME_SKILLONLYMASK;}

	@Override
	public String healthText(MOB viewer, MOB mob)
	{
		final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));

		if(pct<.10)
			return "^r" + mob.name(viewer) + "^r is pulsating in an unstable rage!^N";
		else
		if(pct<.20)
			return "^r" + mob.name(viewer) + "^r is massively and amazingly angry.^N";
		else
		if(pct<.30)
			return "^r" + mob.name(viewer) + "^r is very angry.^N";
		else
		if(pct<.40)
			return "^y" + mob.name(viewer) + "^y is somewhat angry.^N";
		else
		if(pct<.50)
			return "^y" + mob.name(viewer) + "^y is very irritated.^N";
		else
		if(pct<.60)
			return "^p" + mob.name(viewer) + "^p is starting to show irritation.^N";
		else
		if(pct<.70)
			return "^p" + mob.name(viewer) + "^p is definitely serious and concerned.^N";
		else
		if(pct<.80)
			return "^g" + mob.name(viewer) + "^g is growing serious and concerned.^N";
		else
		if(pct<.90)
			return "^g" + mob.name(viewer) + "^g is definitely unamused and is starting to notice.^N";
		else
		if(pct<.99)
			return "^g" + mob.name(viewer) + "^g is no longer amused, though still unconcerned.^N";
		else
			return "^c" + mob.name(viewer) + "^c is in perfect condition.^N";
	}
	@Override
	public List<RawMaterial> myResources()
	{
		synchronized(resources)
		{
			if(resources.size()==0)
			{
				resources.addElement(makeResource
				("a "+name().toLowerCase()+" internal organ",RawMaterial.RESOURCE_MEAT));
			}
		}
		return resources;
	}
}


text:
from subprocess import Popen, PIPE
import shlex
import re
import os
from gpm.utils.console import puts
from gpm.utils.log import Log
from gpm.const.status import Status
from gpm.utils.string import decode as str_decode

class LocalOperation(object):
    _RE_CD = re.compile(r"cd\s([\w\d_\/\s\~\.]+)")

    @classmethod
    def mkdir(cls, paths, *args, **kwargs):
        if not isinstance(paths, list):
            paths = [paths]

        for path in paths:
            if LocalOperation.exist(path):
                paths.remove(path)

        return cls.__exec("mkdir -p %s" % " ".join(paths), *args, **kwargs)

    @classmethod
    def rm(cls, paths, *args, **kwargs):
        if not isinstance(paths, list):
            paths = [paths]

        if paths:
            return cls.__exec("rm -rf %s" % " ".join(paths), *args, **kwargs)
        else:
            return True

    @classmethod
    def ls(cls, path, long = False, hidden = False):
        cmd = "ls %s" % path
        if long:
            cmd = "%s %s" % (cmd, "-l")
        if hidden:
            cmd = "%s %s" % (cmd, "-a")
        ret = cls.__exec(cmd, ret = True)

        if not isinstance(ret, list):
            return []
        return cls.string_clean(ret)

    @classmethod
    def cp(cls, origin, target):
        if not isinstance(origin, list):
            origin = [origin]
        ret = cls.__exec("cp -rf %s %s" % (" ".join(origin), target), ret = True)
        return not ret is False

    @classmethod
    def chmod(cls, mod, path, *args, **kwargs):
        path = LocalOperation.rel2abs(path)
        return cls.__exec("chmod %d %s" % (mod, path), *args, **kwargs)

    @classmethod
    def run(cls, cmd, path = None, *args, **kwargs):
        if path:
            path = cls.rel2abs(path)
        return cls.__exec(cmd, cwd = path, *args, **kwargs)

    @classmethod
    def cat(cls, paths):
        if not isinstance(paths, list):
            paths = [paths]

        ret = cls.__exec("cat %s" % " ".join(paths), ret = True)
        if ret:
            return "\n".join(ret)
        else:
            return None

    @classmethod
    def pwd(cls):
        ret = cls.__exec("pwd", ret = True)
        path = cls.string_clean(ret[0])
        return cls.rel2abs(path)

    @classmethod
    def read(cls, path, *args, **kwargs):
        path = cls.string_clean(path)
        with open(path, "r") as stream:
            lines = [str_decode(line) for line in stream.readlines()]

        return "\n".join(lines)

    @classmethod
    def find(cls, path, name = None, depth = 1, *args, **kwargs):
        if not name:
            target_path = os.path.dirname(path)
        else:
            target_path = path
        target_name = name or os.path.basename(path)
        ret = cls.__exec("find %s -maxdepth %d -name *%s*" % (target_path, depth, target_name), *args, **kwargs)

        if not isinstance(ret, list):
            return []
        return cls.string_clean(ret)

    @classmethod
    def distr(cls):
        paths = cls.find("/etc/*-release")
        ret = cls.cat(paths)
        re_distri = re.compile(r'PRETTY_NAME=\"(.*?)\"')
        return re_distri.findall(ret)[0]

    @classmethod
    def append(cls, path, contents, *args, **kwargs):
        path = LocalOperation.rel2abs(path)
        content = contents.join("\n")
        return cls.__exec("sed -i '$a %s' %s" % (content, path), *args, **kwargs)

    @classmethod
    def exist(cls, path):
        path = LocalOperation.rel2abs(path)
        return os.path.exists(path)

    @classmethod
    def rel2abs(cls, path = None):
        if path:
            if cls.get_user() == "root":
                path = path.replace("~", "/root")
            else:
                path = path.replace("~", "/home/%s" % cls.get_user())
        return os.path.abspath(path or os.curdir)

    @classmethod
    def add_file(cls, path, content = ""):
        with open(path, "w+") as stream:
            stream.write(content)

    @property
    def user(self):
        return self.get_user()

    @staticmethod
    def get_user():
        return os.getenv("USER")

    @classmethod
    def __exec(cls, cmd, cwd = None, *args, **kwargs):
        if "&&" in cmd:
            cmds = cmd.split("&&")
            ret = False
            path = None
            for cmd in cmds:
                if not path:
                    path = cls.__cd_to_path(cwd)
                    if path: continue
                ret = cls.__exec(cmd, cwd=path or cwd, *args, **kwargs)
                if not ret:
                    return ret
            return ret

        cmd_args = shlex.split(cmd)
        Log.debug(cmd)
        p = Popen(cmd_args, cwd = cwd, stderr=PIPE, stdout=PIPE, shell=False)
        return LocalOperation.__parser(p, *args, **kwargs)

    @classmethod
    def string_clean(cls, strings):
        if isinstance(strings, list):
            ret = []
            for string in strings:
                ret.append(cls.string_clean(string))
            return ret
        else:
            if cls.__is_str(strings):
                strings = strings.replace("\n", "")
                strings = strings.replace("\t", "")
            return strings

    @classmethod
    def __cd_to_path(cls, cmd):
        ret = cls._RE_CD.findall(cmd)
        if ret:
            return cls.rel2abs(ret[0])
        else:
            return None

    @staticmethod
    def __is_str(string):
        try:
            return isinstance(string, (unicode, str))
        except:
            return isinstance(string, str)

    @staticmethod
    def __parser(process, ret = True, output = False, *args, **kwargs):
        res = False
        process.wait()
        code = process.poll()

        if not isinstance(code, int):
            Log.fatal(Status["STAT_EXEC_ERROR"])

        out_strs = [str_decode(line) for line in process.stdout.readlines()]
        err_strs = [str_decode(line) for line in process.stderr.readlines()]

        if ret:
            if code != 0:
                res = False
            else:
                res = out_strs or True

        if output:
            if code != 0:
                puts("\n".join(err_strs))
                res = res or False
            else:
                puts("\n".join(out_strs))
                res = res or True

        return res


text:
<?php

namespace OrganizationsORM\om;

use \Criteria;
use \ModelCriteria;
use \ModelJoin;
use \PDO;
use \Propel;
use \PropelPDO;
use OrganizationsORM\OrganizationIdSeq;
use OrganizationsORM\OrganizationIdSeqPeer;
use OrganizationsORM\OrganizationIdSeqQuery;

/**
 * Base class that represents a query for the 'organization_id_seq' table.
 *
 *
 *
 * @method     OrganizationIdSeqQuery orderById($order = Criteria::ASC) Order by the id column
 *
 * @method     OrganizationIdSeqQuery groupById() Group by the id column
 *
 * @method     OrganizationIdSeqQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
 * @method     OrganizationIdSeqQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
 * @method     OrganizationIdSeqQuery innerJoin($relation) Adds a INNER JOIN clause to the query
 *
 * @method     OrganizationIdSeq findOne(PropelPDO $con = null) Return the first OrganizationIdSeq matching the query
 * @method     OrganizationIdSeq findOneOrCreate(PropelPDO $con = null) Return the first OrganizationIdSeq matching the query, or a new OrganizationIdSeq object populated from the query conditions when no match is found
 *
 * @method     OrganizationIdSeq findOneById(int $id) Return the first OrganizationIdSeq filtered by the id column
 *
 * @method     array findById(int $id) Return OrganizationIdSeq objects filtered by the id column
 *
 * @package    propel.generator.organizations.om
 */
abstract class BaseOrganizationIdSeqQuery extends ModelCriteria
{

	/**
	 * Initializes internal state of BaseOrganizationIdSeqQuery object.
	 *
	 * @param     string $dbName The dabase name
	 * @param     string $modelName The phpName of a model, e.g. 'Book'
	 * @param     string $modelAlias The alias for the model in this query, e.g. 'b'
	 */
	public function __construct($dbName = 'organizations', $modelName = 'OrganizationsORM\\OrganizationIdSeq', $modelAlias = null)
	{
		parent::__construct($dbName, $modelName, $modelAlias);
	}

	/**
	 * Returns a new OrganizationIdSeqQuery object.
	 *
	 * @param     string $modelAlias The alias of a model in the query
	 * @param     Criteria $criteria Optional Criteria to build the query from
	 *
	 * @return    OrganizationIdSeqQuery
	 */
	public static function create($modelAlias = null, $criteria = null)
	{
		if ($criteria instanceof OrganizationIdSeqQuery) {
			return $criteria;
		}
		$query = new OrganizationIdSeqQuery();
		if (null !== $modelAlias) {
			$query->setModelAlias($modelAlias);
		}
		if ($criteria instanceof Criteria) {
			$query->mergeWith($criteria);
		}
		return $query;
	}

	/**
	 * Find object by primary key.
	 * Propel uses the instance pool to skip the database if the object exists.
	 * Go fast if the query is untouched.
	 *
	 *
	 * $obj  = $c->findPk(12, $con);
	 *
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    OrganizationIdSeq|array|mixed the result, formatted by the current formatter
	 */
	public function findPk($key, $con = null)
	{
		if ($key === null) {
			return null;
		}
		if ((null !== ($obj = OrganizationIdSeqPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
			// the object is alredy in the instance pool
			return $obj;
		}
		if ($con === null) {
			$con = Propel::getConnection(OrganizationIdSeqPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}
		$this->basePreSelect($con);
		if ($this->formatter || $this->modelAlias || $this->with || $this->select
		 || $this->selectColumns || $this->asColumns || $this->selectModifiers
		 || $this->map || $this->having || $this->joins) {
			return $this->findPkComplex($key, $con);
		} else {
			return $this->findPkSimple($key, $con);
		}
	}

	/**
	 * Find object by primary key using raw SQL to go fast.
	 * Bypass doSelect() and the object formatter by using generated code.
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con A connection object
	 *
	 * @return    OrganizationIdSeq A model object, or null if the key is not found
	 */
	protected function findPkSimple($key, $con)
	{
		$sql = 'SELECT `ID` FROM `organization_id_seq` WHERE `ID` = :p0';
		try {
			$stmt = $con->prepare($sql);
			$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
			$stmt->execute();
		} catch (Exception $e) {
			Propel::log($e->getMessage(), Propel::LOG_ERR);
			throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
		}
		$obj = null;
		if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$obj = new OrganizationIdSeq();
			$obj->hydrate($row);
			OrganizationIdSeqPeer::addInstanceToPool($obj, (string) $key);
		}
		$stmt->closeCursor();

		return $obj;
	}

	/**
	 * Find object by primary key.
	 *
	 * @param     mixed $key Primary key to use for the query
	 * @param     PropelPDO $con A connection object
	 *
	 * @return    OrganizationIdSeq|array|mixed the result, formatted by the current formatter
	 */
	protected function findPkComplex($key, $con)
	{
		// As the query uses a PK condition, no limit(1) is necessary.
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		$stmt = $criteria
			->filterByPrimaryKey($key)
			->doSelect($con);
		return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
	}

	/**
	 * Find objects by primary key
	 *
	 * $objs = $c->findPks(array(12, 56, 832), $con);
	 *
	 * @param     array $keys Primary keys to use for the query
	 * @param     PropelPDO $con an optional connection object
	 *
	 * @return    PropelObjectCollection|array|mixed the list of results, formatted by the current formatter
	 */
	public function findPks($keys, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
		}
		$this->basePreSelect($con);
		$criteria = $this->isKeepQuery() ? clone $this : $this;
		$stmt = $criteria
			->filterByPrimaryKeys($keys)
			->doSelect($con);
		return $criteria->getFormatter()->init($criteria)->format($stmt);
	}

	/**
	 * Filter the query by primary key
	 *
	 * @param     mixed $key Primary key to use for the query
	 *
	 * @return    OrganizationIdSeqQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKey($key)
	{
		return $this->addUsingAlias(OrganizationIdSeqPeer::ID, $key, Criteria::EQUAL);
	}

	/**
	 * Filter the query by a list of primary keys
	 *
	 * @param     array $keys The list of primary key to use for the query
	 *
	 * @return    OrganizationIdSeqQuery The current query, for fluid interface
	 */
	public function filterByPrimaryKeys($keys)
	{
		return $this->addUsingAlias(OrganizationIdSeqPeer::ID, $keys, Criteria::IN);
	}

	/**
	 * Filter the query on the id column
	 *
	 * Example usage:
	 *
	 * $query->filterById(1234); // WHERE id = 1234
	 * $query->filterById(array(12, 34)); // WHERE id IN (12, 34)
	 * $query->filterById(array('min' => 12)); // WHERE id > 12
	 *
	 *
	 * @param     mixed $id The value to use as filter.
	 *              Use scalar values for equality.
	 *              Use array values for in_array() equivalent.
	 *              Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    OrganizationIdSeqQuery The current query, for fluid interface
	 */
	public function filterById($id = null, $comparison = null)
	{
		if (is_array($id) && null === $comparison) {
			$comparison = Criteria::IN;
		}
		return $this->addUsingAlias(OrganizationIdSeqPeer::ID, $id, $comparison);
	}

	/**
	 * Exclude object from result
	 *
	 * @param     OrganizationIdSeq $organizationIdSeq Object to remove from the list of results
	 *
	 * @return    OrganizationIdSeqQuery The current query, for fluid interface
	 */
	public function prune($organizationIdSeq = null)
	{
		if ($organizationIdSeq) {
			$this->addUsingAlias(OrganizationIdSeqPeer::ID, $organizationIdSeq->getId(), Criteria::NOT_EQUAL);
		}

		return $this;
	}

} // BaseOrganizationIdSeqQuery


text:
package com.github.susovan87.hybridappautomator.screen;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.support.PageFactory;

import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.pagefactory.AppiumFieldDecorator;

public abstract class NativeScreen extends AbstractScreen {
  public NativeScreen(AppiumDriver<MobileElement> driver) {
    super(driver);

    driver.context("NATIVE_APP");

    PageFactory.initElements(new AppiumFieldDecorator(driver, 15, TimeUnit.SECONDS), this);
  }

  @Override
  public abstract boolean isDisplayed();
}


text: a block


text:
package de.kaufhof.pillar

import java.util.Date

import com.datastax.driver.core.Session

object CassandraMigrator {
  val appliedMigrationsTableNameDefault = "applied_migrations"
}

class CassandraMigrator(registry: Registry, appliedMigrationsTableName: String) extends Migrator {
  override def migrate(session: Session, dateRestriction: Option[Date] = None) {
    val appliedMigrations = AppliedMigrations(session, registry, appliedMigrationsTableName)
    selectMigrationsToReverse(dateRestriction, appliedMigrations).foreach(_.executeDownStatement(session, appliedMigrationsTableName))
    selectMigrationsToApply(dateRestriction, appliedMigrations).foreach(_.executeUpStatement(session, appliedMigrationsTableName))
  }

  override def initialize(session: Session, keyspace: String,
                          replicationStrategy: ReplicationStrategy = SimpleStrategy()) {
    createKeyspace(session, keyspace, replicationStrategy)
    createMigrationsTable(session, keyspace)
  }

  override def createKeyspace(session: Session, keyspace: String, replicationStrategy: ReplicationStrategy = SimpleStrategy()) = {
    session.execute(s"CREATE KEYSPACE IF NOT EXISTS $keyspace WITH replication = ${replicationStrategy.cql}")
  }

  override def createMigrationsTable(session: Session, keyspace: String) = {
    session.execute(
      """
        | CREATE TABLE IF NOT EXISTS %s.%s (
        |   authored_at timestamp,
        |   description text,
        |   applied_at timestamp,
        |   PRIMARY KEY (authored_at, description)
        |  )
      """.stripMargin.format(keyspace, appliedMigrationsTableName)
    )
  }

  override def destroy(session: Session, keyspace: String) {
    session.execute("DROP KEYSPACE %s".format(keyspace))
  }

  private def selectMigrationsToApply(dateRestriction: Option[Date], appliedMigrations: AppliedMigrations): Seq[Migration] = {
    (dateRestriction match {
      case None => registry.all
      case Some(cutOff) => registry.authoredBefore(cutOff)
    }).filter(!appliedMigrations.contains(_))
  }

  private def selectMigrationsToReverse(dateRestriction: Option[Date], appliedMigrations: AppliedMigrations): Seq[Migration] = {
    (dateRestriction match {
      case None => List.empty[Migration]
      case Some(cutOff) => appliedMigrations.authoredAfter(cutOff)
    }).sortBy(_.authoredAt).reverse
  }
}


text:
class ICollidable : public IDrawable
{
public:
bool virtual PacmanCanEat() = 0;
void virtual WasEaten() = 0;
void virtual AtePacman() {
}
virtual ~ICollidable() {
}
};
#endif


text:
package com.senseidb.test.bql.parsers;

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

import java.util.Iterator;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * A comparator for comparing json objects. This comparator takes care of
 * reordered elements in JSONArray. {@link #STRICT} mode means the two given
 * elements must match exactly, while in {@link #SIMPLE} mode extra elements in
 * the latter is ignored.
 *
 * Check unittests {@link JsonComparatorTest} for examples on this.
 *
 * @author Sachin Shenoy
 */
public class JsonComparator {

  public static final int STRICT = 1;
  public static final int SIMPLE = 2;
  private final int policy;

  public JsonComparator(int policy) {
    this.policy = policy;
  }

  /**
   * Compares two json objects.
   *
   * @param a first element to compare
   * @param b second element to compare
   * @return true if the elements are equal as per the policy.
   */
  public boolean isEquals(Object a, Object b) {
    if (a instanceof JSONObject) {
      if (b instanceof JSONObject) {
        return isEqualsJsonObject((JSONObject) a, (JSONObject) b);
      } else {
        return false;
      }
    }

    if (a instanceof JSONArray) {
      if (b instanceof JSONArray) {
        return isEqualsJsonArray((JSONArray) a, (JSONArray) b);
      } else {
        return false;
      }
    }

    if (a instanceof Long) {
      if (b instanceof Long) {
        return isEqualsLong((Long) a, (Long) b);
      } else if (b instanceof Integer) {
        return isEqualsLong((Long) a, new Long(((Integer) b).intValue()));
      } else {
        return false;
      }
    }

    if (a instanceof Integer) {
      if (b instanceof Integer) {
        return isEqualsInteger((Integer) a, (Integer) b);
      } else if (b instanceof Long) {
        return isEqualsInteger((Integer) a, new Integer((int) ((Long) b).longValue()));
      } else {
        return false;
      }
    }

    if (a instanceof String) {
      if (b instanceof String) {
        return isEqualsString((String) a, (String) b);
      } else {
        return false;
      }
    }

    if (a instanceof Boolean) {
      if (b instanceof Boolean) {
        return isEqualsBoolean((Boolean) a, (Boolean) b);
      } else {
        return false;
      }
    }

    if (a instanceof Float || a instanceof Double) {
      double val1 = (a instanceof Float) ? ((Float) a).doubleValue() : ((Double) a).doubleValue();
      if (b instanceof Float || b instanceof Double) {
        double val2 = (b instanceof Float) ? ((Float) b).doubleValue() : ((Double) b).doubleValue();
        return (Math.abs(val1 - val2) < 0.001);
      } else {
        return false;
      }
    }

    if (a == null && b == null) {
      return true;
    }

    if (a != null && b != null) {
      return a.equals(b);
    }

    return false;
  }

  private boolean isEqualsBoolean(Boolean a, Boolean b) {
    if (a == null ^ b == null) {
      return false;
    } else if (a == null && b == null) {
      return true;
    }
    return a.equals(b);
  }

  private boolean isEqualsString(String a, String b) {
    if (a == null ^ b == null) {
      return false;
    } else if (a == null && b == null) {
      return true;
    }
    return a.equals(b);
  }

  private boolean isEqualsLong(Long a, Long b) {
    if (a == null ^ b == null) {
      return false;
    } else if (a == null && b == null) {
      return true;
    }
    return a.equals(b);
  }

  private boolean isEqualsInteger(Integer a, Integer b) {
    if (a == null ^ b == null) {
      return false;
    } else if (a == null && b == null) {
      return true;
    }
    return a.equals(b);
  }

  private boolean isEqualsJsonArray(JSONArray a, JSONArray b) {
    if (policy == STRICT) {
      if (a.length() != b.length()) {
        return false;
      }
    }

    if (policy == SIMPLE) {
      if (a.length() > b.length()) {
        return false;
      }
    }

    boolean[] am = new boolean[a.length()];
    boolean[] bm = new boolean[b.length()];

    for (int i = 0; i < a.length(); ++i)
      if (am[i] == false) {
        for (int j = 0; j < b.length(); ++j)
          if (bm[j] == false) {
            try {
              if (isEquals(a.get(i), b.get(j))) {
                am[i] = true;
                bm[j] = true;
                break;
              }
            } catch (JSONException e) {
              e.printStackTrace();
            }
          }
      }

    for (int i = 0; i < am.length; ++i)
      if (!am[i]) {
        return false;
      }

    if (policy == STRICT) {
      for (int j = 0; j < bm.length; ++j)
        if (!bm[j]) {
          return false;
        }
    }

    return true;
  }

  @SuppressWarnings("rawtypes")
  private boolean isEqualsJsonObject(JSONObject a, JSONObject b) {
    if (policy == STRICT) {
      if (a.length() != b.length()) {
        return false;
      }
    }

    if (policy == SIMPLE) {
      if (a.length() > b.length()) {
        return false;
      }
    }

    Iterator keys = a.keys();
    while (keys.hasNext()) {
      String key = (String) keys.next();
      if (!b.has(key)) {
        return false;
      }
      try {
        if (!isEquals(a.get(key), b.get(key))) {
          return false;
        }
      } catch (JSONException e) {
        return false;
      }
    }

    return true;
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<repositories-view>
	<repository id=":pserver:anonymous@examples.myeclipseide.com:/home/cvs/public/myeclipse/examples" name="MyEclipse Examples">
	</repository>
</repositories-view>


text:
Scraping weather data from a website using the MEAN stack

No functionality added as of 20th Dec 2015 - Just generating the project.

This project was generated with the [Angular Full-Stack Generator](https://github.com/DaftMonk/generator-angular-fullstack) version 3.1.1.

## Getting Started

### Prerequisites

You will need a few installations to get up and running. I use [chocolatey](https://chocolatey.org/) and [NPM](https://www.npmjs.com/ ) where available:

- [Git](https://git-scm.com/) (`choco install git.install`)
- [Node.js and npm](nodejs.org) Node ^4.2.3, npm ^2.14.7 (`choco install nodejs.install`)
- [Bower](bower.io) (`npm install bower -g`)
- [Grunt](http://gruntjs.com/) (`npm install grunt-cli -g`)
- [MongoDB](https://www.mongodb.org/) - Keep a running daemon with `mongod`

MongoDB will also need to be added to the env PATH of your machine. For my machines I added the following directory to the PATH:

- C:\Program Files\MongoDB\Server\3.2\bin;

### Developing

1. Run `npm install` to install server dependencies.

2. Run `bower install` to install front-end dependencies.

3. Run `mongod` in a separate shell to keep an instance of the MongoDB Daemon running

4. Run `grunt serve` to start the development server. It should automatically and open the client in your browser when ready.

## Build & development

Run `grunt build` for building and `grunt serve` for preview.

## Testing

Running `npm test` will run the unit tests with karma.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>AppleNotificationDispatchable</title>
<meta name="date" content="2016-10-22">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.vangav.backend.push_notifications.apple.dispatch_message

Class AppleNotificationDispatchable

java.lang.Object

com.vangav.backend.dispatcher.DispatchMessage

com.vangav.backend.push_notifications.apple.dispatch_message.AppleNotificationDispatchable

public class AppleNotificationDispatchable
extends DispatchMessage

AppleNotificationDispatchable represents a dispatchable version of
   AppleNotification in the form of a JSON Object

Field Summary

Fields inherited from class com.vangav.backend.dispatcher.DispatchMessage

serialized_message, type

Constructor Summary

Constructors

Constructor and Description

AppleNotificationDispatchable()

AppleNotificationDispatchable(AppleNotification appleNotification)

Constructor AppleNotificationDispatchable
 initializes through serializing an AppleNotification

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

void
execute()

execute
 executes the dispatch message

Methods inherited from class com.vangav.backend.dispatcher.DispatchMessage

toString

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

AppleNotificationDispatchable

public AppleNotificationDispatchable()

AppleNotificationDispatchable

public AppleNotificationDispatchable(AppleNotification appleNotification)
                              throws java.lang.Exception

Constructor AppleNotificationDispatchable
 initializes through serializing an AppleNotification

Parameters:

appleNotification -

Throws:

java.lang.Exception

Method Detail

execute

public void execute()
             throws java.lang.Exception

Description copied from class: DispatchMessage

execute
 executes the dispatch message

Specified by:

execute in class DispatchMessage

Throws:

java.lang.Exception

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
[![JitPackGradle](https://img.shields.io/github/tag/odemolliens/eobot-android-sdk.svg?label=gradle)](https://jitpack.io/#odemolliens/eobot-android-sdk/)
[![JitPackMaven](https://img.shields.io/github/tag/odemolliens/eobot-android-sdk.svg?label=maven)](https://jitpack.io/#odemolliens/eobot-android-sdk/)
[![Travis](https://travis-ci.org/odemolliens/eobot-android-sdk.svg)](https://travis-ci.org/odemolliens/eobot-android-sdk)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/odemolliens/eobot-android-sdk/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Gradle Setup
==========
```gradle

repositories {
    maven {
        url "https://jitpack.io"
    }
}

```
Compile in the build.gradle file. for X.X.X please refer to the change log.
```gradle
dependencies{
    compile 'com.github.odemolliens:eobot-android-sdk:x.x.x'
}
  ```

Maven Setup
==========

  Add Repository
```xml
<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>

```
  Add Dependency:
```xml
	<dependency>
	    <groupId>com.github.odemolliens</groupId>
	    <artifactId>eobot-android-sdk</artifactId>
	    <version>x.x.x</version>
	</dependency>

  ```

ChangeLog
===

** 1.0.8 **

- Added X11 mining

** 1.0.7 **

- Some bugs fix

** 1.0.6 **

- Error management + some bugs fix

** 1.0.5 **

- Fix mininum deposit coins price

** 1.0.4 **

- Added getSupportedFiatCoins service

** 1.0.3 **

- Fixed a bug on getCoinPrice service

** 1.0.2 **

- Implement manual & automatic withdraw

** 1.0.1 **

- Implement cache request system

** 1.0.0 **

- All services from Eobot API are implemented
- All basics unit test are implemented

Donation
==========
[![Donation](https://blockchain.info/Resources/buttons/donate_64.png)](https://blockchain.info/address/1EobotDynsNEcx7X1TTkccq3RFqXoFPtP)

Copyright
==========

  	Copyright 2015 Olivier Demolliens

	Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

	file except in compliance with the License. You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software distributed under

	the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF

	ANY KIND, either express or implied. See the License for the specific language governing

	permissions and limitations under the License.