text:
body {
  font-family: sans-serif;
  overflow-y: hidden;
}

redpajama_set_name: RedPajamaGithub


text:
API Reference
=============

Testing
-------

.. autoclass:: cob.utils.unittests.Webapp
   :members:


text:
source "${HOME}/test/common.sh"

function shunittest_deploy_template {
  set -eux -o pipefail

  export OUTPUT="${HOME}/_output/${INSTANCE_NAME}"

  deploy_template
}


text:
import sys
sys.path.insert(1,"../../")
import h2o
import math
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator

def partial_plot_test():
    kwargs = {}
    kwargs['server'] = True

    # Import data set
    data = h2o.import_file(pyunit_utils.locate('smalldata/prostate/prostate.csv'))

    # Build a GBM model predicting for response CAPSULE
    x = ['AGE', 'RACE']
    y = 'CAPSULE'
    data[y] = data[y].asfactor()

    gbm_model = H2OGradientBoostingEstimator(ntrees=50,
                                           learn_rate=0.05)
    gbm_model.train(x=x, y=y, training_frame=data)

    # Plot Partial Dependence for one feature then for both
    pdp1=gbm_model.partial_plot(data=data,cols=['AGE'],server=True, plot=True)
    #Manual test
    h2o_mean_response_pdp1 = pdp1[0]["mean_response"]
    h2o_stddev_response_pdp1 = pdp1[0]["stddev_response"]
    h2o_std_error_mean_response_pdp1 = pdp1[0]["std_error_mean_response"]
    pdp_manual = partial_dependence(gbm_model, data, "AGE", pdp1, 0)

    assert h2o_mean_response_pdp1 == pdp_manual[0]
    assert h2o_stddev_response_pdp1 == pdp_manual[1]
    assert h2o_std_error_mean_response_pdp1 == pdp_manual[2]

    pdp2=gbm_model.partial_plot(data=data,cols=['AGE','RACE'], server=True, plot=False)
    #Manual test
    h2o_mean_response_pdp2 = pdp2[0]["mean_response"]
    h2o_stddev_response_pdp2 = pdp2[0]["stddev_response"]
    h2o_std_error_mean_response_pdp2 = pdp2[0]["std_error_mean_response"]
    pdp_manual = partial_dependence(gbm_model, data, "AGE", pdp2, 0)

    assert h2o_mean_response_pdp2 == pdp_manual[0]
    assert h2o_stddev_response_pdp2 == pdp_manual[1]
    assert h2o_std_error_mean_response_pdp2 == pdp_manual[2]

    #Manual test
    h2o_mean_response_pdp2_race = pdp2[1]["mean_response"]
    h2o_stddev_response_pdp2_race = pdp2[1]["stddev_response"]
    h2o_std_error_mean_response_pdp2_race = pdp2[1]["std_error_mean_response"]
    pdp_manual = partial_dependence(gbm_model, data, "RACE", pdp2, 1)

    assert h2o_mean_response_pdp2_race == pdp_manual[0]
    assert h2o_stddev_response_pdp2_race == pdp_manual[1]
    assert h2o_std_error_mean_response_pdp2_race == pdp_manual[2]

def partial_dependence(object, pred_data, xname, h2o_pp, pdp_name_idx):
    x_pt = h2o_pp[pdp_name_idx][xname.lower()] #Needs to be lower case here as the PDP response sets everything to lower
    y_pt = list(range(len(x_pt)))
    y_sd = list(range(len(x_pt)))
    y_sem = list(range(len(x_pt)))

    for i in range(len(x_pt)):
        x_data = pred_data
        x_data[xname] = x_pt[i]
        pred = object.predict(x_data)["p1"]
        y_pt[i] = pred.mean()[0,0]
        y_sd[i] = pred.sd()[0]
        y_sem[i] = y_sd[i]/math.sqrt(x_data.nrows)

    return y_pt, y_sd, y_sem

if __name__ == "__main__":
  pyunit_utils.standalone_test(partial_plot_test)
else:
  partial_plot_test()


text:
@implementation __GAScrollViewStyleDefault
- (void)prepareLayout{
    [super prepareLayout];
    [self _setLayout];
}

- (void)_setLayout{
    self.minimumLineSpacing = self.minimumInteritemSpacing = 0;
    self.itemSize = self.collectionView.bounds.size;
    self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
}
@end

#pragma mark -

@implementation __GAScrollViewStyleTranslation
{
    CGFloat         _prevOffset;
    NSIndexPath*    _curIndexPath;
    NSIndexPath*    _movingInIndexPath;
    CGFloat         _difference;
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
    return YES;
}

- (void)prepareLayout{
    [super prepareLayout];
    [self _setLayout];
}

- (void)_setLayout{
    self.minimumLineSpacing = self.minimumInteritemSpacing = 0;
    self.itemSize = self.collectionView.bounds.size;
    self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
}

- (UICollectionViewLayoutAttributes* )layoutAttributesForItemAtIndexPath:(NSIndexPath* )indexPath{
    UICollectionViewLayoutAttributes* attributes = [super layoutAttributesForItemAtIndexPath:indexPath];
    [self _transform2LayoutAttributes:attributes];
    return attributes;
}

- (NSArray* )layoutAttributesForElementsInRect:(CGRect)rect{
    NSArray* attributes  = [super layoutAttributesForElementsInRect:rect];
    NSArray* cellIndices = [self.collectionView indexPathsForVisibleItems];

    if(cellIndices.count == 0){
        return attributes;
    }else if(cellIndices.count == 1){
        _curIndexPath       = cellIndices.firstObject;
        _movingInIndexPath  = nil;
    }else if(cellIndices.count > 1){
        NSIndexPath* firstIndexPath = cellIndices.firstObject;
        if(firstIndexPath == _curIndexPath){
            _movingInIndexPath  = cellIndices[1];
        }else{
            _movingInIndexPath  = cellIndices.firstObject;
            _curIndexPath       = cellIndices[1];
        }
    }

    _difference = self.collectionView.contentOffset.x - _prevOffset;
    _prevOffset = self.collectionView.contentOffset.x;

    for(UICollectionViewLayoutAttributes* attribute in attributes){
        [self _transform2LayoutAttributes:attribute];
    }
    return attributes;
}

#pragma mark - calculate Animation
- (void)_transform2LayoutAttributes:(UICollectionViewLayoutAttributes* )layout{

}

@end

#pragma mark -

@implementation __GAScrollViewStyleRotating
{
    CGFloat         _prevOffset;
    NSIndexPath*    _curIndexPath;
    NSIndexPath*    _movingInIndexPath;
    CGFloat         _difference;
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
    return YES;
}

- (void)prepareLayout{
    [super prepareLayout];
    [self _setLayout];
}

- (void)_setLayout{
    self.minimumLineSpacing = self.minimumInteritemSpacing = 0;
    self.itemSize = self.collectionView.bounds.size;
    self.scrollDirection = UICollectionViewScrollDirectionHorizontal;
}

- (UICollectionViewLayoutAttributes* )layoutAttributesForItemAtIndexPath:(NSIndexPath* )indexPath{
    UICollectionViewLayoutAttributes* attributes = [super layoutAttributesForItemAtIndexPath:indexPath];
    [self _transform2LayoutAttributes:attributes];
    return attributes;
}

- (NSArray* )layoutAttributesForElementsInRect:(CGRect)rect{
    NSArray* attributes  = [super layoutAttributesForElementsInRect:rect];
    NSArray* cellIndices = [self.collectionView indexPathsForVisibleItems];

    if(cellIndices.count == 0){
        return attributes;
    }else if(cellIndices.count == 1){
        _curIndexPath       = cellIndices.firstObject;
        _movingInIndexPath  = nil;
    }else if(cellIndices.count > 1){
        NSIndexPath* firstIndexPath = cellIndices.firstObject;
        if(firstIndexPath == _curIndexPath){
            _movingInIndexPath  = cellIndices[1];
        }else{
            _movingInIndexPath  = cellIndices.firstObject;
            _curIndexPath       = cellIndices[1];
        }
    }

    _difference = self.collectionView.contentOffset.x - _prevOffset;
    _prevOffset = self.collectionView.contentOffset.x;

    for(UICollectionViewLayoutAttributes* attribute in attributes){
        [self _transform2LayoutAttributes:attribute];
    }
    return attributes;
}

#pragma mark - calculate Animation
- (void)_transform2LayoutAttributes:(UICollectionViewLayoutAttributes* )layout{

}

@end


text:
package com.intel.JACW.xphysics;

import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.BodyDef;
import org.jbox2d.dynamics.BodyType;
import org.jbox2d.dynamics.FixtureDef;
import org.jbox2d.dynamics.World;
import com.intel.mttest.config.RunConfig;
import com.intel.mttest.exception.InvalidTestFormatException;
import com.intel.mttest.loaders.XMLParameter;
import com.intel.mttest.representation.AbstractTestCase;

/**
 * Domino falling down.
 *
 */
public class Domino extends AbstractTestCase {

	@XMLParameter(defaultValue = "20")
	public int steps;

	private World world;
	private Vec2 gravity;
	private FixtureDef platformFixtureDef;
	private FixtureDef dominoFixtureDef;
	private FixtureDef floorFixtureDef;
	private BodyDef dominoBody;
	private BodyDef floor;

	@Override
	public void init(RunConfig config) throws InvalidTestFormatException {
		super.init(config);
		gravity = new Vec2(0.0f, -10.0f);
		platformFixtureDef = new FixtureDef();
		PolygonShape platformPolygonShape = new PolygonShape();
		platformPolygonShape.setAsBox(15.0f, 0.1f);
		platformFixtureDef.shape = platformPolygonShape;

		dominoFixtureDef = new FixtureDef();
		PolygonShape dominoPolygonShape = new PolygonShape();
		dominoPolygonShape.setAsBox(0.2f, 2.5f);
		dominoFixtureDef.shape = dominoPolygonShape;
		dominoFixtureDef.density = 25.0f;
		dominoFixtureDef.friction = .5f;
		dominoBody = new BodyDef();
		dominoBody.type = BodyType.DYNAMIC;

		floorFixtureDef = new FixtureDef();
		PolygonShape floorPolygonShape = new PolygonShape();
		floorPolygonShape.setAsBox(60.0f, 5.0f);
		floorFixtureDef.shape = floorPolygonShape;
		floor = new BodyDef();
	}

	@Override
	public long iteration() {
		long count = 0;
		for (int k = 0; k < repeats; k++) {
			world = new World(gravity);
			for (int i = 0; i < 10; i++) {

				BodyDef platform = new BodyDef();
				platform.position = new Vec2(0.0f, 5f + 5f * i);
				world.createBody(platform).createFixture(platformFixtureDef);
			}

			int numPerRow = 15;
			for (int i = 0; i < 10; ++i) {
				for (int j = 0; j < numPerRow; j++) {
					dominoBody.position = new Vec2(-14.75f + j * (16.5f / (numPerRow - 1)), 7.3f + 5f * i);
					if (j == 0) {
						dominoBody.angle = -0.1f;
						dominoBody.position.x += .1f;
					} else
						dominoBody.angle = 0f;
					world.createBody(dominoBody).createFixture(dominoFixtureDef);
				}
			}

			floor.position.set(0.0f, -10.0f);
			world.createBody(floor).createFixture(floorFixtureDef);
			for (int t = 0; t < steps; t++) {
				world.step(1.0f / 60, 6, 2);
				count++;
			}
		}
		return count;
	}
}


text:
<?xml version="1.0" standalone="no"?>

<!DOCTYPE s1 SYSTEM "sbk:/style/dtd/document.dtd">

<s1 title="Sample: DOMCount">

    <s2 title="DOMCount">

DOMCount uses the provided DOM API to parse an XML file,
		construct the DOM tree and walk through the tree counting
		the elements (using just one API call).

        <s3 title="Running DOMCount">

The DOMCount sample parses an XML file and prints out the number of
          elements in the file. To run DOMCount, enter the following

<source>DOMCount <XML file></source>

The following parameters may be set from the command line

<source>
Usage:
    DOMCount [options] <XML file | List file>

This program invokes the DOMLSParser, builds the DOM tree,
and then prints the number of elements found in each XML file.

Options:
    -l          Indicate the input file is a List File that has a list of xml files.
                Default to off (Input file is an XML file).
    -v=xxx      Validation scheme [always | never | auto*].
    -n          Enable namespace processing. Defaults to off.
    -s          Enable schema processing. Defaults to off.
    -f          Enable full schema constraint checking. Defaults to off.
    -locale=ll_CC specify the locale, default: en_US
    -p          Print out names of elements and attributes encountered.
    -?          Show this help.

  * = Default if not provided explicitly.
</source>

-v=always will force validation

             -v=never  will not use any validation

             -v=auto   will validate if a DOCTYPE declaration or a schema declaration is present in the XML document

Here is a sample output from DOMCount

<source>cd &XercesC3InstallDir;/samples/data
DOMCount -v=always personal.xml
personal.xml: 20 ms (37 elems)</source>

          <note>The time reported by the system may be different, depending on your
          processor speed.</note>
        </s3>
    </s2>
</s1>


text:
class UserRequestEmailConfirmationForm

  include Model::NonPersistent

  field :email, type: String

  validates_presence_of :email
  validates_format_of :email, with: /@/, message: :invalid_format

  # validates uniqueness of provider & uid (email) among all users
  validate do |record|
    user = User.where( 'emails.email' => record.email ).first
    unless user
      record.errors.add :email, :not_registered
      return
    end
    user_email = user.emails.where( email: record.email ).first
    unless user_email
      record.errors.add :email, :invalid
      return
    end
    if user_email.confirmed
      record.errors.add :email, :already_confirmed
    end
  end

  # Returns User object, corresponding to this email address
  #
  def user
    User.where( 'emails.email' => email ).first
  end

  # Returns UserEmail object, corresponding to this email address
  #
  def user_email
    user.emails.where( email: email ).first
  end

end # class UserRequestEmailConfirmationForm


text:
package com.jeremyworboys.incDecValue.actions;

import com.jeremyworboys.incDecValue.Amount;

public class IncMaxAction extends IncDecValueAction
{
    protected Amount getAction()
    {
        return Amount.INC_MAX;
    }
}


text:
//
//  ZSCombination.h
//  ZipperSlug
//
//  Created by Zachary Stegall on 6/9/16.
//  Copyright © 2016 Zachary Stegall. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface ZSCombination : NSObject

/**

 @param
 @param
 @return
 */
+(NSArray *)findAllCombinations:(NSArray *)allValues;

/**

 @param
 @param
 @return
 */
+(NSInteger)totalCombinations:(NSInteger)valCount;

@end


text:
import './buttons_boolean_widget';
import './category_picker_widget';
import './ckeditor_widget';
import './color_picker_widget';
import './date_widget';
import './datetime_widget';
import './duration_widget';
import './time_widget';
import './link_list_widget';
import './linking_widget';
import './location_widget';
import './markdown_widget';
import './multiple_items_widget';
import './multiple_tag_select_widget';
import './occurrences_widget';
import './override_multiple_items_widget';
import './participant_visibility_widget';
import './person_link_widget';
import './principal_list_widget';
import './principal_widget';
import './protection_widget';
import './selectize_widget';
import './synced_input_widget';
import './typeahead_widget';
import './permissions_widget';
import './sui_color_picker_widget';


text:
module MongoidTraffic
  VERSION = '1.0.0'.freeze
end


text:
import os
from nose.tools import (assert_true, assert_is_not_none)
from nipype.interfaces.dcmstack import MergeNifti
import qixnat
from qipipe.pipeline import mask
from qipipe.helpers.constants import SCAN_TS_BASE
from ... import (ROOT, CONF_DIR)
from ...helpers.logging import logger
from .volume_test_base import VolumeTestBase

RESULTS = os.path.join(ROOT, 'results', 'pipeline', 'mask')
"""The test results directory."""

class TestMaskWorkflow(VolumeTestBase):
    """
    Mask workflow unit tests.

    This test exercises the mask workflow on three volumes of one visit in each
    of the Breast and Sarcoma studies.
    """

    def __init__(self):
        super(TestMaskWorkflow, self).__init__(logger(__name__), RESULTS)

    def test_breast(self):
        for args in self.stage('Breast'):
            self._test_workflow(*args)

    def test_sarcoma(self):
        for args in self.stage('Sarcoma'):
            self._test_workflow(*args)

    def _test_workflow(self, project, subject, session, scan, *images):
        """
        Executes :meth:`qipipe.pipeline.mask.run` on the input scans.

        :param xnat: the XNAT facade instance
        :param project: the input project name
        :param subject: the input subject name
        :param session: the input session name
        :param scan: the input scan number
        :param images: the input 3D NIfTI images to model
        """
        # Make the 4D time series from the test fixture inputs.
        merge = MergeNifti(in_files=list(images),
                           out_format=SCAN_TS_BASE)
        time_series = merge.run().outputs.out_file
        logger(__name__).debug("Testing the mask workflow on the %s %s"
                               " Scan %d time series %s..." %
                               (subject, session, scan, time_series))
        # Run the workflow.
        with qixnat.connect() as xnat:
            xnat.delete(project, subject)
            result = mask.run(project, subject, session, scan, time_series,
                              base_dir=self.base_dir, config_dir=CONF_DIR)
            # Find the mask resource.
            rsc = xnat.find_one(project, subject, session, scan=scan,
                                resource=result)
            try:
                assert_is_not_none(rsc, "The %s %s scan %d %s resource was not"
                                        " created" %
                                        (subject, session, scan, result))
            finally:
                xnat.delete(project, subject)

if __name__ == "__main__":
    import nose

    nose.main(defaultTest=__name__)


text:
package org.zstack.network.service.eip;

import org.springframework.http.HttpMethod;
import org.zstack.header.identity.Action;
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.APIParam;
import org.zstack.header.rest.RestRequest;

/**
 */
@Action(category = EipConstant.ACTION_CATEGORY)
@RestRequest(
        path = "/eips/{uuid}/actions",
        method = HttpMethod.PUT,
        responseClass = APIChangeEipStateEvent.class,
        isAction = true
)
public class APIChangeEipStateMsg extends APIMessage implements EipMessage {
    @APIParam(resourceType = EipVO.class, checkAccount = true, operationTarget = true)
    private String uuid;
    @APIParam(validValues = {"enable", "disable"})
    private String stateEvent;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public String getStateEvent() {
        return stateEvent;
    }

    public void setStateEvent(String stateEvent) {
        this.stateEvent = stateEvent;
    }

    @Override
    public String getEipUuid() {
        return uuid;
    }

    public static APIChangeEipStateMsg __example__() {
        APIChangeEipStateMsg msg = new APIChangeEipStateMsg();
        msg.setUuid(uuid());
        msg.setStateEvent(EipStateEvent.enable.toString());

        return msg;
    }
}


text:
<templateSet group="Rescript">
    <template name="rrc"
              value="@react.component
let make = (~$PROP$, ~children) => {
  $END$
}
"
              description="Rescript React component" toReformat="false" toShortenFQNames="true">
        <variable name="PROP" expression="" defaultValue="" alwaysStopAt="true"/>
        <context>
            <option name="RESCRIPT_CODE" value="true"/>
        </context>
    </template>
</templateSet>


text:
// <copyright file="EditTrackedProjectViewModel.cs" company="Logikfabrik">
//   Copyright (c) 2016-2018 anton(at)logikfabrik.se. Licensed under the MIT license.
// </copyright>

namespace Logikfabrik.Overseer.WPF.ViewModels
{
    using Caliburn.Micro;
    using EnsureThat;
    using JetBrains.Annotations;

    /// <summary>
    /// The <see cref="EditTrackedProjectViewModel" /> class.
    /// </summary>
    // ReSharper disable once InheritdocConsiderUsage
    public class EditTrackedProjectViewModel : PropertyChangedBase
    {
        private bool _track;

        /// <summary>
        /// Initializes a new instance of the <see cref="EditTrackedProjectViewModel" /> class.
        /// </summary>
        /// <param name="projectId">The project identifier.</param>
        /// <param name="projectName">The project name.</param>
        /// <param name="track">Whether this project should be tracked.</param>
        [UsedImplicitly]

        // ReSharper disable once InheritdocConsiderUsage
        public EditTrackedProjectViewModel(string projectId, string projectName, bool track)
        {
            Ensure.That(projectId).IsNotNullOrWhiteSpace();
            Ensure.That(projectName).IsNotNullOrWhiteSpace();

            Id = projectId;
            Name = projectName;
            _track = track;
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        public string Name { get; }

        /// <summary>
        /// Gets the identifier.
        /// </summary>
        /// <value>
        /// The identifier.
        /// </value>
        public string Id { get; }

        /// <summary>
        /// Gets or sets a value indicating whether this project should be tracked.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this project should be tracked; otherwise, <c>false</c>.
        /// </value>
        public bool Track
        {
            get
            {
                return _track;
            }

            set
            {
                _track = value;
                NotifyOfPropertyChange(() => Track);
            }
        }
    }
}


text:
/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Thrift;
using Thrift.Collections;
using System.Runtime.Serialization;
using Thrift.Protocol;
using Thrift.Transport;

namespace ThriftInterface
{

  #if !SILVERLIGHT
  [Serializable]
  #endif
  public partial class VersionInfo : TBase
  {
    private string _version;
    private string _description;
    private string _uri;

    public string Version
    {
      get
      {
        return _version;
      }
      set
      {
        __isset.version = true;
        this._version = value;
      }
    }

    public string Description
    {
      get
      {
        return _description;
      }
      set
      {
        __isset.description = true;
        this._description = value;
      }
    }

    public string Uri
    {
      get
      {
        return _uri;
      }
      set
      {
        __isset.uri = true;
        this._uri = value;
      }
    }

    public Isset __isset;
    #if !SILVERLIGHT
    [Serializable]
    #endif
    public struct Isset {
      public bool version;
      public bool description;
      public bool uri;
    }

    public VersionInfo() {
    }

    public void Read (TProtocol iprot)
    {
      TField field;
      iprot.ReadStructBegin();
      while (true)
      {
        field = iprot.ReadFieldBegin();
        if (field.Type == TType.Stop) {
          break;
        }
        switch (field.ID)
        {
          case 1:
            if (field.Type == TType.String) {
              Version = iprot.ReadString();
            } else {
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 2:
            if (field.Type == TType.String) {
              Description = iprot.ReadString();
            } else {
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          case 3:
            if (field.Type == TType.String) {
              Uri = iprot.ReadString();
            } else {
              TProtocolUtil.Skip(iprot, field.Type);
            }
            break;
          default:
            TProtocolUtil.Skip(iprot, field.Type);
            break;
        }
        iprot.ReadFieldEnd();
      }
      iprot.ReadStructEnd();
    }

    public void Write(TProtocol oprot) {
      TStruct struc = new TStruct("VersionInfo");
      oprot.WriteStructBegin(struc);
      TField field = new TField();
      if (Version != null && __isset.version) {
        field.Name = "version";
        field.Type = TType.String;
        field.ID = 1;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Version);
        oprot.WriteFieldEnd();
      }
      if (Description != null && __isset.description) {
        field.Name = "description";
        field.Type = TType.String;
        field.ID = 2;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Description);
        oprot.WriteFieldEnd();
      }
      if (Uri != null && __isset.uri) {
        field.Name = "uri";
        field.Type = TType.String;
        field.ID = 3;
        oprot.WriteFieldBegin(field);
        oprot.WriteString(Uri);
        oprot.WriteFieldEnd();
      }
      oprot.WriteFieldStop();
      oprot.WriteStructEnd();
    }

    public override string ToString() {
      StringBuilder sb = new StringBuilder("VersionInfo(");
      sb.Append("Version: ");
      sb.Append(Version);
      sb.Append(",Description: ");
      sb.Append(Description);
      sb.Append(",Uri: ");
      sb.Append(Uri);
      sb.Append(")");
      return sb.ToString();
    }

  }

}


text:
/**
 * Fuzz target interface.
 * Fuzz targets have some common parameters passed as macros during compilation.
 * Check the documentation for each individual fuzzer for more parameters.
 *
 * @param FUZZ_RNG_SEED_SIZE:
 *        The number of bytes of the source to look at when constructing a seed
 *        for the deterministic RNG. These bytes are discarded before passing
 *        the data to lz4 functions. Every fuzzer initializes the RNG exactly
 *        once before doing anything else, even if it is unused.
 *        Default: 4.
 * @param LZ4_DEBUG:
 *        This is a parameter for the lz4 library. Defining `LZ4_DEBUG=1`
 *        enables assert() statements in the lz4 library. Higher levels enable
 *        logging, so aren't recommended. Defining `LZ4_DEBUG=1` is
 *        recommended.
 * @param LZ4_FORCE_MEMORY_ACCESS:
 *        This flag controls how the zstd library accesses unaligned memory.
 *        It can be undefined, or 0 through 2. If it is undefined, it selects
 *        the method to use based on the compiler. If testing with UBSAN set
 *        MEM_FORCE_MEMORY_ACCESS=0 to use the standard compliant method.
 * @param FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
 *        This is the canonical flag to enable deterministic builds for fuzzing.
 *        Changes to zstd for fuzzing are gated behind this define.
 *        It is recommended to define this when building zstd for fuzzing.
 */

#ifndef FUZZ_H
#define FUZZ_H

#ifndef FUZZ_RNG_SEED_SIZE
#  define FUZZ_RNG_SEED_SIZE 4
#endif

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size);

#ifdef __cplusplus
}
#endif

#endif


text:
using namespace ang;
using namespace ang::graphics;
using namespace ang::graphics::vulkan;

vulkan_surface::vulkan_surface(vulkan_driver* _parent)
	: _parent_driver(_parent)
	, _current_size(1, 1)
	, vk_surface(0)
{

}

vulkan_surface::~vulkan_surface()
{

}

ANG_IMPLEMENT_CLASSNAME(ang::graphics::vulkan::vulkan_surface);
ANG_IMPLEMENT_OBJECTNAME(ang::graphics::vulkan::vulkan_surface);

bool vulkan_surface::is_inherited_of(type_name_t name)
{
	return name == type_of<vulkan_surface>()
		|| object::is_inherited_of(name)
		|| isurface::is_inherited_of(name);
}

bool vulkan_surface::is_kind_of(type_name_t name)const
{
	return name == type_of<vulkan_surface>()
		|| object::is_kind_of(name)
		|| isurface::is_kind_of(name);
}

bool vulkan_surface::query_object(type_name_t name, unknown_ptr_t out)
{
	if (out == null)
		return false;
	if (name == type_of<vulkan_surface>())
	{
		*out = static_cast<vulkan_surface*>(this);
		return true;
	}
	else if (object::query_object(name, out))
	{
		return true;
	}
	else if (isurface::query_object(name, out))
	{
		return true;
	}
	return false;
}

bool vulkan_surface::create(platform::icore_view_t view, VkSurfaceKHR surface)
{
	vulkan_driver_t driver = _parent_driver.lock<vulkan_driver>();
	if (driver == null)
		return false;
	auto app = platform::icore_app::get_core_app();

	return false;
}

bool vulkan_surface::update(platform::icore_view_t, foundation::size<float> size, foundation::size<float> scale)
{
	return true;
}

bool vulkan_surface::close()
{
	if (vk_surface != 0)
	{
		VulkanSDK::vkDestroySurfaceKHR(VulkanSDK::Instance(), vk_surface, null);
	}
	return true;
}

void vulkan_surface::swap_buffers()
{

}

iframe_buffer_t vulkan_surface::frame_buffer()const
{
	return null;
}

void vulkan_surface::on_display_size_changed_event(objptr, ang::platform::events::idisplay_info_event_args_t)
{

}

#endif


text:
import { defineMessages } from 'react-intl';

export default defineMessages({
  contactSupport: {
    id: 'app.components.LoginPage.contactSupport',
    defaultMessage: 'Contact Support:',
  },
  email: {
    id: 'app.components.LoginPage.email',
    defaultMessage: 'Email',
  },
  password: {
    id: 'app.components.LoginPage.password',
    defaultMessage: 'Password',
  },
  signIn: {
    id: 'app.components.LoginPage.signIn',
    defaultMessage: 'SIGN IN',
  },
});


text:
require 'test_helper'

class SitesControllerTest < ActionController::TestCase
  setup do
    @site = FactoryGirl.create(:site)
    user = FactoryGirl.create(:user)
    sign_in user
  end

  # Need to have user signed in.

  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:sites)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create site" do
    assert_difference('Site.count') do
      post :create, site: { interval: @site.interval, url: @site.url }
    end

    assert_redirected_to site_path(assigns(:site))
  end

  test "should show site" do
    get :show, id: @site
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @site
    assert_response :success
  end

  test "should update site" do
    patch :update, id: @site.id, site: { interval: @site.interval, url: @site.url, id: @site.id }
    assert_redirected_to site_path(assigns(:site))
  end

  test "should destroy site" do
    assert_difference('Site.count', -1) do
      delete :destroy, id: @site
    end

    assert_redirected_to sites_path
  end
end


text:
@interface NSArray (TDAdditions)
- (NSMutableArray *)reversedMutableArray;
- (NSArray *)reversedArray;
@end


text:
class Post < ActiveRecord::Base

  belongs_to :user,  :counter_cache => true
  belongs_to :topic, :counter_cache => true
  belongs_to :editor, :foreign_key => "updated_by", :class_name => "User"

  validates_presence_of :user_id, :body

  attr_accessor :title, :forum_id, :locked, :sticky, :subscribe

  def after_create
    topic.update_cached_fields
    Notifier.deliver_notification topic, self unless topic.subscribers.count == 0
    Forum.increment_counter("posts_count", topic.forum_id)
  end

  def after_destroy
    topic.update_cached_fields
    Forum.decrement_counter("posts_count", topic.forum_id)
  end

  def self.get(page = 1)
    paginate(:page => page, :per_page => 15, :order => 'created_at desc', :include => [:topic, :user])
  end

  def page
    posts = Post.find_all_by_topic_id(self.topic_id, :select => 'id', :order => 'created_at').map(&:id)
    post_number = posts.rindex(self.id) + 1
    (post_number.to_f / 30).ceil
  end

  def to_s
    body
  end
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/.idea/talk.iml" filepath="$PROJECT_DIR$/.idea/talk.iml" />
    </modules>
  </component>
</project>


text:
using System;
using System.Runtime.CompilerServices;

namespace jQueryApi.UI.Widgets {

    ///
    /// Events raised by Slider.
    ///
    [ScriptImport]
    [ScriptIgnoreNamespace]
    [ScriptConstants(UseNames = true)]
    public enum SliderEvents {

        ///
        /// This event is triggered on slide stop, or if the value is changed programmatically (by the value method).  Takes arguments event and ui.  Use event.originalEvent to detect whether the value changed by mouse, keyboard, or programmatically. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(this).slider('values', index) to get another handle's value.
        ///
        Change,

        ///
        /// This event is triggered when the slider is created.
        ///
        Create,

        ///
        /// This event is triggered on every mouse move during slide. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(..).slider('value', index) to get another handles' value.Return false in order to prevent a slide, based on ui.value.
        ///
        Slide,

        ///
        /// This event is triggered when the user starts sliding.
        ///
        Start,

        ///
        /// This event is triggered when the user stops sliding.
        ///
        Stop
    }
}


text:
package org.olat.data.commons.dao;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Initial Date: 23.11.2011 <br>
 *
 * @author guretzki
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:org/olat/data/commons/dao/_spring/daoDatabaseContextTest.xml" })
public class DaoITCaseNew extends AbstractTransactionalJUnit4SpringContextTests {

    private static final String TEST_DESCRIPTION = "Test Description";
    private static final String TEST_NAME = "Test Name";
    @Autowired
    private ExampleDaoImpl exampleDao;

    @Test
    public void create() {
        ExampleEntity exampleEntity = exampleDao.create();
        assertNotNull("'Create' must return an instance", exampleEntity);
    }

    @Test
    public void save() {
        exampleDao.save(exampleDao.create());
        // hint: Entity will be automatically cleanup with rollback in AbstractTransactionalJUnit4SpringContextTests
    }

    @Test(expected = IllegalArgumentException.class)
    public void save_Null() {
        exampleDao.save(null);
    }

    @Test
    public void save_AlreadyExist() {
        ExampleEntity exampleEntity = exampleDao.create();
        exampleDao.save(exampleEntity);
        exampleDao.save(exampleEntity);
    }

    @Test
    public void findById() {
        ExampleEntity exampleEntity = createTestEntityWith();
        exampleDao.save(exampleEntity);
        ExampleEntity resultEntity = exampleDao.findById(exampleEntity.getId());
        assertResult(TEST_NAME, TEST_DESCRIPTION, resultEntity);
    }

    @Test
    public void findById_WhenNotExist() {
        ExampleEntity exampleEntity = createTestEntityWith();
        exampleDao.save(exampleEntity);
        Long unknownId = new Long(1123456789);
        ExampleEntity resultEntity = exampleDao.findById(unknownId);
        assertNull("Return null when entity does not exist", resultEntity);
    }

    @Test
    public void update() {
        ExampleEntity exampleEntity = createTestEntityWith();
        exampleDao.save(exampleEntity);
        Long id1 = exampleEntity.getId();

        String changedName = exampleEntity.getName() + " changed";
        String changedDescription = exampleEntity.getDescription() + " changed";
        exampleEntity.setName(changedName);
        exampleEntity.setDescription(changedDescription);
        exampleDao.update(exampleEntity);

        ExampleEntity resultEntity = exampleDao.findById(exampleEntity.getId());
        assertResult(changedName, changedDescription, resultEntity);
        assertEquals("ResultEntity has wrong id", id1, resultEntity.getId());
    }

    @Test
    public void update_WhenNotExist() {
        String entityName = "UPDATE_" + TEST_NAME;
        ExampleEntity exampleEntity = createEntityWith(entityName, "UPDATE_" + TEST_DESCRIPTION);
        ExampleEntity updatedEntity = exampleDao.update(exampleEntity);
        assertNotNull(updatedEntity);
        assertEquals(entityName, updatedEntity.getName());
        assertNotNull(updatedEntity.getId());
    }

    @Test(expected = IllegalArgumentException.class)
    public void update_Null() {
        exampleDao.update(null);
    }

    @Test
    public void delete() {
        ExampleEntity exampleEntity = createTestEntityWith();
        exampleDao.save(exampleEntity);
        exampleDao.delete(exampleEntity);
    }

    @Test
    public void delete_WhenNotExist() {
        ExampleEntity exampleEntity = createTestEntityWith();
        exampleDao.delete(exampleEntity);
    }

    @Test(expected = IllegalArgumentException.class)
    public void delete_Null() {
        exampleDao.delete(null);
    }

    private ExampleEntity createTestEntityWith() {
        return createEntityWith(TEST_NAME, TEST_DESCRIPTION);
    }

    private ExampleEntity createEntityWith(String name, String description) {
        ExampleEntity exampleEntity = new ExampleEntity(name, description);
        exampleEntity.setName(name);
        exampleEntity.setDescription(description);
        return exampleEntity;
    }

    private void assertResult(String name, String description, ExampleEntity resultEntity) {
        assertNotNull("ResultEntity could not be null", resultEntity);
        assertEquals("ResultEntity has wrogn name", name, resultEntity.getName());
        assertEquals("ResultEntity has wrong description", description, resultEntity.getDescription());
    }

    @Test(expected = DataRuntimeException.class)
    public void testDataRuntimeException() {
        throw new DataRuntimeException(this.getClass(), "Test DataRuntimeException", null);
    }

    @Test(expected = EntityDoesNotExistException.class)
    public void testEntityDoesNotExistException() {
        throw new EntityDoesNotExistException(this.getClass(), "Test EntityDoesNotExistException", null);
    }

}


text:
package org.locationtech.geogig.metrics;

import org.locationtech.geogig.di.Decorator;
import org.locationtech.geogig.repository.Repository;
import org.locationtech.geogig.repository.Repository.RepositoryListener;

/**
 * Shuts down the metrics service at repository close() event
 */
class RepositoryDecorator implements Decorator {

    private HeapMemoryMetricsService service;

    private RepositoryListener listener;

    public RepositoryDecorator(HeapMemoryMetricsService service) {
        this.service = service;
    }

    @Override
    public boolean canDecorate(Object instance) {
        return instance instanceof Repository;
    }

    @Override
    public <I> I decorate(I subject) {
        if (listener == null) {
            listener = new RepositoryListener() {

                @Override
                public void opened(Repository repo) {
                    service.startAsync().awaitRunning();
                }

                @Override
                public void closed() {
                    service.stopAsync();
                }
            };
            ((Repository) subject).addListener(listener);
        }
        return subject;
    }
}


text:
<!doctype html>

	<title>Node Authentication</title>

QuizArt

Login or Register with:

		 Login
		 Register


text:
using UnityEngine;
using System.Collections;

public class LightningAnimation : MonoBehaviour
{

    public float framesPerSecond = 15f;
    public int framesInAnimation = 8;
    public int startFameOffset;
    private float secondsPerFrame;
    private int currentFrame;

	void Start ()
	{
	    secondsPerFrame = 1f/framesPerSecond;
	}

    public void StartAnimation()
    {
        currentFrame = startFameOffset;
        StartCoroutine(Animation());
    }

    public void StopAnimation()
    {
        StopAllCoroutines();
    }

    IEnumerator Animation()
    {
        while (true)
        {
            renderer.material.SetTextureOffset("_MainTex", new Vector2(currentFrame * 0.125f, 0));
            yield return new WaitForSeconds(secondsPerFrame);
            currentFrame++;
            if (currentFrame == framesInAnimation)
            {
                currentFrame = 0;
            }
        }
    }
}


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

-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="magento_newrelicreporting_cron" instance="Magento\NewRelicReporting\Model\Cron" method="runCron">
            <schedule>*/2 * * * *</schedule>
        </job>
    </group>
</config>


text:
module BeachApiCore
  class AchievementBrand < ActiveRecord::Base
    belongs_to :achievement, class_name: "BeachApiCore::Achievement"
    belongs_to :giftbit_brand, class_name: "BeachApiCore::GiftbitBrand"
  end
end


text:
layout: post
date: '2016-06-13'
title: "Weddington Way Alfred Sung D562 FS Sleeveless Short/Mini Aline/Princess"
category: Weddington Way
tags: [Weddington Way,Aline/Princess ,Scoop Neck,Short/Mini,Sleeveless]
---
### Weddington Way Alfred Sung D562 FS
Just **$149.99**
###   Sleeveless Short/Mini Aline/Princess

BRANDS	Weddington Way

Silhouette	Aline/Princess

Neckline	Scoop Neck

Hemline/Train	Short/Mini

Sleeve	Sleeveless

Buy it: [https://www.readybrides.com/en/weddington-way/16288-weddington-way-alfred-sung-d562-fs.html](https://www.readybrides.com/en/weddington-way/16288-weddington-way-alfred-sung-d562-fs.html)


text:
using System;
using System.Windows.Forms;

namespace DotSpatial.Data.Forms
{
    /// <summary>
    /// This handles the methodology of progress messaging in one place to make it easier to update.
    /// </summary>
    public class TimedProgressMeter
    {
        #region Fields
        private readonly Timer _timer;
        private double _endValue;
        private int _oldProg; // the previous progress level
        private int _prog; // the current progress level
        private double _startValue;
        private int _stepPercent = 1;
        private double _value;
        #endregion

        #region  Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="TimedProgressMeter"/> class that shows progress against an expected time.
        /// </summary>
        /// <param name="progressHandler">An IProgressHandler that will actually handle the status messages sent by this meter.</param>
        /// <param name="baseMessage">A base message to use as the basic status for this progress handler.</param>
        /// <param name="estimatedTime">The time the process might take.</param>
        public TimedProgressMeter(IProgressHandler progressHandler, string baseMessage, TimeSpan estimatedTime)
        {
            ProgressHandler = progressHandler;
            Key = baseMessage;
            _endValue = estimatedTime.TotalSeconds * 1000;

            _timer = new Timer
            {
                Interval = Convert.ToInt32(estimatedTime.TotalSeconds * 10) // Attempt to have a tick once during each estimated percentile
            };

            _timer.Tick += TimerTick;
            _timer.Start(); // Timers should be on another thread...
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TimedProgressMeter"/> class, but doesn't support the IProgressHandler unless one is specified.
        /// </summary>
        public TimedProgressMeter()
            : this(null, "Calculating values.", 100)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TimedProgressMeter"/> class.
        /// A progress meter can't actually do anything without a progressHandler, which actually displays the status.
        /// </summary>
        /// <param name="progressHandler">An IProgressHandler that will actually handle the status messages sent by this meter.</param>
        public TimedProgressMeter(IProgressHandler progressHandler)
            : this(progressHandler, "Calculating values.", 100)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TimedProgressMeter"/> class that simply keeps track of progress and is capable of sending progress messages.
        /// This assumes a MaxValue of 100 unless it is changed later.
        /// </summary>
        /// <param name="progressHandler">Any valid IProgressHandler that will display progress messages.</param>
        /// <param name="baseMessage">A base message to use as the basic status for this progress handler.</param>
        public TimedProgressMeter(IProgressHandler progressHandler, string baseMessage)
            : this(progressHandler, baseMessage, 100)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="TimedProgressMeter"/> class that simply keeps track of progress and is capable of sending progress messages.
        /// </summary>
        /// <param name="progressHandler">Any valid implementation if IProgressHandler that will handle the progress function.</param>
        /// <param name="baseMessage">The message without any progress information.</param>
        /// <param name="endValue">Percent shoudl show a range between the MinValue and MaxValue. MinValue is assumed to be 0.</param>
        public TimedProgressMeter(IProgressHandler progressHandler, string baseMessage, object endValue)
        {
            _endValue = Convert.ToDouble(endValue);
            ProgressHandler = progressHandler;
            Reset();
            Key = baseMessage;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets the current integer progress level from 0 to 100. If a new update is less than or equal to the previous
        /// value, then no progress will be displayed by the ProgressMeter. Values less than 0 are set to 0. Values greater than
        /// 100 are set to 100.
        /// </summary>
        public int CurrentPercent
        {
            get
            {
                return _prog;
            }

            set
            {
                int val = value;
                if (val < 0) val = 0;
                if (val > 100)
                {
                    _timer?.Stop();
                    val = 100;
                }

                _prog = val;
                if (_prog >= _oldProg + _stepPercent)
                {
                    SendProgress();
                    _oldProg = _prog;
                }
            }
        }

        /// <summary>
        /// Gets or sets the current value relative to the specified MaxValue in order to update the progress.
        /// Setting this will also update OldProgress if there is an integer change in the percentage, and send
        /// a progress message to the IProgressHandler interface.
        /// </summary>
        public object CurrentValue
        {
            get
            {
                return _value;
            }

            set
            {
                _value = Convert.ToDouble(value);
                if (_startValue < _endValue)
                {
                    CurrentPercent = Convert.ToInt32(Math.Round(100 * (_value - _startValue) / (_endValue - _startValue)));
                }
                else
                {
                    CurrentPercent = Convert.ToInt32(Math.Round(100 * (_startValue - _value) / (_startValue - _endValue)));
                }
            }
        }

        /// <summary>
        /// Gets or sets the value that defines when the meter should show as 100% complete.
        /// EndValue can be less than StartValue, but values closer to EndValue
        /// will show as being closer to 100%.
        /// </summary>
        public object EndValue
        {
            get
            {
                return _endValue;
            }

            set
            {
                _endValue = Convert.ToDouble(value);
            }
        }

        /// <summary>
        /// Gets or sets the string that does not include any mention of progress percentage, but specifies what is occuring.
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// Gets or sets the previous integer progress level from 0 to 100. If a new update is less than or equal to the previous
        /// value, then no progress will be displayed by the ProgressMeter. Values less than 0 are set to 0. Values greater than
        /// 100 are set to 100.
        /// </summary>
        public int PreviousPercent
        {
            get
            {
                return _oldProg;
            }

            set
            {
                int val = value;
                if (val < 0) val = 0;
                if (val > 100) val = 100;
                _oldProg = val;
            }
        }

        /// <summary>
        /// Gets or sets the progress handler for this meter.
        /// </summary>
        public IProgressHandler ProgressHandler { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether the progress meter should send messages to the IProgressHandler.
        /// By default Silent is false, but setting this to true will disable the messaging portion.
        /// </summary>
        public bool Silent { get; set; }

        /// <summary>
        /// Gets or sets the minimum value defines when the meter should show as 0% complete.
        /// </summary>
        public object StartValue
        {
            get
            {
                return _startValue;
            }

            set
            {
                _startValue = Convert.ToDouble(value);
            }
        }

        /// <summary>
        /// Gets or sets an integer value that is 1 by default. Ordinarilly this will send a progress message only when the integer progress
        /// has changed by 1 percentage point. For example, if StepPercent were set to 5, then a progress update would only
        /// be sent out at 5%, 10% and so on. This helps reduce overhead in cases where showing status messages is actually
        /// the majority of the processing time for the function.
        /// </summary>
        public int StepPercent
        {
            get
            {
                return _stepPercent;
            }

            set
            {
                _stepPercent = value;
                if (_stepPercent < 1) _stepPercent = 1;
                if (_stepPercent > 100) _stepPercent = 100;
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Resets the progress meter to the 0 value. This sets the status message to "Ready.".
        /// </summary>
        public void Reset()
        {
            _prog = 0;
            _oldProg = 0;
            Key = "Ready.";
            _timer?.Stop();
            if (Silent) return;
            if (ProgressHandler == null) return;
            ProgressHandler.Reset();
            Application.DoEvents(); // Allow the form to update a status bar if necessary.
        }

        /// <summary>
        /// Sends a progress message to the IProgressHandler interface with the current message and progres.
        /// </summary>
        public void SendProgress()
        {
            if (Silent) return;
            if (ProgressHandler == null) return;
            ProgressHandler.Progress(_prog, Key + ", " + _prog + "% Complete.");
            Application.DoEvents(); // Allow the form to update a status bar if necessary.
        }

        private void TimerTick(object sender, EventArgs e)
        {
            CurrentPercent++;
        }

        #endregion
    }
}


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

    // consciously not XAML-friendly since Linq Expressions aren't create-set-use
    [Fx.Tag.XamlVisible(false)]
    [DebuggerStepThrough]
    public sealed class LambdaValue<TResult> : CodeActivity<TResult>, IExpressionContainer, IValueSerializableExpression
    {
        Func<ActivityContext, TResult> compiledLambdaValue;
        Expression<Func<ActivityContext, TResult>> lambdaValue;
        Expression<Func<ActivityContext, TResult>> rewrittenTree;

        public LambdaValue(Expression<Func<ActivityContext, TResult>> lambdaValue)
        {
            if (lambdaValue == null)
            {
                throw FxTrace.Exception.ArgumentNull("lambdaValue");
            }
            this.lambdaValue = lambdaValue;
            this.UseOldFastPath = true;
        }

        // this is called via reflection from Microsoft.CDF.Test.ExpressionUtilities.Activities.ActivityUtilities.ReplaceLambdaValuesInActivityTree
        internal Expression LambdaExpression
        {
            get
            {
                return this.lambdaValue;
            }
        }

        protected override void CacheMetadata(CodeActivityMetadata metadata)
        {
            CodeActivityPublicEnvironmentAccessor publicAccessor = CodeActivityPublicEnvironmentAccessor.Create(metadata);

            // We need to rewrite the tree.
            Expression newTree;
            if (ExpressionUtilities.TryRewriteLambdaExpression(this.lambdaValue, out newTree, publicAccessor))
            {
                this.rewrittenTree = (Expression<Func<ActivityContext, TResult>>)newTree;
            }
            else
            {
                this.rewrittenTree = this.lambdaValue;
            }
        }

        protected override TResult Execute(CodeActivityContext context)
        {
            if (this.compiledLambdaValue == null)
            {
                this.compiledLambdaValue = this.rewrittenTree.Compile();
            }
            return this.compiledLambdaValue(context);
        }

        public bool CanConvertToString(IValueSerializerContext context)
        {
            return true;
        }

        public string ConvertToString(IValueSerializerContext context)
        {
            // This workflow contains lambda expressions specified in code.
            // These expressions are not XAML serializable.
            // In order to make your workflow XAML-serializable,
            // use either VisualBasicValue/Reference or ExpressionServices.Convert
            // This will convert your lambda expressions into expression activities.
            throw FxTrace.Exception.AsError(new LambdaSerializationException());
        }
    }
}


text:
/**
 * @page specialevents Special Events
 * @tag core
 * JavaScriptMVC provides a bunch of useful special events.  Find out more info on the left.  The following is a
 * brief summary:
 *
 * ## [jQuery.event.special.default Default Events]
 *
 * Lets you supply default behavior for an event that is preventable
 * with event.preventDefault().  This is extremely useful for providing DOM-like api's for your widgets.
 *
 *     $("#tabs").delegate(".panel","default.open", function(){
 *       $(this).show()
 *     })
 *
 * ## [jQuery.event.special.destroyed Destroyed Events]
 *
 * Know if an element has been removed from the page.
 *
 *     $("#contextMenu").bind("destroyed", function(){
 *       // cleanup
 *       $(document.body).unbind("click.contextMenu");
 *     })
 *
 * ## [jQuery.Drag Drag] and [jQuery.Drop Drop] Events
 *
 * Listen to drag-drop events with event delegation.
 *
 *     $(".item").live("dragover", function(ev, drag){
 *       // let user know that the item can be dropped
 *       $(this).addClass("canDrop");
 *     }).live("dropover", function(ev, drop, drag){
 *       // let user know that the item can be dropped on
 *       $(this).addClass('drop-able')
 *     })
 *
 * ##
 *
 */
steal.plugins('jquery');


text:
import boto3
import travispy
import yaml

from .travis import travis_encrypt as _travis_encrypt
from .iam import credentials_for_new_user, nuke_iam, IAMName

__all__ = [ 'artifact_yaml', 'travis_encrypt', 'iam_credentials', 'iam_nuke', ]

def artifact_yaml(
        repo, pro, github_token, github_owner, s3_bucket,
        aws_region=None, aws_key=None, aws_secret=None, aws_profile=None):
    credentials = iam_credentials(repo, github_owner, s3_bucket, aws_region, aws_key, aws_secret, aws_profile)
    enc_key, enc_secret = travis_encrypt(
            repo, pro, github_token, github_owner,
            (credentials['AccessKeyId'], credentials['SecretAccessKey'],),
            )
    return yaml.safe_dump({
        'key': { 'secure': enc_key.decode('latin-1'), },
        'secret': { 'secure': enc_secret.decode('latin-1'), },
        },
        default_flow_style=False,
        )

def travis_encrypt(repo, pro, github_token, github_owner, strings):
    travis = travispy.TravisPy.github_auth(
            github_token,
            uri=travispy.travispy.PRIVATE if pro else travispy.travispy.PUBLIC,
            )
    repo_slug = '{}/{}'.format(github_owner, repo)
    return (_travis_encrypt(travis, repo_slug, string) for string in strings)

def iam_credentials(
        repo, github_owner, s3_bucket,
        aws_region=None, aws_key=None, aws_secret=None, aws_profile=None):
    iam = boto3.session.Session(
            aws_access_key_id=aws_key,
            aws_secret_access_key=aws_secret,
            region_name=aws_region,
            profile_name=aws_profile,
            ).client('iam')
    return credentials_for_new_user(
            iam,
            '{}__{}__{}'.format(IAMName, github_owner, repo),
            s3_bucket,
            )

def iam_nuke(aws_region=None, aws_key=None, aws_secret=None, aws_profile=None):
    iam = boto3.session.Session(
            aws_access_key_id=aws_key,
            aws_secret_access_key=aws_secret,
            region_name=aws_region,
            profile_name=aws_profile,
            ).client('iam')
    nuke_iam(iam)


text:
if [ ! -d /home/opuser/.ssh ]; then
    mkdir -p /home/opuser/.ssh
    chmod 700 /home/opuser/.ssh
fi

# Fetch public key using HTTP
ATTEMPTS=30
FAILED=0
while [ ! -f /home/opuser/.ssh/authorized_keys ]; do
    curl -f http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/metadata-key 2>/dev/null
    if [ $? -eq 0 ]; then
        cat /tmp/metadata-key >> /home/opuser/.ssh/authorized_keys
        chmod 0600 /home/opuser/.ssh/authorized_keys
        restorecon /home/opuser/.ssh/authorized_keys
        rm -f /tmp/metadata-key
        echo "Successfully retrieved public key from instance metadata"
        echo "*****************"
        echo "AUTHORIZED KEYS"
        echo "*****************"
        cat /home/opuser/.ssh/authorized_keys
        echo "*****************"
    else
        FAILED=`expr $FAILED + 1`
        if [ $FAILED -ge $ATTEMPTS ]; then
            echo "Failed to retrieve public key from instance metadata after $FAILED attempts, quitting"
            break
        fi
            echo "Could not retrieve public key from instance metadata (attempt #$FAILED/$ATTEMPTS), retrying in 5 seconds..."
            sleep 5
    fi
done


text:
DIY door opener

## Motivation
The door to our new office has a traditional key instead of keycard. The door to the building is a keycard. Remembering
to keep a key and using the key is bothersome. Facilities reports that a keycard opener is $3000. Motivated by
[another door opener](http://www.instructables.com/id/Secret-Knock-Detecting-Door-Lock/) and experience using BLE to communicate with [anki](https://github.com/anki/drive-sdk) cars, lets build our own.

## Possible Parts
- http://redbearlab.com/blenano/ (ordered 6 June 2015)
- http://www.adafruit.com/products/1697
- http://www.adafruit.com/products/2487

## Pieces
- Controller to accept BLE authentication
- Actuator to open door
- Protocol to authenticate
- Mechanism to pair phone and opener
- iOS app
- android app

## Protocol
### Pairing
A button on the device and the app must be open (while open app is activley scanning). App confirms. Pairing also records location to use for increasing scan frequency when inactive.

Public key of app is recorded by opener.

### Opening
Initial simplification - require phone app to be open and scan continually while app is open.

The door is opened when the phone is close to the door. Similar to a badge, but it would be more useable if the phone could say in your pocket or bag. Public keys are used by the opener to authenticate the phone.

When the app is open it is actively scanning for openers.

When app is closed scanning can be triggerd by a combination of:
- location (i.e. close to known opener)
- motion (phone taken out of pocket and held to door)
- time window (typical time opener is trigggered)
- polling (simply try to connect every 10-30 seconds)

Depending on energy impact of a poll every 10-30 seconds the phone may be able to detect the opener while the user is
walking to the door. In this case the poll frequency can be increased such that when the target distance is reached there
is no preceived latency.

## Open questions
- How does locking work?
  - Unlock could be based on approach to threashold distance not simply proximity.
  - A second BLE device could be placed in the office to know on what side of the door phone is
- How to prevent energy drain when the door remains in close proximity after opening (i.e. small locked office)

## Possible features
- Allow someone access by sharing key from one phone to another without physical access to lock.
- Administer lock access from phone
- Physicall reset of lock access


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyoSnake.Data
{
    public class HighScore
    {
        public String Name { get; set; }
        public String Score { get; set; }
    }
}


text:
package com.linkedin.pinot.routing.builder;

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

import org.apache.commons.configuration.Configuration;
import org.apache.helix.model.ExternalView;
import org.apache.helix.model.InstanceConfig;

import com.linkedin.pinot.common.utils.CommonConstants;
import com.linkedin.pinot.common.utils.SegmentNameBuilder;
import com.linkedin.pinot.routing.ServerToSegmentSetMap;

public class KafkaHighLevelConsumerBasedRoutingTableBuilder implements RoutingTableBuilder {

  @Override
  public void init(Configuration configuration) {
  }

  @Override
  public List<ServerToSegmentSetMap> computeRoutingTableFromExternalView(String tableName, ExternalView externalView,
      List<InstanceConfig> instanceConfigList) {

    RoutingTableInstancePruner pruner = new RoutingTableInstancePruner(instanceConfigList);

    Set<String> segments = externalView.getPartitionSet();
    List<ServerToSegmentSetMap> routingTable = new ArrayList<ServerToSegmentSetMap>();
    Map<String, Map<String, Set<String>>> groupIdToRouting = new HashMap<String, Map<String, Set<String>>>();
    for (String segment : segments) {
      Map<String, String> instanceMap = externalView.getStateMap(segment);
      for (String instance : instanceMap.keySet()) {
        if (instanceMap.get(instance).equals(CommonConstants.Helix.StateModel.SegmentOnlineOfflineStateModel.OFFLINE)
            || pruner.isInactive(instance)) {
          continue;
        }

        String groupId = SegmentNameBuilder.Realtime.extractGroupIdName(segment);
        if (!groupIdToRouting.containsKey(groupId)) {
          groupIdToRouting.put(groupId, new HashMap<String, Set<String>>());
        }
        if (!groupIdToRouting.get(groupId).containsKey(instance)) {
          groupIdToRouting.get(groupId).put(instance, new HashSet<String>());
        }
        groupIdToRouting.get(groupId).get(instance).add(segment);
      }
    }
    for (Map<String, Set<String>> replicaRouting : groupIdToRouting.values()) {
      routingTable.add(new ServerToSegmentSetMap(replicaRouting));
    }
    return routingTable;
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>cluster</artifactId>
        <groupId>com.barakyesh.common</groupId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.barakyesh.common.cluster</groupId>
    <artifactId>cluster-examples</artifactId>

    <dependencies>
        <dependency>
            <groupId>com.barakyesh.common.cluster</groupId>
            <artifactId>cluster-framework</artifactId>
            <version>1.0.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</project>


text:
.. _usersguide:

============
User's Guide
============

Welcome to the NDPP User's Guide!  This tutorial will guide you through the
essential aspects of using NDPP to convert continuous-energy data in to a
form which can be readily tallied in a Monte Carlo neutron transport code with a
significantly enhanced Figure-of-Merit.

.. toctree::
    :numbered:
    :maxdepth: 3

    install
    input
    utilities
    troubleshoot


text:
var pattern = "/app/";
console.log('blanket pattern',pattern);
require('blanket')({
  // Only files that match the pattern will be instrumented

  pattern: pattern
});


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

import ParseTreeVisitor from '../syntax/ParseTreeVisitor.js';

// Object used as a sentinel. This is thrown to abort visiting the rest of the
// tree.
var foundSentinel = {};

/**
 * This is used to find something in a tree. Extend this class and override
 * the desired visit functions to find what you are looking for. When the tree
 * you are looking for is found set |this.found| to true. This will abort the
 * search of the remaining sub trees.
 */
export class FindVisitor extends ParseTreeVisitor {
  /**
   * @param {ParseTree} tree
   * @param {boolean} keepOnGoing Whether to stop searching after the first
   *     found condition.
   */
  constructor(tree, keepOnGoing) {
    this.found_ = false;
    this.keepOnGoing_ = keepOnGoing;
    try {
      this.visitAny(tree);
    } catch (ex) {
      // This uses an exception to do early exits.
      if (ex !== foundSentinel)
        throw ex;
    }
  }

  /**
   * Whether the searched for tree was found. Setting this to true aborts the
   * search.
   * @type {boolean}
   */
  get found() {
    return this.found_;
  }

  set found(v) {
    if (v) {
      this.found_ = true;
      if (!this.keepOnGoing_)
        throw foundSentinel;
    }
  }
}


text:
<?php

namespace Ben\MyCarParkBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Ben\MyCarParkBundle\Entity\Driver;
use Ben\MyCarParkBundle\Form\DriverType;

/**
 * Driver controller.
 *
 * @Route("/driver")
 */
class DriverController extends Controller
{

    /**
     * Lists all Driver entities.
     *
     * @Route("/", name="driver")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('BenMyCarParkBundle:Driver')->findAll();

        return array(
            'entities' => $entities,
        );
    }

    /**
     * Creates a new Driver entity.
     *
     * @Route("/", name="driver_create")
     * @Method("POST")
     * @Template("BenMyCarParkBundle:Driver:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity = new Driver();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('driver_show', array('id' => $entity->getId())));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Creates a form to create a Driver entity.
     *
     * @param Driver $entity The entity
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createCreateForm(Driver $entity)
    {
        $form = $this->createForm(new DriverType(), $entity, array(
            'action' => $this->generateUrl('driver_create'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Create'));

        return $form;
    }

    /**
     * Displays a form to create a new Driver entity.
     *
     * @Route("/new", name="driver_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Driver();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Driver entity.
     *
     * @Route("/{id}", name="driver_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BenMyCarParkBundle:Driver')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Driver entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Displays a form to edit an existing Driver entity.
     *
     * @Route("/{id}/edit", name="driver_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BenMyCarParkBundle:Driver')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Driver entity.');
        }

        $editForm = $this->createEditForm($entity);
        $deleteForm = $this->createDeleteForm($id);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
    * Creates a form to edit a Driver entity.
    *
    * @param Driver $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Driver $entity)
    {
        $form = $this->createForm(new DriverType(), $entity, array(
            'action' => $this->generateUrl('driver_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }

    /**
     * Edits an existing Driver entity.
     *
     * @Route("/{id}", name="driver_update")
     * @Method("PUT")
     * @Template("BenMyCarParkBundle:Driver:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BenMyCarParkBundle:Driver')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Driver entity.');
        }

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('driver_edit', array('id' => $id)));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
        );
    }

    /**
     * Deletes a Driver entity.
     *
     * @Route("/{id}", name="driver_delete")
     * @Method("DELETE")
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('BenMyCarParkBundle:Driver')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Driver entity.');
            }

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('driver'));
    }

    /**
     * Creates a form to delete a Driver entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder()
            ->setAction($this->generateUrl('driver_delete', array('id' => $id)))
            ->setMethod('DELETE')
            ->add('submit', 'submit', array('label' => 'Delete'))
            ->getForm()
        ;
    }
}


text:
package com.gaecompat.javax.swing.text;

public interface DocumentFilter {

}


text:
<?php
namespace helpers;

use \App;

class Grid extends BaseHtml
{
    public static function begin($datas)
    {
        $model = $datas['model'];
        $items = $datas['items'];

        $result = '

';
        foreach ($items as $head) {
            if (is_array($head)) {
                if (array_key_exists('attribute', $head) && $head['attribute'] == ':serialColumn') {
                    if (array_key_exists('label', $head)) {
                        $result .= '' . $head['label'] . '	';
                    } else {
                        $result .= '#	';
                    }
                } elseif (array_key_exists('attribute', $head) && $head['attribute'] == ':actionColumn') {
                    if (array_key_exists('label', $head)) {
                        $result .= '' . $head['label'] . '	';
                    } else {
                        $result .= 'Actions	';
                    }
                } else {
                    if (array_key_exists('label', $head)) {
                        $result .= '' . $head['label'] . '	';
                    } else {
                        $result .= '' . $model->attributeLabel($head) . '	';
                    }
                }
            } else {
                $result .= '' . $model->attributeLabel($head) . '	';
            }
        }
        $result .= '

';
        foreach ($model->all() as $serial => $row) {
            $result .= '
';
            foreach ($items as $data) {
                if (is_array($data)) {
                    if (array_key_exists('attribute', $data) && $data['attribute'] == ':serialColumn') {
                        $result .= '' . ($serial + 1) . '	';
                    } elseif (array_key_exists('attribute', $data) && $data['attribute'] == ':actionColumn') {
                        $result .= '' . static::actionColumn($row, $data['parameter']) . '	';
                    } elseif (array_key_exists('value', $data)) {
                        $result .= '' . $data['value']($row) . '	';
                    } else {
                        $result .= '' . $row->$data['attribute'] . '	';
                    }
                } else {
                    $result .= '' . $row->$data . '	';
                }
            }
            $result .= '
';
        }
        $result .= '

';
        return $result;
    }

    public static function actionColumn($model, $param)
    {
        return
            '$param]) . '">
            $param]) . '">
            $param]) . '">';
    }
}


text:
@implementation NSDictionary (METAdditions)

+ (instancetype)dictionaryWithObject:(id)object forKeys:(NSArray *)keys {
  NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:keys.count];
  for (id<NSCopying> key in keys) {
    dictionary[key] = object;
  }
  return dictionary;
}

- (NSDictionary *)dictionaryByAddingEntriesFromDictionary:(NSDictionary *)otherDictionary {
  NSMutableDictionary *dictionary = [self mutableCopy];
  [dictionary addEntriesFromDictionary:otherDictionary];
  return dictionary;
}

- (NSDictionary *)dictionaryByAddingObject:(id)object forKey:(id<NSCopying>)key {
  NSMutableDictionary *dictionary = [self mutableCopy];
  dictionary[key] = object;
  return dictionary;
}

- (NSDictionary *)dictionaryByRemovingObjectForKey:(id<NSCopying>)key {
  NSMutableDictionary *dictionary = [self mutableCopy];
  [dictionary removeObjectForKey:key];
  return dictionary;
}

- (NSDictionary *)dictionaryByRemovingObjectsForKeys:(NSArray *)keys {
  NSMutableDictionary *dictionary = [self mutableCopy];
  [dictionary removeObjectsForKeys:keys];
  return dictionary;
}

- (NSDictionary *)fieldsByApplyingChangedFields:(NSDictionary *)changedFields {
  NSMutableDictionary *fields = [self mutableCopy];
  NSArray *clearedFieldNames = [changedFields allKeysForObject:[NSNull null]];
  [fields addEntriesFromDictionary:changedFields];
  [fields removeObjectsForKeys:clearedFieldNames];
  return fields;
}

@end


text:
<include file="Public/min-header" />

        {$first.title}
        <volist name="lists" id="list">

{$list.title}

        </volist>


text:
package gw.internal.xml.xsd.typeprovider.schema;

import gw.internal.xml.xsd.typeprovider.XmlSchemaIndex;
import gw.lang.reflect.LocationInfo;

import java.util.Map;

public final class XmlSchemaEnumerationFacet extends XmlSchemaFacet<XmlSchemaEnumerationFacet> {

  private final Map<String, String> _namespaceContext;

  public XmlSchemaEnumerationFacet( XmlSchemaIndex schemaIndex, LocationInfo locationInfo, String value, Map<String,String> namespaceContext ) {
    super( schemaIndex, locationInfo, value );
    _namespaceContext = namespaceContext;
  }

  public Map<String,String> getNamespaceContext() {
    return _namespaceContext;
  }

  @Override
  protected XmlSchemaEnumerationFacet copy( XmlSchemaIndex schemaIndex ) throws UnsupportedOperationException {
    return new XmlSchemaEnumerationFacet( schemaIndex, getLocationInfo(), getValue(), _namespaceContext );
  }

}


text:
egame.define("InputEnabled", ["Component"], function(Component) {
    /**
     * 给显示对象添加输入功能
     *
     * @class
     */
    egame.Component.InputEnabled = function() {};

    /**
     * 初始化函数
     */
    egame.Component.InputEnabled.init = function() {
        Object.defineProperty(this, 'inputEnabled', this.inputEnabled);
    }

    egame.Component.InputEnabled.prototype = {

        /**
         * 显示对象的输入处理器
         * @property {egame.InputHandler|null} input
         */
        input: null,

        /**
         * 设置为true后,具有接受输入的功能,这个值设置的时机一定是显示对象已经被add到stage上面了
         * @property {boolean} inputEnabled
         */
        inputEnabled: {

            get: function() {

                return (this.input && this.input.enabled);

            },

            set: function(value) {

                if (value) {
                    if (this.input === null) {
                        this.input = new egame.InputHandler(this);
                        this.input.start();
                    } else if (this.input && !this.input.enabled) {
                        this.input.start();
                    }
                } else {
                    if (this.input && this.input.enabled) {
                        this.input.stop();
                    }
                }

            }

        }

    };
    return egame.Component.InputEnabled;
});


text:
<?php

namespace Oro\Bundle\DataAuditBundle\Tests\Unit\Loggable;

use Oro\Bundle\DataAuditBundle\Loggable\AuditEntityMapper;
use Oro\Bundle\UserBundle\Entity\User;

class AuditEntityMapperTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var AuditEntityMapper
     */
    protected $mapper;

    protected function setUp()
    {
        $this->mapper = new AuditEntityMapper();
    }

    protected function tearDown()
    {
        unset($this->mapper);
    }

    public function testClasses()
    {
        $this->mapper->addAuditEntryClass('Oro\Bundle\UserBundle\Entity\User', '\stdClass');
        $this->assertEquals(
            '\stdClass',
            $this->mapper->getAuditEntryClass($this->getUser())
        );

        $this->mapper->addAuditEntryFieldClass('Oro\Bundle\UserBundle\Entity\User', '\stdClass');
        $this->assertEquals(
            '\stdClass',
            $this->mapper->getAuditEntryFieldClass($this->getUser())
        );
    }

    public function testOverrideClasses()
    {
        $this->mapper->addAuditEntryClass('Oro\Bundle\UserBundle\Entity\User', '\stdClass');
        $this->assertEquals(
            '\stdClass',
            $this->mapper->getAuditEntryClass($this->getUser())
        );

        $this->mapper->addAuditEntryClass('Oro\Bundle\UserBundle\Entity\User', '\stdClass2');
        $this->assertEquals(
            '\stdClass2',
            $this->mapper->getAuditEntryClass($this->getUser())
        );
    }

    /**
     * @expectedException \InvalidArgumentException
     * @expectedExceptionMessage Audit entry not found for "Oro\Bundle\UserBundle\Entity\User"
     */
    public function testAuditEntryFailed()
    {
        $this->mapper->getAuditEntryClass($this->getUser());
    }

    /**
     * @expectedException \InvalidArgumentException
     * @expectedExceptionMessage Audit entry field not found for "Oro\Bundle\UserBundle\Entity\User"
     */
    public function testAuditEntryFieldFailed()
    {
        $this->mapper->getAuditEntryFieldClass($this->getUser());
    }

    /**
     * @return User
     */
    protected function getUser()
    {
        return new User();
    }
}


text:
package.path = package.path .. ";../?.lua" -- to load denver.lua
local Synthesizer = require 'Synthesizer'

local synth, keyboard_bind
local current_octave = 4
function love.load()
    synth = Synthesizer:new('square')

    keyboard_bind = {q='C', z='C#', s='D', e='D#', d='E', f='F',
                     t='F#', g='G', y='G#', h='A', u='A#', j='B'}
end

function love.keypressed(key)
    if keyboard_bind[key] then
        synth:playNote(keyboard_bind[key]..current_octave)
    elseif key == 'up' then
        synth:stopNotesOnOctave(current_octave)
        current_octave = current_octave + 1
    elseif key == 'down' then
        synth:stopNotesOnOctave(current_octave)
        current_octave = current_octave - 1
    end
end

function love.keyreleased(key)
    if keyboard_bind[key] then
        synth:stopNote(keyboard_bind[key]..current_octave)
    end
end

-- show informations
function love.draw()
    love.graphics.printf('LOVE synthesizer', 0, 0, 320, 'center')
    love.graphics.printf('QZSEDFTGYHJ to play, and up/down to change octaves',
                          0, 30, 320, 'center')
end