text:
/*
 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
 * a choice of LGPL license versions is made available with the language indicating
 * that LGPLv2 or any later version may be used, or where a choice of which version
 * of the LGPL is applied is otherwise unspecified.
 */

#ifndef __WINE_OLEDBERR_H
#define __WINE_OLEDBERR_H

#define DB_E_BADBINDINFO                    0x80040e08

#define DB_E_NOTFOUND                       0x80040e19

#define DB_E_UNSUPPORTEDCONVERSION          0x80040e1d

#define DB_E_ERRORSOCCURRED                 0x80040e21

#define DB_E_BADSTORAGEFLAG                 0x80040e26
#define DB_E_BADCOMPAREOP                   0x80040e27
#define DB_E_BADSTATUSVALUE                 0x80040e28
#define DB_E_CANTSCROLLBACKWARDS            0x80040e29
#define DB_E_BADREGIONHANDLE                0x80040e2a
#define DB_E_NONCONTIGUOUSRANGE             0x80040e2b
#define DB_E_INVALIDTRANSITION              0x80040e2c
#define DB_E_NOTASUBREGION                  0x80040e2d
#define DB_E_MULTIPLESTATEMENTS             0x80040e2e
#define DB_E_INTEGRITYVIOLATION             0x80040e2f
#define DB_E_BADTYPENAME                    0x80040e30
#define DB_E_ABORTLIMITREACHED              0x80040e31
#define DB_E_ROWSETINCOMMAND                0x80040e32
#define DB_E_CANTTRANSLATE                  0x80040e33
#define DB_E_DUPLICATEINDEXID               0x80040e34
#define DB_E_NOINDEX                        0x80040e35
#define DB_E_INDEXINUSE                     0x80040e36
#define DB_E_NOTABLE                        0x80040e37
#define DB_E_CONCURRENCYVIOLATION           0x80040e38

#define DB_E_TABLEINUSE                     0x80040e40
#define DB_E_NOLOCALE                       0x80040e41
#define DB_E_BADRECORDNUM                   0x80040e42
#define DB_E_BOOKMARKSKIPPED                0x80040e43
#define DB_E_BADPROPERTYVALUE               0x80040e44
#define DB_E_INVALID                        0x80040e45
#define DB_E_BADACCESSORFLAGS               0x80040e46
#define DB_E_BADSTORAGEFLAGS                0x80040e47
#define DB_E_BYREFACCESSORNOTSUPPORTED      0x80040e48
#define DB_E_NULLACCESSORNOTSUPPORTED       0x80040e49
#define DB_E_NOTPREPARED                    0x80040e4a
#define DB_E_BADACCESSORTYPE                0x80040e4b
#define DB_E_WRITEONLYACCESSOR              0x80040e4c
#define DB_SEC_E_AUTH_FAILED                0x80040e4d
#define DB_E_CANCELED                       0x80040e4e

#define DB_E_ALREADYINITIALIZED             0x80040e52
#define DB_E_DATAOVERFLOW                   0x80040e57

#define DB_E_MISMATCHEDPROVIDER             0x80040e75

#define DB_S_ERRORSOCCURRED                 0x00040eda

#endif /* __WINE_OLEDBERR_H */


text:
namespace Tail.Filter
{
    /// <summary>
    /// Processes the results of a filter.  It is inteded to be executed after a filter and therefore is always a
    /// child member in a pipeline.
    /// </summary>
    public interface IFilterProcessor : IPipelineMember
    {

    }
}

redpajama_set_name: RedPajamaGithub


text:
title: Crazy Bricks
baseurl: ../
date: 2016-02-20
categories: cognition communication
toolFile: crazybrick.swf
toolWidth: 800
toolHeight: 600
navGroup: learningtools
---


text:
@interface LILDataSource ()
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, assign) BOOL sectionsUpdated;
@end

@implementation LILFetchedResultsControllerDataSource

- (void)setFetchedResultsController:(NSFetchedResultsController *)fetchedResultsController
{
    _fetchedResultsController = fetchedResultsController;
    _fetchedResultsController.delegate = self;
    [self performFetch];
}

- (void)setPaused:(BOOL)paused
{
    _paused = paused;

    if (paused) {
        self.fetchedResultsController.delegate = nil;
    } else {
        self.fetchedResultsController.delegate = self;
        [self performFetch];
    }
}

- (id)selectedItem
{
    NSIndexPath* path = self.tableView.indexPathForSelectedRow;
    return path ? [self.fetchedResultsController objectAtIndexPath:path] : nil;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.fetchedResultsController.sections.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.fetchedResultsController.sections[section] numberOfObjects];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return [self.fetchedResultsController.sections[section] name];
}

- (NSInteger)     tableView:(UITableView *)tableView
sectionForSectionIndexTitle:(NSString *)title
                    atIndex:(NSInteger)index
{
    return [self.fetchedResultsController sectionForSectionIndexTitle:title atIndex:index];
}

- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
    id object = [self.fetchedResultsController objectAtIndexPath:indexPath];
    return [self.delegate cellWithObject:object];
}

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    return nil;
}

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

- (void) tableView:(UITableView *)tableView
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
 forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        [self.delegate deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
    }
}

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
    [self.tableView beginUpdates];
}

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
{
    [self.tableView endUpdates];
}

- (void)controller:(NSFetchedResultsController *)controller
  didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
           atIndex:(NSUInteger)sectionIndex
     forChangeType:(NSFetchedResultsChangeType)type
{
    self.sectionsUpdated = YES;
    switch(type) {
        case NSFetchedResultsChangeInsert:

            [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex]
                          withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeDelete:

            [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex]
                          withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeUpdate:

            [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:sectionIndex]
                          withRowAnimation:UITableViewRowAnimationFade];
            break;

        default:
            break;
    }
}

- (void)controller:(NSFetchedResultsController *)controller
   didChangeObject:(id)anObject
       atIndexPath:(NSIndexPath *)indexPath
     forChangeType:(NSFetchedResultsChangeType)type
      newIndexPath:(NSIndexPath *)newIndexPath
{
    switch(type) {
        case NSFetchedResultsChangeInsert:

            [self.tableView insertRowsAtIndexPaths:@[newIndexPath]
                                  withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeDelete:

            [self.tableView deleteRowsAtIndexPaths:@[indexPath]
                                  withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeUpdate:

            [self.tableView reloadRowsAtIndexPaths:@[indexPath]
                                  withRowAnimation:UITableViewRowAnimationFade];
            break;

        case NSFetchedResultsChangeMove:

            if (self.sectionsUpdated) {

                [self.tableView deleteRowsAtIndexPaths:@[indexPath]
                                      withRowAnimation:UITableViewRowAnimationFade];
                [self.tableView insertRowsAtIndexPaths:@[newIndexPath]
                                      withRowAnimation:UITableViewRowAnimationFade];

                self.sectionsUpdated = NO;
            }
            else {
                [self.tableView moveRowAtIndexPath:indexPath toIndexPath:newIndexPath];
            }
            break;
    }
}

#pragma Private methods

- (void)performFetch
{
    NSError *error;
    [self.fetchedResultsController performFetch:&error];

    DDLogInfo(@"Performing fetch on %@", self.fetchedResultsController);

    if (error) {
        DDLogError(@"Failed to perform fetch with - %@", [error localizedDescription]);
    }

    [self.tableView reloadData];
}

@end


text:
package org.elasticsearch.xpack.sql.expression.function.scalar.datetime;

import org.elasticsearch.xpack.sql.expression.Expression;
import org.elasticsearch.xpack.sql.expression.Expressions;
import org.elasticsearch.xpack.sql.expression.function.scalar.datetime.DateTimeProcessor.DateTimeExtractor;
import org.elasticsearch.xpack.sql.expression.gen.processor.Processor;
import org.elasticsearch.xpack.sql.tree.Source;

import java.time.OffsetTime;
import java.time.ZoneId;
import java.time.temporal.ChronoField;

import static org.elasticsearch.xpack.sql.expression.TypeResolutions.isDateOrTime;
import static org.elasticsearch.xpack.sql.util.DateUtils.asTimeAtZone;

public abstract class TimeFunction extends DateTimeFunction {

    TimeFunction(Source source, Expression field, ZoneId zoneId, DateTimeExtractor extractor) {
        super(source, field, zoneId, extractor);
    }

    public static Integer dateTimeChrono(OffsetTime time, String tzId, String chronoName) {
        return dateTimeChrono(asTimeAtZone(time, ZoneId.of(tzId)), ChronoField.valueOf(chronoName));
    }

    @Override
    protected TypeResolution resolveType() {
        return isDateOrTime(field(), sourceText(), Expressions.ParamOrdinal.DEFAULT);
    }

    @Override
    protected Processor makeProcessor() {
        return new TimeProcessor(extractor(), zoneId());
    }
}


text:
<?php

namespace Youwe\FileManagerBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

/**
 * This is the class that validates and merges configuration from your app/config files
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();

        $default_mimetypes = array(
            'image/png',
            'image/jpg',
            'image/jpeg',
            'image/gif',
            'application/pdf',
            'application/ogg',
            'video/mp4',
            'application/zip',
            'multipart/x-zip',
            'application/rar',
            'application/x-rar-compressed',
            'application/x-zip-compressed',
            'application/tar',
            'application/x-tar',
            'text/plain',
            'text/x-asm',
            'application/octet-stream'
        );

        $rootNode = $treeBuilder->root('youwe_file_manager');
        $rootNode
            ->children()
                ->arrayNode('mime_allowed')
                    ->prototype('scalar')->defaultValue($default_mimetypes)->cannotBeEmpty()->end()
                ->end()
                ->booleanNode('full_exception')
                    ->defaultFalse()
                ->end()
                ->scalarNode('upload_path')
                    ->defaultValue('%kernel.root_dir%/../web/uploads')->cannotBeEmpty()
                ->end()
                ->arrayNode('theme')
                    ->children()
                        ->scalarNode('css')
                            ->defaultValue("/bundles/youwefilemanager/css/simple/default.css")->cannotBeEmpty()
                        ->end()
                        ->scalarNode('template')
                            ->defaultValue('YouweFileManagerBundle:FileManager:file_manager.html.twig')->cannotBeEmpty()
                        ->end()
                    ->end()
                    ->addDefaultsIfNotSet()
                ->end()
                ->scalarNode('filter_images')
                    ->defaultFalse()
                ->end()
                ->scalarNode('usage_class')
                    ->defaultFalse()
                ->end()
            ->end();
        return $treeBuilder;
    }
}


text:
(function(global) {
  'use strict';

  var HISTORY_API_SUPPORTED = !!history.pushState;

  function toggleFolder(evt) {
    if ($(evt.target).closest('.actions').length) {
      // ignore if it comes from inside the action panel
      return;
    }
    $(this)
      .toggleClass('collapsed')
      .next('.sub-tree')
      .find('td > div')
      .slideToggle(150);
  }

  $(document).ready(function() {
    $('.attachments > .i-dropdown')
      .parent()
      .dropdown();
    if (!$('html').data('static-site')) {
      setupAttachmentPreview();
    }

    $(document).on('click', '[data-attachment-editor]', function(evt) {
      evt.preventDefault();
      var $this = $(this);
      if (this.disabled || $this.hasClass('disabled')) {
        return;
      }
      var locator = $(this).data('locator');
      var title = $(this).data('title');
      var reloadOnChange = $this.data('reload-on-change') !== undefined;
      openAttachmentManager(locator, title, reloadOnChange, $this);
    });
  });

  global.setupAttachmentPreview = function setupAttachmentPreview() {
    var attachment = $('.js-preview-dialog');
    var pageURL = location.href.replace(/#.*$/, '');

    // Previewer not supported on mobile browsers
    if ($.mobileBrowser) {
      return;
    }

    $(window)
      .on('hashchange', function(e, initial) {
        if (location.hash.indexOf('#preview:') !== 0) {
          $('.attachment-preview-dialog').trigger('ajaxDialog:close', [true]);
        } else {
          if (initial && HISTORY_API_SUPPORTED) {
            var hash = location.hash;
            // start with a clean state, i.e. [..., page, page+preview]
            history.replaceState({}, document.title, pageURL);
            history.pushState({}, document.title, location.href + hash);
          }
          var id = location.hash.split('#preview:')[1];
          previewAttachment(id);
        }
      })
      .triggerHandler('hashchange', [true]);

    attachment.on('click', function(e) {
      if (e.which != 1 || e.shiftKey || e.metaKey || e.ctrlKey || e.altKey) {
        // ignore middle clicks and modifier-clicks - people should be able to open
        // an attachment in a new tab/window skipping the previewer, even if they use
        // a weird mouse with less than three buttons.
        return;
      }
      e.preventDefault();
      location.hash = '#preview:{0}'.format($(this).data('attachmentId'));
    });

    function clearHash() {
      if (HISTORY_API_SUPPORTED) {
        // if we have the history api, we can assume that the previous state is the same page without
        // a preview hash (since we ensure this in the initial/fake hashchange event on page load)
        history.back();
      } else {
        // old browsers with no pushState support: the # wil stay which is a bit ugly,
        // but let's not break history (we WILL "spam" history though, but that's what you
        // get when using ancient browsers)
        location.hash = '';
      }
    }

    function previewAttachment(id) {
      var attachment = $('.attachment[data-previewable][data-attachment-id="{0}"]'.format(id));
      if (!attachment.length) {
        clearHash();
        return;
      }
      ajaxDialog({
        url: build_url(attachment.attr('href'), {preview: '1'}),
        title: attachment.data('title'),
        dialogClasses: 'attachment-preview-dialog',
        onClose: function(data) {
          $('body').off('keydown.attachmentPreview');
          $('html, body').removeClass('prevent-scrolling');
          if (!data) {
            // get rid of the hash if we closed the dialog manually (i.e. not using the back button,
            // in which case the hash should already be gone)
            clearHash();
          }
        },
        onOpen: function(popup) {
          var dialog = popup.canvas.closest('.ui-dialog');
          dialog.prev('.ui-widget-overlay').addClass('attachment-preview-overlay');
          popup.canvas
            .find('.attachment-preview-content-wrapper, .js-close-preview')
            .on('click', function() {
              popup.canvas.trigger('ajaxDialog:close');
            });
          popup.canvas.find('.attachment-download').on('click', function() {
            var $this = $(this);
            var href = $this.attr('href');
            $this.attr('href', build_url(href, {from_preview: '1', download: '1'}));
            _.defer(function() {
              $this.attr('href', href);
            });
          });
          popup.canvas
            .find('.attachment-preview-content, .attachment-preview-top-bar')
            .on('click', function(e) {
              e.stopPropagation();
            });
          $('body')
            .add(dialog)
            .on('keydown.attachmentPreview', function(e) {
              if (e.which === $.ui.keyCode.ESCAPE) {
                popup.canvas.trigger('ajaxDialog:close');
              }
            });
          $('html, body').addClass('prevent-scrolling');
          // for some reason the dialog is hidden when its position
          // gets updated so we explicitly show it.
          _.defer(function() {
            dialog.show();
          });
        },
        onLoadError: function(xhr) {
          var hash = location.hash;
          clearHash();
          if (xhr.status == 404) {
            alertPopup($T.gettext('This file no longer exists. Please reload the page.'));
            return false;
          } else if (xhr.status != 403) {
            return;
          }
          if (Indico.User && Indico.User.id !== undefined) {
            alertPopup($T('You are not authorized to access this file.'), $T('Access Denied'));
          } else {
            var msg = $T('This file is protected. You will be redirected to the login page.');
            confirmPrompt(msg, $T('Access Denied')).then(function() {
              location.href = build_url(Indico.Urls.Login, {next: location.href + hash});
            });
          }
          return false;
        },
      });
    }
  };

  global.setupAttachmentTreeView = function setupAttachmentTreeView() {
    $('.attachments-box').on('click', '.tree .expandable', toggleFolder);
  };

  global.setupAttachmentEditor = function setupAttachmentEditor() {
    var editor = $('.attachment-editor');

    function flagChanged() {
      editor.trigger('ajaxDialog:setData', [true]);
    }

    editor
      .on('click', '.tree .expandable', toggleFolder)
      .on('click', '.js-dialog-action', function(e) {
        e.preventDefault();
        var $this = $(this);
        ajaxDialog({
          trigger: this,
          url: $this.data('href'),
          title: $this.data('title'),
          hidePageHeader: true,
          onClose: function(data) {
            if (data) {
              $('#attachments-container').html(data.attachment_list);
              flagChanged();
            }
          },
        });
      })
      .on('indico:confirmed', '.js-delete', function(e) {
        e.preventDefault();

        var $this = $(this);
        $.ajax({
          url: $this.data('href'),
          method: $this.data('method'),
          complete: IndicoUI.Dialogs.Util.progress(),
          error: handleAjaxError,
          success: function(data) {
            $('#attachments-container').html(data.attachment_list);
            handleFlashes(data, true, editor);
            flagChanged();
          },
        });
      });
  };

  global.openAttachmentManager = function openAttachmentManager(
    itemLocator,
    title,
    reloadOnChange,
    trigger
  ) {
    reloadOnChange = reloadOnChange === undefined ? true : reloadOnChange;
    ajaxDialog({
      trigger: trigger,
      url: build_url(Indico.Urls.AttachmentManager, itemLocator),
      title: title || $T.gettext('Manage material'),
      confirmCloseUnsaved: false,
      hidePageHeader: true,
      onClose: function(callbackData, customData) {
        if (customData && reloadOnChange) {
          location.reload();
        } else if (customData && trigger) {
          trigger.trigger('attachments:updated');
        }
      },
    });
  };

  global.reloadManagementAttachmentInfoColumn = function reloadManagementAttachmentInfoColumn(
    itemLocator,
    column
  ) {
    $.ajax({
      url: build_url(Indico.Urls.ManagementAttachmentInfoColumn, itemLocator),
      method: 'GET',
      error: handleAjaxError,
      success: function(data) {
        column.replaceWith(data.html);
      },
    });
  };

  global.messageIfFolderProtected = function messageIfFolderProtected(
    protectionField,
    folderField,
    protectionInfo,
    selfProtection,
    inheritedProtection,
    folderProtection
  ) {
    folderField.on('change', function() {
      var selectedFolder = $(this);
      if (protectionInfo[selectedFolder.val()] && !protectionField.prop('checked')) {
        selfProtection.hide();
        inheritedProtection.hide();
        folderProtection
          .find('.folder-name')
          .html(selectedFolder.children('option:selected').text());
        folderProtection.show();
      } else {
        folderProtection.hide();
        selfProtection.toggle(protectionField.prop('checked'));
        inheritedProtection.toggle(!protectionField.prop('checked'));
      }
    });
    _.defer(function() {
      folderField.triggerHandler('change');
    });
  };

  global.setupAttachmentTooltipButtons = function setupAttachmentTooltipButtons() {
    $('.attachments-tooltip-button').each(function() {
      var button = $(this);
      button.qtip({
        content: {
          text: button.next('.material_list'),
        },
        show: {
          event: 'click',
        },
        hide: {
          event: 'unfocus',
        },
        position: {
          my: 'top right',
          at: 'bottom left',
        },
        events: {
          show: function() {
            button.addClass('open');
          },
          hide: function() {
            button.removeClass('open');
          },
        },
        style: {
          classes: 'material_tip',
        },
      });
    });
  };
})(window);


text:
class Factory

  # Raised when defining an invalid attribute:
  # * Defining an attribute which has a name ending in "="
  # * Defining an attribute with both a static and lazy value
  # * Defining an attribute twice in the same factory
  class AttributeDefinitionError < RuntimeError
  end

  class Attribute #:nodoc:

    attr_reader :name

    def initialize(name)
      @name = name.to_sym

      if @name.to_s =~ /=$/
        raise AttributeDefinitionError,
          "factory_girl uses 'f.#{@name.to_s.chop} value' syntax " +
          "rather than 'f.#{@name} = value'"
      end
    end

    def add_to(proxy)
    end
  end

end


text:
import pageHalNamespace from './../page-hal/namespace';
import Component from './component';

// import _debug from './debug'; const debug = _debug('container');

const { getNamespaceSubstate, wrapContainer } = window.WarpJS.ReactUtils;

const mapStateToProps = (state, ownProps) => {
    const pageHalSubstate = getNamespaceSubstate(state, pageHalNamespace);

    if (pageHalSubstate.pages && pageHalSubstate.pages.length) {
        const page = pageHalSubstate.pages[0];
        if (page._links && page._links.pdfExport) {
            return {
                show: true,
                url: page._links.pdfExport.href
            };
        }
    }
    return {};
};

const mapDispatchToProps = (dispatch, ownProps) => Object.freeze({
    click: (url) => () => {
        if (url) {
            window.open(url, '_blank');
        }
    }
});

const mergeProps = (stateProps, dispatchProps, ownProps) => Object.freeze({
    ...stateProps,
    ...dispatchProps,
    click: dispatchProps.click(stateProps.url),
    ...ownProps
});

export default wrapContainer(Component, mapStateToProps, mapDispatchToProps, mergeProps);


text:
@implementation WebSocketConnection

- (NSDictionary *)replaceWebSocketLocationWithName:(NSString *)socketName {
	NSMutableDictionary *replaceDict = [NSMutableDictionary dictionary];

	// WEBSOCKET_URL
	NSString *wsLocation;
	NSString *wsHost = [request headerField:@"Host"];
	if (wsHost == nil) {
		NSString *port = [NSString stringWithFormat:@"%hu", [asyncSocket localPort]];
		wsLocation = [NSString stringWithFormat:@"ws://localhost:%@/%@", port, socketName];
	} else {
		wsLocation = [NSString stringWithFormat:@"ws://%@/%@", wsHost, socketName];
	}
	[replaceDict setObject:wsLocation forKey:@"WEBSOCKET_URL"];

	// FILELOG_NAME
	NSString *full_path = [[FLogObjectiveC sharedInstance] fullPath];
	[replaceDict setObject:full_path forKey:@"FILELOG_NAME"];

	return replaceDict;
}

- (NSObject<HTTPResponse> *)httpResponseForMethod:(NSString *)method URI:(NSString *)path {
	NSLog(@"WebSocket - [HTTP %@] %@", method, path);

	if (([path isEqualToString:@"/"]) || ([path isEqualToString:@"/index.html"])) {
		return [[HTTPDynamicFileResponse alloc] initWithFilePath:[self filePathForURI:path] forConnection:self
						   separator:@"%%" replacementDictionary:[self replaceWebSocketLocationWithName:@"flog"]];
	}

	return [super httpResponseForMethod:method URI:path];
}

- (WebSocket *)webSocketForURI:(NSString *)path
{
	NSLog(@"WebSocket - [ws] %@", path);

	if ([path isEqualToString:@"/flog"]) {
		return [[FilelogWebSocket alloc] initWithRequest:request socket:asyncSocket];
	}

	return [super webSocketForURI:path];
}

@end


text:
vs-rebuilder
============

Thin wrapper around RegExp that helps to build complex regular expressions


text:
using System;
using System.Collections;
using System.Collections.Generic;

namespace net.r_eg.MvsSln.Core
{
    public sealed class RoProperties: RoProperties<string, string>
    {
        public RoProperties(IDictionary<string, string> data)
            : base(data)
        {

        }
    }

    public class RoProperties<T, T2>: IDictionary<T, T2>
    {
        private IDictionary<T, T2> dict;

        public T2 this[T key] { get => dict[key]; set => throw new NotSupportedException(); }

        public ICollection<T> Keys => dict.Keys;

        public ICollection<T2> Values => dict.Values;

        public int Count => dict.Count;

        public bool IsReadOnly => true;

        public IDictionary<T, T2> ExtractDictionary { get => new Dictionary<T, T2>(dict); }

        public bool ContainsKey(T key) => dict.ContainsKey(key);

        public void CopyTo(KeyValuePair<T, T2>[] array, int index) => dict.CopyTo(array, index);

        public IEnumerator<KeyValuePair<T, T2>> GetEnumerator() => dict.GetEnumerator();

        public bool TryGetValue(T key, out T2 value) => dict.TryGetValue(key, out value);

        IEnumerator IEnumerable.GetEnumerator() => dict.GetEnumerator();

        public static implicit operator RoProperties<T, T2>(Dictionary<T, T2> dict)
        {
            return new RoProperties<T, T2>(dict);
        }

        public RoProperties(IDictionary<T, T2> data)
        {
            dict = data ?? throw new ArgumentNullException(nameof(data), MsgResource.ValueNoEmptyOrNull);
        }

        #region ExplicitImpl

        void IDictionary<T, T2>.Add(T key, T2 value) => Add(key, value);

        void ICollection<KeyValuePair<T, T2>>.Add(KeyValuePair<T, T2> item) => Add(item);

        void ICollection<KeyValuePair<T, T2>>.Clear() => Clear();

        bool ICollection<KeyValuePair<T, T2>>.Contains(KeyValuePair<T, T2> item) => Contains(item);

        bool IDictionary<T, T2>.Remove(T key) => Remove(key);

        bool ICollection<KeyValuePair<T, T2>>.Remove(KeyValuePair<T, T2> item) => Remove(item);

        #endregion

        #region NotSupported

        protected void Add(T key, T2 value)
        {
            throw new NotSupportedException();
        }

        protected void Add(KeyValuePair<T, T2> item)
        {
            throw new NotSupportedException();
        }

        protected void Clear()
        {
            throw new NotSupportedException();
        }

        protected bool Contains(KeyValuePair<T, T2> item)
        {
            throw new NotSupportedException();
        }

        protected bool Remove(T key)
        {
            throw new NotSupportedException();
        }

        protected bool Remove(KeyValuePair<T, T2> item)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}


text:
..  Copyright 2014-2016 Ivan Kravets <me@ikravets.com>
    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.

.. _projectconf:

Project Configuration File ``platformio.ini``
=============================================

The Project configuration file is named ``platformio.ini``. This is a
`INI-style <http://en.wikipedia.org/wiki/INI_file>`_ file.

``platformio.ini`` has sections (each denoted by a ``[header]``) and
key / value pairs within the sections. Lines beginning with ``#`` or ``;``
are ignored and may be used to provide comments.

The sections and their allowable values are described below.

.. contents::

Section ``[platformio]``
------------------------

A ``platformio`` section is used for overriding default configuration options

.. note::
    Relative path is allowed for directory option:

    * ``~`` will be expanded to user's home directory
    * ``../`` or ``..\`` go up to one folder

Options
~~~~~~~

.. _projectconf_pio_home_dir:

``home_dir``
^^^^^^^^^^^^

Is used to store platform toolchains, frameworks, external libraries,
service data and etc.

A default value is User's home directory:

* Unix ``~/.platformio``
* Windows ``%HOMEPATH%\.platformio``

This option can be overridden by global environment variable
:envvar:`PLATFORMIO_HOME_DIR`.

.. _projectconf_pio_lib_dir:

``lib_dir``
^^^^^^^^^^^

This directory is used to store external libraries downloaded by
:ref:`librarymanager`.

A default value is ``%home_dir%/lib``.

This option can be overridden by global environment variable
:envvar:`PLATFORMIO_LIB_DIR`.

.. note::
    You can put here your own/private libraries. The source code of each
    library should be placed in separate directory. For example,
    ``%lib_dir%/private_lib/[here are source files]``.

.. _projectconf_pio_src_dir:

``src_dir``
^^^^^^^^^^^

A path to project's source directory. PlatformIO uses it for :ref:`cmd_run`
command.

A default value is ``src`` which means that folder is located in the root of
project.

This option can be overridden by global environment variable
:envvar:`PLATFORMIO_SRC_DIR`.

.. note::
    This option is useful for people who migrate from Arduino/Energia IDEs where
    source directory should have the same name like the main source file.
    See `example <https://github.com/platformio/platformio/tree/develop/examples/atmelavr-and-arduino/arduino-own-src_dir>`__ project with own source directory.

.. _projectconf_pio_envs_dir:

``envs_dir``
^^^^^^^^^^^^

*PlatformIO Builder* within :ref:`cmd_run` command uses this folder for project
environments to store compiled object files, static libraries, firmwares and
other cached information. It allows PlatformIO to build source code extremely
fast!

*You can delete this folder without any risk!* If you modify :ref:`projectconf`,
then PlatformIO will remove this folder automatically. It will be created on the
next build operation.

A default value is ``.pioenvs`` which means that folder is located in the root of
project.

This option can be overridden by global environment variable
:envvar:`PLATFORMIO_ENVS_DIR`.

.. note::
    If you have any problems with building your Project environmets which
    are defined in :ref:`projectconf`, then **TRY TO DELETE** this folder. In
    this situation you will remove all cached files without any risk.

.. _projectconf_pio_data_dir:

``data_dir``
^^^^^^^^^^^^

Data directory to store contents and :ref:`platform_espressif_uploadfs`.

A default value is ``data`` which means that folder is located in the root of
project.

This option can be overridden by global environment variable
:envvar:`PLATFORMIO_DATA_DIR`.

----------

Section ``[env:NAME]``
----------------------

A section with ``env:`` prefix is used to define virtual environment with
specific options that will be processed with :ref:`cmd_run` command. You can
define unlimited numbers of environments.

Each environment must have unique ``NAME``. The valid chars for ``NAME`` are

* letters ``a-z``
* numbers ``0-9``
* special char ``_`` (underscore)

For example, ``[env:hello_world]``.

General options
~~~~~~~~~~~~~~~

.. _projectconf_env_platform:

``platform``
^^^^^^^^^^^^

:ref:`Platform <platforms>` type.

.. _projectconf_env_framework:

``framework``
^^^^^^^^^^^^^

:ref:`Framework <frameworks>` type.

The multiple frameworks are allowed, split them with comma ``,`` separator.

.. _projectconf_env_board:

``board``
^^^^^^^^^

*PlatformIO* has pre-configured settings for the most popular boards. You don't
need to specify ``board_mcu``, ``board_f_cpu``, ``upload_protocol`` or
``upload_speed`` options. Just define a ``board`` type and *PlatformIO* will
pre-fill options described above with appropriate values.

You can find the ``board`` type in *Boards* section of each :ref:`platforms` or
using `PlatformIO Embedded Boards Explorer <http://platformio.org/#!/boards>`_.

Board options
~~~~~~~~~~~~~

``board_mcu``
^^^^^^^^^^^^^

``board_mcu`` is a microcontroller(MCU) type that is used by compiler to
recognize MCU architecture. The correct type of ``board_mcu`` depends on
platform library. For example, the list of ``board_mcu`` for "megaAVR Devices"
is described `here <http://www.nongnu.org/avr-libc/user-manual/>`_.

The full list of ``board_mcu`` for the popular embedded platforms you can find
in *Boards* section of :ref:`platforms`. See "Microcontroller" column.

.. _projectconf_board_f_cpu:

``board_f_cpu``
^^^^^^^^^^^^^^^

An option ``board_f_cpu`` is used to define MCU frequency (Hertz, Clock). A
format of this option is ``C-like long integer`` value with ``L`` suffix. The
1 Hertz is equal to ``1L``, then 16 Mhz (Mega Hertz) is equal to ``16000000L``.

The full list of ``board_f_cpu`` for the popular embedded platforms you can
find in *Boards* section of :ref:`platforms`. See "Frequency" column. You can
overclock a board by specifying a ``board_f_cpu`` value other than the default.

.. _projectconf_board_f_flash:

``board_f_flash``
^^^^^^^^^^^^^^^^^

An option ``board_f_flash`` is used to define FLASH chip frequency (Hertz, Clock). A
format of this option is ``C-like long integer`` value with ``L`` suffix. The
1 Hertz is equal to ``1L``, then 40 Mhz (Mega Hertz) is equal to ``40000000L``.

This option isn't available for the all development platforms. The only
:ref:`platform_espressif` supports it.

.. _projectconf_board_flash_mode:

``board_flash_mode``
^^^^^^^^^^^^^^^^^^^^

Flash chip interface mode. This option isn't available for the all development
platforms. The only :ref:`platform_espressif` supports it.

Building options
~~~~~~~~~~~~~~~~

.. _projectconf_build_flags:

``build_flags``
^^^^^^^^^^^^^^^

These flags/options control preprocessing, compilation, assembly and linking
processes:

.. list-table::
    :header-rows:  1

    * - Format
      - Scope
      - Description
    * - ``-D name``
      - CPPDEFINES
      - Predefine *name* as a macro, with definition 1.
    * - ``-D name=definition``
      - CPPDEFINES
      - The contents of *definition* are tokenized and processed as if they
        appeared during translation phase three in a ``#define`` directive.
    * - ``-U name``
      - CPPDEFINES
      - Cancel any previous definition of *name*, either built in or provided
        with a ``-D`` option.
    * - ``-Wp,option``
      - CPPFLAGS
      - Bypass the compiler driver and pass *option* directly  through to the
        preprocessor
    * - ``-Wall``
      - CCFLAGS
      - Turns on all optional warnings which are desirable for normal code.
    * - ``-Werror``
      - CCFLAGS
      - Make all warnings into hard errors. Source code which triggers warnings will be rejected.
    * - ``-w``
      - CCFLAGS
      - Suppress all warnings, including those which GNU CPP issues by default.
    * - ``-include file``
      - CCFLAGS
      - Process *file* as if ``#include "file"`` appeared as the first line of
        the primary source file.
    * - ``-Idir``
      - CPPPATH
      - Add the directory *dir* to the list of directories to be searched
        for header files.
    * - ``-Wa,option``
      - ASFLAGS, CCFLAGS
      - Pass *option* as an option to the assembler. If *option* contains
        commas, it is split into multiple options at the commas.
    * - ``-Wl,option``
      - LINKFLAGS
      - Pass *option* as an option to the linker. If *option* contains
        commas, it is split into multiple options at the commas.
    * - ``-llibrary``
      - LIBS
      - Search the *library* named library when linking
    * - ``-Ldir``
      - LIBPATH
      - Add directory *dir* to the list of directories to be searched for
        ``-l``.

This option can be set by global environment variable
:envvar:`PLATFORMIO_BUILD_FLAGS`.

Example:

.. code-block::   ini

    [env:specific_defines]
    build_flags = -DFOO -DBAR=1 -DFLOAT_VALUE=1.23457e+07

    [env:string_defines]
    build_flags = '-DHELLO="World!"' '-DWIFI_PASS="My password"'

    [env:specific_inclibs]
    build_flags = -I/opt/include -L/opt/lib -lfoo

    [env:specific_ld_script]
    build_flags = -Wl,-T/path/to/ld_script.ld

For more detailed information about available flags/options go to:

* `Options to Request or Suppress Warnings
  <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html>`_
* `Options for Debugging Your Program
  <https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html>`_
* `Options That Control Optimization
  <https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html>`_
* `Options Controlling the Preprocessor
  <https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html>`_
* `Passing Options to the Assembler
  <https://gcc.gnu.org/onlinedocs/gcc/Assembler-Options.html>`_
* `Options for Linking <https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html>`_
* `Options for Directory Search
  <https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html>`_

.. _projectconf_src_build_flags:

``src_build_flags``
^^^^^^^^^^^^^^^^^^^

An option ``src_build_flags`` has the same behaviour like ``build_flags``
but will be applied only for the project source code from
:ref:`projectconf_pio_src_dir` directory.

This option can be set by global environment variable
:envvar:`PLATFORMIO_SRC_BUILD_FLAGS`.

.. _projectconf_src_filter:

``src_filter``
^^^^^^^^^^^^^^

This option allows to specify which source files should be included/excluded
from build process. Filter supports 2 templates:

* ``+<PATH>`` include template
* ``-<PATH>`` exclude template

``PATH`` MAST BE related from :ref:`projectconf_pio_src_dir`. All patterns will
be applied in theirs order.
`GLOB Patterns <http://en.wikipedia.org/wiki/Glob_(programming)>`_ are allowed.

By default, ``src_filter`` is predefined to
``+<*> -<.git/> -<svn/> -<example/> -<examples/> -<test/> -<tests/>``,
which means "includes ALL files, then
exclude ``.git`` and ``svn`` repository folders, ``example`` ... folder.

This option can be set by global environment variable
:envvar:`PLATFORMIO_SRC_FILTER`.

.. _projectconf_extra_script:

``extra_script``
^^^^^^^^^^^^^^^^

Allows to launch extra script using `SCons <http://www.scons.org>`_ software
construction tool. For more details please follow to "Construction Environments"
section of
`SCons documentation <http://www.scons.org/doc/production/HTML/scons-user.html#chap-environments>`_.

This option can be set by global environment variable
:envvar:`PLATFORMIO_EXTRA_SCRIPT`.

Example, specify own upload command for :ref:`platform_atmelavr`:

``platformio.ini``:

.. code-block:: ini

    [env:env_with_specific_extra_script]
    platform = atmelavr
    extra_script = /path/to/extra_script.py
    custom_option = hello

``extra_script.py``:

.. code-block:: python

    from SCons.Script import DefaultEnvironment

    env = DefaultEnvironment()

    env.Replace(UPLOADHEXCMD='"$UPLOADER" ${ARGUMENTS.get("custom_option")} --uploader --flags')

    # uncomment line below to see environment variables
    # print env.Dump()
    # print ARGUMENTS

* see built-in examples of `PlatformIO build scripts <https://github.com/platformio/platformio/tree/develop/platformio/builder/scripts>`_.
* take a look at the multiple snippets/answers for the user questions:

  - `#462 Split C/C++ build flags <https://github.com/platformio/platformio/issues/462#issuecomment-172667342>`_
  - `#365 Extra configuration for ESP8266 uploader <https://github.com/platformio/platformio/issues/365#issuecomment-163695011>`_
  - `#351 Specific reset method for ESP8266 <https://github.com/platformio/platformio/issues/351#issuecomment-161789165>`_
  - `#247 Specific options for avrdude <https://github.com/platformio/platformio/issues/247#issuecomment-118169728>`_.

``targets``
^^^^^^^^^^^

A list with targets which will be processed by :ref:`cmd_run` command by
default. You can enter more than one target separated with "space".

The list with available targets is located in :option:`platformio run --target`.

**Tip!** You can use these targets like an option to
:option:`platformio run --target` command. For example:

.. code-block:: bash

    # clean project
    platformio run -t clean

    # dump curent build environment
    platformio run --target envdump

When no targets are defined, *PlatformIO* will build only sources by default.

Uploading options
~~~~~~~~~~~~~~~~~

.. _projectconf_upload_port:

``upload_port``
^^^^^^^^^^^^^^^

This option is used by "uploader" tool when sending firmware to board via
``upload_port``. For example,

* ``/dev/ttyUSB0`` - Unix-based OS
* ``COM3`` - Windows OS
* ``192.168.0.13`` - IP address when using OTA

If ``upload_port`` isn't specified, then *PlatformIO* will try to detect it
automatically.

To print all available serial ports use :ref:`cmd_serialports` command.

This option can be set by global environment variable
:envvar:`PLATFORMIO_UPLOAD_PORT`.

``upload_protocol``
^^^^^^^^^^^^^^^^^^^

A protocol that "uploader" tool uses to talk to the board.

.. _projectconf_upload_speed:

``upload_speed``
^^^^^^^^^^^^^^^^

A connection speed (`baud rate <http://en.wikipedia.org/wiki/Baud>`_)
which "uploader" tool uses when sending firmware to board.

.. _projectconf_upload_flags:

``upload_flags``
^^^^^^^^^^^^^^^^

Extra flags for uploader. Will be added to the end of uploader command. If you
need to override uploader command or base flags please use :ref:`projectconf_extra_script`.

This option can be set by global environment variable
:envvar:`PLATFORMIO_UPLOAD_FLAGS`.

.. _projectconf_upload_resetmethod:

``upload_resetmethod``
^^^^^^^^^^^^^^^^^^^^^^

Specify reset method for "uploader" tool. This option isn't available for all
development platforms. The only :ref:`platform_espressif` supports it.

Library options
~~~~~~~~~~~~~~~

``lib_install``
^^^^^^^^^^^^^^^

Specify dependent libraries which should be installed before environment
process. The only library IDs are allowed. Multiple libraries can be passed
using comma ``,`` sign.

You can obtain library IDs using :ref:`cmd_lib_search` command.

Example:

.. code-block:: ini

    [env:depends_on_some_libs]
    lib_install = 1,13,19

``lib_use``
^^^^^^^^^^^

Specify libraries which should be used by ``Library Dependency Finder (LDF)`` with
the highest priority.

Example:

.. code-block:: ini

    [env:libs_with_highest_priority]
    lib_use = OneWire_ID1,SPI

``lib_ignore``
^^^^^^^^^^^^^^

Specify libraries which should be ignored by ``Library Dependency Finder (LDF)``

Example:

.. code-block:: ini

    [env:ignore_some_libs]
    lib_ignore = SPI,EngduinoV3_ID123

``lib_dfcyclic``
^^^^^^^^^^^^^^^^

Control cyclic (recursive) behaviour for ``Library Dependency Finder (LDF)``.
By default, this option is turned OFF (``lib_dfcyclic=False``) and means that
``LDF`` will find only libraries which are included in source files from the
project :ref:`projectconf_pio_src_dir`.

If you want to enable cyclic (recursive, nested) search, please set this option
to ``True``. Founded library will be treated like a new source files and
``LDF`` will search dependencies for it.

Example:

.. code-block:: ini

    [env:libs_with_enabled_ldf_cyclic]
    lib_dfcyclic = True

-----------

.. _projectconf_examples:

Examples
--------

.. note::
    A full list with project examples can be found in
    `PlatformIO Repository <https://github.com/platformio/platformio/tree/develop/examples>`_.

1. :ref:`platform_atmelavr`: Arduino UNO board with auto pre-configured
   ``board_*`` and ``upload_*`` options (use only ``board`` option) and Arduino
   Wiring-based Framework

.. code-block:: ini

    [env:atmelavr_arduino_uno_board]
    platform = atmelavr
    framework = arduino
    board = uno

    # enable auto-uploading
    targets = upload

2. :ref:`platform_atmelavr`: Embedded board that is based on ATmega168 MCU with
   "arduino" bootloader

.. code-block:: ini

    [env:atmelavr_atmega168_board]
    platform = atmelavr
    board_mcu = atmega168
    board_f_cpu = 16000000L

    upload_port = /dev/ttyUSB0
    # for Windows OS
    # upload_port = COM3
    upload_protocol = arduino
    upload_speed = 19200

    # enable auto-uploading
    targets = upload

3. Upload firmware via USB programmer (USBasp) to :ref:`platform_atmelavr`
   microcontrollers

.. code-block:: ini

    [env:atmelavr_usbasp]
    platform = atmelavr
    framework = arduino
    board = pro8MHzatmega328
    upload_protocol = usbasp
    upload_flags = -Pusb -B5

Then upload firmware using target ``program`` for :option:`platformio run --target`.
command. To use other programmers see :ref:`atmelavr_upload_via_programmer`.

4. :ref:`platform_ststm32`: Upload firmware using GDB script ``upload.gdb``,
   `issue #175 <https://github.com/platformio/platformio/issues/175>`_

.. code-block:: ini

    [env:st_via_gdb]
    platform = ststm32
    board = armstrap_eagle512
    upload_protocol = gdb

Also, take a look at this article `Armstrap Eagle and PlatformIO <http://isobit.io/2015/08/08/armstrap.html>`_.

5. :ref:`platform_ststm32`: Upload firmware using ST-Link instead mbed's media
   disk

.. code-block:: ini

    [env:stlink_for_mbed]
    platform = ststm32
    board = disco_f100rb
    upload_protocol = stlink


text:
struct Blank8hp : Module {
	enum ParamIds {
		NUM_PARAMS
	};

	enum InputIds {
		NUM_INPUTS
	};

	enum OutputIds {
		NUM_OUTPUTS
	};

	Blank8hp();
	void step() override;
};

Blank8hp::Blank8hp()
{
	params.resize(NUM_PARAMS);
	inputs.resize(NUM_INPUTS);
	outputs.resize(NUM_OUTPUTS);
}

void Blank8hp::step()
{
}

Blank8hpWidget::Blank8hpWidget()
{
	Blank8hp *module = new Blank8hp();
	setModule(module);
	box.size = Vec(15 * 8, 380);

	{
		Panel *panel = new LightPanel();
		panel->backgroundImage = Image::load("plugins/av500/res/Blank8hp.png");
		panel->box.size = box.size;
		addChild(panel);
	}

	addChild(createScrew<ScrewSilver>(Vec(15,   0)));
	addChild(createScrew<ScrewSilver>(Vec(15, 365)));

}


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

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/quick_forward"
        android:title="Forward"
        android:icon="@drawable/action_forward"/>
    <item android:id="@+id/quick_delete"
        android:title="Delete"
        android:icon="@android:drawable/ic_menu_delete"/>
</menu>


text:
package org.apache.heron.common.utils.tuple;

import java.util.List;

import org.apache.heron.api.generated.TopologyAPI;
import org.apache.heron.api.topology.TopologyContext;
import org.apache.heron.api.tuple.Fields;
import org.apache.heron.api.tuple.Tuple;
import org.apache.heron.proto.system.HeronTuples;

/**
 * The tuple is the main data structure in Heron. A tuple is a named list of values,
 * where each value can be any type. Tuples are dynamically typed -- the types of the fields
 * do not need to be declared. Tuples have helper methods like getInteger and getString
 * to get field values without having to cast the result.
 *

 * Heron needs to know how to serialize all the values in a tuple. By default, Heron
 * knows how to serialize the primitive types, strings, and byte arrays. If you want to
 * use another type, you'll need to implement and register a serializer for that type.
 *
 * @see Storm serialization
 */
public class TupleImpl implements Tuple {
  private static final long serialVersionUID = -5524957157094337394L;
  private final Fields fields;
  private final TopologyAPI.StreamId stream;
  private final long tupleKey;
  private final List<HeronTuples.RootId> roots;
  private final long creationTime;
  private final int sourceTaskId;

  private List<Object> values;

  public TupleImpl(TopologyContext context, TopologyAPI.StreamId stream,
                   long tupleKey, List<HeronTuples.RootId> roots,
                   List<Object> values, int sourceTaskId) {
    this(context, stream, tupleKey, roots, values, System.nanoTime(), true, sourceTaskId);
  }

  public TupleImpl(TopologyContext context, TopologyAPI.StreamId stream,
                   long tupleKey, List<HeronTuples.RootId> roots,
                   List<Object> values, long creationTime, boolean isCheckRequired,
                   int sourceTaskId) {
    this.stream = stream;
    this.tupleKey = tupleKey;
    this.roots = roots;
    this.values = values;
    this.creationTime = creationTime;
    this.sourceTaskId = sourceTaskId;
    this.fields = context.getComponentOutputFields(
        this.stream.getComponentName(), this.stream.getId());

    if (isCheckRequired) {
      if (values.size() != this.fields.size()) {
        throw new IllegalArgumentException(
            "Tuple created with wrong number of fields. "
                + "Expected " + this.fields.size() + " fields but got "
                + values.size() + " fields"
        );
      }
    }
  }

  public List<HeronTuples.RootId> getRoots() {
    return roots;
  }

  public long getTupleKey() {
    return tupleKey;
  }

  @Override
  public int size() {
    return values.size();
  }

  @Override
  public int fieldIndex(String field) {
    return getFields().fieldIndex(field);
  }

  @Override
  public boolean contains(String field) {
    return getFields().contains(field);
  }

  @Override
  public Object getValue(int i) {
    return values.get(i);
  }

  @Override
  public String getString(int i) {
    return (String) values.get(i);
  }

  @Override
  public Integer getInteger(int i) {
    return (Integer) values.get(i);
  }

  @Override
  public Long getLong(int i) {
    return (Long) values.get(i);
  }

  @Override
  public Boolean getBoolean(int i) {
    return (Boolean) values.get(i);
  }

  @Override
  public Short getShort(int i) {
    return (Short) values.get(i);
  }

  @Override
  public Byte getByte(int i) {
    return (Byte) values.get(i);
  }

  @Override
  public Double getDouble(int i) {
    return (Double) values.get(i);
  }

  @Override
  public Float getFloat(int i) {
    return (Float) values.get(i);
  }

  @Override
  public byte[] getBinary(int i) {
    return (byte[]) values.get(i);
  }

  @Override
  public Object getValueByField(String field) {
    return values.get(fieldIndex(field));
  }

  @Override
  public String getStringByField(String field) {
    return (String) values.get(fieldIndex(field));
  }

  @Override
  public Integer getIntegerByField(String field) {
    return (Integer) values.get(fieldIndex(field));
  }

  @Override
  public Long getLongByField(String field) {
    return (Long) values.get(fieldIndex(field));
  }

  @Override
  public Boolean getBooleanByField(String field) {
    return (Boolean) values.get(fieldIndex(field));
  }

  @Override
  public Short getShortByField(String field) {
    return (Short) values.get(fieldIndex(field));
  }

  @Override
  public Byte getByteByField(String field) {
    return (Byte) values.get(fieldIndex(field));
  }

  @Override
  public Double getDoubleByField(String field) {
    return (Double) values.get(fieldIndex(field));
  }

  @Override
  public Float getFloatByField(String field) {
    return (Float) values.get(fieldIndex(field));
  }

  @Override
  public byte[] getBinaryByField(String field) {
    return (byte[]) values.get(fieldIndex(field));
  }

  @Override
  public List<Object> getValues() {
    return values;
  }

  @Override
  public Fields getFields() {
    return this.fields;
  }

  @Override
  public List<Object> select(Fields selector) {
    return getFields().select(selector, values);
  }

  @Override
  public TopologyAPI.StreamId getSourceGlobalStreamId() {
    return stream;
  }

  @Override
  public String getSourceComponent() {
    return stream.getComponentName();
  }

  @Override
  public int getSourceTask() {
    return sourceTaskId;
  }

  @Override
  public String getSourceStreamId() {
    return stream.getId();
  }

  @Override
  public String toString() {
    return "source: " + getSourceComponent() + ", stream: " + getSourceStreamId()
        + ", " + values.toString();
  }

  @Override
  public boolean equals(Object other) {
    return this == other;
  }

  @Override
  public int hashCode() {
    return System.identityHashCode(this);
  }

  @Override
  public void resetValues() {
    values = null;
  }

  public long getCreationTime() {
    return creationTime;
  }
}


text:
package com.gdgcampinas.chat_firebase;

import android.app.Activity;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.firebase.client.ChildEventListener;
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.gdgcampinas.chat_firebase.animation.SlideInOutLeftItemAnimator;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends Activity {
    private EditText metText;
    private Button mbtSent;
    private Firebase mFirebaseRef;

    private List<Chat> mChats;
    private RecyclerView mRecyclerView;
    private ChatAdapter mAdapter;
    private String mId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        metText = (EditText) findViewById(R.id.etText);
        mbtSent = (Button) findViewById(R.id.btSent);
        mRecyclerView = (RecyclerView) findViewById(R.id.rvChat);
        mChats = new ArrayList<>();

        mId = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.setItemAnimator(new SlideInOutLeftItemAnimator(mRecyclerView));
        mAdapter = new ChatAdapter(this, mChats, mId);
        mRecyclerView.setAdapter(mAdapter);

        //Firebase - Inicia
        Firebase.setAndroidContext(this);
        mFirebaseRef = new Firebase("https://chat-dgd.firebaseio.com/").child("chat");

        mbtSent.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String message = metText.getText().toString();

                if(!message.isEmpty()) {

                    //Firebase - Envia mensagem
                    mFirebaseRef.push().setValue(new Chat(message, mId));
                }

                metText.setText("");
            }
        });

        //Firebase - Recebe mensagem
        mFirebaseRef.addChildEventListener(new ChildEventListener() {
            @Override
            public void onChildAdded(DataSnapshot dataSnapshot, String s) {
                if(dataSnapshot != null && dataSnapshot.getValue() != null) {

                    //Firebase - Converte a resposta em um objeto do tipo Chat
                    Chat model = dataSnapshot.getValue(Chat.class);

                    mChats.add(model);
                    mRecyclerView.scrollToPosition(mChats.size() - 1);
                    mAdapter.notifyItemInserted(mChats.size() - 1);
                }
            }

            @Override
            public void onChildChanged(DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onChildRemoved(DataSnapshot dataSnapshot) {

            }

            @Override
            public void onChildMoved(DataSnapshot dataSnapshot, String s) {

            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {

            }
        });
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>phaceGap Exemplo</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
    <link rel="stylesheet" href="styles.css">

Phacegap

            Login com Facebook

            Sobre eu

Nome:

            <textarea id="Message" placeholder="O Que Você esta pensando?" rows="5"></textarea>

            Compartilhar

            Logout

            Revogar Permissões


text:
<?php

/**
 * Provides methods to manipulate menu items.
 *
 * @abstract
 * @since           2.0.0
 * @since           3.3.1       Changed the name from `AdminPageFramework_Menu`.
 * @extends         AdminPageFramework_Menu_View
 * @package         AdminPageFramework
 * @subpackage      AdminPage
 */
abstract class AdminPageFramework_Menu_Controller extends AdminPageFramework_Menu_View {

     /**
      * Registers necessary callbacks and sets up properties.
      *
      * @internal
      */
    function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) {

        parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain );

        if ( $this->oProp->bIsAdminAjax ) {
            return;
        }

        add_action( 'admin_menu', array( $this, '_replyToBuildMenu' ), 98 );
    }

    /**
     * Sets to which top level page is going to be adding sub-pages.
     *
     *
Example

     *
     * $this->setRootMenuPage( 'Settings' );
     *
     * $this->setRootMenuPage(
     *     'APF Form',
     *     plugins_url( 'image/screen_icon32x32.jpg', __FILE__ )
     * );
     *
     * @acecss      public
     * @since       2.0.0
     * @since       2.1.6       The $sIcon16x16 parameter accepts a file path.
     * @since       3.0.0       The scope was changed to public from protected.
     * @remark      Only one root page can be set per one class instance.
     * @param       string      If the method cannot find the passed string from the following listed items, it will create a top level menu item with the passed string. ( case insensitive )
     *
Dashboard, Posts, Media, Links, Pages, Comments, Appearance, Plugins, Users, Tools, Settings, Network Admin

     * @param       string      (optional) the source of menu icon with either of the following forms:
     *

     *
the URL of the menu icon with the size of 16 by 16 in pixel.

     *
the file path of the menu icon with the size of 16 by 16 in pixel.

     *
the name of a Dashicons helper class to use a font icon, e.g. `dashicons-editor-customchar`.

     *
the string, 'none', to leave div.wp-menu-image empty so an icon can be added via CSS.

     *
a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.

     *

     * @param       string      (optional) the position number that is passed to the <var>$position</var> parameter of the add_menu_page() function.
     * @return      void
     */
    public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) {

        $sRootMenuLabel = trim( $sRootMenuLabel );
        $_sSlug         = $this->_isBuiltInMenuItem( $sRootMenuLabel ); // if true, this method returns the slug
        $this->oProp->aRootMenu = array(
            'sTitle'        => $sRootMenuLabel,
            'sPageSlug'     => $_sSlug ? $_sSlug : $this->oProp->sClassName,
            'sIcon16x16'    => $this->oUtil->resolveSRC( $sIcon16x16 ),
            'iPosition'     => $iMenuPosition,
            'fCreateRoot'   => $_sSlug ? false : true,
        );

    }
        /**
         * Checks if a menu item is a WordPress built-in menu item from the given menu label.
         *
         * @since       2.0.0
         * @internal
         * @return      void|string Returns the associated slug string, if true.
         */
        private function _isBuiltInMenuItem( $sMenuLabel ) {

            $_sMenuLabelLower = strtolower( $sMenuLabel );
            if ( array_key_exists( $_sMenuLabelLower, $this->_aBuiltInRootMenuSlugs ) )
                return $this->_aBuiltInRootMenuSlugs[ $_sMenuLabelLower ];

        }

    /**
     * Sets the top level menu page by page slug.
     *
     * The page should be already created or scheduled to be created separately.
     *
     *
Example

     *
     *  $this->setRootMenuPageBySlug( 'edit.php?post_type=apf_posts' );
     *
     *
     * @since       2.0.0
     * @since       3.0.0       The scope was changed to public from protected.
     * @access      public
     * @param       string      The page slug of the top-level root page.
     * @return      void
     */
    public function setRootMenuPageBySlug( $sRootMenuSlug ) {

        $this->oProp->aRootMenu['sPageSlug'] = $sRootMenuSlug; // do not sanitize the slug here because post types includes a question mark.
        $this->oProp->aRootMenu['fCreateRoot'] = false; // indicates to use an existing menu item.

    }

    /**
    * Adds sub-menu items on the left sidebar menu of the administration panel.
    *
    * It supports pages and links. Each of them has the specific array structure.
    *
    *
Example

    * $this->addSubMenuItems(
    *       array(
    *           'title'         => 'Various Form Fields',
    *           'page_slug'     => 'first_page',
    *           'screen_icon'   => 'options-general',
    *       ),
    *       array(
    *           'title'         => 'Manage Options',
    *           'page_slug'     => 'second_page',
    *           'screen_icon'   => 'link-manager',
    *       ),
    *       array(
    *           'title'         => 'Google',
    *           'href'          => 'http://www.google.com',
    *           'show_page_heading_tab' => false, // this removes the title from the page heading tabs.
    *       )
    * );
    *
    * @since        2.0.0
    * @since        3.0.0       Changed the scope to public.
    * @remark       The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
    * @remark       Accepts variadic parameters; the number of accepted parameters are not limited to three.
    * @param        array       $aSubMenuItem1      a first sub-menu array. A sub-menu array can be a link or a page. For the specifications of the array structures and its arguments, refer to the parameter section of the `addSubMenuItem()` method.
    * @param        array       $aSubMenuItem2      (optional) a second sub-menu array.
    * @param        array       $_and_more          (optional) a third and add items as many as necessary with next parameters.
    * @access       public
    * @return       void
    */
    public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2=null, $_and_more=null ) {
        foreach ( func_get_args() as $aSubMenuItem ) {
            $this->addSubMenuItem( $aSubMenuItem );
        }
    }

    /**
    * Adds the given sub-menu item on the left sidebar menu of the administration panel.
    *
    * It supports pages and links. Each of them has the specific array structure.
    *
    *
Example

    * $this->addSubMenuItem(
    *       array(
    *           'title'         => 'Read Me',
    *           'menu_title'    => 'About'
    *           'page_slug'     => 'my_plugin_readme',
    *       )
    * );
    *
    * @since        2.0.0
    * @since        3.0.0       Changed the scope to public.
    * @remark       The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
    * @param        array       a sub-menu array. It can be a page or a link. The array structures are as follows:
    *
Sub-menu Page Array

    *

    *
**title** - (string) the page title of the page.

    *
**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).

    *
**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below.
    *
edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic

    *
( Notes: the `generic` icon is available WordPress version 3.5 or above.)

    *

    *
**capability** - (optional, string) the access level to the created admin pages defined here. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.

    *
**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.

    *
**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.

    *
**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.

    *
**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.

    *
**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.

    *

    *
Sub-menu Link Array

    *

    *
**title** - (string) the link title.

    *
**href** - (string) the URL of the target link.

    *
**capability** - (optional, string) the access level to show the item, defined here. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.

    *
**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.

    *
**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.

    *
**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.

    *

    * @access       public
    * @return       void
    */
    public function addSubMenuItem( array $aSubMenuItem ) {
        if ( isset( $aSubMenuItem['href'] ) ) {
            $this->addSubMenuLink( $aSubMenuItem );
        } else {
            $this->addSubMenuPage( $aSubMenuItem );
        }
    }

    /**
    * Adds the given link into the menu on the left sidebar of the administration panel.
    *
    * @since        2.0.0
    * @since        3.0.0       Changed the scope to public from protected.
    * @param        string      the menu title.
    * @param        string      the URL linked to the menu.
    * @param        string      (optional) the access level.
    * @param        string      (optional) the order number. The larger it is, the lower the position it gets.
    * @param        string      (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page.
    * @access       protected
    * @return       void
    * @internal
    */
    protected function addSubMenuLink( array $aSubMenuLink ) {

        // If required keys are not set, return.
        if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { return; }

        // If the set URL is not valid, return.
        if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { return; }

        $this->oProp->aPages[ $aSubMenuLink['href'] ] = $this->_formatSubmenuLinkArray( $aSubMenuLink );

    }

    /**
     * Adds sub-menu pages.
     *
     * It is recommended to use addSubMenuItems() instead, which supports external links.
     *
     * @since       2.0.0
     * @since       3.0.0       The scope was changed to public from protected.
     * @internal
     * @return      void
     * @remark      The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
     */
    protected function addSubMenuPages() {
        foreach ( func_get_args() as $aSubMenuPage ) {
            $this->addSubMenuPage( $aSubMenuPage );
        }
    }

    /**
     * Adds a single sub-menu page.
     *
     *
Example

     *
     *  $this->addSubMenuPage(
     *      array(
     *          'title' => __( 'First Page', 'admin-page-framework-demo' ),
     *          'page_slug' => 'apf_first_page',
     *      ),
     *      array(
     *          'title' => __( 'Second Page', 'admin-page-framework-demo' ),
     *          'page_slug' => 'apf_second_page',
     *      )
     *  );
     *
     *
     * @access      public
     * @since       2.0.0
     * @since       2.1.2       A key name was changed.
     * @since       2.1.6       $sScreenIcon accepts a file path.
     * @since       3.0.0       The scope was changed to public from protected. Deprecated all the parameters made it to accept them as an array. A key name was changed.
     * @remark      The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
     * @param       array       The sub menu page array.
     *
Sub Menu Page Array

     *

     *
title - (required) the title of the page.

     *
page_slug - (required) the slug of the page. Do not use hyphens as it serves as the callback method name.

     *
screen icon - (optional) Either a screen icon ID, a url of the icon, or a file path to the icon, with the size of 32 by 32 in pixel. The accepted icon IDs are as follows.

     *
edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic

     * ( Note: the generic ID is available since WordPress 3.5. )
     *
capability - (optional) The access level to the page.

     *
order - (optional) the order number of the page. The lager the number is, the lower the position it is placed in the menu.

     *
show_page_heading_tab - (optional) If this is set to false, the page title won't be displayed in the page heading tab. Default: true.

     *
show_in_menu - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.

     *

     * @return      void
     * @internal
     */
    protected function addSubMenuPage( array $aSubMenuPage ) {

        if ( ! isset( $aSubMenuPage['page_slug'] ) ) { return; }

        $aSubMenuPage['page_slug'] = $this->oUtil->sanitizeSlug( $aSubMenuPage['page_slug'] );
        $this->oProp->aPages[ $aSubMenuPage['page_slug'] ] = $this->_formatSubMenuPageArray( $aSubMenuPage );

    }

}


text:
There isn't much to do while you wait for the droids to repair your ship. At least you're drifting in the right direction. You decide to practice a new card shuffle you've been working on.

Digging through the ship's storage, you find a deck of space cards! Just like any deck of space cards, there are 10007 cards in the deck numbered 0 through 10006. The deck must be new - they're still in factory order, with 0 on the top, then 1, then 2, and so on, all the way through to 10006 on the bottom.

You've been practicing three different techniques that you use while shuffling. Suppose you have a deck of only 10 cards (numbered 0 through 9):

To deal into new stack, create a new stack of cards by dealing the top card of the deck onto the top of the new stack repeatedly until you run out of cards:

Top          Bottom
0 1 2 3 4 5 6 7 8 9   Your deck
                      New stack

  1 2 3 4 5 6 7 8 9   Your deck
                  0   New stack

    2 3 4 5 6 7 8 9   Your deck
                1 0   New stack

      3 4 5 6 7 8 9   Your deck
              2 1 0   New stack

Several steps later...

                  9   Your deck
  8 7 6 5 4 3 2 1 0   New stack

                      Your deck
9 8 7 6 5 4 3 2 1 0   New stack

Finally, pick up the new stack you've just created and use it as the deck for the next technique.

To cut N cards, take the top N cards off the top of the deck and move them as a single unit to the bottom of the deck, retaining their order. For example, to cut 3:

Top          Bottom
0 1 2 3 4 5 6 7 8 9   Your deck

      3 4 5 6 7 8 9   Your deck
0 1 2                 Cut cards

3 4 5 6 7 8 9         Your deck
              0 1 2   Cut cards

3 4 5 6 7 8 9 0 1 2   Your deck

You've also been getting pretty good at a version of this technique where N is negative! In that case, cut (the absolute value of) N cards from the bottom of the deck onto the top. For example, to cut -4:

Top          Bottom
0 1 2 3 4 5 6 7 8 9   Your deck

0 1 2 3 4 5           Your deck
            6 7 8 9   Cut cards

        0 1 2 3 4 5   Your deck
6 7 8 9               Cut cards

6 7 8 9 0 1 2 3 4 5   Your deck

To deal with increment N, start by clearing enough space on your table to lay out all of the cards individually in a long line. Deal the top card into the leftmost position. Then, move N positions to the right and deal the next card there. If you would move into a position past the end of the space on your table, wrap around and keep counting from the leftmost card again. Continue this process until you run out of cards.

For example, to deal with increment 3:

0 1 2 3 4 5 6 7 8 9   Your deck
. . . . . . . . . .   Space on table
^                     Current position

Deal the top card to the current position:

  1 2 3 4 5 6 7 8 9   Your deck
0 . . . . . . . . .   Space on table
^                     Current position

Move the current position right 3:

  1 2 3 4 5 6 7 8 9   Your deck
0 . . . . . . . . .   Space on table
      ^               Current position

Deal the top card:

    2 3 4 5 6 7 8 9   Your deck
0 . . 1 . . . . . .   Space on table
      ^               Current position

Move right 3 and deal:

      3 4 5 6 7 8 9   Your deck
0 . . 1 . . 2 . . .   Space on table
            ^         Current position

Move right 3 and deal:

        4 5 6 7 8 9   Your deck
0 . . 1 . . 2 . . 3   Space on table
                  ^   Current position

Move right 3, wrapping around, and deal:

          5 6 7 8 9   Your deck
0 . 4 1 . . 2 . . 3   Space on table
    ^                 Current position

And so on:

0 7 4 1 8 5 2 9 6 3   Space on table

Positions on the table which already contain cards are still counted; they're not skipped. Of course, this technique is carefully designed so it will never put two cards in the same position or leave a position empty.

Finally, collect the cards on the table so that the leftmost card ends up at the top of your deck, the card to its right ends up just below the top card, and so on, until the rightmost card ends up at the bottom of the deck.

The complete shuffle process (your puzzle input) consists of applying many of these techniques. Here are some examples that combine techniques; they all start with a factory order deck of 10 cards:

deal with increment 7
deal into new stack
deal into new stack
Result: 0 3 6 9 2 5 8 1 4 7

cut 6
deal with increment 7
deal into new stack
Result: 3 0 7 4 1 8 5 2 9 6

deal with increment 7
deal with increment 9
cut -2
Result: 6 3 0 7 4 1 8 5 2 9

deal into new stack
cut -2
deal with increment 7
cut 8
cut -4
deal with increment 7
cut 3
deal with increment 9
deal with increment 3
cut -1
Result: 9 2 5 8 1 4 7 0 3 6

Positions within the deck count from 0 at the top, then 1 for the card immediately below the top card, and so on to the bottom. (That is, cards start in the position matching their number.)

After shuffling your factory order deck of 10007 cards, what is the position of card 2019?


text:
(function () {
    function createJsConsole(selector) {
        var self = this;
        //var consoleElement = document.querySelector(selector);
        var consoleElement = document.getElementById(selector);

        if (consoleElement.className) {
            consoleElement.className = consoleElement.className + " js-console";
        } else {
            consoleElement.className = "js-console";
        }

        var textArea = document.createElement("p");
        consoleElement.appendChild(textArea);

        self.write = function jsConsoleWrite(text) {
            var textLine = document.createElement("span");
            if (text !== "" && text !== undefined) {
                var toWrite = text.toString();
                textLine.innerHTML = toWrite;
                textArea.appendChild(textLine);
                consoleElement.scrollTop = consoleElement.scrollHeight;
            }
        };

        self.writeLine = function jsConsoleWriteLine(text) {
            self.write(text);
            textArea.appendChild(document.createElement("br"));
        };

        self.read = function readText(inputSelector) {
            var element = document.querySelector(inputSelector);
            if (element.innerHTML) {
                return element.innerHTML;
            } else {
                return element.value;
            }
        };

        self.readInteger = function readInteger(inputSelector) {
            var text = self.read(inputSelector);
            return parseInt(text, 10);
        };

        self.readFloat = function readFloat(inputSelector) {
            var text = self.read(inputSelector);
            return parseFloat(text);
        };

        self.clearConsole = function clearConsole() {
            textArea.innerHTML = "";
        };

        return self;
    }
    jsConsole = new createJsConsole("js-console");
}).call(this);

/**previous , next problem visualization
 */

var previousButton = document.getElementById('previous');
    nextButton = document.getElementById('next');
nextButton.onclick = next;
previousButton.onclick = previous;

count = 1;
function next(){
    if(count < 9){
        document.getElementById('article' + count).style.display = "none";
        count++;
       document.getElementById('article' + count).style.display = "block";
        jsConsole.clearConsole();
    }

}
function previous() {
    if (count > 1) {
        document.getElementById('article' + count).style.display = "none";
        count--;
        document.getElementById('article' + count).style.display = "block";
        jsConsole.clearConsole();
    }
}

/**Problem 1. Odd or Even
 *

Write an expression that checks if given integer is odd or even.
    Examples:

n	Odd?
 3	true
2	false
-2	false
-1	true
0	false
*/
var test = document.getElementById('problem1test');
test.onclick = checkIfOddOrEven;
var clear = document.getElementById('problem1clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function checkIfOddOrEven(){
    var number = jsConsole.readInteger('#problem1');
    if(number % 2 == 0){
        jsConsole.writeLine('The number ' + number + ' is even.');
    }
    else{
        jsConsole.writeLine('The number ' + number + ' is odd.')
    }

}

/**Problem 2. Divisible by 7 and 5

 Write a boolean expression that checks for given integer if it can be divided (without remainder) by 7 and 5 in the same time.
 Examples:

 n	Divided by 7 and 5?
 3	false
 0	true
 5	false
 7	false
 35	true
 140	true
 */

test = document.getElementById('problem2test');
test.onclick = divideBySevenAndFive;
clear = document.getElementById('problem2clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function divideBySevenAndFive(){
    var number = jsConsole.readInteger('#problem2');
    if(number % 7 == 0 && number % 5 == 0){
        jsConsole.writeLine('The number ' + number + ' is divisible by seven and by five.');
    }
    else if(number % 7 == 0 && !(number % 5 == 0)){
        jsConsole.writeLine('The number ' + number + ' is divisible by seven, but NOT by five.');
    }

    else if(number % 5 == 0 && !(number % 7 == 0)){
        jsConsole.writeLine('The number ' + number + ' is divisible by five, but NOT by seven.');
    }

    else{
        jsConsole.writeLine('The number ' + number + ' is NOT divisible by seven and by five.');
    }
}

/**Problem 3. Rectangle area

 Write an expression that calculates rectangle's area by given width and height.
 Examples:

 width	height	area
 3	4	12
 2.5	3	7.5
 5	5	25
 */
test = document.getElementById('problem3test');
test.onclick = rectangleArea;
clear = document.getElementById('problem3clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function rectangleArea () {
    var width = jsConsole.readFloat('#problem31');
        height = jsConsole.readFloat('#problem32');
        area = width * height;
    jsConsole.writeLine('The area of a rectangle with width ' + width + ' and height ' + height + ' is ' + area + '.');

}

/** Problem 4. Third digit

 Write an expression that checks for given integer if its third digit (right-to-left) is 7.
 Examples:

 n	Third digit 7?
 5	false
 701	true
 1732	true
 9703	true
 877	false
 777877	false
 9999799	true
 */
test = document.getElementById('problem4test');
test.onclick = thirdDigitSeven;
clear = document.getElementById('problem4clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function thirdDigitSeven (){
    var number = jsConsole.readInteger('#problem4');
        isThird = ((number / 100 |0) % 10) == 7;
    if(isThird){
        jsConsole.writeLine('The third digit of the number ' + number + ' is seven.')
    }

    else{
        jsConsole.writeLine('The third digit of the number ' + number + ' is NOT seven.')
    }
}

/**Problem 5. Third bit

 Write a boolean expression for finding if the bit #3 (counting from 0) of a given integer.
 The bits are counted from right to left, starting from bit #0.
 The result of the expression should be either 1 or 0.
 Examples:

 n	binary representation	bit #3
 5	00000000 00000101	0
 8	00000000 00001000	1
 0	00000000 00000000	0
 15	00000000 00001111	1
 5343	00010100 11011111	1
 62241	11110011 00100001	0
 */
test = document.getElementById('problem5test');
test.onclick = thirdBit;
clear = document.getElementById('problem5clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function thirdBit (){
    var number = jsConsole.readInteger('#problem5');
        binaryNumber = number.toString(2);
        p = 3;
        mask = 1 << p;
        numberAndMask = number & mask;
        bit = numberAndMask >> p;
        jsConsole.writeLine('Number: ' + number);
        jsConsole.writeLine('Binary representation: ' + binaryNumber);
        jsConsole.writeLine('Bit #3: ' + bit);
}

/**Problem 6. Point in Circle

 Write an expression that checks if given point P(x, y) is within a circle K({0,0}, 5). //{0,0} is the centre and 5 is the radius
 Examples:

 x	y	inside
 0	1	true
 -5	0	true
 -4	5	false
 1.5	-3	true
 -4	-3.5	false
 100	-30	false
 0	0	true
 0.2	-0.8	true
 0.9	-4.93	false
 2	2.655	true
 */
test = document.getElementById('problem6test');
test.onclick = pointInCircle;
clear = document.getElementById('problem6clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function pointInCircle (){
    var x = jsConsole.readFloat('#problem61');
        y = jsConsole.readFloat('#problem62');
        isInside = (Math.pow(x, 2)) + (Math.pow(y, 2)) <= (Math.pow(5, 2));
        if(isInside){
            jsConsole.writeLine('The point(' + x + ', ' + y  + ') is inside the circle K({0,0}, 5)' );
        }
    else{
            jsConsole.writeLine('The point(' + x + ', ' + y  + ') is NOT inside the circle K({0,0}, 5)' );
        }

}

/**
 Problem 7. Is prime

 Write an expression that checks if given positive integer number n (n ? 100) is prime.
 Examples:

 n	Prime?
 1	false
 2	true
 3	true
 4	false
 9	false
 37	true
 97	true
 51	false
 -3	false
 0	false
 */
test = document.getElementById('problem7test');
test.onclick = checkIfPrime;
clear = document.getElementById('problem7clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function checkIfPrime(){
    var number = jsConsole.readInteger('#problem7');
        isPrime = true;
    if(number > 100){
        jsConsole.writeLine('The number should be <= 100.')
    }

    else{

        for(var i = 2; i <= Math.sqrt(number); i++){
            if(number % i == 0){
               isPrime = false;
            }
        }

        if(number == 1 || number <= 0){
            isPrime = false;
        }

        if(isPrime){

            jsConsole.writeLine('The number ' + number + ' is prime.')
        }

        else{
            jsConsole.writeLine('The number '  + number + ' is NOT prime.')
        }
    }
}

/**
 Problem 8. Trapezoid area

 Write an expression that calculates trapezoid's area by given sides a and b and height h.
 Examples:

 a	b	h	area
 5	7	12	72
 2	1	33	49.5
 8.5	4.3	2.7	17.28
 100	200	300	45000
 0.222	0.333	0.555	0.1540125
 */
test = document.getElementById('problem8test');
test.onclick = trapezoidArea;
clear = document.getElementById('problem8clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function trapezoidArea(){
    var a  = jsConsole.readFloat('#problem81');
        b  = jsConsole.readFloat('#problem82');
        h  = jsConsole.readFloat('#problem83');
        area = ((a + b)/ 2) * h;
    jsConsole.writeLine('The area of a trapezoid with sides ' + a + ', ' + b + ' and height ' + h + ' is ' + area + '.');

}

/**
 Problem 9. Point in Circle and outside Rectangle

 Write an expression that checks for given point P(x, y) if it is within the circle K( (1,1), 3) and out of the rectangle R(top=1, left=-1, width=6, height=2).
 Examples:

 x	y	inside K & outside of R
 1	4	yes
 3	2	yes
 0	1	no
 4	1	no
 2	0	no
 4	0	no
 2.5	1.5	yes
 3.5	1.5	yes
 -100	-100	no
 */
test = document.getElementById('problem9test');
test.onclick = InCircleOutRectangle;
clear = document.getElementById('problem9clear')

clear.onclick = function () {
    jsConsole.clearConsole();
}

function InCircleOutRectangle(){
    var x = jsConsole.readFloat('#problem91');
        y = jsConsole.readFloat('#problem92');
        isInCircle  = (Math.pow((x - 1), 2)) + (Math.pow((y - 1), 2)) <= (Math.pow(3, 2));
        isOutRec = (y > 1 || y < -1 || x < -1 || x > 5);
        inAndout = isInCircle && isOutRec;
    if(inAndout){
        jsConsole.writeLine('The point(' + x + ', ' + y  + ') is inside the circle K({1,1}, 3) and out of the rectangle R(top=1, left=-1, width=6, height=2). ' )

    }

    else if(isInCircle){
        jsConsole.writeLine('The point(' + x + ', ' + y  + ') is inside the circle K({1,1}, 3), BUT NOT out of the rectangle R(top=1, left=-1, width=6, height=2). ' )
    }

    else if(isOutRec){
        jsConsole.writeLine('The point(' + x + ', ' + y  + ') is  out of the rectangle R(top=1, left=-1, width=6, height=2), BUT NOT inside the circle K({1,1}, 3). ' )
    }

    else{
        jsConsole.writeLine('The point(' + x + ', ' + y  + ') is NOT inside the circle K({1,1}, 3) and NOT out of the rectangle R(top=1, left=-1, width=6, height=2). ' )
    }
}


text:
<!DOCTYPE html>

  <title>Ethan's Blog</title>
  <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="../stylesheet/blog-stylesheet.css">

Ethan's Blog

Problems Facing Tech World

April 12, 2015

      There are many problems facing the tech world. These problems range from gender disparity to budgetary shortfalls. For this blog entry, I have decided that the most pressing problem is the issue of Multinational Operations.

      The problem arises when one company has multiple offices and data centers in multiple countries, around the world. The biggest challenge to overcome is the difference between salaries of employees of the same Company but in different Countries.

      Often, emotions run high when one has been affected by outsourcing. Salary differences can breed resentment. Although slightly alleviated by differences in standard of living costs, it seems patently unfair for two identical workers to receive different salaries.

      One potential solution can be to change the "us versus them" mindset. In the increasingly interconnected and globalized world, nation boundaries are a minor inconvenience in the quest for advancement and achievement. A Company must foster a meritocratic system; treating all of its workers equally.

      Only through following the principal of equality can one truly incentivize human potential.


text:
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.password_manager;

import android.content.Intent;
import android.net.Uri;

import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.ui.base.WindowAndroid;

/**
 * A utitily class for launching the password leak check.
 */
public class PasswordCheckupLauncher {
    @CalledByNative
    private static void launchCheckup(String checkupUrl, WindowAndroid windowAndroid) {
        ChromeActivity activity = (ChromeActivity) windowAndroid.getActivity().get();
        if (tryLaunchingNativePasswordCheckup(activity)) return;
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(checkupUrl));
        intent.setPackage(activity.getPackageName());
        activity.startActivity(intent);
    }

    private static boolean tryLaunchingNativePasswordCheckup(ChromeActivity activity) {
        GooglePasswordManagerUIProvider googlePasswordManagerUIProvider =
                AppHooks.get().createGooglePasswordManagerUIProvider();
        if (googlePasswordManagerUIProvider == null) return false;
        return googlePasswordManagerUIProvider.launchPasswordCheckup(activity);
    }
}


text:
package org.simpleframework.xml.convert;

import org.simpleframework.xml.strategy.Value;

/**
 * The Reference object represents a value that holds
 * an object instance. If an object instance is to be provided from
 * a Strategy implementation it must be wrapped in a
 * value object. The value object can then provide the details of
 * the instance and the actual object instance to the serializer.
 *
 * @author Niall Gallagher
 */
class Reference implements Value {

   /**
    * This represents the original value returned from a strategy.
    */
   private Value value;

   /**
    * This represents the object instance that this represents.
    */
   private Object data;

   /**
    * Constructor for a Reference object. To create
    * this a value and an object instance is required. The value
    * provided may be null, but the instance should be a valid
    * object instance to be used by the serializer.
    *
    * @param value this is the original value from a strategy
    * @param data this is the object instance that is wrapped
    */
   public Reference(Value value, Object data){
      this.value = value;
      this.data = data;
   }

   /**
    * This will return the length of an array reference. Because
    * the value will represent the value itself the length is
    * never used, as no instance needs to be created.
    *
    * @return this will always return zero for a reference
    */
   public int getLength() {
      return 0;
   }

   public Class getType() {
      return data.getClass();
   }

   /**
    * This returns the actual object instance that is held by this
    * reference object.
    */
   public Object getValue() {
      return data;
   }

   /**
    * This will always return true as this Value object
    * will always contain an object instance. Returning true from
    * this method tells the serializer that there is no need to
    * actually perform any further deserialization.
    *
    * @return this always returns true as this will be a reference
    */
   public boolean isReference() {
      return true;
   }

   /**
    * This is used to set the value of the object. If the internal
    * Value is not null then the internal value will
    * have the instance set also.
    *
    * @param data this is the object instance that is to be set
    */
   public void setValue(Object data) {
      if(value != null) {
         value.setValue(data);
      }
      this.data = data;
   }
}