text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Http.Formatting;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;

using Newtonsoft.Json;

namespace Handlebars.WebApi
{
    public sealed class HandlebarsMediaTypeFormatter : MediaTypeFormatter
    {
        #region // Constructor //
        public HandlebarsMediaTypeFormatter(HttpRouteCollection routes,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter) : this(new HttpConfiguration(routes), template, formatter)
        {
        }

        public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter)
            : base()
        {
            this._template = template;
            this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
            this._formatter = formatter;

            config.Formatters.Insert(0, this);
            _config = config;
            _server = new HttpServer(config);
            _client = new HttpMessageInvoker(_server);
        }

        public HandlebarsMediaTypeFormatter(HttpConfiguration config,
                                            IHandlebarsTemplate template,
                                            IRequestFormatter formatter,
                                            HttpServer server,
                                            HttpMessageInvoker client,
                                            string view,
                                            HttpRequestMessage request)
        {

            this._formatter = formatter;
            this._template = template;
            this._request = request;
            this._server = server;
            this._config = config;
            this._client = client;
            this._view = view;

            this.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
        }
        #endregion

        #region // Dependency Injection //
        private readonly HttpConfiguration _config;
        private readonly IHandlebarsTemplate _template;
        private readonly HttpServer _server;
        private readonly HttpMessageInvoker _client;
        private readonly IRequestFormatter _formatter;
        private readonly HttpRequestMessage _request;
        private readonly string _view;
        #endregion

        public override bool CanReadType(Type type)
        {
            return false;
        }

        public override bool CanWriteType(Type type)
        {
            if (typeof(HttpError) == type)
                return false;

            return true;
        }

        private static readonly Regex MasterRegex = new Regex(@"(####master:(.+)####)", RegexOptions.IgnoreCase);
        private static readonly Regex SectionRegex = new Regex(@"(<!--####section:(.+)####-->)", RegexOptions.IgnoreCase);

        private class SectionData
        {
            public int NameLength;
            public int Start;
            public int Stop;
            public string Contents;
        }

        public StringBuilder FillSectionData(string contents, string json)
        {
            var sectionMatches = SectionRegex.Matches(contents);
            var sections = new Dictionary<string, SectionData>();

            foreach (Match match in sectionMatches)
            {
                // extract the matched sections into variables
                var sectionData = match.Value.Split(':');
                var operation = sectionData[1];
                var name = sectionData[2].TrimEnd('#', '-', '>');

                if (!sections.ContainsKey(name))
                    sections.Add(name, new SectionData() { NameLength = name.Length });

                switch (operation)
                {
                    case "start":
                        sections[name].Start = match.Index + match.Length;
                        break;
                    case "stop":
                        sections[name].Stop = match.Index;
                        sections[name].Contents = contents.Substring(sections[name].Start, sections[name].Stop - sections[name].Start).Trim(' ', '\n', '\t', '\r');
                        break;
                }
            }

            // find the master for this template
            // ###master
            // todo:
            // return an HTML error describing the missing
            var masterMatch = MasterRegex.Match(contents, 0);
            if (!masterMatch.Success)
                return new StringBuilder(contents, contents.Length * 2);

            var removal = sections.Values.OrderByDescending(_ => _.Stop);
            foreach (SectionData sd in removal)
            {
                // <!--####section:start:####-->
                // <!--####section:stop:####-->
                int start = sd.Start - sd.NameLength - 29;
                int stop = sd.Stop + sd.NameLength + 28;
                contents = contents.Remove(start, stop - start);
            }

            // remove the master tag from the render pipeline
            contents = contents.Remove(masterMatch.Index, masterMatch.Length);

            // this logic is only needed if there is a master template with sections
            // any content not in a section will be automatically assumed as the
            // "content" section and appended to it (if it was already created)
            if (!sections.ContainsKey("contents"))
            {
                sections.Add("contents", new SectionData { });
                sections["contents"].Contents = contents.Trim(' ', '\n', '\t', '\r');
            }

            var masterPath = masterMatch.Value.Split(':')[1].TrimEnd('#');
            string master = _template.Render(masterPath, json);

            // recycle variable for efficiency
            sectionMatches = SectionRegex.Matches(master);

            // foreach section in the master,
            // replace the section with the contents from the template
            // if the sections don't exist then leave them because there
            // might be default content

            var masterSections = new Dictionary<string, SectionData>();
            foreach (Match match in sectionMatches)
            {
                // extract the matched sections into variables
                var sectionData = match.Value.Split(':');
                var operation = sectionData[1];
                var name = sectionData[2].TrimEnd('#', '-', '>');

                if (!masterSections.ContainsKey(name))
                    masterSections.Add(name, new SectionData() { NameLength = name.Length });

                switch (operation)
                {
                    case "start":
                        masterSections[name].Start = match.Index + match.Length;
                        break;
                    case "stop":
                        masterSections[name].Stop = match.Index;
                        break;
                }
            }

            // use a pesamistic estimate for the length of the string builder (considering we might get donuts later
            var sb = new StringBuilder(master, (master.Length + sections.Sum(_ => _.Value.Contents.Length)) * 2);

            var replacement = masterSections.OrderByDescending(_ => _.Value.Stop);
            foreach (KeyValuePair<string, SectionData> kvp in replacement)
            {
                if (sections.ContainsKey(kvp.Key))
                {
                    sb.Remove(masterSections[kvp.Key].Start, masterSections[kvp.Key].Stop - masterSections[kvp.Key].Start);
                    sb.Insert(masterSections[kvp.Key].Start, "\n" + sections[kvp.Key].Contents + "\n");
                }
            }

            return sb;
        }

        public override async Task WriteToStreamAsync(Type type, object value, Stream stream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)
        {
            // await Console.Out.WriteLineAsync("HB Started: " + Request.RequestUri.PathAndQuery);
            var json = _formatter.GetContext(_request, value);
            string r = _template.Render(_view, json);

            StringBuilder html;

            if (_request.Properties.ContainsKey("donut") &&
                (bool)_request.Properties["donut"] == true)
            {
                // detect any master or sections and fill them
                html = new StringBuilder(r);
            }
            else
            {
                html = FillSectionData(r, json);

                // if there is an outputcache property here, then provide some HTML
                // to be output cached. Minus the donut data of course
                if (_request.Properties.ContainsKey("outputcache:key"))
                    _request.Properties.Add("outputcache:content", html.ToString());

                html = await FillDonutData(html, _request);
            }

            // Console.Out.WriteLineAsync("HandlebarsMediaTypeFormatter: Replace() " + sw.ElapsedMilliseconds + "ms");

            // await writer.WriteAsync(html.ToString());
            var writer = new StreamWriter(stream);

            string output, contentType;
            if (_request.Properties.ContainsKey("hb-as-javascript"))
            {
                var lines = html.ToString()
                                .Split(new[] { "\n\r", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);

                var sb = new StringBuilder();
                foreach (var line in lines)
                {
                    sb.Append("document.write('" +
                              HandlebarsUtilities.ToJavaScriptString(line)
                              + "');");
                }
                output = sb.ToString();
                contentType = "application/javascript";
            }
            else
            {
                contentType = "text/html";
                output = html.ToString();
            }

            content.Headers.ContentType = new MediaTypeHeaderValue(contentType);

            await writer.WriteAsync(output);
            await writer.FlushAsync();
            return;
        }

        public async Task<StringBuilder> FillDonutData(StringBuilder html, HttpRequestMessage original)
        {
            var donuts = new Dictionary<string, SectionData>();

            // detect the donuts
            SectionData donutSection = new SectionData();
            int index = html.IndexOf("####donut:", 0, false);
            int length = 4;
            while (index != -1)
            {
                length = html.IndexOf("####", index + 10, false) - index - 10;
                var key = html.ToString(index + 10, length);

                donutSection.Start = index;
                donutSection.NameLength = length;
                donutSection.Stop = index + length + 14;
                donuts.Add(key, donutSection);

                if (index + length > html.Length) break;
                donutSection = new SectionData();
                index = html.IndexOf("####donut:", index + length, false);
            }

            // execute any donuts
            if (donuts.Count > 0)
            {
                var tasks = new List<Task<DonutResult>>(donuts.Count);

                foreach (var donut in donuts)
                {
                    tasks.Add(ExecuteDonut(original, donut.Key));
                }

                await Task.WhenAll(tasks);

                Dictionary<string, string> content = tasks.ToDictionary(_ => _.Result.Donut,
                                                                        _ => _.Result.Content);

                var replacement = donuts.OrderByDescending(_ => _.Value.Stop);
                foreach (KeyValuePair<string, SectionData> kvp in replacement)
                {
                    if (content.ContainsKey(kvp.Key))
                    {
                        html.Remove(kvp.Value.Start, kvp.Value.Stop - kvp.Value.Start);
                        html.Insert(kvp.Value.Start, content[kvp.Key]);
                    }
                }

            }

            return html;
        }

        private class DonutResult
        {
            public string Donut
            {
                get;
                set;
            }

            public string Content
            {
                get;
                set;
            }

        }

        private async Task<DonutResult> ExecuteDonut(HttpRequestMessage original, string donut)
        {
            var result = new DonutResult
            {
                Donut = donut
            };

            using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://" + original.RequestUri.DnsSafeHost + (original.RequestUri.IsDefaultPort ? "" : ":" + original.RequestUri.Port) + "/" + donut))
            {
                request.Properties.Add("donut", true);

                // ensure any AB testing in donut actions uses the same grouping
                if (original.Properties.ContainsKey("experiment"))
                    request.Properties.Add("experiment", original.Properties["experiment"]);

                // so we can use the same identify and context information in higher up
                // donut functions.
                if (original.Properties.ContainsKey("MS_OwinContext"))
                    request.Properties.Add("MS_OwinContext", original.Properties["MS_OwinContext"]);

                // temp: try catch to debug "bad headers"
                foreach (var header in original.Headers)
                {
                    try
                    {
                        request.Headers.TryAddWithoutValidation(header.Key, header.Value);
                    }
                    catch (Exception e)
                    {
                        Console.Out.WriteLineAsync("Handlebars - Add Header: " + e.Message);
                    }
                }

                // this was previously causing a deadlock, never use .Result!!!! it is the
                // root of all things evil.
                using (HttpResponseMessage response = await _client.SendAsync(request, CancellationToken.None))
                {
                    if (response.IsSuccessStatusCode)
                    {
                        try
                        {
                            var donutHtml = await response.Content.ReadAsStringAsync();
                            result.Content = donutHtml;
                        }
                        catch (Exception exp)
                        {
                            result.Content = exp.Message;
                        }
                    }
                }
            }

            return result;
        }

        public override MediaTypeFormatter GetPerRequestFormatterInstance(Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType)
        {
            HttpActionDescriptor actionDescriptor = request.GetActionDescriptor();
            if (actionDescriptor == null)
                return base.GetPerRequestFormatterInstance(type, request, mediaType);

            var view = actionDescriptor.ControllerDescriptor.ControllerName + "/" +
                       actionDescriptor.ActionName;

            if (actionDescriptor.ControllerDescriptor.Properties.ContainsKey("hb-prefix"))
                view = (actionDescriptor.ControllerDescriptor.Properties["hb-prefix"] as string) + "/" + view;

            if (request.Properties.ContainsKey("hb-view"))
                view = request.Properties["hb-view"] as string;

            return new HandlebarsMediaTypeFormatter(_config, _template, _formatter, _server, _client, view, request);

        }

    }
}


text:
function Get-ProjectDependencies {
	[OutputType([String])]
    [CmdletBinding()]
    param (
		[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]
        [ValidateNotNullOrEmpty()]
        [string[]]$ProjectFilePath
    )
    Begin{
		$formats = @{
			"Begin" = "Begin {0}...";
			"Process" = "...processing {0}...";
			"End" = "...ending {0}";
		};
    	Write-Verbose -Message ($formats.Begin -f $MyInvocation.MyCommand);
    } Process {
    	Write-Verbose -Message ($formats.Process -f $MyInvocation.MyCommand);
		$content = [XML](Get-Content $ProjectFilePath);
		$content.Project.ItemGroup.Compile |
			Where-Object {
				$null -ne $_
			} |
			ForEach-Object {
				Write-Output (Join-Path -Path (Split-Path -Path $ProjectFilePath -Parent) -ChildPath $_.Include);
			}
		$content.Project.ItemGroup.Content |
			Where-Object {
				$null -ne $_ -and
				$null -ne $_.CopyToOutputDirectory -and
				$_.CopyToOutputDirectory -ne 'Do not copy'
			} |
			ForEach-Object {
				Write-Output (Join-Path -Path (Split-Path -Path $ProjectFilePath -Parent) -ChildPath $_.Include);
			}
    } End {
    	Write-Verbose -Message ($formats.End -f $MyInvocation.MyCommand);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML>

	<link rel="stylesheet" type="text/css" href="styles.css">
	<title> Nested Divs </title>


text:
import React from 'react';
import { Switch, Route } from 'react-router-dom';
import cuid from 'cuid';

import { hasToken } from 'common/utils/auth';
import Element from 'common/components/Element';

import { SESSION_CATEGORIES } from 'features/quiz/QuizSession/constants';
import crabigatorOutline from 'common/assets/img/crabigator-outline.svg';

import NavLink from './NavLink';
import { Footer, CrabigatorStencil, FooterLinks, FooterLinkGroup } from './styles';

const links = [
  Object.values(SESSION_CATEGORIES).map((category) => ({ route: `/${category}`, name: category })),
  [
    { route: '/vocabulary', name: 'vocabulary' },
    { route: '/settings', name: 'settings' },
    { route: '/logout', name: 'logout' },
  ],
  [{ route: '/about', name: 'about' }, { route: '/contact', name: 'contact' }],
];

export function SiteFooter() {
  return (
    <Footer>
      <Element style={{ position: 'relative' }} flexRow justifyContent="flex-end">
        <FooterLinks flexRow flexWrap flexCenter>
          {links.map((group) => (
            <FooterLinkGroup key={cuid()} plainList>
              {group.map((link) => (
                <NavLink key={cuid()} isOffCanvas={false} {...link} />
              ))}
            </FooterLinkGroup>
          ))}
        </FooterLinks>
        <CrabigatorStencil imgSrc={crabigatorOutline} bgPosition="bottom left" bgSize="contain" />
      </Element>
    </Footer>
  );
}

export function SiteFooterContainer() {
  return (
    hasToken() && (
      <Switch>
        <Route exact path="/" render={SiteFooter} />
        <Route exact path="/:category(reviews|lessons)" render={SiteFooter} />
        <Route exact path="/(vocabulary|settings|about|contact)" render={SiteFooter} />
        <Route exact path="/vocabulary/levels/:level?" render={SiteFooter} />
        <Route exact path="/vocabulary/entry/:id?" render={SiteFooter} />
      </Switch>
    )
  );
}

export default SiteFooterContainer;


text:
function [MSE] = prototypes_mse(C,DATA,PAR)

% --- Calculate the Mean Squared errors of prototypes ---
%
%   [MSE] = prototypes_mse(C,DATA,PAR)
%
%   Input:
%       C = prototypes [p x k]
%       DATA.
%           dados = input matrix [p x N]
%       PAR.
%           dist = Type of distance
%               0: dot product
%               2: euclidean distance
%   Output:
%       MSE = mean of squared errors between prototypes and data

%% INITIALIZATION

% Load Data

dados = DATA.dados;
[~,N] = size(dados);

%% ALGORITHM

[SSE] = prototypes_sse(C,DATA,PAR);
MSE = SSE/N;

%% FILL OUTPUT STRUCTURE

% Dont need

%% END


text:
package com.linkedin.pinot.common.config;

import com.google.common.base.Preconditions;
import com.linkedin.pinot.common.utils.CommonConstants.Helix.TableType;
import com.linkedin.pinot.common.utils.SegmentName;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class TableNameBuilder {
  public static final TableNameBuilder OFFLINE = new TableNameBuilder(TableType.OFFLINE);
  public static final TableNameBuilder REALTIME = new TableNameBuilder(TableType.REALTIME);

  private static final String TYPE_SUFFIX_SEPARATOR = "_";

  private final String _typeSuffix;

  private TableNameBuilder(@Nonnull TableType tableType) {
    _typeSuffix = TYPE_SUFFIX_SEPARATOR + tableType.toString();
  }

  /**
   * Get the table name builder for the given table type.
   * @param tableType Table type
   * @return Table name builder for the given table type
   */
  @Nonnull
  public static TableNameBuilder forType(@Nonnull TableType tableType) {
    if (tableType == TableType.OFFLINE) {
      return OFFLINE;
    } else {
      return REALTIME;
    }
  }

  /**
   * Get the table name with type suffix.
   *
   * @param tableName Table name with or without type suffix
   * @return Table name with type suffix
   */
  @Nonnull
  public String tableNameWithType(@Nonnull String tableName) {
    Preconditions.checkArgument(!tableName.contains(SegmentName.SEPARATOR),
        "Table name: %s cannot contain two consecutive underscore characters", tableName);

    if (tableName.endsWith(_typeSuffix)) {
      return tableName;
    } else {
      return tableName + _typeSuffix;
    }
  }

  /**
   * Return Whether the table has type suffix that matches the builder type.
   *
   * @param tableName Table name with or without type suffix
   * @return Whether the table has type suffix that matches the builder type
   */
  public boolean tableHasTypeSuffix(@Nonnull String tableName) {
    return tableName.endsWith(_typeSuffix);
  }

  /**
   * Get the table type based on the given table name with type suffix.
   *
   * @param tableName Table name with or without type suffix
   * @return Table type for the given table name, null if cannot be determined by table name
   */
  @Nullable
  public static TableType getTableTypeFromTableName(@Nonnull String tableName) {
    if (OFFLINE.tableHasTypeSuffix(tableName)) {
      return TableType.OFFLINE;
    }
    if (REALTIME.tableHasTypeSuffix(tableName)) {
      return TableType.REALTIME;
    }
    return null;
  }

  /**
   * Extract the raw table name from the given table name with type suffix.
   *
   * @param tableName Table name with or without type suffix
   * @return Table name without type suffix
   */
  @Nonnull
  public static String extractRawTableName(@Nonnull String tableName) {
    if (OFFLINE.tableHasTypeSuffix(tableName)) {
      return tableName.substring(0, tableName.length() - OFFLINE._typeSuffix.length());
    }
    if (REALTIME.tableHasTypeSuffix(tableName)) {
      return tableName.substring(0, tableName.length() - REALTIME._typeSuffix.length());
    }
    return tableName;
  }

  /**
   * Return whether the given resource name represents a table resource.
   *
   * @param resourceName Resource name
   * @return Whether the resource name represents a table resource
   */
  public static boolean isTableResource(@Nonnull String resourceName) {
    return OFFLINE.tableHasTypeSuffix(resourceName) || REALTIME.tableHasTypeSuffix(resourceName);
  }
}


text:
<?php

require __DIR__ . '/product_with_multiple_options_rollback.php';
require __DIR__ . '/../../../Magento/Sales/_files/default_rollback.php';


text:
'use strict';
var moment = require('moment');

moment.fn.isBusinessDay = function() {
    return !(this.day() === 0 || this.day() === 6);
};

moment.fn.businessDiff = function(param) {
    param = moment(param);
    var signal = param.unix() < this.unix()?1:-1;
    var start = moment.min(param, this).clone();
    var end = moment.max(param, this).clone();
    var start_offset = start.day() - 7;
    var end_offset = end.day();

    var end_sunday = end.clone().subtract('d', end_offset);
    var start_sunday = start.clone().subtract('d', start_offset);
    var weeks = end_sunday.diff(start_sunday, 'days') / 7;

    start_offset = Math.abs(start_offset);
    if (start_offset == 7) {
      start_offset = 5;
    } else if (start_offset == 1) {
      start_offset = 0;
    } else {
      start_offset -= 2;
    };

    if (end_offset == 6) {
      end_offset--;
    };

    return signal * (weeks * 5 + start_offset + end_offset);
};

moment.fn.businessAdd = function(days) {
    var signal = days < 0 ? -1 : 1;
    days = Math.abs(days);
    var d = this.clone().add(Math.floor(days / 5) * 7 * signal, 'd');
    var remaining = days % 5;
    while (remaining) {
      d.add(signal, 'd');
      if (d.isBusinessDay()) {
        remaining--;
      };
    };
    return d;
};

moment.fn.businessSubtract = function(days) {
    return this.businessAdd(-days);
};

moment.fn.nextBusinessDay = function() {
    var loop = 1;
    var limit = 7;
    while (loop < limit) {
        if (this.add(1, 'd').isBusinessDay()) {
            break;
        };
        loop++;
    };
    return this;
};

moment.fn.monthBusinessDays = function() {
    var me = this.clone();
    var day = me.clone().startOf('month');
    var end = me.clone().endOf('month');
    var daysArr = [];
    var done = false;
    while (!done) {
        if (day.isBusinessDay()) {
            daysArr.push(day.clone());
        };
        if(end.diff(day.add(1,'d')) < 0) {
            done = true;
        };
    };
    return daysArr;
};

moment.fn.monthNaturalDays = function(fromToday) {
    var me = this.clone();
    var day = fromToday ? me.clone() : me.clone().startOf('month');
    var end = me.clone().endOf('month');
    var daysArr = [];
    var done = false;
    while (!done) {
        daysArr.push(day.clone());
        if(end.diff(day.add(1,'d')) < 0) {
            done = true;
        };
    };
    return daysArr;
};

moment.fn.monthBusinessWeeks = function(fromToday) {
    var me = this.clone();
    var day = fromToday ? me.clone() : me.clone().startOf('month');
    var end = me.clone().endOf('month');
    var weeksArr = [];
    var daysArr = [];
    var done = false;

    while(!done) {
        if(day.day() >= 1 && day.day() < 6) {
            daysArr.push(day.clone());
        };
        if(day.day() === 5) {
            weeksArr.push(daysArr);
            daysArr = [];
        };
        if(end.diff(day.add(1,'d')) < 0) {
            if(daysArr.length < 5) {
                weeksArr.push(daysArr);
            };
            done = true;
        };
    };
    return weeksArr;
};

moment.fn.monthNaturalWeeks = function(fromToday) {
    var me = this.clone();
    var day = fromToday ? me.clone() : me.clone().startOf('month');
    var end = me.clone().endOf('month');
    var weeksArr = [];
    var daysArr = [];
    var done = false;

    while(!done) {
        daysArr.push(day.clone());
        if(day.day() === 6) {
            weeksArr.push(daysArr);
            daysArr = [];
        };
        if(end.diff(day.add(1,'d')) < 0) {
            if(daysArr.length < 7) {
                weeksArr.push(daysArr);
            };
            done = true;
        };
    };
    return weeksArr;
};

module.exports = moment;


text:
package fun.zepo.auth.service.exception;

/**
 * @author Koustav

 *         Year: 2016
 *

 */
public class UserNotAuthorizedException extends Exception
{

    /**
     * Generated serialVersionUID
     */
    private static final long serialVersionUID = -2314603902915412412L;

    /**
     *
     */
    public UserNotAuthorizedException()
    {
        super();
    }

    /**
     * @param message
     * @param cause
     */
    public UserNotAuthorizedException(String message, Throwable cause)
    {
        super(message, cause);
    }

    /**
     * @param message
     */
    public UserNotAuthorizedException(String message)
    {
        super(message);
    }
}


text:
include CommonDefs.mak

BIN_DIR = Bin

INC_DIRS = \
	../../Include

SRC_FILES = *.cpp

USED_LIBS += OpenNI2

LIB_NAME = MWClosestPoint

CFLAGS += -Wall -D_CLOSEST_POINT

ifndef OPENNI2_INCLUDE
    $(error OPENNI2_INCLUDE is not defined. Please define it or 'source' the OpenNIDevEnvironment file from the installation)
else ifndef OPENNI2_REDIST
    $(error OPENNI2_REDIST is not defined. Please define it or 'source' the OpenNIDevEnvironment file from the installation)
endif

INC_DIRS += $(OPENNI2_INCLUDE)

include CommonCppMakefile

.PHONY: copy-redist
copy-redist:
	cp -R $(OPENNI2_REDIST)/* $(OUT_DIR)

$(OUTPUT_FILE): copy-redist


text:
<?php

namespace Kunstmaan\MediaBundle\Form\Type;

/**
 * CurrentValueContainer.
 */
class CurrentValueContainer
{
    /**
     * @var object
     */
    private $currentValue;

    /**
     * @return object
     */
    public function getCurrentValue()
    {
        return $this->currentValue;
    }

    /**
     * @param object $currentValue
     */
    public function setCurrentValue($currentValue)
    {
        $this->currentValue = $currentValue;
    }
}


text:
class PrefValueMap;

namespace policy {

class PolicyErrorMap;
class PolicyMap;

// Maps a policy type to a preference path, and to the expected value type.
struct POLICY_EXPORT PolicyToPreferenceMapEntry {
  const char* const policy_name;
  const char* const preference_path;
  const base::Value::Type value_type;
};

// An abstract super class that subclasses should implement to map policies to
// their corresponding preferences, and to check whether the policies are valid.
class POLICY_EXPORT ConfigurationPolicyHandler {
 public:
  static std::string ValueTypeToString(base::Value::Type type);

  ConfigurationPolicyHandler();
  virtual ~ConfigurationPolicyHandler();

  // Returns whether the policy settings handled by this
  // ConfigurationPolicyHandler can be applied.  Fills |errors| with error
  // messages or warnings.  |errors| may contain error messages even when
  // |CheckPolicySettings()| returns true.
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) = 0;

  // Processes the policies handled by this ConfigurationPolicyHandler and sets
  // the appropriate preferences in |prefs|.
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) = 0;

  // Modifies the values of some of the policies in |policies| so that they
  // are more suitable to display to the user. This can be used to remove
  // sensitive values such as passwords, or to pretty-print values.
  virtual void PrepareForDisplaying(PolicyMap* policies) const;

 private:
  DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyHandler);
};

// Abstract class derived from ConfigurationPolicyHandler that should be
// subclassed to handle a single policy (not a combination of policies).
class POLICY_EXPORT TypeCheckingPolicyHandler
    : public ConfigurationPolicyHandler {
 public:
  TypeCheckingPolicyHandler(const char* policy_name,
                            base::Value::Type value_type);
  virtual ~TypeCheckingPolicyHandler();

  // ConfigurationPolicyHandler methods:
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) OVERRIDE;

  const char* policy_name() const;

 protected:
  // Runs policy checks and returns the policy value if successful.
  bool CheckAndGetValue(const PolicyMap& policies,
                        PolicyErrorMap* errors,
                        const base::Value** value);

 private:
  // The name of the policy.
  const char* policy_name_;

  // The type the value of the policy should have.
  base::Value::Type value_type_;

  DISALLOW_COPY_AND_ASSIGN(TypeCheckingPolicyHandler);
};

// Abstract class derived from TypeCheckingPolicyHandler that ensures an int
// policy's value lies in an allowed range. Either clamps or rejects values
// outside the range.
class POLICY_EXPORT IntRangePolicyHandlerBase
    : public TypeCheckingPolicyHandler {
 public:
  IntRangePolicyHandlerBase(const char* policy_name,
                            int min,
                            int max,
                            bool clamp);

  // ConfigurationPolicyHandler:
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) OVERRIDE;

 protected:
  virtual ~IntRangePolicyHandlerBase();

  // Ensures that the value is in the allowed range. Returns false if the value
  // cannot be parsed or lies outside the allowed range and clamping is
  // disabled.
  bool EnsureInRange(const base::Value* input,
                     int* output,
                     PolicyErrorMap* errors);

 private:
  // The minimum value allowed.
  int min_;

  // The maximum value allowed.
  int max_;

  // Whether to clamp values lying outside the allowed range instead of
  // rejecting them.
  bool clamp_;

  DISALLOW_COPY_AND_ASSIGN(IntRangePolicyHandlerBase);
};

// ConfigurationPolicyHandler for policies that map directly to a preference.
class POLICY_EXPORT SimplePolicyHandler : public TypeCheckingPolicyHandler {
 public:
  SimplePolicyHandler(const char* policy_name,
                      const char* pref_path,
                      base::Value::Type value_type);
  virtual ~SimplePolicyHandler();

  // ConfigurationPolicyHandler methods:
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) OVERRIDE;

 private:
  // The DictionaryValue path of the preference the policy maps to.
  const char* pref_path_;

  DISALLOW_COPY_AND_ASSIGN(SimplePolicyHandler);
};

// A policy handler implementation that maps a string enum list to an int enum
// list as specified by a mapping table.
class POLICY_EXPORT StringToIntEnumListPolicyHandler
    : public TypeCheckingPolicyHandler {
 public:
  struct POLICY_EXPORT MappingEntry {
    const char* enum_value;
    int int_value;
  };

  StringToIntEnumListPolicyHandler(const char* policy_name,
                                   const char* pref_path,
                                   const MappingEntry* mapping_begin,
                                   const MappingEntry* mapping_end);

  // ConfigurationPolicyHandler methods:
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) OVERRIDE;
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) OVERRIDE;

 private:
  // Attempts to convert the list in |input| to |output| according to the table,
  // returns false on errors.
  bool Convert(const base::Value* input,
               base::ListValue* output,
               PolicyErrorMap* errors);

  // Name of the pref to write.
  const char* pref_path_;

  // The mapping table.
  const MappingEntry* mapping_begin_;
  const MappingEntry* mapping_end_;

  DISALLOW_COPY_AND_ASSIGN(StringToIntEnumListPolicyHandler);
};

// A policy handler implementation that ensures an int policy's value lies in an
// allowed range.
class POLICY_EXPORT IntRangePolicyHandler : public IntRangePolicyHandlerBase {
 public:
  IntRangePolicyHandler(const char* policy_name,
                        const char* pref_path,
                        int min,
                        int max,
                        bool clamp);
  virtual ~IntRangePolicyHandler();

  // ConfigurationPolicyHandler:
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) OVERRIDE;

 private:
  // Name of the pref to write.
  const char* pref_path_;

  DISALLOW_COPY_AND_ASSIGN(IntRangePolicyHandler);
};

// A policy handler implementation that maps an int percentage value to a
// double.
class POLICY_EXPORT IntPercentageToDoublePolicyHandler
    : public IntRangePolicyHandlerBase {
 public:
  IntPercentageToDoublePolicyHandler(const char* policy_name,
                                     const char* pref_path,
                                     int min,
                                     int max,
                                     bool clamp);
  virtual ~IntPercentageToDoublePolicyHandler();

  // ConfigurationPolicyHandler:
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) OVERRIDE;

 private:
  // Name of the pref to write.
  const char* pref_path_;

  DISALLOW_COPY_AND_ASSIGN(IntPercentageToDoublePolicyHandler);
};

// Like TypeCheckingPolicyHandler, but validates against a schema instead of a
// single type. |schema| is the schema used for this policy, and |strategy| is
// the strategy used for schema validation errors.
class POLICY_EXPORT SchemaValidatingPolicyHandler
    : public ConfigurationPolicyHandler {
 public:
  SchemaValidatingPolicyHandler(const char* policy_name,
                                Schema schema,
                                SchemaOnErrorStrategy strategy);
  virtual ~SchemaValidatingPolicyHandler();

  // ConfigurationPolicyHandler:
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) OVERRIDE;

  const char* policy_name() const;

 protected:
  // Runs policy checks and returns the policy value if successful.
  bool CheckAndGetValue(const PolicyMap& policies,
                        PolicyErrorMap* errors,
                        scoped_ptr<base::Value>* output);

 private:
  const char* policy_name_;
  Schema schema_;
  SchemaOnErrorStrategy strategy_;

  DISALLOW_COPY_AND_ASSIGN(SchemaValidatingPolicyHandler);
};

// A policy handler to deprecate multiple legacy policies with a new one.
// This handler will completely ignore any of legacy policy values if the new
// one is set.
class POLICY_EXPORT LegacyPoliciesDeprecatingPolicyHandler
    : public ConfigurationPolicyHandler {
 public:
  LegacyPoliciesDeprecatingPolicyHandler(
      ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers,
      scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler);
  virtual ~LegacyPoliciesDeprecatingPolicyHandler();

  // ConfigurationPolicyHandler:
  virtual bool CheckPolicySettings(const PolicyMap& policies,
                                   PolicyErrorMap* errors) OVERRIDE;
  virtual void ApplyPolicySettings(const PolicyMap& policies,
                                   PrefValueMap* prefs) OVERRIDE;

 private:
  ScopedVector<ConfigurationPolicyHandler> legacy_policy_handlers_;
  scoped_ptr<SchemaValidatingPolicyHandler> new_policy_handler_;

  DISALLOW_COPY_AND_ASSIGN(LegacyPoliciesDeprecatingPolicyHandler);
};

}  // namespace policy

#endif  // COMPONENTS_POLICY_CORE_BROWSER_CONFIGURATION_POLICY_HANDLER_H_


text:
Movies by the Masses is an app that uses Twitter to find out how people are feeling about current or popular movies.

## Getting Started

To use the app, simply type in the name of a movie into the search bar. The app will provide you with information such as the movie's poster, actors, release date, etc., and the Twitter Mood Score, which tells you how people on Twitter are feeling about the movie--whether they love it, hate it, or something in between.

## Technologies Used

* HTML/CSS
* Bootstrap
* Javascript/jQuery/jQueryUI
* PHP
* Firebase
* Twitter API
* OMDB API
* Sentiment140 API (sentiment analysis)

## Authors
* Kristin Faner, Rebecca Leach, Eric Steinberg


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

	<meta name="author" content="Basho Technologies" />
	<meta name="description" content="riak - a decentralized key value store - basho technologies" />
	<meta name="keywords" content="riak nosql decentralized distributed key value store" />
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
	<link rel="stylesheet" href="css/style-1c.css" type="text/css" />
	<title>Riak - Map/Reduce brings computation to you data</title>

riak

Home

Source Code

API Docs

FAQ

Contact

Map/Reduce in Riak

The map/reduce programming model

Riak provides a data processing implementation based on the
MapReduce
model popularized by Google and
since adapted by Hadoop as
well as others.  Like every known map/reduce implementation, ours is shaped to best take advantage of our own approach to distributed data organization.

bring the computation to the data

One of the main reasons to use a map/reduce style of programming is to exploit data locality.  For data processing in a networked environment, it is generally understood that making the computation run where the data is already located will often perform much better (and be much more practical to manage) than moving all the data to the systems that will perform the computation.  Since Riak is designed around algorithms to manage and find data efficiently, the shape of our map/reduce implementation follows naturally from the rest of the system.

A map/reduce query or "flow" is simply a sequence of map and reduce phases, each feeding the next, and together providing an aggregate result.

A "map phase" is essentially just a function ("F") and an argument ("A") that is defined as part of a series of phases making up a given map/reduce query.  The phase will receive a stream of inputs ("I"), each of which consists of a key identifying a Riak object and an optional additional data element to accompany that object.  As each input is received by the phase, a node that already contains the document ("D") corresponding to "I" will run F(D,A) and stream along the results to the next phase.  The point here is that your function can be executed over many data items, but instead of collecting all of the data items in one place it will execute wherever the data is already placed.

A "reduce phase" is conceptually simpler.  As it receives inputs from the preceding phase, it collates those inputs along with the ones already received and continually "reduces" the input set until it receives notification that it will receive no further data, at which point the entire reduced set will be streamed to the next phase. Note that this makes a reduce phase a concurrency barrier, as opposed to map phases which can be processing in parallel.  In order for this process to make any sense, a reduce phase's function must be commutative, associative, and idempotent.  Good examples are sum and set-union.  As Riak's core focus is on decentralized data storage and not on compute farming, reduce phases are generally run on a single cluster -- there is no data-locality gain to be had in reduce.

A perfect fit for the Web

Since the original published use of map/reduce was for processing Web search indices, it should come as no surprise that this model is a great fit for the general problem of processing linked data.  That is, if your data set consists of many mostly-independent documents, loosely coupled by way of links inside the documents, then map/reduce is very likely to be a good approach to querying that data collection.  To make this even easier, we have added a superficial third type of phase to the model, the "link" phase.  In fact, link phases are just map phases, parameterized ahead of time such that the map function will be a function that knows enough about your document types to extract links matching a given pattern or tag.  While such map phases can of course be written manually, we saw this operation so frequently that we made a shorthand for it -- and now those phases are by far the most common use of our map/reduce engine.

not just for bulk processing

While the most popular map/reduce systems out there are generally used to apply a map/reduce flow over an entire body of data, Riak provides a more focused approach.  A query is instead "seeded", or provided with the explicit list of inputs that will be used by the first phase in the query.  This approach, combined with the link-following convention, allows for an entirely new set of uses for the map/reduce programming paradigm.

the gory details

A map/reduce query is initiated with two arguments.  The first is simply the list of values (usually bucket/key pairs as the first phase is almost always a map phase) that will be sent to the first phase in the flow.  The second argument is a list of terms declaring the flow of phases for this query.

A map phase is declared as:

{map, FunTerm, Arg, Accumulate}

FunTerm is a reference to the function that will compute the map of
    each value.  A function referenced by a FunTerm must be arity-3,
    accepting the arguments (Value, Data, Arg) as follows:

Value is the value found at a key.  This will either be a Riak object structure (accessed via the riak_object module) or else the tuple {error, notfound}.

Data is an optional piece of data attached to the bucket/key pair that initiated this execution.  If instead of {Bucket, Key}, {{Bucket, Key}, Data} is passed as an input to a map step, that Data will be passed to the map function in this argument.  Data will be the atom 'undefined' if the former form is used.

Arg is the argument by the same name that was passed to the overall map phase declaration.

The FunTerm may take one of two forms: Either {modfun, Module, Function} where Module and Function are atoms that name an Erlang function in a specific module, or {qfun, Function} where Function is a callable fun term.

Accumulate should be set to true for all phases whose output is desired in the final result of the map/reduce execution, and false for all others.  The most common pattern is to set this to true in only the very last phase, but some interesting queries can be produced by setting it earlier as well.

Note that a map function must return a list of values, each of which will be an input to the next phase.

A reduce phase is declared as:

{reduce, FunTerm, Arg, Accumulate}

Where the terms are essentially the same as for map, with the exception that the function referenced by FunTerm must be arity 2.  It takes (ValueList, Arg) with Arg playing the same role as before and ValueList being a round of (possibly already processed) inputs to reduce.

Much like with map, a reduce function must return a list of values.  This list will be combined with the next input list the next time the reduce function is called, which is why the reduce function must be commutative, associative, and idempotent.

The third and final type of phase is a link phase, declared as {link, Bucket, Tag, Accumulate}.  For this kind of phase to work, there must already be a linkfun property set on Bucket in the cluster, which must return a FunTerm.  This will be translated into a map phase with that term, looking like: {map, FunTerm, {Bucket,Tag}, Accumulate}.


text:
Mon Jan 11 22:48:18 2016

## Evaluating magicsquare.c

File doesn't match naming convention

## Evaluating repeatnum.c

File doesn't match naming convention


text:
<?php

final class PhabricatorSlowvoteVoteController
  extends PhabricatorSlowvoteController {

  public function handleRequest(AphrontRequest $request) {
    $viewer = $request->getViewer();
    $id = $request->getURIData('id');

    $poll = id(new PhabricatorSlowvoteQuery())
      ->setViewer($viewer)
      ->withIDs(array($id))
      ->needOptions(true)
      ->needViewerChoices(true)
      ->executeOne();
    if (!$poll) {
      return new Aphront404Response();
    }
    if ($poll->getIsClosed()) {
      return new Aphront400Response();
    }

    $options = $poll->getOptions();
    $viewer_choices = $poll->getViewerChoices($viewer);

    $old_votes = mpull($viewer_choices, null, 'getOptionID');

    if ($request->isAjax()) {
      $vote = $request->getInt('vote');
      $votes = array_keys($old_votes);
      $votes = array_fuse($votes, $votes);

      if ($poll->getMethod() == PhabricatorSlowvotePoll::METHOD_PLURALITY) {
        if (idx($votes, $vote, false)) {
          $votes = array();
        } else {
          $votes = array($vote);
        }
      } else {
        if (idx($votes, $vote, false)) {
          unset($votes[$vote]);
        } else {
          $votes[$vote] = $vote;
        }
      }

      $this->updateVotes($viewer, $poll, $old_votes, $votes);

      $updated_choices = id(new PhabricatorSlowvoteChoice())->loadAllWhere(
        'pollID = %d AND authorPHID = %s',
        $poll->getID(),
        $viewer->getPHID());

      $embed = id(new SlowvoteEmbedView())
        ->setPoll($poll)
        ->setOptions($options)
        ->setViewerChoices($updated_choices);

      return id(new AphrontAjaxResponse())
        ->setContent(array(
          'pollID' => $poll->getID(),
          'contentHTML' => $embed->render(),
        ));
    }

    if (!$request->isFormPost()) {
      return id(new Aphront404Response());
    }

    $votes = $request->getArr('vote');
    $votes = array_fuse($votes, $votes);

    $this->updateVotes($viewer, $poll, $old_votes, $votes);

    return id(new AphrontRedirectResponse())->setURI('/V'.$poll->getID());
  }

  private function updateVotes($viewer, $poll, $old_votes, $votes) {
    if (!empty($votes) && count($votes) > 1 &&
        $poll->getMethod() == PhabricatorSlowvotePoll::METHOD_PLURALITY) {
      return id(new Aphront400Response());
    }

    foreach ($old_votes as $old_vote) {
      if (!idx($votes, $old_vote->getOptionID(), false)) {
        $old_vote->delete();
      }
    }

    foreach ($votes as $vote) {
      if (idx($old_votes, $vote, false)) {
        continue;
      }

      id(new PhabricatorSlowvoteChoice())
        ->setAuthorPHID($viewer->getPHID())
        ->setPollID($poll->getID())
        ->setOptionID($vote)
        ->save();
    }
  }

}


text:
/* $FreeBSD: soc2013/dpl/head/sys/dev/usb/quirk/usb_quirk.h 244625 2012-11-23 08:22:06Z hselasky $ */
/*-
 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef _USB_QUIRK_H_
#define	_USB_QUIRK_H_

enum {
	/*
	 * Keep in sync with usb_quirk_str in usb_quirk.c, and with
	 * share/man/man4/usb_quirk.4
	 */
	UQ_NONE,		/* not a valid quirk */

	UQ_MATCH_VENDOR_ONLY,	/* match quirk on vendor only */

	/* Various quirks */

	UQ_AUDIO_SWAP_LR,	/* left and right sound channels are swapped */
	UQ_AU_INP_ASYNC,	/* input is async despite claim of adaptive */
	UQ_AU_NO_FRAC,		/* don't adjust for fractional samples */
	UQ_AU_NO_XU,		/* audio device has broken extension unit */
	UQ_BAD_ADC,		/* bad audio spec version number */
	UQ_BAD_AUDIO,		/* device claims audio class, but isn't */
	UQ_BROKEN_BIDIR,	/* printer has broken bidir mode */
	UQ_BUS_POWERED,		/* device is bus powered, despite claim */
	UQ_HID_IGNORE,		/* device should be ignored by hid class */
	UQ_KBD_IGNORE,		/* device should be ignored by kbd class */
	UQ_KBD_BOOTPROTO,	/* device should set the boot protocol */
	UQ_UMS_IGNORE,          /* device should be ignored by ums class */
	UQ_MS_BAD_CLASS,	/* doesn't identify properly */
	UQ_MS_LEADING_BYTE,	/* mouse sends an unknown leading byte */
	UQ_MS_REVZ,		/* mouse has Z-axis reversed */
	UQ_NO_STRINGS,		/* string descriptors are broken */
	UQ_POWER_CLAIM,		/* hub lies about power status */
	UQ_SPUR_BUT_UP,		/* spurious mouse button up events */
	UQ_SWAP_UNICODE,	/* has some Unicode strings swapped */
	UQ_CFG_INDEX_1,		/* select configuration index 1 by default */
	UQ_CFG_INDEX_2,		/* select configuration index 2 by default */
	UQ_CFG_INDEX_3,		/* select configuration index 3 by default */
	UQ_CFG_INDEX_4,		/* select configuration index 4 by default */
	UQ_CFG_INDEX_0,		/* select configuration index 0 by default */
	UQ_ASSUME_CM_OVER_DATA,	/* assume cm over data feature */

	/*
	 * USB Mass Storage Quirks. See "storage/umass.c" for a
	 * detailed description.
	 */
	UQ_MSC_NO_TEST_UNIT_READY,	/* send start/stop instead of TUR */
	UQ_MSC_NO_RS_CLEAR_UA,		/* does not reset Unit Att. */
	UQ_MSC_NO_START_STOP,		/* does not support start/stop */
	UQ_MSC_NO_GETMAXLUN,		/* does not support get max LUN */
	UQ_MSC_NO_INQUIRY,		/* fake generic inq response */
	UQ_MSC_NO_INQUIRY_EVPD,		/* does not support inq EVPD */
	UQ_MSC_NO_PREVENT_ALLOW,	/* does not support medium removal */
	UQ_MSC_NO_SYNC_CACHE,		/* does not support sync cache */
	UQ_MSC_SHUTTLE_INIT,		/* requires Shuttle init sequence */
	UQ_MSC_ALT_IFACE_1,		/* switch to alternate interface 1 */
	UQ_MSC_FLOPPY_SPEED,		/* does floppy speeds (20kb/s) */
	UQ_MSC_IGNORE_RESIDUE,		/* gets residue wrong */
	UQ_MSC_WRONG_CSWSIG,		/* uses wrong CSW signature */
	UQ_MSC_RBC_PAD_TO_12,		/* pad RBC requests to 12 bytes */
	UQ_MSC_READ_CAP_OFFBY1,		/* reports sector count, not max sec. */
	UQ_MSC_FORCE_SHORT_INQ,		/* does not support full inq. */
	UQ_MSC_FORCE_WIRE_BBB,		/* force BBB wire protocol */
	UQ_MSC_FORCE_WIRE_CBI,		/* force CBI wire protocol */
	UQ_MSC_FORCE_WIRE_CBI_I,	/* force CBI with int. wire protocol */
	UQ_MSC_FORCE_PROTO_SCSI,	/* force SCSI command protocol */
	UQ_MSC_FORCE_PROTO_ATAPI,	/* force ATAPI command protocol */
	UQ_MSC_FORCE_PROTO_UFI,		/* force UFI command protocol */
	UQ_MSC_FORCE_PROTO_RBC,		/* force RBC command protocol */

	/* Ejection of mass storage (driver disk) */
	UQ_MSC_EJECT_HUAWEI,		/* ejects after Huawei USB command */
	UQ_MSC_EJECT_SIERRA,		/* ejects after Sierra USB command */
	UQ_MSC_EJECT_SCSIEJECT,		/* ejects after SCSI eject command */
	UQ_MSC_EJECT_REZERO,		/* ejects after SCSI rezero command */
	UQ_MSC_EJECT_ZTESTOR,		/* ejects after ZTE SCSI command */
	UQ_MSC_EJECT_CMOTECH,		/* ejects after C-motech SCSI cmd */
	UQ_MSC_EJECT_WAIT,		/* wait for the device to eject */
	UQ_MSC_EJECT_SAEL_M460,		/* ejects after Sael USB commands */
	UQ_MSC_EJECT_HUAWEISCSI,	/* ejects after Huawei SCSI command */
	UQ_MSC_EJECT_TCT,		/* ejects after TCT SCSI command */

	UQ_BAD_MIDI,		/* device claims MIDI class, but isn't */
	UQ_AU_VENDOR_CLASS,	/* audio device uses vendor and not audio class */
	UQ_SINGLE_CMD_MIDI,	/* at most one command per USB packet */

	USB_QUIRK_MAX
};

uint8_t	usb_test_quirk(const struct usb_attach_arg *uaa, uint16_t quirk);

#endif					/* _USB_QUIRK_H_ */


text:
package com.hp.autonomy.types.requests.qms.actions.typeahead.params;

/**
 * Parameters for the QMS TypeAhead action.
 */
public enum TypeAheadParams {
    FieldRestriction,
    MaxResults,
    MinScore,
    Mode,
    SecurityInfo,
    TermExpandParameter,
    Text
}


text:
package io.locative.app.network;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.provider.Settings;

import com.facebook.stetho.okhttp3.StethoInterceptor;

import java.io.IOException;
<<<<<<< HEAD
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
=======
>>>>>>> LocativeHQ/master
import java.sql.Timestamp;
import java.util.Date;

import javax.inject.Inject;

import io.locative.app.BuildConfig;
import io.locative.app.R;
import io.locative.app.model.EventType;
import io.locative.app.model.Fencelog;
import io.locative.app.model.Geofences;
import io.locative.app.notification.NotificationManager;
import io.locative.app.utils.Constants;
import io.locative.app.utils.Preferences;
import io.locative.app.utils.UrlEncoder;
import okhttp3.Authenticator;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Credentials;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.Route;

public class RequestManager {

    private final OkHttpClient.Builder mClientBuilder = new OkHttpClient.Builder();
    @Inject
    SharedPreferences mPreferences;

    @Inject
    LocativeApiWrapper mLocativeNetworkingWrapper;

    @Inject
    Context mContext;

    @Inject
    NotificationManager mNotificationManager;

<<<<<<< HEAD
=======
    @Inject
    RequestManager() {
    }

    private OkHttpClient.Builder getClientBuilder() {
        final OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder();
        if (BuildConfig.DEBUG) {
            clientBuilder.addNetworkInterceptor(new StethoInterceptor());
        }
        return clientBuilder;
    }

>>>>>>> LocativeHQ/master
    private String relevantUrl(final Geofences.Geofence geofence, final EventType eventType) {
        if (eventType == EventType.ENTER) {
            if (geofence.enterUrl != null && geofence.enterUrl.length() > 0) {
                return geofence.enterUrl;
            }
        }
        if (eventType == EventType.EXIT) {
            if (geofence.exitUrl != null && geofence.exitUrl.length() > 0) {
                return geofence.exitUrl;
            }
        }
        return mPreferences.getString(Preferences.HTTP_URL, "");
    }

    private int relevantMethod(final Geofences.Geofence geofence, final EventType eventType) {
        if (eventType == EventType.ENTER) {
            if (geofence.enterUrl != null && geofence.enterUrl.length() > 0) {
                return geofence.enterMethod;
            }
        }
        if (eventType == EventType.EXIT) {
            if (geofence.exitUrl != null && geofence.exitUrl.length() > 0) {
                return geofence.exitMethod;
            }
        }
        return mPreferences.getInt(Preferences.HTTP_METHOD, 0);
    }

    private String urlIncludingQuery(final Geofences.Geofence geofence, EventType eventType) throws UnsupportedEncodingException {
        final String url = relevantUrl(geofence, eventType);
        final int method = relevantMethod(geofence, eventType);
        if (method == 0) { // POST
            return url;
        }

        // GET
        return url
                .concat(url.contains("?") ? "&" : "?")
                .concat(
<<<<<<< HEAD
                "latitude=" + URLEncoder.encode(Float.toString(geofence.latitude))
                + "&longitude=" + URLEncoder.encode(Float.toString(geofence.longitude))
                + "&id=" + URLEncoder.encode(geofence.subtitle)
                + "&device=" + URLEncoder.encode(Settings.Secure.getString(mContext.getContentResolver(),
                        Settings.Secure.ANDROID_ID))
                + "&device_type=" + URLEncoder.encode("Android")
                + "&device_model=" + URLEncoder.encode(Build.MODEL)
                + "&trigger=" + URLEncoder.encode(eventToString(eventType))
                + "&timestamp=" + URLEncoder.encode(String.valueOf(new Timestamp(new Date().getTime())))
        );

=======
                        "latitude=" + UrlEncoder.encode(Double.toString(geofence.latitude))
                                + "&longitude=" + UrlEncoder.encode(Double.toString(geofence.longitude))
                                + "&id=" + UrlEncoder.encode(geofence.getRelevantId())
                                + "&device=" + UrlEncoder.encode(Settings.Secure.getString(mContext.getContentResolver(),
                                Settings.Secure.ANDROID_ID))
                                + "&device_type=" + UrlEncoder.encode("Android")
                                + "&device_model=" + UrlEncoder.encode(Build.MODEL)
                                + "&trigger=" + UrlEncoder.encode(eventType.getEventName())
                                + "&timestamp=" + UrlEncoder.encode(String.valueOf(new Timestamp(new Date().getTime())))
                );
>>>>>>> LocativeHQ/master
    }

    public void dispatch(final Geofences.Geofence geofence, final EventType eventType) {
        final OkHttpClient.Builder clientBuilder = getClientBuilder();

        final String httpUsername = geofence.hasAuthentication() ?
                geofence.httpUsername :
                mPreferences.getString(Preferences.HTTP_USERNAME, "");

        final String httpPassword = geofence.hasAuthentication() ?
                geofence.httpPassword :
                mPreferences.getString(Preferences.HTTP_PASSWORD, "");

        if (httpUsername.length() > 0 && httpPassword.length() > 0) {
            clientBuilder.authenticator(new Authenticator() {
                @Override
                public Request authenticate(Route route, Response response) throws IOException {
                    final String basicAuth = Credentials.basic(httpUsername, httpPassword);
                    return response.request().newBuilder().header("Authorization", basicAuth).build();
                }
            });
        }

        final OkHttpClient mClient = clientBuilder.build();
        final int method = relevantMethod(geofence, eventType);
        final RequestBody body = new FormBody.Builder()
                .add("latitude", String.valueOf(geofence.latitude))
                .add("longitude", String.valueOf(geofence.longitude))
                .add("id", geofence.getRelevantId())
                .add("device", Settings.Secure.getString(mContext.getContentResolver(),
                        Settings.Secure.ANDROID_ID))
                .add("device_type", "Android")
                .add("device_model", Build.MODEL)
                .add("trigger", eventType.getEventName())
                .add("timestamp", String.valueOf(new Timestamp(new Date().getTime())))
                .build();
<<<<<<< HEAD
        final Request request;
=======
        Request request;
>>>>>>> LocativeHQ/master
        try {
            request = new Request.Builder()
                    .url(urlIncludingQuery(geofence, eventType))
                    .method(fromMethod(method), method == 0 ? body : null)
                    .build();
<<<<<<< HEAD

=======
        } catch (Exception ex) {
            conditionallyShowFailureNotification(geofence, mContext.getString(R.string.trigger_error_invalid_url_notification));
            return;
        }
>>>>>>> LocativeHQ/master
        mClient.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                conditionallyShowFailureNotification(geofence, mContext.getString(R.string.error_http_request, mContext.getString((eventType == EventType.ENTER ? R.string.entering : R.string.exiting))));
                dispatchFencelog(geofence, eventType, relevantUrl(geofence, eventType), fromMethod(method), 0);
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                conditionallyShowSuccessNotification(geofence, eventType, response);
                dispatchFencelog(
                        geofence,
                        eventType,
                        relevantUrl(geofence, eventType),
                        fromMethod(method),
                        response.code()
                );
            }
        });}
        catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    private void conditionallyShowFailureNotification(final Geofences.Geofence geofence, final String message) {
        if (!mPreferences.getBoolean(Preferences.NOTIFICATION_FAIL, false)) {
            return;
        }
        mNotificationManager.showNotification(geofence.getRelevantId(), message);
    }

    private void conditionallyShowSuccessNotification(final Geofences.Geofence geofence, final EventType eventType, final Response response) {
        if (!mPreferences.getBoolean(Preferences.NOTIFICATION_SUCCESS, false)) {
            return;
        }
        mNotificationManager.showNotification(
                geofence.getRelevantId(),
                mContext.getString(
                        R.string.success_http_request,
                        response.isSuccessful() ? mContext.getString(R.string.success) : mContext.getString(R.string.error),
                        eventType.isEnter() ? mContext.getString(R.string.entering) : mContext.getString(R.string.exiting),
                        response.code()
                )
        );
    }

    public void dispatchFencelog(final Geofences.Geofence geofence,
                          final EventType eventType,
                          final String httpUrl,
                          final String httpMethod,
                          final int httpResponseCode) {
        String sessionId = mPreferences.getString(Preferences.SESSION_ID, null);
        if (sessionId != null && eventType != null) {
            Fencelog fencelog = new Fencelog();
            fencelog.locationId = geofence.getRelevantId();
            fencelog.latitude = geofence.latitude;
            fencelog.longitude = geofence.longitude;
            fencelog.eventType = eventType;
            fencelog.origin = Build.MODEL;
            fencelog.httpUrl = httpUrl;
            fencelog.httpMethod = httpMethod;
            fencelog.httpResponseCode = String.valueOf(httpResponseCode);
            mLocativeNetworkingWrapper.doDispatchFencelog(sessionId, fencelog, null);
        }
    }

    private String fromMethod(int method) {
        return method == Constants.HttpMethod.POST.ordinal() ? "POST" : "GET";
    }

}


text:
module Softlayer
  module Container
    module Product
      class Order
        module Monitoring
          class Package < Softlayer::Container::Product::Order
            attr_accessor :configuration_template_groups
            attr_accessor :server_type

            class Representer < Softlayer::Container::Product::Order::Representer
              include Representable::Hash
              include Representable::Coercion
              property :server_type, type: String
            end
          end
        end
      end
    end
  end
end


text:
layout: shows/episode
title: "Side Navigation Bar: Live Code Session - Supercharged"
youtubeID: "e5CXg1sjTqQ"
youtubeThumbnail: "https://i.ytimg.com/vi/e5CXg1sjTqQ/maxresdefault.jpg"
published_on: 2016-05-04
updated_on: 2016-05-04
---

In this Side Navigation Bar Live Code Session (Supercharged) Paul and Surma run through the process of building a Side Nav. There is plenty of chatter, much head scratching and the occasional bug!

Please 'Like' this video if you want to see more Supercharged Live Code Sessions from Paul and Surma.

Find the code on Github here: https://github.com/GoogleChrome/ui-element-samples

Watch more episodes of Supercharged here: https://goo.gl/WFD8py

Subscribe to the Chrome Developers channel at http://goo.gl/LLLNvf


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>PHPExcel classes » \PHPExcel_RichText_TextElement</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">

PHPExcel classes

                                    API Documentation

Packages

 Default

 JAMA

 JAMA
Cholesky decomposition class
For a symmetric, positive definite matrix A, the Cholesky decomposition
is an lower triangular matrix L so that A = L*L'

 JAMA
Class to obtain eigenvalues and eigenvectors of a real matrix

 JAMA
Error handling

 JAMA
For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n
unit lower triangular matrix L, an n-by-n upper triangular matrix U,
and a permutation vector piv of length m so that A(piv,:) = L*U

 JAMA
For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n
orthogonal matrix Q and an n-by-n upper triangular matrix R so that
A = Q*R

 JAMA
For an m-by-n matrix A with m >= n, the singular value decomposition is
an m-by-n orthogonal matrix U, an n-by-n diagonal matrix S, and
an n-by-n orthogonal matrix V so that A = U*S*V'

 JAMA
Pythagorean Theorem:
a = 3
b = 4
r = sqrt(square(a) + square(b))
r = 5
r = sqrt(a^2 + b^2) without under/overflow

 PHPExcel

                                    Charts

 Class hierarchy diagram

                                    Reports

 Errors
                551

 Markers

todo
                19

fixme
                10

 Deprecated elements
                12

Back to top

                            Javascript is disabled; several features are only available
                            if Javascript is enabled.

<button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button>

<button class="btn details" title="Show descriptions and method names"></button><button class="btn simple" title="Show only method names"></button>

 Methods

Implement PHP __clone to create a deep clone, not just a shallow copy.
__clone()

Create a new PHPExcel_RichText_TextElement instance
__construct()

Get font
getFont()

Get hash code
getHashCode()

Get text
getText()

Set text
setText()

 Properties

» Private

$_text

\

global

\PHPExcel_RichText_TextElement

PHPExcel_RichText_TextElement

category
PHPExcel

package
PHPExcel_RichText

copyright
Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

 Methods

Implement PHP __clone to create a deep clone, not just a shallow copy.

__clone()

Create a new PHPExcel_RichText_TextElement instance

__construct(string $pText)

Parameters

$pText

string
Text

Get font

getFont() : \PHPExcel_Style_Font

Returns

\PHPExcel_Style_Font

Get hash code

getHashCode() : string

Returns

stringHash code

Get text

getText() : string

Returns

stringText

Set text

setText($pText) : \PHPExcel_RichText_ITextElement

Parameters

$pText

string	Text

Returns

\PHPExcel_RichText_ITextElement

 Properties

$_text : string

            Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.

            Documentation is powered by phpDocumentor 2.0.0a12 and

            generated on 2014-03-02T15:27:36Z.


text:
package com.perpetumobile.bit.android.handlers;

import com.perpetumobile.bit.android.BitActivity;
import com.perpetumobile.bit.android.DataSingleton;

import android.app.SearchManager;
import android.app.SearchableInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.widget.SearchView;

public class SearchViewActivityHandler {

	protected BitActivity activity;
	protected SearchView searchView;

	public SearchViewActivityHandler(BitActivity activity) {
		this.activity = activity;
	}

	public BitActivity getActivity() {
		return activity;
	}

	public boolean onCreateOptionsMenu(Menu menu, int searchViewId, ComponentName searchable) {
		// Get the SearchView and set the searchable configuration
		searchView = (SearchView) menu.findItem(searchViewId).getActionView();
		if(searchView != null) {
			SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
			SearchableInfo searchableInfo = searchManager.getSearchableInfo(searchable);
			searchView.setSearchableInfo(searchableInfo);
			// Do not iconify the widget; expand it by default
			searchView.setIconifiedByDefault(false);

			Intent intent = activity.getIntent();
			if (intent != null && Intent.ACTION_SEARCH.equals(intent.getAction())) {
				activity.setQuery(intent.getStringExtra(SearchManager.QUERY));
			}
		}
		return true;
	}

	public boolean onPrepareOptionsMenu(Menu menu) {
		String query = (String) DataSingleton.getInstance().get(DataSingleton.QUERY_KEY);
		if(query != null && searchView != null) {
			searchView.setQuery(query, false);
		}
		return true;
	}
}


text:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;

using Amazon.Runtime;
namespace Amazon.RDS.Model
{
    /// <summary>
    /// The results from the ModifyDBInstance action.
    /// </summary>
    public class ModifyDBInstanceResult
    {
        private DBInstance dBInstanceValue;

        /// <summary>
        /// Gets and sets the ModifyDBInstanceResult property.
        /// Contains the result of a successful invocation of the ModifyDBInstance
        /// action.
        /// </summary>
        public DBInstance DBInstance
        {
            get { return this.dBInstanceValue; }
            set { this.dBInstanceValue = value; }
        }
    }
}


text:
var Components = require('../../components.json');
var fs = require('fs');
var render = require('json-templater/string');
var uppercamelcase = require('uppercamelcase');
var path = require('path');

var OUTPUT_PATH = path.join(__dirname, '../../src/index.js');
var IMPORT_TEMPLATE = 'import {{name}} from \'../packages/{{package}}/index.js\';';
var ISNTALL_COMPONENT_TEMPLATE = '  Vue.component({{name}}.name, {{name}});';
var MAIN_TEMPLATE = `{{include}}

const install = function(Vue) {
  if (install.installed) return;

{{install}}

  Vue.use(Loading);

  Vue.prototype.$msgbox = Msgbox;
  Vue.prototype.$alert = Msgbox.alert;
  Vue.prototype.$confirm = Msgbox.confirm;
  Vue.prototype.$prompt = Msgbox.prompt;
  Vue.prototype.$notify = Notification;
  Vue.prototype.$msg = Msg;
};

// auto install
if (typeof window !== 'undefined' && window.Vue) {
  install(window.Vue);
};

module.exports = {
  version: '{{version}}',
  install,
{{list}}
};
`;

delete Components.font;

var ComponentNames = Object.keys(Components);

var includeComponentTemplate = [];
var installTemplate = [];
var listTemplate = [];

ComponentNames.forEach(name => {
  var componentName = uppercamelcase(name);

  includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
    name: componentName,
    package: name
  }));

  if (['Loading', 'Msgbox', 'Notification'].indexOf(componentName) === -1) {
    installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
      name: componentName,
      component: name
    }));
  }

  listTemplate.push(`  ${componentName}`);
});

var template = render(MAIN_TEMPLATE, {
  include: includeComponentTemplate.join('\n'),
  install: installTemplate.join('\n'),
  version: process.env.VERSION || require('../../package.json').version,
  list: listTemplate.join(',\n')
});

fs.writeFileSync(OUTPUT_PATH, template);
console.log('[build entry] DONE:', OUTPUT_PATH);


text:
package main

import (
	"os/exec"
	"strings"
	"testing"
)

func TestResizeApiResponse(t *testing.T) {
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "top")
	out, _, err := runCommandWithOutput(runCmd)
	if err != nil {
		t.Fatalf(out, err)
	}
	defer deleteAllContainers()
	cleanedContainerID := strings.TrimSpace(out)

	endpoint := "/containers/" + cleanedContainerID + "/resize?h=40&w=40"
	_, err = sockRequest("POST", endpoint, nil)
	if err != nil {
		t.Fatalf("resize Request failed %v", err)
	}

	logDone("container resize - when started")
}

func TestResizeApiResponseWhenContainerNotStarted(t *testing.T) {
	runCmd := exec.Command(dockerBinary, "run", "-d", "busybox", "true")
	out, _, err := runCommandWithOutput(runCmd)
	if err != nil {
		t.Fatalf(out, err)
	}
	defer deleteAllContainers()
	cleanedContainerID := strings.TrimSpace(out)

	// make sure the exited container is not running
	runCmd = exec.Command(dockerBinary, "wait", cleanedContainerID)
	out, _, err = runCommandWithOutput(runCmd)
	if err != nil {
		t.Fatalf(out, err)
	}

	endpoint := "/containers/" + cleanedContainerID + "/resize?h=40&w=40"
	body, err := sockRequest("POST", endpoint, nil)
	if err == nil {
		t.Fatalf("resize should fail when container is not started")
	}
	if !strings.Contains(string(body), "Cannot resize container") && !strings.Contains(string(body), cleanedContainerID) {
		t.Fatalf("resize should fail with message 'Cannot resize container' but instead received %s", string(body))
	}

	logDone("container resize - when not started should not resize")
}


text:
using System;
namespace BugsnagUnity
{
    public enum ThreadSendPolicy
    {
        Always = 0,
        UnhandledOnly = 1,
        Never = 2
    }
}


text:
class ResultReciever_pblast
{
public:
    virtual bool match_found  (SEQ& xseq, SEQ& yseq, BATCH* batches, int batch_no, double score, double q_auto_score, double t_auto_score) = 0;
};

#endif


text:
//---------------------------------------------------------------------------------------
// This file is part of the Lomse library.
// Copyright (c) 2010-present, Lomse Developers
//
// Licensed under the MIT license.
//
// See LICENSE and NOTICE.md files in the root directory of this source tree.
//---------------------------------------------------------------------------------------

#ifndef __LOMSE_BEAM_ENGRAVER_H__        //to avoid nested includes
#define __LOMSE_BEAM_ENGRAVER_H__

#include "lomse_basic.h"
#include "lomse_injectors.h"
#include "lomse_engraver.h"
#include "lomse_vertical_profile.h"

#include <list>
using namespace std;

namespace lomse
{

//forward declarations
class GmoShape;
class GmoShapeBeam;
class GmoShapeNote;
class ImoBeam;
class ImoNote;
class ImoNoteRest;
class ImoObj;
class ScoreMeter;
class VerticalProfile;

//---------------------------------------------------------------------------------------
/** SegmentData: Helper struct for storing data about one beam segment
*/
struct SegmentData
{
    int iLevel;                 //segment level: 0..5. 0=ppal, 1=next level, etc.
    LUnits xStart;
    LUnits yStart;
    LUnits xEnd;
    LUnits yEnd;
    GmoShapeNote* pStartNote;   //nullptr for forward hook, == pEndNote for backward hook
    GmoShapeNote* pEndNote;
    int position;               //from enum EComputedBeam
    bool fOpposite;             //segment with outher notes in opposite direction

    SegmentData(int level, LUnits xs, LUnits ys, LUnits xe, LUnits ye, GmoShapeNote* pSN,
                GmoShapeNote* pEN, int pos)
        : iLevel(level)
        , xStart(xs)
        , yStart(ys)
        , xEnd(xe)
        , yEnd(ye)
        , pStartNote(pSN)
        , pEndNote(pEN)
        , position(pos)
        , fOpposite(false)
    {
    }
};

//---------------------------------------------------------------------------------------
class BeamEngraver : public RelObjEngraver
{
protected:
    GmoShapeBeam* m_pBeamShape;
    ImoBeam* m_pBeam;
    std::list< pair<ImoNoteRest*, GmoShape*> > m_noteRests;

    std::list<LUnits> m_segments;
    UPoint m_origin;
    USize m_size;
    LUnits m_uBeamThickness;
    int m_beamPos;              //computed beam position. Value from enum EComputedBeam

    bool m_fDoubleStemmed;      //stems forced: not all stems in the same direction
    bool m_fCrossStaff;         //the flag notes are on both staves
    bool m_fGraceNotes;         //it is a beam with grace notes
    bool m_fChord;              //it is a beam with chords
    int m_numNotes;             //total number of notes
    int m_maxStaff;     //for cross-staff beams, the highest staff. For normal beams, just the staff
    int m_minStaff;     //for cross-staff beams, the lowest staff. For normal beams, just the staff
    int m_numLevels;    //number of beam levels for this beam;
    std::vector<GmoShapeNote*> m_note;      //shapes for notes. Rests removed.

public:
    BeamEngraver(LibraryScope& libraryScope, ScoreMeter* pScoreMeter);
    ~BeamEngraver();

    //implementation of virtual methods from RelObjEngraver
    void set_start_staffobj(ImoRelObj* pRO, const AuxObjContext& aoc) override;
    void set_middle_staffobj(ImoRelObj* pRO, const AuxObjContext& aoc) override;
    void set_end_staffobj(ImoRelObj* pRO, const AuxObjContext& aoc) override;

    //RelObjEngraver mandatory overrides
    GmoShape* create_first_or_intermediate_shape(const RelObjEngravingContext& ctx) override;
    GmoShape* create_last_shape(const RelObjEngravingContext& ctx) override;

    //During layout, when more space is added between two staves, all shapes are shifted
    //down to account for the added extra space. If a beam is cross-staff, it is
    //necessary to increment the lenght of all stems conected to this beam
    void increment_cross_staff_stems(LUnits yIncrement);

protected:
    void add_note_rest(ImoStaffObj* pSO, GmoShape* pStaffObjShape);
    void determine_number_of_beam_levels();
    void decide_stems_direction();
        void decide_stems_direction_for_beams_with_chords();
        void decide_stems_direction_for_beams_without_chords();
            void decide_beam_position();
        void change_stems_direction();
    void reposition_rests();

    void compute_beam_segments();
        void engrave_beam_segments_for_double_stemmed();
            void determine_segments(ImoBeam* pBeam, std::vector<SegmentData>* pSegs);
            void classify_segments(std::vector<SegmentData>* pSegs);
	        void position_segments(std::vector<SegmentData>* pSegs);
        void engrave_beam_segments_for_simple_beams();
            void add_segment(LUnits uxStart, LUnits uyStart, LUnits uxEnd, LUnits uyEnd);
            void make_segments_relative();

    void create_shape();
    void add_shape_to_noterests();
    void add_stroke_for_graces();

    //simple beams (and cross-staff but not double-stemmed)
    void beam_angle_and_stems_for_simple_beams();
        void create_horizontal_beam_and_set_stems(int pos0, int posN);
            float get_staff_length_for_beam(int iNote);
        float assign_slant_to_beam_for_grace_notes(int pos0, int posN);
        void assing_stem_length_to_outer_grace_notes(float slant, int pos0, int posN);
        float assign_slant_to_beam_for_regular_notes(int pos0, int posN);
            bool check_all_notes_outside_first_ledger_line();
        void assing_stem_length_to_outer_regular_notes(float slant, int pos0, int posN);
        void assing_stem_length_to_inner_notes();

    //cross-double-stemmed beams (cross-staff double-stemmed)
    void beam_angle_and_stems_for_cross_double_stemmed_beams();
        float determine_slant_direction_for_cross_double_stemmed(
                                                std::vector<GmoShapeNote*>& upNoteShapes,
                                                std::vector<GmoShapeNote*>& downNoteShapes);
            float assign_slant_for_cross_double_stemmed(std::vector<GmoShapeNote*>& noteShapes);
                float compute_slant_for_cross_double_stemmed(int pos0, int posN);
        void compute_stems_for_cross_double_stemmed(float slant,
                                                std::vector<GmoShapeNote*>& upNoteShapes,
                                                std::vector<GmoShapeNote*>& downNoteShapes);

    static bool has_repeated_pattern_of_pitches(std::vector<GmoShapeNote*>& noteShapes);
    static bool beam_must_be_horizontal(std::vector<GmoShapeNote*>& noteShapes);

    //temporary, only while determining stem position. Methods: decide_stems_direction(),
    //decide_beam_position(), change_stems_direction()
    bool m_fStemForced;     //at least one stem forced
    bool m_fStemsUp;        //only meaningfull if m_fDoubleStemed==false. True if all stems
                            //forced up or default position

};

}   //namespace lomse

#endif    // __LOMSE_BEAM_ENGRAVER_H__


text:
<app-nav></app-nav>

  <form class="form-signin" [formGroup]="loginForm" (ngSubmit)="onSubmit()" novalidate>

Please sign in

    Email address
    <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus formControlName="name">
    Password
    <input type="password" id="inputPassword" class="form-control" placeholder="Password" required formControlName="password">

        <input type="checkbox" value="remember-me"> Remember me

    <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
  </form>

<app-footer-aside></app-footer-aside>
<app-footer></app-footer>


text:
import os
import sys

from setuptools import setup, find_packages

if sys.version_info < (2, 6):
    raise SystemExit("Python 2.6 or later is required.")

exec(open(os.path.join("marrow", "config", "release.py")).read())

setup(
        name = "marrow.config",
        version = version,

        description = """""", # TODO: Prior to release.
        long_description = """\
For full documentation, see the README.textile file present in the package,
or view it online on the GitHub project page:

https://github.com/marrow/marrow.config""",

        author = "Alice Bevan-McGregor",
        author_email = "alice+marrow@gothcandy.com",
        url = "https://github.com/marrow/marrow.wsgi.objects",
        license = "MIT",

        install_requires = [
            'marrow.util < 2.0',
            'PyYAML'
        ],

        test_suite = 'nose.collector',
        tests_require = [
            'nose',
            'coverage'
        ],

        classifiers = [
                "Development Status :: 4 - Beta",
                "Environment :: Console",
                "Intended Audience :: Developers",
                "License :: OSI Approved :: MIT License",
                "Operating System :: OS Independent",
                "Programming Language :: Python",
                "Topic :: Software Development :: Libraries :: Python Modules"
            ],

        packages = find_packages(exclude=['examples', 'tests']),
        include_package_data = True,
        package_data = {'': ['README.textile', 'LICENSE']},
        zip_safe = True,

        namespace_packages = ['marrow'],
    )