text:
package macbury.forge.scripts.script;

import macbury.forge.ForgE;
import org.apache.bsf.BSFException;
import org.apache.bsf.BSFManager;
import org.jruby.embed.bsf.JRubyEngine;

/**
 * Created by macbury on 08.09.15.
 */
public class ConsoleScriptRunner extends BaseScriptRunner {
  private static final String TAG = "<console>";
  private final String src;

  public ConsoleScriptRunner(String src) {
    this.src = src;
  }

  @Override
  public void run(JRubyEngine engine, BSFManager manager) throws BSFException {
    try {
      ForgE.log(TAG, src);
      Object result = engine.eval(TAG, 0, 0, src);
      if (result != null) {
        ForgE.log(TAG, "=> "+result.toString());
      } else {
        ForgE.log(TAG, "=> nil");
      }
    } catch (BSFException e) {
      ForgE.log(TAG, e.getTargetException().toString());
    }
  }

  @Override
  public void dispose() {

  }
}


text:
package com.nbdeg.unityplanner.data;

/**
 * Class that stores old and new course names. Useful when adding new assignments from Classroom that
 * have had a name changed.
 */
public class ChangedCourseName {

    String oldCourseName;
    String newCourseName;

    /*
    Required empty constructor
     */
    public ChangedCourseName() {
    }

    public ChangedCourseName(String oldCourseName, String newCourseName) {
        this.oldCourseName = oldCourseName;
        this.newCourseName = newCourseName;
    }

    /* -- Getters and setters -- */

    public String getOldCourseName() {
        return oldCourseName;
    }
    public void setOldCourseName(String oldCourseName) {
        this.oldCourseName = oldCourseName;
    }

    public String getNewCourseName() {
        return newCourseName;
    }
    public void setNewCourseName(String newCourseName) {
        this.newCourseName = newCourseName;
    }
}

redpajama_set_name: RedPajamaGithub


text:
export interface StateProps {
  index: number;
  arr: Array<string>;
  obj: Record<string, any>;
}

// eslint-disable-next-line prettier/prettier
function foo() {
  const x = 0;
  const y = 1;
  if (x) {
    return 2;
    // eslint-disable-next-line no-else-return
  } else {
    return y;
  }
}

foo();

usedBeforeDefine();

function usedBeforeDefine() {
  console.log('Disallowed log');
}


text:
/* -*-C++-*-
******************************************************************************
*
* File:         LmConnection.cpp
* Description:  Stores data about about JDBC/MX connection created by the SPJ
*               methods.
*
* Created:      12/20/2005
* Language:     C++
*
******************************************************************************
*/
#include "Platform.h"
  #include "lmjni.h"
#include "LmConnection.h"
#include "LmDebug.h"

// Constructor: Initializes data members
LmConnection::LmConnection( LmLanguageManagerJava *lm,
                            jobject connRef,
                            LmConnectionType connType,
                            ComRoutineTransactionAttributes transactionAttrs)
 : type_(connType),
   refCnt_(0),
   lmj_(lm),
   jdbcConnRef_(connRef),
   transactionAttrs_(transactionAttrs)
{}

// Destructor:
// Deletes the 'jdbcConnRef_' global reference
LmConnection::~LmConnection()
{
  JNIEnv *jni = (JNIEnv*)lmj_->jniEnv_;
  jni->DeleteGlobalRef( jdbcConnRef_ );
}

// Decrements 'refCnt_' by '1' and when it becomes '0'
// calls the close() method of this class.
// Asserts if 'refCnt_' value goes lesser than '0'
//
// Returns TRUE if the close() method is called, FALSE
// otherwise.
NABoolean LmConnection::decrRefCnt( ComDiagsArea *diags )
{
  refCnt_--;

  if( refCnt_ == 0 ) {
    close( diags );
    return TRUE;
  }
  else
  if( refCnt_ < 0 ) {
    // refCnt_ should not go below zero. If this happens then
    // things have gone wrong in maintaining the reference count
    LM_ASSERT( refCnt_ > 0 );
  }

  return FALSE;
}

// Calls the close() method on 'jdbcConnRef_' which
// is the java.sql.Connection object
// Calls the destructor of this object
void LmConnection::close( ComDiagsArea *diags )
{

  LM_ASSERT( refCnt_ == 0 );

  JNIEnv *jni = (JNIEnv*)lmj_->jniEnv_;

  if( jdbcConnRef_ )
  {
	// Check if the connection was closed by SPJ method
    jboolean connIsClosed = jni->CallBooleanMethod( jdbcConnRef_,
                                       (jmethodID)lmj_->connIsClosedId_ );

    LM_DEBUG1( "Connection.isClosed() returned %s",
               jni->ExceptionOccurred() ? "an Exception" : "no Exception" );
	if (jni->ExceptionOccurred())
	{
      // Populate ComDiagsArea if there are any Java exceptions
	  if( diags )
	    lmj_->exceptionReporter_->checkJVMException( diags, 0 );
	  else
	    jni->ExceptionClear();  // If ComDiagsArea is not available then we clear
		  					    // any pending exception
	}
	else if (! connIsClosed)
    {

			LM_DEBUG1( "LmConnection::close() closing Connection of type %s",
			  	   (type_ == DEFAULT_CONN ? "DEFAULT_CONNECTION" : "NON_DEFAULT_CONNECTION"));

			jni->CallVoidMethod( jdbcConnRef_,
							   (jmethodID)lmj_->connCloseId_ );

			LM_DEBUG1( "Connection.close() returned %s",
				     jni->ExceptionOccurred() ? "an Exception" : "no Exception" );

			// Populate ComDiagsArea if there are any Java exceptions
			if( diags )
			  lmj_->exceptionReporter_->checkJVMException( diags, 0 );
			else
			  jni->ExceptionClear();  // If ComDiagsArea is not available then we clear
								    // any pending exception
			}

  }

  delete this;
}


text:
class Role < ApplicationRecord
  SUPER_ADMIN = 'super_admin'
  ADMIN = 'admin'
  BOARD = 'board_member'

  has_many :users
  has_many :admin_users

  validates :title, presence: true, uniqueness: true

  def board_accessible?
    [BOARD, ADMIN, SUPER_ADMIN].include? title
  end

  def admin_accessible?
    [ADMIN, SUPER_ADMIN].include? title
  end

  def super_admin?
    title == SUPER_ADMIN
  end

  def admin?
    title == ADMIN
  end

  def board?
    title == BOARD
  end
end


text:
<?php

// initialize variable
$locale = array();

// countries
$locale['countries'] = array();
$locale['countries']['AF'] = 'Afganistán';
$locale['countries']['AL'] = 'Albania';
$locale['countries']['DE'] = 'Alemania';
$locale['countries']['AD'] = 'Andorra';
$locale['countries']['AO'] = 'Angola';
$locale['countries']['AI'] = 'Anguila';
$locale['countries']['AG'] = 'Antigua y Barbuda';
$locale['countries']['AN'] = 'Antillas Neerlandesas';
$locale['countries']['AQ'] = 'Antártida';
$locale['countries']['SA'] = 'Arabia Saudí';
$locale['countries']['DZ'] = 'Argelia';
$locale['countries']['AR'] = 'Argentina';
$locale['countries']['AM'] = 'Armenia';
$locale['countries']['AW'] = 'Aruba';
$locale['countries']['AU'] = 'Australia';
$locale['countries']['AT'] = 'Austria';
$locale['countries']['AZ'] = 'Azerbaiyán';
$locale['countries']['BS'] = 'Bahamas';
$locale['countries']['BH'] = 'Bahréin';
$locale['countries']['BD'] = 'Bangladesh';
$locale['countries']['BB'] = 'Barbados';
$locale['countries']['BZ'] = 'Belice';
$locale['countries']['BJ'] = 'Benín';
$locale['countries']['BM'] = 'Bermudas';
$locale['countries']['BY'] = 'Bielorrusia';
$locale['countries']['BO'] = 'Bolivia';
$locale['countries']['BA'] = 'Bosnia-Herzegovina';
$locale['countries']['BW'] = 'Botsuana';
$locale['countries']['BR'] = 'Brasil';
$locale['countries']['BN'] = 'Brunéi';
$locale['countries']['BG'] = 'Bulgaria';
$locale['countries']['BF'] = 'Burkina Faso';
$locale['countries']['BI'] = 'Burundi';
$locale['countries']['BT'] = 'Bután';
$locale['countries']['BE'] = 'Bélgica';
$locale['countries']['CV'] = 'Cabo Verde';
$locale['countries']['KH'] = 'Camboya';
$locale['countries']['CM'] = 'Camerún';
$locale['countries']['CA'] = 'Canadá';
$locale['countries']['TD'] = 'Chad';
$locale['countries']['CL'] = 'Chile';
$locale['countries']['CN'] = 'China';
$locale['countries']['CY'] = 'Chipre';
$locale['countries']['VA'] = 'Ciudad del Vaticano';
$locale['countries']['CO'] = 'Colombia';
$locale['countries']['KM'] = 'Comoras';
$locale['countries']['CG'] = 'Congo';
$locale['countries']['KP'] = 'Corea del Norte';
$locale['countries']['KR'] = 'Corea del Sur';
$locale['countries']['CR'] = 'Costa Rica';
$locale['countries']['CI'] = 'Costa de Marfil';
$locale['countries']['HR'] = 'Croacia';
$locale['countries']['CU'] = 'Cuba';
$locale['countries']['DK'] = 'Dinamarca';
$locale['countries']['DM'] = 'Dominica';
$locale['countries']['EC'] = 'Ecuador';
$locale['countries']['EG'] = 'Egipto';
$locale['countries']['SV'] = 'El Salvador';
$locale['countries']['AE'] = 'Emiratos Árabes Unidos';
$locale['countries']['ER'] = 'Eritrea';
$locale['countries']['SK'] = 'Eslovaquia';
$locale['countries']['SI'] = 'Eslovenia';
$locale['countries']['ES'] = 'España';
$locale['countries']['US'] = 'Estados Unidos';
$locale['countries']['EE'] = 'Estonia';
$locale['countries']['ET'] = 'Etiopía';
$locale['countries']['PH'] = 'Filipinas';
$locale['countries']['FI'] = 'Finlandia';
$locale['countries']['FJ'] = 'Fiyi';
$locale['countries']['FR'] = 'Francia';
$locale['countries']['GA'] = 'Gabón';
$locale['countries']['GM'] = 'Gambia';
$locale['countries']['GE'] = 'Georgia';
$locale['countries']['GH'] = 'Ghana';
$locale['countries']['GI'] = 'Gibraltar';
$locale['countries']['GD'] = 'Granada';
$locale['countries']['GR'] = 'Grecia';
$locale['countries']['GL'] = 'Groenlandia';
$locale['countries']['GP'] = 'Guadalupe';
$locale['countries']['GU'] = 'Guam';
$locale['countries']['GT'] = 'Guatemala';
$locale['countries']['GF'] = 'Guayana Francesa';
$locale['countries']['GG'] = 'Guernsey';
$locale['countries']['GN'] = 'Guinea';
$locale['countries']['GQ'] = 'Guinea Ecuatorial';
$locale['countries']['GW'] = 'Guinea-Bissau';
$locale['countries']['GY'] = 'Guyana';
$locale['countries']['HT'] = 'Haití';
$locale['countries']['HN'] = 'Honduras';
$locale['countries']['HK'] = 'Hong Kong';
$locale['countries']['HU'] = 'Hungría';
$locale['countries']['IN'] = 'India';
$locale['countries']['ID'] = 'Indonesia';
$locale['countries']['IQ'] = 'Iraq';
$locale['countries']['IE'] = 'Irlanda';
$locale['countries']['IR'] = 'Irán';
$locale['countries']['BV'] = 'Isla Bouvet';
$locale['countries']['CX'] = 'Isla Christmas';
$locale['countries']['NU'] = 'Isla Niue';
$locale['countries']['NF'] = 'Isla Norfolk';
$locale['countries']['IM'] = 'Isla de Man';
$locale['countries']['IS'] = 'Islandia';
$locale['countries']['KY'] = 'Islas Caimán';
$locale['countries']['CC'] = 'Islas Cocos';
$locale['countries']['CK'] = 'Islas Cook';
$locale['countries']['FO'] = 'Islas Feroe';
$locale['countries']['GS'] = 'Islas Georgia del Sur y Sandwich del Sur';
$locale['countries']['HM'] = 'Islas Heard y McDonald';
$locale['countries']['FK'] = 'Islas Malvinas';
$locale['countries']['MP'] = 'Islas Marianas del Norte';
$locale['countries']['MH'] = 'Islas Marshall';
$locale['countries']['SB'] = 'Islas Salomón';
$locale['countries']['TC'] = 'Islas Turcas y Caicos';
$locale['countries']['VG'] = 'Islas Vírgenes Británicas';
$locale['countries']['VI'] = 'Islas Vírgenes de los Estados Unidos';
$locale['countries']['UM'] = 'Islas menores alejadas de los Estados Unidos';
$locale['countries']['AX'] = 'Islas Åland';
$locale['countries']['IL'] = 'Israel';
$locale['countries']['IT'] = 'Italia';
$locale['countries']['JM'] = 'Jamaica';
$locale['countries']['JP'] = 'Japón';
$locale['countries']['JE'] = 'Jersey';
$locale['countries']['JO'] = 'Jordania';
$locale['countries']['KZ'] = 'Kazajistán';
$locale['countries']['KE'] = 'Kenia';
$locale['countries']['KG'] = 'Kirguistán';
$locale['countries']['KI'] = 'Kiribati';
$locale['countries']['KW'] = 'Kuwait';
$locale['countries']['LA'] = 'Laos';
$locale['countries']['LS'] = 'Lesoto';
$locale['countries']['LV'] = 'Letonia';
$locale['countries']['LB'] = 'Líbano';
$locale['countries']['LR'] = 'Liberia';
$locale['countries']['LY'] = 'Libia';
$locale['countries']['LI'] = 'Liechtenstein';
$locale['countries']['LT'] = 'Lituania';
$locale['countries']['LU'] = 'Luxemburgo';
$locale['countries']['MO'] = 'Macao';
$locale['countries']['MK'] = 'Macedonia';
$locale['countries']['MG'] = 'Madagascar';
$locale['countries']['MY'] = 'Malasia';
$locale['countries']['MW'] = 'Malaui';
$locale['countries']['MV'] = 'Maldivas';
$locale['countries']['ML'] = 'Mali';
$locale['countries']['MT'] = 'Malta';
$locale['countries']['MA'] = 'Marruecos';
$locale['countries']['MQ'] = 'Martinica';
$locale['countries']['MU'] = 'Mauricio';
$locale['countries']['MR'] = 'Mauritania';
$locale['countries']['YT'] = 'Mayotte';
$locale['countries']['MX'] = 'México';
$locale['countries']['FM'] = 'Micronesia';
$locale['countries']['MD'] = 'Moldavia';
$locale['countries']['MC'] = 'Mónaco';
$locale['countries']['MN'] = 'Mongolia';
$locale['countries']['ME'] = 'Montenegro';
$locale['countries']['MS'] = 'Montserrat';
$locale['countries']['MZ'] = 'Mozambique';
$locale['countries']['MM'] = 'Myanmar';
$locale['countries']['NA'] = 'Namibia';
$locale['countries']['NR'] = 'Nauru';
$locale['countries']['NP'] = 'Nepal';
$locale['countries']['NI'] = 'Nicaragua';
$locale['countries']['NE'] = 'Níger';
$locale['countries']['NG'] = 'Nigeria';
$locale['countries']['NO'] = 'Noruega';
$locale['countries']['NC'] = 'Nueva Caledonia';
$locale['countries']['NZ'] = 'Nueva Zelanda';
$locale['countries']['OM'] = 'Omán';
$locale['countries']['PK'] = 'Pakistán';
$locale['countries']['PW'] = 'Palau';
$locale['countries']['PS'] = 'Palestina';
$locale['countries']['PA'] = 'Panamá';
$locale['countries']['PG'] = 'Papúa Nueva Guinea';
$locale['countries']['PY'] = 'Paraguay';
$locale['countries']['NL'] = 'Países Bajos';
$locale['countries']['PE'] = 'Perú';
$locale['countries']['PN'] = 'Pitcairn';
$locale['countries']['PF'] = 'Polinesia Francesa';
$locale['countries']['PL'] = 'Polonia';
$locale['countries']['PT'] = 'Portugal';
$locale['countries']['PR'] = 'Puerto Rico';
$locale['countries']['QA'] = 'Qatar';
$locale['countries']['ZZ'] = 'Región desconocida o no válida';
$locale['countries']['GB'] = 'Reino Unido';
$locale['countries']['CF'] = 'República Centroafricana';
$locale['countries']['CZ'] = 'República Checa';
$locale['countries']['CD'] = 'República Democrática del Congo';
$locale['countries']['DO'] = 'República Dominicana';
$locale['countries']['RE'] = 'Reunión';
$locale['countries']['RW'] = 'Ruanda';
$locale['countries']['RO'] = 'Rumanía';
$locale['countries']['RU'] = 'Rusia';
$locale['countries']['WS'] = 'Samoa';
$locale['countries']['AS'] = 'Samoa Americana';
$locale['countries']['BL'] = 'San Bartolomé';
$locale['countries']['KN'] = 'San Cristóbal y Nieves';
$locale['countries']['SM'] = 'San Marino';
$locale['countries']['MF'] = 'San Martín';
$locale['countries']['PM'] = 'San Pedro y Miquelón';
$locale['countries']['VC'] = 'San Vicente y las Granadinas';
$locale['countries']['SH'] = 'Santa Elena';
$locale['countries']['LC'] = 'Santa Lucía';
$locale['countries']['ST'] = 'Santo Tomé y Príncipe';
$locale['countries']['SN'] = 'Senegal';
$locale['countries']['RS'] = 'Serbia';
$locale['countries']['CS'] = 'Serbia y Montenegro';
$locale['countries']['SC'] = 'Seychelles';
$locale['countries']['SL'] = 'Sierra Leona';
$locale['countries']['SG'] = 'Singapur';
$locale['countries']['SY'] = 'Siria';
$locale['countries']['SO'] = 'Somalia';
$locale['countries']['LK'] = 'Sri Lanka';
$locale['countries']['SZ'] = 'Suazilandia';
$locale['countries']['ZA'] = 'Sudáfrica';
$locale['countries']['SD'] = 'Sudán';
$locale['countries']['SE'] = 'Suecia';
$locale['countries']['CH'] = 'Suiza';
$locale['countries']['SR'] = 'Surinam';
$locale['countries']['SJ'] = 'Svalbard y Jan Mayen';
$locale['countries']['EH'] = 'Sáhara Occidental';
$locale['countries']['TH'] = 'Tailandia';
$locale['countries']['TW'] = 'Taiwán';
$locale['countries']['TZ'] = 'Tanzania';
$locale['countries']['TJ'] = 'Tayikistán';
$locale['countries']['IO'] = 'Territorio Británico del Océano Índico';
$locale['countries']['TF'] = 'Territorios Australes Franceses';
$locale['countries']['QO'] = 'Territorios alejados de Oceanía';
$locale['countries']['TL'] = 'Timor Oriental';
$locale['countries']['TG'] = 'Togo';
$locale['countries']['TK'] = 'Tokelau';
$locale['countries']['TO'] = 'Tonga';
$locale['countries']['TT'] = 'Trinidad y Tobago';
$locale['countries']['TN'] = 'Túnez';
$locale['countries']['TM'] = 'Turkmenistán';
$locale['countries']['TR'] = 'Turquía';
$locale['countries']['TV'] = 'Tuvalu';
$locale['countries']['UA'] = 'Ucrania';
$locale['countries']['UG'] = 'Uganda';
$locale['countries']['QU'] = 'Unión Europea';
$locale['countries']['UY'] = 'Uruguay';
$locale['countries']['UZ'] = 'Uzbekistán';
$locale['countries']['VU'] = 'Vanuatu';
$locale['countries']['VE'] = 'Venezuela';
$locale['countries']['VN'] = 'Vietnam';
$locale['countries']['WF'] = 'Wallis y Futuna';
$locale['countries']['YE'] = 'Yemen';
$locale['countries']['DJ'] = 'Yibuti';
$locale['countries']['ZM'] = 'Zambia';
$locale['countries']['ZW'] = 'Zimbabue';

// date
$locale['date'] = array();

// date - months
$locale['date']['months'] = array();

// date - months full
$locale['date']['months']['full'] = array();
$locale['date']['months']['full'][1] = 'enero';
$locale['date']['months']['full'][2] = 'febrero';
$locale['date']['months']['full'][3] = 'marzo';
$locale['date']['months']['full'][4] = 'abril';
$locale['date']['months']['full'][5] = 'mayo';
$locale['date']['months']['full'][6] = 'junio';
$locale['date']['months']['full'][7] = 'julio';
$locale['date']['months']['full'][8] = 'agosto';
$locale['date']['months']['full'][9] = 'septiembre';
$locale['date']['months']['full'][10] = 'octubre';
$locale['date']['months']['full'][11] = 'noviembre';
$locale['date']['months']['full'][12] = 'diciembre';

// date - months abbreviated
$locale['date']['months']['abbreviated'] = array();
$locale['date']['months']['abbreviated'][1] = 'ene';
$locale['date']['months']['abbreviated'][2] = 'feb';
$locale['date']['months']['abbreviated'][3] = 'mar';
$locale['date']['months']['abbreviated'][4] = 'abr';
$locale['date']['months']['abbreviated'][5] = 'may';
$locale['date']['months']['abbreviated'][6] = 'jun';
$locale['date']['months']['abbreviated'][7] = 'jul';
$locale['date']['months']['abbreviated'][8] = 'ago';
$locale['date']['months']['abbreviated'][9] = 'sep';
$locale['date']['months']['abbreviated'][10] = 'oct';
$locale['date']['months']['abbreviated'][11] = 'nov';
$locale['date']['months']['abbreviated'][12] = 'dic';

// date - days
$locale['date']['days'] = array();

// date - days full
$locale['date']['days']['full'] = array();
$locale['date']['days']['full']['sun'] = 'domingo';
$locale['date']['days']['full']['mon'] = 'lunes';
$locale['date']['days']['full']['tue'] = 'martes';
$locale['date']['days']['full']['wed'] = 'miércoles';
$locale['date']['days']['full']['thu'] = 'jueves';
$locale['date']['days']['full']['fri'] = 'viernes';
$locale['date']['days']['full']['sat'] = 'sábado';

// date - days abbreviated
$locale['date']['days']['abbreviated'] = array();
$locale['date']['days']['abbreviated']['sun'] = 'dom';
$locale['date']['days']['abbreviated']['mon'] = 'lun';
$locale['date']['days']['abbreviated']['tue'] = 'mar';
$locale['date']['days']['abbreviated']['wed'] = 'mié';
$locale['date']['days']['abbreviated']['thu'] = 'jeu';
$locale['date']['days']['abbreviated']['fri'] = 'vie';
$locale['date']['days']['abbreviated']['sat'] = 'sáb';

// time - time ago
$locale['time']['SecondAgo'] = 'hace 1 segundo';
$locale['time']['SecondsAgo'] = 'hace %s segundos';
$locale['time']['MinuteAgo'] = 'hace 1 minuto';
$locale['time']['MinutesAgo'] = 'hace %s minutos';
$locale['time']['HourAgo'] = 'hace 1 hora';
$locale['time']['HoursAgo'] = 'hace %s horas';
$locale['time']['DayAgo'] = 'hace 1 día';
$locale['time']['DaysAgo'] = 'hace %s días';
$locale['time']['WeekAgo'] = 'hace 1 semana';
$locale['time']['WeeksAgo'] = 'hace %s semanas';
$locale['time']['MonthAgo'] = 'hace 1 mes';
$locale['time']['MonthsAgo'] = 'hace %s meses';
$locale['time']['YearAgo'] = 'hace 1 año';
$locale['time']['YearsAgo'] = 'hace %s años';

?>


text:
CKEDITOR.plugins.setLang( 'a11yhelp', 'it', {
	title: 'Istruzioni di Accessibilità',
	contents: 'Contenuti di Aiuto. Per chiudere questa finestra premi ESC.',
	legend: [
		{
		name: 'Generale',
		items: [
			{
			name: 'Barra degli strumenti Editor',
			legend: 'Premi ${toolbarFocus} per navigare fino alla barra degli strumenti. Muoviti tra i gruppi della barra degli strumenti con i tasti Tab e Maiusc-Tab. Spostati tra il successivo ed il precedente pulsante della barra degli strumenti usando le frecce direzionali Destra e Sinistra. Premi Spazio o Invio per attivare il pulsante della barra degli strumenti.'
		},

			{
			name: 'Finestra Editor',
			legend: 'All\'interno di una finestra di dialogo, premi Tab per navigare fino al campo successivo della finestra di dialogo, premi Maiusc-Tab per tornare al campo precedente, premi Invio per inviare la finestra di dialogo, premi Esc per uscire. Per le finestre che hanno schede multiple, premi Alt+F10 per navigare nella lista delle schede. Quindi spostati alla scheda successiva con il tasto Tab oppure con la Freccia Destra. Torna alla scheda precedente con Maiusc+Tab oppure con la Freccia Sinistra. Premi Spazio o Invio per scegliere la scheda.'
		},

			{
			name: 'Menù contestuale Editor',
			legend: 'Premi ${contextMenu} o TASTO APPLICAZIONE per aprire il menu contestuale. Dunque muoviti all\'opzione successiva del menu con il tasto TAB o con la Freccia Sotto. Muoviti all\'opzione precedente con  MAIUSC+TAB o con Freccia Sopra. Premi SPAZIO o INVIO per scegliere l\'opzione di menu. Apri il sottomenu dell\'opzione corrente con SPAZIO o INVIO oppure con la Freccia Destra. Torna indietro al menu superiore con ESC oppure Freccia Sinistra. Chiudi il menu contestuale con ESC.'
		},

			{
			name: 'Box Lista Editor',
			legend: 'Dentro un box-lista, muoviti al prossimo elemento della lista con TAB o con la Freccia direzionale giù. Spostati all\'elemento precedente con MAIUSC+TAB oppure con Freccia direzionale sopra. Premi SPAZIO o INVIO per scegliere l\'opzione della lista. Premi ESC per chiudere il box-lista.'
		},

			{
			name: 'Barra percorso elementi editor',
			legend: 'Premi ${elementsPathFocus} per navigare tra gli elementi della barra percorso. Muoviti al prossimo pulsante di elemento con TAB o la Freccia direzionale destra. Muoviti al pulsante precedente con MAIUSC+TAB o la Freccia Direzionale Sinistra. Premi SPAZIO o INVIO per scegliere l\'elemento nell\'editor.'
		}
		]
	},
		{
		name: 'Comandi',
		items: [
			{
			name: ' Annulla comando',
			legend: 'Premi ${undo}'
		},
			{
			name: ' Ripeti comando',
			legend: 'Premi ${redo}'
		},
			{
			name: ' Comando Grassetto',
			legend: 'Premi ${bold}'
		},
			{
			name: ' Comando Corsivo',
			legend: 'Premi ${italic}'
		},
			{
			name: ' Comando Sottolineato',
			legend: 'Premi ${underline}'
		},
			{
			name: ' Comando Link',
			legend: 'Premi ${link}'
		},
			{
			name: ' Comando riduci barra degli strumenti',
			legend: 'Premi ${toolbarCollapse}'
		},
			{
			name: 'Comando di accesso al precedente spazio di focus',
			legend: 'Premi ${accessPreviousSpace} per accedere il più vicino spazio di focus non raggiungibile prima del simbolo caret, per esempio due elementi HR adiacenti. Ripeti la combinazione di tasti per raggiungere spazi di focus distanti.'
		},
			{
			name: 'Comando di accesso al prossimo spazio di focus',
			legend: 'Premi ${accessNextSpace} per accedere il più vicino spazio di focus non raggiungibile dopo il simbolo caret, per esempio due elementi HR adiacenti. Ripeti la combinazione di tasti per raggiungere spazi di focus distanti.'
		},
			{
			name: ' Aiuto Accessibilità',
			legend: 'Premi ${a11yHelp}'
		}
		]
	}
	],
	backspace: 'Backspace',
	tab: 'Tab',
	enter: 'Invio',
	shift: 'Maiusc',
	ctrl: 'Ctrl',
	alt: 'Alt',
	pause: 'Pausa',
	capslock: 'Bloc Maiusc',
	escape: 'Esc',
	pageUp: 'Pagina sù',
	pageDown: 'Pagina giù',
	end: 'Fine',
	home: 'Inizio',
	leftArrow: 'Freccia sinistra',
	upArrow: 'Freccia su',
	rightArrow: 'Freccia destra',
	downArrow: 'Freccia giù',
	insert: 'Ins',
	'delete': 'Canc',
	leftWindowKey: 'Tasto di Windows sinistro',
	rightWindowKey: 'Tasto di Windows destro',
	selectKey: 'Tasto di selezione',
	numpad0: '0 sul tastierino numerico',
	numpad1: '1 sul tastierino numerico',
	numpad2: '2 sul tastierino numerico',
	numpad3: '3 sul tastierino numerico',
	numpad4: '4 sul tastierino numerico',
	numpad5: '5 sul tastierino numerico',
	numpad6: '6 sul tastierino numerico',
	numpad7: '7 sul tastierino numerico',
	numpad8: '8 sul tastierino numerico',
	numpad9: '9 sul tastierino numerico',
	multiply: 'Moltiplicazione',
	add: 'Più',
	subtract: 'Sottrazione',
	decimalPoint: 'Punto decimale',
	divide: 'Divisione',
	f1: 'F1',
	f2: 'F2',
	f3: 'F3',
	f4: 'F4',
	f5: 'F5',
	f6: 'F6',
	f7: 'F7',
	f8: 'F8',
	f9: 'F9',
	f10: 'F10',
	f11: 'F11',
	f12: 'F12',
	numLock: 'Bloc Num',
	scrollLock: 'Bloc Scorr',
	semiColon: 'Punto-e-virgola',
	equalSign: 'Segno di uguale',
	comma: 'Virgola',
	dash: 'Trattino',
	period: 'Punto',
	forwardSlash: 'Barra',
	graveAccent: 'Accento grave',
	openBracket: 'Parentesi quadra aperta',
	backSlash: 'Barra rovesciata',
	closeBracket: 'Parentesi quadra chiusa',
	singleQuote: 'Apostrofo'
} );


text:
<?php

namespace Fungku\HubSpot\Http;

use Fungku\HubSpot\Contracts\HttpClient;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\Exception\RequestException;

class Client implements HttpClient
{
    /**
     * @var \GuzzleHttp\Client
     */
    protected $client;

    /**
     * Make it, baby.
     *
     * @param \GuzzleHttp\Client $client
     */
    public function __construct(GuzzleClient $client = null)
    {
        $this->client = $client ?: new GuzzleClient();
    }

    /**
     * Submit the request and build the response object.
     *
     * @param string $method
     * @param string $url
     * @param array  $options
     * @return \Fungku\HubSpot\Http\Response
     */
    private function makeRequest($method, $url, $options)
    {
        try {
            return new Response($this->client->request($method, $url, $options));
        } catch (RequestException $e) {
            return new Response($e->getResponse());
        }
    }

    /**
     * @param  string $url
     * @param  array  $options
     * @return \Fungku\HubSpot\Http\Response
     */
    public function get($url, $options = [])
    {
        return $this->makeRequest('GET', $url, $options);
    }

    /**
     * @param  string $url
     * @param  array  $options
     * @return \Fungku\HubSpot\Http\Response
     */
    public function post($url, $options = [])
    {
        return $this->makeRequest('POST', $url, $options);
    }

    /**
     * @param  string $url
     * @param  array  $options
     * @return \Fungku\HubSpot\Http\Response
     */
    public function put($url, $options = [])
    {
        return $this->makeRequest('PUT', $url, $options);
    }

    /**
     * @param  string $url
     * @param  array  $options
     * @return \Fungku\HubSpot\Http\Response
     */
    public function delete($url, $options = [])
    {
        return $this->makeRequest('DELETE', $url, $options);
    }
}


text:
#import <Foundation/Foundation.h>
#import "WXThreadSafeMutableDictionary.h"

@interface WXRuleManager : NSObject

+ (WXRuleManager *)sharedInstance;
- (void)addRule:(NSString *)type rule:(NSDictionary *)rule;
- (WXThreadSafeMutableDictionary *)getRule:(NSString *)type;
@end


text:
package leap.lang.meta;

import leap.lang.Args;

public class MCollectionType extends MType {

	protected final MType elementType;

	public MCollectionType(MType elementType) {
		this(null, null, elementType);
    }

	public MCollectionType(String summary, String description, MType elementType) {
	    super(summary, description);

	    Args.notNull(elementType);

	    this.elementType = elementType;
    }

    @Override
    public String getName() {
        return elementType.getName() + "[]";
    }

    @Override
	public MTypeKind getTypeKind() {
		return MTypeKind.COLLECTION;
	}

	public MType getElementType() {
		return elementType;
	}

}


text:
package ru.dyatel.karaka.util;

import ru.dyatel.karaka.posts.Post;

import java.util.List;

public class PostUtil {

	public static void sortByThreadIdList(List<Post> posts, List<Long> threadIds) {
		if (threadIds.size() != posts.size())
			throw new IllegalArgumentException("different amount of posts and thread ids!");
		int current = 0;
		for (Long id : threadIds) {
			for (int i = current; i < posts.size(); i++) {
				if (id.equals(posts.get(i).getThreadId())) {
					Post temp = posts.get(i);
					posts.set(i, posts.get(current));
					posts.set(current, temp);
					current++;
					break;
				}
			}
		}
	}

}


text:
import * as React from 'react';
import TooltipOptions from '../tooltip/tooltipoptions';
import { IconType } from '../utils';

type MultiStateCheckboxOptionsType = MultiStateCheckboxOption[] | any[];

type MultiStateCheckboxIconTemplateType = React.ReactNode | ((options: MultiStateCheckboxIconTemplateParams) => React.ReactNode);

interface MultiStateCheckboxOption {
    icon: IconType<MultiStateCheckboxProps>;
    style: object;
    className: string;
    [key: string]: any;
}

interface MultiStateCheckboxIconTemplateParams {
    option: MultiStateCheckboxOption | undefined | null;
    className: string;
    element: JSX.Element;
    props: MultiStateCheckboxProps;
}

interface MultiStateCheckboxChangeTargetOptions {
    name: string;
    id: string;
    value: boolean | undefined | null;
}

interface MultiStateCheckboxChangeParams {
    originalEvent: React.SyntheticEvent;
    value: any;
    stopPropagation(): void;
    preventDefault(): void;
    target: MultiStateCheckboxChangeTargetOptions;
}

export interface MultiStateCheckboxProps extends Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange' | 'ref'> {
    value?: any;
    options?: MultiStateCheckboxOptionsType;
    optionValue?: string;
    optionLabel?: string;
    iconTemplate?: MultiStateCheckboxIconTemplateType;
    dataKey?: string;
    disabled?: boolean;
    readOnly?: boolean;
    empty?: boolean;
    tooltip?: string;
    tooltipOptions?: TooltipOptions;
    onChange?(e: MultiStateCheckboxChangeParams): void;
    children?: React.ReactNode;
}

export declare class MultiStateCheckbox extends React.Component<MultiStateCheckboxProps, any> {
    public getElement(): HTMLDivElement;
}


text:
import SecondaryNavAbstract from '../common/SecondaryNavAbstract';
import SecondaryNavItem from '../common/SecondaryNavItem';
import SecondarySubNavButtons from './SecondarySubNavButtons';

/**
 * A secondary menu with toggle buttons.
 */
export default class SecondaryNavButtons extends SecondaryNavAbstract {

  /**
   * Initialize.
   *
   * @param {HTMLElement} elem  The outermost wrapper for the Navigation.
   * @param {Object} options    An object of metadata.
   */
  constructor(elem, options = {}) {

    // Merge with the default options.
    options = Object.assign({
      itemExpandedClass: 'su-secondary-nav__item--expanded',
      toggleClass: 'su-nav-toggle',
      toggleLabel: 'expand menu',
      subNavToggleText: '+'
    }, options);

    // Call the super.
    super(elem, options);

    // Ok do the creation.
    this.createSubNavItems();

    // Expand the path.
    this.activePath.expandActivePath();
  }

  /**
   * Add the additional state handling after the abstract option has run.
   *
   * @param  {HTMLElement} item The HTMLElement being acted upon.
   */
  expandActivePathItem(item) {
    var node = item.querySelector('.' + this.options.toggleClass);
    if (node) {
      node.setAttribute('aria-expanded', 'true');
    }
  }

  /**
   * Function for creating a new nested navigation item.
   *
   * @param  {HTMLElement} item     The HTMLElement to attach a new subnav to.
   * @param  {Integer} depth        The level of nesting. (starts at 1)
   * @param  {Object|Mixed} parent  The parent subnav instance.
   *
   * @return {SecondarySubNavButtons} A brand new instance.
   */
  newParentItem(item, depth, parent) {
    var nav = new SecondarySubNavButtons(
      item,
      this,
      parent,
      {
        itemExpandedClass: this.options.itemExpandedClass,
        depth: depth
      }
    );
    this.subNavItems.push(nav);
    return nav;
  }

  /**
   * Function for creating a new single tier navigation item.
   *
   * @param  {HTMLElement} item     The HTMLElement to attach a new subnav to.
   * @param  {Integer} depth        The level of nesting. (starts at 1)
   * @param  {Object|Mixed} parent  The parent subnav instance.
   *
   * @return {SecondaryNavItem} A brand new instance.
   */
  newNavItem(item, depth, parent) {
    var nav = new SecondaryNavItem(
      item,
      this,
      parent,
      {depth: depth}
    );
    this.navItems.push(nav);
    return nav;
  }

}


text:
<?php

require_once '../inc/connection.inc.php';

$query_searched = trim($_GET['search']);
$final_response = array();
$connection = get_mysql_connection();

$query = "SELECT `id`,`city_name` FROM `cities` WHERE `city_name` LIKE '%$query_searched%'
	ORDER BY CASE WHEN `city_name` like '$query_searched%' THEN 0
	WHEN `city_name` like '%$query_searched%' THEN 1 ELSE 2
	END, `city_name` LIMIT 10";

$query_run = mysqli_query($connection, $query);

while ($query_row = mysqli_fetch_assoc($query_run)) {
	$temp_array = array(
		'id'   => (int)$query_row['id'],
		'name' => ucwords(strtolower(trim($query_row['city_name']))),
	);

	array_push($final_response, $temp_array);
}

echo json_encode($final_response);


text:
function [Plots]=do_vector_plot_MatlabMapC(plotOPTS,FVCOM,tt)
%
% Function to display vector maps of FVCOM currents (i.e. U,V)
%
%  [Plots]=do_vector_plot(plotOPTS,FVCOM)
%
% DESCRIPTION:
%    Generates vector maps of currents using m_map toolbox
%
% INPUT:
%   plotOPTS   = structure array with predefined options for generating the
%   maps
%   FVCOM  = data extracted from FVCOM NC file. See read_netCDF_FVCOM for
%   details
%
%   plotOPTS.range_lat: [50.1000 50.4000]
%   plotOPTS.range_lon: [-4.5000 -3.8500]
%   plotOPTS.fig_name: 'co2_S5_slowleak'
%   plotOPTS.mesh: [1x1 struct]
%   plotOPTS.coastline_file: '../mat/tamar3_0coast.mat'
%   plotOPTS.zone: 30
%   plotOPTS.ell: 'grs80'
%   plotOPTS.var_plot: 'PH'
%   plotOPTS.clims: [6 8]
%   plotOPTS.do_mesh: 0
%   plotOPTS.nz_plot: 1
%   plotOPTS.figure: 1
%   plotOPTS.Time_record: 7.3271e+05
%   plotOPTS.nz_plot_vec: 1
%   plotOPTS.data_dec: 5
%   plotOPTS.vel_sca: 5
%   plotOPTS.pause: 0.5000

%
% OUTPUT:
%   Plots = structure array with figure handles
%
% EXAMPLE USAGE
%    [Plots]=do_vector_plot(plotOPTS,FVCOM)
%
% Author(s):
%    Ricardo Torres and Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history
%
%==============================================================================
% adds m_map to matlab paths. file is in utilities directory.
% ammend according to your m_map installation paths
figure(plotOPTS.figure);
% generate figure with correct projection lat and lon range ellipsoid and
% zone.

axesm('mercator','MapLatLimit',plotOPTS.range_lat,'MapLonLimit',[plotOPTS.range_lon],'MeridianLabel','on',...
    'ParallelLabel','on','MLineLocation',[0.1],'PLineLocation',[0.1],'LabelUnits','dm')

% add coastline if present
if (isfield(plotOPTS,'coastline_file') && ~isempty(plotOPTS.coastline_file) )
    coast=load(plotOPTS.coastline_file);
    geoshow([coast.ncst(:,2)],[coast.ncst(:,1)],'Color','black')

end
%-----------------------------------------------------------------------
% Convert element positions from FVCOM to lat and lon using m_ll2ll.m from
% utilities directory. This accesses m_map functions.
% In my case it needs adding 6 because of discrepancies between proj and m_map.
% Proj automatically determines a
% reference long in strides of 6deg while m_map doesn't
%------------------------------------------------------------------------

% only plot vectors inside lat and lon range and ...
if ~isfield(plotOPTS.mesh,'latc')
    try
        plotOPTS.mesh.latc = nodes2elems(plotOPTS.mesh.lat,plotOPTS.mesh);
        plotOPTS.mesh.lonc = nodes2elems(plotOPTS.mesh.lon,plotOPTS.mesh);
    catch
        disp(['We have no access to nodes2elems in the fvcom_prepro directory'])
    end
end
igood = find ( plotOPTS.mesh.lonc < plotOPTS.range_lon(2) &  plotOPTS.mesh.lonc > plotOPTS.range_lon(1) &...
     plotOPTS.mesh.latc < plotOPTS.range_lat(2) &   plotOPTS.mesh.latc > plotOPTS.range_lat(1));
% decimate positions. Plot every plotOPTS.data_dec position.
igood=igood(1:plotOPTS.data_dec:end);

%------------------------------------------------------------------------
% Select how many layers to plot
%------------------------------------------------------------------------
ND=ndims(FVCOM.(plotOPTS.var_plotu))
switch ND
    case 2
        nLayers=1;
        colourSpec=[0 0 0];

    case 3
        if isfield(plotOPTS,'nz_plot_vec')
            nLayers=size(plotOPTS.nz_plot_vec,2);
            nLayersRange=plotOPTS.nz_plot_vec;
        else
            nLayers=size(plotOPTS.nz_plot,2);
            nLayersRange=plotOPTS.nz_plot;
        end
        % choose colors for vectors
        if nLayers==1
            colourSpec=[0 0 0];
        else
            colourSpec=colormap(hsv(nLayers));
        end
end

% Preallocate outputs
u=nan(size(igood,1),nLayers,1);
v=nan(size(igood,1),nLayers,1);

% Check if we're running
% for aa=1:length(plotOPTS.Time_record)
aa=tt;
fprintf('Time step %i of %i\n',aa,length(FVCOM.Time_record));

% Mesh goes underneath vectors.
% if plotOPTS.do_mesh
%     % plot vertices
%     Plots(plotOPTS.figure).mesh=patch('Vertices',[double(plotOPTS.mesh.lat),double(plotOPTS.mesh.lon)],'Faces',plotOPTS.mesh.tri,...
%         'EdgeColor',[0.6 0.6 0.6],'FaceColor','none');hold on
% end

switch ND
    case 2
        u(:,1)=squeeze(FVCOM.(plotOPTS.var_plotu)(igood,(aa)));
        v(:,1)=squeeze(FVCOM.(plotOPTS.var_plotv)(igood,(aa)));
    case 3
        for ii=1:nLayers
            u(:,ii)=squeeze(FVCOM.(plotOPTS.var_plotu)(igood,nLayersRange(ii),(aa)));
            v(:,ii)=squeeze(FVCOM.(plotOPTS.var_plotv)(igood,nLayersRange(ii),(aa)));
        end
end
for jj=1:nLayers
%     [Plots(plotOPTS.figure).handles{jj}]=quiver(double(plotOPTS.mesh.lonc(igood)),double(plotOPTS.mesh.latc(igood)),u,v,plotOPTS.vel_sca,'k','filled');
[Plots(plotOPTS.figure).handles{jj}]=quiverwcolorbar(double(plotOPTS.mesh.lonc(igood)),double(plotOPTS.mesh.latc(igood)),u,v,...
    plotOPTS.vel_sca,'bounds',plotOPTS.clims)
    %     [Plots(plotOPTS.figure).handles{jj}]=quiverm(double(FVCOM.latc(igood)),double(FVCOM.lonc(igood)),u./100,v./100,'k',0,'filled'),
%     [Plots(plotOPTS.figure).handles(jj),~]=m_vec(plotOPTS.vel_sca,x(igood),y(igood),...
%         u(:,jj),v(:,jj),colourSpec(jj,:),...
%         'shaftwidth',1,'headwidth',2);
    %         hold on
end
pause(plotOPTS.pause)
%     if aa~=length(plotOPTS.Time_record)
%         delete(Plots(plotOPTS.figure).handles(:))
%     end
% end


text:
package uk.co.jamesmcguigan.patterns.behavioural.observer;

public class Lighting implements AlarmListener {
    public void alarm() {
        System.out.println("lights up");
    }
}


text:
/** \file I2cInterfaceVariables.h
 * \brief Header file for global variables required for Xilinx I2C interface
 * functions.
 * \author Garry Jeromson
 * \date 07.07.15
 */

#pragma once

//-------------------------------------------------------------------------------------------------
// Includes
//-------------------------------------------------------------------------------------------------

#include <xiicps.h>
#include <xparameters.h>
#include <xparameters_ps.h>

//-------------------------------------------------------------------------------------------------
// Definitions and constants
//-------------------------------------------------------------------------------------------------

/// Device ID
#define IIC_DEVICE_ID XPAR_XIICPS_0_DEVICE_ID

/// Interrupt ID
#define IIC_INTR_ID XPAR_XIICPS_0_INTR

//-------------------------------------------------------------------------------------------------
// Global variable declarations
//-------------------------------------------------------------------------------------------------

extern XIicPs g_XIicPsInstance;


text:
module Idcf
  module Ilb
    module Validators
      # Server validator class
      class Server < Base
        self.valid_attributes = {
          ipaddress:     { type: String, add: :required },
          port:          { type: Integer, add: :required }
        }
      end
    end
  end
end


text:
"""Tests for numerical correctness."""

from absl.testing import parameterized
import numpy as np

from tensorflow.python import keras
from tensorflow.python.keras import keras_parameterized
from tensorflow.python.keras import testing_utils
from tensorflow.python.platform import test

class MultiInputSubclassed(keras.Model):
  """Subclassed Model that adds its inputs and then adds a bias."""

  def __init__(self):
    super(MultiInputSubclassed, self).__init__()
    self.add = keras.layers.Add()
    self.bias = testing_utils.Bias()

  def call(self, inputs):
    added = self.add(inputs)
    return self.bias(added)

def multi_input_functional():
  """Functional Model that adds its inputs and then adds a bias."""
  input_1 = keras.Input(shape=(1,))
  input_2 = keras.Input(shape=(1,))
  input_3 = keras.Input(shape=(1,))
  added = keras.layers.Add()([input_1, input_2, input_3])
  output = testing_utils.Bias()(added)
  return keras.Model([input_1, input_2, input_3], output)

@keras_parameterized.run_with_all_model_types
@keras_parameterized.run_all_keras_modes
class SimpleBiasTest(keras_parameterized.TestCase):

  def _get_simple_bias_model(self):
    model = testing_utils.get_model_from_layers([testing_utils.Bias()],
                                                input_shape=(1,))
    model.compile(
        keras.optimizer_v2.gradient_descent.SGD(0.1),
        'mae',
        run_eagerly=testing_utils.should_run_eagerly())
    return model

  def test_simple_bias_fit(self):
    x = np.array([[0.], [1.], [2.]])
    y = np.array([[0.5], [2.], [3.5]])
    model = self._get_simple_bias_model()

    history = model.fit(x, y, batch_size=3, epochs=5)
    self.assertAllClose(history.history['loss'], [1., 0.9, 0.8, 0.7, 0.6])

  def test_simple_bias_evaluate(self):
    x = np.array([[0.], [1.], [2.]])
    y = np.array([[1.], [3.], [5.]])
    model = self._get_simple_bias_model()

    loss = model.evaluate(x, y, batch_size=1)
    self.assertAlmostEqual(loss, 2.)

  def test_simple_bias_predict(self):
    x = np.array([[0.], [1.], [2.]])
    model = self._get_simple_bias_model()

    pred = model.predict(x, batch_size=1)
    self.assertAllClose(x, pred)

@keras_parameterized.run_all_keras_modes
class MultipleInputTest(keras_parameterized.TestCase):

  def _get_multiple_input_model(self, subclassed=True):
    if subclassed:
      model = MultiInputSubclassed()
    else:
      model = multi_input_functional()
    model.compile(
        keras.optimizer_v2.gradient_descent.SGD(0.1),
        'mae',
        run_eagerly=testing_utils.should_run_eagerly())
    return model

  @parameterized.named_parameters(('subclassed', True), ('functional', False))
  def test_multiple_input_fit(self, subclassed):
    x = [
        np.array([[1.], [2.], [3.]]),
        np.array([[4.], [5.], [6.]]),
        np.array([[7.], [8.], [9.]])
    ]
    y = np.array([[12.5], [16.], [19.5]])

    model = self._get_multiple_input_model(subclassed)
    history = model.fit(x, y, batch_size=3, epochs=5)
    self.assertAllClose(history.history['loss'], [1., 0.9, 0.8, 0.7, 0.6])

  @parameterized.named_parameters(('subclassed', True), ('functional', False))
  def test_multiple_input_evaluate(self, subclassed):
    x = [
        np.array([[1.], [2.], [3.]]),
        np.array([[4.], [5.], [6.]]),
        np.array([[7.], [8.], [9.]])
    ]
    y = np.array([[13.], [17.], [21.]])

    model = self._get_multiple_input_model(subclassed)
    loss = model.evaluate(x, y, batch_size=3)
    self.assertAlmostEqual(loss, 2.)

  @parameterized.named_parameters(('subclassed', True), ('functional', False))
  def test_multiple_input_predict(self, subclassed):
    x = [
        np.array([[1.], [2.], [3.]]),
        np.array([[4.], [5.], [6.]]),
        np.array([[7.], [8.], [9.]])
    ]

    model = self._get_multiple_input_model(subclassed)
    pred = model.predict(x, batch_size=1)
    self.assertAllClose(pred, [[12.], [15.], [18.]])

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


text:
#ifndef INCLUDE_stransport_stream_h__
#define INCLUDE_stransport_stream_h__

#include "git2/sys/stream.h"

extern int git_stransport_stream_new(git_stream **out, const char *host, const char *port);

#endif


text:
Serpent source is released under the MIT License

Copyright (c) 2011-2013 Paul Kulchenko (paul@kulchenko.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--]]

local n, v = "serpent", 0.284 -- (C) 2012-15 Paul Kulchenko; MIT License
local c, d = "Paul Kulchenko", "Lua serializer and pretty printer"
local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'}
local badtype = {thread = true, userdata = true, cdata = true}
local getmetatable = debug and debug.getmetatable or getmetatable
local keyword, globals, G = {}, {}, (_G or _ENV)
for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false',
  'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat',
  'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end
for k,v in pairs(G) do globals[v] = k end -- build func to name mapping
for _,g in ipairs({'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}) do
  for k,v in pairs(type(G[g]) == 'table' and G[g] or {}) do globals[v] = g..'.'..k end end

local function s(t, opts)
  local name, indent, fatal, maxnum = opts.name, opts.indent, opts.fatal, opts.maxnum
  local sparse, custom, huge = opts.sparse, opts.custom, not opts.nohuge
  local space, maxl = (opts.compact and '' or ' '), (opts.maxlevel or math.huge)
  local iname, comm = '_'..(name or ''), opts.comment and (tonumber(opts.comment) or math.huge)
  local numformat = opts.numformat or "%.17g"
  local seen, sref, syms, symn = {}, {'local '..iname..'={}'}, {}, 0
  local function gensym(val) return '_'..(tostring(tostring(val)):gsub("[^%w]",""):gsub("(%d%w+)",
    -- tostring(val) is needed because __tostring may return a non-string value
    function(s) if not syms[s] then symn = symn+1; syms[s] = symn end return tostring(syms[s]) end)) end
  local function safestr(s) return type(s) == "number" and tostring(huge and snum[tostring(s)] or numformat:format(s))
    or type(s) ~= "string" and tostring(s) -- escape NEWLINE/010 and EOF/026
    or ("%q"):format(s):gsub("\010","n"):gsub("\026","\\026") end
  local function comment(s,l) return comm and (l or 0) < comm and ' --[['..select(2, pcall(tostring, s))..']]' or '' end
  local function globerr(s,l) return globals[s] and globals[s]..comment(s,l) or not fatal
    and safestr(select(2, pcall(tostring, s))) or error("Can't serialize "..tostring(s)) end
  local function safename(path, name) -- generates foo.bar, foo[3], or foo['b a r']
    local n = name == nil and '' or name
    local plain = type(n) == "string" and n:match("^[%l%u_][%w_]*$") and not keyword[n]
    local safe = plain and n or '['..safestr(n)..']'
    return (path or '')..(plain and path and '.' or '')..safe, safe end
  local alphanumsort = type(opts.sortkeys) == 'function' and opts.sortkeys or function(k, o, n) -- k=keys, o=originaltable, n=padding
    local maxn, to = tonumber(n) or 12, {number = 'a', string = 'b'}
    local function padnum(d) return ("%0"..tostring(maxn).."d"):format(tonumber(d)) end
    table.sort(k, function(a,b)
      -- sort numeric keys first: k[key] is not nil for numerical keys
      return (k[a] ~= nil and 0 or to[type(a)] or 'z')..(tostring(a):gsub("%d+",padnum))
           < (k[b] ~= nil and 0 or to[type(b)] or 'z')..(tostring(b):gsub("%d+",padnum)) end) end
  local function val2str(t, name, indent, insref, path, plainindex, level)
    local ttype, level, mt = type(t), (level or 0), getmetatable(t)
    local spath, sname = safename(path, name)
    local tag = plainindex and
      ((type(name) == "number") and '' or name..space..'='..space) or
      (name ~= nil and sname..space..'='..space or '')
    if seen[t] then -- already seen this element
      sref[#sref+1] = spath..space..'='..space..seen[t]
      return tag..'nil'..comment('ref', level) end
    -- protect from those cases where __tostring may fail
    if type(mt) == 'table' and pcall(function() return mt.__tostring and mt.__tostring(t) end)
    and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself
      seen[t] = insref or spath
      if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end
      ttype = type(t) end -- new value falls through to be serialized
    if ttype == "table" then
      if level >= maxl then return tag..'{}'..comment('max', level) end
      seen[t] = insref or spath
      if next(t) == nil then return tag..'{}'..comment(t, level) end -- table empty
      local maxn, o, out = math.min(#t, maxnum or #t), {}, {}
      for key = 1, maxn do o[key] = key end
      if not maxnum or #o < maxnum then
        local n = #o -- n = n + 1; o[n] is much faster than o[#o+1] on large tables
        for key in pairs(t) do if o[key] ~= key then n = n + 1; o[n] = key end end end
      if maxnum and #o > maxnum then o[maxnum+1] = nil end
      if opts.sortkeys and #o > maxn then alphanumsort(o, t, opts.sortkeys) end
      local sparse = sparse and #o > maxn -- disable sparsness if only numeric keys (shorter output)
      for n, key in ipairs(o) do
        local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse
        if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing
        or opts.keyallow and not opts.keyallow[key]
        or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types
        or sparse and value == nil then -- skipping nils; do nothing
        elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then
          if not seen[key] and not globals[key] then
            sref[#sref+1] = 'placeholder'
            local sname = safename(iname, gensym(key)) -- iname is table for local variables
            sref[#sref] = val2str(key,sname,indent,sname,iname,true) end
          sref[#sref+1] = 'placeholder'
          local path = seen[t]..'['..tostring(seen[key] or globals[key] or gensym(key))..']'
          sref[#sref] = path..space..'='..space..tostring(seen[value] or val2str(value,nil,indent,path))
        else
          out[#out+1] = val2str(value,key,indent,insref,seen[t],plainindex,level+1)
        end
      end
      local prefix = string.rep(indent or '', level)
      local head = indent and '{\n'..prefix..indent or '{'
      local body = table.concat(out, ','..(indent and '\n'..prefix..indent or space))
      local tail = indent and "\n"..prefix..'}' or '}'
      return (custom and custom(tag,head,body,tail) or tag..head..body..tail)..comment(t, level)
    elseif badtype[ttype] then
      seen[t] = insref or spath
      return tag..globerr(t, level)
    elseif ttype == 'function' then
      seen[t] = insref or spath
      local ok, res = pcall(string.dump, t)
      local func = ok and ((opts.nocode and "function() --[[..skipped..]] end" or
        "((loadstring or load)("..safestr(res)..",'@serialized'))")..comment(t, level))
      return tag..(func or globerr(t, level))
    else return tag..safestr(t) end -- handle all other types
  end
  local sepr = indent and "\n" or ";"..space
  local body = val2str(t, name, indent) -- this call also populates sref
  local tail = #sref>1 and table.concat(sref, sepr)..sepr or ''
  local warn = opts.comment and #sref>1 and space.."--[[incomplete output with shared/self-references skipped]]" or ''
  return not name and body..warn or "do local "..body..sepr..tail.."return "..name..sepr.."end"
end

local function deserialize(data, opts)
  local env = (opts and opts.safe == false) and G
    or setmetatable({}, {
        __index = function(t,k) return t end,
        __call = function(t,...) error("cannot call functions") end
      })
  local f, res = (loadstring or load)('return '..data, nil, nil, env)
  if not f then f, res = (loadstring or load)(data, nil, nil, env) end
  if not f then return f, res end
  if setfenv then setfenv(f, env) end
  return pcall(f)
end

local function merge(a, b) if b then for k,v in pairs(b) do a[k] = v end end; return a; end
return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize = s,
  load = deserialize,
  dump = function(a, opts) return s(a, merge({name = '_', compact = true, sparse = true}, opts)) end,
  line = function(a, opts) return s(a, merge({sortkeys = true, comment = true}, opts)) end,
  block = function(a, opts) return s(a, merge({indent = '  ', sortkeys = true, comment = true}, opts)) end }


text:
@interface DropboxUploadSessionFinishArg (DictionarySerializer) <DictionarySerializer>

@end


text:
/*
    Created on : 10-Apr-2015, 9:09:33 PM
    Author     : Nathan
*/
body, html {
    overflow: hidden;
    background: transparent;
    margin: 0 auto;
    width: 95%;
    height: 100%;

    background: black;
}

#preview-container {
    width: 100%;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
    height: 100%;
}

#preview-header {
    border-bottom: 3px solid #FF9900;
    margin-bottom: 15px;
}

#preview-content {
    height: 95%;
}

div#preview-tabs.ui-tabs {
    padding: 0;
}
div#preview-tabs.ui-widget-content {
    background: none;
    font-size: 0.9em;
    border: none;
}

#orbit-preview {
    overflow: hidden;
}

div#preview-tabs div.ui-tabs-panel.ui-widget-content {
    padding: 0;
    border-left: 1px dashed rgba(255, 102, 0, 0.75);
    border-right: 1px dashed rgba(255, 102, 0, 0.75);
    border-bottom: 1px dashed rgba(255, 102, 0, 0.75);

}

#preview-footer {
    margin-top: 15px;
    border-top: 3px solid #FF9900;
    display:flex;
    justify-content: space-between;
}

#seed-section {
    color: white;
    font-size: 0.9em;
}

div.bar-display {
    height: 45px;
    text-align: center;
    background: rgba(255, 102, 0, 0.10);
    border-radius: 5px;
    font-size: 0.8em;
    padding: 5px 15px;
}
div.bar-display button {
    /*font-size: 0.8em;*/
}

canvas {
    background: rgba(255, 102, 0, 0.05);
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

#preview-settings-dialog {
    font-size: 0.8em;
}
button.iconButton {
    width: 16px;
    height: 16px;
}

div.ui-dialog div.ui-dialog-titlebar span.ui-dialog-title {
    font-size: 0.85em;
}

div.ui-dialog-buttonset button.ui-button {
    font-size: 0.7em;
}

div.dialog-input {
    width: 100%;
    margin-bottom: 5px;
}
div.dialog-input label {
    width: 45%;
    display: inline-table;
}
div.dialog-input input {
    width: 50%;
}

div.dialog-input select {
    width: 51%;
}

/* Allow Font Awesome Icons in lieu of jQuery UI and only apply when using a FA icon */
.ui-icon[class*=" fa-"] {
    /* Remove the jQuery UI Icon */
    background: none repeat scroll 0 0 transparent;
    /* Remove the jQuery UI Text Indent */
    text-indent: 0;
    /* Bump it up - jQuery UI is -8px */
    width: auto;
    height: auto;
}

.ui-button-icon-only .ui-icon[class*=" fa-"] {
    /* Bump it - jQuery UI is -8px */
    margin-left: -7px;
}

/* Allow use of icon-large to be properly aligned */
.ui-icon.icon-large {
    margin-top: -0.75em;
}


text:
/*
 * $Id: mtd_blkdevs.c,v 1.27 2005/11/07 11:14:20 gleixner Exp $
 *
 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
 *
 * Interface to Linux 2.5 block layer for MTD 'translation layers'.
 *
 */

#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/fs.h>
#include <linux/mtd/blktrans.h>
#include <linux/mtd/mtd.h>
#include <linux/blkdev.h>
#include <linux/blkpg.h>
#include <linux/spinlock.h>
#include <linux/hdreg.h>
#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/kthread.h>
#include <asm/uaccess.h>

static LIST_HEAD(blktrans_majors);

extern struct mutex mtd_table_mutex;
extern struct mtd_info *mtd_table[];

struct mtd_blkcore_priv {
	struct task_struct *thread;
	struct request_queue *rq;
	spinlock_t queue_lock;
};

static int do_blktrans_request(struct mtd_blktrans_ops *tr,
			       struct mtd_blktrans_dev *dev,
			       struct request *req)
{
	unsigned long block, nsect;
	char *buf;

	block = req->sector << 9 >> tr->blkshift;
	nsect = req->current_nr_sectors << 9 >> tr->blkshift;

	buf = req->buffer;

	if (!blk_fs_request(req))
		return 0;

	if (req->sector + req->current_nr_sectors > get_capacity(req->rq_disk))
		return 0;

	switch(rq_data_dir(req)) {
	case READ:
		for (; nsect > 0; nsect--, block++, buf += tr->blksize)
			if (tr->readsect(dev, block, buf))
				return 0;
		return 1;

	case WRITE:
		if (!tr->writesect)
			return 0;

		for (; nsect > 0; nsect--, block++, buf += tr->blksize)
			if (tr->writesect(dev, block, buf))
				return 0;
		return 1;

	default:
		printk(KERN_NOTICE "Unknown request %u\n", rq_data_dir(req));
		return 0;
	}
}

static int mtd_blktrans_thread(void *arg)
{
	struct mtd_blktrans_ops *tr = arg;
	struct request_queue *rq = tr->blkcore_priv->rq;

	/* we might get involved when memory gets low, so use PF_MEMALLOC */
	current->flags |= PF_MEMALLOC | PF_NOFREEZE;

	spin_lock_irq(rq->queue_lock);
	while (!kthread_should_stop()) {
		struct request *req;
		struct mtd_blktrans_dev *dev;
		int res = 0;

		req = elv_next_request(rq);

		if (!req) {
			set_current_state(TASK_INTERRUPTIBLE);
			spin_unlock_irq(rq->queue_lock);
			schedule();
			spin_lock_irq(rq->queue_lock);
			continue;
		}

		dev = req->rq_disk->private_data;
		tr = dev->tr;

		spin_unlock_irq(rq->queue_lock);

		mutex_lock(&dev->lock);
		res = do_blktrans_request(tr, dev, req);
		mutex_unlock(&dev->lock);

		spin_lock_irq(rq->queue_lock);

		end_request(req, res);
	}
	spin_unlock_irq(rq->queue_lock);

	return 0;
}

static void mtd_blktrans_request(struct request_queue *rq)
{
	struct mtd_blktrans_ops *tr = rq->queuedata;
	wake_up_process(tr->blkcore_priv->thread);
}

static int blktrans_open(struct inode *i, struct file *f)
{
	struct mtd_blktrans_dev *dev;
	struct mtd_blktrans_ops *tr;
	int ret = -ENODEV;

	dev = i->i_bdev->bd_disk->private_data;
	tr = dev->tr;

	if (!try_module_get(dev->mtd->owner))
		goto out;

	if (!try_module_get(tr->owner))
		goto out_tr;

	/* FIXME: Locking. A hot pluggable device can go away
	   (del_mtd_device can be called for it) without its module
	   being unloaded. */
	dev->mtd->usecount++;

	ret = 0;
	if (tr->open && (ret = tr->open(dev))) {
		dev->mtd->usecount--;
		module_put(dev->mtd->owner);
	out_tr:
		module_put(tr->owner);
	}
 out:
	return ret;
}

static int blktrans_release(struct inode *i, struct file *f)
{
	struct mtd_blktrans_dev *dev;
	struct mtd_blktrans_ops *tr;
	int ret = 0;

	dev = i->i_bdev->bd_disk->private_data;
	tr = dev->tr;

	if (tr->release)
		ret = tr->release(dev);

	if (!ret) {
		dev->mtd->usecount--;
		module_put(dev->mtd->owner);
		module_put(tr->owner);
	}

	return ret;
}

static int blktrans_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
	struct mtd_blktrans_dev *dev = bdev->bd_disk->private_data;

	if (dev->tr->getgeo)
		return dev->tr->getgeo(dev, geo);
	return -ENOTTY;
}

static int blktrans_ioctl(struct inode *inode, struct file *file,
			      unsigned int cmd, unsigned long arg)
{
	struct mtd_blktrans_dev *dev = inode->i_bdev->bd_disk->private_data;
	struct mtd_blktrans_ops *tr = dev->tr;

	switch (cmd) {
	case BLKFLSBUF:
		if (tr->flush)
			return tr->flush(dev);
		/* The core code did the work, we had nothing to do. */
		return 0;
	default:
		return -ENOTTY;
	}
}

struct block_device_operations mtd_blktrans_ops = {
	.owner		= THIS_MODULE,
	.open		= blktrans_open,
	.release	= blktrans_release,
	.ioctl		= blktrans_ioctl,
	.getgeo		= blktrans_getgeo,
};

int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
{
	struct mtd_blktrans_ops *tr = new->tr;
	struct list_head *this;
	int last_devnum = -1;
	struct gendisk *gd;

	if (mutex_trylock(&mtd_table_mutex)) {
		mutex_unlock(&mtd_table_mutex);
		BUG();
	}

	list_for_each(this, &tr->devs) {
		struct mtd_blktrans_dev *d = list_entry(this, struct mtd_blktrans_dev, list);
		if (new->devnum == -1) {
			/* Use first free number */
			if (d->devnum != last_devnum+1) {
				/* Found a free devnum. Plug it in here */
				new->devnum = last_devnum+1;
				list_add_tail(&new->list, &d->list);
				goto added;
			}
		} else if (d->devnum == new->devnum) {
			/* Required number taken */
			return -EBUSY;
		} else if (d->devnum > new->devnum) {
			/* Required number was free */
			list_add_tail(&new->list, &d->list);
			goto added;
		}
		last_devnum = d->devnum;
	}
	if (new->devnum == -1)
		new->devnum = last_devnum+1;

	if ((new->devnum << tr->part_bits) > 256) {
		return -EBUSY;
	}

	mutex_init(&new->lock);
	list_add_tail(&new->list, &tr->devs);
 added:
	if (!tr->writesect)
		new->readonly = 1;

	gd = alloc_disk(1 << tr->part_bits);
	if (!gd) {
		list_del(&new->list);
		return -ENOMEM;
	}
	gd->major = tr->major;
	gd->first_minor = (new->devnum) << tr->part_bits;
	gd->fops = &mtd_blktrans_ops;

	if (tr->part_bits)
		if (new->devnum < 26)
			snprintf(gd->disk_name, sizeof(gd->disk_name),
				 "%s%c", tr->name, 'a' + new->devnum);
		else
			snprintf(gd->disk_name, sizeof(gd->disk_name),
				 "%s%c%c", tr->name,
				 'a' - 1 + new->devnum / 26,
				 'a' + new->devnum % 26);
	else
		snprintf(gd->disk_name, sizeof(gd->disk_name),
			 "%s%d", tr->name, new->devnum);

	/* 2.5 has capacity in units of 512 bytes while still
	   having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
	set_capacity(gd, (new->size * tr->blksize) >> 9);

	gd->private_data = new;
	new->blkcore_priv = gd;
	gd->queue = tr->blkcore_priv->rq;

	if (new->readonly)
		set_disk_ro(gd, 1);

	add_disk(gd);

	return 0;
}

int del_mtd_blktrans_dev(struct mtd_blktrans_dev *old)
{
	if (mutex_trylock(&mtd_table_mutex)) {
		mutex_unlock(&mtd_table_mutex);
		BUG();
	}

	list_del(&old->list);

	del_gendisk(old->blkcore_priv);
	put_disk(old->blkcore_priv);

	return 0;
}

static void blktrans_notify_remove(struct mtd_info *mtd)
{
	struct list_head *this, *this2, *next;

	list_for_each(this, &blktrans_majors) {
		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);

		list_for_each_safe(this2, next, &tr->devs) {
			struct mtd_blktrans_dev *dev = list_entry(this2, struct mtd_blktrans_dev, list);

			if (dev->mtd == mtd)
				tr->remove_dev(dev);
		}
	}
}

static void blktrans_notify_add(struct mtd_info *mtd)
{
	struct list_head *this;

	if (mtd->type == MTD_ABSENT)
		return;

	list_for_each(this, &blktrans_majors) {
		struct mtd_blktrans_ops *tr = list_entry(this, struct mtd_blktrans_ops, list);

		tr->add_mtd(tr, mtd);
	}

}

static struct mtd_notifier blktrans_notifier = {
	.add = blktrans_notify_add,
	.remove = blktrans_notify_remove,
};

int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
{
	int ret, i;

	/* Register the notifier if/when the first device type is
	   registered, to prevent the link/init ordering from fucking
	   us over. */
	if (!blktrans_notifier.list.next)
		register_mtd_user(&blktrans_notifier);

	tr->blkcore_priv = kzalloc(sizeof(*tr->blkcore_priv), GFP_KERNEL);
	if (!tr->blkcore_priv)
		return -ENOMEM;

	mutex_lock(&mtd_table_mutex);

	ret = register_blkdev(tr->major, tr->name);
	if (ret) {
		printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n",
		       tr->name, tr->major, ret);
		kfree(tr->blkcore_priv);
		mutex_unlock(&mtd_table_mutex);
		return ret;
	}
	spin_lock_init(&tr->blkcore_priv->queue_lock);

	tr->blkcore_priv->rq = blk_init_queue(mtd_blktrans_request, &tr->blkcore_priv->queue_lock);
	if (!tr->blkcore_priv->rq) {
		unregister_blkdev(tr->major, tr->name);
		kfree(tr->blkcore_priv);
		mutex_unlock(&mtd_table_mutex);
		return -ENOMEM;
	}

	tr->blkcore_priv->rq->queuedata = tr;
	blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
	tr->blkshift = ffs(tr->blksize) - 1;

	tr->blkcore_priv->thread = kthread_run(mtd_blktrans_thread, tr,
			"%sd", tr->name);
	if (IS_ERR(tr->blkcore_priv->thread)) {
		blk_cleanup_queue(tr->blkcore_priv->rq);
		unregister_blkdev(tr->major, tr->name);
		kfree(tr->blkcore_priv);
		mutex_unlock(&mtd_table_mutex);
		return PTR_ERR(tr->blkcore_priv->thread);
	}

	INIT_LIST_HEAD(&tr->devs);
	list_add(&tr->list, &blktrans_majors);

	for (i=0; i<MAX_MTD_DEVICES; i++) {
		if (mtd_table[i] && mtd_table[i]->type != MTD_ABSENT)
			tr->add_mtd(tr, mtd_table[i]);
	}

	mutex_unlock(&mtd_table_mutex);

	return 0;
}

int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
{
	struct list_head *this, *next;

	mutex_lock(&mtd_table_mutex);

	/* Clean up the kernel thread */
	kthread_stop(tr->blkcore_priv->thread);

	/* Remove it from the list of active majors */
	list_del(&tr->list);

	list_for_each_safe(this, next, &tr->devs) {
		struct mtd_blktrans_dev *dev = list_entry(this, struct mtd_blktrans_dev, list);
		tr->remove_dev(dev);
	}

	blk_cleanup_queue(tr->blkcore_priv->rq);
	unregister_blkdev(tr->major, tr->name);

	mutex_unlock(&mtd_table_mutex);

	kfree(tr->blkcore_priv);

	BUG_ON(!list_empty(&tr->devs));
	return 0;
}

static void __exit mtd_blktrans_exit(void)
{
	/* No race here -- if someone's currently in register_mtd_blktrans
	   we're screwed anyway. */
	if (blktrans_notifier.list.next)
		unregister_mtd_user(&blktrans_notifier);
}

module_exit(mtd_blktrans_exit);

EXPORT_SYMBOL_GPL(register_mtd_blktrans);
EXPORT_SYMBOL_GPL(deregister_mtd_blktrans);
EXPORT_SYMBOL_GPL(add_mtd_blktrans_dev);
EXPORT_SYMBOL_GPL(del_mtd_blktrans_dev);

MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Common interface to block layer for MTD 'translation layers'");


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | Billing Information | [optional]
**gatewayProcessor** | **string** |  | [optional]
**currencyCode** | **string** |  | [optional]
**cardNumber** | **string** |  | [optional]
**cardType** | **string** |  | [optional]
**expiry** | **string** |  | [optional]
**payerId** | **string** |  | [optional]
**gatewayReference** | **string** |  | [optional]
**billingAddressName** | **string** |  | [optional]
**billingAddressAddress** | **string** |  | [optional]
**billingAddressAddress2** | **string** |  | [optional]
**billingAddressCity** | **string** |  | [optional]
**billingAddressPostalCode** | **string** |  | [optional]
**billingAddressCountryCode** | **string** |  | [optional]
**billingAddressRegionCode** | **string** |  | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


text:
Collidable::~Collidable() { }
Collidable::Collidable() { }
Collidable::Collidable(int x, int y, int width, int height) {
	cX = x;
	cY = y;
	cWidth = width;
	cHeight = height;
}

bool Collidable::willCollide(Collidable *other, int _dx, int _dy) {
	if (other == nullptr) return false;
	int otherLeft = other->cX - _dx;						// Left line of rectangle
	int otherRight = other->cX + other->cWidth + _dx;		// Right line of rectangle
	int otherTop = other->cY - _dy;							// Top line of rectangle
	int otherBottom = other->cY + +other->cHeight + _dx;	// Bottom line of rectangle

	return !((cY > otherBottom) || (cX > otherRight) || (cY + cHeight < otherTop) || (cX + cWidth < otherLeft));
}

bool Collidable::insideCollidable(Collidable *other) {
	if (other == nullptr) return false;
	int otherLeft = other->cX;						// Left line of rectangle
	int otherRight = other->cX + other->cWidth;		// Right line of rectangle
	int otherTop = other->cY;						// Top line of rectangle
	int otherBottom = other->cY + +other->cHeight;	// Bottom line of rectangle

	return !((cY > otherBottom) || (cX > otherRight) || (cY + cHeight < otherTop) || (cX + cWidth < otherLeft));
}

Vector2f Collidable::getStaticOverlap(Collidable *other) {
	if (other == nullptr) return Vector2f(0.f, 0.f);
	int _x = 0, _y = 0;
	int otherLeft = other->cX - 1;						// Left line of rectangle
	int otherRight = other->cX + other->cWidth + 1;		// Right line of rectangle
	int otherTop = other->cY - 1;						// Top line of rectangle
	int otherBottom = other->cY + +other->cHeight + 1;	// Bottom line of rectangle

	Vector2f center = Vector2f((cX + cWidth / 2)*1.f, (cY + cHeight / 2)*1.f);
	Vector2f otherCenter = Vector2f((other->cX + other->cWidth / 2)*1.f, (other->cY + other->cHeight / 2)*1.f);
	Vector2f diff = center - otherCenter;

	float xOverlap = cWidth / 2 + other->cWidth / 2 - abs(diff.x);
	float yOverlap = cHeight / 2 + other->cHeight / 2 - abs(diff.y);

	if (xOverlap < 0 || yOverlap < 0) // No overlap. Collidables do not touch.
		return Vector2f(0.f, 0.f);

	if (xOverlap < yOverlap) {
		if (diff.x > 0) _x -= cX - otherRight;
		else _x -= cX + cWidth - otherLeft;
	}
	else {
		if (diff.y > 0) _y -= cY - otherBottom;
		else _y -= cY + cHeight - otherTop;
	}

	return Vector2f(_x*1.f, _y*1.f);
}

bool Collidable::intersectsLine(std::pair<Vector2f, Vector2f> line) {
	return lineIntersectsRect(float(cX), float(cY), float(cWidth), float(cHeight), line);
}


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

import java.awt.Color;
import java.awt.Component;
import java.util.List;

import javax.swing.JComponent;
import javax.swing.JTable;

import docking.widgets.table.*;
import generic.theme.GColor;
import generic.theme.GThemeDefaults.Colors.Palette;
import ghidra.docking.settings.Settings;
import ghidra.framework.plugintool.ServiceProvider;
import ghidra.framework.plugintool.ServiceProviderStub;
import ghidra.util.table.column.AbstractGColumnRenderer;
import ghidra.util.table.column.GColumnRenderer;

/**
 * Table model for analyzer enablement state.
 */
public class AnalysisEnablementTableModel
		extends GDynamicColumnTableModel<AnalyzerEnablementState, Object> {

	private static Color FG_COLOR_PROTOTYPE = new GColor("color.fg.analysis.options.prototype");

	private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT =
		new GColor("color.bg.analysis.options.not.default.enablement");
	private static Color BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED =
		new GColor("color.bg.analysis.options.not.default.enablement.selected");

	private List<AnalyzerEnablementState> analyzerStates;
	private AnalysisPanel panel;

	public AnalysisEnablementTableModel(AnalysisPanel panel,
			List<AnalyzerEnablementState> analyzerStates) {
		super(new ServiceProviderStub());
		this.panel = panel;
		this.analyzerStates = analyzerStates;
		setDefaultTableSortState(TableSortState.createUnsortedSortState());
	}

	public void setData(List<AnalyzerEnablementState> analyzerStates) {
		this.analyzerStates = analyzerStates;
		fireTableDataChanged();
	}

	@Override
	public String getName() {
		return "Analysis Enablement";
	}

	@Override
	public List<AnalyzerEnablementState> getModelData() {
		return analyzerStates;
	}

	@Override
	protected TableColumnDescriptor<AnalyzerEnablementState> createTableColumnDescriptor() {
		TableColumnDescriptor<AnalyzerEnablementState> descriptor = new TableColumnDescriptor<>();

		descriptor.addVisibleColumn(new AnalyzerEnabledColumn());
		descriptor.addVisibleColumn(new AnalyzerNameColumn());

		return descriptor;
	}

	@Override
	public Object getDataSource() {
		return null;
	}

	@Override
	public boolean isCellEditable(int rowIndex, int columnIndex) {
		return columnIndex == 0;
	}

	@Override
	public void setValueAt(Object value, int rowIndex, int columnIndex) {
		if (columnIndex == AnalysisPanel.COLUMN_ANALYZER_IS_ENABLED) {
			Boolean enabled = (Boolean) value;
			analyzerStates.get(rowIndex).setEnabled(enabled);
			String analyzerName = analyzerStates.get(rowIndex).getName();
			panel.setAnalyzerEnabled(analyzerName, enabled, true);
			fireTableRowsUpdated(rowIndex, rowIndex);
		}
	}

	@Override
	public boolean isSortable(int columnIndex) {
		return false;
	}

	private void setToolTip(Component c, String text) {
		if (c instanceof JComponent) {
			((JComponent) c).setToolTipText(text);
		}
	}

//==================================================================================================
// Inner Classes
//==================================================================================================

	private class AnalyzerEnabledColumn
			extends AbstractDynamicTableColumn<AnalyzerEnablementState, Boolean, Object> {
		EnabledColumnTableCellRenderer renderer = new EnabledColumnTableCellRenderer();

		@Override
		public String getColumnName() {
			return "Enabled";
		}

		@Override
		public Boolean getValue(AnalyzerEnablementState state, Settings settings, Object data,
				ServiceProvider provider) throws IllegalArgumentException {
			return state.isEnabled();
		}

		@Override
		public GColumnRenderer<Boolean> getColumnRenderer() {
			return renderer;
		}
	}

	private class AnalyzerNameColumn
			extends AbstractDynamicTableColumn<AnalyzerEnablementState, String, Object> {
		AnalyzerNameTableCellRenderer renderer = new AnalyzerNameTableCellRenderer();

		@Override
		public String getColumnName() {
			return "Analyzer";
		}

		@Override
		public String getValue(AnalyzerEnablementState state, Settings settings, Object data,
				ServiceProvider provider) throws IllegalArgumentException {
			String value = state.getName();
			if (state.isPrototype()) {
				value += " (Prototype)";
			}
			return value;
		}

		@Override
		public GColumnRenderer<String> getColumnRenderer() {
			return renderer;
		}
	}

	private class EnabledColumnTableCellRenderer implements GColumnRenderer<Boolean> {
		GBooleanCellRenderer booleanRenderer = new GBooleanCellRenderer();

		@Override
		public Component getTableCellRendererComponent(JTable table, Object value,
				boolean isSelected, boolean hasFocus, int row, int column) {
			Component component = booleanRenderer.getTableCellRendererComponent(table, value,
				isSelected, hasFocus, row, column);

			AnalyzerEnablementState state = getRowObject(row);
			if (state.isDefaultEnablement()) {
				setToolTip(component, null);
				return component;
			}

			// not the default enablement
			if (isSelected) {
				component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED);
			}
			else {
				component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT);
			}

			setToolTip(component, "This option differs from the default");

			return component;
		}

		@Override
		public String getFilterString(Boolean t, Settings settings) {
			return "";
		}
	}

	private class AnalyzerNameTableCellRenderer extends AbstractGColumnRenderer<String> {

		@Override
		public Component getTableCellRendererComponent(GTableCellRenderingData data) {
			Component component = super.getTableCellRendererComponent(data);
			Object value = data.getValue();

			if (value == null) {
				return component;
			}

			String analyzerName = (String) value;
			if (analyzerName.endsWith(AnalysisPanel.PROTOTYPE)) {
				if (!data.isSelected()) {
					component.setForeground(FG_COLOR_PROTOTYPE);
				}
			}

			AnalyzerEnablementState state = (AnalyzerEnablementState) data.getRowObject();
			if (state.isDefaultEnablement()) {
				setToolTip(component, null);
				return component;
			}

			// not the default enablement
			component.setForeground(Palette.BLACK);
			if (data.isSelected()) {
				component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT_SELECTED);
			}
			else {
				component.setBackground(BG_COLOR_NOT_DEFAULT_ENABLEMENT);
			}

			setToolTip(component, "This option differs from the default");
			return component;
		}

		@Override
		public String getFilterString(String value, Settings settings) {
			return value;
		}
	}

}


text:
package com.humorousz.commonutils.log;

import android.util.Log;

/**
 * Created by zzq on 17-4-20.
 */

public class Logger{

    public static void d(String tag,String msg){
        Log.d(tag,msg);

    }
    public static void i(String tag,String msg){
        Log.i(tag,msg);
    }
    public static void e(String tag,String msg){
        Log.e(tag,msg);
    }
    public static void d(String tag,Object msg){
        d(tag,String.valueOf(msg));
    }

}


text:
id: Accordion
section: components
---

import { Checkbox, List, ListItem } from '@patternfly/react-core';

## Accessibility

To implement an accessible PatternFly **accordion**:

- Give each accordion toggle a unique and descriptive label.

For the PatternFly React library:

- Include the `isExpanded` prop on the accordion toggle based on the toggle's state.

For the HTML/CSS library:

- Include the `aria-expanded` attribute on the accordion toggle based on the toggle's state.

## Testing

At a minimum, an accordion should meet the following criteria:

<List isPlain>
  <ListItem>
    <Checkbox id="accordion-a11y-checkbox-1" label="Each accordion toggle includes unique and descriptive labels." description="This ensures that users can more quickly scan through the accordion contents without having to expand individual panels." />
  </ListItem>
  <ListItem>
    <Checkbox id="accordion-a11y-checkbox-2" label="Standard keyboard navigation can be used to navigate between accordion toggles or other focusable elements." description={Tab navigates to the next accordion toggle or focusable element, and Shift + Tab navigates to the previous accordion toggle or focusable element.} />
  </ListItem>
  <ListItem>
    <Checkbox id="accordion-a11y-checkbox-3" label={Accordion toggles can be collapsed or expanded via keyboard by pressing Space or Enter.} />
  </ListItem>
  <ListItem>
    <Checkbox id="accordion-a11y-checkbox-4" label="If headings are used in an accordion toggle, heading levels are not skipped within the context surrounding the accordion." />
  </ListItem>
  <ListItem>
    <Checkbox id="accordion-a11y-checkbox-5" label="A user navigating via a screen reader will be notified of the current accordion toggle state, as well as when that state gets updated." description={This can be checked with a screen reader, or by checking that the aria-expanded attribute is accurate and updating in the DOM.} />
  </ListItem>
</List>

## React customization

The following React props have been provided for more fine-tuned control over accessibility.

| Prop | Applied to | Reason |
|---|---|---|
| `aria-label="[text describing the accordion component]"` | `Accordion` | Adds an accessible name to the accordion for screen readers. If there is no other surrounding context provided for an accordion, especially if there are multiple accordions on a page, this should be passed in with descriptive text. |
| `headingLevel="[a heading tag]"` | `Accordion` | When `asDefinitionList={false}` is passed in, sets the container for the accordion toggle to one of the six heading elements (`h3` by default). Be sure to not skip heading levels when passing this prop in. For example, if an accordion is within a page section that has an `h2` heading, you should not pass `headingLevel="h4"`. |
| `aria-label="[text describing the accordion content]"` | `AccordionContent` | Adds an accessible name to the content of an accordion item. |
| `isHidden` | `AccordionContent` | Determines whether the content of the accordion item is hidden or not. Should be used along with the `isExpanded` prop on the accordion toggle. |
| `isExpanded` | `AccordionToggle` | Adds styling to visually determine whether the toggle is expanded or collapsed. Also sets the accessibility attribute `aria-expanded` with a value of "true" or "false", which notifies screen readers whether the accordion toggle is expanded ("true") or collapsed ("false"). Should be used along with the `isHidden` prop on the accordion content. |

### isHidden and isExpanded

The `isHidden` and `isExpanded` props should always have opposite values of one another; if an accordion toggle is collapsed (`isExpanded={false}`), then the accordion content should be hidden (`isHidden={true}`). For example:

```noLive
const [expandedItem, setExpandedItem] = React.useState('accordion-item-1');

<Accordion>
  <AccordionItem>
    <AccordionToggle
      isExpanded={expanded === 'accordion-item-1'}
    >
      Toggle text...
    </AccordionToggle>
    <AccordionContent isHidden={expanded !== 'accordion-item-1'}>
      Content text...
    </AccordionContent>
  </AccordionItem>
</Accordion>
```

### Aria-label

Passing in the `aria-label` prop to the accordion component can be helpful when there are multiple accordions on a page, or when there is no other surrounding context:

```noLive
<Accordion aria-label="Billing questions">
  ...
</Accordion>

<Accordion aria-label="Return and refund questions">
  ...
</Accordion>
```

## HTML/CSS customization

The following HTML attributes and PatternFly classes can be used for more fine-tuned control over accessibility.

| Attribute or class | Applied to | Reason |
|---|---|---|
| `aria-label="[text describing the accordion component]"` | `.pf-c-accordion` | Adds an accessible name to the accordion for screen readers. If there is no other surrounding context provided for an accordion, especially if there are multiple accordions on a page, this should be passed in with descriptive text.

 See the [aria-label prop example](#aria-label) in the React customization section. |
| `aria-expanded="[true or false]"` | `.pf-c-accordion__toggle` | Indicates whether the accordion toggle is expanded (true) or collapsed (false) to assistive technologies. **Required**. |
| `aria-label="[text describing the accordion content]"` | `.pf-c-accordion__expanded-content` | Adds an accessible name to the content of an accordion item. |
| `hidden` | `.pf-c-accordion__expanded-content` | Hides the accordion content. **Required** when `aria-expanded="false"` is passed in. |
| `aria-hidden="true"` | `.pf-c-accordion__toggle-icon` | Removes the accordion toggle icon from the accessibility tree, preventing assistive technologies from potentially announcing duplicate or unnecessary information without visually hiding it. **Required**. |

## Additional considerations

Consumers must ensure they take any additional considerations when customizing an accordion, using it in a way not described or recommended by PatternFly, or in various other specific use-cases not outlined elsewhere on this page.

- Avoid adding complex interaction to the accordion. This can often cause loops or traps that prevent users from efficiently navigating the content when using a keyboard.

## Further reading

To read more about accessibility with accordions, refer to the following resources:

- [ARIA Authoring Practices Guide - Accordion](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/)


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
<test_definition>
  <suite name="Embedding-asyncapi-android-tests" category="Android embedding APIs">
    <set name="EmbeddingApiAsyncTest" type="androidunit" location="device">
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.XWalkSettingTestAsync" purpose="Check if the methods of XWalkSetting interface can be executed correctly." subcase="7">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.XWalkSettingTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.XWalkViewTestAsync" purpose="Check if the methods of XWalkView interface can be executed correctly." subcase="11">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.XWalkViewTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.XWalkUIClientTestAsync" purpose="Check if the methods of XWalkView interface can be executed correctly." subcase="3">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.XWalkUIClientTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.XWalkResourceClientTestAsync" purpose="Check if the methods of XWalkView interface can be executed correctly." subcase="3">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.XWalkResourceClientTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.ClearSslPreferenceTestAsync" purpose="Check if the methods of ClearSslPreferenceTestAsync can be executed correctly." subcase="1">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.ClearSslPreferenceTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.XWalkPreferenceTestAsync" purpose="Check if the methods of XWalkPreferenceTestAsync can be executed correctly." subcase="3">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.XWalkPreferenceTestAsync</test_script_entry>
        </description>
      </testcase>
      <testcase component="Crosswalk APIs/Embedding API" execution_type="auto" id="v6.ShouldInterceptLoadRequestTestAsync" purpose="Check if the methods of ShouldInterceptLoadRequestTestAsync can be executed correctly." subcase="22">
        <description>
          <test_script_entry>org.xwalk.embedding.asynctest.v6.ShouldInterceptLoadRequestTestAsync</test_script_entry>
        </description>
      </testcase>
    </set>
  </suite>
</test_definition>


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sixeyed.Caching.Extensions;
using System.Threading;
using Sixeyed.Caching;
using Sixeyed.Caching.Tests.Stubs;
using Sixeyed.Caching.AOP;

namespace Sixeyed.Caching.Tests.Caching
{
    [TestClass]
    public class MemoryCacheTests
    {
        [TestMethod]
        [ExpectedException(typeof(CacheKeyNotFoundException))]
        public void Get_CacheKeyNotFoundException()
        {
            var key = Guid.NewGuid().ToString();
            Cache.Memory.Get<StubRequest>(key);
        }

        [TestMethod]
        [ExpectedException(typeof(CacheValueCastException))]
        public void Get_Null_CacheValueCastException()
        {
            var key = Guid.NewGuid().ToString();
            int? value = null;
            Cache.Memory.Set(key, value);
            var retrievedValue = Cache.Memory.Get<int>(key);
        }

        [TestMethod]
        public void Set()
        {
            var key = Guid.NewGuid().ToString();
            var value = StubRequest.GetRequest();
            Cache.Memory.Set(key, value);
            Assert.IsTrue(Cache.Memory.Exists(key));
            var retrievedValue = Cache.Memory.Get<StubRequest>(key);
            Assert.AreEqual(value.CreatedOn, retrievedValue.CreatedOn);
            Assert.AreEqual(value.Id, retrievedValue.Id);
            Assert.AreEqual(value.Name, retrievedValue.Name);
        }

        [TestMethod]
        public void Set_Null()
        {
            var key = Guid.NewGuid().ToString();
            StubRequest value = null;
            Assert.IsFalse(Cache.Memory.Exists(key));
            Cache.Memory.Set(key, value);
            Assert.IsTrue(Cache.Memory.Exists(key));
            var retrievedValue = Cache.Memory.Get<StubRequest>(key);
            Assert.IsNull(retrievedValue);
        }

        [TestMethod]
        public void Set_WithAbsoluteExpiry()
        {
            var key = Guid.NewGuid().ToString();
            var value = StubRequest.GetRequest();
            var expiresAt = DateTime.Now.AddMilliseconds(250);
            Cache.Memory.Set(key, value, expiresAt);
            Assert.IsTrue(Cache.Memory.Exists(key));
            Thread.Sleep(500);
            Assert.IsFalse(Cache.Memory.Exists(key));
        }

        // * Sliding expiration doesn't work until .NET 4.5:
        // * http://connect.microsoft.com/VisualStudio/feedback/details/644778/slidingexpiration-does-not-seem-to-work-on-memorycache             *
        [Ignore]
        [TestMethod]
        public void Set_WithSlidingExpiry()
        {
            var key = Guid.NewGuid().ToString();
            var value = StubRequest.GetRequest();
            var lifespan = new TimeSpan(0, 0, 0, 0, 250);
            Cache.Memory.Set(key, value, lifespan);
            Assert.IsTrue(Cache.Memory.Exists(key));
            Thread.Sleep(200);
            var retrieved = Cache.Memory.Get<StubRequest>(key);
            Assert.IsNotNull(retrieved);

            Thread.Sleep(200);
            retrieved = Cache.Memory.Get<StubRequest>(key);
            Assert.IsNotNull(retrieved);

            Thread.Sleep(500);
            Assert.IsFalse(Cache.Memory.Exists(key));
        }

        [TestMethod]
        public void Set_ThenRemove()
        {
            var key = Guid.NewGuid().ToString();
            var value = StubRequest.GetRequest();
            Cache.Memory.Set(key, value);
            Assert.IsTrue(Cache.Memory.Exists(key));
            Cache.Memory.Remove(key);
            Assert.IsFalse(Cache.Memory.Exists(key));
        }
    }
}


text:
using Digirati.IIIF.Model;
using System.Collections.Generic;

namespace Digirati.IIIF.Serialisation
{
    public class ServiceEqualityComparer : IEqualityComparer<IService>
    {
        public bool Equals(IService s1, IService s2)
        {
            return s1.Id == s2.Id;
        }

        public int GetHashCode(IService s)
        {
            return s.Id.GetHashCode();
        }

    }
}


text:
package com.slidingmenu.example;

import android.os.Bundle;

public class SlidingContent extends BaseActivity {

	public SlidingContent() {
		super(R.string.title_bar_content);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// set the Above View
		setContentView(R.layout.content_frame);
		getSupportFragmentManager()
		.beginTransaction()
		.replace(R.id.content_frame, new SampleListFragment())
		.commit();

		setSlidingActionBarEnabled(false);
	}

}


text:
package plugin

import (
	"github.com/urfave/cli/v2"
)

// Options are used as part of a new plugin
type Options struct {
	Name     string
	Flags    []cli.Flag
	Commands []*cli.Command
	Handlers []Handler
	Init     func(*cli.Context) error
}

type Option func(o *Options)

// WithFlag adds flags to a plugin
func WithFlag(flag ...cli.Flag) Option {
	return func(o *Options) {
		o.Flags = append(o.Flags, flag...)
	}
}

// WithCommand adds commands to a plugin
func WithCommand(cmd ...*cli.Command) Option {
	return func(o *Options) {
		o.Commands = append(o.Commands, cmd...)
	}
}

// WithHandler adds middleware handlers to
func WithHandler(h ...Handler) Option {
	return func(o *Options) {
		o.Handlers = append(o.Handlers, h...)
	}
}

// WithName defines the name of the plugin
func WithName(n string) Option {
	return func(o *Options) {
		o.Name = n
	}
}

// WithInit sets the init function
func WithInit(fn func(*cli.Context) error) Option {
	return func(o *Options) {
		o.Init = fn
	}
}


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

package com.github.sakserv.minicluster.impl;

import com.github.sakserv.minicluster.auth.Jaas;
import com.github.sakserv.minicluster.config.ConfigVars;
import com.github.sakserv.minicluster.util.FileUtils;
import com.github.sakserv.propertyparser.PropertyParser;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.fail;

public class KdcLocalClusterZookeeperIntegrationTest {

    // Logger
    private static final Logger LOG = LoggerFactory.getLogger(KdcLocalClusterZookeeperIntegrationTest.class);

    // Setup the property parser
    private static PropertyParser propertyParser;

    static {
        try {
            propertyParser = new PropertyParser(ConfigVars.DEFAULT_PROPS_FILE);
            propertyParser.parsePropsFile();
        } catch (IOException e) {
            LOG.error("Unable to load property file: {}", propertyParser.getProperty(ConfigVars.DEFAULT_PROPS_FILE));
        }
    }

    private static KdcLocalCluster kdcLocalCluster;
    private static ZookeeperLocalCluster zookeeperLocalCluster;

    @BeforeClass
    public static void setUp() throws Exception {

        //System.setProperty("sun.security.krb5.debug", "true");

        // Force clean
        FileUtils.deleteFolder(propertyParser.getProperty(ConfigVars.ZOOKEEPER_TEMP_DIR_KEY));

        // KDC
        kdcLocalCluster = new KdcLocalCluster.Builder()
                .setPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.KDC_PORT_KEY)))
                .setHost(propertyParser.getProperty(ConfigVars.KDC_HOST_KEY))
                .setBaseDir(propertyParser.getProperty(ConfigVars.KDC_BASEDIR_KEY))
                .setOrgDomain(propertyParser.getProperty(ConfigVars.KDC_ORG_DOMAIN_KEY))
                .setOrgName(propertyParser.getProperty(ConfigVars.KDC_ORG_NAME_KEY))
                .setPrincipals(propertyParser.getProperty(ConfigVars.KDC_PRINCIPALS_KEY).split(","))
                .setKrbInstance(propertyParser.getProperty(ConfigVars.KDC_KRBINSTANCE_KEY))
                .setInstance(propertyParser.getProperty(ConfigVars.KDC_INSTANCE_KEY))
                .setTransport(propertyParser.getProperty(ConfigVars.KDC_TRANSPORT))
                .setMaxTicketLifetime(Integer.parseInt(propertyParser.getProperty(ConfigVars.KDC_MAX_TICKET_LIFETIME_KEY)))
                .setMaxRenewableLifetime(Integer.parseInt(propertyParser.getProperty(ConfigVars.KDC_MAX_RENEWABLE_LIFETIME)))
                .setDebug(Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.KDC_DEBUG)))
                .build();
        kdcLocalCluster.start();

        // Zookeeper
        Jaas jaas = new Jaas()
                .addServiceEntry("Server", kdcLocalCluster.getKrbPrincipal("zookeeper"), kdcLocalCluster.getKeytabForPrincipal("zookeeper"), "zookeeper");
        javax.security.auth.login.Configuration.setConfiguration(jaas);

        Map<String, Object> properties = new HashMap<>();
        properties.put("authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider");
        properties.put("requireClientAuthScheme", "sasl");
        properties.put("sasl.serverconfig", "Server");
        properties.put("kerberos.removeHostFromPrincipal", "true");
        properties.put("kerberos.removeRealmFromPrincipal", "true");

        zookeeperLocalCluster = new ZookeeperLocalCluster.Builder()
                .setPort(Integer.parseInt(propertyParser.getProperty(ConfigVars.ZOOKEEPER_PORT_KEY)))
                .setTempDir(propertyParser.getProperty(ConfigVars.ZOOKEEPER_TEMP_DIR_KEY))
                .setZookeeperConnectionString(propertyParser.getProperty(ConfigVars.ZOOKEEPER_CONNECTION_STRING_KEY))
                .setCustomProperties(properties)
                .build();
        zookeeperLocalCluster.start();
    }

    @AfterClass
    public static void tearDown() throws Exception {
        zookeeperLocalCluster.stop();
        kdcLocalCluster.stop();
    }

    @Test
    public void testZookeeper() throws Exception {

        try (CuratorFramework client = CuratorFrameworkFactory.newClient(zookeeperLocalCluster.getZookeeperConnectionString(),
                new ExponentialBackoffRetry(1000, 3))) {
            client.start();
            client.getChildren().forPath("/");
            fail();
        } catch (KeeperException.AuthFailedException e) {
            LOG.debug("Not authenticated!");
        }

        System.setProperty("zookeeper.sasl.client", "true");
        System.setProperty("zookeeper.sasl.clientconfig", "Client");
        javax.security.auth.login.Configuration.setConfiguration(new Jaas()
                .addEntry("Client", kdcLocalCluster.getKrbPrincipalWithRealm("guest"), kdcLocalCluster.getKeytabForPrincipal("guest")));

        try (CuratorFramework client = CuratorFrameworkFactory.newClient(zookeeperLocalCluster.getZookeeperConnectionString(),
                new ExponentialBackoffRetry(1000, 3))) {
            client.start();
            client.getChildren().forPath("/").forEach(LOG::debug);

            List<ACL> perms = new ArrayList<>();
            perms.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.AUTH_IDS));
            perms.add(new ACL(ZooDefs.Perms.READ, ZooDefs.Ids.ANYONE_ID_UNSAFE));

            client.create().withMode(CreateMode.PERSISTENT).withACL(perms).forPath(propertyParser.getProperty(ConfigVars.HBASE_ZNODE_PARENT_KEY));
        }
    }
}


text: """Tests for the API."""