text:
namespace Dhgms.TplHelper.CodeGeneration.Model
{
    using Dhgms.Nucleotide.PropertyInfo;

    public class RecordProcessor : ProjectClassGenerationParamtersBase
    {
        public override string SubNamespace => "TaskResult";

        public override string ClassName => "RecordProcessor";

        public override PropertyInfoBase[] Properties => new PropertyInfoBase[]
                                                             {
                                                                 new Dhgms.Nucleotide.PropertyInfo.Integer64PropertyInfo(
                                                                     Dhgms.Nucleotide.Model.CollectionType.None,
                                                                     "RecordsProcessed",
                                                                     "The number of records processed",
                                                                     true,
                                                                     0,
                                                                     null,
                                                                     false,
                                                                     null),
                                                             };

        public override PropertyInfoBase[] BaseClassProperties => new TaskResultBase().Properties;

        public override string BaseClassName => new TaskResultBase().ClassName;

        public override string ClassRemarks => "Represents the result of a task the processes a batch of records";
    }
}


text:
import { ExtensionComposer } from "../../extension-composer";
import { ManifestBuilder } from "../../manifest";
import { VsixComponents } from "../../merger";
import { VsixManifestBuilder } from "../../vsix-manifest-builder";
import _ = require("lodash");

export class VSSIntegrationComposer extends ExtensionComposer {
	public validate(components: VsixComponents): Q.Promise<string[]> {
		return super.validate(components).then((result) => {
			let vsixData = components.builders.filter(b => b.getType() === VsixManifestBuilder.manifestType)[0].getData();

			// Ensure that an Action link or a Getstarted link exists.
			let properties = _.get(vsixData, "PackageManifest.Metadata[0].Properties[0].Property", []);
			let pIds = properties.map(p => _.get(p, "$.Id"));

			if (_.intersection(["Microsoft.VisualStudio.Services.Links.Action", "Microsoft.VisualStudio.Services.Links.Getstarted"], pIds).length === 0) {
				result.push("An 'integration' extension must provide a 'getstarted' link.");
			}
			return result;
		});
	}
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Symfony\Component\Validator\Exception;

class GroupDefinitionException extends ValidatorException
{
}


text:
'use strict';

angular.module('whateverApp')
  .controller('RegisterCtrl', ["$scope", "Data", "dataUrl", "$timeout", "$location", function ($scope, Data, url, $timeout, $location) {
      var uuid = "";
      if(window.device) {
          uuid = device.uuid || "";
      }
      $scope.register = function() {
          var param = {};
          var alertScope = angular.element("#alertMessage").scope();
          param.uuid = uuid;
          param.username = $scope.username;
          if(!param.username) {
              alertScope.openDialog("请输入昵称");
              return;
          }
          param.password = $scope.password;
          if(!param.password) {
              alertScope.openDialog("请输入密码");
              return;
          }
          if($scope.password !== $scope.confirmPassword) {
              alertScope.openDialog("密码不一致,请重新输入密码");
              $scope.password ="";
              $scope.confirmPassword = "";
              return;
          }
          //发送注销请求
          Data.get(url.register, param, function(data) {
              if ( data.status === 0 ) {
                  alertScope.openDialog( "注册成功", function() {
                      $location.path("/");
                  } );
              } else {
                  alertScope.openDialog(data.statusInfo);
              }
          });
      }
  }]);


text:
package ingredientes;

public interface Salada {

	public String getDescricao();

}


text:
npm install
bower install
cd bower_components
git clone git@github.com:disordinary/mobiledoc-kit.git --branch section-lifecycle --single-branch
cd mobiledoc-kit

npm install
bower install
npm run-script build


text:
<?php

class AdminController extends Zend_Controller_Action
{

    public function init()
    {
    }

    public function indexAction()
    {
    }

    public function settingsAction()
    {
        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);

        $this->view->environment = APPLICATION_ENV;
        $this->view->cacheSetting = $config->settings->cache->enabled;
        $this->view->logSetting = $config->settings->logs->enabled;
    }

}


text:
 * Infected Wars, an open source Garry's Mod game-mode.
 *
 * Infected Wars is the work of multiple authors,
 * a full list can be found in CONTRIBUTORS.md.
 * For more information, visit https://github.com/JarnoVgr/InfectedWars
 *
 * Infected Wars is free software: you can redistribute it and/or modify
 * it under the terms of the MIT License.
 *
 * A full copy of the MIT License can be found in LICENSE.txt.
 -----------------------------------------------------------------------------]]

include('shared.lua')

function ENT:Initialize()
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetNotSolid(true)
	self.Entity:DrawShadow( false )

	self.nextheal = 0

	timer.Simple(8,function(ent)
		if IsValid(ent) then
			ent:Remove()
		end
	end,self.Entity)
end

function ENT:Think()
	if self.nextheal < CurTime() then

		//local players = ents.FindInSphere(self.Entity:GetPos(), 150)
		local players = team.GetPlayers(TEAM_UNDEAD)
		for k, pl in pairs(players) do
			if pl:IsPlayer() and pl:Team() == TEAM_UNDEAD and pl:Alive() and self.Entity:GetPos():Distance(pl:GetPos()) <= 150 then
				local hpplus = 0
				if pl:HasBought("maliceabsorption2") then
					hpplus = 20
				elseif pl:HasBought("maliceabsorption1") then
					hpplus = 11
				end

				if hpplus > 0 then
					pl:SetHealth(math.min(pl:GetMaximumHealth(),pl:Health()+hpplus))

					local eff = EffectData()
						eff:SetOrigin(pl:GetPos())
					util.Effect( "demon_heal", eff )
				end
			end
		end
		self.nextheal = CurTime() + 2
	end
end

function ENT:OnRemove()
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">

  <title>CSS 2.1 Test Suite: margin-right</title>

  <link rel="help" href="http://www.w3.org/TR/CSS21/box.html#margin-properties" title="8.3 Margin properties: 'margin-top',  'margin-right',  'margin-bottom', 'margin-left', and 'margin'">

It should say "HI" below:

   xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx


text:
def js_fill_in(field, val = {})
  val = val[:with]
  page.execute_script "$('##{field}').val('#{val}')"
end

def keydown(field, how_many = 1)
  how_many.times do |i|
    page.execute_script "$('##{field}').keydown()"
  end
end

def page!
  save_and_open_page
end

def wait_for_jquery(how_many = 1)
  how_many.times do |i|
    start = Time.now
    while true
      break if page.evaluate_script('$.active') == 0
      if Time.now > start + 5.seconds
        fail "wait_for_jquery failed"
      end
      sleep 0.1
    end
  end
end


text:
package com.creditease.uav.hook.httpclients.async;

import java.util.Map;

import com.creditease.monitor.appfra.hook.spi.HookConstants;
import com.creditease.monitor.appfra.hook.spi.HookContext;
import com.creditease.monitor.appfra.hook.spi.HookProxy;
import com.creditease.monitor.interceptframework.spi.InterceptConstants;
import com.creditease.monitor.interceptframework.spi.InterceptContext;
import com.creditease.monitor.interceptframework.spi.InterceptContext.Event;
import com.creditease.uav.hook.httpclients.async.interceptors.ApacheAsyncHttpClientIT;
import com.creditease.uav.monitorframework.dproxy.DynamicProxyInstaller;
import com.creditease.uav.monitorframework.dproxy.DynamicProxyProcessor;
import com.creditease.uav.monitorframework.dproxy.bytecode.DPMethod;
import com.creditease.uav.util.MonitorServerUtil;

/**
 *
 * HttpClientHookProxy description: helps to install proxy class to http clients
 *
 */
public class HttpAsyncClientHookProxy extends HookProxy {

    private final DynamicProxyInstaller dpInstall;

    @SuppressWarnings("rawtypes")
    public HttpAsyncClientHookProxy(String id, Map config) {
        super(id, config);
        dpInstall = new DynamicProxyInstaller();

    }

    @Override
    public void start(HookContext context, ClassLoader webapploader) {

        Event evt = context.get(Event.class);

        switch (evt) {
            case SPRING_BEAN_REGIST:
            case WEBCONTAINER_INIT:
                InsertInterceptToClients(context, webapploader);
                break;
            // when servlet init
            case AFTER_SERVET_INIT:
                break;
            case BEFORE_SERVLET_DESTROY:
                break;
            case WEBCONTAINER_STARTED:
                break;
            case WEBCONTAINER_STOPPED:
                break;
            default:
                break;
        }
    }

    public void InsertInterceptToClients(HookContext context, ClassLoader webapploader) {

        if (isHookEventDone("InsertInterceptToClients")) {
            return;
        }

        InterceptContext ic = (InterceptContext) context.get(HookConstants.INTERCEPTCONTEXT);

        String contextPath = (String) ic.get(InterceptConstants.CONTEXTPATH);
        String basePath = (String) ic.get(InterceptConstants.BASEPATH);

        final String appid = MonitorServerUtil.getApplicationId(contextPath, basePath);

        doInstallDProxy(webapploader, appid);
    }

    public void doInstallDProxy(ClassLoader webapploader, final String appid) {

        /**
         * set the webapploader is the target classloader
         */
        dpInstall.setTargetClassLoader(webapploader);

        /**
         * install proxy to InternalHttpAsyncClient
         */
        dpInstall.installProxy("org.apache.http.impl.nio.client.InternalHttpAsyncClient",
                new String[] { "com.creditease.uav.hook.httpclients.async.interceptors" }, new DynamicProxyProcessor() {

                    @Override
                    public void process(DPMethod m) throws Exception {

                        if ("execute".equals(m.getName())) {
                            if (m.getParameterTypes().length == 4) {
                                dpInstall.defineLocalVal(m, "mObj", ApacheAsyncHttpClientIT.class);
                                m.insertBefore("{mObj=new ApacheAsyncHttpClientIT(\"" + appid + "\"); "
                                        + "$2=mObj.makeConsumer($2);$4=mObj.doAsyncStart(new Object[]{$1,$2,$3,$4});}");
                                m.insertAfter("{$_=mObj.doAsyncEnd(new Object[]{$_});}");
                            }
                        }
                    }
                }, false);

        /**
         * install proxy to MinimalHttpAsyncClient
         */
        dpInstall.installProxy("org.apache.http.impl.nio.client.MinimalHttpAsyncClient",
                new String[] { "com.creditease.uav.hook.httpclients.async.interceptors" }, new DynamicProxyProcessor() {

                    @Override
                    public void process(DPMethod m) throws Exception {

                        if ("execute".equals(m.getName())) {
                            dpInstall.defineLocalVal(m, "mObj", ApacheAsyncHttpClientIT.class);
                            if (m.getParameterTypes().length == 4) {
                                m.insertBefore("{mObj=new ApacheAsyncHttpClientIT(\"" + appid
                                        + "\"); $2=mObj.makeConsumer($2);$4=mObj.doAsyncStart(new Object[]{$1,$2,$3,$4});}");
                                m.insertAfter("{$_=mObj.doAsyncEnd(new Object[]{$_});}");
                            }
                            else if (m.getParameterTypes().length == 5) {
                                m.insertBefore("{mObj=new ApacheAsyncHttpClientIT(\"" + appid
                                        + "\"); $3=mObj.makeConsumers($3);$5=mObj.doAsyncStart(new Object[]{$1,$2,$3,$4,$5});}");
                                m.insertAfter("{$_=mObj.doAsyncEnd(new Object[]{$_});}");
                            }
                        }
                    }
                }, false);

        // release loader
        dpInstall.releaseTargetClassLoader();
    }

    @Override
    public void stop(HookContext context, ClassLoader webapploader) {

        Event evt = context.get(Event.class);

        switch (evt) {
            case AFTER_SERVET_INIT:
                break;
            case BEFORE_SERVLET_DESTROY:
                break;
            case WEBCONTAINER_STARTED:
                break;
            case WEBCONTAINER_STOPPED:
                break;
            default:
                break;

        }
    }

}


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

-->

<resources>
    <item name="key_width" type="fraction">12.5%p</item>
    <dimen name="key_height">48dip</dimen>
    <dimen name="key_vertical_gap">-12dip</dimen>
    <item name="row_horizontal_gap" type="fraction">6.25%p</item>
</resources>


text:
<?xml version="1.0"?>
<!--
  #%L
  govapps_search
  $Id:$
  %%
  Copyright (C) 2013 - 2014 Fraunhofer FOKUS, Kompetenzzentrum Oeffentliche IT
  %%
  Copyright (c) 2,013, Fraunhofer FOKUS, Kompetenzzentrum Oeffentliche IT
  All rights reserved.
  Redistribution and use in source and binary forms, with or without modification,
  are permitted provided that the following conditions are met:

  1) Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.

  2) Redistributions in binary form must reproduce the above copyright notice,
     this list of conditions and the following disclaimer in the documentation
     and/or other materials provided with the distribution.

  3) All advertising materials mentioning features or use of this software must
     display the following acknowledgement:
     This product includes software developed by Fraunhofer FOKUS, Kompetenzzentrum Oeffentliche IT.

  4) Neither the name of the organization nor the names of its contributors may
     be used to endorse or promote products derived from this software without
     specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY COPYRIGHT HOLDER ''AS IS'' AND ANY EXPRESS OR
  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  IN NO EVENT SHALL
  Fraunhofer FOKUS, Kompetenzzentrum Oeffentliche IT
  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  #L%
  -->

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
	<portlet>
		<portlet-name>vepa-suche</portlet-name>
		<display-name>Vepa Suche</display-name>
		<portlet-class>com.liferay.util.bridges.mvc.MVCPortlet</portlet-class>
		<init-param>
			<name>view-template</name>
			<value>/view.jsp</value>
		</init-param>
		<expiration-cache>0</expiration-cache>
		<supports>
			<mime-type>text/html</mime-type>
		</supports>
		<portlet-info>
			<title>Vepa Suche</title>
			<short-title>Vepa Suche</short-title>
			<keywords>Vepa Suche</keywords>
		</portlet-info>
		<security-role-ref>
			<role-name>administrator</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>guest</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>power-user</role-name>
		</security-role-ref>
		<security-role-ref>
			<role-name>user</role-name>
		</security-role-ref>
	</portlet>
</portlet-app>


text:
package org.javarosa.core.model;

import org.javarosa.core.model.condition.EvaluationContext;
import org.javarosa.core.model.instance.FormInstance;
import org.javarosa.core.model.instance.TreeReference;
import org.javarosa.debug.EvaluationResult;
import org.javarosa.debug.Event;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author Meletis Margaritis
 */
public abstract class LatestDagBase extends IDag {

   protected LatestDagBase(EventNotifierAccessor accessor) {
      super(accessor);
   }

   protected Set<QuickTriggerable> doEvaluateTriggerables(FormInstance mainInstance, EvaluationContext evalContext, Set<QuickTriggerable> tv, TreeReference anchorRef, Set<QuickTriggerable> alreadyEvaluated) {
      // tv should now contain all of the triggerable components which are
      // going
      // to need to be addressed
      // by this update.
      // 'triggerables' is topologically-ordered by dependencies, so evaluate
      // the triggerables in 'tv'
      // in the order they appear in 'triggerables'
      Set<QuickTriggerable> fired = new HashSet<QuickTriggerable>();

      Map<TreeReference, List<TreeReference>> firedAnchors = new LinkedHashMap<TreeReference, List<TreeReference>>();

      for (QuickTriggerable qt : triggerablesDAG) {
         if (tv.contains(qt) && !alreadyEvaluated.contains(qt)) {

            List<TreeReference> affectedTriggers = qt.t.findAffectedTriggers(firedAnchors);
            if (affectedTriggers.isEmpty()) {
               affectedTriggers.add(anchorRef);
            }

            List<EvaluationResult> evaluationResults = evaluateTriggerable(
                    mainInstance, evalContext, qt, affectedTriggers);

            if (evaluationResults.size() > 0) {
               fired.add(qt);

               for (EvaluationResult evaluationResult : evaluationResults) {
                  TreeReference affectedRef = evaluationResult.getAffectedRef();

                  TreeReference key = affectedRef.genericize();
                  List<TreeReference> values = firedAnchors.get(key);
                  if (values == null) {
                     values = new ArrayList<TreeReference>();
                     firedAnchors.put(key, values);
                  }
                  values.add(affectedRef);
               }
            }

            fired.add(qt);
         }
      }

      return fired;
   }

   /**
    * Step 3 in DAG cascade. evaluate the individual triggerable expressions
    * against the anchor (the value that changed which triggered recomputation)
    *
    * @param qt
    *            The triggerable to be updated
    * @param anchorRefs
    */
   private List<EvaluationResult> evaluateTriggerable(FormInstance mainInstance,
                                                      EvaluationContext evalContext, QuickTriggerable qt,
                                                      List<TreeReference> anchorRefs) {

      List<EvaluationResult> evaluationResults = new ArrayList<EvaluationResult>(0);

      // Contextualize the reference used by the triggerable against the
      // anchor
      Set<TreeReference> updatedContextRef = new HashSet<TreeReference>();

      for (TreeReference anchorRef : anchorRefs) {
         TreeReference contextRef = qt.t.contextualizeContextRef(anchorRef);
         if (updatedContextRef.contains(contextRef)) {
            continue;
         }

         try {

            // Now identify all of the fully qualified nodes which this
            // triggerable
            // updates. (Multiple nodes can be updated by the same trigger)
            List<TreeReference> qualifiedList = evalContext
                    .expandReference(contextRef);

            // Go through each one and evaluate the trigger expression
            for (TreeReference qualified : qualifiedList) {
               EvaluationContext ec = new EvaluationContext(evalContext,
                       qualified);
               evaluationResults.addAll(qt.t.apply(mainInstance, ec,
                       qualified));
            }

            boolean fired = evaluationResults.size() > 0;
            if (fired) {
               accessor.getEventNotifier().publishEvent(
                       new Event(qt.t.getClass().getSimpleName(),
                               evaluationResults));
            }

            updatedContextRef.add(contextRef);
         } catch (Exception e) {
            throw new RuntimeException("Error evaluating field '"
                    + contextRef.getNameLast() + "': " + e.getMessage(), e);
         }
      }

      return evaluationResults;
   }
}


text:
namespace blink {

namespace {

Element* ClosestInclusiveAncestorContainer(Element& element,
                                           Element* stay_within = nullptr) {
  for (auto* container = &element; container && container != stay_within;
       container = container->ParentOrShadowHostElement()) {
    if (container->GetContainerQueryEvaluator())
      return container;
  }
  return nullptr;
}

}  // namespace

StyleRecalcContext StyleRecalcContext::FromInclusiveAncestors(
    Element& element) {
  if (!RuntimeEnabledFeatures::CSSContainerQueriesEnabled())
    return StyleRecalcContext();

  return StyleRecalcContext{ClosestInclusiveAncestorContainer(element)};
}

StyleRecalcContext StyleRecalcContext::FromAncestors(Element& element) {
  if (!RuntimeEnabledFeatures::CSSContainerQueriesEnabled())
    return StyleRecalcContext();

  // TODO(crbug.com/1145970): Avoid this work if we're not inside a container
  if (Element* shadow_including_parent = element.ParentOrShadowHostElement())
    return FromInclusiveAncestors(*shadow_including_parent);
  return StyleRecalcContext();
}

StyleRecalcContext StyleRecalcContext::ForSlotChildren(
    const HTMLSlotElement& slot) const {
  // If the container is in a different tree scope, it is already in the shadow-
  // including inclusive ancestry of the host.
  if (!container || container->GetTreeScope() != slot.GetTreeScope())
    return *this;

  DCHECK(RuntimeEnabledFeatures::CSSContainerQueriesEnabled());

  // No assigned nodes means we will render the light tree children of the
  // slot as a fallback. Those children are in the same tree scope as the slot
  // which means the current container is the correct one.
  if (slot.AssignedNodes().IsEmpty())
    return *this;

  // The slot's flat tree children are children of the slot's shadow host, and
  // their container is in the shadow-including inclusive ancestors of the host.
  DCHECK(slot.IsInShadowTree());
  Element* host = slot.OwnerShadowHost();
  DCHECK(host);
  return StyleRecalcContext{FromInclusiveAncestors(*host)};
}

StyleRecalcContext StyleRecalcContext::ForSlottedRules(
    HTMLSlotElement& slot) const {
  if (!RuntimeEnabledFeatures::CSSContainerQueriesEnabled())
    return *this;

  // The current container is the shadow-including inclusive ancestors of the
  // host. When matching ::slotted rules, the closest container may be found in
  // the shadow-including inclusive ancestry of the slot. If we reach the host,
  // the current container is still the closest one.
  if (Element* shadow_container =
          ClosestInclusiveAncestorContainer(slot, slot.OwnerShadowHost())) {
    return StyleRecalcContext{shadow_container};
  }
  return *this;
}

StyleRecalcContext StyleRecalcContext::ForPartRules(Element& host) const {
  if (!container || !RuntimeEnabledFeatures::CSSContainerQueriesEnabled())
    return *this;

  // The closest container for matching ::part rules is the originating host.
  // There is no need to walk past the current container.
  if (Element* host_container =
          ClosestInclusiveAncestorContainer(host, container)) {
    return StyleRecalcContext{host_container};
  }
  return *this;
}

}  // namespace blink


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE markables SYSTEM "markables.dtd">
<markables xmlns="www.eml.org/NameSpaces/source">
<markable id="markable_100500294" span="word_1593" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500281" span="word_1134" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_194" span="word_1491..word_1492" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500254" span="word_662..word_664" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_66" span="word_431" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_12" span="word_105" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500233" span="word_565" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500231" span="word_560" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500212" span="word_199" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_157" span="word_1007" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500249" span="word_656" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_187" span="word_1415" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
<markable id="markable_100500259" span="word_817" mmax_level="source"  anaphref="empty"  sentiment_ref="empty" />
</markables>


text:
// This file is automatically generated.

package adila.db;

/*
 * Samsung Galaxy Fit
 *
 * DEVICE: GT-S5670L
 * MODEL: GT-S5670L
 */
final class gt2ds5670l_gt2ds5670l {
    public static final String DATA = "Samsung|Galaxy Fit|";
}


text:
require_relative '../spec_helper'
require 'conf'

describe SpamAssassinCookbook::Conf, order: :random do
  subject { SpamAssassinCookbook::Conf }

  describe '.value' do
    {
      true => '1',
      false => '0',
      '1' => '1',
      '0' => '0',
      1 => '1',
      0 => '0'
    }.each do |value, result|
      it "returns #{result.inspect} for #{value.inspect}" do
        expect(subject.value(value)).to eq(result)
      end
    end
  end # .value
end


text:
import Ember from 'ember';

export default Ember.Route.extend({

  titleToken: 'Reset Password',

  model(params) {
    let token = params.token;
    this.controllerFor('users.resetpassword').set('token', token);
  },

  deactivate(){
    this.controllerFor('users.resetpassword').send('reset');
  },

});


text:
package org.apache.wicket.util.convert.converter;

import java.math.BigDecimal;
import java.util.Locale;

import org.apache.wicket.util.convert.IConverter;

/**
 * Converts from Object to Short.
 *
 * @author Eelco Hillenius
 * @author Jonathan Locke
 */
public class ShortConverter extends AbstractIntegerConverter<Short>
{
	private static final long serialVersionUID = 1L;

	private static final BigDecimal MIN_VALUE = new BigDecimal(Short.MIN_VALUE);
	private static final BigDecimal MAX_VALUE = new BigDecimal(Short.MAX_VALUE);

	/**
	 * The singleton instance for a short converter
	 */
	public static final IConverter<Short> INSTANCE = new ShortConverter();

	/**
	 * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String,Locale)
	 */
	@Override
	public Short convertToObject(final String value, final Locale locale)
	{
		final BigDecimal number = parse(value, MIN_VALUE, MAX_VALUE, locale);

		if (number == null)
		{
			return null;
		}

		return number.shortValue();
	}

	/**
	 * @see org.apache.wicket.util.convert.converter.AbstractConverter#getTargetType()
	 */
	@Override
	protected Class<Short> getTargetType()
	{
		return Short.class;
	}
}


text:
    {{pageTitle}}

    <form novalidate
          [formGroup]="editForm"
          (ngSubmit)="saveMovie()">
      <fieldset>

          Movie Title

            <input class="form-control"
                   id="inputMovieTitle"
                   type="text"
                   placeholder="Title (required)"
                   formControlName="title"
                   [ngClass]="{'is-invalid': formError.title }" />

              {{formError.title}}

          Director

            <input class="form-control"
                   id="inputDirector"
                   type="text"
                   placeholder="Director (required)"
                   formControlName="director"
                   [ngClass]="{'is-invalid': formError.director }" />

              {{formError.director}}

          Star Rating (1-5)

            <input class="form-control"
                   id="inputStarRating"
                   type="text"
                   placeholder="Rating"
                   formControlName="starRating"
                   [ngClass]="{'is-invalid': formError.starRating }" />

              {{formError.starRating}}

          Description

            <textarea class="form-control"
                      id="inputMovieDescription"
                      placeholder="Description"
                      rows=3
                      formControlName="description"
                      [ngClass]="{'is-invalid': formError.description }"></textarea>

              {{ formError.description}}

            <button class="btn btn-primary"
                    type="submit"
                    style="width:80px;margin-right:10px"
                    [disabled]='!editForm.valid'>
              Save
            </button>
            <button class="btn btn-outline-secondary"
                    type="button"
                    style="width:80px"
                    [routerLink]="['/movies']">
              Cancel
            </button>

      </fieldset>
    </form>

{{errorMessage}}


text:
<?php

namespace Sabre\VObject\Property;

use PHPUnit\Framework\TestCase;
use Sabre\VObject;

class FloatTest extends TestCase
{
    public function testMimeDir()
    {
        $input = "BEGIN:VCARD\r\nVERSION:4.0\r\nX-FLOAT;VALUE=FLOAT:0.234;1.245\r\nEND:VCARD\r\n";
        $mimeDir = new VObject\Parser\MimeDir($input);

        $result = $mimeDir->parse($input);

        $this->assertInstanceOf(FloatValue::class, $result->{'X-FLOAT'});

        $this->assertEquals([
            0.234,
            1.245,
        ], $result->{'X-FLOAT'}->getParts());

        $this->assertEquals(
            $input,
            $result->serialize()
        );
    }
}


text:
package org.apereo.cas.ws.idp.web;

import org.apereo.cas.CasProtocolConstants;
import org.apereo.cas.authentication.adaptive.UnauthorizedAuthenticationException;
import org.apereo.cas.authentication.principal.Service;
import org.apereo.cas.util.function.FunctionUtils;
import org.apereo.cas.ws.idp.WSFederationConstants;
import org.apereo.cas.ws.idp.services.WSFederationRegisteredService;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.jasig.cas.client.authentication.DefaultAuthenticationRedirectStrategy;
import org.jasig.cas.client.util.CommonUtils;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;

/**
 * This is {@link WSFederationValidateRequestController}.
 *
 * @author Misagh Moayyed
 * @since 5.1.0
 */
@Slf4j
public class WSFederationValidateRequestController extends BaseWSFederationRequestController {
    public WSFederationValidateRequestController(final WSFederationRequestConfigurationContext ctx) {
        super(ctx);
    }

    /**
     * Handle federation request.
     *
     * @param response the response
     * @param request  the request
     * @throws Exception the exception
     */
    @GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_REQUEST)
    public void handleFederationRequest(final HttpServletResponse response, final HttpServletRequest request) throws Exception {
        val fedRequest = WSFederationRequest.of(request);
        val wa = fedRequest.getWa();
        if (StringUtils.isBlank(wa)) {
            throw new UnauthorizedAuthenticationException("Unable to determine the [WA] parameter", new HashMap<>(0));
        }

        switch (wa.toLowerCase()) {
            case WSFederationConstants.WSIGNOUT10:
            case WSFederationConstants.WSIGNOUT_CLEANUP10:
                handleLogoutRequest(fedRequest, request, response);
                break;
            case WSFederationConstants.WSIGNIN10:
                val targetService = getConfigContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply());
                handleInitialAuthenticationRequest(fedRequest, targetService, response, request);
                break;
            default:
                throw new UnauthorizedAuthenticationException("The authentication request is not recognized", new HashMap<>(0));
        }
    }

    private void handleLogoutRequest(final WSFederationRequest fedRequest, final HttpServletRequest request,
                                     final HttpServletResponse response) throws Exception {

        val logoutUrl = FunctionUtils.doIf(StringUtils.isNotBlank(fedRequest.getWreply()),
            () -> {
                val service = getConfigContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply());
                val registeredService = getWsFederationRegisteredService(service);
                LOGGER.debug("Invoking logout operation for request [{}], redirecting next to [{}] matched against [{}]",
                    fedRequest, fedRequest.getWreply(), registeredService);
                val logoutParam = getConfigContext().getCasProperties().getLogout().getRedirectParameter();
                return getConfigContext().getCasProperties()
                    .getServer().getLogoutUrl().concat("?").concat(logoutParam).concat("=").concat(service.getId());
            },
            () -> getConfigContext().getCasProperties().getServer().getLogoutUrl())
            .get();

        val authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
        authenticationRedirectStrategy.redirect(request, response, logoutUrl);
    }

    private void handleInitialAuthenticationRequest(final WSFederationRequest fedRequest, final Service targetService,
                                                    final HttpServletResponse response, final HttpServletRequest request) {
        val service = findAndValidateFederationRequestForRegisteredService(targetService, fedRequest);
        LOGGER.debug("Redirecting to identity provider for initial authentication [{}]", fedRequest);
        redirectToIdentityProvider(fedRequest, response, request, service);
    }

    @SneakyThrows
    private void redirectToIdentityProvider(final WSFederationRequest fedRequest, final HttpServletResponse response,
                                            final HttpServletRequest request, final WSFederationRegisteredService service) {
        val serviceUrl = constructServiceUrl(request, response, fedRequest);
        LOGGER.debug("Created service url [{}] mapped to [{}]", serviceUrl, service);
        val renew = shouldRenewAuthentication(fedRequest, request);
        val initialUrl = CommonUtils.constructRedirectUrl(getConfigContext().getCasProperties().getServer().getLoginUrl(),
            CasProtocolConstants.PARAMETER_SERVICE, serviceUrl, renew, false);
        LOGGER.debug("Redirecting authN request to [{}]", initialUrl);
        val authenticationRedirectStrategy = new DefaultAuthenticationRedirectStrategy();
        authenticationRedirectStrategy.redirect(request, response, initialUrl);
    }
}


text:
let select = $("#interests-select")

// Setup tag select styling on element
function setupTagsSelect(element) {

    // Give the appropriate class to a tag element
    function styleTag(value) {
        let className = 'tag-' + value
        let tagName = element.find("[value=" + value + "]").text()
        element.parent().find(".search-choice > span:contains('" + tagName + "')").parent().addClass(className + " badge-secondary tags")
    }

    element = $(element)

    element
        // Called when chosen is activated on the select field, styles already present tags
        .on("chosen:ready", function(e, params) {

            for (let i = params.chosen.results_data.length - 1; i >= 0; i--) {
                let tag = params.chosen.results_data[i]
                if (tag.selected)
                    styleTag(tag.value)
            }
        })
        // Called when tags get changed, styles newly added tags
        .on("change", function(e, params) {
            if (params.selected)
                styleTag(params.selected)
        })

    // Enable chosen js on the select input field
    element.chosen({ width: "100%", no_results_text: "No tags with this name", search_contains: true })

    // Give styling to container
    let chosen = element.parent().find(".chosen-container")
    chosen.find(".chosen-search-input").attr("style", "width: 100%;")
    chosen.addClass("form-control")

    // Prevent modifying interests for other users
    let allowEdit = $("#same-user").length ? ($("#same-user").text() == 'True') : false

    if (!allowEdit) {
        let card = $(".card-info.card-interests").find(".card-block")
        let newCard = $("

").css({
            'width': card.width(),
            'height': card.height(),
            'background-color': 'transparent',
            'position': 'absolute',
            'bottom': 0
        })

        card.parent().append(newCard)
    }

}

setupTagsSelect(select)

// Send tags to view
function sendInterestAjax(selectedTags) {
    $.ajax({
        type: "POST",
        data: {
            selectedTags: selectedTags,
            csrfmiddlewaretoken: window.token
        }
    })
}

// Send request when selected tags are changed
document.getElementById("interests-select").onchange = function() {
    let selectedTags = []

    $("#interests-select :selected").each(function() {
        selectedTags.push($(this).val())
    })

    sendInterestAjax(selectedTags)
}


text:
@implementation UIView (SDMaskExtension)

- (nonnull SDMask*)sdm_showAlertUsingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskController alloc] initWithUserView:self];
    [mask.model setAnimte:SDMaskAnimationAlert];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showActionSheetUsingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = (id)[[SDMaskController alloc] initWithUserView:self];
    [mask.model setAnimte:SDMaskAnimationSheet];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showLeftPushUsingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = (id)[[SDMaskController alloc] initWithUserView:self];
    [mask.model setAnimte:SDMaskAnimationLeftPush];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showRightPushUsingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = (id)[[SDMaskController alloc] initWithUserView:self];
    [mask.model setAnimte:SDMaskAnimationRightPush];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showHUDUsingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = (id)[[SDMaskController alloc] initWithUserView:self];
    [mask.model setAnimte:SDMaskAnimationHUD];
    [mask.model setAutoDismiss:YES];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showAlertIn:(UIView *)superview usingBlock:(NS_NOESCAPE SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskView alloc] initWithUserView:self];
    [mask.model setMaskOwner:superview];
    [mask.model setAnimte:SDMaskAnimationAlert];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showActionSheetIn:(UIView *)superview usingBlock:(NS_NOESCAPE  SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskView alloc] initWithUserView:self];
    [mask.model setMaskOwner:superview];
    [mask.model setAnimte:SDMaskAnimationSheet];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showLeftPushIn:(UIView *)superview usingBlock:(NS_NOESCAPE  SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskView alloc] initWithUserView:self];
    [mask.model setMaskOwner:superview];
    [mask.model setAnimte:SDMaskAnimationLeftPush];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showRightPushIn:(UIView *)superview usingBlock:(NS_NOESCAPE  SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskView alloc] initWithUserView:self];
    [mask.model setMaskOwner:superview];
    [mask.model setAnimte:SDMaskAnimationRightPush];
    if(block) block(mask);
    [mask show];
    return mask;
}

- (nonnull SDMask*)sdm_showHUDIn:(UIView *)superview usingBlock:(NS_NOESCAPE  SDMaskSettingBlock)block {
    id<SDMaskProtocol> mask = [[SDMaskView alloc] initWithUserView:self];
    [mask.model setMaskOwner:superview];
    [mask.model setAnimte:SDMaskAnimationHUD];
    [mask.model setAutoDismiss:YES];
    if(block) block(mask);
    [mask show];
    return mask;
}

static char keyForBindingKey = '\0';
- (instancetype)sdm_userViewWithBindingKey:(id)key {
    objc_setAssociatedObject(self, &keyForBindingKey, key, OBJC_ASSOCIATION_COPY_NONATOMIC);
    return self;
}

- (id)sdm_bindingKey {
    return objc_getAssociatedObject(self, &keyForBindingKey);
}

- (nonnull id)sdm_safeGuide {
    if (@available(iOS 11.0, *)) return self.safeAreaLayoutGuide;
    return nil;
}
@end

@implementation UIResponder(SDMaskExtension)

- (SDMask * _Nonnull (^)(id _Nonnull))sdm_maskWith {
    return ^ id (id userView){
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        UIResponder<SDMaskBase>* mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        return mask;
    };
}

- (SDMaskGuidController * _Nonnull (^)(NSArray<UIView *> * _Nonnull))sdm_guidMaskWith {
    return ^ id (NSArray<UIView *> * userView) {
        SDMaskGuidController *mask = [[SDMaskGuidController alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        return mask;
    };
}

- (SDMask * _Nonnull (^)(UIView * _Nonnull))sdm_alertMaskWith {
    return ^ id (UIView *userView) {
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        SDMask *mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        [mask.model setAnimte:SDMaskAnimationAlert];
        return mask;
    };
}

- (SDMask * _Nonnull (^)(UIView * _Nonnull))sdm_actionSheetMaskWith {
    return ^ id (UIView *userView) {
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        SDMask *mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        [mask.model setAnimte:SDMaskAnimationSheet];
        return mask;
    };
}

- (SDMask * _Nonnull (^)(UIView * _Nonnull))sdm_leftPushMaskWith {
    return ^ id (UIView *userView) {
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        SDMask *mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        [mask.model setAnimte:SDMaskAnimationLeftPush];
        return mask;
    };
}

- (SDMask * _Nonnull (^)(UIView * _Nonnull))sdm_rightPushMaskWith {
    return ^ id (UIView *userView) {
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        SDMask *mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        [mask.model setAnimte:SDMaskAnimationRightPush];
        return mask;
    };
}

- (SDMask * _Nonnull (^)(UIView * _Nonnull))sdm_HUDMaskWith {
    return ^ id (UIView *userView) {
        Class cls = nil;
        do {
            if([self.class isSubclassOfClass:UIViewController.class]){
                cls = SDMaskController.class;
                break;
            }
            if([self.class isSubclassOfClass:UIView.class]){
                cls = SDMaskView.class;
                break;
            }
        } while (0);
        SDMask *mask = [[cls alloc] initWithUserView:userView];
        [mask.model setMaskOwner:self];
        [mask.model setAnimte:SDMaskAnimationHUD];
        [mask.model setAutoDismiss:YES];
        return mask;
    };
}

@end


text:
class Person {
    public String name;
}


text:
Parsec is a natural language parser for addresses. It returns it to you in a simple format.
Create something awesome with it.
We use it for our Rails Rumble Project Happy Geocode. But don't tell it to anyone.

## Installation

Add this line to your application's Gemfile:

    gem 'parsec'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install parsec

## Usage

```ruby
Parsec.setup

parsed = Parsec.parse "Hauptstraße 23, Köln"

parsed.street_name   #=> Hauptstrasse
parsed.city          #=> Koeln
parsed.street_number #=> 23
parsed.zip           #=> nil
parsed.country       #=> nil
parsed.state         #=> nil
```


text:
<?php

namespace Omnipay\NetBanx;

use Omnipay\Common\CreditCard;
use Omnipay\GatewayTestCase;

class GatewayTest extends GatewayTestCase
{
    public function setUp()
    {
        parent::setUp();

        $this->gateway = new Gateway($this->getHttpClient(), $this->getHttpRequest());

        $card = new CreditCard($this->getValidCard());

        $card->setBillingAddress1('Wall street');
        $card->setBillingAddress2('Wall street 2');
        $card->setBillingCity('San Luis Obispo');
        $card->setBillingCountry('US');
        $card->setBillingPostcode('93401');
        $card->setBillingPhone('1234567');
        $card->setBillingState('CA');

        $card->setShippingAddress1('Shipping Wall street');
        $card->setShippingAddress2('Shipping Wall street 2');
        $card->setShippingCity('San Luis Obispo');
        $card->setShippingCountry('US');
        $card->setShippingPostcode('93401');
        $card->setShippingPhone('1234567');
        $card->setShippingState('CA');

        $card->setCompany('Test Business name');
        $card->setEmail('test@example.com');

        $this->purchaseOptions = array(
            'amount' => '95.63',
            'card' => $card,
            'customerId' => '9966441',
        );

        $this->captureOptions = array(
            'amount' => '10.00',
            'transactionReference' => '9988775',
        );

        $this->voidOptions = array(
            'accountNumber' => '12345678',
            'storeId' => 'test',
            'storePassword' => 'test',
            'transactionReference' => '115147689',
        );

        $this->storedDataOptions = array(
            'amount' => '95.63',
            'customerId' => '9966441',
            'transactionReference' => '244530120',
        );
    }

    public function testAuthorizeSuccess()
    {
        $this->setMockHttpResponse('AuthorizeSuccess.txt');

        $request = $this->gateway->authorize($this->purchaseOptions);
        $requestData = $request->getData();
        /** @var $card CreditCard */
        $card = $request->getCard();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccAuthorize', $requestData['txnMode']);

        $this->assertSame('93401', (string) $sxml->billingDetails->zip);
        $this->assertSame('VI', (string) $sxml->card->cardType);

        $this->assertTrue(isset($sxml->billingDetails));
        $this->assertTrue(isset($sxml->shippingDetails));

        $this->assertSame('95.63', (string) $sxml->amount);
        $this->assertSame('9966441', (string) $sxml->merchantRefNum);
        $this->assertSame('93401', $card->getPostcode());
        $this->assertSame('test@example.com', $card->getEmail());

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('244350540', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testAuthorizeFailure()
    {
        $this->setMockHttpResponse('AuthorizeFailure.txt');

        $response = $this->gateway->authorize($this->purchaseOptions)->send();

        $this->assertFalse($response->isSuccessful());
        $this->assertSame('-1', $response->getTransactionReference());
        $this->assertSame('Invalid txnMode: ccccAuthorize', $response->getMessage());
    }

    public function testStoredDataAuthorizeSuccess()
    {
        $this->setMockHttpResponse('StoredDataAuthorizeSuccess.txt');

        $request = $this->gateway->authorize($this->storedDataOptions);
        $requestData = $request->getData();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccStoredDataAuthorize', $requestData['txnMode']);

        $this->assertSame('244530120', (string) $sxml->confirmationNumber);

        $this->assertSame('95.63', (string) $sxml->amount);
        $this->assertSame('9966441', (string) $sxml->merchantRefNum);

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('244530120', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testStoredDataAuthorizeFailure()
    {
        $this->setMockHttpResponse('StoredDataAuthorizeFailure.txt');

        $response = $this->gateway->authorize($this->storedDataOptions)->send();

        $this->assertFalse($response->isSuccessful());
        $this->assertSame(
            'You submitted an invalid XML request. Please verify your request and retry the transaction.',
            $response->getMessage()
        );
    }

    public function testCaptureSuccess()
    {
        $this->setMockHttpResponse('CaptureSuccess.txt');

        $request = $this->gateway->capture($this->captureOptions);
        $requestData = $request->getData();

        $response = $request->send();

        $this->assertSame('ccSettlement', $requestData['txnMode']);

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('9988775', (string) $sxml->confirmationNumber);

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('9988775', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testCaptureFailure()
    {
        $this->setMockHttpResponse('CaptureFailure.txt');

        $request = $this->gateway->capture($this->captureOptions);
        $requestData = $request->getData();

        $response = $request->send();

        $this->assertSame('ccSettlement', $requestData['txnMode']);

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('9988775', (string) $sxml->confirmationNumber);

        $this->assertFalse($response->isSuccessful());
        $this->assertSame('9988775', $response->getTransactionReference());
        $this->assertSame('The authorization is either fully settled or cancelled.', $response->getMessage());
    }

    public function testPurchaseSuccess()
    {
        $this->setMockHttpResponse('PurchaseSuccess.txt');

        $request = $this->gateway->purchase($this->purchaseOptions);
        $requestData = $request->getData();
        /** @var $card CreditCard */
        $card = $request->getCard();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccPurchase', $requestData['txnMode']);

        $this->assertSame('93401', (string) $sxml->billingDetails->zip);

        $this->assertSame('93401', $card->getPostcode());
        $this->assertSame('test@example.com', $card->getEmail());

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('244356120', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testPurchaseFailure()
    {
        $this->setMockHttpResponse('PurchaseFailure.txt');

        $request = $this->gateway->purchase($this->purchaseOptions);
        $requestData = $request->getData();
        /** @var $card CreditCard */
        $card = $request->getCard();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccPurchase', $requestData['txnMode']);

        $this->assertSame('93401', (string) $sxml->billingDetails->zip);

        $this->assertSame('93401', $card->getPostcode());
        $this->assertSame('test@example.com', $card->getEmail());

        $this->assertFalse($response->isSuccessful());
        $this->assertSame('244356120', $response->getTransactionReference());
        $this->assertSame('You submitted an unsupported card type with your request.', $response->getMessage());
    }

    public function testStoredDataPurchaseSuccess()
    {
        $this->setMockHttpResponse('StoredDataPurchaseSuccess.txt');

        $request = $this->gateway->purchase($this->storedDataOptions);
        $requestData = $request->getData();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccStoredDataPurchase', $requestData['txnMode']);

        $this->assertSame('244530120', (string) $sxml->confirmationNumber);

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('244679250', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testStoredDataPurchaseFailure()
    {
        $this->setMockHttpResponse('StoredDataPurchaseFailure.txt');

        $response = $this->gateway->purchase($this->storedDataOptions)->send();

        $this->assertFalse($response->isSuccessful());
        $this->assertSame(
            'You submitted an invalid XML request. Please verify your request and retry the transaction.',
            $response->getMessage()
        );
    }

    public function testVoidSuccess()
    {
        $this->setMockHttpResponse('VoidSuccess.txt');

        $request = $this->gateway->void($this->voidOptions);
        $requestData = $request->getData();
        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccAuthorizeReversal', $requestData['txnMode']);

        $this->assertSame('12345678', (string) $sxml->merchantAccount->accountNum);
        $this->assertSame('test', (string) $sxml->merchantAccount->storeID);
        $this->assertSame('test', (string) $sxml->merchantAccount->storePwd);

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('12345678', $response->getTransactionReference());
        $this->assertSame('No Error', $response->getMessage());
    }

    public function testVoidFailure()
    {
        $this->setMockHttpResponse('VoidFailure.txt');

        $request = $this->gateway->void($this->voidOptions);
        $requestData = $request->getData();
        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccAuthorizeReversal', $requestData['txnMode']);

        $this->assertSame('12345678', (string) $sxml->merchantAccount->accountNum);
        $this->assertSame('test', (string) $sxml->merchantAccount->storeID);
        $this->assertSame('test', (string) $sxml->merchantAccount->storePwd);

        $this->assertFalse($response->isSuccessful());
        $this->assertSame('12345678', $response->getTransactionReference());
        $this->assertSame('The confirmation number included in this request could not be found.', $response->getMessage());
    }

    public function testCreateCard()
    {
        $this->setMockHttpResponse('CreateCard.txt');

        $request = $this->gateway->createCard($this->purchaseOptions);
        $requestData = $request->getData();
        /** @var $card CreditCard */
        $card = $request->getCard();

        $response = $request->send();

        $sxml = new \SimpleXMLElement($requestData['txnRequest']);

        $this->assertSame('ccAuthorize', $requestData['txnMode']);

        $this->assertSame('93401', (string) $sxml->billingDetails->zip);
        $this->assertSame('VI', (string) $sxml->card->cardType);

        $this->assertTrue(isset($sxml->billingDetails));
        $this->assertTrue(isset($sxml->shippingDetails));

        $this->assertSame('1.00', (string) $sxml->amount);
        $this->assertSame('9966441', (string) $sxml->merchantRefNum);
        $this->assertSame('93401', $card->getPostcode());
        $this->assertSame('test@example.com', $card->getEmail());

        $this->assertTrue($response->isSuccessful());
        $this->assertSame('244350540', $response->getCardReference());
        $this->assertSame('No Error', $response->getMessage());
    }
}


text:
@implementation RHSocketVariableLengthEncoder

- (instancetype)init
{
    if (self = [super init]) {
        _maxFrameSize = 65536;
        _countOfLengthByte = 2;
        _reverseOfLengthByte = NO;
    }
    return self;
}

- (void)encode:(id<RHUpstreamPacket>)upstreamPacket output:(id<RHSocketEncoderOutputProtocol>)output
{
    NSData *data = [upstreamPacket dataWithPacket];

    if (data.length >= _maxFrameSize - _countOfLengthByte) {
        [RHSocketException raiseWithReason:@"[Encode] Too Long Frame ..."];
        return;
    }//

    //可变长度编码,数据块的前两个字节为后续完整数据块的长度
    NSUInteger dataLen = data.length;
    NSMutableData *sendData = [[NSMutableData alloc] init];

    //将数据长度转换为长度字节,写入到数据块中。这里根据head占的字节个数转换data长度,默认为2个字节
    NSData *headData = [RHSocketUtils bytesFromValue:dataLen byteCount:_countOfLengthByte reverse:_reverseOfLengthByte];
    [sendData appendData:headData];
    if (data.length > 0) {
        [sendData appendData:data];
    }
    NSTimeInterval timeout = [upstreamPacket timeout];

    RHSocketLog(@"[Log]: timeout: %f, sendData: %@", timeout, sendData);
    [output didEncode:sendData timeout:timeout];
}

@end


text:
<tool id="quality_score_distribution" name="Build distribution of base quality">
<description>values</description>

<command interpreter="python">short_reads_figure_score.py $input1 $output1 </command>

<inputs>
<page>
    <param name="input1" type="data" format="qualsolexa, qual454, txtseq.zip" label="Quality score file" help="No dataset? Read tip below"/>
</page>
</inputs>

<outputs>
  	<data name="output1" format="png" />
</outputs>
<requirements>
	<requirement type="python-module">rpy</requirement>
</requirements>
<tests>
	<test>
		<param name="input1" value="solexa.qual" ftype="qualsolexa" />
  		<output name="output1" file="solexaScore.png" ftype="png" />
	</test>
	<test>
		<param name="input1" value="454.qual" ftype="qual454" />
		<output name="output1" file="454Score.png" ftype="png" />
	</test>
</tests>
<help>

.. class:: warningmark

 To use this tool your dataset needs to be in *Quality Score* format. Click pencil icon next to your dataset to set datatype to *Quality Score* (see below for examples of quality scores).

-----

**What it does**

This tool takes Quality Files generated by Roche (454), Illumina (Solexa), or ABI SOLiD machines and builds a graph showing score distribution like the one below. Such graph allows you to perform initial evaluation of data quality in a single pass.

-----

**Examples of Quality Data**

Roche (454) or ABI SOLiD data::

	>seq1
	23 33 34 25 28 28 28 32 23 34 27 4 28 28 31 21 28

Illumina (Solexa) data::

 	-40 -40 40 -40	 -40 -40 -40 40

-----

**Output example**

Quality scores are summarized as boxplot (Roche 454 FLX data):

.. image:: ../static/images/short_reads_boxplot.png

where the **X-axis** is coordiante along the read and the **Y-axis** is quality score adjusted to comply with the Phred score metric. Units on the X-axis depend on whether your data comes from Roche (454) or Illumina (Solexa) and ABI SOLiD machines:

  - For Roche (454) X-axis (shown above) indicates **relative** position (in %) within reads as this technology produces reads of different lengths;
  - For Illumina (Solexa) and ABI SOLiD X-axis shows **absolute** position in nucleotides within reads.

Every box on the plot shows the following values::

       o     <---- Outliers
       o
      -+-    <---- Upper Extreme Value that is no more
       |           than box length away from the box
       |
    +--+--+  <---- Upper Quartile
    |     |
    +-----+  <---- Median
    |     |
    +--+--+  <---- Lower Quartile
       |
       |
      -+-    <---- Lower Extreme Value that is no more
                   than box length away from the box
       o     <---- Outlier

</help>
</tool>


text:
function brewu() {
  brew update
  brew upgrade
  brew cleanup
  brew upgrade --cask
}

function upd() {
  local current_dir=$(pwd)

  if ( user_has brew ); then
    brewu
  else
    echo "INFO: brew not installed."
  fi

  if ( user_has npm ); then
    npm i -g npm
    npm update -g
  else
    echo "INFO: node/npm not installed."
  fi

  cd $current_dir
}


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

//Component

var d3Chart = {};

d3Chart.create = function(el, props, state){ //Init function
  var svg = d3.select(el).append('svg') //We set the parameters of our SVG
    .attr('class', 'd3')
    .attr('width', props.width)
    .attr('height', props.height);

  svg.append('g') //We append an SVG "Group"
    .attr('class', 'd3-points');

  this.update(el, state);
};

d3Chart.update = function(el, state){
  // Re-compute the scales, and render the data-points
  //var scales = this._scales(el, state.domain);
  this._drawPoints(el, state.data);
};

d3Chart.destroy = function(el){
  //Just destroy what needs to be destroyed here

}

d3Chart._drawPoints = function(el, data) { // This is the actual d3 code
  var g = d3.select(el).selectAll('.d3-points');

  var point = g.selectAll('.d3-point')
    .data(data, function(d) { return d.id; });

  // ENTER
  point.enter().append('circle')
      .attr('class', 'd3-point');

  // // ENTER & UPDATE
  // point.attr('cx', function(d) { return scales.x(d.x); })
  //     .attr('cy', function(d) { return scales.y(d.y); })
  //     .attr('r', function(d) { return scales.z(d.z); });

  // EXIT
  point.exit()
      .remove();
};

module.exports = d3Chart;


text:
package javax.security.auth.kerberos;

import java.io.*;
import java.util.Date;
import java.util.Arrays;
import java.net.InetAddress;
import javax.crypto.SecretKey;
import javax.security.auth.Refreshable;
import javax.security.auth.Destroyable;
import javax.security.auth.RefreshFailedException;
import javax.security.auth.DestroyFailedException;
import sun.misc.HexDumpEncoder;
import sun.security.krb5.EncryptionKey;
import sun.security.krb5.Asn1Exception;
import sun.security.util.*;

/**
 * This class encapsulates a Kerberos ticket and associated
 * information as viewed from the client's point of view. It captures all
 * information that the Key Distribution Center (KDC) sends to the client
 * in the reply message KDC-REP defined in the Kerberos Protocol
 * Specification (RFC 4120).
 *

 * All Kerberos JAAS login modules that authenticate a user to a KDC should
 * use this class. Where available, the login module might even read this
 * information from a ticket cache in the operating system instead of
 * directly communicating with the KDC. During the commit phase of the JAAS
 * authentication process, the JAAS login module should instantiate this
 * class and store the instance in the private credential set of a
 * {@link javax.security.auth.Subject Subject}.

 *
 * It might be necessary for the application to be granted a
 * {@link javax.security.auth.PrivateCredentialPermission
 * PrivateCredentialPermission} if it needs to access a KerberosTicket
 * instance from a Subject. This permission is not needed when the
 * application depends on the default JGSS Kerberos mechanism to access the
 * KerberosTicket. In that case, however, the application will need an
 * appropriate
 * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
 *

 * Note that this class is applicable to both ticket granting tickets and
 * other regular service tickets. A ticket granting ticket is just a
 * special case of a more generalized service ticket.
 *
 * @see javax.security.auth.Subject
 * @see javax.security.auth.PrivateCredentialPermission
 * @see javax.security.auth.login.LoginContext
 * @see org.ietf.jgss.GSSCredential
 * @see org.ietf.jgss.GSSManager
 *
 * @author Mayank Upadhyay
 * @since 1.4
 */
public class KerberosTicket implements Destroyable, Refreshable,
         java.io.Serializable {

    private static final long serialVersionUID = 7395334370157380539L;

    // XXX Make these flag indices public
    private static final int FORWARDABLE_TICKET_FLAG = 1;
    private static final int FORWARDED_TICKET_FLAG   = 2;
    private static final int PROXIABLE_TICKET_FLAG   = 3;
    private static final int PROXY_TICKET_FLAG       = 4;
    private static final int POSTDATED_TICKET_FLAG   = 6;
    private static final int RENEWABLE_TICKET_FLAG   = 8;
    private static final int INITIAL_TICKET_FLAG     = 9;

    private static final int NUM_FLAGS = 32;

    /**
     *
     * ASN.1 DER Encoding of the Ticket as defined in the
     * Kerberos Protocol Specification RFC4120.
     *
     * @serial
     */

    private byte[] asn1Encoding;

    /**
     *{@code KeyImpl} is serialized by writing out the ASN1 Encoded bytes
     * of the encryption key. The ASN1 encoding is defined in RFC4120 and as
     * follows:
     *

     * EncryptionKey   ::= SEQUENCE {
     *          keytype    [0] Int32 -- actually encryption type --,
     *          keyvalue   [1] OCTET STRING
     * }
     *

     *
     * @serial
     */

    private KeyImpl sessionKey;

    /**
     *
     * Ticket Flags as defined in the Kerberos Protocol Specification RFC4120.
     *
     * @serial
     */

    private boolean[] flags;

    /**
     *
     * Time of initial authentication
     *
     * @serial
     */

    private Date authTime;

    /**
     *
     * Time after which the ticket is valid.
     * @serial
     */
    private Date startTime;

    /**
     *
     * Time after which the ticket will not be honored. (its expiration time).
     *
     * @serial
     */

    private Date endTime;

    /**
     *
     * For renewable Tickets it indicates the maximum endtime that may be
     * included in a renewal. It can be thought of as the absolute expiration
     * time for the ticket, including all renewals. This field may be null
     * for tickets that are not renewable.
     *
     * @serial
     */

    private Date renewTill;

    /**
     *
     * Client that owns the service ticket
     *
     * @serial
     */

    private KerberosPrincipal client;

    /**
     *
     * The service for which the ticket was issued.
     *
     * @serial
     */

    private KerberosPrincipal server;

    /**
     *
     * The addresses from where the ticket may be used by the client.
     * This field may be null when the ticket is usable from any address.
     *
     * @serial
     */

    private InetAddress[] clientAddresses;

    private transient boolean destroyed = false;

    /**
     * Constructs a KerberosTicket using credentials information that a
     * client either receives from a KDC or reads from a cache.
     *
     * @param asn1Encoding the ASN.1 encoding of the ticket as defined by
     * the Kerberos protocol specification.
     * @param client the client that owns this service
     * ticket
     * @param server the service that this ticket is for
     * @param sessionKey the raw bytes for the session key that must be
     * used to encrypt the authenticator that will be sent to the server
     * @param keyType the key type for the session key as defined by the
     * Kerberos protocol specification.
     * @param flags the ticket flags. Each element in this array indicates
     * the value for the corresponding bit in the ASN.1 BitString that
     * represents the ticket flags. If the number of elements in this array
     * is less than the number of flags used by the Kerberos protocol,
     * then the missing flags will be filled in with false.
     * @param authTime the time of initial authentication for the client
     * @param startTime the time after which the ticket will be valid. This
     * may be null in which case the value of authTime is treated as the
     * startTime.
     * @param endTime the time after which the ticket will no longer be
     * valid
     * @param renewTill an absolute expiration time for the ticket,
     * including all renewal that might be possible. This field may be null
     * for tickets that are not renewable.
     * @param clientAddresses the addresses from where the ticket may be
     * used by the client. This field may be null when the ticket is usable
     * from any address.
     */
    public KerberosTicket(byte[] asn1Encoding,
                         KerberosPrincipal client,
                         KerberosPrincipal server,
                         byte[] sessionKey,
                         int keyType,
                         boolean[] flags,
                         Date authTime,
                         Date startTime,
                         Date endTime,
                         Date renewTill,
                         InetAddress[] clientAddresses) {

        init(asn1Encoding, client, server, sessionKey, keyType, flags,
            authTime, startTime, endTime, renewTill, clientAddresses);
    }

    private void init(byte[] asn1Encoding,
                         KerberosPrincipal client,
                         KerberosPrincipal server,
                         byte[] sessionKey,
                         int keyType,
                         boolean[] flags,
                         Date authTime,
                         Date startTime,
                         Date endTime,
                         Date renewTill,
                         InetAddress[] clientAddresses) {
        if (sessionKey == null)
           throw new IllegalArgumentException("Session key for ticket"
                                              + " cannot be null");
        init(asn1Encoding, client, server,
             new KeyImpl(sessionKey, keyType), flags, authTime,
             startTime, endTime, renewTill, clientAddresses);
    }

    private void init(byte[] asn1Encoding,
                         KerberosPrincipal client,
                         KerberosPrincipal server,
                         KeyImpl sessionKey,
                         boolean[] flags,
                         Date authTime,
                         Date startTime,
                         Date endTime,
                         Date renewTill,
                         InetAddress[] clientAddresses) {
        if (asn1Encoding == null)
           throw new IllegalArgumentException("ASN.1 encoding of ticket"
                                              + " cannot be null");
        this.asn1Encoding = asn1Encoding.clone();

        if (client == null)
           throw new IllegalArgumentException("Client name in ticket"
                                              + " cannot be null");
        this.client = client;

        if (server == null)
           throw new IllegalArgumentException("Server name in ticket"
                                              + " cannot be null");
        this.server = server;

        // Caller needs to make sure `sessionKey` will not be null
        this.sessionKey = sessionKey;

        if (flags != null) {
           if (flags.length >= NUM_FLAGS)
                this.flags = flags.clone();
           else {
                this.flags = new boolean[NUM_FLAGS];
                // Fill in whatever we have
                for (int i = 0; i < flags.length; i++)
                    this.flags[i] = flags[i];
           }
        } else
           this.flags = new boolean[NUM_FLAGS];

        if (this.flags[RENEWABLE_TICKET_FLAG]) {
           if (renewTill == null)
                throw new IllegalArgumentException("The renewable period "
                       + "end time cannot be null for renewable tickets.");

           this.renewTill = new Date(renewTill.getTime());
        }

        if (authTime != null) {
            this.authTime = new Date(authTime.getTime());
        }
        if (startTime != null) {
            this.startTime = new Date(startTime.getTime());
        } else {
            this.startTime = this.authTime;
        }

        if (endTime == null)
           throw new IllegalArgumentException("End time for ticket validity"
                                              + " cannot be null");
        this.endTime = new Date(endTime.getTime());

        if (clientAddresses != null)
           this.clientAddresses = clientAddresses.clone();
    }

    /**
     * Returns the client principal associated with this ticket.
     *
     * @return the client principal.
     */
    public final KerberosPrincipal getClient() {
        return client;
    }

    /**
     * Returns the service principal associated with this ticket.
     *
     * @return the service principal.
     */
    public final KerberosPrincipal getServer() {
        return server;
    }

    /**
     * Returns the session key associated with this ticket.
     *
     * @return the session key.
     */
    public final SecretKey getSessionKey() {
        if (destroyed)
            throw new IllegalStateException("This ticket is no longer valid");
        return sessionKey;
    }

    /**
     * Returns the key type of the session key associated with this
     * ticket as defined by the Kerberos Protocol Specification.
     *
     * @return the key type of the session key associated with this
     * ticket.
     *
     * @see #getSessionKey()
     */
    public final int getSessionKeyType() {
        if (destroyed)
            throw new IllegalStateException("This ticket is no longer valid");
        return sessionKey.getKeyType();
    }

    /**
     * Determines if this ticket is forwardable.
     *
     * @return true if this ticket is forwardable, false if not.
     */
    public final boolean isForwardable() {
        return flags[FORWARDABLE_TICKET_FLAG];
    }

    /**
     * Determines if this ticket had been forwarded or was issued based on
     * authentication involving a forwarded ticket-granting ticket.
     *
     * @return true if this ticket had been forwarded or was issued based on
     * authentication involving a forwarded ticket-granting ticket,
     * false otherwise.
     */
    public final boolean isForwarded() {
        return flags[FORWARDED_TICKET_FLAG];
    }

    /**
     * Determines if this ticket is proxiable.
     *
     * @return true if this ticket is proxiable, false if not.
     */
    public final boolean isProxiable() {
        return flags[PROXIABLE_TICKET_FLAG];
    }

    /**
     * Determines is this ticket is a proxy-ticket.
     *
     * @return true if this ticket is a proxy-ticket, false if not.
     */
    public final boolean isProxy() {
        return flags[PROXY_TICKET_FLAG];
    }

    /**
     * Determines is this ticket is post-dated.
     *
     * @return true if this ticket is post-dated, false if not.
     */
    public final boolean isPostdated() {
        return flags[POSTDATED_TICKET_FLAG];
    }

    /**
     * Determines is this ticket is renewable. If so, the {@link #refresh()
     * refresh} method can be called, assuming the validity period for
     * renewing is not already over.
     *
     * @return true if this ticket is renewable, false if not.
     */
    public final boolean isRenewable() {
        return flags[RENEWABLE_TICKET_FLAG];
    }

    /**
     * Determines if this ticket was issued using the Kerberos AS-Exchange
     * protocol, and not issued based on some ticket-granting ticket.
     *
     * @return true if this ticket was issued using the Kerberos AS-Exchange
     * protocol, false if not.
     */
    public final boolean isInitial() {
        return flags[INITIAL_TICKET_FLAG];
    }

    /**
     * Returns the flags associated with this ticket. Each element in the
     * returned array indicates the value for the corresponding bit in the
     * ASN.1 BitString that represents the ticket flags.
     *
     * @return the flags associated with this ticket.
     */
    public final boolean[]  getFlags() {
        return (flags == null? null: flags.clone());
    }

    /**
     * Returns the time that the client was authenticated.
     *
     * @return the time that the client was authenticated
     *         or null if not set.
     */
    public final java.util.Date getAuthTime() {
        return (authTime == null) ? null : (Date)authTime.clone();
    }

    /**
     * Returns the start time for this ticket's validity period.
     *
     * @return the start time for this ticket's validity period
     *         or null if not set.
     */
    public final java.util.Date getStartTime() {
        return (startTime == null) ? null : (Date)startTime.clone();
    }

    /**
     * Returns the expiration time for this ticket's validity period.
     *
     * @return the expiration time for this ticket's validity period.
     */
    public final java.util.Date getEndTime() {
        return (Date) endTime.clone();
    }

    /**
     * Returns the latest expiration time for this ticket, including all
     * renewals. This will return a null value for non-renewable tickets.
     *
     * @return the latest expiration time for this ticket.
     */
    public final java.util.Date getRenewTill() {
        return (renewTill == null) ? null: (Date)renewTill.clone();
    }

    /**
     * Returns a list of addresses from where the ticket can be used.
     *
     * @return ths list of addresses or null, if the field was not
     * provided.
     */
    public final java.net.InetAddress[] getClientAddresses() {
        return (clientAddresses == null) ? null: clientAddresses.clone();
    }

    /**
     * Returns an ASN.1 encoding of the entire ticket.
     *
     * @return an ASN.1 encoding of the entire ticket.
     */
    public final byte[] getEncoded() {
        if (destroyed)
            throw new IllegalStateException("This ticket is no longer valid");
        return asn1Encoding.clone();
    }

    /** Determines if this ticket is still current.  */
    public boolean isCurrent() {
        return (System.currentTimeMillis() <= getEndTime().getTime());
    }

    /**
     * Extends the validity period of this ticket. The ticket will contain
     * a new session key if the refresh operation succeeds. The refresh
     * operation will fail if the ticket is not renewable or the latest
     * allowable renew time has passed. Any other error returned by the
     * KDC will also cause this method to fail.
     *
     * Note: This method is not synchronized with the the accessor
     * methods of this object. Hence callers need to be aware of multiple
     * threads that might access this and try to renew it at the same
     * time.
     *
     * @throws RefreshFailedException if the ticket is not renewable, or
     * the latest allowable renew time has passed, or the KDC returns some
     * error.
     *
     * @see #isRenewable()
     * @see #getRenewTill()
     */
    public void refresh() throws RefreshFailedException {

        if (destroyed)
            throw new RefreshFailedException("A destroyed ticket "
                                             + "cannot be renewd.");

        if (!isRenewable())
            throw new RefreshFailedException("This ticket is not renewable");

        if (System.currentTimeMillis() > getRenewTill().getTime())
            throw new RefreshFailedException("This ticket is past "
                                             + "its last renewal time.");
        Throwable e = null;
        sun.security.krb5.Credentials krb5Creds = null;

        try {
            krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
                                                    client.toString(),
                                                    server.toString(),
                                                    sessionKey.getEncoded(),
                                                    sessionKey.getKeyType(),
                                                    flags,
                                                    authTime,
                                                    startTime,
                                                    endTime,
                                                    renewTill,
                                                    clientAddresses);
            krb5Creds = krb5Creds.renew();
        } catch (sun.security.krb5.KrbException krbException) {
            e = krbException;
        } catch (java.io.IOException ioException) {
            e = ioException;
        }

        if (e != null) {
            RefreshFailedException rfException
                = new RefreshFailedException("Failed to renew Kerberos Ticket "
                                             + "for client " + client
                                             + " and server " + server
                                             + " - " + e.getMessage());
            rfException.initCause(e);
            throw rfException;
        }

        /*
         * In case multiple threads try to refresh it at the same time.
         */
        synchronized (this) {
            try {
                this.destroy();
            } catch (DestroyFailedException dfException) {
                // Squelch it since we don't care about the old ticket.
            }
            init(krb5Creds.getEncoded(),
                 new KerberosPrincipal(krb5Creds.getClient().getName()),
                 new KerberosPrincipal(krb5Creds.getServer().getName(),
                                        KerberosPrincipal.KRB_NT_SRV_INST),
                 krb5Creds.getSessionKey().getBytes(),
                 krb5Creds.getSessionKey().getEType(),
                 krb5Creds.getFlags(),
                 krb5Creds.getAuthTime(),
                 krb5Creds.getStartTime(),
                 krb5Creds.getEndTime(),
                 krb5Creds.getRenewTill(),
                 krb5Creds.getClientAddresses());
            destroyed = false;
        }
    }

    /**
     * Destroys the ticket and destroys any sensitive information stored in
     * it.
     */
    public void destroy() throws DestroyFailedException {
        if (!destroyed) {
            Arrays.fill(asn1Encoding, (byte) 0);
            client = null;
            server = null;
            sessionKey.destroy();
            flags = null;
            authTime = null;
            startTime = null;
            endTime = null;
            renewTill = null;
            clientAddresses = null;
            destroyed = true;
        }
    }

    /**
     * Determines if this ticket has been destroyed.
     */
    public boolean isDestroyed() {
        return destroyed;
    }

    public String toString() {
        if (destroyed)
            throw new IllegalStateException("This ticket is no longer valid");
        StringBuffer caddrBuf = new StringBuffer();
        if (clientAddresses != null) {
            for (int i = 0; i < clientAddresses.length; i++) {
                caddrBuf.append("clientAddresses[" + i + "] = " +
                                 clientAddresses[i].toString());
            }
        }
        return ("Ticket (hex) = " + "\n" +
                 (new HexDumpEncoder()).encodeBuffer(asn1Encoding) + "\n" +
                "Client Principal = " + client.toString() + "\n" +
                "Server Principal = " + server.toString() + "\n" +
                "Session Key = " + sessionKey.toString() + "\n" +
                "Forwardable Ticket " + flags[FORWARDABLE_TICKET_FLAG] + "\n" +
                "Forwarded Ticket " + flags[FORWARDED_TICKET_FLAG] + "\n" +
                "Proxiable Ticket " + flags[PROXIABLE_TICKET_FLAG] + "\n" +
                "Proxy Ticket " + flags[PROXY_TICKET_FLAG] + "\n" +
                "Postdated Ticket " + flags[POSTDATED_TICKET_FLAG] + "\n" +
                "Renewable Ticket " + flags[RENEWABLE_TICKET_FLAG] + "\n" +
                "Initial Ticket " + flags[RENEWABLE_TICKET_FLAG] + "\n" +
                "Auth Time = " + String.valueOf(authTime) + "\n" +
                "Start Time = " + String.valueOf(startTime) + "\n" +
                "End Time = " + endTime.toString() + "\n" +
                "Renew Till = " + String.valueOf(renewTill) + "\n" +
                "Client Addresses " +
                (clientAddresses == null ? " Null " : caddrBuf.toString() +
                "\n"));
    }

    /**
     * Returns a hashcode for this KerberosTicket.
     *
     * @return a hashCode() for the {@code KerberosTicket}
     * @since 1.6
     */
    public int hashCode() {
        int result = 17;
        if (isDestroyed()) {
            return result;
        }
        result = result * 37 + Arrays.hashCode(getEncoded());
        result = result * 37 + endTime.hashCode();
        result = result * 37 + client.hashCode();
        result = result * 37 + server.hashCode();
        result = result * 37 + sessionKey.hashCode();

        // authTime may be null
        if (authTime != null) {
            result = result * 37 + authTime.hashCode();
        }

        // startTime may be null
        if (startTime != null) {
            result = result * 37 + startTime.hashCode();
        }

        // renewTill may be null
        if (renewTill != null) {
            result = result * 37 + renewTill.hashCode();
        }

        // clientAddress may be null, the array's hashCode is 0
        result = result * 37 + Arrays.hashCode(clientAddresses);
        return result * 37 + Arrays.hashCode(flags);
    }

    /**
     * Compares the specified Object with this KerberosTicket for equality.
     * Returns true if the given object is also a
     * {@code KerberosTicket} and the two
     * {@code KerberosTicket} instances are equivalent.
     *
     * @param other the Object to compare to
     * @return true if the specified object is equal to this KerberosTicket,
     * false otherwise. NOTE: Returns false if either of the KerberosTicket
     * objects has been destroyed.
     * @since 1.6
     */
    public boolean equals(Object other) {

        if (other == this)
            return true;

        if (! (other instanceof KerberosTicket)) {
            return false;
        }

        KerberosTicket otherTicket = ((KerberosTicket) other);
        if (isDestroyed() || otherTicket.isDestroyed()) {
            return false;
        }

        if (!Arrays.equals(getEncoded(), otherTicket.getEncoded()) ||
                !endTime.equals(otherTicket.getEndTime()) ||
                !server.equals(otherTicket.getServer()) ||
                !client.equals(otherTicket.getClient()) ||
                !sessionKey.equals(otherTicket.getSessionKey()) ||
                !Arrays.equals(clientAddresses, otherTicket.getClientAddresses()) ||
                !Arrays.equals(flags, otherTicket.getFlags())) {
            return false;
        }

        // authTime may be null
        if (authTime == null) {
            if (otherTicket.getAuthTime() != null)
                return false;
        } else {
            if (!authTime.equals(otherTicket.getAuthTime()))
                return false;
        }

        // startTime may be null
        if (startTime == null) {
            if (otherTicket.getStartTime() != null)
                return false;
        } else {
            if (!startTime.equals(otherTicket.getStartTime()))
                return false;
        }

        if (renewTill == null) {
            if (otherTicket.getRenewTill() != null)
                return false;
        } else {
            if (!renewTill.equals(otherTicket.getRenewTill()))
                return false;
        }

        return true;
    }

    private void readObject(ObjectInputStream s)
        throws IOException, ClassNotFoundException {
        s.defaultReadObject();
        if (sessionKey == null) {
           throw new InvalidObjectException("Session key cannot be null");
        }
        try {
            init(asn1Encoding, client, server, sessionKey,
                 flags, authTime, startTime, endTime,
                 renewTill, clientAddresses);
        } catch (IllegalArgumentException iae) {
            throw (InvalidObjectException)
                new InvalidObjectException(iae.getMessage()).initCause(iae);
        }
    }
}


text:
module Clusters
  class ClusterPolicy < BasePolicy
    alias_method :cluster, :subject

    delegate { cluster.group }
    delegate { cluster.project }
  end
end


text:
using System;
using Ivento.Dci.Examples.Djikstra.Contexts;

namespace Ivento.Dci.Examples.Djikstra.Data
{
    /// <summary>
    /// A node is equal another if they have the same name.
    /// </summary>
    public class Node : IEquatable<Node>,
        CalculateShortestPath.CurrentIntersectionRole, CalculateShortestPath.DistanceGraphRole,
        CalculateShortestPath.NeighborRole, CalculateShortestPath.CurrentRole
    {
        public string Name { get; set; }

        #region Equality stuff

        public override bool Equals(object obj)
        {
            return Equals(obj as Node);
        }

        public bool Equals(Node other)
        {
            return !ReferenceEquals(other, null) && Name.Equals(other.Name);
        }

        public override int GetHashCode()
        {
            return (Name != null ? Name.GetHashCode() : 0);
        }

        public static bool operator ==(Node lhs, Node rhs)
        {
            if (ReferenceEquals(lhs, null) && ReferenceEquals(rhs, null)) return true;
            return !ReferenceEquals(lhs, null) && lhs.Equals(rhs);
        }

        public static bool operator !=(Node lhs, Node rhs)
        {
            return !(lhs == rhs);
        }

        #endregion

        public override string ToString()
        {
            return Name;
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using FluentAssertions;
using Microsoft.Languages.Core.Test.Tokens;
using Microsoft.R.Editor.RData.Tokens;
using Microsoft.UnitTests.Core.XUnit;

namespace Microsoft.R.Editor.RData.Test.Tokens {
    [ExcludeFromCodeCoverage]
    public class VerifySortedRdTables : TokenizeTestBase<RdToken, RdTokenType> {
        [Test]
        [Category.Rd.Tokenizer]
        public void VerifySortedRdBlockKeywords() {
            string[] array = new List<string>(RdBlockContentType.Keywords).ToArray();
            Array.Sort(array);

            array.Should().Equal(RdBlockContentType.Keywords);
        }

        [Test]
        [Category.Rd.Tokenizer]
        public void VerifySortedRdVerbatimKeywords() {
            string[] array = new List<string>(RdBlockContentType.VerbatimKeywords).ToArray();
            Array.Sort(array);

            array.Should().Equal(RdBlockContentType.VerbatimKeywords);
        }
    }
}