text:
package org.pentaho.di.trans.steps.gpbulkloader;

import java.util.List;

import org.pentaho.di.core.CheckResult;
import org.pentaho.di.core.CheckResultInterface;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.ProvidesDatabaseConnectionInformation;
import org.pentaho.di.core.SQLStatement;
import org.pentaho.di.core.database.Database;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.core.exception.KettleXMLException;
import org.pentaho.di.core.row.RowMeta;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.di.core.xml.XMLHandler;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.shared.SharedObjectInterface;
import org.pentaho.di.trans.DatabaseImpact;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStepMeta;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import org.pentaho.metastore.api.IMetaStore;
import org.w3c.dom.Node;

/**
 * Created on 20-feb-2007
 *
 * @author Sven Boden
 */
public class GPBulkLoaderMeta extends BaseStepMeta implements StepMetaInterface,
  ProvidesDatabaseConnectionInformation {
  private static Class<?> PKG = GPBulkLoaderMeta.class; // for i18n purposes, needed by Translator2!!

  /** what's the schema for the target? */
  private String schemaName;

  /** what's the table for the target? */
  private String tableName;

  /** Path to the PsqlPath utility */
  private String PsqlPath;

  /** Path to the control file */
  private String controlFile;

  /** Path to the data file */
  private String dataFile;

  /** Path to the log file */
  private String logFile;

  /** database connection */
  private DatabaseMeta databaseMeta;

  /** Field value to dateMask after lookup */
  private String[] fieldTable;

  /** Field name in the stream */
  private String[] fieldStream;

  /** boolean indicating if field needs to be updated */
  private String[] dateMask;

  /** maximum errors */
  private int maxErrors;

  /** Load method */
  private String loadMethod;

  /** Load action */
  private String loadAction;

  /** Encoding to use */
  private String encoding;

  /** Erase files after use */
  private boolean eraseFiles;

  /** Database name override */
  private String dbNameOverride;

  /*
   * Do not translate following values!!! They are will end up in the job export.
   */
  public static final String ACTION_APPEND = "APPEND";
  public static final String ACTION_INSERT = "INSERT";
  public static final String ACTION_REPLACE = "REPLACE";
  public static final String ACTION_TRUNCATE = "TRUNCATE";

  /*
   * Do not translate following values!!! They are will end up in the job export.
   */
  // final static public String METHOD_AUTO_CONCURRENT = "AUTO_CONCURRENT";
  public static final String METHOD_AUTO_END = "AUTO_END";
  public static final String METHOD_MANUAL = "MANUAL";

  /*
   * Do not translate following values!!! They are will end up in the job export.
   */
  public static final String DATE_MASK_DATE = "DATE";
  public static final String DATE_MASK_DATETIME = "DATETIME";

  public GPBulkLoaderMeta() {
    super();
  }

  /**
   * @return Returns the database.
   */
  public DatabaseMeta getDatabaseMeta() {
    return databaseMeta;
  }

  /**
   * @param database
   *          The database to set.
   */
  public void setDatabaseMeta( DatabaseMeta database ) {
    this.databaseMeta = database;
  }

  /**
   * @return Returns the tableName.
   */
  public String getTableName() {
    return tableName;
  }

  /**
   * @param tableName
   *          The tableName to set.
   */
  public void setTableName( String tableName ) {
    this.tableName = tableName;
  }

  public String getPsqlpath() {
    return PsqlPath;
  }

  public void setPsqlpath( String PsqlPath ) {
    this.PsqlPath = PsqlPath;
  }

  /**
   * @return Returns the fieldTable.
   */
  public String[] getFieldTable() {
    return fieldTable;
  }

  /**
   * @param fieldTable
   *          The fieldTable to set.
   */
  public void setFieldTable( String[] fieldTable ) {
    this.fieldTable = fieldTable;
  }

  /**
   * @return Returns the fieldStream.
   */
  public String[] getFieldStream() {
    return fieldStream;
  }

  /**
   * @param fieldStream
   *          The fieldStream to set.
   */
  public void setFieldStream( String[] fieldStream ) {
    this.fieldStream = fieldStream;
  }

  public String[] getDateMask() {
    return dateMask;
  }

  public void setDateMask( String[] dateMask ) {
    this.dateMask = dateMask;
  }

  public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {
    readData( stepnode, databases );
  }

  public void allocate( int nrvalues ) {
    fieldTable = new String[nrvalues];
    fieldStream = new String[nrvalues];
    dateMask = new String[nrvalues];
  }

  public Object clone() {
    GPBulkLoaderMeta retval = (GPBulkLoaderMeta) super.clone();
    int nrvalues = fieldTable.length;

    retval.allocate( nrvalues );

    for ( int i = 0; i < nrvalues; i++ ) {
      retval.fieldTable[i] = fieldTable[i];
      retval.fieldStream[i] = fieldStream[i];
      retval.dateMask[i] = dateMask[i];
    }
    return retval;
  }

  private void readData( Node stepnode, List<? extends SharedObjectInterface> databases ) throws KettleXMLException {
    try {
      String con = XMLHandler.getTagValue( stepnode, "connection" );
      databaseMeta = DatabaseMeta.findDatabase( databases, con );

      String serror = XMLHandler.getTagValue( stepnode, "errors" );
      maxErrors = Const.toInt( serror, 50 ); // default to 50.

      schemaName = XMLHandler.getTagValue( stepnode, "schema" );
      tableName = XMLHandler.getTagValue( stepnode, "table" );

      loadMethod = XMLHandler.getTagValue( stepnode, "load_method" );
      loadAction = XMLHandler.getTagValue( stepnode, "load_action" );
      PsqlPath = XMLHandler.getTagValue( stepnode, "PsqlPath" );
      controlFile = XMLHandler.getTagValue( stepnode, "control_file" );
      dataFile = XMLHandler.getTagValue( stepnode, "data_file" );
      logFile = XMLHandler.getTagValue( stepnode, "log_file" );
      eraseFiles = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "erase_files" ) );
      encoding = XMLHandler.getTagValue( stepnode, "encoding" );
      dbNameOverride = XMLHandler.getTagValue( stepnode, "dbname_override" );

      int nrvalues = XMLHandler.countNodes( stepnode, "mapping" );
      allocate( nrvalues );

      for ( int i = 0; i < nrvalues; i++ ) {
        Node vnode = XMLHandler.getSubNodeByNr( stepnode, "mapping", i );

        fieldTable[i] = XMLHandler.getTagValue( vnode, "stream_name" );
        fieldStream[i] = XMLHandler.getTagValue( vnode, "field_name" );
        if ( fieldStream[i] == null ) {
          fieldStream[i] = fieldTable[i]; // default: the same name!
        }
        String locDateMask = XMLHandler.getTagValue( vnode, "date_mask" );
        if ( locDateMask == null ) {
          dateMask[i] = "";
        } else {
          if ( GPBulkLoaderMeta.DATE_MASK_DATE.equals( locDateMask )
            || GPBulkLoaderMeta.DATE_MASK_DATETIME.equals( locDateMask ) ) {
            dateMask[i] = locDateMask;
          } else {
            dateMask[i] = "";
          }
        }
      }
    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString(
        PKG, "GPBulkLoaderMeta.Exception.UnableToReadStepInfoFromXML" ), e );
    }
  }

  public void setDefault() {
    fieldTable = null;
    databaseMeta = null;
    maxErrors = 50;
    schemaName = "";
    tableName = BaseMessages.getString( PKG, "GPBulkLoaderMeta.DefaultTableName" );
    loadMethod = METHOD_AUTO_END;
    loadAction = ACTION_APPEND;
    PsqlPath = "PsqlPath";
    controlFile = "control${Internal.Step.CopyNr}.cfg";
    dataFile = "load${Internal.Step.CopyNr}.dat";
    logFile = "";
    encoding = "";
    dbNameOverride = "";

    eraseFiles = true;

    int nrvalues = 0;
    allocate( nrvalues );
  }

  public String getXML() {
    StringBuffer retval = new StringBuffer( 300 );

    retval
      .append( "    " ).append(
        XMLHandler.addTagValue( "connection", databaseMeta == null ? "" : databaseMeta.getName() ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "errors", maxErrors ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "schema", schemaName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "table", tableName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "load_method", loadMethod ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "load_action", loadAction ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "PsqlPath", PsqlPath ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "control_file", controlFile ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "data_file", dataFile ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "log_file", logFile ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "erase_files", eraseFiles ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "encoding", encoding ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "dbname_override", dbNameOverride ) );

    for ( int i = 0; i < fieldTable.length; i++ ) {
      retval.append( "      <mapping>" ).append( Const.CR );
      retval.append( "        " ).append( XMLHandler.addTagValue( "stream_name", fieldTable[i] ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "field_name", fieldStream[i] ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "date_mask", dateMask[i] ) );
      retval.append( "      </mapping>" ).append( Const.CR );
    }

    return retval.toString();
  }

  public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException {
    try {
      databaseMeta = rep.loadDatabaseMetaFromStepAttribute( id_step, "id_connection", databases );
      maxErrors = (int) rep.getStepAttributeInteger( id_step, "errors" );
      schemaName = rep.getStepAttributeString( id_step, "schema" );
      tableName = rep.getStepAttributeString( id_step, "table" );
      loadMethod = rep.getStepAttributeString( id_step, "load_method" );
      loadAction = rep.getStepAttributeString( id_step, "load_action" );
      PsqlPath = rep.getStepAttributeString( id_step, "PsqlPath" );
      controlFile = rep.getStepAttributeString( id_step, "control_file" );
      dataFile = rep.getStepAttributeString( id_step, "data_file" );
      logFile = rep.getStepAttributeString( id_step, "log_file" );

      eraseFiles = rep.getStepAttributeBoolean( id_step, "erase_files" );
      encoding = rep.getStepAttributeString( id_step, "encoding" );
      dbNameOverride = rep.getStepAttributeString( id_step, "dbname_override" );

      int nrvalues = rep.countNrStepAttributes( id_step, "stream_name" );

      allocate( nrvalues );

      for ( int i = 0; i < nrvalues; i++ ) {
        fieldTable[i] = rep.getStepAttributeString( id_step, i, "stream_name" );
        fieldStream[i] = rep.getStepAttributeString( id_step, i, "field_name" );
        dateMask[i] = rep.getStepAttributeString( id_step, i, "date_mask" );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "GPBulkLoaderMeta.Exception.UnexpectedErrorReadingStepInfoFromRepository" ), e );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
    try {
      rep.saveDatabaseMetaStepAttribute( id_transformation, id_step, "id_connection", databaseMeta );
      rep.saveStepAttribute( id_transformation, id_step, "errors", maxErrors );
      rep.saveStepAttribute( id_transformation, id_step, "schema", schemaName );
      rep.saveStepAttribute( id_transformation, id_step, "table", tableName );

      rep.saveStepAttribute( id_transformation, id_step, "load_method", loadMethod );
      rep.saveStepAttribute( id_transformation, id_step, "load_action", loadAction );
      rep.saveStepAttribute( id_transformation, id_step, "PsqlPath", PsqlPath );
      rep.saveStepAttribute( id_transformation, id_step, "control_file", controlFile );
      rep.saveStepAttribute( id_transformation, id_step, "data_file", dataFile );
      rep.saveStepAttribute( id_transformation, id_step, "log_file", logFile );

      rep.saveStepAttribute( id_transformation, id_step, "erase_files", eraseFiles );
      rep.saveStepAttribute( id_transformation, id_step, "encoding", encoding );
      rep.saveStepAttribute( id_transformation, id_step, "dbname_override", dbNameOverride );

      for ( int i = 0; i < fieldTable.length; i++ ) {
        rep.saveStepAttribute( id_transformation, id_step, i, "stream_name", fieldTable[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, "field_name", fieldStream[i] );
        rep.saveStepAttribute( id_transformation, id_step, i, "date_mask", dateMask[i] );
      }

      // Also, save the step-database relationship!
      if ( databaseMeta != null ) {
        rep.insertStepDatabase( id_transformation, id_step, databaseMeta.getObjectId() );
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "GPBulkLoaderMeta.Exception.UnableToSaveStepInfoToRepository" )
        + id_step, e );
    }
  }

  public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
    // Default: nothing changes to rowMeta
  }

  public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ) {
    CheckResult cr;
    String error_message = "";

    if ( databaseMeta != null ) {
      Database db = new Database( loggingObject, databaseMeta );
      db.shareVariablesWith( transMeta );
      try {
        db.connect();

        if ( !Const.isEmpty( tableName ) ) {
          cr =
            new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
              PKG, "GPBulkLoaderMeta.CheckResult.TableNameOK" ), stepMeta );
          remarks.add( cr );

          boolean first = true;
          boolean error_found = false;
          error_message = "";

          // Check fields in table
          String schemaTable =
            databaseMeta.getQuotedSchemaTableCombination(
              transMeta.environmentSubstitute( schemaName ), transMeta.environmentSubstitute( tableName ) );
          RowMetaInterface r = db.getTableFields( schemaTable );
          if ( r != null ) {
            cr =
              new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
                PKG, "GPBulkLoaderMeta.CheckResult.TableExists" ), stepMeta );
            remarks.add( cr );

            // How about the fields to insert/dateMask in the table?
            first = true;
            error_found = false;
            error_message = "";

            for ( int i = 0; i < fieldTable.length; i++ ) {
              String field = fieldTable[i];

              ValueMetaInterface v = r.searchValueMeta( field );
              if ( v == null ) {
                if ( first ) {
                  first = false;
                  error_message +=
                    BaseMessages
                      .getString( PKG, "GPBulkLoaderMeta.CheckResult.MissingFieldsToLoadInTargetTable" )
                      + Const.CR;
                }
                error_found = true;
                error_message += "\t\t" + field + Const.CR;
              }
            }
            if ( error_found ) {
              cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
            } else {
              cr =
                new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
                  PKG, "GPBulkLoaderMeta.CheckResult.AllFieldsFoundInTargetTable" ), stepMeta );
            }
            remarks.add( cr );
          } else {
            error_message = BaseMessages.getString( PKG, "GPBulkLoaderMeta.CheckResult.CouldNotReadTableInfo" );
            cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
            remarks.add( cr );
          }
        }

        // Look up fields in the input stream <prev>
        if ( prev != null && prev.size() > 0 ) {
          cr =
            new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
              PKG, "GPBulkLoaderMeta.CheckResult.StepReceivingDatas", prev.size() + "" ), stepMeta );
          remarks.add( cr );

          boolean first = true;
          error_message = "";
          boolean error_found = false;

          for ( int i = 0; i < fieldStream.length; i++ ) {
            ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );
            if ( v == null ) {
              if ( first ) {
                first = false;
                error_message +=
                  BaseMessages.getString( PKG, "GPBulkLoaderMeta.CheckResult.MissingFieldsInInput" ) + Const.CR;
              }
              error_found = true;
              error_message += "\t\t" + fieldStream[i] + Const.CR;
            }
          }
          if ( error_found ) {
            cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
          } else {
            cr =
              new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
                PKG, "GPBulkLoaderMeta.CheckResult.AllFieldsFoundInInput" ), stepMeta );
          }
          remarks.add( cr );
        } else {
          error_message =
            BaseMessages.getString( PKG, "GPBulkLoaderMeta.CheckResult.MissingFieldsInInput3" ) + Const.CR;
          cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
          remarks.add( cr );
        }
      } catch ( KettleException e ) {
        error_message =
          BaseMessages.getString( PKG, "GPBulkLoaderMeta.CheckResult.DatabaseErrorOccurred" ) + e.getMessage();
        cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
        remarks.add( cr );
      } finally {
        db.disconnect();
      }
    } else {
      error_message = BaseMessages.getString( PKG, "GPBulkLoaderMeta.CheckResult.InvalidConnection" );
      cr = new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, error_message, stepMeta );
      remarks.add( cr );
    }

    // See if we have input streams leading to this step!
    if ( input.length > 0 ) {
      cr =
        new CheckResult( CheckResultInterface.TYPE_RESULT_OK, BaseMessages.getString(
          PKG, "GPBulkLoaderMeta.CheckResult.StepReceivingInfoFromOtherSteps" ), stepMeta );
      remarks.add( cr );
    } else {
      cr =
        new CheckResult( CheckResultInterface.TYPE_RESULT_ERROR, BaseMessages.getString(
          PKG, "GPBulkLoaderMeta.CheckResult.NoInputError" ), stepMeta );
      remarks.add( cr );
    }
  }

  public SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
    Repository repository, IMetaStore metaStore ) throws KettleStepException {
    SQLStatement retval = new SQLStatement( stepMeta.getName(), databaseMeta, null ); // default: nothing to do!

    if ( databaseMeta != null ) {
      if ( prev != null && prev.size() > 0 ) {
        // Copy the row
        RowMetaInterface tableFields = new RowMeta();

        // Now change the field names
        for ( int i = 0; i < fieldTable.length; i++ ) {
          ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );
          if ( v != null ) {
            ValueMetaInterface tableField = v.clone();
            tableField.setName( fieldTable[i] );
            tableFields.addValueMeta( tableField );
          } else {
            throw new KettleStepException( "Unable to find field [" + fieldStream[i] + "] in the input rows" );
          }
        }

        if ( !Const.isEmpty( tableName ) ) {
          Database db = new Database( loggingObject, databaseMeta );
          db.shareVariablesWith( transMeta );
          try {
            db.connect();

            String schemaTable =
              databaseMeta.getQuotedSchemaTableCombination(
                transMeta.environmentSubstitute( schemaName ), transMeta.environmentSubstitute( tableName ) );
            String sql = db.getDDL( schemaTable, tableFields, null, false, null, true );

            if ( sql.length() == 0 ) {
              retval.setSQL( null );
            } else {
              retval.setSQL( sql );
            }
          } catch ( KettleException e ) {
            retval.setError( BaseMessages.getString( PKG, "GPBulkLoaderMeta.GetSQL.ErrorOccurred" )
              + e.getMessage() );
          }
        } else {
          retval.setError( BaseMessages.getString( PKG, "GPBulkLoaderMeta.GetSQL.NoTableDefinedOnConnection" ) );
        }
      } else {
        retval.setError( BaseMessages.getString( PKG, "GPBulkLoaderMeta.GetSQL.NotReceivingAnyFields" ) );
      }
    } else {
      retval.setError( BaseMessages.getString( PKG, "GPBulkLoaderMeta.GetSQL.NoConnectionDefined" ) );
    }

    return retval;
  }

  public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository,
    IMetaStore metaStore ) throws KettleStepException {
    if ( prev != null ) {
      /* DEBUG CHECK THIS */
      // Insert dateMask fields : read/write
      for ( int i = 0; i < fieldTable.length; i++ ) {
        ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );

        DatabaseImpact ii =
          new DatabaseImpact(
            DatabaseImpact.TYPE_IMPACT_READ_WRITE, transMeta.getName(), stepMeta.getName(), databaseMeta
              .getDatabaseName(), transMeta.environmentSubstitute( tableName ), fieldTable[i],
            fieldStream[i], v != null ? v.getOrigin() : "?", "", "Type = " + v.toStringMeta() );
        impact.add( ii );
      }
    }
  }

  public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ) {
    return new GPBulkLoader( stepMeta, stepDataInterface, cnr, transMeta, trans );
  }

  public StepDataInterface getStepData() {
    return new GPBulkLoaderData();
  }

  public DatabaseMeta[] getUsedDatabaseConnections() {
    if ( databaseMeta != null ) {
      return new DatabaseMeta[] { databaseMeta };
    } else {
      return super.getUsedDatabaseConnections();
    }
  }

  public RowMetaInterface getRequiredFields( VariableSpace space ) throws KettleException {
    String realTableName = space.environmentSubstitute( tableName );
    String realSchemaName = space.environmentSubstitute( schemaName );

    if ( databaseMeta != null ) {
      Database db = new Database( loggingObject, databaseMeta );
      try {
        db.connect();

        if ( !Const.isEmpty( realTableName ) ) {
          String schemaTable = databaseMeta.getQuotedSchemaTableCombination( realSchemaName, realTableName );

          // Check if this table exists...
          if ( db.checkTableExists( schemaTable ) ) {
            return db.getTableFields( schemaTable );
          } else {
            throw new KettleException( BaseMessages.getString( PKG, "GPBulkLoaderMeta.Exception.TableNotFound" ) );
          }
        } else {
          throw new KettleException( BaseMessages.getString( PKG, "GPBulkLoaderMeta.Exception.TableNotSpecified" ) );
        }
      } catch ( Exception e ) {
        throw new KettleException(
          BaseMessages.getString( PKG, "GPBulkLoaderMeta.Exception.ErrorGettingFields" ), e );
      } finally {
        db.disconnect();
      }
    } else {
      throw new KettleException( BaseMessages.getString( PKG, "GPBulkLoaderMeta.Exception.ConnectionNotDefined" ) );
    }

  }

  /**
   * @return the schemaName
   */
  public String getSchemaName() {
    return schemaName;
  }

  /**
   * @param schemaName
   *          the schemaName to set
   */
  public void setSchemaName( String schemaName ) {
    this.schemaName = schemaName;
  }

  public String getControlFile() {
    return controlFile;
  }

  public void setControlFile( String controlFile ) {
    this.controlFile = controlFile;
  }

  public String getDataFile() {
    return dataFile;
  }

  public void setDataFile( String dataFile ) {
    this.dataFile = dataFile;
  }

  public String getLogFile() {
    return logFile;
  }

  public void setLogFile( String logFile ) {
    this.logFile = logFile;
  }

  public void setLoadAction( String action ) {
    this.loadAction = action;
  }

  public String getLoadAction() {
    return this.loadAction;
  }

  public void setLoadMethod( String method ) {
    this.loadMethod = method;
  }

  public String getLoadMethod() {
    return this.loadMethod;
  }

  public String getEncoding() {
    return encoding;
  }

  public void setEncoding( String encoding ) {
    this.encoding = encoding;
  }

  public String getDelimiter() {
    return ",";
  }

  public String getEnclosure() {
    return "\"";
  }

  public boolean isEraseFiles() {
    return eraseFiles;
  }

  public void setEraseFiles( boolean eraseFiles ) {
    this.eraseFiles = eraseFiles;
  }

  public int getMaxErrors() {
    return maxErrors;
  }

  public void setMaxErrors( int maxErrors ) {
    this.maxErrors = maxErrors;
  }

  public String getDbNameOverride() {
    return dbNameOverride;
  }

  public void setDbNameOverride( String dbNameOverride ) {
    this.dbNameOverride = dbNameOverride;
  }

  @Override
  public String getMissingDatabaseConnectionInformationMessage() {
    // TODO Auto-generated method stub
    return null;
  }
}


text:
/*
 * $FreeBSD: soc2013/dpl/head/contrib/top/machine.h 238411 2012-06-27 18:08:48Z jhb $
 */

/*
 *  This file defines the interface between top and the machine-dependent
 *  module.  It is NOT machine dependent and should not need to be changed
 *  for any specific machine.
 */

/*
 * the statics struct is filled in by machine_init
 */
struct statics
{
    char **procstate_names;
    char **cpustate_names;
    char **memory_names;
    char **arc_names;
    char **swap_names;
#ifdef ORDER
    char **order_names;
#endif
    int ncpus;
};

/*
 * the system_info struct is filled in by a machine dependent routine.
 */

#ifdef p_active     /* uw7 define macro p_active */
#define P_ACTIVE p_pactive
#else
#define P_ACTIVE p_active
#endif

struct system_info
{
    int    last_pid;
    double load_avg[NUM_AVERAGES];
    int    p_total;
    int    P_ACTIVE;     /* number of procs considered "active" */
    int    *procstates;
    int    *cpustates;
    int    *memory;
    int    *arc;
    int    *swap;
    struct timeval boottime;
    int    ncpus;
};

/* cpu_states is an array of percentages * 10.  For example,
   the (integer) value 105 is 10.5% (or .105).
 */

/*
 * the process_select struct tells get_process_info what processes we
 * are interested in seeing
 */

struct process_select
{
    int idle;		/* show idle processes */
    int self;		/* show self */
    int system;		/* show system processes */
    int thread;		/* show threads */
    int uid;		/* only this uid (unless uid == -1) */
    int wcpu;		/* show weighted cpu */
    int jail;		/* show jail ID */
    int kidle;		/* show per-CPU idle threads */
    char *command;	/* only this command (unless == NULL) */
};

/* routines defined by the machine dependent module */

char *format_header();
char *format_next_process();

/* non-int routines typically used by the machine dependent module */
char *printable();

redpajama_set_name: RedPajamaGithub


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

export default class Toolbar extends Component {
    static propTypes = {
        data: PropTypes.object.isRequired,
        type: PropTypes.string.isRequired,
    };

    render() {
        const { type } = this.props;
        const content = this.props.data.get(type);
        const className = `pane-toolbar pane-toolbar-${type}`;

        if (!content) return null;

        return (
            <div className={className} dangerouslySetInnerHTML={{ __html: content }}/>
        );
    }
}


text:
from django.views import generic

from .base import TemplateNameResolverMixin

__all__ = (
    'ListView',
)

class ListViewMixin(TemplateNameResolverMixin):
    template_suffixes = ('list',)

class ListView(ListViewMixin, generic.ListView):
    pass


text:
<!DOCTYPE HTML>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="robots" content="index, follow">
        <title>aciTree drag & drop sorting demo - A treeview control with jQuery</title>
        <meta name="description" content="A demo to show you how aciTree can be used with aciSortable, check the plugin page to see all the functions exposed by the API">
        <meta name="keywords" content="aciTree, treeview, control, tree view, javascript, jQuery">
        <link rel="stylesheet" type="text/css" href="css/aciTree.css" media="all">
        <link rel="stylesheet" type="text/css" href="css/demo.css" media="all">

The sortable extension is using the aciSortable plugin, the available callback init options and the options parameter of the event handler
                receives the properties as defined by aciSortable (see the docs). aciTree adds a few extra events on top of aciSortable so we can handle
                with ease the drag start and check for a valid drop target. In this way we can limit what items can be dragged and where they can be dropped.

For dragging tree items out of the tree - check this demo.

See the examples below for what can be done by responding to only two events: beforedrag and checkdrop.

Note: you can also implement your own options.sortDrag and options.sortValid
                callbacks to set the helper (the element that follows the mouse pointer when in drag) the way you want.
                For the default implementation - check the source code of the sortable extension.

The default implementation (options.sortable needs to be active), you can drag & drop items anywhere, before or after another one,
                set as a child of a leaf node (it will be transformed in a inode by default), the parent can be changed:

                    see the JSON behind this tree

The easy way to find a car that's right for you

Tree Log... clear log

Limit the number of newly created tree levels to only #3 (we wont be able to add more than #3 levels deep but still be able to sort
                existing items in more than #3 levels deep):

                    see the JSON behind this tree

The easy way to find a car that's right for you

Tree Log... clear log

Limit the items that can be dragged around to just leaf items:

                    see the JSON behind this tree

The easy way to find a car that's right for you

Tree Log... clear log

Items can be dragged around only inside the same parent (items can't change parent):

                    see the JSON behind this tree

The easy way to find a car that's right for you

Tree Log... clear log


text:
<?php

return yii\helpers\ArrayHelper::merge(require __DIR__.'/base.php', [
    'id' => 'console',
]);


text:
require 'spec_helper'
describe TipVote do
  it {should belong_to :user}
  it {should belong_to :tip}
  it {should have_db_index([:user_id, :tip_id])}
end


text:
package hudson.plugins.warnings.parser;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

/**
 * Tests the class {@link PhpParser}.
 *
 * @author Shimi Kiviti
 */
public class PhpParserTest extends ParserTester {
    private static final String TYPE = new PhpParser().getGroup();

    private static final String PARSE_ERROR_CATEGORY = "PHP Parse error";
    private static final String FATAL_ERROR_CATEGORY = "PHP Fatal error";
    private static final String WARNING_CATEGORY = "PHP Warning";
    private static final String NOTICE_CATEGORY = "PHP Notice";

    /**
     * Tests the PHP parsing.
     *
     * @throws IOException Signals that an I/O exception has occurred.
     */
    @Test
    public void testParse() throws IOException {
        Collection<FileAnnotation> results = createParser().parse(openFile());
        assertEquals(5, results.size());

        Iterator<FileAnnotation> iterator = results.iterator();
        FileAnnotation annotation = iterator.next();
        checkWarning(annotation,
                25, "include_once(): Failed opening \'RegexpLineParser.php\' for inclusion (include_path=\'.:/usr/share/pear\') in PhpParser.php on line 25",
                "PhpParser.php", TYPE, WARNING_CATEGORY, Priority.NORMAL);

        annotation = iterator.next();
        checkWarning(annotation,
                25, "Undefined index:  SERVER_NAME in /path/to/file/Settings.php on line 25",
                "/path/to/file/Settings.php", TYPE, NOTICE_CATEGORY, Priority.NORMAL);

        annotation = iterator.next();
        checkWarning(annotation,
                35, "Undefined class constant 'MESSAGE' in /MyPhpFile.php on line 35",
                "/MyPhpFile.php", TYPE, FATAL_ERROR_CATEGORY, Priority.HIGH);

        annotation = iterator.next();
        checkWarning(annotation,
                35, "Undefined class constant 'MESSAGE' in /MyPhpFile.php on line 35",
                "/MyPhpFile.php", TYPE, PARSE_ERROR_CATEGORY, Priority.HIGH);

        annotation = iterator.next();
        checkWarning(annotation,
                34, "Missing argument 1 for Title::getText(), called in Title.php on line 22 and defined in Category.php on line 34",
                "Category.php", TYPE, WARNING_CATEGORY, Priority.NORMAL);

    }

    /**
     * Creates the parser.
     *
     * @return the warnings parser
     */
    protected AbstractWarningsParser createParser() {
        return new PhpParser();
    }

    @Override
    protected String getWarningsFile() {
        return "php.txt";
    }
}


text:
class MetaController < ApplicationController
  respond_to :json

  def show
    respond_with meta_info
  end

  private

  def meta_info
    {
      owner_email: "msolli@gmail.com",
      publication_api_version: "1.0",
      name: "Nostalgia",
      description: "A photo from your Flickr photostream from today on a corresponding date in the past.",
      delivered_on: "whenever there's a photo in your Flickr photostream from the corresponding date in the past",
      send_timezone_info: true,
      send_delivery_count: false,
      external_configuration: true
    }
  end
end


text:
package com.amazonaws.services.ec2.model;

import javax.annotation.Generated;

/**
 *
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum TpmSupportValues {

    V20("v2.0");

    private String value;

    private TpmSupportValues(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        return this.value;
    }

    /**
     * Use this in place of valueOf.
     *
     * @param value
     *        real value
     * @return TpmSupportValues corresponding to the value
     *
     * @throws IllegalArgumentException
     *         If the specified value does not map to one of the known values in this enum.
     */
    public static TpmSupportValues fromValue(String value) {
        if (value == null || "".equals(value)) {
            throw new IllegalArgumentException("Value cannot be null or empty!");
        }

        for (TpmSupportValues enumEntry : TpmSupportValues.values()) {
            if (enumEntry.toString().equals(value)) {
                return enumEntry;
            }
        }

        throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
    }
}


text:
#region Usings

using System;
using JetBrains.Annotations;

#endregion

namespace Extend
{
    public static partial class StringEx
    {
        /// <summary>
        ///     Returns a string containing a specified number of characters from the right side of a string.
        /// </summary>
        /// <param name="count">The number of characters to return.</param>
        /// <exception cref="ArgumentNullException">value can not be null.</exception>
        /// <exception cref="ArgumentOutOfRangeException">count is less than 0 or greater than the length of the string.</exception>
        /// <param name="value">The string from which the rightmost characters are returned.</param>
        /// <returns>Returns a string containing a specified number of characters from the right side of a string.</returns>
        [NotNull]
        [Pure]
        [PublicAPI]
        public static String Right( [NotNull] this String value, Int32 count )
        {
            value.ThrowIfNull( nameof(value) );

            if ( count < 0 || value.Length < count )
                throw new ArgumentOutOfRangeException( nameof(count), count, "The specified amount of characters is out of range." );

            return value.Substring( value.Length - count, count );
        }
    }
}


text:
import React from 'react';
import Modal from '../src/Modal';
import Button from '../src/Button';

export default
<div>
  <Button onClick={() => {
    $('#foo').modal('open');
  }}>Show Modal</Button>
  <Modal
    id='foo'
    header='Modal Header'>
    Lorem ipsum dolor sit amet
  </Modal>
</div>;


text:
package com.ds.ce.diy.domain;

import com.ds.ce.diy.domain.audit.AbstractAuditableEntity;
import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotNull;

import java.io.Serializable;
import java.time.LocalDate;

@MappedSuperclass
@RequiredArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Data
@EqualsAndHashCode(of = {"type", "brand"}, callSuper = false)
abstract class AbstractRentable extends AbstractAuditableEntity implements Serializable {

    @NotNull
    @Column(nullable = false, name = "rental_price")
    @NonNull
    private Double rentalPrice;

    @NotBlank
    @Column(nullable = false, length = 510)
    @NonNull
    private String description;

    @NotBlank
    @Column(nullable = false, updatable = false)
    @NonNull
    private String type;

    @NotBlank
    @Column(nullable = false, updatable = false)
    @NonNull
    private String brand;

    @NotNull
    @Column(nullable = false, updatable = false, name = "purchase_date")
    @NonNull
    private LocalDate purchaseDate;

    @Column(nullable = false, updatable = false, name = "purchase_price")
    @NonNull
    private Double purchasePrice;
}


text:
A jekyll blog and website with AMP, Ajax, Gulp and super intergrated into atom.

To prebuild locally:
npm install

Then:
gulp

Super in progress for now...


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * First window that user encounter. You can choose here which game you want to play.
 *
 * @author kastel
 */
public class StartWindow extends javax.swing.JFrame
{

	//All games avaiable. They are static beacause you can change game from any point of game
	public static HigherLower highlow;
	public static HeadTail headtail;
	public static Dice dice;
	public static Whatnumber whatnum;

	/**
	 * Creates new form StartWindow
	 */
	public StartWindow()
	{
		initComponents();
		this.setLocationRelativeTo(null); //set it at the center of the screen
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        btn_lowehigh = new javax.swing.JButton();
        btn_headtail = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        btn_dice = new javax.swing.JButton();
        btn_whatnumber = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("RandomGames");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setResizable(false);

        btn_lowehigh.setBackground(new java.awt.Color(102, 153, 255));
        btn_lowehigh.setFont(new java.awt.Font("MS Reference Sans Serif", 0, 14)); // NOI18N
        btn_lowehigh.setText("Lower or Higher");
        btn_lowehigh.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                btn_lowehighActionPerformed(evt);
            }
        });

        btn_headtail.setBackground(new java.awt.Color(102, 153, 255));
        btn_headtail.setFont(new java.awt.Font("MS Reference Sans Serif", 0, 14)); // NOI18N
        btn_headtail.setText("Head/Tails");
        btn_headtail.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                btn_headtailActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Arial", 0, 18)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Choose the game:");

        btn_dice.setBackground(new java.awt.Color(102, 153, 255));
        btn_dice.setFont(new java.awt.Font("MS Reference Sans Serif", 0, 14)); // NOI18N
        btn_dice.setText("Throw dice");
        btn_dice.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                btn_diceActionPerformed(evt);
            }
        });

        btn_whatnumber.setBackground(new java.awt.Color(102, 153, 255));
        btn_whatnumber.setFont(new java.awt.Font("MS Reference Sans Serif", 0, 14)); // NOI18N
        btn_whatnumber.setText("What number?");
        btn_whatnumber.addActionListener(new java.awt.event.ActionListener()
        {
            public void actionPerformed(java.awt.event.ActionEvent evt)
            {
                btn_whatnumberActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(93, 93, 93)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_lowehigh, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)
                    .addComponent(btn_headtail, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_dice, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_whatnumber, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(93, 93, 93))
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btn_headtail, btn_lowehigh});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btn_lowehigh)
                .addGap(18, 18, 18)
                .addComponent(btn_headtail)
                .addGap(18, 18, 18)
                .addComponent(btn_dice)
                .addGap(18, 18, 18)
                .addComponent(btn_whatnumber)
                .addGap(50, 50, 50))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	//=======================MENU SECTION==================================
    private void btn_lowehighActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_lowehighActionPerformed
		highlow.setVisible(true);
		this.setVisible(false);
    }//GEN-LAST:event_btn_lowehighActionPerformed
    private void btn_headtailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_headtailActionPerformed
		this.setVisible(false);
		headtail.setVisible(true);
    }//GEN-LAST:event_btn_headtailActionPerformed
    private void btn_diceActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btn_diceActionPerformed
    {//GEN-HEADEREND:event_btn_diceActionPerformed
		this.setVisible(false);
		dice.setVisible(true);
    }//GEN-LAST:event_btn_diceActionPerformed
    private void btn_whatnumberActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btn_whatnumberActionPerformed
    {//GEN-HEADEREND:event_btn_whatnumberActionPerformed
		this.setVisible(false);
		whatnum.setVisible(true);
    }//GEN-LAST:event_btn_whatnumberActionPerformed

	/**
	 * @param args the command line arguments
	 */
	public static void main(String args[])
	{
		/* Set the Nimbus look and feel */
		//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
		/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
		 */
		try
		{
			for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
			{
				if ("Nimbus".equals(info.getName()))
				{
					javax.swing.UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		} catch (ClassNotFoundException ex)
		{
			java.util.logging.Logger.getLogger(StartWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (InstantiationException ex)
		{
			java.util.logging.Logger.getLogger(StartWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (IllegalAccessException ex)
		{
			java.util.logging.Logger.getLogger(StartWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		} catch (javax.swing.UnsupportedLookAndFeelException ex)
		{
			java.util.logging.Logger.getLogger(StartWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
		}
		//</editor-fold>

		/* Create and display the form */
		java.awt.EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				//at the begining we start all games and showing only StartWindow
				highlow = new HigherLower();
				headtail = new HeadTail();
				dice = new Dice();
				whatnum = new Whatnumber();
				new StartWindow().setVisible(true);
			}
		});
	}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_dice;
    private javax.swing.JButton btn_headtail;
    private javax.swing.JButton btn_lowehigh;
    private javax.swing.JButton btn_whatnumber;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}


text:
namespace wiquotes
{
    partial class MainWindow
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.updateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.analysisToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.chartsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.menuStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // menuStrip1
            //
            this.menuStrip1.ImageScalingSize = new System.Drawing.Size(24, 24);
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileToolStripMenuItem,
            this.analysisToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Padding = new System.Windows.Forms.Padding(9, 3, 0, 3);
            this.menuStrip1.Size = new System.Drawing.Size(2205, 35);
            this.menuStrip1.TabIndex = 1;
            this.menuStrip1.Text = "menuStrip1";
            //
            // fileToolStripMenuItem
            //
            this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.updateToolStripMenuItem,
            this.preferencesToolStripMenuItem,
            this.exitToolStripMenuItem});
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size = new System.Drawing.Size(50, 29);
            this.fileToolStripMenuItem.Text = "File";
            //
            // updateToolStripMenuItem
            //
            this.updateToolStripMenuItem.Name = "updateToolStripMenuItem";
            this.updateToolStripMenuItem.Size = new System.Drawing.Size(211, 30);
            this.updateToolStripMenuItem.Text = "Update";
            this.updateToolStripMenuItem.Click += new System.EventHandler(this.updateToolStripMenuItem_Click);
            //
            // preferencesToolStripMenuItem
            //
            this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
            this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(211, 30);
            this.preferencesToolStripMenuItem.Text = "Preferences";
            this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click);
            //
            // exitToolStripMenuItem
            //
            this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size = new System.Drawing.Size(211, 30);
            this.exitToolStripMenuItem.Text = "Exit";
            //
            // analysisToolStripMenuItem
            //
            this.analysisToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.chartsToolStripMenuItem});
            this.analysisToolStripMenuItem.Name = "analysisToolStripMenuItem";
            this.analysisToolStripMenuItem.Size = new System.Drawing.Size(88, 29);
            this.analysisToolStripMenuItem.Text = "Analysis";
            //
            // chartsToolStripMenuItem
            //
            this.chartsToolStripMenuItem.Name = "chartsToolStripMenuItem";
            this.chartsToolStripMenuItem.Size = new System.Drawing.Size(147, 30);
            this.chartsToolStripMenuItem.Text = "Charts";
            this.chartsToolStripMenuItem.Click += new System.EventHandler(this.chartsToolStripMenuItem_Click);
            //
            // MainWindow
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(2205, 952);
            this.Controls.Add(this.menuStrip1);
            this.IsMdiContainer = true;
            this.MainMenuStrip = this.menuStrip1;
            this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
            this.Name = "MainWindow";
            this.Text = "WI Quotes";
            this.Load += new System.EventHandler(this.MainWindow_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem analysisToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem updateToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem chartsToolStripMenuItem;
    }
}


text:
using Caliburn.Micro;
using MeliMelo.MangaReader.Models;
using MeliMelo.MangaReader.ViewModels;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;

namespace MeliMelo.ViewModels
{
    /// <summary>
    /// Manga view model factory
    /// </summary>
    public interface IMangaViewModelFactory
    {
        /// <summary>
        /// Creates a new MangaViewModel
        /// </summary>
        /// <param name="manga">Manga</param>
        /// <param name="item_height"></param>
        /// <param name="speed"></param>
        /// <returns>View model</returns>
        MangaViewModel Create(Manga manga, int item_height, decimal speed);

        /// <summary>
        /// Releases a manga view model
        /// </summary>
        /// <param name="manga">Manga view model to release</param>
        void Release(MangaViewModel manga);
    }

    /// <summary>
    /// Represents a manga view model
    /// </summary>
    public class MangaViewModel : Screen
    {
        /// <summary>
        /// Creates a new MangaViewModel
        /// </summary>
        /// <param name="manga">Manga</param>
        /// <param name="item_height"></param>
        /// <param name="speed"></param>
        public MangaViewModel(Manga manga, int item_height, decimal speed)
        {
            item_height_ = item_height;
            speed_ = speed;
            manga_ = manga;
            slides_ = new PagedList<SlideViewModel>();

            int item = 0;
            foreach (var slide in manga_.Slides)
            {
                int page = item / kItemsPerPage;
                item++;
                slides_.Add(page, new SlideViewModel(slide, item_height_));
            }

            slides_.Update(0);
        }

        public int ItemHeight
        {
            get
            {
                return item_height_;
            }
            set
            {
                item_height_ = value;
                foreach (var slide in Slides)
                {
                    slide.Height = item_height_;
                }
            }
        }

        public string MangaName
        {
            get
            {
                return manga_.Name;
            }
        }

        /// <summary>
        /// Gets the scroll viewer speed
        /// </summary>
        public decimal ScrollSpeed
        {
            get
            {
                return speed_;
            }
            set
            {
                speed_ = value;
                NotifyOfPropertyChange(() => ScrollSpeed);
            }
        }

        /// <summary>
        /// Gets the manga slides
        /// </summary>
        public IEnumerable<SlideViewModel> Slides
        {
            get
            {
                return slides_.Items.Values.SelectMany(i => i);
            }
        }

        /// <summary>
        /// Called when the current scroll position has changed
        /// </summary>
        /// <param name="e">Scroll event</param>
        public void ScrollChanged(ScrollChangedEventArgs e)
        {
            int index = (int)(e.VerticalOffset / (item_height_ * kItemsPerPage));

            slides_.Update(index);
        }

        protected override void OnActivate()
        {
            // Load the first pages
            slides_.Update(0);

            base.OnActivate();
        }

        protected override void OnDeactivate(bool close)
        {
            // Unload everything
            slides_.Update(-1);

            base.OnDeactivate(close);
        }

        /// <summary>
        /// Number of items per page
        /// </summary>
        private const int kItemsPerPage = 2;

        private int item_height_;

        /// <summary>
        /// Manga
        /// </summary>
        private Manga manga_;

        /// <summary>
        /// List of slides
        /// </summary>
        private PagedList<SlideViewModel> slides_;

        private decimal speed_;
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Phytopath. Z. 40(3): 281 (1961)

#### Original name
Tunstallia aculeata var. aculeata (Petch) Agnihothr.

### Remarks
null


text:
using System;
using System.Linq;
using System.Runtime.Caching;

namespace Cachengue.Providers.Runtime
{
    /// <summary>
    /// A cache provider that relies on System.Runtime.Caching
    /// </summary>
    public class RuntimeCacheProvider : CacheProviderBase
    {
        /// <summary>
        /// Gets a value indicating whether the cache provider is available.
        /// </summary>
        /// <value>
        /// <c>true</c> if the cache provider is available; otherwise, <c>false</c>.
        /// </value>
        public override bool IsAvailable
        {
            get { return true; }
        }

        /// <summary>
        /// Gets the count of items stored in the cache.
        /// </summary>
        /// <value>
        /// The count of items stored in the cache.
        /// </value>
        public override int Size
        {
            get { return (int)RuntimeCache.GetCount(); }
        }

        /// <summary>
        /// Gets the stored cache keys.
        /// </summary>
        /// <value>
        /// The keys.
        /// </value>
        public override string[] Keys
        {
            get { return RuntimeCache.Select(x => x.Key).ToArray(); }
        }

        private ObjectCache RuntimeCache
        {
            get { return MemoryCache.Default; }
        }

        /// <summary>
        /// Tries to get the value from the cache.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="type">The type.</param>
        /// <param name="value">The value.</param>
        /// <returns>
        ///   <c>true</c> if the value exists on the cache, otherwise <c>false</c>.
        /// </returns>
        public override bool TryGetValue(string key, Type type, out object value)
        {
            if (!RuntimeCache.Contains(key))
            {
                value = null;
                return false;
            }

            value = RuntimeCache.Get(key);
            return true;
        }

        /// <summary>
        /// Stores the object on the cache.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="type">The object type to store.</param>
        /// <param name="value">The value.</param>
        /// <param name="options">The options.</param>
        public override void SetValue(string key, Type type, object value, CacheOptions options = null)
        {
            var policy = new CacheItemPolicy();
            policy.AbsoluteExpiration = DateTime.Now.AddSeconds(options.ExpirationSeconds);
            switch (options.Priority)
            {
                case CacheItemPriority.Default:
                case CacheItemPriority.High:
                case CacheItemPriority.Low:
                case CacheItemPriority.Normal:
                    policy.Priority = System.Runtime.Caching.CacheItemPriority.Default;
                    break;
                case CacheItemPriority.NotRemovable:
                    policy.Priority = System.Runtime.Caching.CacheItemPriority.NotRemovable;
                    break;
            }

            foreach (var runtimeDependency in options.Dependencies.Select(d => d as RuntimeCacheDependency).Where(runtimeDependency => runtimeDependency != null))
            {
                policy.ChangeMonitors.Add(runtimeDependency.ChangeMonitor);
            }

            if (options.UpdateCallback != null)
            {
                policy.UpdateCallback = arguments => options.UpdateCallback(arguments.Key, arguments.UpdatedCacheItem.Value);
            }

            if (options.RemovedCallback != null)
            {
                policy.RemovedCallback = arguments => options.RemovedCallback(arguments.CacheItem.Key, arguments.CacheItem.Value);
            }

            RuntimeCache.Set(key, value, policy);
        }

        /// <summary>
        /// Determines whether the specified key exists on the cache.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns>
        ///   <c>true</c> if the specified key exists; otherwise, <c>false</c>.
        /// </returns>
        public override bool Contains(string key)
        {
            return RuntimeCache.Contains(key);
        }

        /// <summary>
        /// Deletes the specified key from the cache.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <returns>
        ///   <c>true</c> if the key was succesfully removed; otherwise, <c>false</c>.
        /// </returns>
        public override bool Remove(string key)
        {
            if (Contains(key))
            {
                return false;
            }

            RuntimeCache.Remove(key);
            return true;
        }

        /// <summary>
        /// Removes all the keys from the cache.
        /// </summary>
        public override void FlushAll()
        {
            foreach (var key in RuntimeCache.Select(x => x.Key))
            {
                RuntimeCache.Remove(key);
            }
        }
    }
}


text:
import {BoardTicTacToe} from './boardTicTacToe';
import {PlayerTicTacToe} from './player/playerTicTacToe';
import {DrawTicTacToe} from './rendering/drawTicTacToe';

class MockBoardTicTacToe extends BoardTicTacToe {

    getDrawTicTacToe() {
        return new MockDrawTicTacToe();
    }
}

class MockDrawTicTacToe extends DrawTicTacToe {
    drawBoardWasCalled: boolean = false;
    drawXWasCalled: boolean = false;
    drawOWasCalled: boolean = false;
    writeGameOverMessageWasCalled: boolean = false;
    drawWinningLineWasCalled: boolean = false;

    constructor() {
        super(null, 10, 80);
        this.drawBoardWasCalled = false;
        this.drawXWasCalled = false;
        this.drawOWasCalled = false;
        this.writeGameOverMessageWasCalled = false;
        this.drawWinningLineWasCalled = false;
    }

    drawBoard() {
        this.drawBoardWasCalled = true;
    }

    drawX() {
        this.drawXWasCalled = true;
    }

    drawO() {
        this.drawOWasCalled = true;
    }

    writeGameOverMessage() {
        this.writeGameOverMessageWasCalled = true;
    }

    drawWinningLine() {
        this.drawWinningLineWasCalled = true;
    }
}

describe('BoardTicTacToe', function () {
    let boardTicTacToe: BoardTicTacToe;
    let player1: PlayerTicTacToe;
    let player2: PlayerTicTacToe;
    let numOfBoardCells = 9;

    beforeEach(() => {
        player1 = new PlayerTicTacToe();
        player2 = new PlayerTicTacToe();
        boardTicTacToe = new MockBoardTicTacToe(player1, player2);
    });

    describe('Basic setup', function () {

        it('board basic setup', () => {
            expect(boardTicTacToe.player1).toBe(player1);
            expect(boardTicTacToe.player1.isX).toBe(true);
            expect(boardTicTacToe.player2).toBe(player2);
            expect(boardTicTacToe.player2.isX).toBe(false);
            expect(boardTicTacToe.draw.boardTicTacToe).toBe(boardTicTacToe);

            for (let i = 0; i < numOfBoardCells; i++) {
                expect(boardTicTacToe.board[i] === null).toBe(true);
            }
        });
    });

    describe('isCellEmpty', function () {

        it('board basic setup', () => {
            for (let i = 0; i < numOfBoardCells; i++) {
                expect(boardTicTacToe.board[i]).toBeNull();
                expect(boardTicTacToe.isCellEmpty(i)).toBe(true);
            }
        });
        it('should return true if add player to cell', function () {
            for (let i = 0; i < numOfBoardCells; i++) {
                boardTicTacToe.board[i] = player1;
                for (let j = 0; j < numOfBoardCells; j++) {
                    if (i === j) {
                        expect(boardTicTacToe.isCellEmpty(j)).toBe(false);
                    } else {
                        expect(boardTicTacToe.isCellEmpty(j)).toBe(true);
                    }
                }
                boardTicTacToe.board[i] = null;
            }
        });
    });

    describe('didPlayerWin', function () {

        it('board basic setup', () => {
            expect(boardTicTacToe.didPlayerWin(player1)).toBe(false);
            expect(boardTicTacToe.didPlayerWin(player2)).toBe(false);
        });

        let clearBoard = function () {
            for (let i = 0; i < 9; i++) {
                boardTicTacToe.board[i] = null;
            }
        };

        let expectDidPlayerWinResult = function (setup, results) {
            setup.forEach(function (info) {
                let player: PlayerTicTacToe = info['player'];
                info['cells'].forEach(function (num: number) {
                    boardTicTacToe.board[num] = player;
                });
            });
            results.forEach(function (info) {
                let player: PlayerTicTacToe = info['player'];
                expect(boardTicTacToe.didPlayerWin(player)).toBe(info['result']);
            });
            clearBoard();
        };

        it('should return true if the board has 3 in a row, column, or diagoal', function () {
            expectDidPlayerWinResult([{player: player1, cells: [0, 1, 2]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [3, 4, 5]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [6, 7, 8]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [0, 3, 6]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [1, 4, 7]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [2, 5, 8]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [0, 4, 8]}], [{player: player1, result: true}]);
            expectDidPlayerWinResult([{player: player1, cells: [2, 4, 6]}], [{player: player1, result: true}]);

            expectDidPlayerWinResult([
                    {player: player1, cells: [4, 6, 1, 3, 8]},
                    {player: player2, cells: [0, 2, 7, 5]}],
                [{player: player1, result: false},
                    {player: player2, result: false}]);

        });

        it('should return false because does not have three in a row', function () {
            expectDidPlayerWinResult([{player: player1, cells: [0, 1]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [3, 4]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [6, 7]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [0, 3]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [1, 4]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [2, 5]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [0, 4]}], [{player: player1, result: false}]);
            expectDidPlayerWinResult([{player: player1, cells: [2, 4]}], [{player: player1, result: false}]);

            expectDidPlayerWinResult([
                    {player: player1, cells: [0, 1, 3, 5, 6]},
                    {player: player2, cells: [2, 4, 7, 8]}],
                [{player: player1, result: true},
                    {player: player2, result: false}]);

            expectDidPlayerWinResult([
                    {player: player1, cells: [2, 3, 4, 7, 8]},
                    {player: player2, cells: [0, 1, 5, 6]}],
                [{player: player1, result: false},
                    {player: player2, result: false}]);

        });
    });

    describe('isAcross', function () {

        it('should return true if the winning cells passed is a row', function () {

            [[0, 1, 2], [3, 4, 5], [6, 7, 8]].forEach((function (picks) {
                expect(boardTicTacToe.isAcross(picks)).toBe(true);
            }));

            [[0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]].forEach((function (picks) {
                expect(boardTicTacToe.isAcross(picks)).toBe(false);
            }));

        });

        describe('isDown', function () {

            it('should return true if the winning cells passed is a column', function () {

                [[0, 3, 6], [1, 4, 7], [2, 5, 8]].forEach((function (picks) {
                    expect(boardTicTacToe.isDown(picks)).toBe(true);
                }));

                [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 4, 8], [2, 4, 6]].forEach((function (picks) {
                    expect(boardTicTacToe.isDown(picks)).toBe(false);
                }));

            });
        });

        describe('isDiagonal', function () {

            it('should return true if the winning cells passed is a column', function () {

                [[0, 4, 8], [2, 4, 6]].forEach((function (picks) {
                    expect(boardTicTacToe.isDiagonal(picks)).toBe(true);
                }));

                [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8]].forEach((function (picks) {
                    expect(boardTicTacToe.isDiagonal(picks)).toBe(false);
                }));

            });
        });

        describe('place', function () {

            it('should insert player in an empty cell', function () {

                boardTicTacToe.place(player1, 0);

                expect(boardTicTacToe.board[0]).toBe(player1);

            });

            it('should throw signal in an pre-occupied cell', function () {

                boardTicTacToe.board[0] = player2;

                expect(function () {
                    boardTicTacToe.place(player1, 0);
                }).toThrow(new Error('Illegal Move: player=X cell=0'));

            });
        });

    });

});


text:
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

// Route::get('/registration/{catchAll?}', 'PublicController@home')->name('public.home')->where('catchAll', '.*');

Route::get('/test', function () {
    $attendees = \K20FastPass\Models\PhaseOneAttendee::get();
    foreach($attendees as $attendee) {
        $attendee->school_name = str_replace('High School', 'HS', $attendee->school_name);
        $attendee->save();
        $school = \K20FastPass\Models\School::where('name', $attendee->school_name)->first();
        if ($school && $school->id) {
            $attendee->school_id = $school->id;
            $attendee->save();
        }
    }
});

Route::get('/', function () { return redirect()->route('registration.home'); });

Route::group(['prefix' => 'registration'], function () {
    Route::get('/', 'RegistrationController@home')->name('registration.home');
    Route::post('/', 'RegistrationController@start')->name('registration.start');
    Route::group(['middleware' => 'registration.started'], function () {
        Route::group(['prefix' => 'attendee'], function () {
            Route::get('/{type?}', 'RegistrationController@attendee')->name('registration.attendee');
        });
        Route::group(['prefix' => 'presenter'], function () {
            Route::get('/', 'RegistrationController@presenter')->name('registration.presenter');
            Route::post('/', 'RegistrationController@savePresenter')->name('registration.presenter.save');
            Route::get('/success', 'RegistrationController@successPresenter')->name('registration.presenter.success');
        });
        Route::group(['prefix' => 'vendor'], function () {
            Route::get('/', 'RegistrationController@vendor')->name('registration.vendor');
            Route::post('/', 'RegistrationController@saveVendor')->name('registration.vendor.save');
            Route::get('/success', 'RegistrationController@successVendor')->name('registration.vendor.success');
        });
        Route::get('/details', 'RegistrationController@details')->name('registration.details');
        Route::post('/details', 'RegistrationController@detailsSave')->name('registration.details.save');
        Route::get('/check', 'RegistrationController@check')->name('registration.check');
        Route::post('/send_invitation/{type}', 'RegistrationController@sendInvitation')->name('registration.invitations.send');
    });
});

Route::group(['prefix' => 'api'], function () {
    Route::get('schools', 'ApiController@schools');
    Route::get('organizations', 'ApiController@organizations');
    Route::get('dietary_restrictions', 'ApiController@dietaryRestrictions');
    Route::get('check', 'ApiController@checkUser');
    Route::post('save_school', 'ApiController@saveSchool');
    Route::post('save_org', 'ApiController@saveOrganization');
    Route::post('claim', 'ApiController@saveClaims');
});

Route::get('/confirmation/{confirmation_code}', 'PublicController@getConfirmation')->name('view.confirmation');

Auth::routes();

Route::get('/displayattendance', 'AttendanceController@getAttendance')->name('get.attendance');
Route::post('/receiveattendance', 'AttendanceController@postAttendance')->name('post.attendance');

Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function () {
    Route::get('/', function () { return redirect()->route('view.home'); });
    Route::get('/home', 'HomeController@index')->name('view.home');

    Route::get('/search-attendees', 'HomeController@getPrintBadge')->name('view.print.badge');
    Route::post('/search-attendees', 'HomeController@postPrintBadge')->name('post.print.badge');
    Route::get('/search-attendees/{attendee}', 'HomeController@getPrintUserBadge')->name('view.print.user.badge');

    Route::get('/register-attendee', 'HomeController@getRegisterAttendee')->name('view.register.attendee');
    Route::post('/register-attendee', 'HomeController@postRegisterAttendee')->name('post.register.attendee');

    Route::get('/import-attendees', 'HomeController@getImportAttendees')->name('view.import.attendees');
    Route::post('/import-attendees', 'HomeController@postImportAttendees')->name('post.import.attendees');

    Route::get('/send-emails', 'HomeController@getSendEmails')->name('view.send.emails');
    Route::post('/send-emails', 'HomeController@postSendEmails')->name('post.send.emails');
    Route::get('/send-all-emails', 'HomeController@getSendAllEmails')->name('view.send.all.emails');
    Route::post('/send-all-emails', 'HomeController@postSendAllEmails')->name('post.send.all.emails');

    Route::get('/export', 'HomeController@getExport')->name('view.export');
    Route::get('/export/download', 'HomeController@postExportDownload')->name('get.export.download');
    Route::get('/export/attendees', 'HomeController@getAttendeesList')->name('fetch.attendees');
    Route::post('/export/attendees', 'HomeController@getAttendeesList')->name('fetch.attendees');

    Route::get('/fastpass-emails', 'HomeController@getFastpassEmails')->name('view.fastpass.emails');

    Route::get('logs', 'HomeController@getLogs')->name('view.logs');

});

/**
 * Below - duplicating all routes to prefix 'expresspass' so that this works on dev and prod
 */

Route::group(['prefix' => '/expresspass/registration'], function () {
    Route::get('/', 'RegistrationController@home')->name('registration.home');
    Route::post('/', 'RegistrationController@start')->name('registration.start');
    Route::group(['middleware' => 'registration.started'], function () {
        Route::group(['prefix' => 'attendee'], function () {
            Route::get('/{type?}', 'RegistrationController@attendee')->name('registration.attendee');
        });
        Route::group(['prefix' => 'presenter'], function () {
            Route::get('/', 'RegistrationController@presenter')->name('registration.presenter');
            Route::post('/', 'RegistrationController@savePresenter')->name('registration.presenter.save');
            Route::get('/success', 'RegistrationController@successPresenter')->name('registration.presenter.success');
        });
        Route::group(['prefix' => 'vendor'], function () {
            Route::get('/', 'RegistrationController@vendor')->name('registration.vendor');
            Route::post('/', 'RegistrationController@saveVendor')->name('registration.vendor.save');
            Route::get('/success', 'RegistrationController@successVendor')->name('registration.vendor.success');
        });
        Route::get('/details', 'RegistrationController@details')->name('registration.details');
        Route::post('/details', 'RegistrationController@detailsSave')->name('registration.details.save');
        Route::get('/check', 'RegistrationController@check')->name('registration.check');
        Route::post('/send_invitation/{type}', 'RegistrationController@sendInvitation')->name('registration.invitations.send');
    });
});

Route::group(['prefix' => '/expresspass/api'], function () {
    Route::get('schools', 'ApiController@schools');
    Route::get('organizations', 'ApiController@organizations');
    Route::get('dietary_restrictions', 'ApiController@dietaryRestrictions');
    Route::get('check', 'ApiController@checkUser');
    Route::post('save_school', 'ApiController@saveSchool');
    Route::post('save_org', 'ApiController@saveOrganization');
    Route::post('claim', 'ApiController@saveClaims');
});

Route::get('/expresspass/confirmation/{confirmation_code}', 'PublicController@getConfirmation')->name('view.confirmation');

Route::get('/expresspass/displayattendance', 'AttendanceController@getAttendance')->name('get.attendance');
Route::post('/expresspass/receiveattendance', 'AttendanceController@postAttendance')->name('post.attendance');

Route::get('/attendee/edit/{attendee}', 'RegistrationController@editAttendee');
Route::post('/attendee/edit/{attendee}', 'RegistrationController@updateAttendee');
Route::post('/attendee/delete/{attendee}', 'RegistrationController@deleteAttendee');
Route::get('/expresspass/attendee/edit/{attendee}', 'RegistrationController@editAttendee');
Route::post('/expresspass/attendee/edit/{attendee}', 'RegistrationController@updateAttendee');
Route::post('/expresspass/attendee/delete/{attendee}', 'RegistrationController@deleteAttendee');

Route::group(['prefix' => '/expresspass/admin', 'middleware' => 'auth'], function () {
    Route::get('/', function () { return redirect()->route('view.home'); });
    Route::get('/home', 'HomeController@index')->name('view.home');
    Route::get('/users', 'HomeController@users')->name('view.users');
    Route::post('/users', 'HomeController@saveUser')->name('view.users.post');

    Route::get('/search-attendees', 'HomeController@getPrintBadge')->name('view.print.badge');
    Route::post('/search-attendees', 'HomeController@postPrintBadge')->name('post.print.badge');
    Route::get('/search-attendees/{attendee}', 'HomeController@getPrintUserBadge')->name('view.print.user.badge');

    Route::get('/register-attendee', 'HomeController@getRegisterAttendee')->name('view.register.attendee');
    Route::post('/register-attendee', 'HomeController@postRegisterAttendee')->name('post.register.attendee');

    Route::get('/import-attendees', 'HomeController@getImportAttendees')->name('view.import.attendees');
    Route::post('/import-attendees', 'HomeController@postImportAttendees')->name('post.import.attendees');

    Route::get('/send-emails', 'HomeController@getSendEmails')->name('view.send.emails');
    Route::post('/send-emails', 'HomeController@postSendEmails')->name('post.send.emails');
    Route::get('/send-all-emails', 'HomeController@getSendAllEmails')->name('view.send.all.emails');
    Route::post('/send-all-emails', 'HomeController@postSendAllEmails')->name('post.send.all.emails');

    Route::get('/export', 'HomeController@getExport')->name('view.export');

    Route::get('/fastpass-emails', 'HomeController@getFastpassEmails')->name('view.fastpass.emails');

    Route::get('logs', 'HomeController@getLogs')->name('view.logs');

});


text:
namespace Messageboard.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Replies",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Body = c.String(),
                        CreationDate = c.DateTime(nullable: false),
                        TopicId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("dbo.Topics", t => t.TopicId, cascadeDelete: true)
                .Index(t => t.TopicId);

            CreateTable(
                "dbo.Topics",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Title = c.String(),
                        Body = c.String(),
                        CreationDate = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id);

        }

        public override void Down()
        {
            DropForeignKey("dbo.Replies", "TopicId", "dbo.Topics");
            DropIndex("dbo.Replies", new[] { "TopicId" });
            DropTable("dbo.Topics");
            DropTable("dbo.Replies");
        }
    }
}


text:
const constants = require('./constants');

function pageMode(state) {
  const explorePages = [
    constants.PageNames.EXPLORE_ROOT,
    constants.PageNames.EXPLORE_CHANNEL,
    constants.PageNames.EXPLORE_TOPIC,
    constants.PageNames.EXPLORE_CONTENT,
  ];
  const learnPages = [
    constants.PageNames.LEARN_ROOT,
    constants.PageNames.LEARN_CHANNEL,
    constants.PageNames.LEARN_CONTENT,
  ];
  if (explorePages.some(page => page === state.pageName)) {
    return constants.PageModes.EXPLORE;
  } else if (learnPages.some(page => page === state.pageName)) {
    return constants.PageModes.LEARN;
  }
  return undefined;
}

module.exports = {
  pageMode,
};


text:
<!DOCTYPE html>

    <title>Alias Class Reference</title>
    <link rel="stylesheet" type="text/css" href="../../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../../css/highlight.css" />
    <meta charset="utf-8">

          gir2swift 6.0.0 Docs

         (98% documented)

        <form role="search" action="../../search.json">
          <input type="text" placeholder="Search documentation" data-typeahead>
        </form>

            View on GitHub

            Install in Dash

      gir2swift Reference

      Alias Class Reference

            Classes

                GIR

                – Thing

                – Datatype

                – CType

                – Alias

                – Constant

                – Enumeration

                – Bitfield

                – Record

                – Class

                – Interface

                – Method

                – Function

                – Callback

                – Signal

                – Property

                – Argument

            Extensions

                BidirectionalCollection

                Collection

                Sequence

                String

                String

                – UTF8View

                XMLElement

            Functions

                <(_:_:)

                ==(_:_:)

                callCode(_:_:ptr:)

                callSetter(_:_:ptr:)

                codeFor(argument:)

                codeFor(argument:prefix:)

                commentCode(_:indentation:)

                computedPropertyCode(_:record:publicDesignation:ptr:)

                constructorParam(_:prefix:)

                constructorPrefix(_:)

                convenienceConstructorCode(_:indentation:convenience:publicDesignation:factory:convertName:)

                convertSetterArgumentToSwiftFor(_:ptr:)

                deprecatedCode(_:indentation:)

                functionCode(_:indentation:initialIndentation:)

                get_opt(_:)

                getterSetterPairs(for:)

                gtkDoc2SwiftDoc(_:linePrefix:)

                methodCode(_:initialIndentation:record:publicDesignation:convertName:ptr:)

                recordClassCode(_:parent:indentation:ptr:)

                recordProtocolCode(_:parent:indentation:ptr:)

                recordProtocolExtensionCode(_:_:indentation:ptr:)

                recordStructCode(_:indentation:ptr:)

                returnCode(_:_:ptr:)

                returnDeclarationCode(_:)

                returnTypeCode(_:)

                signalNameCode(indentation:convertName:)

                signalNameCode(indentation:prefixes:convertName:)

                swiftCallbackAliasCode(callback:)

                swiftCode(_:)

                swiftCode(_:)

                swiftCode(_:)

                swiftCode(_:_:indentation:)

                swiftCode(alias:)

                swiftCode(constant:)

                toSwift(_:ptr:)

                typeAlias(_:)

                valueCode(_:)

                with_mmap(_:protection:flags:process:)

                with_mmap(_:protection:flags:process:)

            Structures

                GetterSetterPair

Alias

public class Alias : CType

a type alias is just a type with an underlying C type

                    kind

String representation for an Alias

Declaration

Swift

public override var kind: String { get }

                        Show on GitHub

© 2019 René Hexel. All rights reserved. (Last updated: 2019-12-12)

Generated by jazzy ♪♫ v0.11.2, a Realm project.


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W28857_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans24.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">gyrodata
Gyrodata Incorporated
301 Thelma Dr. #413 Casper, Wyoming 82601
307-472-0182 Fax: 307-472-0204

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">DIRECTIONAL SURVEY CERTIFICATION

    <p class="styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">RE: Oasis Petroleum LLC (Operator)
Helling Trust Federal 5494 41—22 2B (Well Name & No.)

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">7.58 Ma etic Declination

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Surveyor: Josh Devereaux

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">I, Kristopher Bertsch ,having personal knowledge of all the facts, hereby certify

    <p class="styleSans13.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">that the attached directional survey run from measured depth of 1,974 feet to a

    <p class="styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">measured depth of 17,970 feet, and projected to 18,018 feet is true and correct as
determined from all available records.

    <p class="styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Signature

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">*All measurements recorded with a manned MWD Survey Tool.

    <p class="styleSans6.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Sewing the Worldwide Energy Industry with Precision Survey Instrumentation

    <p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">MWD Coordinator Title

    <p class="styleSans12.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Gflodata, Inc. Company


text:
package org.apache.cassandra.metrics;

import com.yammer.metrics.core.MetricName;

public interface MetricNameFactory
{
    /**
     * Create {@link MetricName} from given metric name.
     *
     * @param metricName Name part of {@link MetricName}.
     * @return new MetricName with given metric name.
     */
    MetricName createMetricName(String metricName);
}


text:
package org.jboss.netty.buffer;

import java.nio.ByteOrder;

/**
 * A skeletal implementation of {@link ChannelBufferFactory}.
 */
public abstract class AbstractChannelBufferFactory implements ChannelBufferFactory {

    private final ByteOrder defaultOrder;

    /**
     * Creates a new factory whose default {@link ByteOrder} is
     * {@link ByteOrder#BIG_ENDIAN}.
     */
    protected AbstractChannelBufferFactory() {
        this(ByteOrder.BIG_ENDIAN);
    }

    /**
     * Creates a new factory with the specified default {@link ByteOrder}.
     *
     * @param defaultOrder the default {@link ByteOrder} of this factory
     */
    protected AbstractChannelBufferFactory(ByteOrder defaultOrder) {
        if (defaultOrder == null) {
            throw new NullPointerException("defaultOrder");
        }
        this.defaultOrder = defaultOrder;
    }

    public ChannelBuffer getBuffer(int capacity) {
        return getBuffer(getDefaultOrder(), capacity);
    }

    public ChannelBuffer getBuffer(byte[] array, int offset, int length) {
        return getBuffer(getDefaultOrder(), array, offset, length);
    }

    public ByteOrder getDefaultOrder() {
        return defaultOrder;
    }
}


text:
package com.github.pheymann.scala.bft.consensus

import com.github.pheymann.scala.bft.ScalaBftSpec
import com.github.pheymann.scala.bft.messaging.{CommitMessage, PrepareMessage}
import com.github.pheymann.scala.bft.replica.ReplicaConfig
import org.slf4j.LoggerFactory

class MessageValidationSpec extends ScalaBftSpec {

  implicit val specLog = LoggerFactory.getLogger(classOf[MessageValidationSpec])

  "Received consensus messages" should {
    """have the same view as the receiver replica, a sequence number within
      |defined watermarks and the expected sender/receiver ids""".stripMargin in {
      implicit val config = newConfig(0, 0, 1)

      val state = ConsensusState(0, 0, 0, 0, 1)

      // valid messages
      MessageValidation.validateMessage(CommitMessage(0, 0, 0, 0), state) should beTrue
      MessageValidation.validateMessage(CommitMessage(0, 0, 0, 1), state) should beTrue

      // invalid messages
      MessageValidation.validateMessage(CommitMessage(0, 0, 0, 3), state) should beFalse
      MessageValidation.validateMessage(CommitMessage(0, 0, 1, 0), state) should beFalse
      MessageValidation.validateMessage(CommitMessage(0, 1, 1, 0), state) should beFalse
    }

    "set the state to prepared := true if 2f messages are received" in {
      implicit val config = newConfig(0, 0, 1)

      val state = ConsensusState(0, 0, 0, 0, 1)

      def checkState(state: ConsensusState)(isConsensus: Boolean, receivedMessages: Int) = {
        state.isPrepared should beEqualTo(isConsensus)
        state.receivedPrepares should beEqualTo(receivedMessages)
      }

      //ignored
      checkState(MessageValidation.validatePrepare(PrepareMessage(0, 0, 1, 0), state))(false, 0)

      //accepted
      checkState(MessageValidation.validatePrepare(PrepareMessage(0, 0, 0, 0), state))(false, 1)
      checkState(MessageValidation.validatePrepare(PrepareMessage(0, 0, 0, 0), state))(true, 2)
    }

    "set the state to commited := true if 2f + 1 messages are received" in {
      implicit val config = newConfig(0, 0, 1)

      val state = ConsensusState(0, 0, 0, 0, 1)

      def checkState(state: ConsensusState)(isConsensus: Boolean, receivedMessages: Int) = {
        state.isCommited should beEqualTo(isConsensus)
        state.receivedCommits should beEqualTo(receivedMessages)
      }

      //ignored
      checkState(MessageValidation.validateCommit(CommitMessage(0, 0, 1, 0), state))(false, 0)

      //accepted
      checkState(MessageValidation.validateCommit(CommitMessage(0, 0, 0, 0), state))(false, 1)
      checkState(MessageValidation.validateCommit(CommitMessage(0, 0, 0, 0), state))(false, 2)
      checkState(MessageValidation.validateCommit(CommitMessage(0, 0, 0, 0), state))(true, 3)
    }
  }

}