text:
import React from 'react';
import PropTypes from 'prop-types';
import times from '../../../utils/operators/times';

export const LongTextContent = props => {
  const pages = times(props.numOfPages, (x, i) => (

        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam facilisis
        molestie magna vitae pellentesque. Ut elementum accumsan nibh, ut
        faucibus velit. Vestibulum at mollis justo. Vestibulum ante ipsum primis
        in faucibus orci luctus et ultrices posuere cubilia Curae; In sapien
        odio, hendrerit a iaculis ut, venenatis in ligula. Vestibulum suscipit
        egestas augue, nec mattis est mollis et. Curabitur id eleifend leo.
        Fusce tempor efficitur commodo.

        Cras porta augue non erat imperdiet ornare. Aliquam aliquam elit nec
        erat ultricies, ac blandit purus efficitur. Suspendisse sagittis id nibh
        eget pulvinar. Phasellus congue ultricies interdum. Mauris vel dolor at
        diam feugiat imperdiet feugiat varius eros. Aenean accumsan interdum
        massa vitae semper. Maecenas tincidunt ut lectus a fringilla. In
        eleifend ante in tellus consequat vestibulum. Fusce lacinia turpis quis
        turpis semper venenatis. Donec faucibus felis nisi, non maximus augue
        mattis ac. Ut erat sem, finibus vel gravida sed, hendrerit ac nibh.
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam et
        egestas lectus. Ut vitae est maximus, viverra sem et, pharetra diam.

        Vivamus quis nunc maximus elit ullamcorper ullamcorper non sit amet
        metus. Mauris consequat tortor ac ante vestibulum lacinia. Vestibulum
        molestie risus purus, nec faucibus odio iaculis vitae. Integer erat
        magna, interdum et venenatis vel, aliquet id nunc. Vivamus nec pharetra
        dui. Nam sed quam ultricies, molestie dui a, tempus felis. Pellentesque
        tincidunt tortor eu tempus porttitor. Nam vitae dapibus lacus, a gravida
        ligula. Vestibulum eget pulvinar mauris. Vestibulum ante ipsum primis in
        faucibus orci luctus et ultrices posuere cubilia Curae; In hac habitasse
        platea dictumst. Sed ultrices bibendum urna, elementum condimentum est
        faucibus et. Aenean a hendrerit ipsum. Sed aliquam ligula sed magna
        commodo, sit amet fringilla urna scelerisque. Phasellus at felis sed
        neque euismod tincidunt vitae id leo.

        Donec vel felis id mauris iaculis posuere eget eu purus. Duis id libero
        dolor. Vivamus nec ornare nunc. Ut efficitur quis sem quis consectetur.
        Suspendisse et justo ac sem rhoncus posuere et eget quam. Phasellus sit
        amet viverra nulla, vel tincidunt ante. Duis nec commodo lorem.

        Proin orci nisl, facilisis ut efficitur sit amet, sollicitudin et metus.
        Nunc dictum laoreet convallis. Praesent iaculis consequat elit non
        consectetur. In risus ex, efficitur non tempor ac, suscipit ut nisi.
        Etiam vel vehicula eros. Sed molestie, metus sed tristique fringilla,
        tortor metus facilisis justo, sit amet blandit dolor urna eget diam.
        Etiam nec lorem cursus nisl finibus venenatis. Ut consequat dui non
        pharetra fringilla. Nulla facilisi.
        {i < props.numOfPages - 1 && [
,
]}

  ));

  return
{pages}
;
};

LongTextContent.defaultProps = {
  numOfPages: 5,
};

export default class SomeContentComponent2 extends React.Component {
  static propTypes = {
    shortContent: PropTypes.bool,
    stretchVertically: PropTypes.bool,
  };

  getBody() {
    return;
  }

  render() {
    return (

        <LongTextContent numOfPages={this.props.shortContent ? 1 : undefined} />

    );
  }
}


text:
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
Loader::model('form','sixeightforms');
Loader::model('field','sixeightforms');
Loader::model('answer_set','sixeightforms');
Loader::model('form_style','sixeightforms');

class DashboardSixeightformsStylesController extends Controller {
	function view() {
		$styles = sixeightformstyle::getAll();
		$this->set('styles',$styles);
	}

	public function createStyle() {
		$style = sixeightformstyle::create($_POST['name']);

		if($_POST['useTemplate'] == '1') {
			$style->setSelector('form.sem-form','','The form element',true);
			$style->setSelector('div.sem-field-container','padding: 5px 0;','Element that is wrapped around each label and field',true);
			$style->setSelector('span.sem-required-indicator','','Wrapper for required indicator',true);
			$style->setSelector('label.sem-label',"display:block;\nmargin-top:4px;",'Form labels (except for checkboxes and radio button)',true);
			$style->setSelector('fieldset.sem-fieldset',"border:0;\npadding:0;\nmargin:0;",'Checkbox/radio button fieldset',true);
			$style->setSelector('legend.sem-legend',"display:block;\npadding:0;\nmargin:0;\nvertical-align:top;\nmargin-top:4px;\nwhite-space:normal;",'Legend (field label) for checkbox/radio button fieldsets',true);
			$style->setSelector('input.sem-text','margin:2px;','Text input boxes',true);
			$style->setSelector('textarea.sem-textarea','margin:2px;','Textarea input boxes',true);
			$style->setSelector('select.sem-select','margin:2px;','Select (dropdown) boxes',true);
			$style->setSelector('option.sem-option','','Option within select boxes',true);
			$style->setSelector('label.sem-radio-button-label',"display:block;\nclear:both;\nmargin-left:15px;",'Radio button option labels',true);
			$style->setSelector('input.sem-radio-button','margin:2px;','Radio buttons',true);
			$style->setSelector('label.sem-checkbox-label',"display:block;\nclear:both;\nmargin-left:15px;",'Checkbox option labels',true);
			$style->setSelector('input.sem-checkbox','margin:2px;','Checkboxes',true);
			$style->setSelector('input.sem-date','margin:2px;','Date input boxes',true);
			$style->setSelector('div.sem-file','','Browse button for file uploader',true);
			$style->setSelector('a.sem-file-selector','','Link to file manager',true);
			$style->setSelector('textarea.sem-wysiwyg','','WYSIWYG texatrea',true);
			$style->setSelector('input.sem-submit','margin:2px;','Submit Button',true);
		} else {
			$style->setSelector('form.sem-form','','The form element',true);
			$style->setSelector('div.sem-field-container','','Element that is wrapped around each label and field',true);
			$style->setSelector('span.sem-required-indicator','','Wrapper for required indicator',true);
			$style->setSelector('label.sem-label','','Form labels (except for checkboxes and radio button)',true);
			$style->setSelector('fieldset.sem-fieldset','','Checkbox/radio button fieldset',true);
			$style->setSelector('legend.sem-legend','','Legend (field label) for checkbox/radio button fieldsets',true);
			$style->setSelector('input.sem-text','','Text input boxes',true);
			$style->setSelector('textarea.sem-textarea','','Textarea input boxes',true);
			$style->setSelector('select.sem-select','','Select (dropdown) boxes',true);
			$style->setSelector('option.sem-option','','Option within select boxes',true);
			$style->setSelector('label.sem-radio-button-label','','Radio button option labels',true);
			$style->setSelector('input.sem-radio-button','','Radio buttons',true);
			$style->setSelector('label.sem-checkbox-label','','Checkbox option labels',true);
			$style->setSelector('input.sem-checkbox','','Checkboxes',true);
			$style->setSelector('input.sem-date','','Date input boxes',true);
			$style->setSelector('div.sem-file','','Browse button for file uploader',true);
			$style->setSelector('a.sem-file-selector','','Link to file manager',true);
			$style->setSelector('textarea.sem-wysiwyg','','WYSIWYG texatrea',true);
			$style->setSelector('input.sem-submit','','Submit Button',true);
		}

		$style->setSelector('','','Custom classes or IDs',true);

		$this->redirect('/dashboard/sixeightforms/styles/-/loadStyle?sID=' . $style->sID);
	}

	public function loadStyle() {
		$style = sixeightformstyle::getByID(intval($_GET['sID']));
		$this->set('style',$style);
	}

	public function saveStyle() {
		foreach($_POST['selector-css'] as $ssID => $css) {
			sixeightformstyle::setSelectorByID($ssID,$css);
		}
		$this->redirect('/dashboard/sixeightforms/styles/-/loadStyle?sID=' . intval($_POST['sID']));
	}

	public function deleteStyle() {
		sixeightformstyle::delete(intval($_GET['sID']));
		$this->redirect('/dashboard/sixeightforms/styles/-/deleteStyleSuccess');
	}

	public function deleteStyleSuccess() {
		$this->set('message',t('The style has been deleted.'));
		$this->view();
	}

	public function duplicateStyle() {
		$style = sixeightformstyle::getByID(intval($_GET['sID']));
		$style->duplicate();
		$this->redirect('/dashboard/sixeightforms/styles/-/duplicateStyleSuccess');
	}

	public function duplicateStyleSuccess() {
		$this->set('message',t('The style has been duplicated.'));
		$this->view();
	}

}

redpajama_set_name: RedPajamaGithub


text:
Pattern: Missing use of `const`

Issue: -

## Description

Const declarations are more hot-reload friendly and allow to use const
constructors if an instantiation references this declaration.

Example of **correct** code:
```dart
const o = const [];

class A {
 static const o = const [];
}
```

Example of **incorrect** code:
```dart
final o = const [];

class A {
 static final o = const [];
}
```

## Further Reading

* [Linter for Dart - prefer_const_declarations](https://dart-lang.github.io/linter/lints/prefer_const_declarations.html)


text:
robotics assignents by sarah

photon app

webpage

prep photon

light on

flex servo program

motor driver program

ifttt program

   final project


text:
using namespace std::literals;

BOOST_FIXTURE_TEST_SUITE(base64_tests, BasicTestingSetup)

BOOST_AUTO_TEST_CASE(base64_testvectors)
{
    static const std::string vstrIn[]  = {"","f","fo","foo","foob","fooba","foobar"};
    static const std::string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"};
    for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
    {
        std::string strEnc = EncodeBase64(vstrIn[i]);
        BOOST_CHECK_EQUAL(strEnc, vstrOut[i]);
        std::string strDec = DecodeBase64(strEnc);
        BOOST_CHECK_EQUAL(strDec, vstrIn[i]);
    }

    // Decoding strings with embedded NUL characters should fail
    bool failure;
    (void)DecodeBase64("invalid\0"s, &failure);
    BOOST_CHECK(failure);
    (void)DecodeBase64("nQB/pZw="s, &failure);
    BOOST_CHECK(!failure);
    (void)DecodeBase64("nQB/pZw=\0invalid"s, &failure);
    BOOST_CHECK(failure);
    (void)DecodeBase64("nQB/pZw=invalid\0"s, &failure);
    BOOST_CHECK(failure);
}

BOOST_AUTO_TEST_SUITE_END()


text:
import React, { PropTypes, Component } from "react";
import { connectToStores } from "fluxible-addons-react";
import { NavLink } from "fluxible-router";

import Logo from "../components/Logo";

import features from "../constants/features";
import LocaleSwitcher from "../components/LocaleSwitcher";
import { FormattedMessage } from "../utils/IntlComponents";

if (process.env.BROWSER) {
  require("../style/NavBar.scss");
}

@connectToStores([], (context) =>
  ({ route: context.getStore("RouteStore").getCurrentRoute() })
)
class NavBar extends Component {

  static PropTypes = {
    route: PropTypes.object.isRequired
  }

  render() {
    const { route } = this.props;
    const currentFeature = route ? route.getIn(["params", "feature"]) : null;
    return (

          <NavLink href="/">
            <Logo />
          </NavLink>

          {
            features.map(feature => {
              let className = "NavBar-link";

              if (currentFeature === feature) {
                className = `${className} ${className}--selected`;
              }

              return (
                <NavLink
                  key={ feature }
                  className={ className }
                  routeName="featured"
                  navParams={ {feature: feature} }>
                  <FormattedMessage message={ `features.${feature}` } />
                </NavLink>
              );
            })
          }

          <LocaleSwitcher />

    );
  }

}

export default NavBar;


text:
'use strict';
/**
 * @fileOverview Storage Client Provider
 * @module sal/ClientProvider
 */
 module.exports = function(mm) {
  var qq    = mm.check(mm.Q);
  //--------------------------------------------------------------------------
  /**
   * @summary **Provides storage operations over the session socket**
   * @description
   * A ClientProvider is plugged into client based StorageEngine which is
   * running in a browser or node client that is connected to a mMeddle
   * server over a socket based ClientSession.
   * @constructor
   * @param {StorageEngine} engine context for this engine
   * @param {ClientSession} cs the current client session
   * @returns {ClientProvider} the new ClientProvider
   */
  function ClientProvider(engine, cs) {
    var self = this;
    self.engine = mm.check(engine);
    self.cs     = mm.check(cs);
  }

  /**
   * @summary **registers the Client Remote StorageProvider**
   * @description
   * Provides storage operations over sockets to the mMeddle server.
   * @static
   * @param {StorageEngine} engine the current storage engine
   * @param {ClientSession} cs the current client session
   */
  ClientProvider.register = function registerClientProvider(engine, cs) {
    engine.clientProvider = new ClientProvider(engine, cs);
  }

  /**
   * @summary **initialize the remote storage provider**
   * @return {Promise} resolves when successful.
   */
  ClientProvider.prototype.initialize =
  function initialize(op) {
    var self = this;
    /* istanbul ignore else */
    if (!self.initialized) {
      self.initialized = qq(true);
    }
    return self.initialized;
  }

  /**
   * @summary **perform a remote storage operation**
   * @param {StorageEngine} op the operation to perform.
   */
  ClientProvider.prototype.perform =
  function perform(op) {
    var self = this;
    // Pass only the relevant request parts of the op.
    var simpleOp = { op: op.op, path: op.path, content: op.content };
    var rsRequired = op.path.callback ? op.path.callback : true;
    var tmt = op.path.timeout ? op.path.timeout : null;
    return self.cs.rq('clientStorage', simpleOp, rsRequired, tmt)
    .then(function (rs) {
      rs.content._elapsed = rs._elapsed;
      op.deferred.resolve(rs.content);
    },
    function (e) {
      op.deferred.reject(e);
      return;
    });
  }

  return ClientProvider;
}


text:
#import "ORKTouchAbilityGestureRecoginzerEvent.h"
#import "ORKHelpers_Internal.h"

#pragma mark - ORKTouchAbilityGestureRecoginzerEvent

@interface ORKTouchAbilityGestureRecoginzerEvent ()

@property (nonatomic, assign) NSTimeInterval timestamp;
@property (nonatomic, assign) UIGestureRecognizerState state;
@property (nonatomic, copy) NSArray<NSNumber *> *allowedTouchTypes;
@property (nonatomic, assign) CGPoint locationInWindow;
@property (nonatomic, assign) NSUInteger numberOfTouches;
@property (nonatomic, copy) NSDictionary<NSNumber *, NSValue *> *locationInWindowOfTouchAtIndex;

@end

@implementation ORKTouchAbilityGestureRecoginzerEvent

+ (BOOL)supportsSecureCoding {
    return YES;
}

- (void)encodeWithCoder:(NSCoder *)aCoder {
    ORK_ENCODE_DOUBLE(aCoder, timestamp);
    ORK_ENCODE_ENUM(aCoder, state);
    ORK_ENCODE_OBJ(aCoder, allowedTouchTypes);
    ORK_ENCODE_CGPOINT(aCoder, locationInWindow);
    ORK_ENCODE_INTEGER(aCoder, numberOfTouches);
    ORK_ENCODE_OBJ(aCoder, locationInWindowOfTouchAtIndex);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super init];
    if (self) {
        ORK_DECODE_DOUBLE(aDecoder, timestamp);
        ORK_DECODE_ENUM(aDecoder, state);
        ORK_DECODE_OBJ(aDecoder, allowedTouchTypes);
        ORK_DECODE_CGPOINT(aDecoder, locationInWindow);
        ORK_DECODE_INTEGER(aDecoder, numberOfTouches);
        ORK_DECODE_OBJ(aDecoder, locationInWindowOfTouchAtIndex);
    }
    return self;
}

- (instancetype)initWithGestureRecognizer:(UIGestureRecognizer *)recognizer {
    self = [super init];
    if (self) {
        self.timestamp = [[NSDate date] timeIntervalSince1970];
        self.state = recognizer.state;
        self.allowedTouchTypes = recognizer.allowedTouchTypes;
        self.locationInWindow = [recognizer locationInView:nil];
        self.numberOfTouches = recognizer.numberOfTouches;

        if (recognizer.numberOfTouches == 0) {
            self.locationInWindowOfTouchAtIndex = @{};
        } else {
            NSMutableDictionary *dict = @{}.mutableCopy;
            for (NSUInteger i = 0; i < recognizer.numberOfTouches; i++) {
                CGPoint location = [recognizer locationOfTouch:i inView:nil];
                dict[@(i)] = [NSValue valueWithCGPoint:location];
            }
            self.locationInWindowOfTouchAtIndex = [dict copy];
        }
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityGestureRecoginzerEvent *event = [[[self class] allocWithZone:zone] init];
    event.timestamp = self.timestamp;
    event.state = self.state;
    event.allowedTouchTypes = [self.allowedTouchTypes copy];
    event.locationInWindow = self.locationInWindow;
    event.numberOfTouches = self.numberOfTouches;
    event.locationInWindowOfTouchAtIndex = [self.locationInWindowOfTouchAtIndex copy];
    return event;
}

- (BOOL)isEqual:(id)object {

    if ([self class] != [object class]) {
        return NO;
    }

    __typeof(self) castObject = object;

    return ((self.timestamp == castObject.timestamp) &&
            (self.state == castObject.state) &&
            ORKEqualObjects(self.allowedTouchTypes, castObject.allowedTouchTypes) &&
            CGPointEqualToPoint(self.locationInWindow, castObject.locationInWindow) &&
            self.numberOfTouches == castObject.numberOfTouches &&
            ORKEqualObjects(self.locationInWindowOfTouchAtIndex, castObject.locationInWindowOfTouchAtIndex));
}

- (NSArray<NSNumber *> *)allowedTouchTypes {
    if (!_allowedTouchTypes) {
        _allowedTouchTypes = @[];
    }
    return _allowedTouchTypes;
}

- (NSDictionary<NSNumber *,NSValue *> *)locationInWindowOfTouchAtIndex {
    if (!_locationInWindowOfTouchAtIndex) {
        _locationInWindowOfTouchAtIndex = @{};
    }
    return _locationInWindowOfTouchAtIndex;
}

- (NSString *)description {
    NSString *stateString;
    switch (self.state) {
        case UIGestureRecognizerStatePossible:  stateString = @"possible";  break;
        case UIGestureRecognizerStateBegan:     stateString = @"began";     break;
        case UIGestureRecognizerStateChanged:   stateString = @"changed";   break;
        case UIGestureRecognizerStateEnded:     stateString = @"ended";     break;
        case UIGestureRecognizerStateFailed:    stateString = @"failed";    break;
        case UIGestureRecognizerStateCancelled: stateString = @"cancelled"; break;
    }

    return [NSString stringWithFormat:@"<%@: %p; state: %@; numberOfTouches: %@; location: (%@, %@)>", self.class.description, self, stateString, @(self.numberOfTouches), @(self.locationInWindow.x), @(self.locationInWindow.y)];
}

@end

#pragma mark - ORKTouchAbilityTapGestureRecoginzerEvent

@interface ORKTouchAbilityTapGestureRecoginzerEvent ()

@property (nonatomic, assign) NSUInteger numberOfTapsRequired;
@property (nonatomic, assign) NSUInteger numberOfTouchesRequired;

@end

@implementation ORKTouchAbilityTapGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_INTEGER(aCoder, numberOfTapsRequired);
    ORK_ENCODE_INTEGER(aCoder, numberOfTouchesRequired);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_INTEGER(aDecoder, numberOfTapsRequired);
        ORK_DECODE_INTEGER(aDecoder, numberOfTouchesRequired);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityTapGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.numberOfTapsRequired = self.numberOfTapsRequired;
    event.numberOfTouchesRequired = self.numberOfTouchesRequired;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.numberOfTapsRequired == castObject.numberOfTapsRequired &&
            self.numberOfTouchesRequired == castObject.numberOfTouchesRequired);
}

- (instancetype)initWithTapGestureRecognizer:(UITapGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.numberOfTapsRequired = recognizer.numberOfTapsRequired;
        self.numberOfTouchesRequired = recognizer.numberOfTouchesRequired;
    }
    return self;
}

@end

#pragma mark - ORKTouchAbilityLongPressGestureRecoginzerEvent

@interface ORKTouchAbilityLongPressGestureRecoginzerEvent ()

@property (nonatomic, assign) NSUInteger numberOfTapsRequired;
@property (nonatomic, assign) NSUInteger numberOfTouchesRequired;
@property (nonatomic, assign) NSTimeInterval minimumPressDuration;
@property (nonatomic, assign) CGFloat allowableMovement;

@end

@implementation ORKTouchAbilityLongPressGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_INTEGER(aCoder, numberOfTapsRequired);
    ORK_ENCODE_INTEGER(aCoder, numberOfTouchesRequired);
    ORK_ENCODE_ENUM(aCoder, minimumPressDuration);
    ORK_ENCODE_DOUBLE(aCoder, allowableMovement);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_INTEGER(aDecoder, numberOfTapsRequired);
        ORK_DECODE_INTEGER(aDecoder, numberOfTouchesRequired);
        ORK_DECODE_ENUM(aDecoder, minimumPressDuration);
        ORK_DECODE_DOUBLE(aDecoder, allowableMovement);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityLongPressGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.numberOfTapsRequired = self.numberOfTapsRequired;
    event.numberOfTouchesRequired = self.numberOfTouchesRequired;
    event.minimumPressDuration = self.minimumPressDuration;
    event.allowableMovement = self.allowableMovement;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.numberOfTapsRequired == castObject.numberOfTapsRequired &&
            self.numberOfTouchesRequired == castObject.numberOfTouchesRequired &&
            self.minimumPressDuration == castObject.minimumPressDuration &&
            self.allowableMovement == castObject.allowableMovement);
}

- (instancetype)initWithLongPressGestureRecognizer:(UILongPressGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.numberOfTapsRequired = recognizer.numberOfTapsRequired;
        self.numberOfTouchesRequired = recognizer.numberOfTouchesRequired;
        self.minimumPressDuration = recognizer.minimumPressDuration;
        self.allowableMovement = recognizer.allowableMovement;
    }
    return self;
}

@end

#pragma mark - ORKTouchAbilityPanGestureRecoginzerEvent

@interface ORKTouchAbilityPanGestureRecoginzerEvent ()

@property (nonatomic, assign) NSUInteger minimumNumberOfTouches;
@property (nonatomic, assign) NSUInteger maximumNumberOfTouches;
@property (nonatomic, assign) CGPoint velocityInWindow;

@end

@implementation ORKTouchAbilityPanGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_INTEGER(aCoder, minimumNumberOfTouches);
    ORK_ENCODE_INTEGER(aCoder, maximumNumberOfTouches);
    ORK_ENCODE_CGPOINT(aCoder, velocityInWindow);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_INTEGER(aDecoder, minimumNumberOfTouches);
        ORK_DECODE_INTEGER(aDecoder, maximumNumberOfTouches);
        ORK_DECODE_CGPOINT(aDecoder, velocityInWindow);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityPanGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.minimumNumberOfTouches = self.minimumNumberOfTouches;
    event.maximumNumberOfTouches = self.maximumNumberOfTouches;
    event.velocityInWindow = self.velocityInWindow;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.minimumNumberOfTouches == castObject.minimumNumberOfTouches &&
            self.maximumNumberOfTouches == castObject.maximumNumberOfTouches &&
            CGPointEqualToPoint(self.velocityInWindow, castObject.velocityInWindow));
}

- (instancetype)initWithPanGestureRecognizer:(UIPanGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.minimumNumberOfTouches = recognizer.minimumNumberOfTouches;
        self.maximumNumberOfTouches = recognizer.maximumNumberOfTouches;
        self.velocityInWindow = [recognizer velocityInView:nil];
    }
    return self;
}

@end

#pragma mark - ORKTouchAbilityPanGestureRecoginzerEvent

@interface ORKTouchAbilitySwipeGestureRecoginzerEvent ()

@property (nonatomic, assign) NSUInteger numberOfTouchesRequired;
@property (nonatomic, assign) UISwipeGestureRecognizerDirection direction;

@end

@implementation ORKTouchAbilitySwipeGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_INTEGER(aCoder, numberOfTouchesRequired);
    ORK_ENCODE_ENUM(aCoder, direction);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_INTEGER(aDecoder, numberOfTouchesRequired);
        ORK_DECODE_ENUM(aDecoder, direction);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilitySwipeGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.numberOfTouchesRequired = self.numberOfTouchesRequired;
    event.direction = self.direction;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.numberOfTouchesRequired == castObject.numberOfTouchesRequired &&
            self.direction == castObject.direction);
}

- (instancetype)initWithSwipeGestureRecognizer:(UISwipeGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.numberOfTouchesRequired = recognizer.numberOfTouchesRequired;
        self.direction = recognizer.direction;
    }
    return self;
}

@end

#pragma mark - ORKTouchAbilitySwipeGestureRecoginzerEvent

@interface ORKTouchAbilityPinchGestureRecoginzerEvent ()

@property (nonatomic, assign) CGFloat scale;
@property (nonatomic, assign) CGFloat velocity;

@end

@implementation ORKTouchAbilityPinchGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_DOUBLE(aCoder, scale);
    ORK_ENCODE_DOUBLE(aCoder, velocity);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_DOUBLE(aDecoder, scale);
        ORK_DECODE_DOUBLE(aDecoder, velocity);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityPinchGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.scale = self.scale;
    event.velocity = self.velocity;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.scale == castObject.scale &&
            self.velocity == castObject.velocity);
}

- (instancetype)initWithPinchGestureRecognizer:(UIPinchGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.scale = recognizer.scale;
        self.velocity = recognizer.velocity;
    }
    return self;
}

@end

#pragma mark - ORKTouchAbilityRotationGestureRecoginzerEvent

@interface ORKTouchAbilityRotationGestureRecoginzerEvent ()

@property (nonatomic, assign) CGFloat rotation;
@property (nonatomic, assign) CGFloat velocity;

@end

@implementation ORKTouchAbilityRotationGestureRecoginzerEvent

- (void)encodeWithCoder:(NSCoder *)aCoder {
    [super encodeWithCoder:aCoder];
    ORK_ENCODE_DOUBLE(aCoder, rotation);
    ORK_ENCODE_DOUBLE(aCoder, velocity);
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        ORK_DECODE_DOUBLE(aDecoder, rotation);
        ORK_DECODE_DOUBLE(aDecoder, velocity);
    }
    return self;
}

- (id)copyWithZone:(NSZone *)zone {
    ORKTouchAbilityRotationGestureRecoginzerEvent *event = [super copyWithZone:zone];
    event.rotation = self.rotation;
    event.velocity = self.velocity;
    return event;
}

- (BOOL)isEqual:(id)object {

    BOOL isParentSame = [super isEqual:object];

    __typeof(self) castObject = object;

    return (isParentSame &&
            self.rotation == castObject.rotation &&
            self.velocity == castObject.velocity);
}

- (instancetype)initWithRotationGestureRecognizer:(UIRotationGestureRecognizer *)recognizer {
    self = [super initWithGestureRecognizer:recognizer];
    if (self) {
        self.rotation = recognizer.rotation;
        self.velocity = recognizer.velocity;
    }
    return self;
}

@end


text:
import '@polymer/polymer/lib/elements/custom-style.js';
const documentContainer = document.createElement('template');

documentContainer.innerHTML = `
<custom-style>
    <!-- This is where your App's styling should go. You can use .css files too. -->
    <style>
    .tw-docs {
        font-size: 90%;
        height: 100%;
        overflow-y: auto;

        .tw-switch-out {
            @include transform-origin(50% 100%);
            @include animation(rotateFoldTop 0.5s both ease);
        }
        .tw-switch-in {
            @include animation(moveFromBottomFade 0.5s both ease);
        }
    }

    .root-container {
        padding: 10px;
    }
    .centered-caption {
        text-align: center;
        color: var(--)
    }

    .primary-text {
      color: var(--lumo-primary-text-color);
    }
    .font-size-l {
      font-size: var(--lumo-font-size-l);
    }

    .tw-demo-tab {
        margin: 10px;
    }
    .tw-demo-tab {
        margin: 10px;
        flex-wrap: wrap;
    }

    .tw-widget {
        width: 300px;
        margin: 0 20px 20px 20px;
    }

    .tw-timeline {
        overflow-y: scroll;
    }

    .tw-single-tweet {
        min-height: 250px;
    }

    .v-label-undef-w {
        white-space: pre-wrap;
    }

    </style>
</custom-style>`;

document.head.appendChild(documentContainer.content);


text:
import asyncio

import grpc.aio

from helloworld import helloworld_pb2
from helloworld import helloworld_pb2_grpc

class Greeter(helloworld_pb2_grpc.GreeterServicer):

    async def SayHello(self, request, context):
        return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)

async def serve(host='127.0.0.1', port=50051):
    server = grpc.aio.server()
    helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)
    server.add_insecure_port(f'{host}:{port}')
    await server.start()
    print(f'Serving on {host}:{port}')
    try:
        await server.wait_for_termination()
    finally:
        await server.stop(10)

if __name__ == '__main__':
    try:
        asyncio.run(serve())
    except KeyboardInterrupt:
        pass


text:
package com.intellij.util.containers;

import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NotNull;

/**
 * A single threaded, resizable, circular char queue backed by an array.
 */
public class CircularCharBuffer {

  private char[] myArray;
  private final int myMaxCapacity;
  private int mySize;
  private int myTail;
  private int myHead;

  public CircularCharBuffer(int initialCapacity) {
    this(initialCapacity, -1);
  }

  public CircularCharBuffer(int initialCapacity, int maxCapacity) {
    assert maxCapacity < 0 || initialCapacity <= maxCapacity;
    myArray = new char[initialCapacity];
    myMaxCapacity = maxCapacity;
    mySize = 0;
    myTail = 0;
    myHead = 0;
  }

  public void add(char c) {
    resizeIfNeeded(mySize + 1);
    doAdd(c);
  }

  public void add(char[] buffer) {
    resizeIfNeeded(mySize + buffer.length);
    for (char c : buffer) {
      doAdd(c);
    }
  }

  public void add(@NotNull String str) {
    resizeIfNeeded(mySize + str.length());
    for (int i = 0; i < str.length(); i++) {
      doAdd(str.charAt(i));
    }
  }

  private void doAdd(char c) {
    myArray[myTail] = c;
    myTail++;
    int length = myArray.length;
    if (myTail >= length) {
      myTail = 0;
    }
    mySize++;
    if (mySize > length) {
      doPoll();
    }
  }

  public int poll() {
    return doPoll();
  }

  public int doPoll() {
    if (mySize == 0) {
      return -1;
    }
    char res = myArray[myHead];
    myHead++;
    if (myHead >= myArray.length) {
      myHead = 0;
    }
    mySize--;
    return res;
  }

  @NotNull
  public String getText() {
    normalize();
    return new String(myArray, 0, mySize);
  }

  public boolean isEmpty() {
    return mySize == 0;
  }

  public int size() {
    return mySize;
  }

  private boolean resizeIfNeeded(int newSize) {
    int length = myArray.length;
    if (newSize <= length) {
      return true;
    }
    if (myMaxCapacity > -1 && length == myMaxCapacity) {
      return false;
    }
    normalize();
    int newLength = Math.max(length << 1, newSize);
    if (myMaxCapacity > -1) {
      newLength = Math.min(myMaxCapacity, newLength);
    }
    char[] newArray = new char[newLength];
    System.arraycopy(myArray, myHead, newArray, 0, mySize);
    myArray = newArray;
    myTail = mySize % newArray.length;
    return true;
  }

  /**
   * Updates internal data to make sure {@code myHead} points to zero index of {@code myArray}.
   * As a result of this operation there will be no visible changes to clients.
   */
  private void normalize() {
    if (myHead == 0) {
      return;
    }
    int length = myArray.length;
    if (myHead < myTail) {
      moveSubArrayLeft(myArray, myHead, mySize, myHead);
    }
    else {
      int headSize = myTail;
      int tailSize = length - myHead;
      reverseSubArray(myArray, 0, headSize);
      reverseSubArray(myArray, length - tailSize, tailSize);
      reverseSubArray(myArray, 0, length);
      moveSubArrayLeft(myArray, length - headSize, headSize, length - headSize - tailSize);
    }
    myHead = 0;
    myTail = mySize % length;
  }

  private static void moveSubArrayLeft(char[] array, int startInd, int length, int moveLeftCount) {
    //noinspection ManualArrayCopy
    for (int i = startInd; i < startInd + length; i++) {
      array[i - moveLeftCount] = array[i];
    }
  }

  private static void reverseSubArray(char[] array, int startInd, int length) {
    for (int i = 0; i < length / 2; i++) {
      ArrayUtil.swap(array, startInd + i, startInd + length - 1 - i);
    }
  }
}


text:
VERSION = 2.0.1

include ../SuiteSparse_config/SuiteSparse_config.mk

default: all

all:
	( cd Lib ; $(MAKE) )
	( cd Demo ; $(MAKE) )

library:
	( cd Lib ; $(MAKE) )

demos:
	( cd Demo ; $(MAKE) )

cov:
	( cd Tcov ; $(MAKE) )

purge:
	( cd Lib ; $(MAKE) purge )
	( cd Demo ; $(MAKE) purge )
	( cd Tcov ; $(MAKE) purge )
	( cd Doc ; $(MAKE) purge )
	( cd MATLAB ; $(RM) $(CLEAN) rename.h *.mex* )

clean:
	( cd Lib ; $(MAKE) clean )
	( cd Demo ; $(MAKE) clean )
	( cd MATLAB ; $(RM) $(CLEAN) rename.h )

distclean: purge

ccode: demos

# create PDF documents for the original distribution
docs:
	( cd Doc    ; $(MAKE) )

# install SPQR
install:
	$(CP) Lib/libspqr.a $(INSTALL_LIB)/libspqr.$(VERSION).a
	( cd $(INSTALL_LIB) ; ln -sf libspqr.$(VERSION).a libspqr.a )
	$(CP) Include/SuiteSparseQR.hpp $(INSTALL_INCLUDE)
	$(CP) Include/SuiteSparseQR_C.h $(INSTALL_INCLUDE)
	$(CP) Include/SuiteSparseQR_definitions.h $(INSTALL_INCLUDE)
	$(CP) Include/spqr.hpp $(INSTALL_INCLUDE)
	chmod 644 $(INSTALL_LIB)/libspqr*.a
	chmod 644 $(INSTALL_INCLUDE)/SuiteSparseQR.hpp
	chmod 644 $(INSTALL_INCLUDE)/SuiteSparseQR_C.h
	chmod 644 $(INSTALL_INCLUDE)/SuiteSparseQR_definitions.h
	chmod 644 $(INSTALL_INCLUDE)/spqr.hpp

# uninstall SPQR
uninstall:
	$(RM) $(INSTALL_LIB)/libspqr*.a
	$(RM) $(INSTALL_INCLUDE)/SuiteSparseQR.hpp
	$(RM) $(INSTALL_INCLUDE)/SuiteSparseQR_C.h
	$(RM) $(INSTALL_INCLUDE)/SuiteSparseQR_definitions.h
	$(RM) $(INSTALL_INCLUDE)/spqr.hpp


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Encryptor (HBase 0.98.8-hadoop2 API)</title>
<meta name="date" content="2014-11-14">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.hadoop.hbase.io.crypto

Interface Encryptor

@InterfaceAudience.Public
@InterfaceStability.Evolving
public interface Encryptor

Encryptors apply a cipher to an OutputStream to produce ciphertext.

Method Summary

Methods

Modifier and Type
Method and Description

OutputStream
createEncryptionStream(OutputStream out)

Create a stream for encryption

int
getBlockSize()

Get the cipher's internal block size

byte[]
getIv()

Get the initialization vector

int
getIvLength()

Get the expected length for the initialization vector

void
reset()

Reset state, reinitialize with the key and iv

void
setIv(byte[] iv)

Set the initialization vector

void
setKey(Key key)

Set the secret key

Method Detail

setKey

void setKey(Key key)

Set the secret key

Parameters:

key -

getIvLength

int getIvLength()

Get the expected length for the initialization vector

Returns:

the expected length for the initialization vector

getBlockSize

int getBlockSize()

Get the cipher's internal block size

Returns:

the cipher's internal block size

getIv

byte[] getIv()

Get the initialization vector

setIv

void setIv(byte[] iv)

Set the initialization vector

Parameters:

iv -

createEncryptionStream

OutputStream createEncryptionStream(OutputStream out)

Create a stream for encryption

Parameters:

out -

reset

void reset()

Reset state, reinitialize with the key and iv

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2014 The Apache Software Foundation. All rights reserved.


text:
package org.wso2.siddhi.test.standard.pattern;

import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.wso2.siddhi.core.SiddhiManager;
import org.wso2.siddhi.core.event.Event;
import org.wso2.siddhi.core.query.output.callback.QueryCallback;
import org.wso2.siddhi.core.stream.input.InputHandler;
import org.wso2.siddhi.core.util.EventPrinter;
import org.wso2.siddhi.query.api.QueryFactory;
import org.wso2.siddhi.query.api.condition.Condition;
import org.wso2.siddhi.query.api.definition.Attribute;
import org.wso2.siddhi.query.api.expression.Expression;
import org.wso2.siddhi.query.api.query.Query;
import org.wso2.siddhi.query.api.query.input.pattern.Pattern;
import org.wso2.siddhi.query.api.query.input.pattern.element.LogicalElement;

public class PatternLogicTestCase {
    static final Logger log = Logger.getLogger(PatternLogicTestCase.class);
    private int eventCount;
    private boolean eventArrived;

    @Before
    public void init() {
        eventCount = 0;
        eventArrived = false;
    }

    @Test
    public void testQuery1() throws InterruptedException {
        log.info("testPatternLogic1 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.OR,
                                        QueryFactory.inputStream("e3", "Stream2").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "symbol"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", "GOOG"}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"GOOG", 59.6f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }

    @Test
    public void testQuery2() throws InterruptedException {
        log.info("testPatternLogic2 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.OR,
                                        QueryFactory.inputStream("e3", "Stream2").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "symbol"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", null}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 10.7f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }

    @Test
    public void testQuery3() throws InterruptedException {
        log.info("testPatternLogic3 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.OR,
                                        QueryFactory.inputStream("e3", "Stream2").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "price")).
                        select("symbol3", Expression.variable("e3", "price"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", null, 72.7f}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }

    @Test
    public void testQuery4() throws InterruptedException {
        log.info("testPatternLogic4 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.AND,
                                        QueryFactory.inputStream("e3", "Stream2").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "price")).
                        select("symbol3", Expression.variable("e3", "price"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", 72.7f, 4.7f}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"GOOG", 72.7f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 4.7f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }

    @Test
    public void testQuery5() throws InterruptedException {
        log.info("testPatternLogic5 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.AND,
                                        QueryFactory.inputStream("e3", "Stream2").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "price")).
                        select("symbol3", Expression.variable("e3", "price"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", 72.7f, 72.7f}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }

    @Test
    public void testQuery6() throws InterruptedException {
        log.info("testPatternLogic6 - OUT 1");

        SiddhiManager siddhiManager = new SiddhiManager();

        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream1").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));
        siddhiManager.defineStream(QueryFactory.createStreamDefinition().name("Stream2").attribute("symbol", Attribute.Type.STRING).attribute("price", Attribute.Type.FLOAT).attribute("volume", Attribute.Type.INT));

        Query query = QueryFactory.createQuery();
        query.from(
                QueryFactory.patternStream(
                        Pattern.followedBy(
                                QueryFactory.inputStream("e1", "Stream1").filter(
                                        Condition.compare(Expression.variable("price"),
                                                          Condition.Operator.GREATER_THAN,
                                                          Expression.value(20))),
                                Pattern.logical(
                                        QueryFactory.inputStream("e2", "Stream2").filter(
                                                Condition.compare(Expression.variable("price"),
                                                                  Condition.Operator.GREATER_THAN,
                                                                  Expression.variable("e1", "price"))),
                                        LogicalElement.Type.AND,
                                        QueryFactory.inputStream("e3", "Stream1").filter(
                                                Condition.compare(Expression.value("IBM"),
                                                                  Condition.Operator.EQUAL,
                                                                  Expression.variable("symbol")))))));

        query.select(
                QueryFactory.outputSelector().
                        select("symbol1", Expression.variable("e1", "symbol")).
                        select("symbol2", Expression.variable("e2", "price")).
                        select("symbol3", Expression.variable("e3", "price"))

        );
        query.insertInto("OutStream");

        String queryReference= siddhiManager.addQuery(query);
        siddhiManager.addCallback(queryReference, new QueryCallback() {
            @Override
            public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
                EventPrinter.print(timeStamp, inEvents, removeEvents);
                Assert.assertArrayEquals(new Object[]{"WSO2", 72.7f, 75.7f}, inEvents[0].getData());
                eventCount++;
                eventArrived = true;
            }
        });
        InputHandler stream1 = siddhiManager.getInputHandler("Stream1");
        InputHandler stream2 = siddhiManager.getInputHandler("Stream2");
        stream1.send(new Object[]{"WSO2", 55.6f, 100});
        Thread.sleep(500);
        stream2.send(new Object[]{"IBM", 72.7f, 100});
        Thread.sleep(500);
        stream1.send(new Object[]{"IBM", 75.7f, 100});
        Thread.sleep(500);

        siddhiManager.shutdown();

        Assert.assertEquals("Number of success events", 1, eventCount);
        Assert.assertEquals("Event arrived", true, eventArrived);

    }
}


text:
package org.openapitools.server.model

/**
 * @param displayName  for example: ''null''
 * @param estimatedDurationInMillis  for example: ''null''
 * @param latestRun  for example: ''null''
 * @param name  for example: ''null''
 * @param organization  for example: ''null''
 * @param weatherScore  for example: ''null''
 * @param branchNames  for example: ''null''
 * @param numberOfFailingBranches  for example: ''null''
 * @param numberOfFailingPullRequests  for example: ''null''
 * @param numberOfSuccessfulBranches  for example: ''null''
 * @param numberOfSuccessfulPullRequests  for example: ''null''
 * @param totalNumberOfBranches  for example: ''null''
 * @param totalNumberOfPullRequests  for example: ''null''
 * @param `class`  for example: ''null''
*/
final case class MultibranchPipeline (
  displayName: Option[String] = None,
  estimatedDurationInMillis: Option[Int] = None,
  latestRun: Option[String] = None,
  name: Option[String] = None,
  organization: Option[String] = None,
  weatherScore: Option[Int] = None,
  branchNames: Option[Seq[String]] = None,
  numberOfFailingBranches: Option[Int] = None,
  numberOfFailingPullRequests: Option[Int] = None,
  numberOfSuccessfulBranches: Option[Int] = None,
  numberOfSuccessfulPullRequests: Option[Int] = None,
  totalNumberOfBranches: Option[Int] = None,
  totalNumberOfPullRequests: Option[Int] = None,
  `class`: Option[String] = None
)


text:
package com.byoutline.hackfest;

import android.app.Application;
import android.content.Context;
import android.graphics.Typeface;

import com.byoutline.secretsauce.Settings;
import com.byoutline.secretsauce.utils.BusWrapper;
import com.byoutline.secretsauce.utils.OttoBusWrapper;
import com.parse.Parse;
import com.squareup.otto.Bus;

import javax.inject.Inject;

import dagger.ObjectGraph;
import timber.log.Timber;

import static timber.log.Timber.plant;

/**
 * @author Sebastian Kacprzak <nait at naitbit.com>
 */
public class App extends Application {

    public static final String DEFAULT_FONT = "BebasNeueBold.ttf";
    private static ObjectGraph objectGraph;
    private Typeface mBebasNoueBold = Typeface.DEFAULT;
    private static App sInstance;
    @Inject
    Bus bus;

    @Override
    public void onCreate() {
        super.onCreate();
        this.sInstance = this;
        objectGraph = ObjectGraph.create(new AppModule(this));
        doDaggerInject(this);
        if (BuildConfig.DEBUG) {
            plant(new Timber.DebugTree());
        }
        Parse.initialize(this, "0PxlFOC4zXxNRqXEgu9N2hT0tGUK19pwb5CVj5s3", "jX6iULkeOeDbeifALn0Ius1mYn49CrCykHAKZO5D");

        BusWrapper busWrapper = new OttoBusWrapper(bus);
        Settings.set(getApplicationContext(), BuildConfig.DEBUG, R.id.container, busWrapper, DEFAULT_FONT, mBebasNoueBold);
    }

    public static void doDaggerInject(Object o) {
        objectGraph.inject(o);
    }

    public static Context getInstance() {
        if(sInstance == null){
            sInstance = new App();
        }
        return sInstance;
    }
}


text:
package com.example.rodrigo.recyclergrid;

import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

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

/**
 * Created by rodrigo on 19/12/15.
 */
public class MapAdapter extends RecyclerView.Adapter<MapAdapter.ViewHolder> {

    public static int TYPE_HEADER = 0;
    public static int TYPE_ITEM = 1;

    private int mCount;
    private Map<String, List<String>> mMap;
    private SparseArray<String> mHeaders;

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View v;
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        if(viewType == TYPE_HEADER) {
            v = inflater.inflate(R.layout.list_header, parent, false);
        } else {
            v = inflater.inflate(R.layout.list_item, parent, false);
        }
        return new ViewHolder(v, viewType);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        int type = getItemViewType(position);
        if (type == TYPE_HEADER) {
            String key = mHeaders.get(position);
            holder.text.setText(key);
        } else if (type == TYPE_ITEM) {
            int keyCount = 0;
            for (List<String> values: mMap.values()) {
                keyCount++;
                int itemPosition = position - keyCount;
                if(itemPosition < values.size()) {
                    String item = values.get(itemPosition);
                    holder.text.setText(item);
                    return;
                }
                position -= values.size();
            }
        }

    }

    @Override
    public int getItemCount() {
        return mCount;
    }

    @Override
    public int getItemViewType(int position) {
        if(mHeaders.get(position) != null) {
            return TYPE_HEADER;
        }
        return TYPE_ITEM;
    }

    public boolean isHeader(int position) {
        return getItemViewType(position) == TYPE_HEADER;
    }

    public String getTitleForPosition(int position) {
        if(isHeader(position)) {
            return mHeaders.get(position);
        } else {
            for (int i = 0; i < mHeaders.size(); i++) {
                int key = mHeaders.keyAt(i);
                if(position > key) {
                    int nextIndex = i + 1;
                    if (nextIndex < mHeaders.size()) {
                        int nextKey = mHeaders.keyAt(nextIndex);
                        if (position < nextKey) {
                            return mHeaders.get(key);
                        }
                    } else {
                        return mHeaders.get(key);
                    }
                }
            }
            return null;
        }
    }

    public int getSpan(int position) {
        int type = getItemViewType(position);
        if(type == TYPE_HEADER) {
            return 2;
        }
        return 1;
    }

    public Map<String, List<String>> getMap() {
        return mMap;
    }

    public void setMap(Map<String, List<String>> map) {
        mMap = map;
        mCount = 0;
        mHeaders = new SparseArray<>();
        for (String key: mMap.keySet()) {
            //Index for the list headers
            mHeaders.put(mCount, key);
            List<String> values = mMap.get(key);
            mCount += values.size() + 1;
        }
        notifyDataSetChanged();
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        public TextView text;
        public ViewHolder(View itemView, int viewType) {
            super(itemView);
            text = (TextView) itemView.findViewById(R.id.item_text);
        }
    }
}


text:
<?php

require('src/SimpleMath.php');

class simpleMathTest extends PHPUnit_Framework_TestCase {

    public function testAddOk() {
        $m = new simpleMath();
        $result = $m->add(1, 1);
        $this->assertEquals($result, 2);
    }

    public function testSubOk() {
        $m = new simpleMath();
        $result = $m->sub(2, 1);
        $this->assertEquals($result, 1);
    }
}


text:
import contextlib
import io
import os
import posixpath
import re
import subprocess

import typ

def BuildFileMatchRegex(*file_matchers):
  return re.compile('^' + '|'.join(file_matchers) + '$')

# Chrome specific files which are not in Monochrome.apk
CHROME_SPECIFIC = BuildFileMatchRegex(
    r'lib/.*/libchrome\.so',
    r'lib/.*/libchrome\.\d{4}\.\d{2,3}\.so', # libchrome placeholders
    r'lib/.*/libchromium_android_linker\.so',
    r'lib/.*/libchromeview\.so', # placeholder library
    r'lib/.*/libchrome_crashpad_handler\.so',
    r'lib/.*/crazy\.libchrome\.so',
    r'lib/.*/crazy\.libchrome\.align',
    r'lib/.*/gdbserver',
    # R.font.accent_font is an alias in internal Chrome.
    r'res/.*/accent_font.xml',
    # Monochrome doesn't have any res directories whose api number is less
    # than v24.
    r'res/.*-v1\d/.*\.xml',
    r'res/.*-v2[0-3]/.*\.xml',
    r'META-INF/.*',
    r'assets/metaresources.arsc',
    r'assets/AndroidManifest.xml')

# WebView specific files which are not in Monochrome.apk
WEBVIEW_SPECIFIC = BuildFileMatchRegex(
    r'lib/.*/libwebviewchromium\.so',
    r'lib/.*/libchromium_android_linker\.so',
    r'assets/webview_licenses.notice',
    r'res/.*/accent_font.xml',
    r'res/.*/icon_webview(.webp)?',
    r'META-INF/.*',
     # Monochrome doesn't have any res directories
     # whose api level is less than v24.
    r'res/.*-v1\d/.*\.xml',
    r'res/.*-v2[0-3]/.*\.xml',
    r'lib/.*/gdbserver',
    # libarcore is only added to the aab version of monochrome.
    r'lib/.*/libarcore_sdk_c\.so')

# The files in Chrome are not same as those in Monochrome
CHROME_CHANGES = BuildFileMatchRegex(
    r'AndroidManifest\.xml',
    r'resources\.arsc',
    r'classes\d*\.dex',
    r'res/.*\.xml', # Resource id isn't same
    r'assets/unwind_cfi_32', # Generated from apk's shared library
     # All pak files except chrome_100_percent.pak are different
    r'assets/resources\.pak',
    r'assets/locales/.*\.pak')

# The files in WebView are not same as those in Monochrome
WEBVIEW_CHANGES = BuildFileMatchRegex(
    r'AndroidManifest\.xml',
    r'resources\.arsc',
    r'classes\d?\.dex',
    r'res/.*\.xml', # Resource id isn't same
    r'assets/.*\.pak') # All pak files are not same as Monochrome

# Parse the output of unzip -lv, like
# 2384  Defl:N      807  66% 2001-01-01 00:00 2f2d9fce  res/xml/privacy.xml
ZIP_ENTRY = re.compile(
    "^ *[0-9]+ +\S+ +[0-9]+ +(?P<cmpr>[0-9]{1,2})% +\S+ +\S+ +"
    "(?P<crc>[0-9a-fA-F]+) +(?P<name>\S+)"
  )

class APKEntry:
  def __init__(self,  filename, crc, uncompressed):
    self.filename = filename
    self.CRC = crc
    self.uncompressed = uncompressed

def DumpAPK(apk):
  args = ['unzip', '-lv']
  args.append(apk)
  content = subprocess.check_output(args, universal_newlines=True)
  apk_entries = []
  with contextlib.closing(io.StringIO(content)) as f:
    for line in f:
      match = ZIP_ENTRY.match(line)
      if match:
        apk_entries.append(
            APKEntry(
                match.group('name'), match.group('crc'),
                match.group('cmpr') == 0))
  return apk_entries

def DeobfuscateFilename(obfuscated_filename, pathmap):
  return pathmap.get(obfuscated_filename, obfuscated_filename)

class MonochromeApkCheckerTest(typ.TestCase):
  def VerifySameFile(self, monochrome_dict, apk, changes, apk_name):
    """Verify apk file content matches same files in monochrome.

    Verify files from apk are same as those in monochrome except files
    in changes.
    """
    diff = []
    for a in apk:
      # File may not exists due to exists_in_some_form().
      m = monochrome_dict.get(a.filename)
      if m and m.CRC != a.CRC and not changes.match(m.filename):
        diff.append(a.filename)
    self.assertEquals(len(diff), 0,  """\
Unless specifcially excepted, all files in {0} should be exactly the same as
the similarly named file in Monochrome. However these files were present in
both monochrome and {0}, but had different contents:
{1}
""".format(apk_name, '\n'.join(diff)))

  def VerifyUncompressed(self, monochrome, apk, apk_name):
    """Verify uncompressed files in apk are a subset of those in monochrome.

    Verify files not being compressed in apk are also uncompressed in
    Monochrome APK.
    """
    uncompressed = [i.filename for i in apk if i.uncompressed ]
    monochrome_uncompressed = [i.filename for i in monochrome if i.uncompressed]
    compressed = [u for u in uncompressed if u not in monochrome_uncompressed]
    self.assertEquals(len(compressed), 0, """\
Uncompressed files in {0} should also be uncompressed in Monochrome.
However these files were uncompressed in {0} but compressed in Monochrome:
{1}
""".format(apk_name, '\n'.join(compressed)))

  def SuperSetOf(self, monochrome, apk, apk_name):
    """Verify Monochrome is super set of apk."""

    def exists_in_some_form(f):
      if f in monochrome:
        return True
      # Chrome.apk may have an extra classes.dex due to jdk library desugaring.
      if f.startswith('classes') and f.endswith('.dex'):
        return True
      if not f.startswith('res/'):
        return False
      name = '/' + posixpath.basename(f)
      # Some resources will exists in apk but not in monochrome due to the
      # difference in minSdkVersion. https://crbug.com/794438
      # E.g.:
      # apk could have: res/drawable/foo.png, res/drawable-v23/foo.png
      # monochrome (minSdkVersion=24) would need only: res/drawable-v23/foo.png
      return any(x.endswith(name) for x in monochrome)

    missing_files = [f for f in apk if not exists_in_some_form(f)]
    self.assertEquals(len(missing_files), 0, """\
Monochrome is expected to have a superset of the files in {0}.
However these files were present in {0} but not in Monochrome:
{1}
""".format(apk_name, '\n'.join(missing_files)))

  def RemoveSpecific(self, apk_entries, specific):
    return [i for i in apk_entries
            if not specific.search(i.filename) ]

  def LoadPathmap(self, pathmap_path):
    """Load the pathmap of obfuscated resource paths.

    Returns: A dict mapping from obfuscated paths to original paths or an
           empty dict if passed a None |pathmap_path|.
    """
    if pathmap_path is None or not os.path.exists(pathmap_path):
      return {}

    pathmap = {}
    with open(pathmap_path, 'r') as f:
      for line in f:
        line = line.strip()
        if line.startswith('#') or line == '':
          continue
        original, renamed = line.split(' -> ')
        pathmap[renamed] = original
    return pathmap

  def testApkChecker(self):
    options = self.context

    monochrome = DumpAPK(options.monochrome_apk)
    monochrome_pathmap = self.LoadPathmap(options.monochrome_pathmap)
    monochrome_files = [
        DeobfuscateFilename(f.filename, monochrome_pathmap)
          for f in monochrome
    ]
    monochrome_dict = dict((DeobfuscateFilename(i.filename, monochrome_pathmap),
                            i) for i in monochrome)

    chrome = self.RemoveSpecific(DumpAPK(options.chrome_apk),
                                 CHROME_SPECIFIC)
    self.assertTrue(len(chrome) > 0,
        'Chrome should have common files with Monochrome. However the passed '
        'in APKs do not have any files in common. Are you sure you are passing '
        'in the right arguments?')

    webview = self.RemoveSpecific(DumpAPK(options.system_webview_apk),
                                  WEBVIEW_SPECIFIC)
    self.assertTrue(len(webview) > 0,
        'Webview should have common files with Monochrome. However the passed '
        'in APKs do not have any files in common. Are you sure you are passing '
        'in the right arguments?')

    def check_apk(apk, pathmap, apk_name):
      apk_files = [DeobfuscateFilename(f.filename, pathmap) for f in apk]
      self.SuperSetOf(monochrome_files, apk_files, apk_name)
      self.VerifyUncompressed(monochrome, apk, apk_name)

    chrome_pathmap = self.LoadPathmap(options.chrome_pathmap)
    check_apk(chrome, chrome_pathmap, 'Chrome')
    self.VerifySameFile(monochrome_dict, chrome, CHROME_CHANGES, 'Chrome')

    webview_pathmap = self.LoadPathmap(options.system_webview_pathmap)
    check_apk(webview, webview_pathmap, 'Webview')
    self.VerifySameFile(monochrome_dict, webview, WEBVIEW_CHANGES, 'Webview')


text:
<?php

namespace Oro\Bundle\TranslationBundle\Provider;

use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader;

use Oro\Bundle\TranslationBundle\Translation\DatabasePersister;

class TranslationServiceProvider
{
    const FILE_NAME_SUFFIX      = '.zip';
    const DEFAULT_SOURCE_LOCALE = 'en';

    /** @var AbstractAPIAdapter */
    protected $adapter;

    /** @var JsTranslationDumper */
    protected $jsTranslationDumper;

    /** @var NullLogger */
    protected $logger;

    /** @var TranslationLoader */
    protected $translationLoader;

    /** @var DatabasePersister  */
    protected $databasePersister;

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

    /**
     * @param AbstractAPIAdapter  $adapter
     * @param JsTranslationDumper $jsTranslationDumper
     * @param TranslationLoader   $translationLoader
     * @param DatabasePersister   $databasePersister
     * @param string              $cacheDir
     */
    public function __construct(
        AbstractAPIAdapter $adapter,
        JsTranslationDumper $jsTranslationDumper,
        TranslationLoader $translationLoader,
        DatabasePersister $databasePersister,
        $cacheDir
    ) {
        $this->adapter             = $adapter;
        $this->jsTranslationDumper = $jsTranslationDumper;
        $this->translationLoader   = $translationLoader;
        $this->databasePersister   = $databasePersister;
        $this->cacheDir            = $cacheDir;

        $this->setLogger(new NullLogger());
    }

    /**
     * Loop through the generated files in $dirs and merge them with downloaded in $targetDir
     * merge generated files over downloaded and upload result back to remote
     *
     * @param array|string[] $dirs
     */
    public function update($dirs)
    {
        $targetDir  = $this->getTmpDir('oro-trans');
        $pathToSave = $targetDir . DIRECTORY_SEPARATOR . 'update';
        $targetDir  = $targetDir . DIRECTORY_SEPARATOR . self::DEFAULT_SOURCE_LOCALE . DIRECTORY_SEPARATOR;

        $isDownloaded = $this->download($pathToSave, [], self::DEFAULT_SOURCE_LOCALE, false);
        if (!$isDownloaded) {
            return false;
        }

        foreach ($dirs as $dir) {
            $finder = Finder::create()->files()->name('*.yml')->in($dir);

            /** @var SplFileInfo $fileInfo */
            foreach ($finder->files() as $fileInfo) {
                $localContents = file($fileInfo);
                $remoteFile    = $targetDir . $fileInfo->getRelativePathname();

                if (file_exists($remoteFile)) {
                    $remoteContents = file($remoteFile);
                    array_shift($remoteContents); // remove dashes from the beginning of file
                } else {
                    $remoteContents = [];
                }

                $content = array_unique(array_merge($remoteContents, $localContents));
                $content = implode('', $content);

                $remoteDir = dirname($remoteFile);
                if (!is_dir($remoteDir)) {
                    mkdir($remoteDir, 0777, true);
                }
                file_put_contents($remoteFile, $content);
            }
        }

        $this->upload($targetDir, 'update');
        $this->cleanup($targetDir);
    }

    /**
     * Upload translations
     *
     * @param string $dir
     * @param string $mode
     *
     * @return mixed
     */
    public function upload($dir, $mode = 'add')
    {
        $finder = Finder::create()->files()->name('*.yml')->in($dir);

        /** $file \SplFileInfo */
        $files = [];
        foreach ($finder->files() as $file) {
            // crowdin understand only "/" as directory separator :)
            $apiPath         = str_replace([$dir, DIRECTORY_SEPARATOR], ['', '/'], (string)$file);
            $files[$apiPath] = (string)$file;
        }

        return $this->adapter->upload($files, $mode);
    }

    /**
     * @param string      $pathToSave path to save translations
     * @param array       $projects   project names
     * @param null|string $locale
     * @param bool        $toApply    whether apply download packs or not
     *
     * @throws \RuntimeException
     * @return bool
     */
    public function download($pathToSave, array $projects, $locale = null, $toApply = true)
    {
        $pathToSave = $pathToSave . self::FILE_NAME_SUFFIX;
        $targetDir  = dirname($pathToSave);
        $this->cleanup($targetDir);

        $isDownloaded = $this->adapter->download($pathToSave, $projects, $locale);
        $isExtracted  = $this->unzip(
            $pathToSave,
            is_null($locale) ? $targetDir : rtrim($targetDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $locale
        );

        if ($locale == 'en') {
            // check and fix exported file names, replace $locale_XX locale in file names to $locale
            $this->renameFiles('.en_US.', '.en.', $targetDir);
        }

        if ($isExtracted) {
            unlink($pathToSave);
        }

        if ($toApply && $isExtracted) {
            $this->apply($locale, $targetDir);

            $this->cleanup($targetDir);
            $this->jsTranslationDumper->dumpTranslations([$locale]);
        }

        return $isExtracted && $isDownloaded;
    }

    /**
     * @param string $find    find string in file name
     * @param string $replace replacement
     * @param string $dir     where to search
     */
    protected function renameFiles($find, $replace, $dir)
    {
        $finder = Finder::create()->files()->name('*.yml')->in($dir);

        /** $file \SplFileInfo */
        foreach ($finder->files() as $file) {
            rename($file, str_replace($find, $replace, $file));
        }
    }

    /**
     * @param string $file
     * @param string $path
     *
     * @return bool
     * @throws \RuntimeException
     */
    protected function unzip($file, $path)
    {
        $zip = new \ZipArchive();
        $res = $zip->open($file);

        $zipErrors = [
            \ZipArchive::ER_EXISTS => 'File already exists.',
            \ZipArchive::ER_INCONS => 'Zip archive inconsistent.',
            \ZipArchive::ER_INVAL  => 'Invalid argument.',
            \ZipArchive::ER_MEMORY => 'Malloc failure.',
            \ZipArchive::ER_NOENT  => 'No such file.',
            \ZipArchive::ER_NOZIP  => 'Not a zip archive.',
            \ZipArchive::ER_OPEN   => 'Can\'t open file.',
            \ZipArchive::ER_READ   => 'Read error.',
            \ZipArchive::ER_SEEK   => 'Seek error.',
        ];

        if ($res !== true) {
            throw new \RuntimeException($zipErrors[$res], $res);
        }

        $isExtracted = $zip->extractTo($path);
        if (!$isExtracted) {
            throw new \RuntimeException(sprintf('Pack %s can\'t be extracted', $file));
        }

        $isClosed = $zip->close();
        if (!$isClosed) {
            throw new \RuntimeException(sprintf('Pack %s can\'t be closed', $file));
        }

        return true;
    }

    /**
     * Cleanup directory
     *
     * @param string $targetDir
     */
    protected function cleanup($targetDir)
    {
        if (!is_dir($targetDir)) {
            mkdir($targetDir, 0777, true);
            return;
        }

        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($targetDir, \FilesystemIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($iterator as $path) {
            $path->isFile() ? unlink($path->getPathname()) : rmdir($path->getPathname());
        }
    }

    /**
     * Apply downloaded and extracted language packs to Symfony, in app/Resources dir
     * Returns applied locale codes
     *
     * @param string $locale
     * @param string $sourceDir
     */
    protected function apply($locale, $sourceDir)
    {
        $iterator = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($sourceDir, \FilesystemIterator::SKIP_DOTS),
            \RecursiveIteratorIterator::SELF_FIRST
        );

        $catalog = new MessageCatalogue($locale);
        /** @var \SplFileInfo $fileInfo */
        foreach ($iterator as $fileInfo) {
            if ($iterator->getDepth() < 1 || $fileInfo->isDir()) {
                continue;
            }

            // fix bad formatted yaml that may come from third-party service
            YamlFixer::fixStrings($fileInfo->getPathname());
        }

        $this->translationLoader->loadMessages($sourceDir, $catalog);
        $this->databasePersister->persist($locale, $catalog->all());
    }

    /**
     * @param APIAdapterInterface $adapter
     */
    public function setAdapter(APIAdapterInterface $adapter)
    {
        $this->adapter = $adapter;
    }

    /**
     * @return AbstractAPIAdapter
     */
    public function getAdapter()
    {
        return $this->adapter;
    }

    /**
     * Sets a logger
     *
     * @param LoggerInterface $logger
     */
    public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

        $this->adapter->setLogger($this->logger);
        $this->jsTranslationDumper->setLogger($this->logger);
    }

    /**
     * @param string $prefix
     *
     * @return string
     */
    public function getTmpDir($prefix)
    {
        $pathParts = [
            rtrim($this->cacheDir, DIRECTORY_SEPARATOR),
            'translations',
            ltrim(uniqid($prefix), DIRECTORY_SEPARATOR)
        ];
        $path = implode(DIRECTORY_SEPARATOR, $pathParts);

        if (!is_dir($path)) {
            mkdir($path, 0777, true);
        }

        return $path;
    }
}


text:
var _ = require('lodash');
var fs = require('fs');
var inCssUtil = require('../../util/in_css');

var inCssConfig;

module.exports = (config) => {
    if (!config.useInCss) return;

    // have read once
    if (inCssConfig) {
        config.inCssConfig = _.cloneDeep(inCssConfig);
        return;
    }

    var inCssConfigPath = config.basePaths.webRoot + config.inCssConfigPath;

    if (!fs.existsSync(inCssConfigPath)) {
        logger.error('in-css config file is not exist.');
        logger.error(`Wrong Path is ${inCssConfigPath}`);
        process.exit(0);
    }

    // get in-css config
    inCssConfig = inCssUtil.getConfigFromFilePath(inCssConfigPath);

    config.inCssConfig = _.cloneDeep(inCssConfig);
};


text:
<?xml version="1.0" encoding="UTF-8"?>
<ldswebml type="image" uri="/media-library/images/sunrises-sunsets#sunrise-flowers-885917" xml:lang="eng" locale="eng" status="publish" xmlns:its="http://www.w3.org/2005/11/its">
  <search-meta>
      <uri-title its:translate="no">sunrise-flowers-885917</uri-title>
      <source>sunrise-flowers-885917</source>
      <publication-type its:translate="no">image</publication-type>
      <media-type its:translate="no">image</media-type>
      <publication value="ldsorg">LDS.org</publication>
      <publication-date value="2012-07-02">2012-07-02</publication-date>
      <title/>
      <description/>
      <collections>
          <collection its:translate="no">global-search</collection>
          <collection its:translate="no">media</collection>
          <collection its:translate="no">images</collection>
      </collections>
      <subjects>
          <subject>sunrises</subject>
          <subject>sunsets</subject>
          <subject>fields</subject>
          <subject>grasses</subject>
          <subject>flowers</subject>
          <subject>mountains</subject>
          <subject>clouds</subject>
          <subject>sky</subject>
          <subject>skies</subject>
      </subjects>
  </search-meta>
  <no-search>
      <path>http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-gallery.jpg</path>
      <images>
          http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-thumbnail.jpg
      </images>
          <download-urls>
              <download-url>
                  Mobile
                  <size>195 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-mobile.jpg</path>
              </download-url>
              <download-url>
                  Tablet
                  <size>220 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-tablet.jpg</path>
              </download-url>
              <download-url>
                  Print
                  <size>528 KB</size>
                  <path>http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-print.jpg</path>
              </download-url>
              <download-url>
                  Wallpaper
                  <size>1.3 MB</size>
                  <path>http://media.ldscdn.org/images/media-library/sunrises-sunsets/sunrise-flowers-885917-wallpaper.jpg</path>
              </download-url>
          </download-urls>
  </no-search>
</ldswebml>


text:
/*
 *      $Id$
 */
/************************************************************************
*									*
*			     Copyright (C)  2003			*
*				Internet2				*
*			     All Rights Reserved			*
*									*
************************************************************************/
/*
 *	File:		conf.h
 *
 *	Author:		Jeff W. Boote
 *			Internet2
 *
 *	Date:		Tue Sep 16 14:28:48 MDT 2003
 *
 *	Description:
 *
 * 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.
 *
 */
#ifndef	_i2_conf_h_
#define	_i2_conf_h_

#include "../I2util/util.h"

#include <stdio.h>

/*
 * Growth increment for linebuffer.
 */
#define I2LINEBUFINC	(120)

/*
 * same charactors isspace checks for - useful for strtok splits
 * of whitespace.
 */
#define I2WSPACESET   "\t\n\v\f\r "

/*
 * Maximum "identity"/"username" charactor length
 */
#define I2MAXIDENTITYLEN	(16)

/*
 * Length of a key in bytes.
 */
#define	I2KEYLEN		(16)

extern int
I2GetConfLine(
	I2ErrHandle	eh,
	FILE		*fp,
	int		rc,
	char		**lbuf,
	size_t		*lbuf_max
	);

extern int
I2ReadConfVar(
	FILE	*fp,
	int	rc,
	char	*key,
	char	*val,
	size_t	max,
	char	**lbuf,
	size_t	*lbuf_max
	);

/*
 * lbuf will contain an undisturbed copy of the last line to be parsed in
 * the file. (It is the callers responsibility to free the memory pointed
 * to by lbuf after calling this function.)
 *
 */
extern int
I2ParseKeyFile(
	I2ErrHandle eh,
	FILE	    *fp,
	int	    rc,
	char	    **lbuf,
	size_t	    *lbuf_max,
	FILE	    *tofp,	/* copy 'to' file, or null */
	const char  *id_query,
	char	    *id_ret,	/* [I2MAXIDENTITYLEN+1] or null */
	uint8_t	    *key_ret	/* [I2KEYLEN] or null */
	);

extern int
I2WriteKeyLine(
	I2ErrHandle     eh,
	FILE	        *fp,
	const char      *id,	/* no more than [I2MAXIDENTITYLEN+1] */
	const uint8_t   *key	/* [I2KEYLEN] */
	);

/*
 * lbuf will NOT contain an undisturbed copy of the last line to be parsed in
 * the file. lbuf is just a memory buffer to be used by the function, and
 * realloc'd as needed.
 *
 * It is the callers responsibility to free the memory pointed
 * to by lbuf after calling this function.
 *
 */
extern int
I2ParsePFFile(
	I2ErrHandle	eh,
	FILE		*fp,
	FILE		*tofp,
	int		rc,
        const char      *id_query,
        char            **id_ret,   /* nul terminated, points in lbuf */
        char            **pf_ret,   /* points in lbuf */
        size_t          *pf_len,
	char		**lbuf,
	size_t		*lbuf_max
	);

/*
 * lbuf has same semantics as above, caller must free memory eventually.
 */
extern int
I2WritePFLine(
	I2ErrHandle	eh,
	FILE		*fp,
	const char	*id,
        const uint8_t   *bytes,
        size_t          nbytes,
        char            **lbuf,
        size_t          *lbuf_max
	);

typedef uint64_t	I2numT;

/*
 * These two functions are destructive to the passed in string.
 * StrToNum interprets k/m/g as base 10 numbers,
 * StrToBytes interprets k == 1024 etc...
 */
extern int
I2StrToNum(
	I2numT		*numret,
	char		*str
	  );

extern int
I2StrToByte(
	I2numT		*numret,
	char		*str
	  );

#endif	/* _i2_conf_h_ */


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ViridiX.Mason.Logging;

namespace ViridiX.Linguist.Tests
{
    [TestClass]
    public class XboxMemoryTests
    {
        private Xbox _xbox;

        [TestInitialize]
        public void Initialize()
        {
            _xbox = new Xbox(AssemblyGlobals.Logger);
            _xbox.Connect(AssemblyGlobals.TestXbox.Ip);
        }

        [TestCleanup]
        public void Cleanup()
        {
            _xbox?.Dispose();
            AssemblyGlobals.Logger.Level = LogLevel.Trace;
        }

        [TestMethod]
        public void ValidAddressTest()
        {
            Assert.IsTrue(_xbox.Memory.IsValidAddress(0x10000));
            Assert.IsFalse(_xbox.Memory.IsValidAddress(0xFFFFF000));
            Assert.IsFalse(_xbox.Memory.IsValidAddress(long.MaxValue));

            // TODO: more
        }

        [TestMethod]
        public void StatsTest()
        {
            var mmglobal = _xbox.Memory.Statistics;
            Assert.IsTrue(mmglobal.TotalPages == 0x4000 || mmglobal.TotalPages == 0x8000);
            Assert.IsTrue(mmglobal.AvailablePages < mmglobal.TotalPages);
        }

        [TestMethod]
        public void RegionTest()
        {
            var regions = _xbox.Memory.Regions;
            foreach (var region in regions)
            {
                // make sure everything is 4kb aligned
                Assert.IsTrue((region.Address & 0xFFF) == 0 && (region.Size & 0xFFF) == 0);
            }
        }
    }
}