text:
require 'grpc'
require 'google/cloud/networkmanagement/v1/reachability_pb'

module Google
  module Cloud
    module NetworkManagement
      module V1
        module ReachabilityService
          # The Reachability service in Google Cloud Network Management API
          #
          # The Reachability service in the Google Cloud Network Management API provides
          # services that analyze the reachability within a single Google Virtual Private
          # Cloud (VPC) network, between peered VPC networks, between VPC and on-premises
          # networks, or between VPC networks and internet hosts. A reachability analysis
          # is based on Google Cloud network configurations.
          #
          # You can use the analysis results to verify these configurations and
          # to troubleshoot connectivity issues.
          class Service

            include ::GRPC::GenericService

            self.marshal_class_method = :encode
            self.unmarshal_class_method = :decode
            self.service_name = 'google.cloud.networkmanagement.v1.ReachabilityService'

            # Lists all Connectivity Tests owned by a project.
            rpc :ListConnectivityTests, ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsRequest, ::Google::Cloud::NetworkManagement::V1::ListConnectivityTestsResponse
            # Gets the details of a specific Connectivity Test.
            rpc :GetConnectivityTest, ::Google::Cloud::NetworkManagement::V1::GetConnectivityTestRequest, ::Google::Cloud::NetworkManagement::V1::ConnectivityTest
            # Creates a new Connectivity Test.
            # After you create a test, the reachability analysis is performed as part
            # of the long running operation, which completes when the analysis completes.
            #
            # If the endpoint specifications in `ConnectivityTest` are invalid
            # (for example, containing non-existent resources in the network, or you
            # don't have read permissions to the network configurations of listed
            # projects), then the reachability result returns a value of `UNKNOWN`.
            #
            # If the endpoint specifications in `ConnectivityTest` are
            # incomplete, the reachability result returns a value of
            # AMBIGUOUS. For more information,
            # see the Connectivity Test documentation.
            rpc :CreateConnectivityTest, ::Google::Cloud::NetworkManagement::V1::CreateConnectivityTestRequest, ::Google::Longrunning::Operation
            # Updates the configuration of an existing `ConnectivityTest`.
            # After you update a test, the reachability analysis is performed as part
            # of the long running operation, which completes when the analysis completes.
            # The Reachability state in the test resource is updated with the new result.
            #
            # If the endpoint specifications in `ConnectivityTest` are invalid
            # (for example, they contain non-existent resources in the network, or the
            # user does not have read permissions to the network configurations of
            # listed projects), then the reachability result returns a value of
            # UNKNOWN.
            #
            # If the endpoint specifications in `ConnectivityTest` are incomplete, the
            # reachability result returns a value of `AMBIGUOUS`. See the documentation
            # in `ConnectivityTest` for for more details.
            rpc :UpdateConnectivityTest, ::Google::Cloud::NetworkManagement::V1::UpdateConnectivityTestRequest, ::Google::Longrunning::Operation
            # Rerun an existing `ConnectivityTest`.
            # After the user triggers the rerun, the reachability analysis is performed
            # as part of the long running operation, which completes when the analysis
            # completes.
            #
            # Even though the test configuration remains the same, the reachability
            # result may change due to underlying network configuration changes.
            #
            # If the endpoint specifications in `ConnectivityTest` become invalid (for
            # example, specified resources are deleted in the network, or you lost
            # read permissions to the network configurations of listed projects), then
            # the reachability result returns a value of `UNKNOWN`.
            rpc :RerunConnectivityTest, ::Google::Cloud::NetworkManagement::V1::RerunConnectivityTestRequest, ::Google::Longrunning::Operation
            # Deletes a specific `ConnectivityTest`.
            rpc :DeleteConnectivityTest, ::Google::Cloud::NetworkManagement::V1::DeleteConnectivityTestRequest, ::Google::Longrunning::Operation
          end

          Stub = Service.rpc_stub_class
        end
      end
    end
  end
end


text:
package com.larswerkman.boxer.wrappers.android;

import android.os.Bundle;
import android.os.Parcel;
import com.larswerkman.boxer.Boxer;

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.List;

/**
 *
 * ParcelWrapper defines how the Boxer class should write to a {@link android.os.Parcel}
 *
 * ParcelWrapper should only be used when you don't
 * change the order you read and write to it.
 */
public class ParcelWrapper extends Boxer<Parcel> {

    Parcel parcel;

    public ParcelWrapper(Parcel object){
        super(object);
        parcel = object;
    }

    @Override
    public void add(String key, Object value) {
        this.parcel.writeBundle(serialize(new BundleWrapper(new Bundle()), value));
    }

    @Override
    public void addArray(String key, Object[] value) {
        this.parcel.writeInt(value.length);
        for(Object boxable : value) {
            this.parcel.writeBundle(serialize(new BundleWrapper(new Bundle()), boxable));
        }
    }

    @Override
    public void addList(String key, List<?> value) {
        addArray(key, value.toArray());
    }

    @Override
    public void addEnum(String key, Enum value) {
        this.parcel.writeString(value.name());
    }

    @Override
    public void addEnumArray(String key, Enum[] value) {
        String[] strings = new String[value.length];
        for(int i = 0; i < value.length; i++){
            strings[i] = value[i].name();
        }
        this.parcel.writeStringArray(strings);
    }

    @Override
    public void addEnumList(String key, List<? extends Enum> value) {
        String[] strings = new String[value.size()];
        for(int i = 0; i < value.size(); i++){
            strings[i] = value.get(i).name();
        }
        this.parcel.writeStringArray(strings);
    }

    @Override
    public void addString(String key, String value) {
        this.parcel.writeString(value);
    }

    @Override
    public void addStringArray(String key, String[] value) {
        this.parcel.writeStringArray(value);
    }

    @Override
    public void addStringList(String key, List<String> value) {
        this.parcel.writeStringList(value);
    }

    @Override
    public void addBoolean(String key, boolean value) {
        this.parcel.writeByte(value ? Byte.MAX_VALUE : Byte.MIN_VALUE);
    }

    @Override
    public void addBooleanArray(String key, boolean[] value) {
        this.parcel.writeBooleanArray(value);
    }

    @Override
    public void addBooleanList(String key, List<Boolean> value) {
        boolean[] bools = new boolean[value.size()];
        for(int i = 0; i < value.size(); i++){
            bools[i] = value.get(i);
        }
        this.parcel.writeBooleanArray(bools);
    }

    @Override
    public void addByte(String key, byte value) {
        this.parcel.writeByte(value);
    }

    @Override
    public void addByteArray(String key, byte[] value) {
        this.parcel.writeByteArray(value);
    }

    @Override
    public void addByteList(String key, List<Byte> value) {
        byte[] bytes = new byte[value.size()];
        for(int i = 0; i < value.size(); i++){
            bytes[i] = value.get(i);
        }
        this.parcel.writeByteArray(bytes);
    }

    @Override
    public void addChar(String key, char value) {
        this.parcel.writeString(String.valueOf(value));
    }

    @Override
    public void addCharArray(String key, char[] value) {
        this.parcel.writeCharArray(value);
    }

    @Override
    public void addCharList(String key, List<Character> value) {
        char[] chars = new char[value.size()];
        for(int i = 0; i < value.size(); i++){
            chars[i] = value.get(i);
        }
        this.parcel.writeCharArray(chars);
    }

    @Override
    public void addShort(String key, short value) {
        this.parcel.writeInt((int) value);
    }

    @Override
    public void addShortArray(String key, short[] value) {
        int[] shorts = new int[value.length];
        for(int i = 0; i < value.length; i++){
            shorts[i] = (int) value[i];
        }
        this.parcel.writeIntArray(shorts);
    }

    @Override
    public void addShortList(String key, List<Short> value) {
        int[] shorts = new int[value.size()];
        for(int i = 0; i < value.size(); i++){
            shorts[i] = (int) value.get(i);
        }
        this.parcel.writeIntArray(shorts);
    }

    @Override
    public void addInt(String key, int value) {
        this.parcel.writeInt(value);
    }

    @Override
    public void addIntArray(String key, int[] value) {
        this.parcel.writeIntArray(value);
    }

    @Override
    public void addIntList(String key, List<Integer> value) {
        int[] ints = new int[value.size()];
        for(int i = 0; i < value.size(); i++){
            ints[i] = value.get(i);
        }
        this.parcel.writeIntArray(ints);
    }

    @Override
    public void addLong(String key, long value) {
        this.parcel.writeLong(value);
    }

    @Override
    public void addLongArray(String key, long[] value) {
        this.parcel.writeLongArray(value);
    }

    @Override
    public void addLongList(String key, List<Long> value) {
        long[] longs = new long[value.size()];
        for(int i = 0; i < value.size(); i++){
            longs[i] = value.get(i);
        }
        this.parcel.writeLongArray(longs);
    }

    @Override
    public void addDouble(String key, double value) {
        this.parcel.writeDouble(value);
    }

    @Override
    public void addDoubleArray(String key, double[] value) {
        this.parcel.writeDoubleArray(value);
    }

    @Override
    public void addDoubleList(String key, List<Double> value) {
        double[] doubles = new double[value.size()];
        for(int i = 0; i < value.size(); i++){
            doubles[i] = value.get(i);
        }
        this.parcel.writeDoubleArray(doubles);
    }

    @Override
    public void addFloat(String key, float value) {
        this.parcel.writeFloat(value);
    }

    @Override
    public void addFloatArray(String key, float[] value) {
        this.parcel.writeFloatArray(value);
    }

    @Override
    public void addFloatList(String key, List<Float> value) {
        float[] floats = new float[value.size()];
        for(int i = 0; i < value.size(); i++){
            floats[i] = value.get(i);
        }
        this.parcel.writeFloatArray(floats);
    }

    @Override
    public <T> T get(String key, Class<T> clazz) {
        Bundle bundle = this.parcel.readBundle();
        if(bundle == null || bundle.isEmpty()){
            return null;
        }

        return deserialize(new BundleWrapper(bundle), clazz);
    }

    @Override
    public <T> T[] getArray(String key, Class<T> clazz) {
        int size = this.parcel.readInt();
        if(size == 0){
            return null;
        }

        T[] boxables = (T[]) Array.newInstance(clazz, size);
        for(int i = 0; i < size; i++){
            boxables[i] = deserialize(new BundleWrapper(this.parcel.readBundle()), clazz);
        }
        return boxables;
    }

    @Override
    public <T, E extends List<T>> E getList(String key, Class<T> clazz, Class<E> listtype) {
        int size = this.parcel.readInt();
        if(size == 0){
            return null;
        }

        E boxables = null;
        try {
            boxables = listtype.newInstance();
            for (int i = 0; i < size; i++) {
                boxables.add(deserialize(new BundleWrapper(this.parcel.readBundle()), clazz));
            }
        } catch (Exception e){};
        return boxables;
    }

    public <T extends Enum> T retrieveEnum(String value, Class<T> clazz){
        T en = null;
        try{
            Method method = clazz.getMethod("valueOf", String.class);
            en = (T) method.invoke(null, value);
        } catch (Exception e){}
        return en;
    }

    @Override
    public <T extends Enum> T getEnum(String key, Class<T> clazz) {
        return retrieveEnum(this.parcel.readString(), clazz);
    }

    @Override
    public <T extends Enum> T[] getEnumArray(String key, Class<T> clazz) {
        String[] values = this.parcel.createStringArray();
        if(values.length == 0){
            return null;
        }

        T[] enums = (T[]) Array.newInstance(clazz, values.length);
        for(int i = 0; i < values.length; i++){
            enums[i] = retrieveEnum(values[i], clazz);
        }
        return enums;
    }

    @Override
    public <T extends Enum, E extends List<T>> E getEnumList(String key, Class<T> clazz, Class<E> listtype) {
        String[] values = this.parcel.createStringArray();
        if(values.length == 0){
            return null;
        }

        E enums = null;
        try {
            enums = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                enums.add(retrieveEnum(values[i], clazz));
            }
        } catch (Exception e){};
        return enums;
    }

    @Override
    public String getString(String key) {
        return this.parcel.readString();
    }

    @Override
    public String[] getStringArray(String key) {
        String[] values = this.parcel.createStringArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<String>> T getStringList(String key, Class<T> listtype) {
        T list = null;
        try {
            list = listtype.newInstance();
        } catch (Exception e){}
        this.parcel.readStringList(list);
        if(list == null || list.size() == 0){
            return null;
        }

        return list;
    }

    @Override
    public boolean getBoolean(String key) {
        byte bytes = parcel.readByte();
        return bytes > Byte.MIN_VALUE && bytes != 0;
    }

    @Override
    public boolean[] getBooleanArray(String key) {
        boolean[] values = this.parcel.createBooleanArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Boolean>> T getBooleanList(String key, Class<T> listtype) {
        boolean[] values = this.parcel.createBooleanArray();
        if(values.length == 0){
            return null;
        }

        T booleans = null;
        try {
            booleans = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                booleans.add(values[i]);
            }
        } catch (Exception e){};
        return booleans;
    }

    @Override
    public byte getByte(String key) {
        return this.parcel.readByte();
    }

    @Override
    public byte[] getByteArray(String key) {
        byte[] values = this.parcel.createByteArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Byte>> T getByteList(String key, Class<T> listtype) {
        byte[] values = this.parcel.createByteArray();
        if(values.length == 0){
            return null;
        }

        T bytes = null;
        try {
            bytes = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                bytes.add(values[i]);
            }
        } catch (Exception e){};
        return bytes;
    }

    @Override
    public char getChar(String key) {
        String value = this.parcel.readString();
        if(value == null){
            return 0;
        }

        return value.charAt(0);
    }

    @Override
    public char[] getCharArray(String key) {
        char[] values = this.parcel.createCharArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Character>> T getCharList(String key, Class<T> listtype) {
        char[] values = this.parcel.createCharArray();
        if(values.length == 0){
            return null;
        }

        T chars = null;
        try {
            chars = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                chars.add(values[i]);
            }
        } catch (Exception e){};
        return chars;
    }

    @Override
    public short getShort(String key) {
        return (short) this.parcel.readInt();
    }

    @Override
    public short[] getShortArray(String key) {
        int[] values = this.parcel.createIntArray();
        if(values.length == 0){
            return null;
        }

        short[] shorts = new short[values.length];
        for(int i = 0; i < values.length; i++){
            shorts[i] = (short) values[i];
        }
        return shorts;
    }

    @Override
    public <T extends List<Short>> T getShortList(String key, Class<T> listtype) {
        int[] values = this.parcel.createIntArray();
        if(values.length == 0){
            return null;
        }

        T shorts = null;
        try {
            shorts = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                shorts.add((short) values[i]);
            }
        } catch (Exception e){};
        return shorts;
    }

    @Override
    public int getInt(String key) {
        return this.parcel.readInt();
    }

    @Override
    public int[] getIntArray(String key) {
        int[] values = this.parcel.createIntArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Integer>> T getIntList(String key, Class<T> listtype) {
        int[] values = this.parcel.createIntArray();
        if(values.length == 0){
            return null;
        }

        T ints = null;
        try {
            ints = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                ints.add(values[i]);
            }
        } catch (Exception e){};
        return ints;
    }

    @Override
    public long getLong(String key) {
        return this.parcel.readLong();
    }

    @Override
    public long[] getLongArray(String key) {
        long[] values = this.parcel.createLongArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Long>> T getLongList(String key, Class<T> listtype) {
        long[] values = this.parcel.createLongArray();
        if(values.length == 0){
            return null;
        }

        T longs = null;
        try {
            longs = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                longs.add(values[i]);
            }
        } catch (Exception e){};
        return longs;
    }

    @Override
    public double getDouble(String key) {
        return this.parcel.readDouble();
    }

    @Override
    public double[] getDoubleArray(String key) {
        double[] values = this.parcel.createDoubleArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Double>> T getDoubleList(String key, Class<T> listtype) {
        double[] values = this.parcel.createDoubleArray();
        if(values.length == 0){
            return null;
        }

        T doubles = null;
        try {
            doubles = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                doubles.add(values[i]);
            }
        } catch (Exception e){};
        return doubles;
    }

    @Override
    public float getFloat(String key) {
        return this.parcel.readFloat();
    }

    @Override
    public float[] getFloatArray(String key) {
        float[] values = this.parcel.createFloatArray();
        if(values.length == 0){
            return null;
        }

        return values;
    }

    @Override
    public <T extends List<Float>> T getFloatList(String key, Class<T> listtype) {
        float[] values = this.parcel.createFloatArray();
        if(values.length == 0){
            return null;
        }

        T floats = null;
        try {
            floats = listtype.newInstance();
            for (int i = 0; i < values.length; i++) {
                floats.add(values[i]);
            }
        } catch (Exception e){};
        return floats;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Runtime.CompilerServices;

namespace KnockoutApi {

    /// <summary>
    /// Represents an object containing an observable value.
    /// </summary>
    /// <typeparam name="T">The type of the contained value.</typeparam>
    [Imported]
    [IgnoreNamespace]
    public class Observable<T> : Subscribable<T> {

        /// <summary>
        /// Creates an observable value.
        /// </summary>
        [InlineCode("ko.observable()")]
        public Observable() {
        }

        /// <summary>
        /// Creates an observable value.
        /// </summary>
        /// <param name="initialValue">The initial value.</param>
        [InlineCode("ko.observable({initialValue})")]
        public Observable(T initialValue) {
        }

        /// <summary>
        /// Gets the current value within the observable object.
        /// </summary>
        /// <returns>The current value.</returns>
        [ScriptName("")]
        [Obsolete("Use the Value property instead.")]
        public T GetValue() {
            return default(T);
        }

        /// <summary>
        /// Sets the value within the observable object.
        /// </summary>
        /// <param name="value">The new value.</param>
        [ScriptName("")]
        [Obsolete("Use the Value property instead.")]
        public void SetValue(T value) {
        }

        /// <summary>
        /// Gets or sets the value within the observable object.
        /// </summary>
        public T Value {
            [ScriptName("")]
            get { return default(T); }

            [ScriptName("")]
            set { }
        }

        /// <summary>
        /// Returns the current value of the observable without creating a dependency
        /// </summary>
        public T Peek() {
            return default(T);
        }

        /// <summary>
        /// Notifies All Subscribers that the Value has Changed
        /// Called internally with SetValue
        /// </summary>
        public void ValueHasMutated() {
        }

        /// <summary>
        /// Notifies All Subscribers BEFORE the Value has Changed
        /// Called internally with SetValue
        /// </summary>
        public void ValueWillMutated() {
        }

        /// <summary>
        /// For Primitive Types ko will handle Equality internally
        /// For complex types a supplied function can be assigned to improve
        /// change (mutation) detection
        /// </summary>
        [IntrinsicProperty]
        public Func<T, T, bool> EqualityComparer {
            get;
            set;
        }
    }
}


text:
第二个TabBar 下的.h .m 以及相关文件

@TabBar主界面    YIem_SecondTabBar_ViewController


text:
require 'yaml'

YAML.add_builtin_type("omap") do |type, val|
  ActiveSupport::OrderedHash[val.map{ |v| v.to_a.first }]
end

module ActiveSupport
  # DEPRECATED: <tt>ActiveSupport::OrderedHash</tt> implements a hash that preserves
  # insertion order.
  #
  #   oh = ActiveSupport::OrderedHash.new
  #   oh[:a] = 1
  #   oh[:b] = 2
  #   oh.keys # => [:a, :b], this order is guaranteed
  #
  # Also, maps the +omap+ feature for YAML files
  # (See http://yaml.org/type/omap.html) to support ordered items
  # when loading from yaml.
  #
  # <tt>ActiveSupport::OrderedHash</tt> is namespaced to prevent conflicts
  # with other implementations.
  class OrderedHash < ::Hash
    def to_yaml_type
      "!tag:yaml.org,2002:omap"
    end

    def encode_with(coder)
      coder.represent_seq '!omap', map { |k,v| { k => v } }
    end

    def select(*args, &block)
      dup.tap { |hash| hash.select!(*args, &block) }
    end

    def reject(*args, &block)
      dup.tap { |hash| hash.reject!(*args, &block) }
    end

    def nested_under_indifferent_access
      self
    end

    # Returns true to make sure that this hash is extractable via <tt>Array#extract_options!</tt>
    def extractable_options?
      true
    end
  end
end


text:
package org.opentosca.container.api.planbuilder;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;

import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;

import org.eclipse.winery.model.selfservice.ApplicationOption;

import org.apache.ode.schemas.dd._2007._03.TProvide;
import org.opentosca.container.core.impl.service.FileSystem;
import org.opentosca.planbuilder.export.VinothekKnownParameters;
import org.opentosca.planbuilder.export.WineryExporter;
import org.opentosca.planbuilder.model.plan.bpel.BPELPlan;
import org.opentosca.planbuilder.model.plan.bpel.Deploy;

public class Util {

    public static SelfServiceOptionWrapper generateSelfServiceOption(final BPELPlan buildPlan) throws IOException {
        final String id = String.valueOf(System.currentTimeMillis());
        final ApplicationOption option = new ApplicationOption();

        final File tmpDir = FileSystem.getTemporaryFolder().toFile();
        tmpDir.mkdir();

        final File planInputMessageFile = new File(tmpDir, "plan.input.default." + id + ".xml");

        option.setName(Util.getBuildPlanServiceName(buildPlan.getDeploymentDeskriptor()).getLocalPart());
        option.setId(id);
        option.setIconUrl("");
        option.setDescription("N/A");
        option.setPlanServiceName(Util.getBuildPlanServiceName(buildPlan.getDeploymentDeskriptor()).getLocalPart());
        option.setPlanInputMessageUrl("plan.input.default." + id + ".xml");
        Util.writePlanInputMessageInstance(buildPlan, planInputMessageFile);

        return new SelfServiceOptionWrapper(option, planInputMessageFile);
    }

    /**
     * Writes given BuildPlan to temporary folder.
     *
     * @param buildPlan a BuildPlan
     * @return a File denoting the export location
     */
    public static File writePlan2TmpFolder(final BPELPlan buildPlan) {
        final WineryExporter planBuilderExporter = new WineryExporter();

        try {
            final File tmpDir = FileSystem.getTemporaryFolder().toFile();
            tmpDir.mkdir();

            final File uploadFile = new File(tmpDir.getAbsoluteFile() + System.getProperty("file.separator")
                + buildPlan.getBpelProcessElement().getAttribute("name") + ".zip");
            planBuilderExporter.exportToPlanFile(uploadFile.toURI(), buildPlan);
            return uploadFile;
        } catch (final IOException e) {
            e.printStackTrace();
            return null;
        } catch (final JAXBException e) {
            e.printStackTrace();
            return null;
        }
    }

    private static QName getBuildPlanServiceName(final Deploy deploy) {
        // generated buildplans have only one process!
        for (final TProvide provide : deploy.getProcess().get(0).getProvide()) {
            // "client" is a convention
            if (provide.getPartnerLink().equals("client")) {
                return provide.getService().getName();
            }
        }
        return null;
    }

    private static void writePlanInputMessageInstance(final BPELPlan buildPlan, final File xmlFile) throws IOException {
        final String messageNs = buildPlan.getWsdl().getTargetNamespace();
        final String requestMessageLocalName = buildPlan.getWsdl().getRequestMessageLocalName();
        final List<String> inputParamNames = buildPlan.getWsdl().getInputMessageLocalNames();

        final VinothekKnownParameters paramMappings = new VinothekKnownParameters();
        final String soapMessagePrefix = Util.createPrefixPartOfSoapMessage(messageNs, requestMessageLocalName);
        final String soapMessageSuffix = Util.createSuffixPartOfSoapMessage(requestMessageLocalName);

        String soapMessage = soapMessagePrefix;
        for (final String inputParamName : inputParamNames) {
            soapMessage += paramMappings.createXmlElement(inputParamName);
        }
        soapMessage += soapMessageSuffix;

        Files.write(xmlFile.toPath(), soapMessage.getBytes(StandardCharsets.UTF_8));
    }

    private static String createPrefixPartOfSoapMessage(final String namespace, final String messageBodyRootLocalName) {
        return "<soapenv:Envelope xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:org=\""
            + namespace
            + "\"><soapenv:Header><wsa:ReplyTo><wsa:Address>%CALLBACK-URL%</wsa:Address></wsa:ReplyTo><wsa:Action>"
            + namespace
            + "/initiate</wsa:Action><wsa:MessageID>%CORRELATION-ID%</wsa:MessageID></soapenv:Header><soapenv:Body><org:"
            + messageBodyRootLocalName + ">";
    }

    private static String createSuffixPartOfSoapMessage(final String messageBodyRootLocalName) {
        return "</org:" + messageBodyRootLocalName + "></soapenv:Body></soapenv:Envelope>";
    }

    public static class SelfServiceOptionWrapper {

        public ApplicationOption option;
        public File planInputMessageFile;

        public SelfServiceOptionWrapper(final ApplicationOption option, final File planInputMessageFile) {
            this.option = option;
            this.planInputMessageFile = planInputMessageFile;
        }

        @Override
        public String toString() {
            return "SelfServiceOption Id: " + this.option.getId() + " Name: " + this.option.getName();
        }
    }
}


text:
# What's here?

If you know your way around a computer, like a developer or data expert, this is a good place to be. If you need a bit more help, like a spreadsheet jockey or designer, use the [Beginners' Guide/FAQ]

1. [Using YADA]
2. [YADA Markup]
3. [Defintions](#defs)
4. [The YADA "Service"](#svc)
5. [Query Authoring](#authoring)
6. The YADAQuery object (coming soon)
7. Client-side Development (coming soon)
8. Tips and Tricks (coming soon)

# Using YADA

Every request must contain either both `qname` and `params` request parameters, or a `JSONParams` parameter.  Note that short parameter names are also available, so the previous sentence could read: Every query must contain either both `q` and `p` request parameters, or a `j` parameter

## YADA Markup

For authoring queries, use the following markup for parameter symbols:

|Markup|Definition             |Description                  |
|:----:|:----------------------|:----------------------------|
|?v    |VARCHAR, VARCHAR2, CHAR|Any character-based data type|
|?i    |INTEGER, INT           |Any integer data type        |
|?n    |NUMBER, DECIMAL        |Any floating point data type |
|?d    |DATE                   |Any date data type           |
|?t    |TIME                   |Any time data type           |

## Definitions

Some terms that are used repeatedly throughout the documentation:

|Term              |Definition
|:-----------------|:---------
|standard parameter|a YADA request parameter appended to the url like 'qname' in the following example: `http://example.com/yada.jsp?qname=YADA+default`
|JSON parameter    |a YADA request parameter expressed using the [JSONParams Specification]
|default parameter |a YADA request parameter that is stored with a query in the YADA Index and attached automatically to each request that references the query
|default value     |a parameter for which the default value is set by YADA, e.g., `format=json`
|protocols         |a reference to one of the supported protocols, i.e., JDBC, SOAP, REST, or FILE
|YADA markup       |The modification of the query parameter symbol to indicate the datatype of the parameter in the query itself, e.g., `?v, ?i, ?d, ?n, ?t`

# YADA Services

Most users coming to this page just want data, and probably want it from an existing YADA app.  Getting data from these sources is simple, and in fact, is precisely the way data is delivered to the single-page Javascript application using YADA under the hood.

## Curl Example

From the linux command-line, or any system call, a user can request any data simply using a known query, with standard parameters.  For example, the following query will return the Oracle® SYSDATE of the YADA server in a standard YADA JSON string.

```bash
curl "http://example.com/yada.jsp?qname=YADA+default"

# returns
# {"RESULTSET":{"total": 1,"ROWS": [{"RNUM": "1","SYSDATE": "2014-10-27 17:34:43.0"}],"qname": "YADA default","page": "1","records": 1}}

# short params names are available to:
# curl "http://example.com/yada.jsp?q=YADA+default"
```

The JSON params version of the above query is

```bash
curl "http://example.com/yada.jsp?JSONParams=[{qname:YADA default,DATA:[{}]}]"

# returns
# {"RESULTSET": {"total": 1,"ROWS": [{"RNUM": "1","SYSDATE": "2014-10-27 17:34:43.0"}],"qname": "YADA default","page": "1","records": 1}}

# using short param names:
# curl "http://example.com/yada.jsp?j=[{qname:YADA default,DATA:[{}]}]"
```

# Query Authoring

Some users are authoring their own queries to access configured data sources. These queries, especially for JDBC, are bascially SQL queries with some minimal added markup.  Basic knowledge of the source database schemas, REST or SOAP API, or Filesystem, is required—just like in any other query-authoring scenario.

## YADA Markup

All YADA queries with value parameters require YADA markup, whether they are processed as positional parameters, or transmitted as name/value pairs in JSONParams strings. At a minimum, for example, for REST queries which always take Strings as values, probably only require `?v` for parameter placeholders. See [JDBC queries with datatypes] below, for more details.

## Parameterized Queries

### Positional Parameters

YADA supports positional parameters for all supported protocols: JDBC, REST, SOAP, and FILE.  Given that you're reading this, you probably understand what positional parameters are and how to use them, so we won't go into too much detail.
Say you want to get a users id number from your database using first and last name as search criteria.  You could write the following query:

```sql
SELECT ID FROM MY_TABLE WHERE FIRST_NAME = 'Joe' AND LAST_NAME = 'Cool';
```

This will return Joe Cool's id number.  But what if you want to enable users of a webapp to search using their own names?  You have to write the query so the values 'Joe' and 'Cool' can be substituted with a user's own criteria.  The way to do this is to parametirize the query.  The standard syntax for a query parameter is a question mark: ? .  See YADA Markup at the bottom of this subsection for how to markup this query with a datatype indicator, to make it YADA compatible.

```sql
SELECT ID FROM MY_TABLE WHERE FIRST_NAME = ? AND LAST_NAME = ?;
```

Internally, when a parameterized query is processed, it is typically embedded in some kind of object such as a [java.sql.PreparedStatement](http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html), which in addition to housing the statement, also offers methods for setting parameter values, such as [setString(int index, String value)](http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setString(int,%20java.lang.String)). Java®, .NET®, Perl, Python, and other platforms all offer similar methods.  YADA uses Java® internally to apply values to the appropriate parameters.

When YADA [standard parameters] are in use, positional parameters correspond to the order in which they are conveyed in the request url, for example:

```
# parameter 1: Joe
# parameter 2: Cool
# Request:
http://example.com/yada.jsp?qname=my+named+query&params=Joe,Cool

# The following statement is not equivalent to the former:
http://example.com/yada.jsp?qname=my+name+query&params=Cool,Joe
```

When JSON parameters are in use, the values to plug in to the query are associated to column names, so order is not significant:

```
# The following statements are equivalent
http://example.com/yada.jsp?JSONparams=[{qname:my named query,DATA[{FIRST_NAME:Joe,LAST_NAME:Cool}]}]
http://example.com/yada.jsp?JSONparams=[{qname:my named query,DATA[{LAST_NAME:Cool,FIRST_NAME:Joe}]}]
```

### YADA Markup

As noted above, all YADA queries require parameter symbols (?) to be accompanied by YADA markup datatype indicators.  Thus the example query above should be written as follows:
```sql
SELECT ID FROM MY_TABLE WHERE FIRST_NAME = ?v AND LAST_NAME = ?v;
```

See [JDBC queries with datatypes] below, for more details.

### JDBC Queries with Datatypes

Parameterized JDBC queries require data typing, because values correspond to database columns which themselves are typed. YADA currently supports four datatypes for parameterized JDBC queries:  *character*, *integer*, *number* (floating point), and *date*.  As noted above, when writing an SQL query to be executed via JDBC, the question mark character ( ? ) is used as a positional parameter marker, and values and data types are "plugged in" to these positions programmatically.  With YADA, there must be a shortcut system to convey not only the position of parameters, but also their datatypes, simultaneously.  This is achieved for all protocols using the designated markup:

|Markup|Definition           |Description                  |
|:----:|:--------------------|:----------------------------|
|?v    |VARCHAR,VARCHAR2,CHAR|Any character-based data type|
|?i    |INTEGER,INT          |Any integer data type        |
|?n    |NUMBER,DECIMAL       |Any floating point data type |
|?d    |DATE                 |Any date data type           |
|?t    |TIME                 |Any time data type           |

## SQL (JDBC)

Virtually any SQL statement is supported by YADA.  Again, if the statement is not ANSI-compliant, or otherwise un-parseable, the YADA adaptor will fall back to the use of positional parameters.

An example:

```sql
select * mytable where col1 = ?v where col2 = ?i
```

Calling the above query from a curl call would look like the following,assuming the query is stored with name `EXMPL example`, and with the string, `abc`, in the first params position, and an integer, `123`, in the second

```
curl "http://example.com/yada.jsp?qname=EXMPL+example&params=abc,123"
```

## REST Example

REST queries behave like proxied queries to third party services.  In fact, if you're writing a javascript application, YADA is a great single-origin-policy workaround. Even if this isn't an issue, YADA enables the aggregation of multiple queries in a single http request, even from multiple sources, and the stacking or harmonization of results. REST queries look just like any other YADA query when being called.  Here's an example of a EBI QuickGO query:

```
http://example.com/yada.jsp?q=QGO%20search&params=0005515
```

Here's an example from TODO example:

```
http://example.com/yada.jsp?example
```

These are the results of the example query, below.  Note, by default, results are wrapped in the standard YADA JSON object structure:

```
{"RESULTSET": {"ROWS": [
```

It is also possible to use one of the built in Response classes to simply pass through the REST result as is.  The new query, with the 'r=RESTPassThruResponse' parameter:

```
http://example.com/yada.jsp?q=N&p=&r=RESTPassThruResponse
```

And the result:

```
{ ... }
```

## More to come soon!

[Beginners' Guide/FAQ]: faq.md
[Getting into the YADA Mindset]: index.md#mindset
[JSONParams Specification]: jsonparams.md
[Filter Specification]: filters.md
[Harmonizer Specification]: harmony.md
[Mail Specification]: mail.md
[Plugin Guide]: pluginguide.md

[standard parameters]: params.md#params
[format]: params.md#format
[delimiter]: params.md#delimiter
[bypassargs]: params.md#bypassargs

[Go to top]: #top
[Using YADA]: #using
[YADA Markup]: #markup
[YADA Requests]: #requests
[JDBC queries with datatypes]: ''

[Javadoc]: http://opensource.nibr.com/yada/yada-api/apidocs/index.html
[TestNG Results]:''


text:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.robdobsn.spideywall" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>SpideyApp</name>
    <description>
        Spidey Wall App
    </description>
    <author email="rob@dobson.com" href="http://robdobson.com">
        Rob Dobson
    </author>
    <content src="index.html" />
    <access origin="*" />
</widget>


text:
package au.com.breakpoint.hedron.daogen;

import java.util.List;
import java.util.Set;
import au.com.breakpoint.hedron.core.GenericFactory;
import au.com.breakpoint.hedron.core.HcUtil;

public class SmartFileJavaClass extends SmartFileShowingProgress
{
    public SmartFileJavaClass (final String filepath)
    {
        super (filepath);
    }

    public void addClassImport (final String format, final Object... args)
    {
        final String className = String.format (format, args);
        m_imports.add (className);
    }

    public void addClassImports (final List<String> imports)
    {
        for (final String s : imports)
        {
            addClassImport (s);
        }

    }

    @Override
    public void close ()
    {
        // Output the gathered imports at this stage.
        setSectionImports ();
        print (HcUtil.NewLine);

        for (final String importedClass : m_imports)
        {
            printf ("import %s;%n", importedClass);
        }

        print (HcUtil.NewLine);

        super.close ();
    }

    public void setSectionClassCode ()
    {
        setSectionNumber (sectionClass);
    }

    public void setSectionPackage ()
    {
        setSectionNumber (sectionPackage);
    }

    private void setSectionImports ()
    {
        setSectionNumber (sectionImports);
    }

    private final Set<String> m_imports = GenericFactory.newTreeSet ();

    private static final int sectionClass = 2;

    private static final int sectionImports = 1;

    private static final int sectionPackage = 0;
}


text:
import tensorflow as tf
import tensorflow.python.framework.errors

class Word2VecModel:
    def __init__(self, sess):
        self.sess = sess
        self.w_in = None
        self._word2id = {}

    def load_model(self, model_file, vocab_file, emb_size):
        print('Loading word2vec vocab...')

        self._word2id = {}
        with open(vocab_file, 'r') as vocab_file:
            for i, line in enumerate(vocab_file):
                word, _ = line.split(' ')  # bytes in str
                word = eval(word)  # bytes
                word = word.decode('utf8')  # actual str

                self._word2id[word] = i

        vocab_size = len(self._word2id)
        self.w_in = tf.Variable(tf.zeros([vocab_size, emb_size]), dtype=tf.float32, name="w_in")

        print('Loading word2vec model...')
        saver = tf.train.Saver()
        saver.restore(self.sess, model_file)
        self.w_in = tf.constant(self.w_in.eval(session=self.sess))

    def word2vec(self, word, run=True):
        if word in self._word2id:
            id = self._word2id[word]
            vec = tf.nn.embedding_lookup(self.w_in, [id])

            if run:
                vec = self.sess.run(vec)

            return vec
        else:
            return None

    def word2id_many(self, words):
        ids = []
        for word in words:
            word_id = self._word2id.get(word)
            if word_id is not None:
                ids.append(word_id)
        return ids

    def word2vec_many(self, words, run=True):
        ids = self.word2id_many(words)
        if len(ids) == 0:
            return None

        try:
            vec = tf.nn.embedding_lookup(self.w_in, ids)
        except:
            print(words)
            print(ids)
            raise

        if run:
            vec = self.sess.run(vec)
        return vec

    def get_embeddings_shape(self):
        return self.w_in.get_shape().as_list()

def main():
    sess = tf.Session()
    model = Word2VecModel(sess)
    model.load_model(model_file='./saved/model.ckpt-2264733',
                     vocab_file='./saved/vocab.txt',
                     emb_size=200)

    print('Evaluating...')
    igor_vec = model.word2vec('igor')
    two_vec = model.word2vec('two')
    three_vec = model.word2vec('three')

    igor_dst = sess.run(tf.reduce_mean(tf.square(igor_vec - two_vec)))
    num_dst = sess.run(tf.reduce_mean(tf.square(three_vec - two_vec)))

    print('igor_dst = \'igor\' - \'two\' = {}'.format(igor_dst))
    print('num_dst = \'three\' - \'two\' = {}'.format(num_dst))

if __name__ == "__main__":
    main()


text:
enum {
	tagContentView = 100
	, tagTableView
};

enum {
	tableViewRowPelvisLevel           = 0
	, tableViewRowPelvisElevated = 1
	, tableViewRowPelvisRotated  = 2
	, tableViewRowCount          = 3
};

static NSString* cell_identifier = @"pelvis-back-cell";

@interface PACPelvisBackViewController ()
-(void) segmentvaluechanged:(id)sender;
@end

@implementation PACPelvisBackViewController

- (void)viewDidLoad
{
	[super viewDidLoad];
}

- (void)didReceiveMemoryWarning
{
	[super didReceiveMemoryWarning];
}
-(void) loadView
{
	[super loadView];

	self.navigationItem.title = @"Pelvis - Back";

	CGRect frame = self.view.frame;
	float fy = 5.0f;
	float fgutter = 5.0f;

	UIScrollView* content_view = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height)];
	content_view.tag = tagContentView;
	content_view.backgroundColor = [UIColor whiteColor];

	UIImage* image = [UIImage imageNamed:@"pelvis_back_detail.jpg"];

	UIImageView* image_view = [[UIImageView alloc] initWithFrame:CGRectMake( (frame.size.width / 2.0f) - (image.size.width / 2.0f), fy, image.size.width, image.size.height)];
	image_view.image = image;
	[content_view addSubview:image_view];

	fy = fy + image.size.height + fgutter;

	UIImage* look = [UIImage imageNamed:@"look.jpg"];
	UIImageView* look_view = [[UIImageView alloc] initWithFrame:CGRectMake( 5.0f, fy, look.size.width, look.size.height )];
	look_view.image = look;
	[content_view addSubview:look_view];

	UIImage* touch = [UIImage imageNamed:@"touch.jpg"];
	UIImageView* touch_view = [[UIImageView alloc] initWithFrame:CGRectMake( 7.0f + look.size.width, fy, touch.size.width, touch.size.height )];
	touch_view.image = touch;
	[content_view addSubview:touch_view];

	fy = fy + look.size.height + fgutter;

	UITableView* tableView = [[UITableView alloc] initWithFrame:CGRectMake(3.0f, fy + 30.0f, frame.size.width - 3.0f, 280.0f) style:UITableViewStyleGrouped];
	tableView.tag = tagTableView;
	tableView.dataSource = self;
	tableView.delegate = self;
	tableView.scrollEnabled = NO;
	[content_view addSubview:tableView];

	[tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cell_identifier];

	fy = fy + 220.0f + 30.0f + fgutter;

	[self.view addSubview:content_view];
}
#pragma mark -
#pragma mark UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cell_identifier forIndexPath:indexPath];

	cell.accessoryType = UITableViewCellAccessoryNone;

	if(indexPath.row == tableViewRowPelvisElevated && !cell.accessoryView) {
		UISegmentedControl *segment = [[UISegmentedControl alloc] init];
		segment.frame = CGRectMake(0,0,200,30);
		segment.tag   = indexPath.row;
		[segment insertSegmentWithTitle:@"Left" atIndex:0 animated:NO];
		[segment insertSegmentWithTitle:@"Right" atIndex:1 animated:NO];
		[segment addTarget:self action:@selector(segmentvaluechanged:) forControlEvents:UIControlEventValueChanged];
		cell.accessoryView = segment;
	} else if(indexPath.row == tableViewRowPelvisRotated && !cell.accessoryView) {
		UISegmentedControl *segment = [[UISegmentedControl alloc] init];
		segment.frame = CGRectMake(0,0,200,30);
		segment.tag   = indexPath.row;
		[segment insertSegmentWithTitle:@"Clockwise" atIndex:0 animated:NO];
		[segment insertSegmentWithTitle:@"Counter-Clockwise" atIndex:1 animated:NO];
		[segment addTarget:self action:@selector(segmentvaluechanged:) forControlEvents:UIControlEventValueChanged];
		cell.accessoryView = segment;
	}

	switch(indexPath.row) {
	case tableViewRowPelvisLevel:
		cell.textLabel.text = @"Level";
		if((PACPelvisBackAlignment & pelvisBackAlignmentLevel) == pelvisBackAlignmentLevel) {
			cell.accessoryType = UITableViewCellAccessoryCheckmark;
		}
		break;
	case tableViewRowPelvisElevated:
		cell.textLabel.text = @"Elevated";
		((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = -1;
		if((PACPelvisBackAlignment & pelvisBackAlignmentElevatedLeft) == pelvisBackAlignmentElevatedLeft) {
			((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = 0;
		} else if((PACPelvisBackAlignment & pelvisBackAlignmentElevatedRight) == pelvisBackAlignmentElevatedRight) {
			((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = 1;
		}
		break;
	case tableViewRowPelvisRotated:
		cell.textLabel.text = @"Rotated";
		((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = -1;
		if((PACPelvisBackAlignment & pelvisBackAlignmentRotatedClockwise) == pelvisBackAlignmentRotatedClockwise) {
			((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = 0;
		} else if((PACPelvisBackAlignment & pelvisBackAlignmentRotatedCounterClockwise) == pelvisBackAlignmentRotatedCounterClockwise) {
			((UISegmentedControl*)cell.accessoryView).selectedSegmentIndex = 1;
		}
		break;
	}
	return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
	return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
	return tableViewRowCount;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
	UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0f, tableView.frame.size.width, 42.0f)];
	label.backgroundColor = [UIColor clearColor];
	label.textColor = [UIColor blackColor];
	label.font = [UIFont boldSystemFontOfSize:16.0];
	label.text = NSLocalizedString(@"● Palpate each PSIS and compare.\r\n● Palpate top of iliac crests with hands parallel to floor.", @"");
	label.numberOfLines = 0;
	label.lineBreakMode = NSLineBreakByWordWrapping;
	return label;
}
-(CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section
{
	return 64.0f;
}
#pragma mark -
#pragma mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
	if(indexPath.row == tableViewRowPelvisLevel) {
		PACPelvisBackAlignment = pelvisBackAlignmentLevel;
		[tableView reloadData];

		if(!((PACChecklistBackView & backViewCheckListPelvis) == backViewCheckListPelvis)) {
			PACChecklistBackView |= backViewCheckListPelvis;
			[[NSNotificationCenter defaultCenter] postNotificationName:[NSString stringWithUTF8String:PACCheckListBackViewDidChange] object:nil];
		}
	}
}
#pragma mark -
#pragma mark private
-(void) segmentvaluechanged:(id)sender
{
	UISegmentedControl* segment = (UISegmentedControl*)sender;

	if(segment.tag == tableViewRowPelvisElevated) {
		switch(segment.selectedSegmentIndex) {
		case 0: // elevated left
			PACPelvisBackAlignment &= ~pelvisBackAlignmentLevel;
			PACPelvisBackAlignment &= ~pelvisBackAlignmentElevatedRight;
			PACPelvisBackAlignment |= pelvisBackAlignmentElevatedLeft;
			break;
		case 1: // elevated right
			PACPelvisBackAlignment &= ~pelvisBackAlignmentLevel;
			PACPelvisBackAlignment &= ~pelvisBackAlignmentElevatedLeft;
			PACPelvisBackAlignment |= pelvisBackAlignmentElevatedRight;
			break;
		}
	} else if(segment.tag == tableViewRowPelvisRotated) {
		switch(segment.selectedSegmentIndex) {
		case 0: // rotated clockwise
			PACPelvisBackAlignment &= ~pelvisBackAlignmentLevel;
			PACPelvisBackAlignment &= ~pelvisBackAlignmentRotatedCounterClockwise;
			PACPelvisBackAlignment |= pelvisBackAlignmentRotatedClockwise;
			break;
		case 1: // rotated counter-clockwise
			PACPelvisBackAlignment &= ~pelvisBackAlignmentLevel;
			PACPelvisBackAlignment &= ~pelvisBackAlignmentRotatedClockwise;
			PACPelvisBackAlignment |= pelvisBackAlignmentRotatedCounterClockwise;
			break;
		}
	}

	if(PACPelvisBackAlignment > -1) {

		UITableView* tableView = (UITableView*)[[self.view viewWithTag:tagContentView] viewWithTag:tagTableView];
		[tableView reloadData];

		if(!((PACChecklistBackView & backViewCheckListPelvis) == backViewCheckListPelvis)) {
			PACChecklistBackView |= backViewCheckListPelvis;
			[[NSNotificationCenter defaultCenter] postNotificationName:[NSString stringWithUTF8String:PACCheckListBackViewDidChange] object:nil];
		}
	}
}
@end


text:
package com.zhranklin.ddd.support.casbah

import java.util.Date

import com.mongodb.casbah.Imports.{MongoDBObject ⇒ $, _}
import com.mongodb.casbah.MongoDB
import com.mongodb.casbah.commons.TypeImports
import com.zhranklin.ddd.infra.persistence.{Dmo, Mapper}
import com.zhranklin.ddd.model.Id
import org.bson.types.ObjectId

/**
 * Created by Zhranklin on 2017/3/17.
 */
trait CasbahMapper extends Mapper[DBAttr] {

  def db: MongoDB

  def read(id: Id, clazz: Class[_]) = {
    val table = getTableName(clazz)
    val mongoObj: Option[TypeImports.DBObject] = db(table).findOneByID(id.id)
    mongoObj.map(obj ⇒
      Dmo[DBAttr](id, table, obj.mapValues(v ⇒ new DBAttr(v)).toMap)
    ).orNull
  }
  def write(dmo: Dmo[DBAttr]) = {
    val mongoObj = dmo.attributes.mapValues(_.v).toSeq :+ ("_id", dmo.id.id)
    db(dmo.table).update("_id" $eq dmo.id.id, $(mongoObj: _*), upsert = true)
  }
}


text:
package text

import (
	"github.com/golang/glog"
	"github.com/pikkpoiss/gamejam/v1/base/core"
	"github.com/pikkpoiss/gamejam/v1/base/render"
	"github.com/pikkpoiss/gamejam/v1/base/sprites"
	"image/draw"
)

type Config struct {
	TextureWidth  int
	TextureHeight int
	PixelsPerUnit float32
}

type TextInstanceList struct {
	*render.InstanceList
	cfg   Config
	sheet *sprites.PackedSheet
}

func NewTextInstanceList(cfg Config) *TextInstanceList {
	return &TextInstanceList{
		InstanceList: render.NewInstanceList(),
		cfg:          cfg,
		sheet: sprites.NewPackedSheet(
			cfg.TextureWidth,
			cfg.TextureHeight,
		),
	}
}

func (l *TextInstanceList) SetText(instance *render.Instance, text string, font *FontFace) (err error) {
	var (
		img    draw.Image
		sprite *sprites.Sprite
	)
	if instance == nil {
		return // No error.
	}
	if img, err = font.GetImage(text); err != nil {
		return
	}
	if err = l.sheet.Pack(text, img); err != nil {
		// Attempt to compact the texture.
		if err = l.repackImage(); err != nil {
			return
		}
		if err = l.sheet.Pack(text, img); err != nil {
			return
		}
	}
	if sprite, err = l.sheet.Sprite(text); err != nil {
		return
	}
	instance.Frame = sprite.Index()
	instance.SetScale(sprite.WorldDimensions(l.cfg.PixelsPerUnit).Vec3(1.0))
	instance.MarkChanged()
	instance.Key = text
	if err = l.generateTexture(); err != nil {
		return
	}
	return
}

func (l *TextInstanceList) generateTexture() (err error) {
	var (
		texture *core.Texture
	)
	if texture, err = core.GetTexture(
		l.sheet.Image(),
		core.SmoothingLinear,
	); err != nil {
		return
	}
	l.sheet.SetTexture(texture)
	return
}

func (l *TextInstanceList) repackImage() (err error) {
	var (
		newImage *sprites.PackedSheet
		instance *render.Instance
		sprite   *sprites.Sprite
	)
	if glog.V(1) {
		glog.Info("Repacking image")
	}
	newImage = sprites.NewPackedSheet(
		l.sheet.Width,
		l.sheet.Height,
	)
	instance = l.Head()
	for instance != nil {
		if err = newImage.Copy(instance.Key, l.sheet); err != nil {
			return
		}
		if sprite, err = newImage.Sheet.Sprite(instance.Key); err != nil {
			return
		}
		instance.Frame = sprite.Index()
		instance.MarkChanged()
		instance = instance.Next()
	}
	l.sheet = newImage
	if err = l.generateTexture(); err != nil {
		return
	}
	if glog.V(1) {
		glog.Info("Done repacking")
	}
	return
}

func (l *TextInstanceList) Bind() {
	l.sheet.Bind()
}

func (l *TextInstanceList) Unbind() {
	l.sheet.Unbind()
}

func (l *TextInstanceList) Delete() {
	l.sheet.Delete()
	l.sheet = nil
}

func (l *TextInstanceList) Sheet() *sprites.PackedSheet {
	return l.sheet
}


text:
using FujiyBlog.Core.DomainObjects;
using System.Collections.Generic;

namespace FujiyBlog.Web.Areas.Admin.ViewModels
{
    public class AdminCategoriesList
    {
        public AdminCategoriesList()
        {
            NewCategory = new Category();
        }

        public IDictionary<Category, int> CategoriesPostCount { get; set; }
        public Category NewCategory { get; set; }
    }
}


text:
"""
    tipfyext.mako
    ~~~~~~~~~~~~~

    Mako template support for Tipfy.

    Learn more about Mako at http://www.makotemplates.org/

    :copyright: 2011 by tipfy.org.
    :license: BSD, see LICENSE.txt for more details.
"""
from __future__ import absolute_import
from cStringIO import StringIO

from mako.lookup import TemplateLookup
from mako.runtime import Context

from werkzeug import cached_property

#: Default configuration values for this module. Keys are:
#:
#: templates_dir
#:     Directory for templates. Default is `templates`.
default_config = {
    'templates_dir': 'templates',
}

class Mako(object):
    def __init__(self, app, _globals=None, filters=None):
        self.app = app
        config = app.config[__name__]
        dirs = config.get('templates_dir')
        if isinstance(dirs, basestring):
            dirs = [dirs]

        self.environment = TemplateLookup(directories=dirs,
            output_encoding='utf-8', encoding_errors='replace')

    def render(self, _filename, **context):
        """Renders a template and returns a response object.

        :param _filename:
            The template filename, related to the templates directory.
        :param context:
            Keyword arguments used as variables in the rendered template.
            These will override values set in the request context.
       :returns:
            A rendered template.
        """
        template = self.environment.get_template(_filename)
        return template.render_unicode(**context)

    def render_template(self, _handler, _filename, **context):
        """Renders a template and returns a response object.

        :param _filename:
            The template filename, related to the templates directory.
        :param context:
            Keyword arguments used as variables in the rendered template.
            These will override values set in the request context.
       :returns:
            A rendered template.
        """
        ctx = _handler.context.copy()
        ctx.update(context)
        return self.render(_filename, **ctx)

    def render_response(self, _handler, _filename, **context):
        """Returns a response object with a rendered template.

        :param _filename:
            The template filename, related to the templates directory.
        :param context:
            Keyword arguments used as variables in the rendered template.
            These will override values set in the request context.
        """
        res = self.render_template(_handler, _filename, **context)
        return self.app.response_class(res)

    @classmethod
    def factory(cls, _app, _name, **kwargs):
        if _name not in _app.registry:
            _app.registry[_name] = cls(_app, **kwargs)

        return _app.registry[_name]

class MakoMixin(object):
    """Mixin that adds ``render_template`` and ``render_response`` methods
    to a :class:`tipfy.RequestHandler`. It will use the request context to
    render templates.
    """
    # The Mako creator.
    mako_class = Mako

    @cached_property
    def mako(self):
        return self.mako_class.factory(self.app, 'mako')

    def render_template(self, _filename, **context):
        return self.mako.render_template(self, _filename, **context)

    def render_response(self, _filename, **context):
        return self.mako.render_response(self, _filename, **context)


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.execution;

import com.facebook.presto.Session;
import com.facebook.presto.metadata.Metadata;
import com.facebook.presto.security.AccessControl;
import com.facebook.presto.sql.SqlFormatter;
import com.facebook.presto.sql.tree.Statement;

public interface DataDefinitionTask<T extends Statement>
{
    String getName();

    void execute(T statement, Session session, Metadata metadata, AccessControl accessControl, QueryStateMachine stateMachine);

    default String explain(T statement)
    {
        return SqlFormatter.formatSql(statement);
    }
}


text:
package org.qcri.rheem.iejoin.operators;

import org.qcri.rheem.basic.data.Tuple2;
import org.qcri.rheem.basic.data.Tuple5;
import org.qcri.rheem.core.function.TransformationDescriptor;
import org.qcri.rheem.core.plan.rheemplan.BinaryToUnaryOperator;
import org.qcri.rheem.core.types.DataSetType;

/**
 * This operator applies inequality join on elements of input datasets.
 */
public class IEJoinOperator<Type0, Type1, Input>
        extends BinaryToUnaryOperator<Input, Input, Tuple2<Input, Input>> {

    //protected final int get0Pivot;
    protected final TransformationDescriptor<Input, Type0> get0Pivot;
    //protected final int get1Pivot;
    protected final TransformationDescriptor<Input, Type0> get1Pivot;
    protected final IEJoinMasterOperator.JoinCondition cond0;
    //protected final int get0Ref;
    protected final TransformationDescriptor<Input, Type1> get0Ref;
    //protected final int get1Ref;
    protected final TransformationDescriptor<Input, Type1> get1Ref;
    protected final IEJoinMasterOperator.JoinCondition cond1;
    protected boolean list1ASC;
    protected boolean list1ASCSec;
    protected boolean list2ASC;
    protected boolean list2ASCSec;
    protected boolean equalReverse;

    public IEJoinOperator(Class<Input> inputType0Class, Class<Input> inputType1Class,
                          TransformationDescriptor<Input, Type0> get0Pivot, TransformationDescriptor<Input, Type0> get1Pivot, IEJoinMasterOperator.JoinCondition cond0,
                          TransformationDescriptor<Input, Type1> get0Ref, TransformationDescriptor<Input, Type1> get1Ref, IEJoinMasterOperator.JoinCondition cond1) {
        super(DataSetType.createDefault(inputType0Class),
                DataSetType.createDefault(inputType1Class),
                DataSetType.createDefaultUnchecked(Tuple2.class),
                false);
        this.get0Pivot = get0Pivot;
        this.get1Pivot = get1Pivot;
        this.cond0 = cond0;
        this.get0Ref = get0Ref;
        this.get1Ref = get1Ref;
        this.cond1 = cond1;
        assignSortOrders();
    }

    public IEJoinOperator(DataSetType<Input> inputType0, DataSetType<Input> inputType1,
                          TransformationDescriptor<Input, Type0> get0Pivot, TransformationDescriptor<Input, Type0> get1Pivot, IEJoinMasterOperator.JoinCondition cond0,
                          TransformationDescriptor<Input, Type1> get0Ref, TransformationDescriptor<Input, Type1> get1Ref, IEJoinMasterOperator.JoinCondition cond1) {
        super(inputType0, inputType1, DataSetType.createDefaultUnchecked(Tuple2.class), false);
        this.get0Pivot = get0Pivot;
        this.get1Pivot = get1Pivot;
        this.cond0 = cond0;
        this.get0Ref = get0Ref;
        this.get1Ref = get1Ref;
        this.cond1 = cond1;
        assignSortOrders();
    }

    public void assignSortOrders() {
        Tuple5<Boolean, Boolean, Boolean, Boolean, Boolean> sortOrders = IEJoinMasterOperator.getSortOrders(this.cond0, this.cond1);
        list1ASC = sortOrders.getField0();
        list1ASCSec = sortOrders.getField1();
        list2ASC = sortOrders.getField2();
        list2ASCSec = sortOrders.getField3();
        equalReverse = sortOrders.getField4();
    }

    public TransformationDescriptor<Input, Type0> getGet0Pivot() {
        return this.get0Pivot;
    }

    public TransformationDescriptor<Input, Type1> getGet0Ref() {
        return this.get0Ref;
    }

    public TransformationDescriptor<Input, Type0> getGet1Pivot() {
        return this.get1Pivot;
    }

    public TransformationDescriptor<Input, Type1> getGet1Ref() {
        return this.get1Ref;
    }

    public IEJoinMasterOperator.JoinCondition getCond0() {
        return this.cond0;
    }

    public IEJoinMasterOperator.JoinCondition getCond1() {
        return this.cond1;
    }
}


text:
<!DOCTYPE html>

  <meta charset ="UTF-8">
  <link type="text/css" rel="stylesheet" href="gps1-2.css"/>
    <title> Tina and David's Website on Pair Programming </title>

 Website Authors

 David Hallinan

 Tina Patel

 What is Pair Programming?

 Pair programming refers to when 2 programmers work together to build a code based project             . It entails one person serving as the role of a driver, and the other as the navigator.             Pair programming is important because it helps minimize human error and maximize human               creativity.

 Why is Pair Programming important to DBC?

  Pair programming to core to DBC's curriculum for several reasons. The first reason is                that it helps reiterate previously learned concepts. Secondly, it gives 2 people a                   chance to practice vocalizing their ideas on building a code based project together.                 Lastly, it simulates the industry standard of building code based project as a team.

 What is the difference between Driver and Navigator?

  The Navigator is the brain and the Driver is the hands. They both work together                      collaboratively. Usually, they switch roles throughout the project in order to both see              the project from each perspective.


text:
package org.elasticsoftware.elasticactors.tracing.spring;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class TraceableExecutorService implements ExecutorService {

    protected final ExecutorService delegate;

    public TraceableExecutorService(final ExecutorService delegate) {
        this.delegate = delegate;
    }

    @Override
    public void execute(Runnable command) {
        this.delegate.execute(TraceRunnable.wrap(command));
    }

    @Override
    public void shutdown() {
        this.delegate.shutdown();
    }

    @Override
    public List<Runnable> shutdownNow() {
        return this.delegate.shutdownNow();
    }

    @Override
    public boolean isShutdown() {
        return this.delegate.isShutdown();
    }

    @Override
    public boolean isTerminated() {
        return this.delegate.isTerminated();
    }

    @Override
    public boolean awaitTermination(long timeout, TimeUnit unit)
            throws InterruptedException {
        return this.delegate.awaitTermination(timeout, unit);
    }

    @Override
    public <T> Future<T> submit(Callable<T> task) {
        return this.delegate.submit(TraceCallable.wrap(task));
    }

    @Override
    public <T> Future<T> submit(Runnable task, T result) {
        return this.delegate.submit(TraceRunnable.wrap(task), result);
    }

    @Override
    public Future<?> submit(Runnable task) {
        return this.delegate.submit(TraceRunnable.wrap(task));
    }

    @Override
    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
            throws InterruptedException {
        return this.delegate.invokeAll(wrapCallableCollection(tasks));
    }

    @Override
    public <T> List<Future<T>> invokeAll(
            Collection<? extends Callable<T>> tasks,
            long timeout, TimeUnit unit) throws InterruptedException {
        return this.delegate.invokeAll(wrapCallableCollection(tasks), timeout, unit);
    }

    @Override
    public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
            throws InterruptedException, ExecutionException {
        return this.delegate.invokeAny(wrapCallableCollection(tasks));
    }

    @Override
    public <T> T invokeAny(
            Collection<? extends Callable<T>> tasks, long timeout,
            TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException {
        return this.delegate.invokeAny(wrapCallableCollection(tasks), timeout, unit);
    }

    private <T> Collection<? extends Callable<T>> wrapCallableCollection(
            Collection<? extends Callable<T>> tasks) {
        List<Callable<T>> ts = new ArrayList<>();
        for (Callable<T> task : tasks) {
            if (!(task instanceof TraceCallable)) {
                ts.add(TraceCallable.wrap(task));
            }
        }
        return ts;
    }

}


text:
<?php namespace Analogue\ORM\Relationships;

use Analogue\ORM\System\Query;

class MorphPivot extends Pivot {

	/**
	 * The type of the polymorphic relation.
	 *
	 * Explicitly define this so it's not included in saved attributes.
	 *
	 * @var string
	 */
	protected $morphType;

	/**
	 * The value of the polymorphic relation.
	 *
	 * Explicitly define this so it's not included in saved attributes.
	 *
	 * @var string
	 */
	protected $morphClass;

	/**
	 * Set the keys for a save update query.
	 *
	 * @param  \Analogue\ORM\Query  $query
	 * @return \Analogue\ORM\Query
	 */
	protected function setKeysForSaveQuery(Query $query)
	{
		$query->where($this->morphType, $this->morphClass);

		return parent::setKeysForSaveQuery($query);
	}

	/**
	 * Set the morph type for the pivot.
	 *
	 * @param  string  $morphType
	 * @return $this
	 */
	public function setMorphType($morphType)
	{
		$this->morphType = $morphType;

		return $this;
	}

	/**
	 * Set the morph class for the pivot.
	 *
	 * @param  string  $morphClass
	 * @return \Analogue\ORM\Relationships\MorphPivot
	 */
	public function setMorphClass($morphClass)
	{
			$this->morphClass = $morphClass;

			return $this;
	}

}


text:
Magnifractal
============

A fractal zooming/exploring tool. Under construction - mostly this was a fun weekend project to learn Java, but I'll try to make it a decent tool for exploring fractals. At the moment, its Mandelbrot only.

How to Use
==========

Compile using "javac Magnifractal.java".

Run it using "java Magnifractal".

Controls are as follows:

Mouse wheel: zoom in/out

'r': increase resolution (wraps around)

'u': set to min resolution (good for faster zooming)

't': set to max resolution (use for stunning images)

Arrow keys: panning (NOT IMPLEMENTED YET)


text:
import fetch from 'isomorphic-fetch';
import { stringify as buildAPIQS } from 'qs';
import _ from 'lodash';

import * as actions from './action-types';
import config from '../config';
import { PM25_PARAMETER_ID } from '../utils/constants';

// ////////////////////////////////////////////////////////////////
//                       COMPARE LOCATION                        //
// ////////////////////////////////////////////////////////////////

export function invalidateCompare() {
  return {
    type: actions.INVALIDATE_COMPARE,
  };
}

function requestCompareLocation(index) {
  return {
    type: actions.REQUEST_COMPARE_LOCATION,
    index,
  };
}

function receiveCompareLocation(index, json, error = null) {
  return {
    type: actions.RECEIVE_COMPARE_LOCATION,
    index,
    json: json,
    error,
    receivedAt: Date.now(),
  };
}

function receiveMultipleCompareLocation(count, data, error = null) {
  return {
    type: actions.RECEIVE_MULTIPLE_COMPARE_LOCATION,
    count,
    data,
    error,
    receivedAt: Date.now(),
  };
}

export function fetchCompareLocationIfNeeded(index, location, filters = {}) {
  return function (dispatch, getState) {
    dispatch(requestCompareLocation(index));
    if (location) {
      // Search for the location in the state.
      const state = getState();
      const l = _.find(state.locations.data.results, { location: location });
      if (l) {
        return dispatch(receiveCompareLocation(index, l));
      }

      filters.location = location;
    }

    const f = buildAPIQS(filters);

    return fetch(`${config.api}/locations?${f}`)
      .then(response => {
        if (response.status >= 400) {
          throw new Error('Bad response');
        }
        return response.json();
      })
      .then(
        json => {
          if (!json.results.length) {
            return dispatch(
              receiveCompareLocation(index, null, 'Data not available')
            );
          }
          return dispatch(receiveCompareLocation(index, json.results[0]));
        },
        e => {
          console.log('e', e);
          return dispatch(
            receiveCompareLocation(index, null, 'Data not available')
          );
        }
      );
  };
}

// Fetches random location and dispatches them to the compare slice of state.
export function fetchRandomCompareLocs(limit = 2) {
  return dispatch => {
    // Dispatch all requests.
    for (let index = 0; index < limit; index++) {
      dispatch(requestCompareLocation(index));
    }

    const f = buildAPIQS({
      order_by: 'random',
      // pm25 has id 2.
      parameter: PM25_PARAMETER_ID,
      limit,
    });

    return fetch(`${config.api}/locations?${f}`)
      .then(response => {
        if (response.status >= 400) {
          throw new Error('Bad response');
        }
        return response.json();
      })
      .then(
        json => {
          return dispatch(receiveMultipleCompareLocation(limit, json.results));
        },
        e => {
          console.log('e', e);
          return dispatch(
            receiveMultipleCompareLocation(limit, null, 'Data not available')
          );
        }
      );
  };
}

export function removeCompareLocation(index) {
  return {
    type: actions.REMOVE_COMPARE_LOCATION,
    index,
  };
}

export function selectCompareOptions() {
  return {
    type: actions.SELECT_COMPARE_OPTIONS,
  };
}

export function cancelCompareOptions() {
  return {
    type: actions.CANCEL_COMPARE_OPTIONS,
  };
}

export function selectCompareCountry(country) {
  return {
    type: actions.SELECT_COMPARE_OPT_COUNTRY,
    country,
  };
}

export function selectCompareArea(area) {
  return {
    type: actions.SELECT_COMPARE_OPT_AREA,
    area,
  };
}

export function selectCompareLocation(location) {
  return {
    type: actions.SELECT_COMPARE_OPT_LOCATION,
    location,
  };
}

function requestCompareLocationMeasurements(index) {
  return {
    type: actions.REQUEST_COMPARE_LOCATION_MEASUREMENTS,
    index,
  };
}

function receiveCompareLocationMeasurements(index, json, error = null) {
  return {
    type: actions.RECEIVE_COMPARE_LOCATION_MEASUREMENTS,
    index,
    json: json,
    error,
    receivedAt: Date.now(),
  };
}

export function fetchCompareLocationMeasurements(
  index,
  location,
  startDate,
  endDate,
  parameter
) {
  return function (dispatch) {
    dispatch(requestCompareLocationMeasurements(index));

    let data = null;
    let limit = 1000;
    const fetcher = function (page) {
      let qs = buildAPIQS({
        spatial: 'location',
        temporal: 'hour',
        location,
        page,
        limit,
        parameter,
        date_from: startDate,
        date_to: endDate,
      });

      fetch(`${config.api}/averages?${qs}`)
        .then(response => {
          if (response.status >= 400) {
            throw new Error('Bad response');
          }
          return response.json();
        })
        .then(
          json => {
            if (data === null) {
              data = json;
            } else {
              data.results = data.results.concat(json.results);
            }
            if (page * limit < json.meta.found) {
              return fetcher(++page);
            } else {
              return dispatch(receiveCompareLocationMeasurements(index, data));
            }
          },
          e => {
            console.log('e', e);
            return dispatch(
              receiveCompareLocationMeasurements(
                index,
                null,
                'Data not available'
              )
            );
          }
        );
    };

    fetcher(1);
  };
}


text:
package filemanager.io;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;

/**
* Manager for reading of and writing to text files.
*/
public class FileManager {
	private static final Charset CHARSET = Charset.forName("US-ASCII");

	private FileManager(){}

	/**
	* Returns a String array of the file where the index corresponds to
	* line number.
	*
	* @param fileName the name of the file to be read
	* @return a String array containing the file's contents
	*/
	public static String[] read(String fileName){
		return read(new File(fileName));
	}

	/**
	* Returns a String array of the file where the index corresponds to
	* line number.
	*
	* @param file the file to be read
	* @return a String array containing the file's contents
	*/
	public static String[] read(File file){
		if(!file.exists()){
			return null;
		}
		ArrayList<String> returnList = new ArrayList<String>();
		try(BufferedReader reader = Files.newBufferedReader(file.toPath(), CHARSET)){
			String line = null;
			while ((line = reader.readLine()) != null){
				returnList.add(line);
			}
		}
		catch(IOException e){
		}
		finally{
			return returnList.toArray(new String[returnList.size()]);
		}
	}

	/**
	* Writes the output to the specified file.
	*
	* @param fileName the name of the file to write to
	* @param output the String to write
	* @return true if the write is successful
	*/
	public static boolean write(String fileName, String output){
		return write(new File(fileName), new String[]{output});
	}

	/**
	* Writes the elements of outputArray to the specified file.
	*
	* @param fileName the name of the file to write to
	* @param outputArray the String array to write
	* @return true if the write is successful
	*/
	public static boolean write(String fileName, String[] outputArray){
		return write(new File(fileName), outputArray);
	}

	/**
	* Writes the output to the specified file.
	*
	* @param file the file to write to
	* @param output the String to write
	* @return true if the write is successful
	*/
	public static boolean write(File file, String output){
		return write(file, new String[]{output});
	}

	/**
	* Writes the elements of outputArray to the specified file.
	*
	* @param fileName the file to write to
	* @param outputArray the String array to write
	* @return true if the write is successful
	*/
	public static boolean write(File file, String[] outputArray){
		try(BufferedWriter writer = Files.newBufferedWriter(file.toPath(), CHARSET)){
			for(String s : outputArray){
				writer.write(s, 0, s.length());
				writer.newLine();
			}
		}
		catch (IOException e){
			return false;
		}
		return true;
	}

	/**
	* Appends the output to the specified file.
	*
	* @param fileName the name of the file to write to
	* @param output the String to write
	* @return true if the write is successful
	*/
	public static boolean append(String fileName, String output){
		return append(new File(fileName), new String[]{output});
	}

	/**
	* Appends the elements of outputArray to the specified file.
	*
	* @param fileName the name of the file to write to
	* @param outputArray the String array to write
	* @return true if the write is successful
	*/
	public static boolean append(String fileName, String[] outputArray){
		return append(new File(fileName), outputArray);
	}

	/**
	* Appends the output to the specified file.
	*
	* @param file the file to write to
	* @param output the String to write
	* @return true if the write is successful
	*/
	public static boolean append(File file, String output){
		return append(file, new String[]{output});
	}

	/**
	* Appends the elements of outputArray to the specified file.
	*
	* @param fileName the file to write to
	* @param outputArray the String array to write
	* @return true if the write is successful
	*/
	public static boolean append(File file, String[] outputArray){
		if(!file.exists()){
			return false;
		}
		String[] preOutputArray = read(file);
		int preOutputLength = preOutputArray.length;
		int outputLength = outputArray.length;
		String[] combinedArray = new String[preOutputLength + outputLength];
		System.arraycopy(preOutputArray, 0, combinedArray, 0, preOutputLength);
		System.arraycopy(outputArray, 0, combinedArray, preOutputLength, outputLength);
		return write(file, combinedArray);
	}
}


text:
<!DOCTYPE HTML>

		<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
		<title>SNSGetTopicAttributesResponse Class Reference</title>
		<meta id="xcode-display" name="xcode-display" content="render"/>
		<meta name="viewport" content="width=550" />
		<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
		<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
		<meta name="generator" content="appledoc 2.0.5 (build 789)" />

AWS SDK for iOS v1.4.3

				Amazon Web Services, Inc.

SNSGetTopicAttributesResponse Class Reference

					<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents">Table of Contents</button>

					<select id="jumpTo">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<option value="properties">Properties</option>

	<option value="//api/name/attributes">    attributes</option>

	<option value="instance_methods">Instance Methods</option>

	<option value="//api/name/attributesValueForKey:">    - attributesValueForKey:</option>

	<option value="//api/name/description">    - description</option>

	<option value="//api/name/init">    - init</option>

	<option value="//api/name/setException:">    - setException:</option>

</select>

Overview

Tasks

Properties

attributes

Instance Methods

attributesValueForKey:

description

init

setException:

Index

Hierarchy

SNSGetTopicAttributesResponse Class Reference

	Inherits from
	SNSResponse : AmazonServiceResponse : NSObject

	Declared in
	SNSGetTopicAttributesResponse.h

Overview

Get Topic Attributes Result

Tasks

		– setException:

If an exception was thrown, this will return the exception.

		– init

Default constructor for a new  object.  Callers should use the
property methods to initialize this object after creating it.

		  attributes

A map of the topic’s attributes. Attributes in this map include the
following:

TopicArn — the topic’s ARN

Owner — the
AWS account ID of the topic’s owner

Policy — the JSON
serialization of the topic’s access control policy

DisplayName — the human-readable name used in the “From” field
for notifications to email and email-json endpoints

SubscriptionsPending — the number of subscriptions pending
confirmation on this topic

SubscriptionsConfirmed — the
number of confirmed subscriptions on this topic

SubscriptionsDeleted — the number of deleted subscriptions on
this topic

DeliveryPolicy — the JSON serialization of the
topic’s delivery policy

EffectiveDeliveryPolicy — the JSON
serialization of the effective delivery policy which takes into
account system defaults

	property

		– attributesValueForKey:

Returns a value from the attributes dictionary for the specified key.

		– description

Returns a string representation of this object; useful for testing and
debugging.

Properties

attributes

A map of the topic’s attributes. Attributes in this map include the
following:

TopicArn — the topic’s ARN

Owner — the
AWS account ID of the topic’s owner

Policy — the JSON
serialization of the topic’s access control policy

DisplayName — the human-readable name used in the “From” field
for notifications to email and email-json endpoints

SubscriptionsPending — the number of subscriptions pending
confirmation on this topic

SubscriptionsConfirmed — the
number of confirmed subscriptions on this topic

SubscriptionsDeleted — the number of deleted subscriptions on
this topic

DeliveryPolicy — the JSON serialization of the
topic’s delivery policy

EffectiveDeliveryPolicy — the JSON
serialization of the effective delivery policy which takes into
account system defaults

@property (nonatomic, retain) NSMutableDictionary *attributes

Discussion

A map of the topic’s attributes. Attributes in this map include the
following:

TopicArn — the topic’s ARN

Owner — the
AWS account ID of the topic’s owner

Policy — the JSON
serialization of the topic’s access control policy

DisplayName — the human-readable name used in the “From” field
for notifications to email and email-json endpoints

SubscriptionsPending — the number of subscriptions pending
confirmation on this topic

SubscriptionsConfirmed — the
number of confirmed subscriptions on this topic

SubscriptionsDeleted — the number of deleted subscriptions on
this topic

DeliveryPolicy — the JSON serialization of the
topic’s delivery policy

EffectiveDeliveryPolicy — the JSON
serialization of the effective delivery policy which takes into
account system defaults

Declared In

		SNSGetTopicAttributesResponse.h

Instance Methods

attributesValueForKey:

Returns a value from the attributes dictionary for the specified key.

- (NSString *)attributesValueForKey:(NSString *)theKey

Discussion

Returns a value from the attributes dictionary for the specified key.

Declared In

		SNSGetTopicAttributesResponse.h

description

Returns a string representation of this object; useful for testing and
debugging.

- (NSString *)description

Return Value

A string representation of this object.

Discussion

Returns a string representation of this object; useful for testing and
debugging.

Declared In

		SNSGetTopicAttributesResponse.h

init

Default constructor for a new  object.  Callers should use the
property methods to initialize this object after creating it.

- (id)init

Discussion

Default constructor for a new  object.  Callers should use the
property methods to initialize this object after creating it.

Declared In

		SNSGetTopicAttributesResponse.h

setException:

If an exception was thrown, this will return the exception.

- (void)setException:(AmazonServiceException *)theException

Discussion

If an exception was thrown, this will return the exception.

Declared In

		AmazonServiceResponse.h

Index

Hierarchy

© 2012 Amazon Web Services, Inc.. All rights reserved. (Last updated: 2012-10-05)

						Generated by appledoc 2.0.5 (build 789).


text:
<?php
namespace Owl;

abstract class Service {
    protected $config = [];

    abstract public function disconnect();

    public function __construct(array $config = []) {
        $this->config = $config;
    }

    public function getConfig($key = null) {
        if ($key === null) {
            return $this->config;
        }

        return isset($this->config[$key])
             ? $this->config[$key]
             : false;
    }
}


text:
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;

namespace SunokoLibrary.Web.GooglePlus
{
    using SunokoLibrary.Web.GooglePlus.Primitive;

    public class CircleInfo : GroupContainer, IReadRange, IPostRange
    {
        public CircleInfo(PlatformClient client, CircleData targetData)
            : base(client, targetData.Name)
        {
            if (targetData == null)
                throw new ArgumentNullException("引数targetDataをnullにする事はできません。");
            _data = targetData;
        }
        CircleData _data;

        public string Id { get { return _data.Id; } }
        public virtual IObservable<ActivityInfo> GetStream()
        {
            return Observable
                .If(() => IsLoadedMember == false,
                    Client.People.UpdateCirclesAndBlockAsync(false, CircleUpdateLevel.LoadedWithMembers).ToObservable(),
                    Observable.Return(System.Reactive.Unit.Default))
                .SelectMany(unit => Client.Activity.GetStream()
                    .OfType<ActivityInfo>()
                    .Where(info => info.PostStatus != PostStatusType.Removed && ContainsKey(info.PostUser.Id))
                    .Catch<ActivityInfo, ApiErrorException>(ex => Observable.Throw(new FailToOperationException<CircleInfo>("CircleInfo.GetStream()の受信中にエラーが発生しました。", this, ex), (ActivityInfo)null)));
        }
        public virtual IInfoList<ActivityInfo> GetActivities()
        { return new ActivityInfoList(this, null, Client, null, null); }
        public async virtual Task<bool> Post(string content)
        {
            try
            {
                await Client.ServiceApi.PostActivity(content,
                    new Dictionary<string, string> { { Id, Name } },
                    new Dictionary<string, string> { }, false, false, Client);
                return true;
            }
            catch (ApiErrorException)
            { return false; }
        }

        public class ActivityInfoList : AccessorBase, IInfoList<ActivityInfo>
        {
            public ActivityInfoList(CircleInfo circleInfo, ProfileInfo profileInfo, PlatformClient client, ActivityData[] activities, string ctVal)
                : base(client)
            {
                _circleInfo = circleInfo;
                _profileInfo = profileInfo;
                _activities = activities != null ? new Queue<ActivityData>(activities) : new Queue<ActivityData>();
                _ctValue = ctVal;
            }
            readonly System.Threading.SemaphoreSlim _syncer = new System.Threading.SemaphoreSlim(1, 1);
            string _ctValue;
            CircleInfo _circleInfo;
            ProfileInfo _profileInfo;
            Queue<ActivityData> _activities;

            public async Task<ActivityInfo[]> TakeAsync(int length)
            {
                var activities = new List<ActivityInfo>();
                for (var i = 0; i < length; )
                {
                    if (_activities.Count > 0)
                    {
                        activities.Add(new ActivityInfo(Client, _activities.Dequeue()));
                        i++;
                        continue;
                    }

                    var oneSetSize = Math.Min(length - activities.Count, 40);
                    var oneSetCount = 0;
                    Tuple<ActivityData[], string> apiResult;
                    try
                    {
                        await _syncer.WaitAsync();
                        var circleId = _circleInfo != null ? _circleInfo.Id == "anyone" ? null : _circleInfo.Id : null;
                        var profileId = _profileInfo != null ? _profileInfo.Id : null;
                        apiResult = await Client.ServiceApi.GetActivitiesAsync(circleId, profileId, _ctValue, length, Client);
                        _ctValue = apiResult.Item2;
                    }
                    catch (ApiErrorException e)
                    { throw new FailToOperationException<ActivityInfoList>("CircleInfoのActivity取得に失敗しました。", this, e); }
                    finally
                    { _syncer.Release(); }

                    foreach (var item in apiResult.Item1)
                    {
                        oneSetCount++;
                        activities.Add(Client.Activity.GetActivityInfo(Client.Activity.InternalUpdateActivity(item).Id));
                        if (++i >= length)
                            break;
                    }
                    //一度にsingleSize分だけ読み込む。同時にsingleLengthで実際何件読み込んだかを記録し、
                    //期待した件数と実際のを比べて違ったらそれ以上読み込めないとして切り上げる
                    if (oneSetCount < oneSetSize)
                        break;
                }
                return activities.ToArray();
            }
        }
    }
    public static class CircleInfoEx
    {
        public static async Task<bool> Post(this IEnumerable<IPostRange> enumerable, string content)
        {
            try
            {
                var groups = CircleInfo.GroupByClient(enumerable);
                foreach (var rangePairs in groups)
                    if (rangePairs.Item1 != null)
                    {
                        var client = rangePairs.Item1;
                        var circles = rangePairs.Item2.Cast<IPostRange>();
                        await client.ServiceApi.PostActivity(
                            content, circles.ToDictionary(obj => obj.Id, obj => obj.Name),
                            new Dictionary<string, string> { }, false, false, client);
                    }
                    else
                        foreach (var postRange in rangePairs.Item2)
                            await postRange.Post(content);
                return true;
            }
            catch (ApiErrorException)
            { return false; }
        }
        public static IObservable<ActivityInfo> GetStream(this IEnumerable<IReadRange> enumerable)
        {
            var groups = CircleInfo.GroupByClient(enumerable);
            var streams = groups.Where(pair => pair.Item1 != null).Select(
                aa => aa.Item1.Activity.GetStream()
                    .OfType<ActivityInfo>()
                    .Where(info =>
                    {
                        var res = info.PostStatus != PostStatusType.Removed
                            && info.PostUser.Circles.Where(circle => aa.Item2.Any(val => ((CircleInfo)val).Id == circle.Id)).Any();
                        return res;
                    }))
                    .Concat(groups.Last().Item2.Select(readRange => readRange.GetStream()));
            return Observable.Merge(streams).Distinct(activity => activity.Id);
        }
    }
}