text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Xml.Linq;

namespace ASC.Data.Backup.Restore
{
    class Restarter : IBackupProvider
    {
        public string Name
        {
            get { return "restarter"; }
        }

        public IEnumerable<XElement> GetElements(int tenant, string[] configs, IDataWriteOperator writer)
        {
            return null;
        }

        public void LoadFrom(IEnumerable<XElement> elements, int tenant, string[] configs, IDataReadOperator reader)
        {
            try
            {
                RestartService("OnlyOffice");
                KillProcesses("w3wp");
                KillProcesses("aspnet_wp");
            }
            catch { }
            finally
            {
                OnProgressChanged("OK", 100);
            }
        }

        public event EventHandler<ProgressChangedEventArgs> ProgressChanged;

        private void OnProgressChanged(string status, int progress)
        {
            try
            {
                if (ProgressChanged != null) ProgressChanged(this, new ProgressChangedEventArgs(status, progress));
            }
            catch { }
        }

        private void RestartService(string serviceName)
        {
            var services = ServiceController.GetServices().Where(s => s.ServiceName.StartsWith(serviceName, StringComparison.InvariantCultureIgnoreCase));
            var controllers = new List<ServiceController>();
            foreach (var service in services)
            {
                controllers.AddRange(service.DependentServices);
                controllers.Add(service);
            }
            RestartServices(controllers);
        }

        private void RestartServices(IEnumerable<ServiceController> controllers)
        {
            var timeout = TimeSpan.FromSeconds(30);
            var count = controllers.Count() * 2 + 1;
            var counter = 0;

            foreach (var controller in controllers)
            {
                try
                {
                    OnProgressChanged("Stopping service " + controller.DisplayName, counter++ * 100 / count);
                    WaitPendingStatuses(controller, timeout);
                    if (controller.Status != ServiceControllerStatus.Stopped)
                    {
                        controller.Stop();
                        controller.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
                    }
                }
                catch (Exception) { }
            }

            foreach (var controller in controllers.Reverse())
            {
                try
                {
                    OnProgressChanged("Starting service " + controller.DisplayName, counter++ * 100 / count);
                    WaitPendingStatuses(controller, timeout);
                    if (controller.Status == ServiceControllerStatus.Stopped)
                    {
                        controller.Start();
                        controller.WaitForStatus(ServiceControllerStatus.Running, timeout);
                    }
                }
                catch (Exception) { }
            }
        }

        private void WaitPendingStatuses(ServiceController controller, TimeSpan timeout)
        {
            if (controller.Status == ServiceControllerStatus.StartPending)
            {
                controller.WaitForStatus(ServiceControllerStatus.Running, timeout);
            }
            if (controller.Status == ServiceControllerStatus.PausePending)
            {
                controller.WaitForStatus(ServiceControllerStatus.Paused, timeout);
            }
            if (controller.Status == ServiceControllerStatus.ContinuePending)
            {
                controller.WaitForStatus(ServiceControllerStatus.Running, timeout);
            }
            if (controller.Status == ServiceControllerStatus.StopPending)
            {
                controller.WaitForStatus(ServiceControllerStatus.Stopped, timeout);
            }
        }

        private void KillProcesses(string processName)
        {
            OnProgressChanged("Restart process " + processName, 95);
            foreach (var process in Process.GetProcessesByName(processName))
            {
                process.Kill();
            }
        }
    }
}


text:
require 'mercadopago'
require 'uri'

module Spree
  class Gateway::MercadoPago < Gateway
    include Spree::BaseHelper

    preference :client_id, :string
    preference :client_secret, :string
    preference :installments, :integer, default: 12

    def source_required?
      false
    end

    def method_type
      'mercado_pago'
    end

    def auto_capture?
      false
    end

    def actions
      %w{capture void}
    end

    def can_void?(payment)
      !payment.void?
    end

    def can_capture?(payment)
      payment.pending? || payment.checkout?
    end

    def provider_class
      ::MercadoPago::Client
    end

    def provider
      @provider ||= provider_class.new(preferred_client_id, preferred_client_secret)
    end

    def notification(ref)
      Rails.logger.info "Enviando notificação: #{ref.inspect}"
      notification = provider.notification(ref)
      Rails.logger.info "Notificação retorno Mercado Pago: #{notification.inspect}"

      notification
    end

    def create_preference(order, back_urls, notification_uri)
      pr = payment_preference(order, back_urls, notification_uri)
      Rails.logger.info "Enviando preferência de pagamento: #{pr.inspect}"
      preference = provider.create_preference(pr)
      Rails.logger.info "Preferência retorno Mercado Pago: #{preference.inspect}"

      preference
    end

    def capture(a, b, c)
      Class.new do
        def success?; true; end
        def authorization; nil; end
      end.new
    end

    def void(*args)
      ActiveMerchant::Billing::Response.new(true, "", {}, {})
    end

    private

    def payment_preference(order, back_urls, notification_uri)
      preference = Hash.new

      success_uri = back_urls[:success]
      uri = URI(success_uri)

      external_reference = "#{order.number}@#{uri.host}"

      # Order Information
      preference[:external_reference] = external_reference
      preference[:back_urls] = back_urls
      preference[:notification_uri] = notification_uri

      # MercadoPago asked for it. Do'h!
      preference[:notification_url] = notification_uri

      # User Information
      preference[:payer] = {
        phone: {
          area_code: order.ship_address.phone.gsub(/\D/,"")[0,2],
          number: order.ship_address.phone.gsub(/\D/,"")[2,9],
        },
        address: {
          zip_code: order.ship_address.zipcode,
          street_name: order.ship_address.address1,
        },
        email: order.user.try(:email),
        identification: {
          type: 'CPF',
          number: order.user.document
        },
        name: order.user.first_name,
        surname: order.user.last_name,
        date_created: order.user.created_at.to_time.iso8601
      }

      # Items Information
      preference[:items] = []
      order.line_items.each do |item|
        preference[:items] << {
          :title => item.product.name,
          :unit_price => item.price.to_f,
          :quantity => item.quantity,
          :currency_id => order.currency,
          :picture_url => small_image_url(item.product),
          :description => item.product.description,
          :category_id => 'others'
        }
      end

      # Order Adjusts
      if order.adjustment_total.to_f > 0
        preference[:items] << {
          :title => 'Ajustes',
          :unit_price => order.adjustment_total.to_f,
          :quantity => 1,
          :currency_id => order.currency
        }
      end

      #Shipments Information
      preference[:shipments] = {
        receiver_address: {
          zip_code: order.ship_address.zipcode,
          street_name: order.ship_address.address1,
        }
      }

      # Payment Configuration
      preference[:payment_methods] = {
        installments: preferred_installments
      }

      preference
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
define(['repositories/albumRepository', 'repositories/queueRepository'], function (albumRepository, queueRepository) {
    var album = ko.observable();

    return {
        album: album,

        queueTrack: function (track) {
            track.ReasonExpanded(false);
            queueRepository.queueTrack(track);
        },

        expandReason: function (track) {
            if (!track.IsAlreadyQueued()) {
                if (track.ReasonExpanded()) {
                    track.ReasonExpanded(false);
                } else {
                    track.ReasonExpanded(true);
                }
            }
        },

        activate: function (provider, link) {
            return albumRepository.getAlbum(album, provider, link);
        }
    };
});


text:
package cli

import (
	"fmt"

	"github.com/cosmos/cosmos-sdk/client"

	// "strings".
	"github.com/spf13/cobra"

	// sdk "github.com/cosmos/cosmos-sdk/types".
	"github.com/zigbee-alliance/distributed-compliance-ledger/x/dclgenutil/types"
)

// GetQueryCmd returns the cli query commands for this module.
func GetQueryCmd(queryRoute string) *cobra.Command {
	// Group dclgenutil queries under a subcommand
	cmd := &cobra.Command{
		Use:                        types.ModuleName,
		Short:                      fmt.Sprintf("Querying commands for the %s module", types.ModuleName),
		DisableFlagParsing:         true,
		SuggestionsMinimumDistance: 2,
		RunE:                       client.ValidateCmd,
	}

	// this line is used by starport scaffolding # 1

	return cmd
}


text:
package org.eclipse.swt.events;

/* Generated file */
public class ArmListenerNative implements org.eclipse.swt.events.ArmListener {
	public native void widgetArmed(org.eclipse.swt.events.ArmEvent a);

}


text:
FC = gfortran
FCOPTS = -g -fbounds-check
BINDIR = ~/Applications/bin
LIBDIR = ~/Applications/modules/lib
MODDIR = ~/Applications/modules/mods
LIBS = -lanisotropy_ajn

all: CIJ_axial_average

install: all
	/bin/cp CIJ_axial_average $(BINDIR)/

CIJ_axial_average: CIJ_axial_average.o
	$(FC) ${FCOPTS} -o CIJ_axial_average -L $(LIBDIR) ${LIBS} CIJ_axial_average.o

%.o: %.f90
	$(FC) ${FCOPTS} -c -I $(MODDIR) $*.f90

.PHONY: clean

clean:
	/bin/rm -f CIJ_axial_average *.o *.mod


text:
#ifndef __CC_HELPER_H__
#define __CC_HELPER_H__

#include <stdint.h>
#include <common_time/ICommonClock.h>
#include <utils/threads.h>

namespace android {

// CCHelper is a simple wrapper class to help with centralizing access to the
// Common Clock service and implementing lifetime managment, as well as to
// implement a simple policy of making a basic attempt to reconnect to the
// common clock service when things go wrong.
//
// On platforms which run the native common_time service in auto-disable mode,
// the service will go into networkless mode whenever it has no active clients.
// It tracks active clients using registered CommonClockListeners (the callback
// interface for onTimelineChanged) since this provides a convienent death
// handler notification for when the service's clients die unexpectedly.  This
// means that users of the common time service should really always have a
// CommonClockListener, unless they know that the time service is not running in
// auto disabled mode, or that there is at least one other registered listener
// active in the system.  The CCHelper makes this a little easier by sharing a
// ref counted ICommonClock interface across all clients and automatically
// registering and unregistering a listener whenever there are CCHelper
// instances active in the process.
class CCHelper {
  public:
    CCHelper();
    ~CCHelper();

    status_t isCommonTimeValid(bool* valid, uint32_t* timelineID);
    status_t commonTimeToLocalTime(int64_t commonTime, int64_t* localTime);
    status_t localTimeToCommonTime(int64_t localTime, int64_t* commonTime);
    status_t getCommonTime(int64_t* commonTime);
    status_t getCommonFreq(uint64_t* freq);
    status_t getLocalTime(int64_t* localTime);
    status_t getLocalFreq(uint64_t* freq);

  private:
    class CommonClockListener : public BnCommonClockListener {
      public:
        void onTimelineChanged(uint64_t timelineID);
    };

    static bool verifyClock_l();

    static Mutex lock_;
    static sp<ICommonClock> common_clock_;
    static sp<ICommonClockListener> common_clock_listener_;
    static uint32_t ref_count_;
};

}  // namespace android
#endif  // __CC_HELPER_H__


text:
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Reflection;
using Newtonsoft.Json;
namespace HMS.SP{
    /// <summary>
    /// <para>https://msdn.microsoft.com/en-us/library/office/dn450841.aspx#bk_File</para>
    /// </summary>
    public class File : SPBase,iSP{
        [JsonProperty("__HMSError")]
        public HMS.Util.__HMSError __HMSError_ { set; get; }
        [JsonProperty("__status")]
        public SP.__status __status_ { set; get; }
        [JsonProperty("__deferred")]
        public SP.__deferred __deferred_ { set; get; }
        [JsonProperty("__metadata")]
        public SP.__metadata __metadata_ { set; get; }
        public Dictionary<string, string> __rest;
        /// <summary>
        /// <para>Gets a value that specifies the user who added the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("Author")]
        public SP.User Author_ { set; get; }
        /// <summary>
        /// <para>Gets a value that returns the user who has checked out the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("CheckedOutByUser")]
        public SP.User CheckedOutByUser_ { set; get; }
        /// <summary>
        /// <para>Gets a value that returns the comment used when a document is checked in to a document library.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("CheckInComment")]
        public String CheckInComment_ { set; get; }
        /// <summary>
        /// <para>Gets a value that indicates how the file is checked out of a document library. Represents an SP.CheckOutType value: Online = 0; Offline = 1; None = 2.The checkout state of a file is independent of its locked state.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("CheckOutType")]
        public Int32 CheckOutType_ { set; get; }
        /// <summary>
        /// <para>Returns internal version of content, used to validate document equality for read purposes.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("ContentTag")]
        public String ContentTag_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the customization status of the file. Represents an SP.CustomizedPageStatus value: None = 0; Uncustomized = 1; Customized = 2.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("CustomizedPageStatus")]
        public Int32 CustomizedPageStatus_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the ETag value.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("ETag")]
        public String ETag_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies whether the file exists.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("Exists")]
        public Boolean Exists_ { set; get; }
        /// <summary>
        /// <para>Gets the size of the file in bytes, excluding the size of any Web Parts that are used in the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("Length")]
        public Int64 Length_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the publishing level of the file. Represents an SP.FileLevel value: Published = 1; Draft = 2; Checkout = 255.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("Level")]
        public Byte Level_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the list item field values for the list item corresponding to the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("ListItemAllFields")]
        public SP.ListItem ListItemAllFields_ { set; get; }
        /// <summary>
        /// <para>Gets a value that returns the user that owns the current lock on the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("LockedByUser")]
        public SP.User LockedByUser_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the major version of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("MajorVersion")]
        public Int32 MajorVersion_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the minor version of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("MinorVersion")]
        public Int32 MinorVersion_ { set; get; }
        /// <summary>
        /// <para>Gets a value that returns the user who last modified the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("ModifiedBy")]
        public SP.User ModifiedBy_ { set; get; }
        /// <summary>
        /// <para>Gets the name of the file including the extension.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("Name")]
        public String Name_ { set; get; }
        /// <summary>
        /// <para>Gets the relative URL of the file based on the URL for the server.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("ServerRelativeUrl")]
        public String ServerRelativeUrl_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies when the file was created.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("TimeCreated")]
        public DateTime TimeCreated_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies when the file was last modified.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("TimeLastModified")]
        public DateTime TimeLastModified_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the display name of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("Title")]
        public String Title_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the display name of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("TitleResource")]
        public SP.__deferred TitleResource_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the implementation-specific version identifier of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("UiVersion")]
        public Int32 UiVersion_ { set; get; }
        /// <summary>
        /// <para>Gets a value that specifies the implementation-specific version identifier of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:Yes</para>
        /// </summary>
        [JsonProperty("UiVersionLabel")]
        public String UiVersionLabel_ { set; get; }
        /// <summary>
        /// <para>Gets a value that returns a collection of file version objects that represent the versions of the file.</para>
        /// <para>R/W: R</para>
        /// <para>Returned with resource:No</para>
        /// </summary>
        [JsonProperty("Versions")]
        public SP.FileVersionCollection Versions_ { set; get; }
        /// <summary>
        /// <para> Endpoints </para>
        /// </summary>
        static string[] endpoints = {
            "http://<site url>/_api/web/getfilebyserverrelativeurl('/<folder name>/<file name>')",
        };

        public File(ExpandoObject expObj)
        {
             try
             {
                var use_EO = ((dynamic)expObj).entry.content.properties;
                HMS.SP.SPUtil.expando2obj(use_EO, this, typeof(File));
             }
             catch (Exception ex)
             {

             }

        }
        // used by Newtonsoft.JSON
        public  File()
        {
        }
        public  File(string json)
        {
            if( json == String.Empty )
                return;
            dynamic jobject = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
            dynamic refObj = jobject;
            if (jobject.d != null)
                refObj = jobject.d;
            string errInfo = "";
            if (refObj.results != null)
            {
                if (refObj.results.Count > 1)
                    errInfo = "Result is Collection, only 1. entry displayed.";
                refObj = refObj.results[0];
            }
            List<string> usedFields = new List<string>();
                usedFields.Add("__HMSError");
            HMS.SP.SPUtil.dyn_ValueSet("__HMSError", refObj, this);
                usedFields.Add("__deferred");
            this.__deferred_ = new SP.__deferred(HMS.SP.SPUtil.dyn_toString(refObj.__deferred));
                usedFields.Add("__metadata");
            this.__metadata_ = new SP.__metadata(HMS.SP.SPUtil.dyn_toString(refObj.__metadata));
                usedFields.Add("Author");
            this.Author_ = new SP.User(HMS.SP.SPUtil.dyn_toString(refObj.Author));
                usedFields.Add("CheckedOutByUser");
            this.CheckedOutByUser_ = new SP.User(HMS.SP.SPUtil.dyn_toString(refObj.CheckedOutByUser));
                usedFields.Add("CheckInComment");
            HMS.SP.SPUtil.dyn_ValueSet("CheckInComment", refObj, this);
                usedFields.Add("CheckOutType");
            HMS.SP.SPUtil.dyn_ValueSet("CheckOutType", refObj, this);
                usedFields.Add("ContentTag");
            HMS.SP.SPUtil.dyn_ValueSet("ContentTag", refObj, this);
                usedFields.Add("CustomizedPageStatus");
            HMS.SP.SPUtil.dyn_ValueSet("CustomizedPageStatus", refObj, this);
                usedFields.Add("ETag");
            HMS.SP.SPUtil.dyn_ValueSet("ETag", refObj, this);
                usedFields.Add("Exists");
            HMS.SP.SPUtil.dyn_ValueSet("Exists", refObj, this);
                usedFields.Add("Length");
            HMS.SP.SPUtil.dyn_ValueSet("Length", refObj, this);
                usedFields.Add("Level");
            HMS.SP.SPUtil.dyn_ValueSet("Level", refObj, this);
                usedFields.Add("ListItemAllFields");
            this.ListItemAllFields_ = new SP.ListItem(HMS.SP.SPUtil.dyn_toString(refObj.ListItemAllFields));
                usedFields.Add("LockedByUser");
            this.LockedByUser_ = new SP.User(HMS.SP.SPUtil.dyn_toString(refObj.LockedByUser));
                usedFields.Add("MajorVersion");
            HMS.SP.SPUtil.dyn_ValueSet("MajorVersion", refObj, this);
                usedFields.Add("MinorVersion");
            HMS.SP.SPUtil.dyn_ValueSet("MinorVersion", refObj, this);
                usedFields.Add("ModifiedBy");
            this.ModifiedBy_ = new SP.User(HMS.SP.SPUtil.dyn_toString(refObj.ModifiedBy));
                usedFields.Add("Name");
            HMS.SP.SPUtil.dyn_ValueSet("Name", refObj, this);
                usedFields.Add("ServerRelativeUrl");
            HMS.SP.SPUtil.dyn_ValueSet("ServerRelativeUrl", refObj, this);
                usedFields.Add("TimeCreated");
            HMS.SP.SPUtil.dyn_ValueSet("TimeCreated", refObj, this);
                usedFields.Add("TimeLastModified");
            HMS.SP.SPUtil.dyn_ValueSet("TimeLastModified", refObj, this);
                usedFields.Add("Title");
            HMS.SP.SPUtil.dyn_ValueSet("Title", refObj, this);
                usedFields.Add("TitleResource");
            this.TitleResource_ = new SP.__deferred(HMS.SP.SPUtil.dyn_toString(refObj.TitleResource));
                usedFields.Add("UiVersion");
            HMS.SP.SPUtil.dyn_ValueSet("UiVersion", refObj, this);
                usedFields.Add("UiVersionLabel");
            HMS.SP.SPUtil.dyn_ValueSet("UiVersionLabel", refObj, this);
                usedFields.Add("Versions");
            this.Versions_ = new SP.FileVersionCollection(HMS.SP.SPUtil.dyn_toString(refObj.Versions));
            this.__rest = new Dictionary<string, string>();
            var dyn = ((Newtonsoft.Json.Linq.JContainer)refObj).First;
            while (dyn != null)
            {
                string Name = ((Newtonsoft.Json.Linq.JProperty)dyn).Name;
                string Value = ((Newtonsoft.Json.Linq.JProperty)dyn).Value.ToString();
                if ( !usedFields.Contains( Name ))
                    this.__rest.Add( Name, Value);
                dyn = dyn.Next;
            }
            if( errInfo != "")
                this.__HMSError_.info = errInfo;
        }
    }
}


text:
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.chrome.browser.browserservices;

import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.browser.customtabs.CustomTabsSessionToken;

import org.chromium.base.ContextUtils;
import org.chromium.base.PackageUtils;
import org.chromium.base.Promise;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.browserservices.constants.QualityEnforcementViolationType;
import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.browserservices.metrics.TrustedWebActivityUmaRecorder;
import org.chromium.chrome.browser.browserservices.ui.controller.Verifier;
import org.chromium.chrome.browser.browserservices.ui.controller.trustedwebactivity.ClientPackageNameProvider;
import org.chromium.chrome.browser.customtabs.CustomTabsConnection;
import org.chromium.chrome.browser.customtabs.content.TabObserverRegistrar;
import org.chromium.chrome.browser.customtabs.content.TabObserverRegistrar.CustomTabTabObserver;
import org.chromium.chrome.browser.dependency_injection.ActivityScope;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.content_public.browser.NavigationHandle;
import org.chromium.content_public.browser.RenderFrameHost;
import org.chromium.net.NetError;
import org.chromium.ui.widget.Toast;
import org.chromium.url.GURL;

import java.util.List;

import javax.inject.Inject;

/**
 * This class enforces a quality bar on the websites shown inside Trusted Web Activities. For
 * example triggering if a link from a page on the verified origin 404s.
 *
 * The current plan for when QualityEnforcer is triggered is to finish Chrome and send a signal
 * back to the TWA shell, causing it to crash. The purpose of this is to bring TWAs in line with
 * native applications - if a native application tries to start an Activity that doesn't exist, it
 * will crash. We should hold web apps to the same standard.
 */
@ActivityScope
public class QualityEnforcer {
    @VisibleForTesting
    static final String CRASH = "quality_enforcement.crash";
    @VisibleForTesting
    static final String KEY_CRASH_REASON = "crash_reason";
    @VisibleForTesting
    static final String KEY_SUCCESS = "success";

    private final Activity mActivity;
    private final Verifier mVerifier;
    private final CustomTabsConnection mConnection;
    private final CustomTabsSessionToken mSessionToken;
    private final ClientPackageNameProvider mClientPackageNameProvider;
    private final BrowserServicesIntentDataProvider mIntentDataProvider;
    private final TrustedWebActivityUmaRecorder mUmaRecorder;

    private boolean mFirstNavigationFinished;
    private boolean mOriginVerified;

    private final CustomTabTabObserver mTabObserver = new CustomTabTabObserver() {
        @Override
        public void onDidFinishNavigationInPrimaryMainFrame(Tab tab, NavigationHandle navigation) {
            if (!navigation.hasCommitted() || navigation.isSameDocument()) {
                return;
            }

            if (!mFirstNavigationFinished) {
                String loadUrl = mIntentDataProvider.getUrlToLoad();
                mFirstNavigationFinished = true;
                mVerifier.verify(loadUrl).then((verified) -> {
                    if (!verified) {
                        trigger(tab, QualityEnforcementViolationType.DIGITAL_ASSET_LINK,
                                mIntentDataProvider.getUrlToLoad(), 0);
                    }
                });
            }

            GURL newUrl = tab.getOriginalUrl();
            if (isNavigationInScope(newUrl)) {
                if (navigation.httpStatusCode() == 404) {
                    trigger(tab, QualityEnforcementViolationType.HTTP_ERROR404, newUrl.getSpec(),
                            navigation.httpStatusCode());
                } else if (navigation.httpStatusCode() >= 500
                        && navigation.httpStatusCode() <= 599) {
                    trigger(tab, QualityEnforcementViolationType.HTTP_ERROR5XX, newUrl.getSpec(),
                            navigation.httpStatusCode());
                } else if (navigation.errorCode() == NetError.ERR_INTERNET_DISCONNECTED) {
                    trigger(tab, QualityEnforcementViolationType.UNAVAILABLE_OFFLINE,
                            newUrl.getSpec(), navigation.httpStatusCode());
                }
            }
        }

        @Override
        public void onDidFinishNavigationNoop(Tab tab, NavigationHandle navigation) {
            if (!navigation.isInPrimaryMainFrame()) return;
        }

        @Override
        public void onObservingDifferentTab(@NonNull Tab tab) {
            // On tab switches, update the stored verification state.
            isNavigationInScope(tab.getOriginalUrl());
        }
    };

    @Inject
    public QualityEnforcer(Activity activity, ActivityLifecycleDispatcher lifecycleDispatcher,
            TabObserverRegistrar tabObserverRegistrar,
            BrowserServicesIntentDataProvider intentDataProvider, CustomTabsConnection connection,
            Verifier verifier, ClientPackageNameProvider clientPackageNameProvider,
            TrustedWebActivityUmaRecorder umaRecorder) {
        mActivity = activity;
        mVerifier = verifier;
        mSessionToken = intentDataProvider.getSession();
        mIntentDataProvider = intentDataProvider;
        mConnection = connection;
        mClientPackageNameProvider = clientPackageNameProvider;
        mUmaRecorder = umaRecorder;
        // Initialize the value to true before the first navigation.
        mOriginVerified = true;
        tabObserverRegistrar.registerActivityTabObserver(mTabObserver);
    }

    private void trigger(
            Tab tab, @QualityEnforcementViolationType int type, String url, int httpStatusCode) {
        mUmaRecorder.recordQualityEnforcementViolation(tab.getWebContents(), type);

        if (ChromeFeatureList.isEnabled(
                    ChromeFeatureList.TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_WARNING)) {
            showErrorToast(getToastMessage(type, url, httpStatusCode));

            if (tab.getWebContents() != null) {
                String packageName = null;
                String signature = null;
                // Only get the package name and signature when violation type is
                // DIGITAL_ASSET_LINK. This is because computing the fingerprint is expensive.
                // We should figure out how to reuse the existing one in OriginVerifier.
                if (type == QualityEnforcementViolationType.DIGITAL_ASSET_LINK) {
                    packageName = mClientPackageNameProvider.get();
                    PackageManager pm = mActivity.getPackageManager();
                    List<String> signatures =
                            PackageUtils.getCertificateSHA256FingerprintForPackage(packageName);

                    // Sometimes information about the current package cannot be found - perhaps
                    // the user uninstalled the TWA while using it? See https://crbug.com/1358864.
                    if (signatures != null && signatures.size() > 0) {
                        signature = signatures.get(0);
                    }
                }

                QualityEnforcerJni.get().reportDevtoolsIssue(tab.getWebContents().getMainFrame(),
                        type, url, httpStatusCode, packageName, signature);
            }
        }

        if (!ChromeFeatureList.isEnabled(
                    ChromeFeatureList.TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT)) {
            return;
        }

        // Notify the client app.
        Bundle args = new Bundle();
        args.putString(KEY_CRASH_REASON, toTwaCrashMessage(type, url, httpStatusCode));
        Bundle result = mConnection.sendExtraCallbackWithResult(mSessionToken, CRASH, args);
        boolean success = result != null && result.getBoolean(KEY_SUCCESS);

        // Do not crash on assetlink failures if the client app does not have installer package
        // name.
        if (type == QualityEnforcementViolationType.DIGITAL_ASSET_LINK && !isDebugInstall()) {
            return;
        }

        if (ChromeFeatureList.isEnabled(
                    ChromeFeatureList.TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_FORCED)
                || success) {
            mUmaRecorder.recordQualityEnforcementViolationCrashed(type);
            mActivity.finish();
        }
    }

    private void showErrorToast(String message) {
        Context context = ContextUtils.getApplicationContext();
        PackageManager pm = context.getPackageManager();
        // Only shows the toast when the TWA client app does not have installer info, i.e. install
        // via adb instead of a store.
        if (!isDebugInstall()) {
            Toast.makeText(context, message, Toast.LENGTH_LONG).show();
        }
    }

    /*
     * Updates whether the current url is verified and returns whether the source and destination
     * are both on the verified origin.
     */
    private boolean isNavigationInScope(GURL newUrl) {
        if (newUrl.isEmpty()) return false;
        boolean wasVerified = mOriginVerified;
        // TODO(crbug/783819): Migrate Verifier to GURL.
        Promise<Boolean> result = mVerifier.verify(newUrl.getSpec());
        mOriginVerified = !result.isFulfilled() || result.getResult();
        return wasVerified && mOriginVerified;
    }

    /* Get the localized string for toast message. */
    private String getToastMessage(
            @QualityEnforcementViolationType int type, String url, int httpStatusCode) {
        switch (type) {
            case QualityEnforcementViolationType.HTTP_ERROR404:
            case QualityEnforcementViolationType.HTTP_ERROR5XX:
                return ContextUtils.getApplicationContext().getString(
                        R.string.twa_quality_enforcement_violation_error, httpStatusCode, url);
            case QualityEnforcementViolationType.UNAVAILABLE_OFFLINE:
                return ContextUtils.getApplicationContext().getString(
                        R.string.twa_quality_enforcement_violation_offline, url);
            case QualityEnforcementViolationType.DIGITAL_ASSET_LINK:
                return ContextUtils.getApplicationContext().getString(
                        R.string.twa_quality_enforcement_violation_asset_link, url);
            default:
                return "";
        }
    }

    /*
     * Get the string for sending message to TWA client app. We are not using the localized one as
     * the toast because this is used in TWA's crash message.
     */
    private String toTwaCrashMessage(
            @QualityEnforcementViolationType int type, String url, int httpStatusCode) {
        switch (type) {
            case QualityEnforcementViolationType.HTTP_ERROR404:
            case QualityEnforcementViolationType.HTTP_ERROR5XX:
                return httpStatusCode + " on " + url;
            case QualityEnforcementViolationType.UNAVAILABLE_OFFLINE:
                return "Page unavailable offline: " + url;
            case QualityEnforcementViolationType.DIGITAL_ASSET_LINK:
                return "Digital asset links verification failed on " + url;
            default:
                return "";
        }
    }

    private boolean isDebugInstall() {
        // TODO(crbug.com/1136153) Need to figure out why the client package name can be null.
        if (mClientPackageNameProvider.get() == null) return false;

        return ContextUtils.getApplicationContext().getPackageManager().getInstallerPackageName(
                       mClientPackageNameProvider.get())
                != null;
    }

    @NativeMethods
    interface Natives {
        void reportDevtoolsIssue(RenderFrameHost renderFrameHost, int type, String url,
                int httpStatusCode, String packageName, String signature);
    }
}


text:
CMasternodeConfig masternodeConfig;

void CMasternodeConfig::add(const std::string& alias, const std::string& ip, const std::string& privKey, const std::string& txHash, const std::string& outputIndex) {
    CMasternodeEntry cme(alias, ip, privKey, txHash, outputIndex);
    entries.push_back(cme);
}

bool CMasternodeConfig::read(std::string& strErrRet) {
    int linenumber = 1;
    const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN);
    fs::path pathMasternodeConfigFile = GetConfigFile(gArgs.GetArg("-mnconf", MASTERNODE_CONF_FILENAME));
    fs::ifstream streamConfig(pathMasternodeConfigFile);

    if (!streamConfig.good()) {
        FILE* configFile = fopen(pathMasternodeConfigFile.string().c_str(), "a");
        if (configFile != nullptr) {
            std::string strHeader = "# Masternode config file\n"
                          "# Format: alias IP:port masternodeprivkey collateral_output_txid collateral_output_index\n"
                          "# Example: mn1 127.0.0.2:11994 93HaYBVUCYjEMeeH1Y4sBGLALQZE1Yc1K64xiqgX37tGBDQL8Xg 2bcd3c84c84f87eaa86e4e56834c92927a07f9e18718810b92e0d0324456a67c 0\n";
            fwrite(strHeader.c_str(), std::strlen(strHeader.c_str()), 1, configFile);
            fclose(configFile);
        }
        return true; // Nothing to read, so just return
    }

    for(std::string line; std::getline(streamConfig, line); linenumber++)
    {
        if (line.empty()) continue;

        std::istringstream iss(line);
        std::string comment, alias, ip, privKey, txHash, outputIndex;

        if (iss >> comment) {
            if (comment.at(0) == '#') continue;
            iss.str(line);
            iss.clear();
        }

        if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) {
            iss.str(line);
            iss.clear();
            if (!(iss >> alias >> ip >> privKey >> txHash >> outputIndex)) {
                strErrRet = _("Could not parse masternode.conf") + "\n" +
                        strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"";
                streamConfig.close();
                return false;
            }
        }

        int port = 0;
        std::string hostname = "";
        SplitHostPort(ip, port, hostname);
        if (port == 0 || hostname == "") {
            strErrRet = _("Failed to parse host:port string") + "\n"+
                    strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"";
            streamConfig.close();
            return false;
        }
        int mainnetDefaultPort = defaultChainParams->GetDefaultPort();
        if (Params().NetworkIDString() == CBaseChainParams::MAIN) {
            if (port != mainnetDefaultPort) {
                strErrRet = _("Invalid port detected in masternode.conf") + "\n" +
                        strprintf(_("Port: %d"), port) + "\n" +
                        strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" +
                        strprintf(_("(must be %d for mainnet)"), mainnetDefaultPort);
                streamConfig.close();
                return false;
            }
        } else if (port == mainnetDefaultPort) {
            strErrRet = _("Invalid port detected in masternode.conf") + "\n" +
                    strprintf(_("Line: %d"), linenumber) + "\n\"" + line + "\"" + "\n" +
                    strprintf(_("(%d could be used only on mainnet)"), mainnetDefaultPort);
            streamConfig.close();
            return false;
        }

        add(alias, ip, privKey, txHash, outputIndex);
    }

    streamConfig.close();
    return true;
}


text:
package jp.co.opentone.bsol.linkbinder.view.servlet;

import static org.junit.Assert.*;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;

/**
 * @author opentone
 */
public class MockPrintWriter extends PrintWriter {
    private static int RET_TESTCASE;

    /**
     * @param out
     */
    public MockPrintWriter(Writer out) {
        super(out);
    }

    /**
     * @param out
     */
    public MockPrintWriter(OutputStream out) {
        super(out);
    }

    /**
     * @param fileName
     * @throws FileNotFoundException
     */
    public MockPrintWriter(String fileName) throws FileNotFoundException {
        super(fileName);
        MockPrintWriter.RET_TESTCASE = Integer.valueOf(fileName);
    }

    /**
     * @param file
     * @throws FileNotFoundException
     */
    public MockPrintWriter(File file) throws FileNotFoundException {
        super(file);
    }

    /**
     * @param out
     * @param autoFlush
     */
    public MockPrintWriter(Writer out, boolean autoFlush) {
        super(out, autoFlush);
    }

    /**
     * @param out
     * @param autoFlush
     */
    public MockPrintWriter(OutputStream out, boolean autoFlush) {
        super(out, autoFlush);
    }

    /**
     * @param fileName
     * @param csn
     * @throws FileNotFoundException
     * @throws UnsupportedEncodingException
     */
    public MockPrintWriter(String fileName, String csn) throws FileNotFoundException,
        UnsupportedEncodingException {
        super(fileName, csn);
    }

    /**
     * @param file
     * @param csn
     * @throws FileNotFoundException
     * @throws UnsupportedEncodingException
     */
    public MockPrintWriter(File file, String csn) throws FileNotFoundException,
        UnsupportedEncodingException {
        super(file, csn);
    }

    /**
     *
     */
    @Override
    public void println(String statement) {
        switch (RET_TESTCASE) {
        case 1:
            assertEquals("paramerter error : maked time", statement);
            break;
        case 2:
            assertEquals("paramerter error : hash code", statement);
            break;
        case 3:
            assertEquals("paramerter error : no value", statement);
            break;
        case 4:
            assertEquals("paramerter error : no value", statement);
            break;
        case 5:
            assertEquals("paramerter error : no value", statement);
            break;
        case 6:
            assertEquals("paramerter error : no value", statement);
            break;
        }
    }
    /**
     *
     */
    @Override
    public void println(int i) {
        switch (RET_TESTCASE) {
        case 7:
            assertEquals(i,0);
            break;
        case 8:
            assertEquals(i,0);
            break;
        }
    }

}


text:
#include "TTClassWrapperMax.h"
#include "ext.h"						// Max Header
#include "z_dsp.h"						// MSP Header
#include "ext_strings.h"				// String Functions
#include "commonsyms.h"					// Common symbols used by the Max 4.5 API
#include "ext_obex.h"					// Max Object Extensions (attributes) Header

#include "TTDSP.h"
#define MAX_NUM_CHANNELS 32

// Data Structure for this object
typedef struct _gain{
	t_pxobject 		obj;
	TTAudioObject*	xfade;				// crossfade object from the ttblue library
	TTAudioObject*	gain;				// gain control object the ttblue library
	TTAudioSignal*	signalIn;
	TTAudioSignal*	signalOut;
	TTAudioSignal*	signalTemp;
	TTUInt16		numChannels;
	char			attrBypass;			// toggle 1 = bypass
	float			attrMix;			// mix in %
	float			attrGain;			// gain in midi units
} t_gain;

// Prototypes for methods
void*		gain_new(t_symbol *s, long argc, t_atom *argv);					// New Object Creation Method
void		gain_free(t_gain *x);											// Object Deletion Method
void		gain_dsp(t_gain *x, t_signal **sp, short *count);				// DSP Method
void		gain_dsp64(t_gain *x, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags); // DSP64 Method
void		gain_assist(t_gain *x, void *b, long m, long a, char *s);		// Assistance Method
t_int*		gain_perform(t_int *w);											// MSP Perform Method
t_max_err	attr_set_gain(t_gain *x, void *attr, long argc, t_atom *argv);
t_max_err	attr_set_mix(t_gain *x, void *attr, long argc, t_atom *argv);
t_max_err	attr_set_bypass(t_gain *x, void *attr, long argc, t_atom *argv);

// Globals
static t_class*	s_gain_class;

/************************************************************************************/
// Define our class

int TTCLASSWRAPPERMAX_EXPORT main(void)
{
	t_class *c;

	TTDSPInit();
	common_symbols_init();

	c = class_new("jcom.gain~", (method)gain_new, (method)gain_free, sizeof(t_gain), (method)0L, A_GIMME, 0);

	// Make methods accessible for our class:
	class_addmethod(c, (method)gain_dsp, 				"dsp", A_CANT, 0L);
	class_addmethod(c, (method)gain_dsp64,				"dsp64", A_CANT, 0);
    class_addmethod(c, (method)object_obex_dumpout, 	"dumpout", A_CANT,0);
    class_addmethod(c, (method)gain_assist, 			"assist", A_CANT, 0L);

	CLASS_ATTR_CHAR(c,		"bypass",	0,		t_gain,	attrBypass);
	CLASS_ATTR_ACCESSORS(c,	"bypass",	NULL,	attr_set_bypass);

	CLASS_ATTR_FLOAT(c,		"mix",		0,		t_gain,	attrBypass);
	CLASS_ATTR_ACCESSORS(c,	"mix",		NULL,	attr_set_mix);

	CLASS_ATTR_FLOAT(c,		"gain",		0,		t_gain,	attrBypass);
	CLASS_ATTR_ACCESSORS(c,	"gain",		NULL,	attr_set_gain);

	// Setup our class to work with MSP
	class_dspinit(c);

	// Finalize our class
	class_register(CLASS_BOX, c);
	s_gain_class = c;
	return 0;
}

/************************************************************************************/
// Object Life

// Create
void* gain_new(t_symbol* s, long argc, t_atom* argv)
{
	long	attrstart = attr_args_offset(argc, argv);		// support normal arguments
	short	i;
	t_gain*	x = (t_gain*)object_alloc(s_gain_class);

	if(x){
		object_obex_store((void*)x, _sym_dumpout, (object*)outlet_new(x, NULL));	// dumpout

		x->numChannels = 1;
		if(attrstart && argv){
			int argument = atom_getlong(argv);
			x->numChannels = TTClip(argument, 1, MAX_NUM_CHANNELS);
		}

		dsp_setup((t_pxobject*)x, x->numChannels * 2);			// Create Object and Inlets
		x->obj.z_misc = Z_NO_INPLACE;							// ESSENTIAL!
		for(i=0; i < x->numChannels; i++)
			outlet_new((t_pxobject*)x, "signal");				// Create a signal Outlet

		//x->xfade = new TTCrossfade(x->numChannels);				// Constructors
		//x->gain = new TTGain(x->numChannels);
		TTObjectInstantiate(TT("crossfade"), &x->xfade, x->numChannels);
		TTObjectInstantiate(TT("gain"), &x->gain, x->numChannels);
		TTObjectInstantiate(kTTSym_audiosignal, &x->signalTemp, x->numChannels);
		TTObjectInstantiate(kTTSym_audiosignal, &x->signalOut, x->numChannels);
		TTObjectInstantiate(kTTSym_audiosignal, &x->signalIn, x->numChannels*2);
		//x->signalTemp = new TTAudioSignal(x->numChannels);
		//x->signalOut = new TTAudioSignal(x->numChannels);
		//x->signalIn = new TTAudioSignal(x->numChannels*2);

		x->xfade->setAttributeValue(TT("position"), 1.0);		// defaults
		x->gain->setAttributeValue(TT("linearGain"), 0.0);

		x->attrBypass = 0;
		x->attrGain = 0;

		attr_args_process(x, argc, argv);						// handle attribute args
	}
	return (x);													// Return the pointer
}

// Destroy
void gain_free(t_gain *x)
{
	dsp_free((t_pxobject *)x);		// Always call dsp_free first in this routine
	TTObjectRelease(&x->xfade);
	TTObjectRelease(&x->gain);
	TTObjectRelease(&x->signalTemp);
	TTObjectRelease(&x->signalOut);
	TTObjectRelease(&x->signalIn);
}

/************************************************************************************/
// Methods bound to input/inlets

// Method for Assistance Messages
void gain_assist(t_gain *x, void *b, long msg, long arg, char *dst)
{
	if(msg==1){ 	// Inlets
		if(arg == 0)
			snprintf(dst, 256, "(signal) raw audio (ch. %ld), control messages", arg+1);
		else if(arg < x->numChannels)
			snprintf(dst, 256, "(signal) raw audio (ch. %ld)", arg+1);
		else if(arg >= x->numChannels)
			snprintf(dst, 256, "(signal) wet audio (ch. %ld)", arg-x->numChannels+1);
	}
	else if(msg==2) {// Outlets
		if(arg == x->numChannels)
			strcpy(dst, "dumpout");
		else
			snprintf(dst, 256, "(signal) processed audio (ch. %ld)", arg+1);
	}
}

// ATTRIBUTE: gain
t_max_err attr_set_gain(t_gain *x, void *attr, long argc, t_atom *argv)
{
	x->attrGain = atom_getfloat(argv);
	x->gain->setAttributeValue(TT("midiGain"), x->attrGain);
	return MAX_ERR_NONE;
}

// ATTRIBUTE: mix
t_max_err attr_set_mix(t_gain *x, void *attr, long argc, t_atom *argv)
{
	x->attrMix = atom_getfloat(argv);
	if(x->attrBypass == 0)
		x->xfade->setAttributeValue(TT("position"), x->attrMix * 0.01);
	return MAX_ERR_NONE;
}

// ATTRIBUTE: bypass
t_max_err attr_set_bypass(t_gain *x, void *attr, long argc, t_atom *argv)
{
	x->attrBypass = atom_getlong(argv);
	if(x->attrBypass == 0)
		x->xfade->setAttributeValue(TT("position"), x->attrMix * 0.01);
	else
		x->xfade->setAttributeValue(TT("position"), 0.0);
	return MAX_ERR_NONE;
}

// Perform Method
t_int* gain_perform(t_int *w)
{
	t_gain*		x = (t_gain *)(w[1]);
	short		i, j;
	TTUInt16	numChannels = x->signalOut->getNumChannelsAsInt();
	TTUInt16	vs = x->signalIn->getVectorSizeAsInt();

	// We sort audioIn so that all channels of signalA comes first, then all channels of signalB
	for(i=0; i < numChannels; i++){
		j = (i*3) + 1;
		x->signalIn->setVector(i, vs, (t_float*)(w[j+1]));
		x->signalIn->setVector(i+numChannels, vs, (t_float*)(w[j+2]));
	}

	if(!x->obj.z_disabled){								// if we are not muted...
		x->xfade->process(x->signalIn, x->signalTemp);	// perform bypass and/or mix operation on processed input
		x->gain->process(x->signalTemp, x->signalOut);	// perform gain boost/cut on processed/bypassed input
	}

	for(i=0; i < numChannels; i++){
		j = (i*3) + 1;
		x->signalOut->getVector(i, vs, (t_float*)(w[j+3]));
	}

	return w + ((numChannels*3)+2);				// +2 = +1 for the x pointer and +1 to point to the next object
}

// DSP Method
void gain_dsp(t_gain *x, t_signal **sp, short *count)
{
	short		i, j, k, l=0;
	void**		audioVectors = NULL;
	TTUInt16	numChannels = 0;
	TTUInt16	vs = 0;

	audioVectors = (void**)sysmem_newptr(sizeof(void*) * ((x->numChannels * 3) + 1));
	audioVectors[l] = x;
	l++;

	// audioVectors[] passed to gain_perform() as:
	//	{x, audioInL[0], audioInR[0], audioOut[0], audioInL[1], audioInR[1], audioOut[1],...}
	for(i=0; i < x->numChannels; i++){
		j = x->numChannels + i;
		k = x->numChannels*2 + i;
		if(count[i] && count[j] && count[k]){
			numChannels++;
			if(sp[i]->s_n > vs)
				vs = sp[i]->s_n;

			audioVectors[l] = sp[i]->s_vec;
			l++;
			audioVectors[l] = sp[j]->s_vec;
			l++;
			audioVectors[l] = sp[k]->s_vec;
			l++;
		}
	}

	x->signalIn->setNumChannels(TTUInt16(numChannels*2));
	x->signalOut->setNumChannels(numChannels);
	x->signalTemp->setNumChannels(numChannels);

	x->signalIn->setVectorSizeWithInt(vs);
	x->signalOut->setVectorSizeWithInt(vs);
	x->signalTemp->setVectorSizeWithInt(vs);

	//signalIn will be set in the perform method
	x->signalOut->alloc();
	x->signalTemp->alloc();

	x->xfade->setAttributeValue(kTTSym_sampleRate, sp[0]->s_sr);
	x->gain->setAttributeValue(kTTSym_sampleRate, sp[0]->s_sr);
	x->gain->setAttributeValue(TT("interpolated"), true);

	dsp_addv(gain_perform, l, audioVectors);
	sysmem_freeptr(audioVectors);
}

void gain_perform64(t_gain *x, t_object *dsp64, double **ins, long numins, double **outs, long numouts, long sampleframes, long flags, void *userparam)
{
	short		i;
	TTUInt16	vs = x->signalIn->getVectorSizeAsInt();

	// We sort audioIn so that all channels of signalA comes first, then all channels of signalB
	for(i=0; i < numouts; i++){
		x->signalIn->setVector(i, vs, ins[i]);
		x->signalIn->setVector(i+numouts, vs, ins[i+numouts]);
	}

	//if(!x->obj.z_disabled){								// Max6 takes care of the muting now
		x->xfade->process(x->signalIn, x->signalTemp);	// perform bypass and/or mix operation on processed input
		x->gain->process(x->signalTemp, x->signalOut);	// perform gain boost/cut on processed/bypassed input

	//}

	for(i=0; i < numouts; i++)
		x->signalOut->getVectorCopy(i, vs, outs[i]); //getVector doesn't seem to work
}

void gain_dsp64(t_gain *x, t_object *dsp64, short *count, double samplerate, long maxvectorsize, long flags)
{
	short		i, k, j;
	TTUInt16	numChannels = 0;

	for (i=0; i < x->numChannels; i++) {
		j = x->numChannels + i;
		k = x->numChannels*2 + i;
		if (count[i] && count[j] && count[k]) {
			numChannels++;
		}
	}

	x->signalIn->setNumChannels(numChannels*2);
	x->signalOut->setNumChannels(numChannels);
	x->signalTemp->setNumChannels(numChannels);

	x->signalIn->setVectorSizeWithInt((TTUInt16)maxvectorsize);
	x->signalOut->setVectorSizeWithInt((TTUInt16)maxvectorsize);
	x->signalTemp->setVectorSizeWithInt((TTUInt16)maxvectorsize);

	//signalIn will be set in the perform method
	x->signalOut->alloc();
	x->signalTemp->alloc();

	x->xfade->setAttributeValue(kTTSym_sampleRate, samplerate);
	x->gain->setAttributeValue(kTTSym_sampleRate, samplerate);
	x->gain->setAttributeValue(TT("interpolated"), true);
	object_method(dsp64, gensym("dsp_add64"), x, gain_perform64, 0, NULL);

}


text:
package edu.cmu.cs.stage3.alice.scenegraph;

/**
 * @author Dennis Cosgrove
 */
public class Text extends Geometry {
	public static final Property TEXT_PROPERTY = new Property( Text.class, "TEXT" );
	public static final Property FONT_PROPERTY = new Property( Text.class, "FONT" );
	public static final Property EXTRUSION_PROPERTY = new Property( Text.class, "EXTRUSION" );
	private String m_text = null;
	private java.awt.Font m_font = null;
	private javax.vecmath.Vector3d m_extrusion = new javax.vecmath.Vector3d( 0, 0, 1 );

	public String getText() {
		return m_text;
	}
	public void setText( String text ) {
		if( notequal( m_text, text ) ) {
			m_text = text;
			onPropertyChange( TEXT_PROPERTY );
		}
	}
	public java.awt.Font getFont() {
		return m_font;
	}
	public void setFont( java.awt.Font font ) {
		if( notequal( m_font, font ) ) {
			m_font = font;
			onPropertyChange( FONT_PROPERTY );
		}
	}
	//todo javax.vecmath.Vector3d->spline
	public javax.vecmath.Vector3d getExtrusion() {
		return m_extrusion;
	}
	public void setExtrusion( javax.vecmath.Vector3d extrusion ) {
		if( notequal( m_extrusion, extrusion ) ) {
			m_extrusion = extrusion;
			onPropertyChange( EXTRUSION_PROPERTY );
		}
	}
	protected void updateBoundingBox() {
		//todo
	}
	protected void updateBoundingSphere() {
		//todo
	}
	public void transform( javax.vecmath.Matrix4d trans ) {
		//todo
	}
}


text:
#pragma once
#include <aws/mediaconvert/MediaConvert_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace MediaConvert
{
namespace Model
{

  /**
   * Specify the details for each additional Microsoft Smooth Streaming manifest that
   * you want the service to generate for this output group. Each manifest can
   * reference a different subset of outputs in the group.

See Also:
   AWS
   * API Reference

   */
  class AWS_MEDIACONVERT_API MsSmoothAdditionalManifest
  {
  public:
    MsSmoothAdditionalManifest();
    MsSmoothAdditionalManifest(Aws::Utils::Json::JsonView jsonValue);
    MsSmoothAdditionalManifest& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline const Aws::String& GetManifestNameModifier() const{ return m_manifestNameModifier; }

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline bool ManifestNameModifierHasBeenSet() const { return m_manifestNameModifierHasBeenSet; }

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline void SetManifestNameModifier(const Aws::String& value) { m_manifestNameModifierHasBeenSet = true; m_manifestNameModifier = value; }

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline void SetManifestNameModifier(Aws::String&& value) { m_manifestNameModifierHasBeenSet = true; m_manifestNameModifier = std::move(value); }

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline void SetManifestNameModifier(const char* value) { m_manifestNameModifierHasBeenSet = true; m_manifestNameModifier.assign(value); }

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline MsSmoothAdditionalManifest& WithManifestNameModifier(const Aws::String& value) { SetManifestNameModifier(value); return *this;}

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline MsSmoothAdditionalManifest& WithManifestNameModifier(Aws::String&& value) { SetManifestNameModifier(std::move(value)); return *this;}

    /**
     * Specify a name modifier that the service adds to the name of this manifest to
     * make it different from the file names of the other main manifests in the output
     * group. For example, say that the default main manifest for your Microsoft Smooth
     * group is film-name.ismv. If you enter "-no-premium" for this setting, then the
     * file name the service generates for this top-level manifest is
     * film-name-no-premium.ismv.
     */
    inline MsSmoothAdditionalManifest& WithManifestNameModifier(const char* value) { SetManifestNameModifier(value); return *this;}

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline const Aws::Vector<Aws::String>& GetSelectedOutputs() const{ return m_selectedOutputs; }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline bool SelectedOutputsHasBeenSet() const { return m_selectedOutputsHasBeenSet; }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline void SetSelectedOutputs(const Aws::Vector<Aws::String>& value) { m_selectedOutputsHasBeenSet = true; m_selectedOutputs = value; }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline void SetSelectedOutputs(Aws::Vector<Aws::String>&& value) { m_selectedOutputsHasBeenSet = true; m_selectedOutputs = std::move(value); }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline MsSmoothAdditionalManifest& WithSelectedOutputs(const Aws::Vector<Aws::String>& value) { SetSelectedOutputs(value); return *this;}

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline MsSmoothAdditionalManifest& WithSelectedOutputs(Aws::Vector<Aws::String>&& value) { SetSelectedOutputs(std::move(value)); return *this;}

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline MsSmoothAdditionalManifest& AddSelectedOutputs(const Aws::String& value) { m_selectedOutputsHasBeenSet = true; m_selectedOutputs.push_back(value); return *this; }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline MsSmoothAdditionalManifest& AddSelectedOutputs(Aws::String&& value) { m_selectedOutputsHasBeenSet = true; m_selectedOutputs.push_back(std::move(value)); return *this; }

    /**
     * Specify the outputs that you want this additional top-level manifest to
     * reference.
     */
    inline MsSmoothAdditionalManifest& AddSelectedOutputs(const char* value) { m_selectedOutputsHasBeenSet = true; m_selectedOutputs.push_back(value); return *this; }

  private:

    Aws::String m_manifestNameModifier;
    bool m_manifestNameModifierHasBeenSet = false;

    Aws::Vector<Aws::String> m_selectedOutputs;
    bool m_selectedOutputsHasBeenSet = false;
  };

} // namespace Model
} // namespace MediaConvert
} // namespace Aws


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <predicate lemma="prance">
        <note>
            Frames file for 'prance' based on sentences in wsj.  Verbnet entry
            51.3.2, Framenet entry Self motion.
        </note>

        <roleset id="prance.01" name="manner of motion" vncls="51.3.2">
            <roles>
                <role descr="entity in motion" n="0">
                    <vnrole vncls="51.3.2" vntheta="Theme"/>
                </role>
                <role descr="path" n="1">
                    <vnrole vncls="51.3.2" vntheta="Location"/>
                </role>
            </roles>

            <example name="the one example">
                <inflection aspect="ns" form="gerund" person="ns" tense="present" voice="active"/>
                <text>
                    Here she delivers, especially during her enthusiastically awful
                    rendition of the ``Candy Man,'' which she-21 sings while [*-21]
                    prancing around in a little cotton candy pink angora sweater that
                    couldn't be more perfect.
                </text>
                <arg n="0">[*-21]</arg>
                <rel>prancing</rel>
                <arg n="1">around</arg>
                <arg f="MNR" n="M">in a little cotton candy pink angora
                    sweater that couldn't be more perfect
                </arg>
            </example>

            <note>
            </note>

        </roleset>
    </predicate>
</frameset>


text:
/*	$NetBSD: postconf_unused.c,v 1.1.1.2 2014/07/06 19:27:53 tron Exp $	*/

/*++
/* NAME
/*	postconf_unused 3
/* SUMMARY
/*	report unused parameters
/* SYNOPSIS
/*	#include <postconf.h>
/*
/*	void    pcf_flag_unused_main_parameters()
/*
/*	void    pcf_flag_unused_master_parameters()
/* DESCRIPTION
/*	These functions must be called after all parameter information
/*	is initialized: built-ins, service-defined and user-defined.
/*	In other words, don't call these functions with "postconf
/*	-d" which ignores user-defined main.cf settings.
/*
/*	pcf_flag_unused_main_parameters() reports unused "name=value"
/*	entries in main.cf.
/*
/*	pcf_flag_unused_master_parameters() reports unused "-o
/*	name=value" entries in master.cf.
/* DIAGNOSTICS
/*	Problems are reported to the standard error stream.
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

/* System library. */

#include <sys_defs.h>

/* Utility library. */

#include <msg.h>
#include <dict.h>
#include <vstream.h>

/* Global library. */

#include <mail_params.h>
#include <mail_conf.h>

/* Application-specific. */

#include <postconf.h>

/* pcf_flag_unused_parameters - warn about unused parameters */

static void pcf_flag_unused_parameters(DICT *dict, const char *conf_name,
				               PCF_MASTER_ENT *local_scope)
{
    const char *myname = "pcf_flag_unused_parameters";
    const char *param_name;
    const char *param_value;
    int     how;

    /*
     * Sanity checks.
     */
    if (pcf_param_table == 0)
	msg_panic("%s: global parameter table is not initialized", myname);

    /*
     * Iterate over all entries, and flag parameter names that aren't used
     * anywhere. Show the warning message at the end of the output.
     */
    if (dict->sequence == 0)
	msg_panic("%s: parameter dictionary %s has no iterator",
		  myname, conf_name);
    for (how = DICT_SEQ_FUN_FIRST;
	 dict->sequence(dict, how, &param_name, &param_value) == 0;
	 how = DICT_SEQ_FUN_NEXT) {
	if (PCF_PARAM_TABLE_LOCATE(pcf_param_table, param_name) == 0
	    && (local_scope == 0
		|| PCF_PARAM_TABLE_LOCATE(local_scope->valid_names, param_name) == 0)) {
	    vstream_fflush(VSTREAM_OUT);
	    msg_warn("%s/%s: unused parameter: %s=%s",
		     var_config_dir, conf_name, param_name, param_value);
	}
    }
}

/* pcf_flag_unused_main_parameters - warn about unused parameters */

void    pcf_flag_unused_main_parameters(void)
{
    const char *myname = "pcf_flag_unused_main_parameters";
    DICT   *dict;

    /*
     * Iterate over all main.cf entries, and flag parameter names that aren't
     * used anywhere.
     */
    if ((dict = dict_handle(CONFIG_DICT)) == 0)
	msg_panic("%s: parameter dictionary %s not found",
		  myname, CONFIG_DICT);
    pcf_flag_unused_parameters(dict, MAIN_CONF_FILE, (PCF_MASTER_ENT *) 0);
}

/* pcf_flag_unused_master_parameters - warn about unused parameters */

void    pcf_flag_unused_master_parameters(void)
{
    const char *myname = "pcf_flag_unused_master_parameters";
    PCF_MASTER_ENT *masterp;
    DICT   *dict;

    /*
     * Sanity checks.
     */
    if (pcf_master_table == 0)
	msg_panic("%s: master table is not initialized", myname);

    /*
     * Iterate over all master.cf entries, and flag parameter names that
     * aren't used anywhere.
     */
    for (masterp = pcf_master_table; masterp->argv != 0; masterp++)
	if ((dict = masterp->all_params) != 0)
	    pcf_flag_unused_parameters(dict, MASTER_CONF_FILE, masterp);
}


text:
package com.simulator.model.state;

import com.simulator.model.tags.ExecType;
import com.simulator.model.tags.OrdType;
import com.simulator.model.tags.Side;

/**
 * Mutable structure that holds the state of an order.
 *
 * @author sunquan
 *
 */
public interface Order extends ReadOrder {
	void setMsgType(String msgType);

	void setSenderCompID(String senderCompID);

	void setTargetCompID(String targetCompID);

	void setOrderID(String ID);

	void setClOrdID(String clientID);

	void setOrigClOrdID(String origClientID);

	void setSymbol(String symbol);

	void setOrdStatus(ExecType status);

	void setTimeInForce(char tif);

	void setSide(Side side);

	void setOrdType(OrdType type);

	void setOrderQty(double qty);

	void setAvgPx(double price);

	void setPrice(Double price);

	void setCumQty(double cumQty);

	void setLeavesQty(double leavesQty);

	void setText(String text);

	void setTransactTime(String transactTime);
}


text:
namespace commands {

namespace {

// Prints the given directory in a nice way for the user to view.
std::string FormatSourceDir(const SourceDir& dir) {
#if defined(OS_WIN)
  // On Windows we fix up system absolute paths to look like native ones.
  // Internally, they'll look like "/C:\foo\bar/"
  if (dir.is_system_absolute()) {
    std::string buf = dir.value();
    if (buf.size() > 3 && buf[2] == ':') {
      buf.erase(buf.begin());  // Erase beginning slash.
      return buf;
    }
  }
#endif
  return dir.value();
}

void RecursiveCollectChildDeps(const Target* target, std::set<Label>* result);

void RecursiveCollectDeps(const Target* target, std::set<Label>* result) {
  if (result->find(target->label()) != result->end())
    return;  // Already did this target.
  result->insert(target->label());

  RecursiveCollectChildDeps(target, result);
}

void RecursiveCollectChildDeps(const Target* target, std::set<Label>* result) {
  const LabelTargetVector& deps = target->deps();
  for (size_t i = 0; i < deps.size(); i++)
    RecursiveCollectDeps(deps[i].ptr, result);

  const LabelTargetVector& datadeps = target->datadeps();
  for (size_t i = 0; i < datadeps.size(); i++)
    RecursiveCollectDeps(datadeps[i].ptr, result);
}

// Prints dependencies of the given target (not the target itself). If the
// set is non-null, new targets encountered will be added to the set, and if
// a dependency is in the set already, it will not be recused into. When the
// set is null, all dependencies will be printed.
void RecursivePrintDeps(const Target* target,
                        const Label& default_toolchain,
                        std::set<const Target*>* seen_targets,
                        int indent_level) {
  LabelTargetVector sorted_deps = target->deps();
  const LabelTargetVector& datadeps = target->datadeps();
  sorted_deps.insert(sorted_deps.end(), datadeps.begin(), datadeps.end());
  std::sort(sorted_deps.begin(), sorted_deps.end(),
            LabelPtrLabelLess<Target>());

  std::string indent(indent_level * 2, ' ');
  for (size_t i = 0; i < sorted_deps.size(); i++) {
    const Target* cur_dep = sorted_deps[i].ptr;

    // Don't print groups. Groups are flattened such that the deps of the
    // group are added directly to the target that depended on the group.
    // Printing and recursing into groups here will cause such targets to be
    // duplicated.
    //
    // It would be much more intuitive to do the opposite and not display the
    // deps that were copied from the group to the target and instead display
    // the group, but the source of those dependencies is not tracked.
    if (cur_dep->output_type() == Target::GROUP)
      continue;

    OutputString(indent +
        cur_dep->label().GetUserVisibleName(default_toolchain));
    bool print_children = true;
    if (seen_targets) {
      if (seen_targets->find(cur_dep) == seen_targets->end()) {
        // New target, mark it visited.
        seen_targets->insert(cur_dep);
      } else {
        // Already seen.
        print_children = false;
        // Only print "..." if something is actually elided, which means that
        // the current target has children.
        if (!cur_dep->deps().empty() || !cur_dep->datadeps().empty())
          OutputString("...");
      }
    }

    OutputString("\n");
    if (print_children) {
      RecursivePrintDeps(cur_dep, default_toolchain, seen_targets,
                         indent_level + 1);
    }
  }
}

void PrintDeps(const Target* target, bool display_header) {
  const CommandLine* cmdline = CommandLine::ForCurrentProcess();
  Label toolchain_label = target->label().GetToolchainLabel();

  // Tree mode is separate.
  if (cmdline->HasSwitch("tree")) {
    if (display_header)
      OutputString("\nDependency tree:\n");

    if (cmdline->HasSwitch("all")) {
      // Show all tree deps with no eliding.
      RecursivePrintDeps(target, toolchain_label, NULL, 1);
    } else {
      // Don't recurse into duplicates.
      std::set<const Target*> seen_targets;
      RecursivePrintDeps(target, toolchain_label, &seen_targets, 1);
    }
    return;
  }

  // Collect the deps to display.
  std::vector<Label> deps;
  if (cmdline->HasSwitch("all")) {
    if (display_header)
      OutputString("\nAll recursive dependencies:\n");

    std::set<Label> all_deps;
    RecursiveCollectChildDeps(target, &all_deps);
    for (std::set<Label>::iterator i = all_deps.begin();
         i != all_deps.end(); ++i)
      deps.push_back(*i);
  } else {
    if (display_header) {
      OutputString(
          "\nDirect dependencies "
          "(try also \"--all\", \"--tree\", or even \"--all --tree\"):\n");
    }

    const LabelTargetVector& target_deps = target->deps();
    for (size_t i = 0; i < target_deps.size(); i++)
      deps.push_back(target_deps[i].label);

    const LabelTargetVector& target_datadeps = target->datadeps();
    for (size_t i = 0; i < target_datadeps.size(); i++)
      deps.push_back(target_datadeps[i].label);
  }

  std::sort(deps.begin(), deps.end());
  for (size_t i = 0; i < deps.size(); i++)
    OutputString("  " + deps[i].GetUserVisibleName(toolchain_label) + "\n");
}

void PrintForwardDependentConfigsFrom(const Target* target,
                                      bool display_header) {
  if (target->forward_dependent_configs().empty())
    return;

  if (display_header)
    OutputString("\nforward_dependent_configs_from:\n");

  // Collect the sorted list of deps.
  std::vector<Label> forward;
  for (size_t i = 0; i < target->forward_dependent_configs().size(); i++)
    forward.push_back(target->forward_dependent_configs()[i].label);
  std::sort(forward.begin(), forward.end());

  Label toolchain_label = target->label().GetToolchainLabel();
  for (size_t i = 0; i < forward.size(); i++)
    OutputString("  " + forward[i].GetUserVisibleName(toolchain_label) + "\n");
}

// libs and lib_dirs are special in that they're inherited. We don't currently
// implement a blame feature for this since the bottom-up inheritance makes
// this difficult.
void PrintLibDirs(const Target* target, bool display_header) {
  const OrderedSet<SourceDir>& lib_dirs = target->all_lib_dirs();
  if (lib_dirs.empty())
    return;

  if (display_header)
    OutputString("\nlib_dirs\n");

  for (size_t i = 0; i < lib_dirs.size(); i++)
    OutputString("    " + FormatSourceDir(lib_dirs[i]) + "\n");
}

void PrintLibs(const Target* target, bool display_header) {
  const OrderedSet<std::string>& libs = target->all_libs();
  if (libs.empty())
    return;

  if (display_header)
    OutputString("\nlibs\n");

  for (size_t i = 0; i < libs.size(); i++)
    OutputString("    " + libs[i] + "\n");
}

void PrintPublic(const Target* target, bool display_header) {
  if (display_header)
    OutputString("\npublic:\n");

  if (target->all_headers_public()) {
    OutputString("  [All headers listed in the sources are public.]\n");
    return;
  }

  Target::FileList public_headers = target->public_headers();
  std::sort(public_headers.begin(), public_headers.end());
  for (size_t i = 0; i < public_headers.size(); i++)
    OutputString("  " + public_headers[i].value() + "\n");
}

void PrintVisibility(const Target* target, bool display_header) {
  if (display_header)
    OutputString("\nvisibility:\n");

  OutputString(target->visibility().Describe(2, false));
}

void PrintConfigsVector(const Target* target,
                        const LabelConfigVector& configs,
                        const std::string& heading,
                        bool display_header) {
  if (configs.empty())
    return;

  // Don't sort since the order determines how things are processed.
  if (display_header)
    OutputString("\n" + heading + " (in order applying):\n");

  Label toolchain_label = target->label().GetToolchainLabel();
  for (size_t i = 0; i < configs.size(); i++) {
    OutputString("  " +
        configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
  }
}

void PrintConfigsVector(const Target* target,
                        const UniqueVector<LabelConfigPair>& configs,
                        const std::string& heading,
                        bool display_header) {
  if (configs.empty())
    return;

  // Don't sort since the order determines how things are processed.
  if (display_header)
    OutputString("\n" + heading + " (in order applying):\n");

  Label toolchain_label = target->label().GetToolchainLabel();
  for (size_t i = 0; i < configs.size(); i++) {
    OutputString("  " +
        configs[i].label.GetUserVisibleName(toolchain_label) + "\n");
  }
}

void PrintConfigs(const Target* target, bool display_header) {
  PrintConfigsVector(target, target->configs().vector(), "configs",
                     display_header);
}

void PrintDirectDependentConfigs(const Target* target, bool display_header) {
  PrintConfigsVector(target, target->direct_dependent_configs(),
                     "direct_dependent_configs", display_header);
}

void PrintAllDependentConfigs(const Target* target, bool display_header) {
  PrintConfigsVector(target, target->all_dependent_configs(),
                     "all_dependent_configs", display_header);
}

void PrintFileList(const Target::FileList& files,
                   const std::string& header,
                   bool indent_extra,
                   bool display_header) {
  if (files.empty())
    return;

  if (display_header)
    OutputString("\n" + header + ":\n");

  std::string indent = indent_extra ? "    " : "  ";

  Target::FileList sorted = files;
  std::sort(sorted.begin(), sorted.end());
  for (size_t i = 0; i < sorted.size(); i++)
    OutputString(indent + sorted[i].value() + "\n");
}

void PrintSources(const Target* target, bool display_header) {
  PrintFileList(target->sources(), "sources", false, display_header);
}

void PrintInputs(const Target* target, bool display_header) {
  PrintFileList(target->inputs(), "inputs", false, display_header);
}

void PrintOutputs(const Target* target, bool display_header) {
  if (display_header)
    OutputString("\noutputs:\n");

  if (target->output_type() == Target::ACTION) {
    // Action, print out outputs, don't apply sources to it.
    for (size_t i = 0; i < target->action_values().outputs().list().size();
         i++) {
      OutputString("  " +
                   target->action_values().outputs().list()[i].AsString() +
                   "\n");
    }
  } else {
    const SubstitutionList& outputs = target->action_values().outputs();
    if (!outputs.required_types().empty()) {
      // Display the pattern and resolved pattern separately, since there are
      // subtitutions used.
      OutputString("  Output pattern:\n");
      for (size_t i = 0; i < outputs.list().size(); i++)
        OutputString("    " + outputs.list()[i].AsString() + "\n");

      // Now display what that resolves to given the sources.
      OutputString("\n  Resolved output file list:\n");
    }

    // Resolved output list.
    std::vector<SourceFile> output_files;
    SubstitutionWriter::ApplyListToSources(target->settings(), outputs,
                                           target->sources(), &output_files);
    PrintFileList(output_files, "", true, false);
  }
}

void PrintScript(const Target* target, bool display_header) {
  if (display_header)
    OutputString("\nscript:\n");
  OutputString("  " + target->action_values().script().value() + "\n");
}

void PrintArgs(const Target* target, bool display_header) {
  if (display_header)
    OutputString("\nargs:\n");
  for (size_t i = 0; i < target->action_values().args().list().size(); i++) {
    OutputString("  " +
                 target->action_values().args().list()[i].AsString() + "\n");
  }
}

void PrintDepfile(const Target* target, bool display_header) {
  if (target->action_values().depfile().empty())
    return;
  if (display_header)
    OutputString("\ndepfile:\n");
  OutputString("  " + target->action_values().depfile().AsString() + "\n");
}

// Attribute the origin for attributing from where a target came from. Does
// nothing if the input is null or it does not have a location.
void OutputSourceOfDep(const ParseNode* origin, std::ostream& out) {
  if (!origin)
    return;
  Location location = origin->GetRange().begin();
  out << "       (Added by " + location.file()->name().value() << ":"
      << location.line_number() << ")\n";
}

// Templatized writer for writing out different config value types.
template<typename T> struct DescValueWriter {};
template<> struct DescValueWriter<std::string> {
  void operator()(const std::string& str, std::ostream& out) const {
    out << "    " << str << "\n";
  }
};
template<> struct DescValueWriter<SourceDir> {
  void operator()(const SourceDir& dir, std::ostream& out) const {
    out << "    " << FormatSourceDir(dir) << "\n";
  }
};

// Writes a given config value type to the string, optionally with attribution.
// This should match RecursiveTargetConfigToStream in the order it traverses.
template<typename T> void OutputRecursiveTargetConfig(
    const Target* target,
    const char* header_name,
    const std::vector<T>& (ConfigValues::* getter)() const) {
  bool display_blame = CommandLine::ForCurrentProcess()->HasSwitch("blame");

  DescValueWriter<T> writer;
  std::ostringstream out;

  for (ConfigValuesIterator iter(target); !iter.done(); iter.Next()) {
    if ((iter.cur().*getter)().empty())
      continue;

    // Optional blame sub-head.
    if (display_blame) {
      const Config* config = iter.GetCurrentConfig();
      if (config) {
        // Source of this value is a config.
        out << "  From " << config->label().GetUserVisibleName(false) << "\n";
        OutputSourceOfDep(iter.origin(), out);
      } else {
        // Source of this value is the target itself.
        out << "  From " << target->label().GetUserVisibleName(false) << "\n";
      }
    }

    // Actual values.
    ConfigValuesToStream(iter.cur(), getter, writer, out);
  }

  std::string out_str = out.str();
  if (!out_str.empty()) {
    OutputString("\n" + std::string(header_name) + "\n");
    OutputString(out_str);
  }
}

}  // namespace

// desc ------------------------------------------------------------------------

const char kDesc[] = "desc";
const char kDesc_HelpShort[] =
    "desc: Show lots of insightful information about a target.";
const char kDesc_Help[] =
    "gn desc <target label> [<what to show>] [--blame] [--all | --tree]\n"
    "  Displays information about a given labeled target.\n"
    "\n"
    "Possibilities for <what to show>:\n"
    "  (If unspecified an overall summary will be displayed.)\n"
    "\n"
    "  sources\n"
    "      Source files.\n"
    "\n"
    "  inputs\n"
    "      Additional input dependencies.\n"
    "\n"
    "  public\n"
    "      Public header files.\n"
    "\n"
    "  visibility\n"
    "      Prints which targets can depend on this one.\n"
    "\n"
    "  configs\n"
    "      Shows configs applied to the given target, sorted in the order\n"
    "      they're specified. This includes both configs specified in the\n"
    "      \"configs\" variable, as well as configs pushed onto this target\n"
    "      via dependencies specifying \"all\" or \"direct\" dependent\n"
    "      configs.\n"
    "\n"
    "  deps [--all | --tree]\n"
    "      Show immediate (or, when \"--all\" or \"--tree\" is specified,\n"
    "      recursive) dependencies of the given target. \"--tree\" shows them\n"
    "      in a tree format with duplicates elided (noted by \"...\").\n"
    "      \"--all\" shows them sorted alphabetically. Using both flags will\n"
    "      print a tree with no omissions. Both \"deps\" and \"datadeps\"\n"
    "      will be included.\n"
    "\n"
    "  direct_dependent_configs\n"
    "  all_dependent_configs\n"
    "      Shows the labels of configs applied to targets that depend on this\n"
    "      one (either directly or all of them).\n"
    "\n"
    "  forward_dependent_configs_from\n"
    "      Shows the labels of dependencies for which dependent configs will\n"
    "      be pushed to targets depending on the current one.\n"
    "\n"
    "  script\n"
    "  args\n"
    "  depfile\n"
    "      Actions only. The script and related values.\n"
    "\n"
    "  outputs\n"
    "      Outputs for script and copy target types.\n"
    "\n"
    "  defines       [--blame]\n"
    "  include_dirs  [--blame]\n"
    "  cflags        [--blame]\n"
    "  cflags_cc     [--blame]\n"
    "  cflags_cxx    [--blame]\n"
    "  ldflags       [--blame]\n"
    "  lib_dirs\n"
    "  libs\n"
    "      Shows the given values taken from the target and all configs\n"
    "      applying. See \"--blame\" below.\n"
    "\n"
    "  --blame\n"
    "      Used with any value specified by a config, this will name\n"
    "      the config that specified the value. This doesn't currently work\n"
    "      for libs and lib_dirs because those are inherited and are more\n"
    "      complicated to figure out the blame (patches welcome).\n"
    "\n"
    "Note:\n"
    "  This command will show the full name of directories and source files,\n"
    "  but when directories and source paths are written to the build file,\n"
    "  they will be adjusted to be relative to the build directory. So the\n"
    "  values for paths displayed by this command won't match (but should\n"
    "  mean the same thing).\n"
    "\n"
    "Examples:\n"
    "  gn desc //base:base\n"
    "      Summarizes the given target.\n"
    "\n"
    "  gn desc :base_unittests deps --tree\n"
    "      Shows a dependency tree of the \"base_unittests\" project in\n"
    "      the current directory.\n"
    "\n"
    "  gn desc //base defines --blame\n"
    "      Shows defines set for the //base:base target, annotated by where\n"
    "      each one was set from.\n";

#define OUTPUT_CONFIG_VALUE(name, type) \
    OutputRecursiveTargetConfig<type>(target, #name, &ConfigValues::name);

int RunDesc(const std::vector<std::string>& args) {
  if (args.size() != 1 && args.size() != 2) {
    Err(Location(), "You're holding it wrong.",
        "Usage: \"gn desc <target_name> <what to display>\"").PrintToStdout();
    return 1;
  }

  const Target* target = GetTargetForDesc(args);
  if (!target)
    return 1;

#define CONFIG_VALUE_HANDLER(name, type) \
    } else if (what == #name) { OUTPUT_CONFIG_VALUE(name, type)

  if (args.size() == 2) {
    // User specified one thing to display.
    const std::string& what = args[1];
    if (what == "configs") {
      PrintConfigs(target, false);
    } else if (what == "direct_dependent_configs") {
      PrintDirectDependentConfigs(target, false);
    } else if (what == "all_dependent_configs") {
      PrintAllDependentConfigs(target, false);
    } else if (what == "forward_dependent_configs_from") {
      PrintForwardDependentConfigsFrom(target, false);
    } else if (what == "sources") {
      PrintSources(target, false);
    } else if (what == "public") {
      PrintPublic(target, false);
    } else if (what == "visibility") {
      PrintVisibility(target, false);
    } else if (what == "inputs") {
      PrintInputs(target, false);
    } else if (what == "script") {
      PrintScript(target, false);
    } else if (what == "args") {
      PrintArgs(target, false);
    } else if (what == "depfile") {
      PrintDepfile(target, false);
    } else if (what == "outputs") {
      PrintOutputs(target, false);
    } else if (what == "deps") {
      PrintDeps(target, false);
    } else if (what == "lib_dirs") {
      PrintLibDirs(target, false);
    } else if (what == "libs") {
      PrintLibs(target, false);

    CONFIG_VALUE_HANDLER(defines, std::string)
    CONFIG_VALUE_HANDLER(include_dirs, SourceDir)
    CONFIG_VALUE_HANDLER(cflags, std::string)
    CONFIG_VALUE_HANDLER(cflags_c, std::string)
    CONFIG_VALUE_HANDLER(cflags_cc, std::string)
    CONFIG_VALUE_HANDLER(cflags_objc, std::string)
    CONFIG_VALUE_HANDLER(cflags_objcc, std::string)
    CONFIG_VALUE_HANDLER(ldflags, std::string)

    } else {
      OutputString("Don't know how to display \"" + what + "\".\n");
      return 1;
    }

#undef CONFIG_VALUE_HANDLER
    return 0;
  }

  // Display summary.

  // Display this only applicable to binary targets.
  bool is_binary_output =
    target->output_type() != Target::GROUP &&
    target->output_type() != Target::COPY_FILES &&
    target->output_type() != Target::ACTION &&
    target->output_type() != Target::ACTION_FOREACH;

  // Generally we only want to display toolchains on labels when the toolchain
  // is different than the default one for this target (which we always print
  // in the header).
  Label target_toolchain = target->label().GetToolchainLabel();

  // Header.
  OutputString("Target: ", DECORATION_YELLOW);
  OutputString(target->label().GetUserVisibleName(false) + "\n");
  OutputString("Type: ", DECORATION_YELLOW);
  OutputString(std::string(
      Target::GetStringForOutputType(target->output_type())) + "\n");
  OutputString("Toolchain: ", DECORATION_YELLOW);
  OutputString(target_toolchain.GetUserVisibleName(false) + "\n");

  PrintSources(target, true);
  if (is_binary_output)
    PrintPublic(target, true);
  PrintVisibility(target, true);
  if (is_binary_output)
    PrintConfigs(target, true);

  PrintDirectDependentConfigs(target, true);
  PrintAllDependentConfigs(target, true);
  PrintForwardDependentConfigsFrom(target, true);

  PrintInputs(target, true);

  if (is_binary_output) {
    OUTPUT_CONFIG_VALUE(defines, std::string)
    OUTPUT_CONFIG_VALUE(include_dirs, SourceDir)
    OUTPUT_CONFIG_VALUE(cflags, std::string)
    OUTPUT_CONFIG_VALUE(cflags_c, std::string)
    OUTPUT_CONFIG_VALUE(cflags_cc, std::string)
    OUTPUT_CONFIG_VALUE(cflags_objc, std::string)
    OUTPUT_CONFIG_VALUE(cflags_objcc, std::string)
    OUTPUT_CONFIG_VALUE(ldflags, std::string)
  }

  if (target->output_type() == Target::ACTION ||
      target->output_type() == Target::ACTION_FOREACH) {
    PrintScript(target, true);
    PrintArgs(target, true);
    PrintDepfile(target, true);
  }

  if (target->output_type() == Target::ACTION ||
      target->output_type() == Target::ACTION_FOREACH ||
      target->output_type() == Target::COPY_FILES) {
    PrintOutputs(target, true);
  }

  // Libs can be part of any target and get recursively pushed up the chain,
  // so always display them, even for groups and such.
  PrintLibs(target, true);
  PrintLibDirs(target, true);

  PrintDeps(target, true);

  return 0;
}

}  // namespace commands


text:
import { browser, element, by, logging } from 'protractor';

describe('Template-reference-variables-example', () => {
  beforeEach(() => browser.get(''));

  // helper function used to test what's logged to the console
  async function logChecker(contents: string) {
    const logs = await browser
      .manage()
      .logs()
      .get(logging.Type.BROWSER);
    const messages = logs.filter(({ message }) => message.indexOf(contents) !== -1);
    expect(messages.length).toBeGreaterThan(0);
  }

  it('should display Template reference variables', async () => {
    expect(await element(by.css('h1')).getText()).toEqual(
      'Template reference variables'
    );
  });

  it('should log a Calling 123 ... message', async () => {
    const callButton = element.all(by.css('button')).get(0);
    const phoneInput = element.all(by.css('input')).get(0);
    await phoneInput.sendKeys('123');
    await callButton.click();
    const contents = 'Calling 123 ...';
    await logChecker(contents);
  });

  it('should submit form', async () => {
    const submitButton = element.all(by.css('button')).get(2);
    const nameInput = element.all(by.css('input')).get(1);
    await nameInput.sendKeys('123');
    await submitButton.click();
    expect(await element.all(by.css('div > p')).get(2).getText()).toEqual('Submitted. Form value is {"name":"123"}');
  });

});


text:
grouVie is a mobile app built with React Native and Ruby on Rails in 8 days as a final project at Dev Bootcamp Chicago. The app allows users to create groups of like-minded friends and to post challenges within the group. If other members accept that challenge, they can announce its completion by posting a selfie using the in-app camera function. The app also features in-group instant messaging.

This respository houses the grouVie API - for the front-end mobile application, see [grouVie-react](https://github.com/msosland/grouVie-react). The back-end was built using Ruby 2.2.1 and Rails 4, and we used [Paperclip](https://github.com/thoughtbot/paperclip) and Amazon S3 for image hosting.

##Contributors

* [Alana Hanson](https://github.com/alanahanson)
* [Michal Klimek](https://github.com/KlimekM)
* [Lauren Reid](https://github.com/tomorrow-lauren)
* [Marshall Sosland](https://github.com/msosland)

##Schema

![Grouvie Schema](schema.png)