text:
package unix

import "unsafe"

// Round the length of a raw sockaddr up to align it properly.
func rsaAlignOf(salen int) int {
	salign := sizeofPtr
	// NOTE: It seems like 64-bit Darwin kernel still requires
	// 32-bit aligned access to BSD subsystem. Also NetBSD 6
	// kernel and beyond require 64-bit aligned access to routing
	// facilities.
	if darwin64Bit {
		salign = 4
	} else if netbsd32Bit {
		salign = 8
	}
	if salen == 0 {
		return salign
	}
	return (salen + salign - 1) & ^(salign - 1)
}

// RouteRIB returns routing information base, as known as RIB,
// which consists of network facility information, states and
// parameters.
func RouteRIB(facility, param int) ([]byte, error) {
	mib := []_C_int{CTL_NET, AF_ROUTE, 0, 0, _C_int(facility), _C_int(param)}
	// Find size.
	n := uintptr(0)
	if err := sysctl(mib, nil, &n, nil, 0); err != nil {
		return nil, err
	}
	if n == 0 {
		return nil, nil
	}
	tab := make([]byte, n)
	if err := sysctl(mib, &tab[0], &n, nil, 0); err != nil {
		return nil, err
	}
	return tab[:n], nil
}

// RoutingMessage represents a routing message.
type RoutingMessage interface {
	sockaddr() []Sockaddr
}

const anyMessageLen = int(unsafe.Sizeof(anyMessage{}))

type anyMessage struct {
	Msglen  uint16
	Version uint8
	Type    uint8
}

// RouteMessage represents a routing message containing routing
// entries.
type RouteMessage struct {
	Header RtMsghdr
	Data   []byte
}

const rtaRtMask = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_GENMASK

func (m *RouteMessage) sockaddr() []Sockaddr {
	var (
		af  int
		sas [4]Sockaddr
	)
	b := m.Data[:]
	for i := uint(0); i < RTAX_MAX; i++ {
		if m.Header.Addrs&rtaRtMask&(1<<i) == 0 {
			continue
		}
		rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
		switch i {
		case RTAX_DST, RTAX_GATEWAY:
			sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
			if err != nil {
				return nil
			}
			if i == RTAX_DST {
				af = int(rsa.Family)
			}
			sas[i] = sa
		case RTAX_NETMASK, RTAX_GENMASK:
			switch af {
			case AF_INET:
				rsa4 := (*RawSockaddrInet4)(unsafe.Pointer(&b[0]))
				sa := new(SockaddrInet4)
				for j := 0; rsa4.Len > 0 && j < int(rsa4.Len)-int(unsafe.Offsetof(rsa4.Addr)); j++ {
					sa.Addr[j] = rsa4.Addr[j]
				}
				sas[i] = sa
			case AF_INET6:
				rsa6 := (*RawSockaddrInet6)(unsafe.Pointer(&b[0]))
				sa := new(SockaddrInet6)
				for j := 0; rsa6.Len > 0 && j < int(rsa6.Len)-int(unsafe.Offsetof(rsa6.Addr)); j++ {
					sa.Addr[j] = rsa6.Addr[j]
				}
				sas[i] = sa
			}
		}
		b = b[rsaAlignOf(int(rsa.Len)):]
	}
	return sas[:]
}

// InterfaceMessage represents a routing message containing
// network interface entries.
type InterfaceMessage struct {
	Header IfMsghdr
	Data   []byte
}

func (m *InterfaceMessage) sockaddr() (sas []Sockaddr) {
	if m.Header.Addrs&RTA_IFP == 0 {
		return nil
	}
	sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(&m.Data[0])))
	if err != nil {
		return nil
	}
	return append(sas, sa)
}

// InterfaceAddrMessage represents a routing message containing
// network interface address entries.
type InterfaceAddrMessage struct {
	Header IfaMsghdr
	Data   []byte
}

const rtaIfaMask = RTA_IFA | RTA_NETMASK | RTA_BRD

func (m *InterfaceAddrMessage) sockaddr() (sas []Sockaddr) {
	if m.Header.Addrs&rtaIfaMask == 0 {
		return nil
	}
	b := m.Data[:]
	// We still see AF_UNSPEC in socket addresses on some
	// platforms. To identify each address family correctly, we
	// will use the address family of RTAX_NETMASK as a preferred
	// one on the 32-bit NetBSD kernel, also use the length of
	// RTAX_NETMASK socket address on the FreeBSD kernel.
	preferredFamily := uint8(AF_UNSPEC)
	for i := uint(0); i < RTAX_MAX; i++ {
		if m.Header.Addrs&rtaIfaMask&(1<<i) == 0 {
			continue
		}
		rsa := (*RawSockaddr)(unsafe.Pointer(&b[0]))
		switch i {
		case RTAX_IFA:
			if rsa.Family == AF_UNSPEC {
				rsa.Family = preferredFamily
			}
			sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
			if err != nil {
				return nil
			}
			sas = append(sas, sa)
		case RTAX_NETMASK:
			switch rsa.Family {
			case AF_UNSPEC:
				switch rsa.Len {
				case SizeofSockaddrInet4:
					rsa.Family = AF_INET
				case SizeofSockaddrInet6:
					rsa.Family = AF_INET6
				default:
					rsa.Family = AF_INET // an old fashion, AF_UNSPEC means AF_INET
				}
			case AF_INET, AF_INET6:
				preferredFamily = rsa.Family
			default:
				return nil
			}
			sa, err := anyToSockaddr((*RawSockaddrAny)(unsafe.Pointer(rsa)))
			if err != nil {
				return nil
			}
			sas = append(sas, sa)
		case RTAX_BRD:
			// nothing to do
		}
		b = b[rsaAlignOf(int(rsa.Len)):]
	}
	return sas
}

// ParseRoutingMessage parses b as routing messages and returns the
// slice containing the RoutingMessage interfaces.
func ParseRoutingMessage(b []byte) (msgs []RoutingMessage, err error) {
	msgCount := 0
	for len(b) >= anyMessageLen {
		msgCount++
		any := (*anyMessage)(unsafe.Pointer(&b[0]))
		if any.Version != RTM_VERSION {
			b = b[any.Msglen:]
			continue
		}
		msgs = append(msgs, any.toRoutingMessage(b))
		b = b[any.Msglen:]
	}
	// We failed to parse any of the messages - version mismatch?
	if msgCount > 0 && len(msgs) == 0 {
		return nil, EINVAL
	}
	return msgs, nil
}

// ParseRoutingMessage parses msg's payload as raw sockaddrs and
// returns the slice containing the Sockaddr interfaces.
func ParseRoutingSockaddr(msg RoutingMessage) (sas []Sockaddr, err error) {
	return append(sas, msg.sockaddr()...), nil
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Trans. Sapporo nat. Hist. Soc. 15: 125 (1938)

#### Original name
Puccinia caricis-maximowiczii Homma

### Remarks
null

redpajama_set_name: RedPajamaGithub


text:
export MOUNT_HD_PARTITION_NUMBER='1'
export MOUNT_HD_FS_TYPE='ext4'
export MOUNT_HD_MOUNT_OPTIONS='defaults'
export MOUNT_HD_DUMP='0'
export MOUNT_HD_FSCK_OPTION='2'


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ProductFactoryExtensions.cs" company="Sitecore Corporation">
//   Copyright (c) Sitecore Corporation 1999-2015
// </copyright>
// <summary>
//   Defines the product factory extensions class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
// Copyright 2015 Sitecore Corporation A/S
// 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.
// -------------------------------------------------------------------------------------------

namespace Sitecore.Ecommerce.DomainModel.Products
{
  /// <summary>
  /// Defines the product factory extensions class.
  /// </summary>
  public static class ProductFactoryExtensions
  {
    /// <summary>
    /// Creates the specified template.
    /// </summary>
    /// <typeparam name="T">The product type.</typeparam>
    /// <param name="factory">The factory.</param>
    /// <param name="template">The template.</param>
    /// <returns>
    /// The product.
    /// </returns>
    public static T Create<T>(this ProductFactory factory, string template) where T : ProductBaseData
    {
      return factory.Create(template) as T;
    }
  }
}


text:
@interface WelcomeViewController : UIViewController

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UIViewController *rootViewController;

@end


text:
require.config({
  paths: {
    json: 'lib/requirejs-plugins/src/json',
    jasmine: 'lib/jasmine/lib/jasmine-core/jasmine',
    'jasmine-html': 'lib/jasmine/lib/jasmine-core/jasmine-html',
    'jasmine-jquery': 'lib/jasmine-jquery/lib/jasmine-jquery',
    inherits: 'lib/inherits/inherits',
    base64: 'lib/base64/base64.min',
    jquery: 'lib/jquery/jquery',
    hgn: 'lib/requirejs-hogan-plugin/hgn',
    hogan: 'lib/hogan/web/builds/2.0.0/hogan-2.0.0.amd',
    text: 'lib/requirejs-text/text',
    'event-emitter': 'lib/event-emitter/src/event-emitter'
  },
  packages: [{
    name: "streamhub-author-content",
    location: "src"
  },{
    name: "streamhub-sdk",
    location: "lib/streamhub-sdk/src"
  },{
    name: "streamhub-sdk/auth",
    location: "lib/streamhub-sdk/src/auth"
  },{
    name: "streamhub-sdk/collection",
    location: "lib/streamhub-sdk/src/collection"
  },{
    name: "streamhub-sdk/content",
    location: "lib/streamhub-sdk/src/content"
  },{
    name: "streamhub-sdk/modal",
    location: "lib/streamhub-sdk/src/modal"
  },{
    name: "streamhub-sdk/jquery",
    location: "lib/streamhub-sdk/src",
    main: "jquery"
  },{
    name: "streamhub-sdk-tests",
    location: "tests"
  },{
    name: "stream",
    location: "lib/stream/src"
  },{
    name: "view",
    location: "lib/view/src",
    main: "view"
  }],
  shim: {
    jasmine: {
        exports: 'jasmine'
    },
    'jasmine-html': {
        deps: ['jasmine'],
        exports: 'jasmine'
    },
    jquery: {
        exports: '$'
    }
  }
});


text:
(() => {
  'use strict'; // eslint-disable-line strict

  document.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('.mustache-browser__link').forEach((link) => {
      link.addEventListener('click', (e) => {
        // Only run when loaded from within the iframe.
        if (parent === window) {
          return;
        }

        e.preventDefault();

        const messageObj = {
          event: 'patternlab.updatePath',
          path: link.dataset.path,
          patternPartial: link.dataset.patternPartial
        };
        const targetOrigin =
          (window.location.protocol === 'file:') ? '*' : window.location.protocol + '//' + window.location.host;

        parent.postMessage(messageObj, targetOrigin);
      });
    });
  });
})();


text:
package com.xmartlabs.daydreaming;

import android.support.annotation.Nullable;
import android.util.Log;

import com.crashlytics.android.Crashlytics;

import timber.log.Timber;

public class CrashlyticsTree extends Timber.Tree {
  private static final String CRASHLYTICS_KEY_PRIORITY = "priority";
  private static final String CRASHLYTICS_KEY_TAG = "tag";
  private static final String CRASHLYTICS_KEY_MESSAGE = "message";

  @Override
  protected void log(int priority, @Nullable String tag, @Nullable String message, @Nullable Throwable t) {
    if (priority == Log.VERBOSE || priority == Log.DEBUG || priority == Log.INFO) {
      return;
    }

    Crashlytics.setInt(CRASHLYTICS_KEY_PRIORITY, priority);
    Crashlytics.setString(CRASHLYTICS_KEY_TAG, tag);
    Crashlytics.setString(CRASHLYTICS_KEY_MESSAGE, message);

    if (t == null) {
      Crashlytics.logException(new Exception(message));
    } else {
      Crashlytics.logException(t);
    }
  }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using UniversityTimetabling;
using UniversityTimetabling.MIPModels;
using UniversityTimetabling.StrategicOpt;

namespace UnitTests
{

    [TestFixture]
    internal class MultiObjectiveOneObjectiveTests : UnitTestBase
    {
        private int Timelimit = 15*60;

        private bool ConsoleToFile = true;

        [Test, Combinatorial]
        public void MultiObjOneObjetive([Values(
       ITC_Comp01,
         ITC_Comp02,
         ITC_Comp03,
         ITC_Comp04,
         ITC_Comp05,
         ITC_Comp06,
         ITC_Comp07,
         ITC_Comp08,
         ITC_Comp09,
         ITC_Comp10,
         ITC_Comp11,
         ITC_Comp12,
         ITC_Comp13,
         ITC_Comp14,
         ITC_Comp15,
         ITC_Comp16,
         ITC_Comp17,
         ITC_Comp18,
         ITC_Comp19,
         ITC_Comp20,
         ITC_Comp21
            )]
        string filename,
            [Values(ProblemFormulation.Objective.MinimumWorkingDaysWeight,
            ProblemFormulation.Objective.CurriculumCompactnessWeight,
            ProblemFormulation.Objective.BadTimeslots,
            ProblemFormulation.Objective.StudentMinMaxLoadWeight)]
        ProblemFormulation.Objective objective)
        {
            //ProblemFormulation.Objective objective = ProblemFormulation.Objective.BadTimeslots;

            var algoname = nameof(MultiObjOneObjetive) + "_" + Enum.GetName(objective.GetType(), objective);
            if (ConsoleToFile)
                SetConsoleOutputToFile(@"c:\temp\multiobjective\\logs\\" + filename + "\\" + algoname + ".log");

            var data = Data.ReadXml(dataPath + filename, "120", "4");
            //var newrooms = CreateRooms(data);
             var newrooms = CreateRoomsFixedSize(data, 25,1);
            data.SetRoomList(newrooms);

            var problemFormulation = ProblemFormulation.EverythingZero;
            problemFormulation.SetWeight(objective,1);
            //problemFormulation.AvailabilityHardConstraint = false;

            var mipModelParameters = new CCTModel.MIPModelParameters()
            {
                TuneGurobi = true,
                UseStageIandII = false,
                // UseStageIandII = true,
                UseHallsConditions = true,
                UseRoomHallConditions = true,
                //ConstraintPenalty = null, //1,
                ConstraintPenalty = 50,
                UseRoomsAsTypes = true,
            };

            var solver = new MultiObjectiveSolver(data,problemFormulation, mipModelParameters)
            {
                Timelimit = Timelimit,
                EpsilonOnQuality = true,
                EpsilonRelaxing = false,
            };

            Console.WriteLine("Algorithm: " + algoname);
            DisplayParameterObject(problemFormulation);
            DisplayParameterObject(solver);
            DisplayParameterObject(solver.MipParameters);
            var pareto = solver.Run();
            WriteSol(@"c:\temp\multiobjective\", filename, data,problemFormulation ,algoname, DateTime.Now.ToString(), pareto);
        }

    }
}


text:
@interface LCSDiskImageDetachCommand : LCSExternalCommand
-(id)initWithDevicePath:(NSString*)devicePath;
+(LCSDiskImageDetachCommand*)commandWithDevicePath:(NSString*)devicePath;
@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cqut.mapper.CompanyInfoMapper">
    <resultMap id="BaseResultMap" type="com.cqut.entity.entity.CompanyInfo">
        <id property="companyInfoId" column="company_info_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="companyRegisteredAddress" column="company_registered_address" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="area" column="area" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="businessLicense" column="business_license" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="uniformIdentificationCode" column="uniform_identification_code" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="companyLegalPerson" column="company_legal_person" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="companyLegalPersonPhoneNumber" column="company_legal_person_phone_number" javaType="java.lang.String" jdbcType="VARCHAR"/>
        <result property="companyStatus" column="company_status" javaType="java.lang.Boolean" jdbcType="BIT"/>
        <result property="organizationId" column="organization_id" javaType="java.lang.String" jdbcType="VARCHAR"/>
    </resultMap>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
        delete from sys_company_info
        where company_info_id = #{companyInfoId,jdbcType=VARCHAR}
    </delete>

    <delete id="deleteByOrgId" parameterType="java.lang.String">
        delete from sys_company_info
        where organization_id = #{orgId,jdbcType=VARCHAR}
    </delete>

    <insert id="insert" parameterType="com.cqut.entity.entity.CompanyInfo">
        insert into sys_company_info (company_info_id, company_registered_address,
        area, business_license, uniform_identification_code,
        company_legal_person, company_legal_person_phone_number,
        company_status, organization_id)
        values (#{companyInfo.companyInfoId,jdbcType=VARCHAR}, #{companyInfo.companyRegisteredAddress,jdbcType=VARCHAR},
        #{companyInfo.area,jdbcType=VARCHAR}, #{companyInfo.businessLicense,jdbcType=VARCHAR}, #{companyInfo.uniformIdentificationCode,jdbcType=VARCHAR},
        #{companyInfo.companyLegalPerson,jdbcType=VARCHAR}, #{companyInfo.companyLegalPersonPhoneNumber,jdbcType=VARCHAR},
        #{companyInfo.companyStatus,jdbcType=BIT}, #{companyInfo.organizationId,jdbcType=VARCHAR})
    </insert>

    <update id="updateByPrimaryKey" parameterType="com.cqut.entity.entity.CompanyInfo">
        update sys_company_info
            set company_registered_address = #{companyInfo.companyRegisteredAddress,jdbcType=VARCHAR},
            area = #{companyInfo.area,jdbcType=VARCHAR},
            business_license = #{companyInfo.businessLicense,jdbcType=VARCHAR},
            uniform_identification_code = #{companyInfo.uniformIdentificationCode,jdbcType=VARCHAR},
            company_legal_person = #{companyInfo.companyLegalPerson,jdbcType=VARCHAR},
            company_legal_person_phone_number = #{companyInfo.companyLegalPersonPhoneNumber,jdbcType=VARCHAR},
            company_status = #{companyInfo.companyStatus,jdbcType=BIT},
            organization_id = #{companyInfo.organizationId,jdbcType=VARCHAR}
        where company_info_id = #{companyInfo.companyInfoId,jdbcType=VARCHAR}
    </update>

    <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
        select company_info_id, company_registered_address, area, business_license, uniform_identification_code,
            company_legal_person, company_legal_person_phone_number, company_status, organization_id
            from sys_company_info
            where company_info_id = #{companyInfoId,jdbcType=VARCHAR}
    </select>

    <select id="selectAll" resultMap="BaseResultMap">
        select company_info_id, company_registered_address, area, business_license, uniform_identification_code,
            company_legal_person, company_legal_person_phone_number, company_status, organization_id
        from sys_company_info
    </select>

    <select id="selectByOrgId" resultMap="BaseResultMap">
        select company_info_id, company_registered_address, area, business_license, uniform_identification_code,
        company_legal_person, company_legal_person_phone_number, company_status, organization_id
        from sys_company_info
        WHERE organization_id = #{orgId,jdbcType=VARCHAR}
    </select>
</mapper>


text:
module BWAPI
  class Client
    module Client
      # Subclients module for client/subclient endpoints
      module SubClients
        # Get all sub clients
        #
        # @param client_id [Integer] Id of the client
        # @param opts [Hash] options hash of parameters
        # @option opts [Integer] page Page of projects to retrieve
        # @option opts [Integer] pageSize Results per page of results
        # @return [Hash] All sub clients for client
        def client_sub_clients(client_id, opts = {})
          get "/client/#{client_id}/subclients", opts
        end

        # Get specific sub client of client
        #
        # @param client_id [Integer] Id of the client
        # @param sub_client_id [Integer] Id of the sub client
        # @return [Hash] Specific sub client for client
        def get_client_sub_client(client_id, sub_client_id)
          get "/client/#{client_id}/subclients/#{sub_client_id}"
        end

        # Create new subclient
        #
        # @param client_id [Integer] Id of the client
        # @param opts [Hash] options hash of parameters
        # @option opts [Date] startDate Start date of the client
        # @option opts [String] contactTitle Contact title of the client
        # @option opts [String] address1 Address line one of the client
        # @option opts [String] address2 Address line two of the client
        # @option opts [String] address3 Address line three of the client
        # @option opts [String] pricingModel Pricing model of the client
        # @option opts [Integer] mentionArchiveSize Mention archive size for the client
        # @option opts [Integer] id Id of the sub client
        # @option opts [Integer] parentId Parent id of the sub client
        # @option opts [Integer] maxUsers Maxiumum number of users for the client
        # @option opts [Boolean] isLegacy Legacy status of the client
        # @option opts [String] name Name of the client
        # @option opts [String] contactTelephone Telephone number of the client
        # @option opts [Integer] priceStructureId Id of the price structure for client
        # @option opts [Hash] tags Tags for the client
        # @option opts [String] website The website for the client
        # @option opts [String] contactEmail The contact email for the client
        # @option opts [Date] expiryDate The expiry date for the client
        # @option opts [String] theme The theme of the client
        # @option opts [Integer] priceStructureLineId The level of the price structure for the client
        # @option opts [Integer] mentionBasedPricingMatrixLevel The amount of mentions allowed
        # @option opts [String] postcode The postcode of the client
        # @option opts [String] country The country of the client
        # @option opts [String] contactName The contact name of the client
        # @option opts [Integer] maximumSubscribedBrands The maximum subscribed brands for the client
        # @option opts [String] contactMobile The mobile number for the client
        # @return [Hash] New sub client
        def create_client_sub_client(client_id, opts = {})
          post "/client/#{client_id}/subclients", opts
        end

        # Update new subclient
        #
        # @param client_id [Integer] Id of the client
        # @param sub_client_id [Integer] Id of the sub client
        # @param opts [Hash] options hash of parameters
        # @option opts [Date] startDate Start date of the client
        # @option opts [String] contactTitle Contact title of the client
        # @option opts [String] address1 Address line one of the client
        # @option opts [String] address2 Address line two of the client
        # @option opts [String] address3 Address line three of the client
        # @option opts [String] pricingModel Pricing model of the client
        # @option opts [Integer] mentionArchiveSize Mention archive size for the client
        # @option opts [Integer] id Id of the sub client
        # @option opts [Integer] parentId Parent id of the sub client
        # @option opts [Integer] maxUsers Maxiumum number of users for the client
        # @option opts [Boolean] isLegacy Legacy status of the client
        # @option opts [String] name Name of the client
        # @option opts [String] contactTelephone Telephone number of the client
        # @option opts [Integer] priceStructureId Id of the price structure for client
        # @option opts [Hash] tags Tags for the client
        # @option opts [String] website The website for the client
        # @option opts [String] contactEmail The contact email for the client
        # @option opts [Date] expiryDate The expiry date for the client
        # @option opts [String] theme The theme of the client
        # @option opts [Integer] priceStructureLineId The level of the price structure for the client
        # @option opts [Integer] mentionBasedPricingMatrixLevel The amount of mentions allowed
        # @option opts [String] postcode The postcode of the client
        # @option opts [String] country The country of the client
        # @option opts [String] contactName The contact name of the client
        # @option opts [Integer] maximumSubscribedBrands The maximum subscribed brands for the client
        # @option opts [String] contactMobile The mobile number for the client
        # @return [Hash] Edited sub client
        def update_client_sub_client(client_id, sub_client_id, opts = {})
          put "/client/#{client_id}/subclients/#{sub_client_id}", opts
        end

        # Delete specific sub client of client
        #
        # @param client_id [Integer] Id of the client
        # @param sub_client_id [Integer] Id of the sub client
        # @return [Hash] Specific sub client for client
        def delete_client_sub_client(client_id, sub_client_id)
          delete "/client/#{client_id}/subclients/#{sub_client_id}"
        end
      end
    end
  end
end


text:
package com.ju51.nutch.plugin.protocol.test;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
import org.apache.nutch.crawl.CrawlDatum;
import org.apache.nutch.metadata.Metadata;
import org.apache.nutch.protocol.Content;
import org.apache.nutch.protocol.Protocol;
import org.apache.nutch.protocol.ProtocolOutput;
import org.apache.nutch.protocol.RobotRulesParser;

import crawlercommons.robots.BaseRobotRules;

/**
 * DateTime: 2015年7月2日 上午11:17:19
 *
 */
public class TestProtocol implements Protocol {
    private Configuration conf = null;

    @Override
    public Configuration getConf() {
        return conf;
    }

    @Override
    public void setConf(Configuration conf) {
        this.conf = conf;
    }

    @Override
    public ProtocolOutput getProtocolOutput(Text url, CrawlDatum datum) {
        Content c =
                new Content(url.toString(), url.toString(), "hello world".getBytes(), "text/html",
                    new Metadata(), this.conf); // 返回的网页内容为"hello world"
        return new ProtocolOutput(c);
    }

    @Override
    public BaseRobotRules getRobotRules(Text url, CrawlDatum datum) {
        return RobotRulesParser.EMPTY_RULES; // 没有robot规则
    }

}


text:
window.$$ = function(s) {
    var c = {
        '#': 'ById',
        '.': 'sByClassName',
        '@': 'sByName',
        '=': 'sByTagName'}[s[0]];
    return document[c?'getElement'+c:'querySelectorAll'](s.slice(1))
};

var Sugarcane = {
  target: '',
  floor: '',
  originalEl: '',
  floorEl: '',
  cloneEl: '',
  state: false,
  ready: function (options) {
    Sugarcane.target = options.target || 'nav';
    Sugarcane.floor = options.floor || 'footer';
    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", Sugarcane.pageStart, false);
    } else if (document.attachEvent) {
        document.attachEvent("onreadystatechange", function() {
            if (document.readyState === "complete" ) {
                Sugarcane.pageStart();
        }
        });
    } else {
      Sugarcane.pageStart();
    }
  },
  pageStart: function(){
    var t = $$(Sugarcane.target)[0];
    if(t){
      Sugarcane.floorEl = $$(Sugarcane.floor)[0];
      Sugarcane.originalEl = t;
      Sugarcane.cloneEl = t.cloneNode(true);
      Sugarcane.cloneEl.style.display = 'none';
      Sugarcane.cloneEl.style.position = 'fixed';
      Sugarcane.cloneEl.style.left = (Sugarcane.originalEl.offsetLeft + Sugarcane.originalEl.offsetParent.offsetLeft)+ 'px';
      Sugarcane.cloneEl.style.width = Sugarcane.originalEl.offsetWidth + 'px';
      Sugarcane.cloneEl.style.top = '0px';

      Sugarcane.originalEl.parentNode.insertBefore(Sugarcane.cloneEl, Sugarcane.originalEl);
      Sugarcane.switchTop = Sugarcane.originalEl.getBoundingClientRect().top;
      Sugarcane.switchFloor =  Sugarcane.floorEl ? Sugarcane.floorEl.getBoundingClientRect().top : null;
      scrollIntervalID = setInterval(Sugarcane.scrollChange, 10);
      window.onresize = function(event) {
         Sugarcane.scrollChange();
      };
    }
  },
  scrollChange: function(){

    var top = Sugarcane.getScroll();

    if( ( (top + Sugarcane.originalEl.getBoundingClientRect().height) > Sugarcane.switchFloor) && Sugarcane.switchFloor) {
      Sugarcane.cloneEl.style.display = 'none';
      Sugarcane.state = false;
      return true;
    }
    else if (top > Sugarcane.switchTop && !Sugarcane.state) {
      Sugarcane.cloneEl.style.display = 'block';
      Sugarcane.originalEl.style.display = 'none';
      Sugarcane.state = true;
    } else if(top < Sugarcane.switchTop && Sugarcane.state) {
      Sugarcane.originalEl.style.display = 'block';
      Sugarcane.cloneEl.style.display = 'none';
      Sugarcane.state = false;
    }
    return true;
  },

  getScroll: function() {
    var scroll = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
      scroll = window.pageYOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
      scroll = document.body.scrollTop;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
      scroll = document.documentElement.scrollTop;
    }
    return scroll;
  }
}

window.Sugarcane = Sugarcane;


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#include "pal_ssl.h"
#include "openssl.h"

#include <assert.h>
#include <string.h>
#include <stdbool.h>

c_static_assert(PAL_SSL_ERROR_NONE == SSL_ERROR_NONE);
c_static_assert(PAL_SSL_ERROR_SSL == SSL_ERROR_SSL);
c_static_assert(PAL_SSL_ERROR_WANT_READ == SSL_ERROR_WANT_READ);
c_static_assert(PAL_SSL_ERROR_WANT_WRITE == SSL_ERROR_WANT_WRITE);
c_static_assert(PAL_SSL_ERROR_SYSCALL == SSL_ERROR_SYSCALL);
c_static_assert(PAL_SSL_ERROR_ZERO_RETURN == SSL_ERROR_ZERO_RETURN);

int32_t CryptoNative_EnsureOpenSslInitialized(void);

#ifdef NEED_OPENSSL_1_0
static void EnsureLibSsl10Initialized()
{
    SSL_library_init();
    SSL_load_error_strings();
}
#endif

void CryptoNative_EnsureLibSslInitialized()
{
    CryptoNative_EnsureOpenSslInitialized();

    // If portable, call the 1.0 initializer when needed.
    // If 1.0, call it statically.
    // In 1.1 no action is required, since EnsureOpenSslInitialized does both libraries.
#ifdef FEATURE_DISTRO_AGNOSTIC_SSL
    if (API_EXISTS(SSL_state))
    {
        EnsureLibSsl10Initialized();
    }
#elif OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_1_1_0_RTM
    EnsureLibSsl10Initialized();
#endif
}

const SSL_METHOD* CryptoNative_SslV2_3Method()
{
    const SSL_METHOD* method = TLS_method();
    assert(method != NULL);
    return method;
}

SSL_CTX* CryptoNative_SslCtxCreate(SSL_METHOD* method)
{
    SSL_CTX* ctx = SSL_CTX_new(method);

    if (ctx != NULL)
    {
        // As of OpenSSL 1.1.0, compression is disabled by default. In case an older build
        // is used, ensure it's disabled.
        SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION);
    }

    return ctx;
}

/*
Openssl supports setting ecdh curves by default from version 1.1.0.
For lower versions, this is the recommended approach.
Returns 1 on success, 0 on failure.
*/
static long TrySetECDHNamedCurve(SSL_CTX* ctx)
{
#ifdef NEED_OPENSSL_1_0
    uint32_t version = CryptoNative_OpenSslVersionNumber();
    long result = 0;

    if (version >= OPENSSL_VERSION_1_1_0_RTM)
    {
        // OpenSSL 1.1+ automatically set up ECDH
        result = 1;
    }
    else if (version >= OPENSSL_VERSION_1_0_2_RTM)
    {
#ifndef SSL_CTRL_SET_ECDH_AUTO
#define SSL_CTRL_SET_ECDH_AUTO 94
#endif
        // Expanded form of SSL_CTX_set_ecdh_auto(ctx, 1)
        result = SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, 1, NULL);
    }
    else
    {
        EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);

        if (ecdh != NULL)
        {
            result = SSL_CTX_set_tmp_ecdh(ctx, ecdh);
            EC_KEY_free(ecdh);
        }
    }

	return result;
#else
    (void)ctx;
    return 1;
#endif
}

void CryptoNative_SetProtocolOptions(SSL_CTX* ctx, SslProtocols protocols)
{
    // Ensure that ECDHE is available
    if (TrySetECDHNamedCurve(ctx) == 0)
    {
        ERR_clear_error();
    }

    // protocols may be 0, meaning system default, in which case let OpenSSL do what OpenSSL wants.
    if (protocols == 0)
    {
        return;
    }

    unsigned long protocolOptions = 0;

    if ((protocols & PAL_SSL_SSL2) != PAL_SSL_SSL2)
    {
        protocolOptions |= SSL_OP_NO_SSLv2;
    }
    if ((protocols & PAL_SSL_SSL3) != PAL_SSL_SSL3)
    {
        protocolOptions |= SSL_OP_NO_SSLv3;
    }
    if ((protocols & PAL_SSL_TLS) != PAL_SSL_TLS)
    {
        protocolOptions |= SSL_OP_NO_TLSv1;
    }
    if ((protocols & PAL_SSL_TLS11) != PAL_SSL_TLS11)
    {
        protocolOptions |= SSL_OP_NO_TLSv1_1;
    }
    if ((protocols & PAL_SSL_TLS12) != PAL_SSL_TLS12)
    {
        protocolOptions |= SSL_OP_NO_TLSv1_2;
    }

    // protocol options were specified, and there's no handler yet for TLS 1.3.
#ifndef SSL_OP_NO_TLSv1_3
#define SSL_OP_NO_TLSv1_3 0x20000000U
#endif
    protocolOptions |= SSL_OP_NO_TLSv1_3;

    // OpenSSL 1.0 calls this long, OpenSSL 1.1 calls it unsigned long.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wsign-conversion"
    SSL_CTX_set_options(ctx, protocolOptions);
#pragma clang diagnostic pop
}

SSL* CryptoNative_SslCreate(SSL_CTX* ctx)
{
    return SSL_new(ctx);
}

int32_t CryptoNative_SslGetError(SSL* ssl, int32_t ret)
{
    // This pops off "old" errors left by other operations
    // until the first error is equal to the last one,
    // this should be looked at again when OpenSsl 1.1 is migrated to
    while (ERR_peek_error() != ERR_peek_last_error())
    {
        ERR_get_error();
    }

    // The error queue should be cleaned outside, if done here there will be no info
    // for managed exception.
    return SSL_get_error(ssl, ret);
}

void CryptoNative_SslDestroy(SSL* ssl)
{
    if (ssl)
    {
        SSL_free(ssl);
    }
}

void CryptoNative_SslCtxDestroy(SSL_CTX* ctx)
{
    if (ctx)
    {
        SSL_CTX_free(ctx);
    }
}

void CryptoNative_SslSetConnectState(SSL* ssl)
{
    SSL_set_connect_state(ssl);
}

void CryptoNative_SslSetAcceptState(SSL* ssl)
{
    SSL_set_accept_state(ssl);
}

const char* CryptoNative_SslGetVersion(SSL* ssl)
{
    return SSL_get_version(ssl);
}

int32_t CryptoNative_SslGetFinished(SSL* ssl, void* buf, int32_t count)
{
    size_t result = SSL_get_finished(ssl, buf, (size_t)count);
    assert(result <= INT32_MAX);
    return (int32_t)result;
}

int32_t CryptoNative_SslGetPeerFinished(SSL* ssl, void* buf, int32_t count)
{
    size_t result = SSL_get_peer_finished(ssl, buf, (size_t)count);
    assert(result <= INT32_MAX);
    return (int32_t)result;
}

int32_t CryptoNative_SslSessionReused(SSL* ssl)
{
    return SSL_session_reused(ssl) == 1;
}

static bool StringSpanEquals(const char* lhs, const char* rhs, size_t lhsLength)
{
    if (lhsLength != strlen(rhs))
    {
        return false;
    }

    return strncmp(lhs, rhs, lhsLength) == 0;
}

static CipherAlgorithmType MapCipherAlgorithmType(const char* encryption, size_t encryptionLength)
{
    if (StringSpanEquals(encryption, "DES(56)", encryptionLength))
        return Des;
    if (StringSpanEquals(encryption, "3DES(168)", encryptionLength))
        return TripleDes;
    if (StringSpanEquals(encryption, "RC4(128)", encryptionLength))
        return Rc4;
    if (StringSpanEquals(encryption, "RC2(128)", encryptionLength))
        return Rc2;
    if (StringSpanEquals(encryption, "None", encryptionLength))
        return Null;
    if (StringSpanEquals(encryption, "IDEA(128)", encryptionLength))
        return SSL_IDEA;
    if (StringSpanEquals(encryption, "SEED(128)", encryptionLength))
        return SSL_SEED;
    if (StringSpanEquals(encryption, "AES(128)", encryptionLength))
        return Aes128;
    if (StringSpanEquals(encryption, "AES(256)", encryptionLength))
        return Aes256;
    if (StringSpanEquals(encryption, "Camellia(128)", encryptionLength))
        return SSL_CAMELLIA128;
    if (StringSpanEquals(encryption, "Camellia(256)", encryptionLength))
        return SSL_CAMELLIA256;
    if (StringSpanEquals(encryption, "GOST89(256)", encryptionLength))
        return SSL_eGOST2814789CNT;
    if (StringSpanEquals(encryption, "AESGCM(128)", encryptionLength))
        return Aes128;
    if (StringSpanEquals(encryption, "AESGCM(256)", encryptionLength))
        return Aes256;

    return CipherAlgorithmType_None;
}

static ExchangeAlgorithmType MapExchangeAlgorithmType(const char* keyExchange, size_t keyExchangeLength)
{
    if (StringSpanEquals(keyExchange, "RSA", keyExchangeLength))
        return RsaKeyX;
    if (StringSpanEquals(keyExchange, "DH/RSA", keyExchangeLength))
        return DiffieHellman;
    if (StringSpanEquals(keyExchange, "DH/DSS", keyExchangeLength))
        return DiffieHellman;
    if (StringSpanEquals(keyExchange, "DH", keyExchangeLength))
        return DiffieHellman;
    if (StringSpanEquals(keyExchange, "KRB5", keyExchangeLength))
        return SSL_kKRB5;
    if (StringSpanEquals(keyExchange, "ECDH", keyExchangeLength))
        return SSL_ECDHE;
    if (StringSpanEquals(keyExchange, "ECDH/RSA", keyExchangeLength))
        return SSL_ECDH;
    if (StringSpanEquals(keyExchange, "ECDH/ECDSA", keyExchangeLength))
        return SSL_ECDSA;
    if (StringSpanEquals(keyExchange, "PSK", keyExchangeLength))
        return SSL_kPSK;
    if (StringSpanEquals(keyExchange, "GOST", keyExchangeLength))
        return SSL_kGOST;
    if (StringSpanEquals(keyExchange, "SRP", keyExchangeLength))
        return SSL_kSRP;

    return ExchangeAlgorithmType_None;
}

static void GetHashAlgorithmTypeAndSize(const char* mac,
                                        size_t macLength,
                                        HashAlgorithmType* dataHashAlg,
                                        DataHashSize* hashKeySize)
{
    if (StringSpanEquals(mac, "MD5", macLength))
    {
        *dataHashAlg = Md5;
        *hashKeySize = MD5_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "SHA1", macLength))
    {
        *dataHashAlg = Sha1;
        *hashKeySize = SHA1_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "GOST94", macLength))
    {
        *dataHashAlg = SSL_GOST94;
        *hashKeySize = GOST_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "GOST89", macLength))
    {
        *dataHashAlg = SSL_GOST89;
        *hashKeySize = GOST_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "SHA256", macLength))
    {
        *dataHashAlg = SSL_SHA256;
        *hashKeySize = SHA256_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "SHA384", macLength))
    {
        *dataHashAlg = SSL_SHA384;
        *hashKeySize = SHA384_HashKeySize;
        return;
    }
    if (StringSpanEquals(mac, "AEAD", macLength))
    {
        *dataHashAlg = SSL_AEAD;
        *hashKeySize = Default;
        return;
    }

    *dataHashAlg = HashAlgorithmType_None;
    *hashKeySize = Default;
}

/*
Given a keyName string like "Enc=XXX", parses the description string and returns the
'XXX' into value and valueLength return variables.

Returns a value indicating whether the pattern starting with keyName was found in description.
*/
static bool GetDescriptionValue(
    const char* description, const char* keyName, size_t keyNameLength, const char** value, size_t* valueLength)
{
    // search for keyName in description
    const char* keyNameStart = strstr(description, keyName);
    if (keyNameStart != NULL)
    {
        // set valueStart to the beginning of the value
        const char* valueStart = keyNameStart + keyNameLength;
        size_t index = 0;

        // the value ends when we hit a space or the end of the string
        while (valueStart[index] != ' ' && valueStart[index] != '\0')
        {
            index++;
        }

        *value = valueStart;
        *valueLength = index;
        return true;
    }

    return false;
}

#define descriptionLength 256

/*
Parses the Kx, Enc, and Mac values out of the SSL_CIPHER_description and
maps the values to the corresponding .NET enum value.
*/
static bool GetSslConnectionInfoFromDescription(const SSL_CIPHER* cipher,
                                                CipherAlgorithmType* dataCipherAlg,
                                                ExchangeAlgorithmType* keyExchangeAlg,
                                                HashAlgorithmType* dataHashAlg,
                                                DataHashSize* hashKeySize)
{
    char description[descriptionLength] = { 0 };
    SSL_CIPHER_description(cipher, description, descriptionLength - 1); // ensure description is NULL-terminated

    const char* keyExchange;
    size_t keyExchangeLength;
    if (!GetDescriptionValue(description, "Kx=", 3, &keyExchange, &keyExchangeLength))
    {
        return false;
    }

    const char* encryption;
    size_t encryptionLength;
    if (!GetDescriptionValue(description, "Enc=", 4, &encryption, &encryptionLength))
    {
        return false;
    }

    const char* mac;
    size_t macLength;
    if (!GetDescriptionValue(description, "Mac=", 4, &mac, &macLength))
    {
        return false;
    }

    *keyExchangeAlg = MapExchangeAlgorithmType(keyExchange, keyExchangeLength);
    *dataCipherAlg = MapCipherAlgorithmType(encryption, encryptionLength);
    GetHashAlgorithmTypeAndSize(mac, macLength, dataHashAlg, hashKeySize);
    return true;
}

int32_t CryptoNative_GetSslConnectionInfo(SSL* ssl,
                                                     CipherAlgorithmType* dataCipherAlg,
                                                     ExchangeAlgorithmType* keyExchangeAlg,
                                                     HashAlgorithmType* dataHashAlg,
                                                     int32_t* dataKeySize,
                                                     DataHashSize* hashKeySize)
{
    const SSL_CIPHER* cipher;

    if (!ssl || !dataCipherAlg || !keyExchangeAlg || !dataHashAlg || !dataKeySize || !hashKeySize)
    {
        goto err;
    }

    cipher = SSL_get_current_cipher(ssl);
    if (!cipher)
    {
        goto err;
    }

    SSL_CIPHER_get_bits(cipher, dataKeySize);

    if (GetSslConnectionInfoFromDescription(cipher, dataCipherAlg, keyExchangeAlg, dataHashAlg, hashKeySize))
    {
        return 1;
    }

err:
    assert(false);

    if (dataCipherAlg)
        *dataCipherAlg = CipherAlgorithmType_None;
    if (keyExchangeAlg)
        *keyExchangeAlg = ExchangeAlgorithmType_None;
    if (dataHashAlg)
        *dataHashAlg = HashAlgorithmType_None;
    if (dataKeySize)
        *dataKeySize = 0;
    if (hashKeySize)
        *hashKeySize = Default;

    return 0;
}

int32_t CryptoNative_SslWrite(SSL* ssl, const void* buf, int32_t num)
{
    return SSL_write(ssl, buf, num);
}

int32_t CryptoNative_SslRead(SSL* ssl, void* buf, int32_t num)
{
    return SSL_read(ssl, buf, num);
}

int32_t CryptoNative_IsSslRenegotiatePending(SSL* ssl)
{
    return SSL_renegotiate_pending(ssl) != 0;
}

int32_t CryptoNative_SslShutdown(SSL* ssl)
{
    ERR_clear_error();
    return SSL_shutdown(ssl);
}

void CryptoNative_SslSetBio(SSL* ssl, BIO* rbio, BIO* wbio)
{
    SSL_set_bio(ssl, rbio, wbio);
}

int32_t CryptoNative_SslDoHandshake(SSL* ssl)
{
    ERR_clear_error();
    return SSL_do_handshake(ssl);
}

int32_t CryptoNative_IsSslStateOK(SSL* ssl)
{
    return SSL_is_init_finished(ssl);
}

X509* CryptoNative_SslGetPeerCertificate(SSL* ssl)
{
    return SSL_get_peer_certificate(ssl);
}

X509Stack* CryptoNative_SslGetPeerCertChain(SSL* ssl)
{
    return SSL_get_peer_cert_chain(ssl);
}

int32_t CryptoNative_SslCtxUseCertificate(SSL_CTX* ctx, X509* x)
{
    return SSL_CTX_use_certificate(ctx, x);
}

int32_t CryptoNative_SslCtxUsePrivateKey(SSL_CTX* ctx, EVP_PKEY* pkey)
{
    return SSL_CTX_use_PrivateKey(ctx, pkey);
}

int32_t CryptoNative_SslCtxCheckPrivateKey(SSL_CTX* ctx)
{
    return SSL_CTX_check_private_key(ctx);
}

void CryptoNative_SslCtxSetQuietShutdown(SSL_CTX* ctx)
{
    SSL_CTX_set_quiet_shutdown(ctx, 1);
}

void CryptoNative_SslSetQuietShutdown(SSL* ssl, int mode)
{
    SSL_set_quiet_shutdown(ssl, mode);
}

X509NameStack* CryptoNative_SslGetClientCAList(SSL* ssl)
{
    return SSL_get_client_CA_list(ssl);
}

void CryptoNative_SslCtxSetVerify(SSL_CTX* ctx, SslCtxSetVerifyCallback callback)
{
    int mode = SSL_VERIFY_PEER;

    SSL_CTX_set_verify(ctx, mode, callback);
}

void
CryptoNative_SslCtxSetCertVerifyCallback(SSL_CTX* ctx, SslCtxSetCertVerifyCallbackCallback callback, void* arg)
{
    SSL_CTX_set_cert_verify_callback(ctx, callback, arg);
}

// delimiter ":" is used to allow more than one strings
// below string is corresponding to "AllowNoEncryption"
#define SSL_TXT_Separator ":"
#define SSL_TXT_Exclusion "!"
#define SSL_TXT_AllIncludingNull SSL_TXT_ALL SSL_TXT_Separator SSL_TXT_eNULL
#define SSL_TXT_NotAnon SSL_TXT_Separator SSL_TXT_Exclusion SSL_TXT_aNULL

int32_t CryptoNative_SetEncryptionPolicy(SSL_CTX* ctx, EncryptionPolicy policy)
{
    const char* cipherString = NULL;
    bool clearSecLevel = false;

    switch (policy)
    {
        case RequireEncryption:
            cipherString = SSL_TXT_ALL SSL_TXT_NotAnon;
            break;

        case AllowNoEncryption:
            cipherString = SSL_TXT_AllIncludingNull;
            clearSecLevel = true;
            break;

        case NoEncryption:
            cipherString = SSL_TXT_eNULL;
            clearSecLevel = true;
            break;
    }

    assert(cipherString != NULL);

    if (clearSecLevel)
    {
        // No minimum security policy, same as OpenSSL 1.0
        SSL_CTX_set_security_level(ctx, 0);
    }

    return SSL_CTX_set_cipher_list(ctx, cipherString);
}

void CryptoNative_SslCtxSetClientCertCallback(SSL_CTX* ctx, SslClientCertCallback callback)
{
    SSL_CTX_set_client_cert_cb(ctx, callback);
}

int32_t CryptoNative_SslAddExtraChainCert(SSL* ssl, X509* x509)
{
    if (!x509 || !ssl)
    {
        return 0;
    }

    SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl);
    if (SSL_CTX_add_extra_chain_cert(ssl_ctx, x509) == 1)
    {
        return 1;
    }

    return 0;
}

void CryptoNative_SslCtxSetAlpnSelectCb(SSL_CTX* ctx, SslCtxSetAlpnCallback cb, void* arg)
{
#if HAVE_OPENSSL_ALPN
    if (API_EXISTS(SSL_CTX_set_alpn_select_cb))
    {
        SSL_CTX_set_alpn_select_cb(ctx, cb, arg);
    }
#else
    (void)ctx;
    (void)cb;
    (void)arg;
#endif
}

int32_t CryptoNative_SslCtxSetAlpnProtos(SSL_CTX* ctx, const uint8_t* protos, uint32_t protos_len)
{
#if HAVE_OPENSSL_ALPN
    if (API_EXISTS(SSL_CTX_set_alpn_protos))
    {
        return SSL_CTX_set_alpn_protos(ctx, protos, protos_len);
    }
    else
#else
    (void)ctx;
    (void)protos;
    (void)protos_len;
#endif
    {
        return 0;
    }
}

void CryptoNative_SslGet0AlpnSelected(SSL* ssl, const uint8_t** protocol, uint32_t* len)
{
#if HAVE_OPENSSL_ALPN
    if (API_EXISTS(SSL_get0_alpn_selected))
    {
        SSL_get0_alpn_selected(ssl, protocol, len);
    }
    else
#else
    (void)ssl;
#endif
    {
        *protocol = NULL;
        *len = 0;
    }
}

int32_t CryptoNative_SslSetTlsExtHostName(SSL* ssl, uint8_t* name)
{
    return (int32_t)SSL_set_tlsext_host_name(ssl, name);
}


text:
"""
https://leetcode.com/problems/ransom-note/

https://leetcode.com/submissions/detail/108015385/
"""

class Solution(object):
    def canConstruct(self, ransomNote, magazine):
        """
        :type ransomNote: str
        :type magazine: str
        :rtype: bool
        """
        index = 0
        ransomNoteLen = len(ransomNote)
        while index < ransomNoteLen:
            char = ransomNote[index]
            magazineIndex = 0
            magazineLen = len(magazine)
            found = False
            while magazineIndex < magazineLen:
                mChar = magazine[magazineIndex]
                if mChar == char:
                    found = True
                    magazine = magazine[:magazineIndex] + magazine[magazineIndex + 1:]
                    break
                else:
                    magazineIndex += 1
            if found == False:
                return False
            index += 1
        return True

import unittest

class Test(unittest.TestCase):
    def test(self):
        solution = Solution()
        self.assertEqual(solution.canConstruct('a', 'b'), False)
        self.assertEqual(solution.canConstruct('aa', 'ab'), False)
        self.assertEqual(solution.canConstruct('aa', 'aab'), True)

if __name__ == '__main__':
    unittest.main()


text:
//
//  HDeviceIdentifier.m
//  HDeviceIdentifier
//
//  Created by hext on 16/4/5.
//  Copyright © 2016年 hext. All rights reserved.
//

#import "HDeviceIdentifier.h"
#import "SFHFKeychainUtils.h"

//获取包名 如:com.hext.uuidDemo
#define bundleIdentifier [[NSBundle mainBundle]bundleIdentifier]

@implementation HDeviceIdentifier

/**
 *  同步唯一设备标识 (生成并保存唯一设备标识,如已存在则不进行任何处理)
 *
 *  @return 是否成功
 */
+(BOOL)syncDeviceIdentifier{

    /**
     *  获取应用的UUID标识
     *  (
     *  identifierForVendor返回本应用的UUID, 卸载重装后会变.所以要存入钥匙串
     *  此处可用 [[NSUUID UUID]UUIDString] 代替, [NSUUID UUID]方法每次调用都会生成一个不同的UUID
     *  但是identifierForVendor可以用来验证是不是第一次安装
     *  )
     */
    NSString *myUUIDStr = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

    /**
     *  保存UUID到钥匙串Keychain, 如果已存在则不保存
     *  storeUsername:键
     *  Password:值
     *  ServiceName:组名
     *  updateExisting:更新已存在的
     */
    BOOL f = [SFHFKeychainUtils storeUsername:@"deviceIdentifier" andPassword:myUUIDStr forServiceName:bundleIdentifier updateExisting:NO error:nil];

    return f;
}

/**
 *  返回唯一设备标识
 *
 *  @return 设备标识
 */
+(NSString*)deviceIdentifier{
    //先同步一下, 防止设备标识还未存在的情况
    [self syncDeviceIdentifier];

    //从钥匙串中获取唯一设备标识
    NSString * deviceIdentifier = [SFHFKeychainUtils getPasswordForUsername:@"deviceIdentifier" andServiceName:bundleIdentifier error:nil];

    return deviceIdentifier;
}

/**
 *  本应用是第一次安装
 *
 *  @return 是否是第一次安装
 */
+(BOOL)isFirstInstall{

    NSString * deviceIdentifier = [HDeviceIdentifier deviceIdentifier];
    NSString * identifierForVendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

    /**
     *  如果钥匙串中存的deviceIdentifier(设备标识)不存在 或者 等于deviceIdentifier(本应用的UUID) , 则为第一次安装
     */
    if ( !deviceIdentifier || [deviceIdentifier isEqualToString:identifierForVendor]) {
        return YES;
    }else{
        return NO;
    }
}

@end


text:
import React from 'react';
import Animate from 'rc-animate';
import Icon from '../icon';
import Tooltip from '../tooltip';
import Progress from '../progress';
import classNames from 'classnames';
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsDataURL
const previewFile = (file, callback) => {
    const reader = new FileReader();
    reader.onloadend = () => callback(reader.result);
    reader.readAsDataURL(file);
};
export default class UploadList extends React.Component {
    constructor() {
        super(...arguments);
        this.handleClose = (file) => {
            const { onRemove } = this.props;
            if (onRemove) {
                onRemove(file);
            }
        };
        this.handlePreview = (file, e) => {
            const { onPreview } = this.props;
            if (!onPreview) {
                return;
            }
            e.preventDefault();
            return onPreview(file);
        };
    }
    componentDidUpdate() {
        if (this.props.listType !== 'picture' && this.props.listType !== 'picture-card') {
            return;
        }
        (this.props.items || []).forEach(file => {
            if (typeof document === 'undefined' ||
                typeof window === 'undefined' ||
                !window.FileReader || !window.File ||
                !(file.originFileObj instanceof File) ||
                file.thumbUrl !== undefined) {
                return;
            }
            /*eslint-disable */
            file.thumbUrl = '';
            /*eslint-enable */
            previewFile(file.originFileObj, (previewDataUrl) => {
                /*eslint-disable */
                file.thumbUrl = previewDataUrl;
                /*eslint-enable */
                this.forceUpdate();
            });
        });
    }
    render() {
        const { prefixCls, items = [], listType, showPreviewIcon, showRemoveIcon, locale } = this.props;
        const list = items.map(file => {
            let progress;
            let icon = React.createElement(Icon, { type: file.status === 'uploading' ? 'loading' : 'paper-clip' });
            if (listType === 'picture' || listType === 'picture-card') {
                if (file.status === 'uploading' || (!file.thumbUrl && !file.url)) {
                    if (listType === 'picture-card') {
                        icon = React.createElement("div", { className: `${prefixCls}-list-item-uploading-text` }, locale.uploading);
                    }
                    else {
                        icon = React.createElement(Icon, { className: `${prefixCls}-list-item-thumbnail`, type: "picture" });
                    }
                }
                else {
                    icon = (React.createElement("a", { className: `${prefixCls}-list-item-thumbnail`, onClick: e => this.handlePreview(file, e), href: file.url || file.thumbUrl, target: "_blank", rel: "noopener noreferrer" },
                        React.createElement("img", { src: file.thumbUrl || file.url, alt: file.name })));
                }
            }
            if (file.status === 'uploading') {
                // show loading icon if upload progress listener is disabled
                const loadingProgress = ('percent' in file) ? (React.createElement(Progress, Object.assign({ type: "line" }, this.props.progressAttr, { percent: file.percent }))) : null;
                progress = (React.createElement("div", { className: `${prefixCls}-list-item-progress`, key: "progress" }, loadingProgress));
            }
            const infoUploadingClass = classNames({
                [`${prefixCls}-list-item`]: true,
                [`${prefixCls}-list-item-${file.status}`]: true,
            });
            const preview = file.url ? (React.createElement("a", { href: file.url, target: "_blank", rel: "noopener noreferrer", className: `${prefixCls}-list-item-name`, onClick: e => this.handlePreview(file, e), title: file.name }, file.name)) : (React.createElement("span", { className: `${prefixCls}-list-item-name`, onClick: e => this.handlePreview(file, e), title: file.name }, file.name));
            const style = (file.url || file.thumbUrl) ? undefined : {
                pointerEvents: 'none',
                opacity: 0.5,
            };
            const previewIcon = showPreviewIcon ? (React.createElement("a", { href: file.url || file.thumbUrl, target: "_blank", rel: "noopener noreferrer", style: style, onClick: e => this.handlePreview(file, e), title: locale.previewFile },
                React.createElement(Icon, { type: "eye-o" }))) : null;
            const removeIcon = showRemoveIcon ? (React.createElement(Icon, { type: "delete", title: locale.removeFile, onClick: () => this.handleClose(file) })) : null;
            const removeIconCross = showRemoveIcon ? (React.createElement(Icon, { type: "cross", title: locale.removeFile, onClick: () => this.handleClose(file) })) : null;
            const actions = (listType === 'picture-card' && file.status !== 'uploading')
                ? React.createElement("span", { className: `${prefixCls}-list-item-actions` },
                    previewIcon,
                    removeIcon)
                : removeIconCross;
            let message;
            if (file.response && typeof file.response === 'string') {
                message = file.response;
            }
            else {
                message = (file.error && file.error.statusText) || locale.uploadError;
            }
            const iconAndPreview = (file.status === 'error')
                ? React.createElement(Tooltip, { title: message },
                    icon,
                    preview)
                : React.createElement("span", null,
                    icon,
                    preview);
            return (React.createElement("div", { className: infoUploadingClass, key: file.uid },
                React.createElement("div", { className: `${prefixCls}-list-item-info` }, iconAndPreview),
                actions,
                React.createElement(Animate, { transitionName: "fade", component: "" }, progress)));
        });
        const listClassNames = classNames({
            [`${prefixCls}-list`]: true,
            [`${prefixCls}-list-${listType}`]: true,
        });
        const animationDirection = listType === 'picture-card' ? 'animate-inline' : 'animate';
        return (React.createElement(Animate, { transitionName: `${prefixCls}-${animationDirection}`, component: "div", className: listClassNames }, list));
    }
}
UploadList.defaultProps = {
    listType: 'text',
    progressAttr: {
        strokeWidth: 2,
        showInfo: false,
    },
    prefixCls: 'ant-upload',
    showRemoveIcon: true,
    showPreviewIcon: true,
};


text:
require 'active_support/core_ext/array/wrap'
require "active_support/core_ext/module/anonymous"
require 'active_support/core_ext/object/blank'

module ActiveModel #:nodoc:

  # == Active Model Validator
  #
  # A simple base class that can be used along with
  # +ActiveModel::Validations::ClassMethods.validates_with+
  #
  #   class Person
  #     include ActiveModel::Validations
  #     validates_with MyValidator
  #   end
  #
  #   class MyValidator < ActiveModel::Validator
  #     def validate(record)
  #       if some_complex_logic
  #         record.errors[:base] = "This record is invalid"
  #       end
  #     end
  #
  #     private
  #       def some_complex_logic
  #         # ...
  #       end
  #   end
  #
  # Any class that inherits from ActiveModel::Validator must implement a method
  # called <tt>validate</tt> which accepts a <tt>record</tt>.
  #
  #   class Person
  #     include ActiveModel::Validations
  #     validates_with MyValidator
  #   end
  #
  #   class MyValidator < ActiveModel::Validator
  #     def validate(record)
  #       record # => The person instance being validated
  #       options # => Any non-standard options passed to validates_with
  #     end
  #   end
  #
  # To cause a validation error, you must add to the <tt>record<tt>'s errors directly
  # from within the validators message
  #
  #   class MyValidator < ActiveModel::Validator
  #     def validate(record)
  #       record.errors[:base] << "This is some custom error message"
  #       record.errors[:first_name] << "This is some complex validation"
  #       # etc...
  #     end
  #   end
  #
  # To add behavior to the initialize method, use the following signature:
  #
  #   class MyValidator < ActiveModel::Validator
  #     def initialize(record, options)
  #       super
  #       @my_custom_field = options[:field_name] || :first_name
  #     end
  #   end
  #
  # The easiest way to add custom validators for validating individual attributes
  # is with the convenient ActiveModel::EachValidator for example:
  #
  #   class TitleValidator < ActiveModel::EachValidator
  #     def validate_each(record, attribute, value)
  #       record.errors[attribute] << 'must be Mr. Mrs. or Dr.' unless ['Mr.', 'Mrs.', 'Dr.'].include?(value)
  #     end
  #   end
  #
  # This can now be used in combination with the +validates+ method
  # (see ActiveModel::Validations::ClassMethods.validates for more on this)
  #
  #   class Person
  #     include ActiveModel::Validations
  #     attr_accessor :title
  #
  #     validates :title, :presence => true, :title => true
  #   end
  #
  # Validator may also define a +setup+ instance method which will get called
  # with the class that using that validator as it's argument. This can be
  # useful when there are prerequisites such as an attr_accessor being present
  # for example:
  #
  #   class MyValidator < ActiveModel::Validator
  #     def setup(klass)
  #       klass.send :attr_accessor, :custom_attribute
  #     end
  #   end
  #
  # This setup method is only called when used with validation macros or the
  # class level <tt>validates_with</tt> method.
  #
  class Validator
    attr_reader :options

    # Returns the kind of the validator.
    #
    # == Examples
    #
    #   PresenceValidator.kind   # => :presence
    #   UniquenessValidator.kind # => :uniqueness
    #
    def self.kind
      @kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym unless anonymous?
    end

    # Accepts options that will be made available through the +options+ reader.
    def initialize(options)
      @options = options.freeze
    end

    # Return the kind for this validator.
    def kind
      self.class.kind
    end

    # Override this method in subclasses with validation logic, adding errors
    # to the records +errors+ array where necessary.
    def validate(record)
      raise NotImplementedError
    end
  end

  # EachValidator is a validator which iterates through the attributes given
  # in the options hash invoking the validate_each method passing in the
  # record, attribute and value.
  #
  # All Active Model validations are built on top of this Validator.
  class EachValidator < Validator
    attr_reader :attributes

    # Returns a new validator instance. All options will be available via the
    # +options+ reader, however the <tt>:attributes</tt> option will be removed
    # and instead be made available through the +attributes+ reader.
    def initialize(options)
      @attributes = Array.wrap(options.delete(:attributes))
      raise ":attributes cannot be blank" if @attributes.empty?
      super
      check_validity!
    end

    # Performs validation on the supplied record. By default this will call
    # +validates_each+ to determine validity therefore subclasses should
    # override +validates_each+ with validation logic.
    def validate(record)
      attributes.each do |attribute|
        value = record.read_attribute_for_validation(attribute)
        next if (value.nil? && options[:allow_nil]) || (value.blank? && options[:allow_blank])
        validate_each(record, attribute, value)
      end
    end

    # Override this method in subclasses with the validation logic, adding
    # errors to the records +errors+ array where necessary.
    def validate_each(record, attribute, value)
      raise NotImplementedError
    end

    # Hook method that gets called by the initializer allowing verification
    # that the arguments supplied are valid. You could for example raise an
    # ArgumentError when invalid options are supplied.
    def check_validity!
    end
  end

  # BlockValidator is a special EachValidator which receives a block on initialization
  # and call this block for each attribute being validated. +validates_each+ uses this
  # Validator.
  class BlockValidator < EachValidator
    def initialize(options, &block)
      @block = block
      super
    end

    private

    def validate_each(record, attribute, value)
      @block.call(record, attribute, value)
    end
  end
end


text:
\hypertarget{classtesting_1_1internal_1_1_action_helper}{}\section{testing\+:\+:internal\+:\+:Action\+Helper$<$ Result, Impl $>$ Class Template Reference}
\label{classtesting_1_1internal_1_1_action_helper}\index{testing\+::internal\+::\+Action\+Helper$<$ Result, Impl $>$@{testing\+::internal\+::\+Action\+Helper$<$ Result, Impl $>$}}

{\ttfamily \#include $<$gmock-\/generated-\/actions.\+h$>$}

\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item
static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a25176836b0a381d883d61c3a2dc60662}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$$>$ \&args)
\item
{\footnotesize template$<$typename A0 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a08d2e199b0a3a1f9e05982cae07db3ec}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a96d8d8399ff3322e77ba1de51c166f4e}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_ad450478d185cbcac0e1383f7517f5c36}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a2ceda08aeb7b9fd1ad6ccb0821a3ea39}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_afd2d1dcea480db63416fc3b8604dec56}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a58e3b1699dd3a4404ed2cd652327d8ca}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a457f1505b200c5125c3bb370fb7e7bb4}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_a1f851f76793206daf2dd8a2f9621f43c}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_afcc265631df5d3a0f8955e9aa35c57f7}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8 $>$ \&args)
\item
{\footnotesize template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 $>$ }\\static \hyperlink{typedefs__d_8js_a28287671eaf7406afd604bd055ba4066}{Result} \hyperlink{classtesting_1_1internal_1_1_action_helper_adfe6c86332cc09b352ec5ccbad1d3988}{Perform} (Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 $>$ \&args)
\end{DoxyCompactItemize}

\subsection{Detailed Description}
\subsubsection*{template$<$typename Result, class Impl$>$\\*
class testing\+::internal\+::\+Action\+Helper$<$ Result, Impl $>$}

Definition at line 512 of file gmock-\/generated-\/actions.\+h.

\subsection{Member Function Documentation}
\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$$>$ \&args)}{Perform(Impl *impl, const ::testing::tuple<> &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$$>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a25176836b0a381d883d61c3a2dc60662}{}\label{classtesting_1_1internal_1_1_action_helper_a25176836b0a381d883d61c3a2dc60662}

Definition at line 514 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a08d2e199b0a3a1f9e05982cae07db3ec}{}\label{classtesting_1_1internal_1_1_action_helper_a08d2e199b0a3a1f9e05982cae07db3ec}

Definition at line 522 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a96d8d8399ff3322e77ba1de51c166f4e}{}\label{classtesting_1_1internal_1_1_action_helper_a96d8d8399ff3322e77ba1de51c166f4e}

Definition at line 530 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_ad450478d185cbcac0e1383f7517f5c36}{}\label{classtesting_1_1internal_1_1_action_helper_ad450478d185cbcac0e1383f7517f5c36}

Definition at line 538 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a2ceda08aeb7b9fd1ad6ccb0821a3ea39}{}\label{classtesting_1_1internal_1_1_action_helper_a2ceda08aeb7b9fd1ad6ccb0821a3ea39}

Definition at line 546 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_afd2d1dcea480db63416fc3b8604dec56}{}\label{classtesting_1_1internal_1_1_action_helper_afd2d1dcea480db63416fc3b8604dec56}

Definition at line 555 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4, A5 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a58e3b1699dd3a4404ed2cd652327d8ca}{}\label{classtesting_1_1internal_1_1_action_helper_a58e3b1699dd3a4404ed2cd652327d8ca}

Definition at line 565 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4, A5, A6 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a457f1505b200c5125c3bb370fb7e7bb4}{}\label{classtesting_1_1internal_1_1_action_helper_a457f1505b200c5125c3bb370fb7e7bb4}

Definition at line 575 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4, A5, A6, A7 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_a1f851f76793206daf2dd8a2f9621f43c}{}\label{classtesting_1_1internal_1_1_action_helper_a1f851f76793206daf2dd8a2f9621f43c}

Definition at line 585 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4, A5, A6, A7, A8 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_afcc265631df5d3a0f8955e9aa35c57f7}{}\label{classtesting_1_1internal_1_1_action_helper_afcc265631df5d3a0f8955e9aa35c57f7}

Definition at line 595 of file gmock-\/generated-\/actions.\+h.

\index{testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}!Perform@{Perform}}
\index{Perform@{Perform}!testing\+::internal\+::\+Action\+Helper@{testing\+::internal\+::\+Action\+Helper}}
\subsubsection[{\texorpdfstring{Perform(\+Impl $\ast$impl, const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 $>$ \&args)}{Perform(Impl *impl, const ::testing::tuple< A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 > &args)}}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename Result , class Impl $>$ template$<$typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 $>$ static {\bf Result} {\bf testing\+::internal\+::\+Action\+Helper}$<$ {\bf Result}, Impl $>$\+::Perform (
\begin{DoxyParamCaption}
\item[{Impl $\ast$}]{impl, }
\item[{const \+::testing\+::tuple$<$ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 $>$ \&}]{args}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}\hypertarget{classtesting_1_1internal_1_1_action_helper_adfe6c86332cc09b352ec5ccbad1d3988}{}\label{classtesting_1_1internal_1_1_action_helper_adfe6c86332cc09b352ec5ccbad1d3988}

Definition at line 605 of file gmock-\/generated-\/actions.\+h.

The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item
/home/bhargavi/\+Documents/\+S\+D\+R/\+Copy\+\_\+\+Exam\+\_\+808\+X/vendor/googletest/googlemock/include/gmock/\hyperlink{gmock-generated-actions_8h}{gmock-\/generated-\/actions.\+h}\end{DoxyCompactItemize}


text:
/*
 * USB packet size.
 */
#define	PACKET_SIZE	    64

/*
 * Initialize the PiDP-8 panel interface.
 */
void pidp_init(void);

/*
 * Run one cycle of the PiDP-8 panel control interface.
 */
void pidp_step(void);

/*
 * Process the packet, received via USB.
 * Prepare an output packet to send.
 */
void pidp_request(const unsigned char *receive, unsigned char *send);

/*
 * Delay for a given number of microseconds.
 * The processor has a 32-bit hardware Count register,
 * which increments at half CPU rate.
 * We use it to get a precise delay.
 */
void udelay (unsigned usec);


text:
using System;
using System.Threading;
using System.Threading.Tasks;
using Serilog.Events;
using Serilog.Sinks.XSockets.Sinks.XSockets.Data;
using XSockets.Client40;
using XSockets.Core.Common.Socket;

namespace TestServer
{
    /// <summary>
    /// When running this you will see that the console logs everything
    /// but the cilent only receives data when the current loglevel is => the clients level
    /// Notice that all messages with XSockets sink is written in green... So that you can see the difference.
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            using (var container = XSockets.Plugin.Framework.Composable.GetExport<IXSocketServerContainer>())
            {
                //Start a server
                container.Start();

                Console.WriteLine("Hit enter to start a client that will show Serilog.Sinks.XSockets");
                Console.ReadLine();

                //Start a client and hook up only to the log controller...
                var client = new XSocketClient("ws://localhost:4502","http://localhost","log");

                client.Open();

                client.Controller("log").On<LogEventWrapper>("logEvent", logEvent =>
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("Message: {0}",logEvent.RenderedMessage);
                    Console.ResetColor();
                });

                //Change the LogEventLevel the client listens to every 8 seconds
                Task.Factory.StartNew(() =>
                {
                    while (true)
                    {
                        var newLevel = ((LogEventLevel)new Random().Next(0, 5)).ToString();
                        client.Controller("log").SetEnum("LogEventLevel", newLevel);
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.WriteLine("New LogEventLevel set to {0}", newLevel);
                        Console.ResetColor();
                        Thread.Sleep(8000);
                    }
                });

                Console.WriteLine("Hit enter to quit");
                Console.ReadLine();
            }
        }
    }
}


text:
<?php

namespace Chamilo\Application\Plagiarism\Service\Turnitin;

use Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException;
use Chamilo\Application\Plagiarism\Domain\SubmissionStatus;
use Chamilo\Application\Plagiarism\Domain\Turnitin\SimilarityReportSettings;

/**
 * @package Chamilo\Application\Plagiarism\Domain\Turnitin
 *
 * @author Sven Vanpoucke - Hogeschool Gent
 */
class WebhookHandler
{
    const STATUS_COMPLETE = 'COMPLETE';
    const STATUS_ERROR = 'ERROR';

    /**
     * @var \Chamilo\Configuration\Service\ConfigurationConsulter
     */
    protected $configurationConsulter;

    /**
     * @var \Chamilo\Application\Plagiarism\Service\Events\PlagiarismEventNotifier
     */
    protected $plagiarismEventNotifier;

    /**
     * @var \Chamilo\Application\Plagiarism\Service\Turnitin\SubmissionStatusParser
     */
    protected $submissionStatusParser;

    /**
     * @var \Chamilo\Application\Plagiarism\Service\Turnitin\SubmissionService
     */
    protected $submissionService;

    /**
     * WebhookHandler constructor.
     *
     * @param \Chamilo\Configuration\Service\ConfigurationConsulter $configurationConsulter
     * @param \Chamilo\Application\Plagiarism\Service\Events\PlagiarismEventNotifier $plagiarismEventNotifier
     * @param \Chamilo\Application\Plagiarism\Service\Turnitin\SubmissionStatusParser $submissionStatusParser
     * @param \Chamilo\Application\Plagiarism\Service\Turnitin\SubmissionService $submissionService
     */
    public function __construct(
        \Chamilo\Configuration\Service\ConfigurationConsulter $configurationConsulter,
        \Chamilo\Application\Plagiarism\Service\Events\PlagiarismEventNotifier $plagiarismEventNotifier,
        \Chamilo\Application\Plagiarism\Service\Turnitin\SubmissionStatusParser $submissionStatusParser,
        SubmissionService $submissionService
    )
    {
        $this->configurationConsulter = $configurationConsulter;
        $this->plagiarismEventNotifier = $plagiarismEventNotifier;
        $this->submissionStatusParser = $submissionStatusParser;
        $this->submissionService = $submissionService;
    }

    /**
     * @param string $eventType
     * @param string $authorizationKey
     * @param string $requestBody
     *
     * @throws \Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException
     */
    public function handleWebhookRequest(
        string $eventType = null, string $authorizationKey = null, string $requestBody = null
    )
    {
        $this->validateAuthorizationKey($authorizationKey, $requestBody);
        $this->validateEventType($eventType);

        $data = $this->getDataFromRequestBody($requestBody);

        $webhookToStatusMapping = [
            WebhookManager::WEBHOOK_SUBMISSION_COMPLETE => SubmissionStatusParser::SUBMISSION_STATUS_UPLOAD,
            WebhookManager::WEBHOOK_SIMILARITY_COMPLETE => SubmissionStatusParser::SUBMISSION_STATUS_REPORT_GENERATION
        ];

        if (array_key_exists($eventType, $webhookToStatusMapping))
        {
            $submissionStatus = $this->submissionStatusParser->parse($webhookToStatusMapping[$eventType], $data);

            if ($submissionStatus->isUploadComplete())
            {
                $submissionStatus = $this->handleUploadComplete($submissionStatus);
            }

            $this->plagiarismEventNotifier->submissionStatusChanged($submissionStatus);
        }
    }

    /**
     * @param \Chamilo\Application\Plagiarism\Domain\SubmissionStatus $currentSubmissionStatus
     *
     * @return \Chamilo\Application\Plagiarism\Domain\SubmissionStatus
     * @throws \Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException
     */
    protected function handleUploadComplete(SubmissionStatus $currentSubmissionStatus)
    {
        $settings = new SimilarityReportSettings();
        $settings->setSearchRepositories(
            [
                SimilarityReportSettings::SEARCH_REPOSITORY_INTERNET,
                SimilarityReportSettings::SEARCH_REPOSITORY_PUBLICATION,
                SimilarityReportSettings::SEARCH_REPOSITORY_SUBMITTED_WORK
            ]
        );

        $settings->setAutoExcludeMatchingScope(SimilarityReportSettings::AUTO_EXCLUDE_ALL);

        $this->submissionService->generateSimilarityReport($currentSubmissionStatus->getSubmissionId(), $settings);

        return new SubmissionStatus(
            $currentSubmissionStatus->getSubmissionId(), SubmissionStatus::STATUS_CREATE_REPORT_IN_PROGRESS
        );
    }

    /**
     * Validates the secret key from the webhook
     *
     * @param string $authorizationKey
     * @param string $requestBody
     *
     * @throws \Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException
     */
    protected function validateAuthorizationKey(string $authorizationKey = null, string $requestBody = null)
    {
        if(empty($authorizationKey))
        {
            throw new PlagiarismException(
                'The given authorization key is empty and therefor it is insecure to call this service, request aborted'
            );
        }

        $webhookSecret = $this->configurationConsulter->getSetting(
            ['Chamilo\Application\Plagiarism', 'turnitin_webhook_secret']
        );

        if (empty($webhookSecret))
        {
            throw new PlagiarismException(
                'The stored authorization key is empty and therefor it is insecure to call this service, request aborted'
            );
        }

        $expectedKey = hash_hmac('sha256', $requestBody, base64_decode($webhookSecret));
        if ($expectedKey != $authorizationKey)
        {
            throw new PlagiarismException('The given authorization key is not correct');
        }
    }

    /**
     * @param string $eventType
     *
     * @throws \Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException
     */
    protected function validateEventType(string $eventType = null)
    {
        $availableEventTypes =
            [WebhookManager::WEBHOOK_SIMILARITY_COMPLETE, WebhookManager::WEBHOOK_SUBMISSION_COMPLETE];

        if (!in_array($eventType, $availableEventTypes))
        {
            throw new PlagiarismException(sprintf('The given event type %s is invalid', $eventType));
        }
    }

    /**
     * @param string $requestBody
     *
     * @return array
     * @throws \Chamilo\Application\Plagiarism\Domain\Exception\PlagiarismException
     */
    protected function getDataFromRequestBody(string $requestBody)
    {
        $data = \json_decode($requestBody, true);
        if (empty($data))
        {
            throw new PlagiarismException(
                sprintf('Could not decode the data from the request body, not a valid json string (%s)', $requestBody)
            );
        }

        return $data;
    }
}


text: TODO(Unreachable code w.r.t. Nothing)


text:
.. _mobile_configuration:

Mobile Configuration
====================

To choose mobile operating system in which Appium will execute the tests, configure *type* property in *[Driver]*
section in properties.cfg file with one of these values: ios or android.

The following example shows how to choose Android::

    [Driver]
    type: android

Moreover, configure Appium properties in *[AppiumCapabilities]* section in properties.cfg file. The following example
shows how to configure Appium to run tests over TestApp app on an iPhone 6 with iOS 8.3::

    [Driver]
    type: ios

    [AppiumCapabilities]
    automationName: Appium
    platformName: iOS
    deviceName: iPhone 6
    platformVersion: 8.3
    app: http://server_url/TestApp.zip

See http://appium.io/slate/en/master#appium-server-capabilities for the complete Appium capabilities list.


text:
/* jshint undef: true, unused: true, browser:true, devel: true */
/* global define */

define(function() {
    "use strict";

    var ImageLoader = {};
    ImageLoader.load = function(directory, callback, offset, size, sequence) {
        var htmlImagesSrcArray = new Array(size),
            htmlImagesArray = new Array(htmlImagesSrcArray.length),
            i,
            img,
            num;

        if (sequence === false) {
            htmlImagesSrcArray[0] = directory;
        } else {
            for ( i = 0; i < htmlImagesSrcArray.length; i++) {
                num = (offset + i);
                htmlImagesSrcArray[i] = directory + "image-" + ("00" + num).slice(-3) + ".jpg";
            }
        }
        htmlImagesArray.notLoaded = [];
        htmlImagesArray.addImage = function(img) {
            htmlImagesArray.notLoaded.push(img);
        };
        htmlImagesArray.loaded = function(loadedImg) {
            var notloadedImgs = htmlImagesArray.notLoaded;
            for (var x = 0; x < notloadedImgs.length; x++) {
                if (notloadedImgs[x] == loadedImg) {
                    notloadedImgs.splice(x, 1);
                    for (var y = 0; y < htmlImagesSrcArray.length; y++) {
                        var imgName = htmlImagesSrcArray[y].substr(htmlImagesSrcArray[y].lastIndexOf("/"));
                        if (loadedImg.src.lastIndexOf(imgName) != -1) {
                            htmlImagesArray[y] = loadedImg;
                            break;
                        }
                    }
                    break;
                }
            }
            if (notloadedImgs.length === 0) {
                console.log("Images loaded");
                callback.apply(null, [htmlImagesArray]);
            }
        };

        for ( i = 0; i < htmlImagesSrcArray.length; i++) {
            img = new Image();
            htmlImagesArray.addImage(img);
            addOnloadHandler(img, htmlImagesArray);
            img.src = htmlImagesSrcArray[i];
        }
    };

    function addOnloadHandler(img, htmlImagesArray) {
        img.onload = function() {
            htmlImagesArray.loaded(this);
        };
    }

    return (ImageLoader);
});


text:
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Home = { template: '
home
' }

// In Webpack we can use special require syntax to signify a "split point"
// Webpack will automatically split and lazy-load the split modules.
// - https://webpack.github.io/docs/code-splitting.html

// Combine that with Vue's async components, we can easily make our route
// components lazy-loaded only when the given route is matched.

// async components are defined as:
// - resolve => resolve(Component)
// or
// - () => Promise<Component>

// For single component, we can use the AMD shorthand
// require(['dep'], dep => { ... })
const Foo = resolve => require(['./Foo.vue'], resolve)

// If using Webpack 2, you can also do:
// const Foo = () => System.import('./Foo.vue')

// If you want to group a number of components that belong to the same
// nested route in the same async chunk, you will need to use
// require.ensure. The 3rd argument is the chunk name they belong to -
// modules that belong to the same chunk should use the same chunk name.
const Bar = r => require.ensure([], () => r(require('./Bar.vue')), '/bar')
const Baz = r => require.ensure([], () => r(require('./Baz.vue')), '/bar')

const router = new VueRouter({
  mode: 'history',
  base: __dirname,
  routes: [
    { path: '/', component: Home },
    // Just use them normally in the route config
    { path: '/foo', component: Foo },
    // Bar and Baz belong to the same root route
    // and grouped in the same async chunk.
    { path: '/bar', component: Bar,
      children: [
        { path: 'baz', component: Baz }
      ]
    }
  ]
})

new Vue({
  router,
  template: `

Basic

<router-link to="/">/</router-link>

<router-link to="/foo">/foo</router-link>

<router-link to="/bar">/bar</router-link>

<router-link to="/bar/baz">/bar/baz</router-link>

      <router-view class="view"></router-view>

  `
}).$mount('#app')


text:
"""
This is still left unlike other *2 operation (sub2, mul2, ...) because
it has cudnn implementation.
"""
import pytest
import numpy as np
import nnabla.functions as F
from nbla_test_utils import list_context

ctxs = list_context('Maximum2')

@pytest.mark.parametrize("ctx, func_name", ctxs)
@pytest.mark.parametrize("seed", [313])
def test_maximum2_double_backward(seed, ctx, func_name):
    from nbla_test_utils import backward_function_tester
    rng = np.random.RandomState(seed)
    inputs = [rng.randn(2, 3).astype(np.float32),
              rng.randn(2, 3).astype(np.float32)]
    backward_function_tester(rng, F.maximum2,
                             inputs=inputs,
                             func_args=[], func_kwargs={},
                             atol_accum=1e-3,
                             dstep=1e-3,
                             ctx=ctx)


text:
export EXIST_HOME=/Users/graham/Apps/eXist
${EXIST_HOME}/bin/startup.sh
#
# End.


text:
var x = 0;
var mmpt = []
if (!localStorage.mmptList) {
    localStorage.mmptList = "[]";
}
mmpt = JSON.parse(localStorage.mmptList);
mmpAdd = function(){
	var task = document.getElementById('taskmmp').value;
    if (task != '') {
        // Add the task to array and refresh list
        mmpt[mmpt.length] = task;
        mmpRefresh();
        // Clear the input
        document.getElementById('taskmmp').value = '';
    }
};
mmpRefresh = function(){
	var $tasks = $('#tlmmp');
    // Clear the existing task list
    $tasks.empty();
    if (mmpt.length) {
        for (var i=0;i<mmpt.length;i++){
            // Append each task
			x = i;
            var li = '
' + mmpt[i] + '
'
            $tasks.append(li);
			$(function () {
			$("#confirmmmp"+i).bind("singletap", function() {
				$.UIPopup({
					id: "warning",
					title: 'Completed?',
					message: 'Have you really completed this task?',
					cancelButton: 'No',
					continueButton: 'Yes',
					callback: function() {
						mmpt.splice(x,1);
						mmpRefresh();
					}
				});
			});
			});
        }
    }
    localStorage.mmptList = JSON.stringify(mmpt || []);
}


text:
package org.jboss.resteasy.test.response.resource;

import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

@Produces(MediaType.WILDCARD)
public class WriterMatchingBoolWriter implements MessageBodyWriter<Object> {
    @Override
    public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return type.equals(Boolean.class);
    }

    @Override
    public long getSize(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) {
        return -1;
    }

    @Override
    public void writeTo(Object o, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
        Boolean b = (Boolean) o;
        if (b.booleanValue()) {
            entityStream.write("YES".getBytes());
        } else {
            entityStream.write("NO".getBytes());
        }
    }
}