text:
namespace FIX50
{

  class PositionMaintenanceRequest : public Message
  {
  public:
    PositionMaintenanceRequest() : Message(MsgType()) {}
    PositionMaintenanceRequest(const FIX::Message& m) : Message(m) {}
    PositionMaintenanceRequest(const Message& m) : Message(m) {}
    PositionMaintenanceRequest(const PositionMaintenanceRequest& m) : Message(m) {}
    static FIX::MsgType MsgType() { return FIX::MsgType("AL"); }

    PositionMaintenanceRequest(
      const FIX::PosTransType& aPosTransType,
      const FIX::PosMaintAction& aPosMaintAction,
      const FIX::ClearingBusinessDate& aClearingBusinessDate )
    : Message(MsgType())
    {
      set(aPosTransType);
      set(aPosMaintAction);
      set(aClearingBusinessDate);
    }

    FIELD_SET(*this, FIX::PosReqID);
    FIELD_SET(*this, FIX::PosTransType);
    FIELD_SET(*this, FIX::PosMaintAction);
    FIELD_SET(*this, FIX::OrigPosReqRefID);
    FIELD_SET(*this, FIX::PosMaintRptRefID);
    FIELD_SET(*this, FIX::ClearingBusinessDate);
    FIELD_SET(*this, FIX::SettlSessID);
    FIELD_SET(*this, FIX::SettlSessSubID);
    FIELD_SET(*this, FIX::NoPartyIDs);
    class NoPartyIDs: public FIX::Group
    {
    public:
    NoPartyIDs() : FIX::Group(453,448,FIX::message_order(448,447,452,802,0)) {}
      FIELD_SET(*this, FIX::PartyID);
      FIELD_SET(*this, FIX::PartyIDSource);
      FIELD_SET(*this, FIX::PartyRole);
      FIELD_SET(*this, FIX::NoPartySubIDs);
      class NoPartySubIDs: public FIX::Group
      {
      public:
      NoPartySubIDs() : FIX::Group(802,523,FIX::message_order(523,803,0)) {}
        FIELD_SET(*this, FIX::PartySubID);
        FIELD_SET(*this, FIX::PartySubIDType);
      };
    };
    FIELD_SET(*this, FIX::Account);
    FIELD_SET(*this, FIX::AcctIDSource);
    FIELD_SET(*this, FIX::AccountType);
    FIELD_SET(*this, FIX::Symbol);
    FIELD_SET(*this, FIX::SymbolSfx);
    FIELD_SET(*this, FIX::SecurityID);
    FIELD_SET(*this, FIX::SecurityIDSource);
    FIELD_SET(*this, FIX::Product);
    FIELD_SET(*this, FIX::CFICode);
    FIELD_SET(*this, FIX::SecurityType);
    FIELD_SET(*this, FIX::SecuritySubType);
    FIELD_SET(*this, FIX::MaturityMonthYear);
    FIELD_SET(*this, FIX::MaturityDate);
    FIELD_SET(*this, FIX::MaturityTime);
    FIELD_SET(*this, FIX::PutOrCall);
    FIELD_SET(*this, FIX::SettleOnOpenFlag);
    FIELD_SET(*this, FIX::InstrmtAssignmentMethod);
    FIELD_SET(*this, FIX::SecurityStatus);
    FIELD_SET(*this, FIX::CouponPaymentDate);
    FIELD_SET(*this, FIX::IssueDate);
    FIELD_SET(*this, FIX::RepoCollateralSecurityType);
    FIELD_SET(*this, FIX::RepurchaseTerm);
    FIELD_SET(*this, FIX::RepurchaseRate);
    FIELD_SET(*this, FIX::Factor);
    FIELD_SET(*this, FIX::CreditRating);
    FIELD_SET(*this, FIX::InstrRegistry);
    FIELD_SET(*this, FIX::CountryOfIssue);
    FIELD_SET(*this, FIX::StateOrProvinceOfIssue);
    FIELD_SET(*this, FIX::LocaleOfIssue);
    FIELD_SET(*this, FIX::RedemptionDate);
    FIELD_SET(*this, FIX::StrikePrice);
    FIELD_SET(*this, FIX::StrikeCurrency);
    FIELD_SET(*this, FIX::StrikeMultiplier);
    FIELD_SET(*this, FIX::StrikeValue);
    FIELD_SET(*this, FIX::OptAttribute);
    FIELD_SET(*this, FIX::ContractMultiplier);
    FIELD_SET(*this, FIX::MinPriceIncrement);
    FIELD_SET(*this, FIX::UnitOfMeasure);
    FIELD_SET(*this, FIX::TimeUnit);
    FIELD_SET(*this, FIX::CouponRate);
    FIELD_SET(*this, FIX::SecurityExchange);
    FIELD_SET(*this, FIX::PositionLimit);
    FIELD_SET(*this, FIX::NTPositionLimit);
    FIELD_SET(*this, FIX::Issuer);
    FIELD_SET(*this, FIX::EncodedIssuerLen);
    FIELD_SET(*this, FIX::EncodedIssuer);
    FIELD_SET(*this, FIX::SecurityDesc);
    FIELD_SET(*this, FIX::EncodedSecurityDescLen);
    FIELD_SET(*this, FIX::EncodedSecurityDesc);
    FIELD_SET(*this, FIX::Pool);
    FIELD_SET(*this, FIX::ContractSettlMonth);
    FIELD_SET(*this, FIX::CPProgram);
    FIELD_SET(*this, FIX::CPRegType);
    FIELD_SET(*this, FIX::DatedDate);
    FIELD_SET(*this, FIX::InterestAccrualDate);
    FIELD_SET(*this, FIX::Currency);
    FIELD_SET(*this, FIX::NoLegs);
    class NoLegs: public FIX::Group
    {
    public:
    NoLegs() : FIX::Group(555,600,FIX::message_order(600,601,602,603,607,608,609,764,610,611,248,249,250,251,252,253,257,599,596,597,598,254,612,942,613,614,999,1001,615,616,617,618,619,620,621,622,623,624,556,740,739,955,956,1017,0)) {}
      FIELD_SET(*this, FIX::LegSymbol);
      FIELD_SET(*this, FIX::LegSymbolSfx);
      FIELD_SET(*this, FIX::LegSecurityID);
      FIELD_SET(*this, FIX::LegSecurityIDSource);
      FIELD_SET(*this, FIX::LegProduct);
      FIELD_SET(*this, FIX::LegCFICode);
      FIELD_SET(*this, FIX::LegSecurityType);
      FIELD_SET(*this, FIX::LegSecuritySubType);
      FIELD_SET(*this, FIX::LegMaturityMonthYear);
      FIELD_SET(*this, FIX::LegMaturityDate);
      FIELD_SET(*this, FIX::LegCouponPaymentDate);
      FIELD_SET(*this, FIX::LegIssueDate);
      FIELD_SET(*this, FIX::LegRepoCollateralSecurityType);
      FIELD_SET(*this, FIX::LegRepurchaseTerm);
      FIELD_SET(*this, FIX::LegRepurchaseRate);
      FIELD_SET(*this, FIX::LegFactor);
      FIELD_SET(*this, FIX::LegCreditRating);
      FIELD_SET(*this, FIX::LegInstrRegistry);
      FIELD_SET(*this, FIX::LegCountryOfIssue);
      FIELD_SET(*this, FIX::LegStateOrProvinceOfIssue);
      FIELD_SET(*this, FIX::LegLocaleOfIssue);
      FIELD_SET(*this, FIX::LegRedemptionDate);
      FIELD_SET(*this, FIX::LegStrikePrice);
      FIELD_SET(*this, FIX::LegStrikeCurrency);
      FIELD_SET(*this, FIX::LegOptAttribute);
      FIELD_SET(*this, FIX::LegContractMultiplier);
      FIELD_SET(*this, FIX::LegUnitOfMeasure);
      FIELD_SET(*this, FIX::LegTimeUnit);
      FIELD_SET(*this, FIX::LegCouponRate);
      FIELD_SET(*this, FIX::LegSecurityExchange);
      FIELD_SET(*this, FIX::LegIssuer);
      FIELD_SET(*this, FIX::EncodedLegIssuerLen);
      FIELD_SET(*this, FIX::EncodedLegIssuer);
      FIELD_SET(*this, FIX::LegSecurityDesc);
      FIELD_SET(*this, FIX::EncodedLegSecurityDescLen);
      FIELD_SET(*this, FIX::EncodedLegSecurityDesc);
      FIELD_SET(*this, FIX::LegRatioQty);
      FIELD_SET(*this, FIX::LegSide);
      FIELD_SET(*this, FIX::LegCurrency);
      FIELD_SET(*this, FIX::LegPool);
      FIELD_SET(*this, FIX::LegDatedDate);
      FIELD_SET(*this, FIX::LegContractSettlMonth);
      FIELD_SET(*this, FIX::LegInterestAccrualDate);
      FIELD_SET(*this, FIX::LegOptionRatio);
    };
    FIELD_SET(*this, FIX::NoUnderlyings);
    class NoUnderlyings: public FIX::Group
    {
    public:
    NoUnderlyings() : FIX::Group(711,311,FIX::message_order(311,312,309,305,462,463,310,763,313,542,315,241,242,243,244,245,246,256,595,592,593,594,247,316,941,317,436,998,1000,435,308,306,362,363,307,364,365,877,878,972,318,879,975,973,974,810,882,883,884,885,886,1044,1045,1046,1038,1039,0)) {}
      FIELD_SET(*this, FIX::UnderlyingSymbol);
      FIELD_SET(*this, FIX::UnderlyingSymbolSfx);
      FIELD_SET(*this, FIX::UnderlyingSecurityID);
      FIELD_SET(*this, FIX::UnderlyingSecurityIDSource);
      FIELD_SET(*this, FIX::UnderlyingProduct);
      FIELD_SET(*this, FIX::UnderlyingCFICode);
      FIELD_SET(*this, FIX::UnderlyingSecurityType);
      FIELD_SET(*this, FIX::UnderlyingSecuritySubType);
      FIELD_SET(*this, FIX::UnderlyingMaturityMonthYear);
      FIELD_SET(*this, FIX::UnderlyingMaturityDate);
      FIELD_SET(*this, FIX::UnderlyingPutOrCall);
      FIELD_SET(*this, FIX::UnderlyingCouponPaymentDate);
      FIELD_SET(*this, FIX::UnderlyingIssueDate);
      FIELD_SET(*this, FIX::UnderlyingRepoCollateralSecurityType);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseTerm);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseRate);
      FIELD_SET(*this, FIX::UnderlyingFactor);
      FIELD_SET(*this, FIX::UnderlyingCreditRating);
      FIELD_SET(*this, FIX::UnderlyingInstrRegistry);
      FIELD_SET(*this, FIX::UnderlyingCountryOfIssue);
      FIELD_SET(*this, FIX::UnderlyingStateOrProvinceOfIssue);
      FIELD_SET(*this, FIX::UnderlyingLocaleOfIssue);
      FIELD_SET(*this, FIX::UnderlyingRedemptionDate);
      FIELD_SET(*this, FIX::UnderlyingStrikePrice);
      FIELD_SET(*this, FIX::UnderlyingStrikeCurrency);
      FIELD_SET(*this, FIX::UnderlyingOptAttribute);
      FIELD_SET(*this, FIX::UnderlyingContractMultiplier);
      FIELD_SET(*this, FIX::UnderlyingUnitOfMeasure);
      FIELD_SET(*this, FIX::UnderlyingTimeUnit);
      FIELD_SET(*this, FIX::UnderlyingCouponRate);
      FIELD_SET(*this, FIX::UnderlyingSecurityExchange);
      FIELD_SET(*this, FIX::UnderlyingIssuer);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuerLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuer);
      FIELD_SET(*this, FIX::UnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDescLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::UnderlyingCPProgram);
      FIELD_SET(*this, FIX::UnderlyingCPRegType);
      FIELD_SET(*this, FIX::UnderlyingAllocationPercent);
      FIELD_SET(*this, FIX::UnderlyingCurrency);
      FIELD_SET(*this, FIX::UnderlyingQty);
      FIELD_SET(*this, FIX::UnderlyingSettlementType);
      FIELD_SET(*this, FIX::UnderlyingCashAmount);
      FIELD_SET(*this, FIX::UnderlyingCashType);
      FIELD_SET(*this, FIX::UnderlyingPx);
      FIELD_SET(*this, FIX::UnderlyingDirtyPrice);
      FIELD_SET(*this, FIX::UnderlyingEndPrice);
      FIELD_SET(*this, FIX::UnderlyingStartValue);
      FIELD_SET(*this, FIX::UnderlyingCurrentValue);
      FIELD_SET(*this, FIX::UnderlyingEndValue);
      FIELD_SET(*this, FIX::UnderlyingAdjustedQuantity);
      FIELD_SET(*this, FIX::UnderlyingFXRate);
      FIELD_SET(*this, FIX::UnderlyingFXRateCalc);
      FIELD_SET(*this, FIX::UnderlyingCapValue);
      FIELD_SET(*this, FIX::UnderlyingSettlMethod);
    };
    FIELD_SET(*this, FIX::NoTradingSessions);
    class NoTradingSessions: public FIX::Group
    {
    public:
    NoTradingSessions() : FIX::Group(386,336,FIX::message_order(336,625,0)) {}
      FIELD_SET(*this, FIX::TradingSessionID);
      FIELD_SET(*this, FIX::TradingSessionSubID);
    };
    FIELD_SET(*this, FIX::TransactTime);
    FIELD_SET(*this, FIX::NoPositions);
    class NoPositions: public FIX::Group
    {
    public:
    NoPositions() : FIX::Group(702,703,FIX::message_order(703,704,705,706,976,539,0)) {}
      FIELD_SET(*this, FIX::PosType);
      FIELD_SET(*this, FIX::LongQty);
      FIELD_SET(*this, FIX::ShortQty);
      FIELD_SET(*this, FIX::PosQtyStatus);
      FIELD_SET(*this, FIX::QuantityDate);
      FIELD_SET(*this, FIX::NoNestedPartyIDs);
      class NoNestedPartyIDs: public FIX::Group
      {
      public:
      NoNestedPartyIDs() : FIX::Group(539,524,FIX::message_order(524,525,538,804,0)) {}
        FIELD_SET(*this, FIX::NestedPartyID);
        FIELD_SET(*this, FIX::NestedPartyIDSource);
        FIELD_SET(*this, FIX::NestedPartyRole);
        FIELD_SET(*this, FIX::NoNestedPartySubIDs);
        class NoNestedPartySubIDs: public FIX::Group
        {
        public:
        NoNestedPartySubIDs() : FIX::Group(804,545,FIX::message_order(545,805,0)) {}
          FIELD_SET(*this, FIX::NestedPartySubID);
          FIELD_SET(*this, FIX::NestedPartySubIDType);
        };
      };
    };
    FIELD_SET(*this, FIX::NoPosAmt);
    class NoPosAmt: public FIX::Group
    {
    public:
    NoPosAmt() : FIX::Group(753,707,FIX::message_order(707,708,1055,0)) {}
      FIELD_SET(*this, FIX::PosAmtType);
      FIELD_SET(*this, FIX::PosAmt);
      FIELD_SET(*this, FIX::PositionCurrency);
    };
    FIELD_SET(*this, FIX::AdjustmentType);
    FIELD_SET(*this, FIX::ContraryInstructionIndicator);
    FIELD_SET(*this, FIX::PriorSpreadIndicator);
    FIELD_SET(*this, FIX::ThresholdAmount);
    FIELD_SET(*this, FIX::Text);
    FIELD_SET(*this, FIX::EncodedTextLen);
    FIELD_SET(*this, FIX::EncodedText);
    FIELD_SET(*this, FIX::SettlCurrency);
  };

}

#endif


text:
{% extends "base.html" %}

{% block content %}

  {% from "macros.html" import render_field %}
  <form method="POST" action="." class="form bs-example form-horizontal">
    {{ form.csrf_token }}
    <input type="hidden" name="next" value="{{ next }}" />
    {{ render_field(form.username, class="form-control", placeholder="username", autofocus="") }}

    {{ render_field(form.email, class="form-control", placeholder="email") }}

    {{ render_field(form.password, class="form-control", placeholder="password") }}

    {{ render_field(form.confirm, class="form-control", placeholder="confirm password") }}

    Check to agree to terms of services
        {{ render_field(form.accept_tos, class="form-control") }}
    ReCaptcha
    {% for error in form.recaptcha.errors %}
        {{ error }}
    {% endfor %}
    {{ form.recaptcha }}

    <button type="submit" value="Register" class="btn btn-primary">Register</button>
  </form>

{% endblock %}

redpajama_set_name: RedPajamaGithub


text:
import browser from 'webextension-polyfill';

export async function sendMessage (request: ButtonRequest) {
  if (process.env.DEBUG) {
    console.info('Extension:sendMessage', request);
  }
  const response = await browser.runtime
    .sendMessage(request)
    .catch(error => {
      if (process.env.DEBUG) {
        console.error('Extension:sendMessageResponse', request, error);
      }
    });

  if (!response) {
    return null;
  }
  if (process.env.DEBUG) {
    console.info('Extension:sendMessageResponse', request, response);
  }
  return response as ButtonResponse;
}


text:
import { I18nName } from '../common/i18n-name';

export interface Levequest {
  id: number;
  level: number;
  jobId: number;
  itemId: number;
  itemIcon: string;
  exp: number;
  gil: number;
  hq: boolean;
  // Amount of levequest completions
  amount: number;
  // Quantity of item required for completion
  itemQuantity: number;
  name: I18nName;
  repeats: number;
  deliveryPlaceId: number;
  startPlaceId: number;
  // Levequest is selected from search results
  selected?: boolean;
  // Option to complete all deliveries (3x turn-in) is selected from search results
  allDeliveries?: boolean;
  allowanceCost: number;
}


text:
/*
 * Created by SharpDevelop.
 * User: wij
 * Date: 3/05/2015
 * Time: 7:58
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;

namespace EAAddinManager
{
	/// <summary>
	/// Description of AddinConfig.
	/// </summary>
	public class AddinConfig
	{
		public string name {
			get
			{
				return new DirectoryInfo(this.directory).Name;
			}
		}
		private string _directory;
		public string directory
		{get
			{
				return _directory;
			}
			set
			{
				_directory = value;
				this.resolveDllPath();
			}
		}
        public string version {get;set;}
        public bool load {get;set;}
        public string dllPath {get;set;}
		public AddinConfig(ConnectionStringSettings  connectionString )
		{
			this.directory = connectionString.Name;
			string[] conStrSplitted = connectionString.ConnectionString.Split(';');
			this.dllPath = conStrSplitted[0];
			this.load = bool.Parse(conStrSplitted[1]);
			this.version = conStrSplitted[2];
		}
		public AddinConfig(string filePath)
		{
			this.directory = Path.GetDirectoryName(filePath);
			this.dllPath = Path.GetFileName(filePath);
			this.version = FileVersionInfo.GetVersionInfo(filePath).FileVersion;
			this.load = true;
		}
		internal ConnectionStringSettings getConnectionString()
		{
			ConnectionStringSettings connectionString = new ConnectionStringSettings();
			connectionString.ConnectionString = string.Join(";", new string[]{this.dllPath, this.load.ToString(), this.version});
			connectionString.Name = this.directory;
			connectionString.ProviderName = "EA Addin Manager";
			return connectionString;
		}
		private void resolveDllPath()
		{
			if (!string.IsNullOrEmpty(this.dllPath))
			{
				//if the file doesn't exist then find recursively in the current directory
				if (!File.Exists(this.directory + "\\" +this.dllPath))
				{
					string dllFullPath = this.findFile(this.directory,Path.GetFileName(this.dllPath));
					//get the subpath for the dllpath
					dllPath = dllFullPath.Replace(this.directory, string.Empty);
				}
			}
		}
		private string findFile(string directory, string filename)
		{
			//first check files in this directory
			foreach (string file in Directory.GetFiles(directory, filename))
			{
				return file;
			}
			//not found so we search subdirectories
			foreach (string  subdirectory in Directory.GetDirectories(directory))
			{
				string file = findFile(subdirectory, filename);
				if (file != string.Empty)
				{
					return file;
				}
			}
			//still not found, return empty string
			return string.Empty;
		}
	}

}


text:
#include <stdio.h>
#include <GL/glfw.h>

void initGlScene();
void renderGlScene(double delta);
void doRenderingLoop();

double lastSceneRendered, currentSceneRendered;

void renderFrame() {
    currentSceneRendered = glfwGetTime();
    renderGlScene(currentSceneRendered - lastSceneRendered);
    lastSceneRendered = currentSceneRendered;
    glfwSwapBuffers();
}

int main(void)
{
    /* Initialize the library */
    if (!glfwInit()) {
        printf("Could not initialize library\n");
        return -1;
    }

    /* Create a windowed mode window and its OpenGL context */
    if(glfwOpenWindow(640, 480, 0,0,0,0,16,0, GLFW_WINDOW) != GL_TRUE)
    {
        printf("Could not create OpenGL window\n");
        glfwTerminate();
        return -1;
    }

    initGlScene();
    lastSceneRendered = glfwGetTime();

    doRenderingLoop(&renderFrame);

    glfwTerminate();
    return 0;
}


text:
package logbook.config;

import java.util.Date;
import java.util.Set;

import javax.annotation.CheckForNull;

import logbook.config.bean.QuestBean;
import logbook.config.bean.QuestMapBean;
import logbook.constants.AppConstants;
import logbook.util.BeanUtils;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 任務の進行状況を保存・復元します
 *
 */
public class QuestConfig {

    /** ロガー */
    private static final Logger LOG = LogManager.getLogger(QuestConfig.class);

    /** 任務のBean */
    private static QuestMapBean mapBean;

    /** 最後の更新 */
    private static long last;

    /**
     * 任務の進行状況を保存します
     */
    public static void store() {
        load();
        if (mapBean != null) {
            try {
                BeanUtils.writeObject(AppConstants.QUEST_CONFIG_FILE, mapBean);
                last = AppConstants.QUEST_CONFIG_FILE.toFile().lastModified();
            } catch (Exception e) {
                LOG.warn("任務の進行状況を保存しますに失敗しました", e);
            }
        }
    }

    /**
     * 任務の進行状況を保存します
     *
     * @param no 任務No
     * @param quest 任務
     */
    public static void put(int no, QuestBean quest) {
        load();
        if (mapBean == null) {
            mapBean = new QuestMapBean();
            last = -1;
        }

        mapBean.getQuestMap().put(no, quest);

        store();
    }

    /**
     * 任務の進行状況を復元します
     */
    public static void load() {
        try {
            if (mapBean == null) {
                mapBean = BeanUtils.readObject(AppConstants.QUEST_CONFIG_FILE, QuestMapBean.class);
                last = AppConstants.QUEST_CONFIG_FILE.toFile().lastModified();
            } else if (last != AppConstants.QUEST_CONFIG_FILE.toFile().lastModified()) {
                mapBean.marge(BeanUtils.readObject(AppConstants.QUEST_CONFIG_FILE, QuestMapBean.class));
                last = AppConstants.QUEST_CONFIG_FILE.toFile().lastModified();
            }
        } catch (Exception e) {
            LOG.warn("任務の進行状況を復元しますに失敗しました", e);
        }
    }

    /**
     * 任務の進行状況を取得します
     *
     * @param no 任務No
     * @return 任務の進行状況
     */
    @CheckForNull
    public static QuestBean get(int no) {
        load();
        if (mapBean != null) {
            QuestBean qb = mapBean.getQuestMap().get(no);
            if ((qb != null) && (qb.getDue() != null) && qb.getDue().before(new Date()))
            {
                qb = new QuestBean();
                put(no, qb);
            }
            return qb;
        }
        return null;
    }

    /**
     * 任務の進行状況を削除します
     *
     * @param no 任務No
     */
    public static void remove(int no) {
        load();
        if (mapBean != null) {
            mapBean.getQuestMap().remove(no);
            store();
        }
    }

    /**
     * 任務Noを一覧します
     *
     * @return 任務No一覧
     */
    public static Set<Integer> getNoList() {
        load();
        if (mapBean != null) {
            return mapBean.getQuestMap().keySet();
        }
        return null;
    }
}


text:
module.exports = function isFunction (x) {
    return x.type === 'FunctionDeclaration'
        || x.type === 'FunctionExpression'
    ;
};


text:
{-
Copyright 2013 Google Inc. All Rights Reserved.

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.
-}

module Plush.Run.Script (
    parse,
    parseInput,

    runCommand,
    runScript,
    runFile,
)
where

import Control.Applicative ((<$>))
import Control.Monad (when)
import Control.Monad.Exception (catchIOError)

import Plush.Parser
import Plush.Pretty
import {-# SOURCE #-} Plush.Run.Execute         -- see Execute.hs-boot
import Plush.Run.Posix
import Plush.Run.Posix.Return
import Plush.Run.Posix.Utilities
import Plush.Run.ShellExec
import Plush.Run.Types
import qualified Plush.Run.ShellFlags as F

-- | Parse a command, in the state of the shell. Extracts the aliases from
-- the shell state to give to the parser. This action should have no side
-- effects, and the transformed shell state from this action can be safely
-- ignored.
parse :: (PosixLike m) => String -> ShellExec m ParseCommandResult
parse s = getAliases >>= return . flip parseCommand s

-- | Like 'parse', but the string is considered "shell input", and so is
-- subject the @verbose (@-v@) and @parseout@ (@-P@) shell flags. Therefore,
-- this operation can have output other potential side effects.
parseInput :: (PosixLike m) => String -> ShellExec m ParseCommandResult
parseInput s = do
    flags <- getFlags
    when (F.verbose flags) $ errStrLn s
    pcr <- parse s
    when (F.parseout flags) $ case pcr of
        Right (cl, _) -> errStrLn $ pp cl
        _ -> return ()
    return pcr

-- | Run a single command, parsed out of a string.
runCommand :: (PosixLike m) => String -> ShellExec m (ShellStatus, Maybe String)
runCommand cmds = do
    pcr <- parseInput cmds
    case pcr of
        Left errs -> shellError 125 errs >>= return . (\st -> (st, Nothing))
        Right (cl, rest) -> execute cl >>= return . (\st -> (st, Just rest))

-- | Run all the commands, parsed from a string
runScript :: (PosixLike m) => String -> ShellExec m ShellStatus
runScript cmds0 = rc (StStatus ExitSuccess, Just cmds0)
  where
    rc (StStatus _, Just cmds) | not (null cmds) = runCommand cmds >>= rc
    rc (st, _) = return st

-- | Run all commands from a file.
runFile :: (PosixLike m) => FilePath -> ShellExec m ShellStatus
runFile fp = do
    mscript <- (Just <$> readAllFile fp) `catchIOError` (\_ -> return Nothing)
    case mscript of
        Nothing -> shellError 127 $ "file couldn't be read: " ++ fp
        Just script -> runScript script


text:
require "test_helper"

feature "WPInstanllationFlow Feature Test" do
  before do
    sign_in_user
  end

  scenario "add a new installation" do
    create_new_wp_installation
    page.must_have_content "Registered new Wordpress installation."
  end

  scenario "view an installation" do
    create_new_wp_installation
    visit wp_installations_path
    @wp_installation = WPInstallation.last
    page.must_have_content @wp_installation.name
    page.must_have_content @wp_installation.url
  end

  scenario "edit installation" do
    create_new_wp_installation
    change_wordpress_installation_name_to WPInstallation.last, 'changed_name'
    page.must_have_content "Updated Wordpress installation."
    page.must_have_content "changed_name"
  end

  scenario "delete installation" do
    create_new_wp_installation
    delete_wordpress_installation(WPInstallation.last)
    page.must_have_content "Unregistered Wordpress installation."
    page.wont_have_content "Test"
  end
end

def change_wordpress_installation_name_to(wp_installation, name)
  visit edit_wp_installation_path(wp_installation)
  within "#edit_wp_installation_#{wp_installation.id}" do
    fill_in :wp_installation_name, with: name
    click_on 'Update'
  end
end

def delete_wordpress_installation(wp_installation)
  visit wp_installations_path
  within "#wp_installation_#{wp_installation.id}" do
    click_on "Remove"
  end
end


text:
=head1 LICENSE

Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2022] EMBL-European Bioinformatics Institute

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.

=cut

package EnsEMBL::Web::Component::Variation::PopulationGraphs;

use strict;

use base qw(EnsEMBL::Web::Component::Variation);

sub _init {
  my $self = shift;
  $self->cacheable(0);
  $self->ajaxable(1);
}

sub content {
  my $self      = shift;
  my $hub       = $self->hub;
  my $pop_freq  = $self->object->format_group_population_freqs();

  return unless defined $pop_freq;

  my $graph_id    = 0;
  my $height      = 50;
  my $width       = 118;
  my $max_width   = 150;
  my $max_pie_chart_count = 35;
  my (@graphs, $pop_tree, %sub_pops, @alleles);

  my $vf         = $hub->param('vf');
  my $vf_object  = $vf ? $hub->database('variation')->get_VariationFeatureAdaptor->fetch_by_dbID($vf) : undef;
  my $ref_allele = $vf_object ? $vf_object->ref_allele_string : '';

  my @inputs = (
    q{<input class="graph_config" type="hidden" name="legendpos" value="'east'" />},
    q{<input class="graph_config" type="hidden" name="legendmark" value="'arrow'" />},
    q{<input class="graph_dimensions" type="hidden" value="[25,25,20]" />},
  );

  # Get alleles list
  my $project_name;
  my $pop_width = $width;
  my $has_100 = 0;
  foreach my $pop_name (sort keys %$pop_freq) {
    my $values = '';

    $pop_tree = $self->update_pop_tree($pop_tree, $pop_name, $pop_freq->{$pop_name}{'sub_pop'}) if defined $pop_freq->{$pop_name}{'sub_pop'};

    $project_name = $pop_freq->{$pop_name}{'group'} if (!$project_name);

    foreach my $ssid (keys %{$pop_freq->{$pop_name}{'freq'}}) {
      foreach my $allele (keys %{$pop_freq->{$pop_name}{'freq'}{$ssid}}) {
        my $freq = $pop_freq->{$pop_name}{'freq'}{$ssid}{$allele};
        my $allele_length = length($allele);
        my $new_width = ($allele_length > 1) ? $width + (($allele_length - 1) * 5) : $width;
        $pop_width = $new_width if ($new_width > $pop_width);
        $has_100 = 1 if ($freq == 1);
        push (@alleles, $allele) if $freq > 0 && !(grep $allele eq $_, @alleles);
      }
    }
  }
  $width = ($pop_width > $max_width) ? $max_width : $pop_width;
  $width += 5 if ($has_100 == 1);

  my $nb_alleles = scalar @alleles;

  if ($nb_alleles > 2) {
    while ($nb_alleles != 2) {
      $height += 5;
      $nb_alleles--;
    }
  }

  # Create graphs
  my $population_count = scalar keys %$pop_freq;
  my $too_many_populations = ($population_count > $max_pie_chart_count);
  foreach my $pop_name (sort { ($a !~ /ALL/ cmp $b !~ /ALL/) || $a cmp $b } keys %$pop_freq) {
    if ($too_many_populations) {
      next if ($pop_name !~ /ALL/);
    }
    my $values     = '';
    my $short_name = $self->get_short_name($pop_name);
    my $pop_desc   = $pop_freq->{$pop_name}{'desc'};
    if (!$pop_desc || $pop_desc eq '') {
      $pop_desc = $short_name;
      $pop_desc =~ s/_/ /g;
    }
    $pop_desc = $self->strip_HTML($pop_desc);

    # Constructs the array for the pie charts: [allele,frequency]
    foreach my $al (sort { ($a !~ /$ref_allele/ cmp $b !~ /$ref_allele/) || $a cmp $b } @alleles) {
      foreach my $ssid (keys %{$pop_freq->{$pop_name}{'freq'}}) {
        my $freq = $pop_freq->{$pop_name}{'freq'}{$ssid}{$al};
        next unless $freq;

        $values .= ',' if $values ne '';
        $freq    = $self->format_number($freq);
        $freq    = 0.5 if $freq < 0.5; # Fixed bug if freq between 0 and 0.5
        my $a_label = $al;
        if (length($al)>4) {
          $a_label = substr($al,0,4).'...';
        }
        $values .= "[$freq,'$a_label']";
        last;
      }
    }

    push @inputs, qq{<input type="hidden" class="graph_data" value="[$values]" />};

    # Main "ALL" population OR no population structure
    if ($short_name =~ /ALL/ || scalar(keys(%$pop_tree)) == 0) {
      push @graphs, sprintf('

              %s

      ', $short_name eq 'ALL' ? ' all_population' : '', $pop_desc, $short_name, $graph_id, $width, $height);
    }
    # Super-population
    elsif ($pop_tree->{$short_name}) {
      push @graphs, sprintf('

              %s

          Sub-populations

      ', $pop_desc, $short_name, $graph_id, $width, $height,
         $hub->get_cookie_value("toggle_population_freq_$short_name") eq 'open' ? 'open' : 'closed',
         $short_name, $short_name);
    }
    # Sub-populations
    else {
      foreach (grep $pop_tree->{$_}{$short_name}, keys %$pop_tree) {
        push @{$sub_pops{$_}}, sprintf('

                %s

        ', $pop_desc, $short_name, $graph_id, $width, $height);
      }
    }

    $graph_id++;
  }

  my $html = sprintf(
    '
%s allele frequencies

<input type="hidden" class="panel_type" value="PopulationGraph" />%s

%s
',
    $project_name,
    join('', @inputs),
    join('', @graphs)
  );

  foreach my $sp (sort keys %sub_pops) {
    my $sub_html = join '', @{$sub_pops{$sp}};
    my $show     = $hub->get_cookie_value("toggle_population_freq_$sp") eq 'open';

    $html .= sprintf('

%s sub-populations

          %s

    ', $sp, $sp, $show ? '' : 'style="display:none"', $sp, $sub_html);
  }

  return $html;
}

sub format_number {
  ### Population_genotype_alleles
  ### Arg1 : null or a number
  ### Returns "unknown" if null or formats the number to 3 decimal places

  my ($self, $number) = @_;
  return 'unknown' if (!defined($number) || $number eq 'unknown');

  $number = $number * 100;
  return sprintf '%.2f', $number;
}

sub update_pop_tree {
  my ($self, $p_tree, $p_name, $sub_list) = @_;
  my $p_short_name = $self->get_short_name($p_name);

  foreach my $sub_pop (keys %$sub_list) {
    my $sub_name       = $sub_list->{$sub_pop}{'Name'};
    my $sub_short_name = $self->get_short_name($sub_name);

    $p_tree->{$p_short_name}{$sub_short_name} = 1;
  }

  return $p_tree;
}

sub get_short_name {
  my $self   = shift;
  my $p_name = shift;
  my @composed_name = split(':', $p_name);
  my $short_name = $composed_name[$#composed_name];

  if ($short_name =~ /phase_\d+_(.+)$/) {
    $short_name = $1;
  }

  return $short_name;
}

1;


text:
package io.sarl.docs.doclet.utils;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

import com.sun.tools.doclets.internal.toolkit.util.MessageRetriever;

import io.sarl.docs.doclet.SarlConfiguration;

/** Message retreiver for SARL.
 *
 * @author $Author: sgalland$
 * @version $FullVersion$
 * @mavengroupid $GroupId$
 * @mavenartifactid $ArtifactId$
 * @since 0.7
 */
public class SarlMessageRetreiver extends MessageRetriever {

	/** Name of the bundle's property for the label of an agent type.
	 */
	public static final String DOCLET_AGENT = "doclet.Agent"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of a behavior type.
	 */
	public static final String DOCLET_BEHAVIOR = "doclet.Behavior"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of a event type.
	 */
	public static final String DOCLET_EVENT = "doclet.Event"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of a capacity type.
	 */
	public static final String DOCLET_CAPACITY = "doclet.Capacity"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of a skill type.
	 */
	public static final String DOCLET_SKILL = "doclet.Skill"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of a space type.
	 */
	public static final String DOCLET_SPACE = "doclet.Space"; //$NON-NLS-1$

	/** Name of the bundle's property for the label of an artifact type.
	 */
	public static final String DOCLET_ARTIFACT = "doclet.Artifact"; //$NON-NLS-1$

	private static final String STANDARD_RESOURCE = "com.sun.tools.doclets.formats.html.resources.standard"; //$NON-NLS-1$

	private static final String SARL_RESOURCE = SarlMessageRetreiver.class.getPackage()
			.getName().replaceAll("\\.", "/") + "/messages"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

	private ResourceBundle messages;

	/** Constructor.
	 *
	 * @param configuration the configuration.
	 */
	public SarlMessageRetreiver(SarlConfiguration configuration) {
		super(configuration, STANDARD_RESOURCE);
	}

	@Override
    public String getText(String key, Object... args) throws MissingResourceException {
    	if (this.messages == null) {
            try {
                this.messages = ResourceBundle.getBundle(SARL_RESOURCE);
            } catch (MissingResourceException e) {
                throw new Error("Fatal: Resource (" + SARL_RESOURCE + ") for javadoc doclets is missing."); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
    	if (this.messages.containsKey(key)) {
            final String message = this.messages.getString(key);
            return MessageFormat.format(message, args);
    	}
    	return super.getText(key, args);
    }

}


text:
Installation
############

Requirements
============

This packages has the following strict requirements:

- `Python <http://www.python.org/>`_ 2.7, 3.3, 3.4

- `Numpy <http://www.numpy.org/>`_ 1.8 or later

- `Cython <http://www.cython.org/>`_: 0.21 or later

You can use pip to install these automatically using the
`pip-requirements.txt <https://github.com/adrn/SuperFreq/blob/master/pip-requirements-txt>`_
file (from the root of the project):

   pip install -r pip-requirements.txt

Installing
==========

Development repository
----------------------

The latest development version of superfreq can be cloned from
`GitHub <https://github.com/>`_ using git::

   git clone git://github.com/adrn/superfreq.git

Building and Installing
-----------------------

To build the project (from the root of the source tree, e.g., inside
the cloned ``superfreq`` directory)::

   python setup.py build

To install the project::

   python setup.py install


text:
declare module 'fabric8-planner';
export * from './lib/shared/http-service.service';
export * from './lib/work-item/work-item.module'
export * from './lib/shared/mock-data.service';
export * from './lib/auth/authentication.service';
export * from './lib/user/user.service';
export * from './lib/footer/footer.component';
export * from './lib/header/header.component';
export * from './lib/login/login.component';
export * from './lib/login/login.service';
export * from './lib/work-item/work-item-search/work-item-search.component';
export * from './lib/work-item/work-item.service';
export * from './lib/code/code.module';
export * from './lib/home/home.module';
export * from './lib/hypothesis/hypothesis.module';
export * from './lib/notifications/notifications.module';
export * from './lib/pipeline/pipeline.module';
export * from './lib/settings/settings.module';
export * from './lib/test/test.module';
export * from './lib/obsidian/obsidian.module';
export * from './lib/dashboard/dashboard.module';
export * from './lib/learn/learn.module';


text:
'use strict';
var
expect = require("expect.js"),
Promise = require("../promise"),
Interval = require("../interval");

describe("Interval", function () {
  it("wraps the native setInterval and clearInterval methods", function (done) {
    var
    inter = new Interval(
      function (n) {
        expect(this).to.be(inter);
        expect(val).to.be(42);

        if (n === 3) {
          inter.suspend();
          done();
        }
      },
      10
    ),
    val;

    inter.activate(true);

    val = 42;
  });
  it("can also use a promise using the notification method", function (done) {
    Interval.start(10, true)
      .notified(function (count) {
        if (count === 3) {
          throw "finish";
        }
      })
      .failed(function (err) {
        expect(err).to.be("finish");
        done();
      });
  });
});


text:
package org.ovirt.mobile.movirt.rest.dto.v4;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.ovirt.mobile.movirt.rest.RestEntityWrapperList;

import java.util.List;

public class DataCenters extends RestEntityWrapperList<DataCenter> {
    @JsonCreator
    public DataCenters(@JsonProperty("data_center") List<DataCenter> list) {
        super(list);
    }
}


text:
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';

const classesDic = {
  status: {
    success: '-success',
    failed: '-failed',
    saved: '-saved',
    deleted: '-deleted',
    pending: '-pending',
  },
};

class StatusTD extends PureComponent {
  static propTypes = { value: PropTypes.string.isRequired }

  render() {
    const { value } = this.props;
    const tdClass = classnames(
      'status',
      { [classesDic.status[value]]: !!classesDic.status[value] },
    );

    return (
      <td className={tdClass}>
        {value}
      </td>
    );
  }
}

export default StatusTD;


text:
<!doctype html>

	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>Constructor | @storefront/core</title>
	<meta name="description" content="">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="../assets/css/main.css">

						Search
						<input id="tsd-search-field" type="text" />

Preparing search index...

The search index is not available

					@storefront/core

						Options

								All

Public

Public/Protected

All

							<input type="checkbox" id="tsd-filter-inherited" checked />
							Inherited
							<input type="checkbox" id="tsd-filter-externals" checked />
							Externals
							<input type="checkbox" id="tsd-filter-only-exported" />
							Only exported

					Menu

					Globals

					Service

					Constructor

Module Constructor

Index

Type aliases

Map

Constructors

constructor

Type aliases

Map

Map: object

Defined in core/service/index.ts:26

Type declaration

[key: string]: Constructor

Constructors

constructor

new <wbr>Constructor(app: StoreFront, config: any): Service

Defined in core/service/index.ts:29

Parameters

app: StoreFront

config: any

Returns Service

						Globals

						Internals

						Configuration

						Product<wbr>Transformer

						Selectors

						Structure

						Url<wbr>Utils

						Utils

						Externals

						Beautifier<wbr>Factory

						Globals

						Phase

						Props

						Provide<wbr>Consume

						Pure

						Service

								Constructor

						Tag<wbr>Utils

						Map

						constructor

Legend

Module

Object literal

Variable

Function

Function with type parameter

Index signature

Type alias

Enumeration

Enumeration member

Property

Method

Interface

Interface with type parameter

Constructor

Property

Method

Index signature

Class

Class with type parameter

Constructor

Property

Method

Accessor

Index signature

Inherited constructor

Inherited property

Inherited method

Inherited accessor

Protected property

Protected method

Protected accessor

Private property

Private method

Private accessor

Static property

Static method

Generated using TypeDoc


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Acta bot. fenn. 150: 219 (1994)

#### Original name
Peltigera soredians Vitik.

### Remarks
null


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>com.communote.plugins.api.rest.v30.resource.user.observation (Communote 3.5 API)</title>
<meta name="date" content="2019-02-02">
<link rel="stylesheet" type="text/css" href="../../../../../../../../../stylesheet.css" title="Style">

com.communote.plugins.api.rest.v30.resource.user.observation

Classes

GetCollectionObservationParameter

GetObservationParameter

ObservationResource

ObservationResourceHandler


text:
from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ('core', '0020_auto_20210121_0943'),
    ]

    operations = [
        # 20_path
        migrations.RunSQL('DROP INDEX IF EXISTS evenements_geom_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS e_t_evenement_geom_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_topology_geom_idx;'),

        # 40_path
        migrations.RunSQL('DROP INDEX IF EXISTS troncons_geom_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS l_t_troncon_geom_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_path_geom_idx;'),

        migrations.RunSQL('DROP INDEX IF EXISTS troncons_geom_cadastre_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS l_t_troncon_geom_cadastre_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS troncons_geom_cadastre_idx;'),

        migrations.RunSQL('DROP INDEX IF EXISTS l_t_troncon_geom_3d_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_path_geom_3d_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_path_geom_cadastre_idx;'),

        migrations.RunSQL('DROP INDEX IF EXISTS troncons_start_point_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS l_t_troncon_start_point_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_path_start_point_idx;'),

        migrations.RunSQL('DROP INDEX IF EXISTS troncons_end_point_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS l_t_troncon_end_point_idx;'),
        migrations.RunSQL('DROP INDEX IF EXISTS core_path_end_point_idx;'),
    ]


text:
@class BaseRequest, MMBizJsApiMedia, NSString;

@interface MMBizJsApiUploadMediaReq : WXPBGeneratedMessage
{
}

+ (void)initialize;

// Remaining properties
@property(retain, nonatomic) NSString *appid; // @dynamic appid;
@property(retain, nonatomic) BaseRequest *baseRequest; // @dynamic baseRequest;
@property(retain, nonatomic) MMBizJsApiMedia *media; // @dynamic media;
@property(retain, nonatomic) NSString *mediaId; // @dynamic mediaId;

@end


text:
import {
    EntityService,
    BelongsToManyRelationDefinition,
    RelationDefinition,
    RelationType,
    WithRelations
} from '../interfaces';

/**
 * Mixin to be applied to an Entity Service to support associations
 * @param {WeakMap<EntityService, RelationDefinition>} serviceToRelation
 * @param {Map<string, EntityService>} aliasToService
 * @returns {WithRelations<EntityService>}
 */
export const withRelation = (
    serviceToRelation: WeakMap<EntityService, RelationDefinition>,
    aliasToService: Map<string, EntityService>
): WithRelations<EntityService> => {
    return {
        hasOne(service: EntityService, alias) {
            const label = alias || service.definition.name.toLowerCase();
            const relation = {
                type: RelationType.HAS_ONE,
                alias: label
            };
            serviceToRelation.set(service, relation);
            aliasToService.set(alias, service);
            return this;
        },
        hasMany(service: EntityService, alias) {
            const label = alias || service.definition.name.toLowerCase();
            const relation = {
                type: RelationType.HAS_MANY,
                alias: label
            };
            serviceToRelation.set(service, relation);
            aliasToService.set(alias, service);
            return this;
        },
        belongsTo(service: EntityService, foreignKey, alias) {
            const label = alias || service.definition.name.toLowerCase();
            const relation = {
                type: RelationType.BELONGS_TO,
                alias: label,
                foreignKey
            };
            serviceToRelation.set(service, relation);
            aliasToService.set(alias, service);
            return this;
        },
        belongsToMany(service: EntityService, pivot: EntityService | string, keyInPivot: string, alias?: string) {
            const pivotTable = typeof pivot === 'string' ? pivot : pivot.definition.table;
            const label = alias || service.definition.name.toLowerCase();
            const relation: BelongsToManyRelationDefinition = {
                type: RelationType.BELONGS_TO_MANY,
                alias: label,
                pivotTable,
                pivotKey: keyInPivot
            };
            serviceToRelation.set(service, relation);
            aliasToService.set(label, service);
            return this;
        },
        getRelationWith(key: EntityService | string) {

            if (typeof key === 'string') {
                return this.getRelationWith(aliasToService.get(key));
            }

            if (!serviceToRelation.has(key)) {
                const message = `Could not find a relation between ${this.definition.name} and ${key.definition.name}`;
                throw new Error(message);
            }

            return serviceToRelation.get(key);
        }
    };
};


text:
namespace OctoTorrent.Client
{
    using Common;
    using Connections;

    static partial class NetworkIO
    {
        #region Nested type: AsyncConnectState

        private class AsyncConnectState : ICacheable
        {
            public IConnection Connection { get; private set; }

            public AsyncIOCallback Callback { get; private set; }

            public object State { get; private set; }

            #region ICacheable Members

            public void Initialise()
            {
                Initialise(null, null, null);
            }

            #endregion

            public AsyncConnectState Initialise(IConnection connection, AsyncIOCallback callback, object state)
            {
                Connection = connection;
                Callback = callback;
                State = state;
                return this;
            }
        }

        #endregion
    }
}


text:
drop database if exists webauto;
create database webauto DEFAULT CHARACTER SET utf8;
grant all on webauto.* to ltiuser@'localhost' identified by 'ltipassword';
grant all on webauto.* to ltiuser@'127.0.0.1' identified by 'ltipassword';

use webauto;

drop table if exists sample_profile;
drop table if exists webauto_lti_result;
drop table if exists webauto_lti_service;
drop table if exists webauto_lti_membership;
drop table if exists webauto_lti_link;
drop table if exists webauto_lti_context;
drop table if exists webauto_lti_user;
drop table if exists webauto_lti_key;

create table webauto_lti_key (
	key_id			MEDIUMINT NOT NULL AUTO_INCREMENT,
	key_sha256		CHAR(64) NOT NULL UNIQUE,
	key_key			VARCHAR(4096) NOT NULL,

	secret			VARCHAR(4096) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

	UNIQUE(key_sha256),
	PRIMARY KEY (key_id)
 ) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_context (
	context_id		MEDIUMINT NOT NULL AUTO_INCREMENT,
	context_sha256	CHAR(64) NOT NULL,
	context_key		VARCHAR(4096) NOT NULL,

	key_id			MEDIUMINT NOT NULL,

	title			VARCHAR(2048) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

    CONSTRAINT `webauto_lti_context_ibfk_1`
        FOREIGN KEY (`key_id`)
        REFERENCES `webauto_lti_key` (`key_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

	UNIQUE(key_id, context_sha256),
	PRIMARY KEY (context_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_link (
	link_id		MEDIUMINT NOT NULL AUTO_INCREMENT,
	link_sha256	CHAR(64) NOT NULL,
	link_key	VARCHAR(4096) NOT NULL,

	context_id		MEDIUMINT NOT NULL,

	title			VARCHAR(2048) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

    CONSTRAINT `webauto_lti_link_ibfk_1`
        FOREIGN KEY (`context_id`)
        REFERENCES `webauto_lti_context` (`context_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

	UNIQUE(link_sha256),
	PRIMARY KEY (link_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_user (
	user_id			MEDIUMINT NOT NULL AUTO_INCREMENT,
	user_sha256		CHAR(64) NOT NULL,
	user_key		VARCHAR(4096) NOT NULL,

	key_id			MEDIUMINT NOT NULL,
	profile_id		MEDIUMINT NOT NULL,

	displayname		VARCHAR(2048) NULL,
	email			VARCHAR(2048) NULL,
	locale			CHAR(63) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

	CONSTRAINT `webauto_lti_user_ibfk_1`
	    FOREIGN KEY (`key_id`)
	    REFERENCES `webauto_lti_key` (`key_id`)
	    ON DELETE CASCADE ON UPDATE CASCADE,

	UNIQUE(key_id, user_sha256),
	PRIMARY KEY (user_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_membership (
	membership_id	MEDIUMINT NOT NULL AUTO_INCREMENT,

	context_id		MEDIUMINT NOT NULL,
	user_id			MEDIUMINT NOT NULL,

	role			SMALLINT NULL,

	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

    CONSTRAINT `webauto_lti_membership_ibfk_1`
        FOREIGN KEY (`context_id`)
        REFERENCES `webauto_lti_context` (`context_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

    CONSTRAINT `webauto_lti_membership_ibfk_2`
        FOREIGN KEY (`user_id`)
        REFERENCES `webauto_lti_user` (`user_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

	UNIQUE(context_id, user_id),
	PRIMARY KEY (membership_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_service (
	service_id		MEDIUMINT NOT NULL AUTO_INCREMENT,
	service_sha256	CHAR(64) NOT NULL,
	service_key		VARCHAR(4096) NOT NULL,

	key_id			MEDIUMINT NOT NULL,

	format			VARCHAR(1024) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

    CONSTRAINT `webauto_lti_service_ibfk_1`
        FOREIGN KEY (`key_id`)
        REFERENCES `webauto_lti_key` (`key_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

	UNIQUE(key_id, service_sha256),
	PRIMARY KEY (service_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

create table webauto_lti_result (
	result_id		MEDIUMINT NOT NULL AUTO_INCREMENT,
	link_id			MEDIUMINT NOT NULL,
	user_id			MEDIUMINT NOT NULL,

	sourcedid		VARCHAR(2048) NOT NULL,
	sourcedid_sha256	CHAR(64) NOT NULL,

	service_id		MEDIUMINT NULL,

	grade			FLOAT NULL,
	note			VARCHAR(2048) NOT NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

    CONSTRAINT `webauto_lti_result_ibfk_1`
        FOREIGN KEY (`link_id`)
        REFERENCES `webauto_lti_link` (`link_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

    CONSTRAINT `webauto_lti_result_ibfk_2`
        FOREIGN KEY (`user_id`)
        REFERENCES `webauto_lti_user` (`user_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

    CONSTRAINT `webauto_lti_result_ibfk_3`
        FOREIGN KEY (`service_id`)
        REFERENCES `webauto_lti_service` (`service_id`)
        ON DELETE CASCADE ON UPDATE CASCADE,

	-- Note service_id is not part of the key on purpose
	-- It is data that can change and can be null in LTI 2.0
	UNIQUE(link_id, user_id, sourcedid_sha256),
	PRIMARY KEY (result_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

-- Profile hangs out as a leaf
create table sample_profile (
	profile_id		MEDIUMINT NOT NULL AUTO_INCREMENT,

	displayname		VARCHAR(2048) NULL,
	email			VARCHAR(2048) NULL,
	locale			CHAR(63) NULL,

	json			TEXT NULL,
	created_at		DATETIME NOT NULL,
	updated_at		DATETIME NOT NULL,

	PRIMARY KEY (profile_id)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;

insert into webauto_lti_key (key_sha256, key_key, secret) values ( '5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5', '12345', 'secret')


text:
/*global define*/
define([
        '../Core/Color',
        '../Core/defaultValue',
        '../Core/freezeObject'
    ], function(
        Color,
        defaultValue,
        freezeObject) {
    "use strict";

    /**
     * Represents a command to the renderer for clearing a framebuffer.
     *
     * @private
     */
    var ClearCommand = function(options) {
        options = defaultValue(options, defaultValue.EMPTY_OBJECT);

        /**
         * The value to clear the color buffer to.  When undefined, the color buffer is not cleared.
         *
         * @type {Color}
         *
         * @default undefined
         */
        this.color = options.color;

        /**
         * The value to clear the depth buffer to.  When undefined, the depth buffer is not cleared.
         *
         * @type {Number}
         *
         * @default undefined
         */
        this.depth = options.depth;

        /**
         * The value to clear the stencil buffer to.  When undefined, the stencil buffer is not cleared.
         *
         * @type {Number}
         *
         * @default undefined
         */
        this.stencil = options.stencil;

        /**
         * The render state to apply when executing the clear command.  The following states affect clearing:
         * scissor test, color mask, depth mask, and stencil mask.  When the render state is
         * undefined, the default render state is used.
         *
         * @type {RenderState}
         *
         * @default undefined
         */
        this.renderState = options.renderState;

        /**
         * The framebuffer to clear.
         *
         * @type {Framebuffer}
         *
         * @default undefined
         */
        this.framebuffer = options.framebuffer;

        /**
         * The object who created this command.  This is useful for debugging command
         * execution; it allows you to see who created a command when you only have a
         * reference to the command, and can be used to selectively execute commands
         * with {@link Scene#debugCommandFilter}.
         *
         * @type {Object}
         *
         * @default undefined
         *
         * @see Scene#debugCommandFilter
         */
        this.owner = options.owner;
    };

    /**
     * Clears color to (0.0, 0.0, 0.0, 0.0); depth to 1.0; and stencil to 0.
     *
     * @type {ClearCommand}
     *
     * @constant
     */
    ClearCommand.ALL = freezeObject(new ClearCommand({
        color : new Color(0.0, 0.0, 0.0, 0.0),
        depth : 1.0,
        stencil : 0.0
    }));

    ClearCommand.prototype.execute = function(context, passState) {
        context.clear(this, passState);
    };

    return ClearCommand;
});


text:
using UnityEngine;
using System.Collections;

public class GameStart : MonoBehaviour {

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
				if (Input.GetKeyDown ("return")) {
						Application.LoadLevel ("Stage");
				}

	}
}


text:
{% extends 'results/base.html' %}
{% load i18n %}
{% block title %}{% trans "Browser" %}{% endblock %}

{% block page_header %}
  {% include "horizon/common/_page_header.html" with title=_("Browser") %}
{% endblock page_header %}

{% block results_main %}
{% endblock %}


text:
  1. Go to [https://rac-portal.cybera.ca](https://rac-portal.cybera.ca) to sign up
  2. Fill out the form
  3. Press Save
  4. Log in!

## Using RAC

  1. Go to [https://cloud.cybera.ca](https://cloud.cybera.ca) to log into the Dashboard
  2. Note the two different regions - quotas are shared but resources are separate.
  3. Resources are on the left side
  4. Settings, Sign Out, and Region changer in top right
  5. Resources: Current Project (Tenant), Instances, Volumes, Images and Security
  6. Security Section: Keypairs (create a keypair)
  7. Security Section: Security Groups (add ping, ssh, web). Should be as tight as possible.
  8. Security Section: Floating IP (add a floating IP)
  9. Images Section: Show what images are available.
 10. Instance Section: Create a new instance. (Verify each tab). Then associate floating IP.
 11. Log into Instance1 via ssh - install apache2. Access it using browser.
 12. Go to Volumes - create a new volume and attach to Instance1
 13. `ls /dev/vd*; mkfs.ext4 /dev/vdc; mkdir /mnt/volume; mount /dev/vdc /mnt/volume; df -h`
 14. Create a second instance
 15. Attach floating IP to Instance2
 16. Try to acccess website. Fails.
 17. Swift Containers example on Dashboard (make public container - get URL)
 18. More [Documentation](http://www.cybera.ca/projects/cloud-resources/rapid-access-cloud/documentation)


text:
run = require("./setup")

run.run(function(maven) {
   maven.deploy('bouhanef-repository-snapshot', true);
})


text:
'use strict';

describe('Directive: articleSubreddit', function () {

  // load the directive's module
  beforeEach(module('redditAngularApp'));

  var element,
    scope;

  beforeEach(inject(function ($rootScope) {
    scope = $rootScope.$new();
  }));

  it('should make hidden element visible', inject(function ($compile) {
    element = angular.element('<article-subreddit></article-subreddit>');
    element = $compile(element)(scope);
    expect(element.text()).toBe('this is the articleSubreddit directive');
  }));
});


text:
from unittest import TestCase
from test import support, mock_socket
import socket
import io
import smtpd
import asyncore

class DummyServer(smtpd.SMTPServer):
    def __init__(self, localaddr, remoteaddr):
        smtpd.SMTPServer.__init__(self, localaddr, remoteaddr)
        self.messages = []

    def process_message(self, peer, mailfrom, rcpttos, data):
        self.messages.append((peer, mailfrom, rcpttos, data))
        if data == 'return status':
            return '250 Okish'

class DummyDispatcherBroken(Exception):
    pass

class BrokenDummyServer(DummyServer):
    def listen(self, num):
        raise DummyDispatcherBroken()

class SMTPDServerTest(TestCase):
    def setUp(self):
        smtpd.socket = asyncore.socket = mock_socket

    def test_process_message_unimplemented(self):
        server = smtpd.SMTPServer('a', 'b')
        conn, addr = server.accept()
        channel = smtpd.SMTPChannel(server, conn, addr)

        def write_line(line):
            channel.socket.queue_recv(line)
            channel.handle_read()

        write_line(b'MAIL From:eggs@example')
        write_line(b'RCPT To:spam@example')
        write_line(b'DATA')
        self.assertRaises(NotImplementedError, write_line, b'spam\r\n.\r\n')

    def tearDown(self):
        asyncore.close_all()
        asyncore.socket = smtpd.socket = socket

class SMTPDChannelTest(TestCase):
    def setUp(self):
        smtpd.socket = asyncore.socket = mock_socket
        self.debug = smtpd.DEBUGSTREAM = io.StringIO()
        self.server = DummyServer('a', 'b')
        conn, addr = self.server.accept()
        self.channel = smtpd.SMTPChannel(self.server, conn, addr)

    def tearDown(self):
        asyncore.close_all()
        asyncore.socket = smtpd.socket = socket

    def write_line(self, line):
        self.channel.socket.queue_recv(line)
        self.channel.handle_read()

    def test_broken_connect(self):
        self.assertRaises(DummyDispatcherBroken, BrokenDummyServer, 'a', 'b')

    def test_server_accept(self):
        self.server.handle_accept()

    def test_missing_data(self):
        self.write_line(b'')
        self.assertEqual(self.channel.socket.last,
                         b'500 Error: bad syntax\r\n')

    def test_EHLO_not_implemented(self):
        self.write_line(b'EHLO test.example')
        self.assertEqual(self.channel.socket.last,
                         b'502 Error: command "EHLO" not implemented\r\n')

    def test_HELO(self):
        name = smtpd.socket.getfqdn()
        self.write_line(b'HELO test.example')
        self.assertEqual(self.channel.socket.last,
                         '250 {}\r\n'.format(name).encode('ascii'))

    def test_HELO_bad_syntax(self):
        self.write_line(b'HELO')
        self.assertEqual(self.channel.socket.last,
                         b'501 Syntax: HELO hostname\r\n')

    def test_HELO_duplicate(self):
        self.write_line(b'HELO test.example')
        self.write_line(b'HELO test.example')
        self.assertEqual(self.channel.socket.last,
                         b'503 Duplicate HELO/EHLO\r\n')

    def test_NOOP(self):
        self.write_line(b'NOOP')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')

    def test_NOOP_bad_syntax(self):
        self.write_line(b'NOOP hi')
        self.assertEqual(self.channel.socket.last,
                         b'501 Syntax: NOOP\r\n')

    def test_QUIT(self):
        self.write_line(b'QUIT')
        self.assertEqual(self.channel.socket.last, b'221 Bye\r\n')

    def test_QUIT_arg_ignored(self):
        self.write_line(b'QUIT bye bye')
        self.assertEqual(self.channel.socket.last, b'221 Bye\r\n')

    def test_bad_state(self):
        self.channel.smtp_state = 'BAD STATE'
        self.write_line(b'HELO')
        self.assertEqual(self.channel.socket.last,
                         b'451 Internal confusion\r\n')

    def test_command_too_long(self):
        self.write_line(b'MAIL from ' +
                        b'a' * self.channel.command_size_limit +
                        b'@example')
        self.assertEqual(self.channel.socket.last,
                         b'500 Error: line too long\r\n')

    def test_data_too_long(self):
        # Small hack. Setting limit to 2K octets here will save us some time.
        self.channel.data_size_limit = 2048
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'DATA')
        self.write_line(b'A' * self.channel.data_size_limit +
                        b'A\r\n.')
        self.assertEqual(self.channel.socket.last,
                         b'552 Error: Too much mail data\r\n')

    def test_need_MAIL(self):
        self.write_line(b'RCPT to:spam@example')
        self.assertEqual(self.channel.socket.last,
            b'503 Error: need MAIL command\r\n')

    def test_MAIL_syntax(self):
        self.write_line(b'MAIL from eggs@example')
        self.assertEqual(self.channel.socket.last,
            b'501 Syntax: MAIL FROM:<address>\r\n')

    def test_MAIL_missing_from(self):
        self.write_line(b'MAIL from:')
        self.assertEqual(self.channel.socket.last,
            b'501 Syntax: MAIL FROM:<address>\r\n')

    def test_MAIL_chevrons(self):
        self.write_line(b'MAIL from:<eggs@example>')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')

    def test_nested_MAIL(self):
        self.write_line(b'MAIL from:eggs@example')
        self.write_line(b'MAIL from:spam@example')
        self.assertEqual(self.channel.socket.last,
            b'503 Error: nested MAIL command\r\n')

    def test_need_RCPT(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'DATA')
        self.assertEqual(self.channel.socket.last,
            b'503 Error: need RCPT command\r\n')

    def test_RCPT_syntax(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT to eggs@example')
        self.assertEqual(self.channel.socket.last,
            b'501 Syntax: RCPT TO: <address>\r\n')

    def test_data_dialog(self):
        self.write_line(b'MAIL From:eggs@example')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
        self.write_line(b'RCPT To:spam@example')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')

        self.write_line(b'DATA')
        self.assertEqual(self.channel.socket.last,
            b'354 End data with <CR><LF>.<CR><LF>\r\n')
        self.write_line(b'data\r\nmore\r\n.')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
        self.assertEqual(self.server.messages,
            [('peer', 'eggs@example', ['spam@example'], 'data\nmore')])

    def test_DATA_syntax(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'DATA spam')
        self.assertEqual(self.channel.socket.last, b'501 Syntax: DATA\r\n')

    def test_data_transparency_section_4_5_2(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'DATA')
        self.write_line(b'..\r\n.\r\n')
        self.assertEqual(self.channel.received_data, '.')

    def test_multiple_RCPT(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'RCPT To:ham@example')
        self.write_line(b'DATA')
        self.write_line(b'data\r\n.')
        self.assertEqual(self.server.messages,
            [('peer', 'eggs@example', ['spam@example','ham@example'], 'data')])

    def test_manual_status(self):
        # checks that the Channel is able to return a custom status message
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'DATA')
        self.write_line(b'return status\r\n.')
        self.assertEqual(self.channel.socket.last, b'250 Okish\r\n')

    def test_RSET(self):
        self.write_line(b'MAIL From:eggs@example')
        self.write_line(b'RCPT To:spam@example')
        self.write_line(b'RSET')
        self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
        self.write_line(b'MAIL From:foo@example')
        self.write_line(b'RCPT To:eggs@example')
        self.write_line(b'DATA')
        self.write_line(b'data\r\n.')
        self.assertEqual(self.server.messages,
            [('peer', 'foo@example', ['eggs@example'], 'data')])

    def test_RSET_syntax(self):
        self.write_line(b'RSET hi')
        self.assertEqual(self.channel.socket.last, b'501 Syntax: RSET\r\n')

    def test_attribute_deprecations(self):
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__server
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__server = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__line
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__line = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__state
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__state = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__greeting
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__greeting = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__mailfrom
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__mailfrom = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__rcpttos
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__rcpttos = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__data
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__data = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__fqdn
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__fqdn = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__peer
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__peer = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__conn
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__conn = 'spam'
        with support.check_warnings(('', PendingDeprecationWarning)):
            spam = self.channel._SMTPChannel__addr
        with support.check_warnings(('', PendingDeprecationWarning)):
            self.channel._SMTPChannel__addr = 'spam'

def test_main():
    support.run_unittest(SMTPDServerTest, SMTPDChannelTest)

if __name__ == "__main__":
    test_main()


text:
package org.taitasciore.android.hospitalk.main;

import android.util.Log;

import com.google.android.gms.location.LocationRequest;

import org.taitasciore.android.model.LocationResponse;
import org.taitasciore.android.network.HospitalkService;

import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.schedulers.Schedulers;
import retrofit2.Response;

/**
 * Created by roberto on 18/04/17.
 */

public class LocationPresenter implements LocationContract.Presenter {

    private LocationContract.View mView;
    private HospitalkService mService;

    public LocationPresenter(LocationContract.View view) {
        bindView(view);
        mService = new HospitalkService();
    }

    @Override
    public void bindView(LocationContract.View view) {
        mView = view;
    }

    @Override
    public void unbindView() {
        mView = null;
    }

    @Override
    public void getLocation(double lat, double lon) {
        Log.i("fetching location...", lat + " - " + lon);

        mView.showHeaderLoading();

        mService.getLocation(lat, lon)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new DisposableObserver<Response<LocationResponse>>() {
                    @Override
                    public void onNext(Response<LocationResponse> response) {
                        Log.i("result code", response.code()+"");

                        if (mView != null) {
                            if (response.isSuccessful()) {
                                LocationResponse locationResponse = response.body();
                                LocationResponse.Country country = locationResponse.getCountry();
                                LocationResponse.City city = locationResponse.getCity();
                                mView.showPing();
                                mView.updateLocation(country.getWebcode(), city.getCityname());
                                mView.setCountry(country.getCountryid());
                                mView.setLocation(city.getLatitude(), city.getLongitude());
                            } else {
                                mView.showPing();
                                mView.updateLocation("ES", "Madrid");
                                mView.showLocationFailedError();
                            }
                        }
                    }

                    @Override
                    public void onError(Throwable e) {
                        if (mView != null) {
                            mView.showPing();
                            mView.updateLocation("ES", "Madrid");
                            mView.setCountry("ESP");
                            mView.setLocation(40.4116767, -3.7130291);
                            mView.showNetworkError();
                        }
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }
}


text:
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import {FormattedMessage} from 'react-intl';

import CallDataActivityMessage from '@webex/react-component-call-data-activity';

import messages from './messages';
import styles from './styles.css';

// eslint-disable-next-line no-warning-comments
// TODO: Migrate message verbs into a top level helper package

export const SYSTEM_MESSAGE_VERB_TOMBSTONE = 'tombstone';
export const SYSTEM_MESSAGE_VERB_CREATE = 'create';
export const SYSTEM_MESSAGE_VERB_UPDATE = 'update';
export const SYSTEM_MESSAGE_VERB_ADD = 'add';
export const SYSTEM_MESSAGE_VERB_LEAVE = 'leave';
export const SYSTEM_MESSAGE_VERBS = [
  SYSTEM_MESSAGE_VERB_CREATE,
  SYSTEM_MESSAGE_VERB_TOMBSTONE,
  SYSTEM_MESSAGE_VERB_UPDATE,
  SYSTEM_MESSAGE_VERB_ADD,
  SYSTEM_MESSAGE_VERB_LEAVE
];

const propTypes = {
  activity: PropTypes.shape({
    duration: PropTypes.number,
    isGroupCall: PropTypes.bool,
    participants: PropTypes.shape({
      items: PropTypes.arrayOf(
        PropTypes.shape({
          isInitiator: PropTypes.bool,
          person: PropTypes.shape({
            entryUUID: PropTypes.string
          }),
          state: PropTypes.string
        })
      )
    })
  }),
  actor: PropTypes.shape({
    entryUUID: PropTypes.string
  }),
  currentUser: PropTypes.shape({
    id: PropTypes.string
  }),
  isSelf: PropTypes.bool,
  name: PropTypes.string.isRequired,
  timestamp: PropTypes.string,
  verb: PropTypes.string.isRequired
};

const defaultProps = {
  activity: {
    duration: null,
    isGroupCall: false,
    participants: {
      items: []
    }
  },
  actor: {},
  currentUser: {},
  isSelf: false,
  timestamp: ''
};

function ActivitySystemMessage(props) {
  const {
    activity,
    actor,
    currentUser,
    isSelf,
    name,
    timestamp,
    verb
  } = props;

  let systemMessage;

  switch (verb) {
    case SYSTEM_MESSAGE_VERB_ADD: {
      if (isSelf) {
        systemMessage = <FormattedMessage {...messages.youAdded} values={{name}} />;
      }
      else {
        systemMessage = <FormattedMessage {...messages.someoneAdded} values={{name}} />;
      }
      break;
    }
    case SYSTEM_MESSAGE_VERB_CREATE: {
      if (isSelf) {
        systemMessage = <FormattedMessage {...messages.youCreate} />;
      }
      else {
        systemMessage = <FormattedMessage {...messages.someoneCreate} values={{name}} />;
      }
      break;
    }
    case SYSTEM_MESSAGE_VERB_LEAVE: {
      if (isSelf) {
        systemMessage = <FormattedMessage {...messages.youRemoved} values={{name}} />;
      }
      else {
        systemMessage = <FormattedMessage {...messages.someoneRemoved} values={{name}} />;
      }
      break;
    }
    case SYSTEM_MESSAGE_VERB_TOMBSTONE: {
      if (isSelf) {
        systemMessage = <FormattedMessage {...messages.youDelete} />;
      }
      else {
        systemMessage = <FormattedMessage {...messages.someoneDelete} values={{name}} />;
      }
      break;
    }
    case SYSTEM_MESSAGE_VERB_UPDATE: {
      systemMessage = (
        <CallDataActivityMessage
          actor={actor}
          currentUser={currentUser}
          duration={activity.duration}
          isGroupCall={activity.isGroupCall}
          participants={activity.participants.items}
        />
      );
      break;
    }
    default:
      return null;
  }

  return (
    <div className={classNames('webex-system-message', styles.systemMessage)}>
      {systemMessage} {timestamp}
    </div>
  );
}

ActivitySystemMessage.propTypes = propTypes;
ActivitySystemMessage.defaultProps = defaultProps;

export default ActivitySystemMessage;


text:
package com.opengamma.master.holiday.impl;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import org.threeten.bp.DayOfWeek;
import org.threeten.bp.LocalDate;

import com.google.common.collect.ImmutableList;
import com.opengamma.core.holiday.Holiday;
import com.opengamma.core.holiday.HolidaySource;
import com.opengamma.core.holiday.HolidayType;
import com.opengamma.core.holiday.WeekendTypeProvider;
import com.opengamma.core.holiday.impl.SimpleHoliday;
import com.opengamma.id.ExternalId;
import com.opengamma.id.ExternalIdBundle;
import com.opengamma.id.VersionCorrection;
import com.opengamma.master.AbstractMasterSource;
import com.opengamma.master.holiday.HolidayDocument;
import com.opengamma.master.holiday.HolidayMaster;
import com.opengamma.master.holiday.HolidaySearchRequest;
import com.opengamma.master.holiday.HolidaySearchResult;
import com.opengamma.util.ArgumentChecker;
import com.opengamma.util.PublicSPI;
import com.opengamma.util.money.Currency;

/**
 * A {@code HolidaySource} implemented using an underlying {@code HolidayMaster}.
 *

 * The {@link HolidaySource} interface provides holidays to the application via a narrow API. This class provides the source on
 * top of a standard {@link HolidayMaster}.
 *

 * Previously, this source hard-coded the weekend to be Saturday and Sunday. Now the holiday is checked and if it is a
 * {@link WeekendTypeProvider}, the provider is used to determine if a day is a weekend. If this information is not available
 * from a holiday, the previous hard-coding is used.
 */
@PublicSPI
public class MasterHolidaySource extends AbstractMasterSource<Holiday, HolidayDocument, HolidayMaster> implements HolidaySource {
  /** True if the holiday calendars should be cached */
  private final boolean _cacheHolidayCalendars;
  /** The cached holiday objects */
  private final ConcurrentMap<HolidaySearchRequest, Holiday> _cachedHolidays = new ConcurrentHashMap<>();

  /**
   * Creates an instance with an underlying master.
   *
   * @param master the master, not null
   */
  public MasterHolidaySource(final HolidayMaster master) {
    this(master, false);
  }

  /**
   * Creates an instance with an underlying master.
   *
   * @param master the master, not null
   * @param cacheCalendars whether all calendars should be cached
   */
  public MasterHolidaySource(final HolidayMaster master, final boolean cacheCalendars) {
    super(master);
    _cacheHolidayCalendars = cacheCalendars;
  }

  @Override
  public Collection<Holiday> get(final HolidayType holidayType,
      final ExternalIdBundle regionOrExchangeIds) {
    final HolidaySearchRequest request = createNonCurrencySearchRequest(holidayType, regionOrExchangeIds);
    return processDocuments(getMaster().search(request));
  }

  @Override
  public Collection<Holiday> get(final Currency currency) {
    final HolidaySearchRequest request = createCurrencySearchRequest(currency);
    return processDocuments(getMaster().search(request));
  }

  private static Collection<Holiday> processDocuments(final HolidaySearchResult search) {
    return ImmutableList.<Holiday>copyOf(search.getHolidays());
  }

  @Override
  public boolean isHoliday(final LocalDate dateToCheck, final Currency currency) {
    final HolidaySearchRequest request = createCurrencySearchRequest(currency);
    return isHoliday(request, dateToCheck);
  }

  @Override
  public boolean isHoliday(final LocalDate dateToCheck, final HolidayType holidayType, final ExternalIdBundle regionOrExchangeIds) {
    final HolidaySearchRequest request = createNonCurrencySearchRequest(holidayType, regionOrExchangeIds);
    return isHoliday(request, dateToCheck);
  }

  /**
   * This method used to check the ThreadLocalServiceContext.getConfigVersionCorrection(), but as it wasn't being initialized correctly
   * by the engine, and always returned LATEST, it's been removed.
   * @return the version/correction (always LATEST currently)
   */
  private static VersionCorrection getVersionCorrection() {
    return VersionCorrection.LATEST;
  }

  private static HolidaySearchRequest createCurrencySearchRequest(final Currency currency) {
    return createdVersionCorrectedSearchRequest(new HolidaySearchRequest(currency));
  }

  private static HolidaySearchRequest createNonCurrencySearchRequest(final HolidayType holidayType,
      final ExternalIdBundle regionOrExchangeIds) {
    return createdVersionCorrectedSearchRequest(new HolidaySearchRequest(holidayType, regionOrExchangeIds));
  }

  private static HolidaySearchRequest createdVersionCorrectedSearchRequest(final HolidaySearchRequest searchRequest) {
    searchRequest.setVersionCorrection(getVersionCorrection());
    return searchRequest;
  }

  @Override
  public boolean isHoliday(final LocalDate dateToCheck, final HolidayType holidayType, final ExternalId regionOrExchangeId) {
    final HolidaySearchRequest request = new HolidaySearchRequest(holidayType, ExternalIdBundle.of(regionOrExchangeId));
    return isHoliday(request, dateToCheck);
  }

  //-------------------------------------------------------------------------
  /**
   * Checks if the specified date is a holiday.
   *
   * @param request the request to search base on, not null
   * @param dateToCheck the date to check, not null
   * @return true if the date is a holiday
   */
  protected boolean isHoliday(final HolidaySearchRequest request, final LocalDate dateToCheck) {
    ArgumentChecker.notNull(request, "request");
    ArgumentChecker.notNull(dateToCheck, "dateToCheck");
    final HolidaySearchRequest cacheKey = request.clone();
    if (_cacheHolidayCalendars) {
      final Holiday cachedHoliday = _cachedHolidays.get(cacheKey);
      if (cachedHoliday != null) {
        // note that the weekend check has been moved into this section rather than being short-circuited
        // above, as different countries can have different weekend days
        if (cachedHoliday instanceof WeekendTypeProvider) {
          if (((WeekendTypeProvider) cachedHoliday).getWeekendType().isWeekend(dateToCheck)) {
            return true;
          }
        } else {
          // backwards compatibility
          if (isWeekend(dateToCheck)) {
            return true;
          }
        }
        final List<LocalDate> cachedDates = cachedHoliday.getHolidayDates();
        if (cachedDates == null || cachedDates.isEmpty()) {
          // Sign that we couldn't find anything.
          return false;
        }
        return isHoliday(cachedDates, dateToCheck);
      }
    }
    final HolidayDocument doc;
    if (_cacheHolidayCalendars) {
      // get all holidays and cache
      final HolidaySearchResult result = getMaster().search(cacheKey);
      if (result == null) {
        doc = null;
      } else {
        doc = result.getFirstDocument();
      }
      if (doc != null) {
        _cachedHolidays.put(cacheKey, doc.getHoliday());
      } else {
        // preserves old behaviour, which cached an empty list of dates
        _cachedHolidays.put(cacheKey, new SimpleHoliday());
        return false;
      }
    } else {
      // Not caching, search for this date only.
      request.setDateToCheck(dateToCheck);
      final HolidaySearchResult result = getMaster().search(request);
      if (result != null) {
        doc = result.getFirstDocument();
      } else {
        doc = null;
      }
    }
    if (doc != null && doc.getHoliday() instanceof WeekendTypeProvider) {
      if (((WeekendTypeProvider) doc.getHoliday()).getWeekendType().isWeekend(dateToCheck)) {
        return true;
      }
    } else {
      // backwards compatibility
      if (isWeekend(dateToCheck)) {
        return true;
      }
    }
    return isHoliday(doc, dateToCheck);
  }

  /**
   * Checks if the specified date is a holiday.
   *
   * @param doc document retrieved from underlying holiday master, may be null
   * @param dateToCheck the date to check, not null
   * @return false if nothing was retrieved from underlying holiday master. Otherwise, true if and only if
   * the date is a holiday based on the underlying holiday master
   */
  protected boolean isHoliday(final HolidayDocument doc, final LocalDate dateToCheck) {
    if (doc == null) {
      return false;
    }
    return Collections.binarySearch(doc.getHoliday().getHolidayDates(), dateToCheck) >= 0;
  }

  /**
   * Returns true if a date is present in a list of holiday dates. Note that this method
   * does not include weekends.
   * @param dates  the dates, not null
   * @param dateToCheck  the date to check, not null
   * @return true if the date is present in the list of holiday dates
   */
  protected boolean isHoliday(final List<LocalDate> dates, final LocalDate dateToCheck) {
    return Collections.binarySearch(dates, dateToCheck) >= 0;
  }

  /**
   * Checks if the date is at the weekend, defined as a Saturday or Sunday.
   *
   * @param date the date to check, not null
   * @return true if it is a weekend
   * @deprecated The weekend dates should be returned from a {@link WeekendTypeProvider} object.
   */
  @Deprecated
  protected boolean isWeekend(final LocalDate date) {
    return date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY;
  }

}


text:
void init_uart();

void print_uart(const char* str);

void print_uart_int(uint32_t addr);

void print_uart_addr(uint64_t addr);

void print_uart_byte(uint8_t byte);


text:
namespace zucchini {

// For consistency, let "canonical order" of DEX data types be the order defined
// in https://source.android.com/devices/tech/dalvik/dex-format "Type Codes"
// section.

class DisassemblerDex : public Disassembler {
 public:
  // Pools follow canonical order.
  enum ReferencePool : uint8_t {
    kStringId,
    kTypeId,
    kProtoId,
    kFieldId,
    kMethodId,
    // kClassDef,  // Unused
    // kCallSiteId, // Unused
    // kMethodHandle, // Unused
    kTypeList,
    kAnnotationSetRefList,
    kAnnotionSet,
    kClassData,
    kCode,
    kStringData,
    kAnnotation,
    kEncodedArray,
    kAnnotationsDirectory,
    // kCallSite, // Unused
    kNumPools
  };

  // Types are grouped and ordered by target ReferencePool. This is required by
  // Zucchini-apply, which visits references by type order and sequentially
  // handles pools in the same order. Type-pool association is established in
  // MakeReferenceGroups(), and verified by a unit test.
  enum ReferenceType : uint8_t {
    kTypeIdToDescriptorStringId,  // kStringId
    kProtoIdToShortyStringId,
    kFieldIdToNameStringId,
    kMethodIdToNameStringId,
    kClassDefToSourceFileStringId,
    kCodeToStringId16,
    kCodeToStringId32,

    kProtoIdToReturnTypeId,  // kTypeId
    kFieldIdToClassTypeId,
    kFieldIdToTypeId,
    kMethodIdToClassTypeId,
    kClassDefToClassTypeId,
    kClassDefToSuperClassTypeId,
    kTypeListToTypeId,
    kCodeToTypeId,

    kMethodIdToProtoId,  // kProtoId

    kCodeToFieldId,  // kFieldId
    kAnnotationsDirectoryToFieldId,

    kCodeToMethodId,  // kMethodId
    kAnnotationsDirectoryToMethodId,
    kAnnotationsDirectoryToParameterMethodId,

    kProtoIdToParametersTypeList,  // kTypeList
    kClassDefToInterfacesTypeList,

    kAnnotationsDirectoryToParameterAnnotationSetRef,  // kAnnotationSetRef,

    kAnnotationSetRefListToAnnotationSet,  // kAnnotationSet,
    kAnnotationsDirectoryToClassAnnotationSet,
    kAnnotationsDirectoryToFieldAnnotationSet,
    kAnnotationsDirectoryToMethodAnnotationSet,

    kClassDefToClassData,  // kClassData

    kCodeToRelCode8,  // kCode
    kCodeToRelCode16,
    kCodeToRelCode32,

    kStringIdToStringData,  // kStringData

    kAnnotationSetToAnnotation,  // kAnnotation

    kClassDefToStaticValuesEncodedArray,  // kEncodedArrayItem

    kClassDefToAnnotationDirectory,  // kAnnotationsDirectory

    // Intentionally ignored references (never appeared in test corpus).
    // kMethodHandleToFieldId,
    // kMethodHandleToMethodId,
    // kCallSiteIdToCallSite,

    kNumTypes
  };

  DisassemblerDex();
  ~DisassemblerDex() override;

  // Applies quick checks to determine if |image| *may* point to the start of an
  // executable. Returns true on success.
  static bool QuickDetect(ConstBufferView image);

  // Disassembler:
  ExecutableType GetExeType() const override;
  std::string GetExeTypeString() const override;
  std::vector<ReferenceGroup> MakeReferenceGroups() const override;

  // Functions that return reference readers. These follow canonical order of
  // *locations* (unlike targets for ReferenceType). This allows functions with
  // similar parsing logic to appear togeter.
  std::unique_ptr<ReferenceReader> MakeReadStringIdToStringData(offset_t lo,
                                                                offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadTypeIdToDescriptorStringId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadProtoIdToShortyStringId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadProtoIdToReturnTypeId32(offset_t lo,
                                                                   offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadProtoIdToParametersTypeList(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadFieldToClassTypeId16(offset_t lo,
                                                                offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadFieldToTypeId16(offset_t lo,
                                                           offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadFieldToNameStringId32(offset_t lo,
                                                                 offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadMethodIdToClassTypeId16(offset_t lo,
                                                                   offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadMethodIdToProtoId16(offset_t lo,
                                                               offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadMethodIdToNameStringId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToClassTypeId32(offset_t lo,
                                                                   offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToSuperClassTypeId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToInterfacesTypeList(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToSourceFileStringId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToAnnotationDirectory(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToClassData(offset_t lo,
                                                               offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadClassDefToStaticValuesEncodedArray(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadTypeListToTypeId16(offset_t lo,
                                                              offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadAnnotationSetToAnnotation(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadAnnotationSetRefListToAnnotationSet(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader>
  MakeReadAnnotationsDirectoryToClassAnnotationSet(offset_t lo, offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadAnnotationsDirectoryToFieldId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader>
  MakeReadAnnotationsDirectoryToFieldAnnotationSet(offset_t lo, offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadAnnotationsDirectoryToMethodId32(
      offset_t lo,
      offset_t hi);
  std::unique_ptr<ReferenceReader>
  MakeReadAnnotationsDirectoryToMethodAnnotationSet(offset_t lo, offset_t hi);
  std::unique_ptr<ReferenceReader>
  MakeReadAnnotationsDirectoryToParameterMethodId32(offset_t lo, offset_t hi);
  std::unique_ptr<ReferenceReader>
  MakeReadAnnotationsDirectoryToParameterAnnotationSetRef(offset_t lo,
                                                          offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToStringId16(offset_t lo,
                                                            offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToStringId32(offset_t lo,
                                                            offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToTypeId16(offset_t lo,
                                                          offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToFieldId16(offset_t lo,
                                                           offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToMethodId16(offset_t lo,
                                                            offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToRelCode8(offset_t lo,
                                                          offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToRelCode16(offset_t lo,
                                                           offset_t hi);
  std::unique_ptr<ReferenceReader> MakeReadCodeToRelCode32(offset_t lo,
                                                           offset_t hi);

  // Functions that return reference writers. Different readers may share a
  // common writer. Therefore these loosely follow canonical order of locations,
  std::unique_ptr<ReferenceWriter> MakeWriteStringId16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteStringId32(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteTypeId16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteTypeId32(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteProtoId16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteFieldId16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteFieldId32(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteMethodId16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteMethodId32(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteRelCode8(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteRelCode16(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteRelCode32(MutableBufferView image);
  std::unique_ptr<ReferenceWriter> MakeWriteAbs32(MutableBufferView image);

 private:
  friend Disassembler;
  using MapItemMap = std::map<uint16_t, const dex::MapItem*>;

  // Disassembler:
  bool Parse(ConstBufferView image) override;

  bool ParseHeader();

  const dex::HeaderItem* header_ = nullptr;
  int dex_version_ = 0;
  MapItemMap map_item_map_ = {};
  dex::MapItem string_map_item_ = {};
  dex::MapItem type_map_item_ = {};
  dex::MapItem proto_map_item_ = {};
  dex::MapItem field_map_item_ = {};
  dex::MapItem method_map_item_ = {};
  dex::MapItem class_def_map_item_ = {};
  dex::MapItem type_list_map_item_ = {};
  dex::MapItem code_map_item_ = {};

  // Optionally supported (not all DEX files have these).
  dex::MapItem annotation_set_ref_list_map_item_ = {};
  dex::MapItem annotation_set_map_item_ = {};
  dex::MapItem annotations_directory_map_item_ = {};

  // Sorted list of offsets of parsed items in |image_|.
  std::vector<offset_t> code_item_offsets_;
  std::vector<offset_t> type_list_offsets_;
  std::vector<offset_t> annotation_set_ref_list_offsets_;
  std::vector<offset_t> annotation_set_offsets_;
  std::vector<offset_t> annotations_directory_item_offsets_;
  std::vector<offset_t> annotations_directory_item_field_annotation_offsets_;
  std::vector<offset_t> annotations_directory_item_method_annotation_offsets_;
  std::vector<offset_t>
      annotations_directory_item_parameter_annotation_offsets_;

  DISALLOW_COPY_AND_ASSIGN(DisassemblerDex);
};

}  // namespace zucchini

#endif  // COMPONENTS_ZUCCHINI_DISASSEMBLER_DEX_H_