text:
package ca.waterloo.dsg.graphflow.query.planner;

import ca.waterloo.dsg.graphflow.graph.Graph;
import ca.waterloo.dsg.graphflow.graph.GraphDBState;
import ca.waterloo.dsg.graphflow.query.parser.StructuredQueryParser;
import ca.waterloo.dsg.graphflow.query.result.AbstractQueryResult;
import ca.waterloo.dsg.graphflow.query.result.Tuples;
import ca.waterloo.dsg.graphflow.query.structuredquery.StructuredQuery;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * Tests the {@link LoadDataFromCSVQueryPlanner}.
 *

 * Resource files used in these tests are from the train benchmark project.
 * https://github.com/FTSRG/trainbenchmark/tree/graphflow/models
 *

 * Schema can be found in railway-containments.png, in the resources folder
 */
public class LoadDataFromCSVPlannerTest {

    private static final int EXPECTED_CONNECTS_TO_EDGES = 585;
    private static final int EXPECTED_ENTRY_EDGES = 5;
    private static final int EXPECTED_EXIT_EDGES = 5;
    private static final int EXPECTED_FOLLOWS_EDGES = 25;
    private static final int EXPECTED_MONITORED_BY_EDGES = 672;
    private static final int EXPECTED_REQUIRES_EDGES = 112;
    private static final int EXPETED_TARGET_EDGES = 25;
    private static final int EXPECTED_HIGHEST_VERTEX_ID = 737;

    private static final String[] edgeFiles = {
        "connectsTo",
        "entry",
        "exit",
        "follows",
        "monitoredBy",
        "requires",
        "target",
    };

    private static final String[] vertexFiles = {
        "Region",
        "Route",
        "Segment",
        "Semaphore",
        "Sensor",
        "Switch",
        "SwitchPosition",
    };

    @Before
    public void setUp() {
        GraphDBState.reset();
        for (int i = 0; i < vertexFiles.length; i++) {
            String filePath = this.getClass().getClassLoader().getResource("vertices_data_csv" +
                "/railway-" + vertexFiles[i] + ".csv").getPath();
            loadCSVIntoGraph("LOAD VERTICES WITH LABEL '" + vertexFiles[i] + "' FROM CSV '" +
                filePath + "' SEPARATOR ',';");
        }

        for (int i = 0; i < edgeFiles.length; i++) {
            String filePath = this.getClass().getClassLoader().getResource("edges_data_csv/" +
                "railway-" + edgeFiles[i] + ".csv").getPath();
            loadCSVIntoGraph("LOAD EDGES WITH TYPE '" + edgeFiles[i] + "' FROM CSV '" + filePath +
                "' SEPARATOR ',';");
        }
    }

    @Test
    public void testFindHighestVertexID() {
        int highestId = Graph.getInstance().getHighestPermanentVertexId();
        Assert.assertEquals(highestId, EXPECTED_HIGHEST_VERTEX_ID);
    }

    @Test
    public void testFindNumberOfConnections() {
        assertQueryResultCount("MATCH (a)-[:connectsTo]->(b) return COUNT(*);",
            EXPECTED_CONNECTS_TO_EDGES);
    }

    @Test
    public void testFindNumberOfEntries() {
        assertQueryResultCount("MATCH (a)-[:entry]->(b) return COUNT(*);", EXPECTED_ENTRY_EDGES);
    }

    @Test
    public void testFindNumberOfExits() {
        assertQueryResultCount("MATCH (a)-[:exit]->(b) return COUNT(*);", EXPECTED_EXIT_EDGES);
    }

    @Test
    public void testFindNumberOfFollows() {
        assertQueryResultCount("MATCH (a)-[:follows]->(b) return COUNT(*);",
            EXPECTED_FOLLOWS_EDGES);
    }

    @Test
    public void testFindNumberOfMonitoredBy() {
        assertQueryResultCount("MATCH (a)-[:monitoredBy]->(b) return COUNT(*);",
            EXPECTED_MONITORED_BY_EDGES);
    }

    @Test
    public void testFindNumberOfRequires() {
        assertQueryResultCount("MATCH (a)-[:requires]->(b) return COUNT(*);",
            EXPECTED_REQUIRES_EDGES);
    }

    @Test
    public void testFindNumberOfTargets() {
        assertQueryResultCount("MATCH (a)-[:target]->(b) return COUNT(*);", EXPETED_TARGET_EDGES);
    }

    private void assertQueryResultCount(String matchQuery, int expectedCount) {
        AbstractQueryResult queryResult = new OneTimeMatchQueryPlanner(new StructuredQueryParser().
            parse(matchQuery)).plan().execute();
        long edgeCount = (long) ((Tuples) queryResult).getTuples().get(0)[0];
        Assert.assertEquals(edgeCount, expectedCount);
    }

    private static void loadCSVIntoGraph(String loadQuery) {
        StructuredQuery structuredQuery = new StructuredQueryParser().parse(loadQuery);
        new LoadDataFromCSVQueryPlanner(structuredQuery).plan().execute();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Sucker</Say>
  <Play>http://pages.cs.wisc.edu/~gtracy/twilio/NeverGonnaGiveYouUp.mp3</Play>
</Response>

redpajama_set_name: RedPajamaGithub


text:
class NATIVETEST_API CNativeTest {
public:
	CNativeTest(void);
	// TODO: add your methods here.
};


text:
     #define FatalErr(message) { cout << message << endl << endl; exit(-1); }
#endif

#define CleanUpAndExit(EXITCODE) { RemoveTheTee(); exit(EXITCODE); }

const Bool         parsed_args::INVALID_BOOL = 2;
const int          parsed_args::INVALID_INT = numeric_limits<int>::min() + 1;
const unsigned int parsed_args::INVALID_UINT = (unsigned int) -1 ;
const longlong     parsed_args::INVALID_LONGLONG = numeric_limits<longlong>::min() + 1;
const double       parsed_args::INVALID_DOUBLE = -1.1234;
const String       parsed_args::INVALID_STRING = "<required>";
const parsed_args *parsed_args::ARGS = NULL;

Bool parsed_args::pretty_help;
String parsed_args::usage_format;  // usage line format
String parsed_args::param_format;  // parameter name format
String parsed_args::header_format; // header line format
String parsed_args::info_format;   // paramter information format
String parsed_args::doc_format;    // paramter documentation format

void parsed_args::PrintTheCommandPretty( ostream& out, const String& prefix )
{
  String bar( "-----------------------------------------------------------"
	      "---------------------" );

  std::string hostname = getHostName();
  hostname = hostname.substr(0,hostname.find('.'));

  // Get the process ID and pad it to 5 characters.
  String pid_str = ToString( getpid( ) );
  while ( pid_str.size( ) < 5 ) pid_str += " ";

  // Write the first line of the command header.
  out << prefix << "\n" << prefix << bar << "\n" << prefix
      << Date( ) << " run on " << hostname << ", pid=" << pid_str
      << " [" << LINK_TIMESTAMP << " R" << SVN_REVISION << " ]\n";

  if ( orig_command_ != "" ) {
    String oc;
    SlashFold( orig_command_, oc );
    out << prefix << oc;
    out << "........................................................."
	<< ".......................\n";
  }

  String tc;
  SlashFold( TheCommand( ), tc );
  if ( prefix != "" )  {
    ForceAssert( !prefix.Contains("\n") );

    for ( int i = 0; i+1 < tc.isize(); i++ ) // tc changes size in the loop, which is ok
      if ( tc[i] == '\n' )
	tc.replace( i+1, 0, prefix );
  }
  out << prefix << tc << prefix << bar << "\n" << prefix << endl;
}

parsed_args::parsed_args( int argc, char *argv[], const Bool no_header )
  : command_( Basename(argv[0]) ), doc_(0), outputRedirectionPipe( NULL )
{
     no_header_ = no_header;
     ARGS = this;
     char* pretty_help_ptr = getenv( "ARACHNE_PRETTY_HELP" );
     if (pretty_help_ptr != 0 && String(pretty_help_ptr) == "Color") {
       usage_format = START_BOLD;
       param_format = START_MAGENTA;
       header_format = START_BOLD;
       info_format = START_LIGHT_BLUE;
       doc_format = "";
       pretty_help = True;
     } else if (pretty_help_ptr != 0 && String(pretty_help_ptr) == "Bold") {
       usage_format = START_BOLD;
       param_format = START_BOLD;
       header_format = START_BOLD;
       info_format = "";
       doc_format = "";
       pretty_help = True;
     } else {
       pretty_help = False;
     }
     name_.reserve( argc - 1 );
     def_.reserve( argc - 1 );
     used_.reserve( argc - 1 );
     if ( argc == 1 || ( argc > 1 && (strcmp( argv[1], "-h" ) == 0  || strcmp( argv[1], "--help" ) == 0 ) ) ) {
       get_help_ = True;
       if (argc == 3)
	 get_help_command_ = String(argv[2]);
     } else if ( argc == 2 && (strcmp( argv[1], "-v" ) == 0  || strcmp( argv[1], "--version" ) == 0 ) ) {
       PrintVersion();
       exit(0);
     } else
       {    static Bool included_args;  // static because of longjmp below
       included_args = False;
          get_help_ = False;
          for ( int i = 1; i < argc; i++ )
          {    if ( String(argv[i]).Contains( "@@", 0 ) )
               {    included_args = True;
                    String source = String(argv[i]).After( "@@" );
                    if ( !IsRegularFile(source) )
                    {     PRINT2(i, argv[i]);
                          InputErr( "Failed to locate " << source << "." );     }
                    Ifstream( in, source );
                    String line, x, inargs;
                    while(in)
                    {    getline( in, line );
                         if ( !in ) break;
                         if ( line.Contains( "#", 0 ) ) continue;
                         istrstream ini( line.c_str( ) );
                         while(ini)
                         {    ini >> x;
                              if ( x == "" ) break;
                              if ( !ParseString(x) )
                              {    PRINT2(i, argv[i]);
	                           InputErr( "Could not parse argument " << x
                                        << " from file " << source
                                        << "." );    }    }    }    }
               else if ( ! this->ParseString( argc, argv, i) )
               {    PRINT2(i, argv[i]);
	            InputErr( "You did not invoke this program with " <<
		          "white-space-free arguments of the form PARAMETER=VALUE."
		          << "\n\nTo see the syntax for this command, type \""
		          << command_ << " -h\"." );    }    }

	  MemMonitor();   // Launch MemMonitor if required
	  ParseTheTee();	  // Create TEE if required

          // Print the command name, etc.

          if ( no_header_ ) return;
          if ( TheCommand( ).Contains( "Assemble ", 0 ) ) return;
          if ( TheCommand( ).Contains( "Rerun ", 0 ) ) return;
          if ( TheCommand( ).Contains( "PackSource ", 0 ) ) return;
          if ( TheCommand( ).Contains( " NO_HEADER=True" ) ) return;
          if ( TheCommand( ).Contains( " NH=True" ) ) return;

	  // Add any command arguments passed via a file (using @@filename) to
	  // the original command line string for pretty printing. Ignore TEE.

          if (included_args)
          {
	    Bool first = True;
	      for ( int i = 0; i < argc; i++ )
               {    if ( String(orig_command_).substr(0, 4) == "TEE=" )
		       continue;
	            if ( !first ) orig_command_ += " ";
		    first = False;
                    orig_command_ += argv[i];    }    }

          PrintTheCommandPretty( cout );
	  PrintTheTee();    }    }

parsed_args::~parsed_args() {
  ARGS = NULL;
  RemoveTheTee();
}

bool parsed_args::ParseString( int argc, char **argv, int & i) {
  int len = strlen(argv[i]);
  if (i == argc-1
      || argv[i][len-1] != '=' //e.g. PARAM=blah
      || String(argv[i+1]).Contains("=") ) {
    return ParseString(argv[i]);
  }
  else { //e.g. PARAM= blah
    String temp(argv[i]);
    temp += argv[i+1];
    ++i; //consume the next argument!
    return ParseString(temp);
  }
}

void parsed_args::FetchArgsFromFile( const String& filename )
{    if ( IsRegularFile(filename) )
     {    Ifstream( in, filename );
          String line, a;
          while(1)
          {    getline( in, line );
               if ( !in ) break;
               if ( line.Contains( "#", 0 ) ) continue;
               if ( line.size( ) == 0 ) continue;
               istrstream iline( line.c_str( ) );
               while(iline)
               {    iline >> a;
                    if ( a.empty( ) ) break;
                    if ( !this->ParseString(a) )
	                 InputErr( "\nThe file " << filename << "\ndoes not contain "
		              << "white-space-free arguments of the form "
		              << "PARAMETER=VALUE." );    }    }    }    }

bool parsed_args::ParseString( const String& string )
{
  int eq = string.Position( "=" );
  if ( eq <= 0 )
    return false;

  String name = string.substr( 0, eq );
  if ( !Member( name_, name ) )
  {
    def_.push_back( string.substr( eq+1, string.size( ) ) );
    name_.push_back( name );
    used_.push_back(False);
  }
  else
  {    cout << "You've specified two values for " << name << ".\n"
            << "This is not allowed.  Please remove one of your "
            << "specifications.\n";
       cout << "Aborting.\n\n";
       CleanUpAndExit(1);    }

  return true;
}

void parsed_args::ConversionFailure(int i) {
  cout << "I couldn't convert the command line value \"" << def_[i] <<
    "\" for argument \"" << name_[i] << "\" to the required type.\n";
  System( command_ + " -h " + name_[i] );
  cout << "Aborting.\n\n";
  CleanUpAndExit(1);
}

void parsed_args::ValidationFailure(int i, const String& valid ) {
  cout << "Invalid command line value \"" << def_[i]
       << "\" for argument \"" << name_[i] << "\".\n"
       << "Valid value set/range is " << valid << "\n";
  System( command_ + " -h " + name_[i] );
  cout << "Aborting.\n\n";
  CleanUpAndExit(1);
}

void parsed_args::ValidationFailureDefault(const String& name,
					   const String& deflt,
					   const String& valid ) {
  cout << "Invalid default command line value \"" << deflt
       << "\" for argument \"" << name << "\".\n"
       << "Valid value set/range is " << valid << "\n";
  System( command_ + " -h " + name );
  cout << "Aborting.\n\n";
  CleanUpAndExit(1);
}

void parsed_args::NoValue(String n)
{    cout << "You must specify a command-line value for " << n << ".\n";
     System( command_ + " -h " + n );
     cout << "Aborting.\n\n";
     CleanUpAndExit(1);    }

String parsed_args::CheckForArgAndAbbreviation( String n, String abbr )
{
  if ( abbr == "" )
    return n;

  bool gotName(False), gotAbbr(False);
  for ( unsigned int i = 0; i < name_.size( ); i++ )
     {
       if ( name_[i] == n )
	 {
	   gotName = True;
	   continue;
	 }
       if ( name_[i] == abbr )
	 {
	   gotAbbr = True;
	 }
     }

  if ( gotName && gotAbbr )
    {
      cout << "You must not specify both an argument-" << n
	   << " and its abbreviation-" << abbr << ".\n"
	   << "\nTo see the syntax for this command, type \""
	   << command_ << " -h\".\n\n";
     CleanUpAndExit(1);
    }

  if ( gotName )
    return n;

  return abbr;

}

void parsed_args::CheckEnv( const String& n, const String& abbr ) {
    for ( int i = 0; i < name_.isize( ); i++ )
	if ( name_[i] == n || name_[i] == abbr ) return;
    int npasses = ( abbr == "" ? 1 : 2 );
    for ( int pass = 1; pass <= npasses; pass++ ) {
	char* env = nullptr;
	if (env_var_prefix_ != "") {
	    // Look for specific prefix (if set) first
	    String env_var = env_var_prefix_ + "_" + ( pass == 1 ? n : abbr );
	    env = getenv( env_var.c_str( ) );
	}
	if (!env) {
	    // Try default ARACHNE prefix as a fall back
	    String env_var =  "ARACHNE_" + ( pass == 1 ? n : abbr );
	    env = getenv( env_var.c_str( ) );
	}
	if ( env != 0 ) {
	    // Environment variable command arg found
	    def_.push_back( String(env) );
	    name_.push_back(n);
	    used_.push_back(False);
	    return;
	}
    }
}

template<>
void parsed_args::GetValue<String>
( String n, String & value, const String & abbr, const String & deflt,
  const String & valid) {
  value = GetStringValue(n, abbr, deflt, valid);
}

template<>
void parsed_args::GetValue<vec<String> >
( String n, vec<String> & value, const String & abbr, const String & deflt,
  const String & valid) {
    ParseStringSet(GetStringValue(n, abbr,deflt), value, false);
}

template<>
void parsed_args::GetValue<vec<int> >
( String n, vec<int> & value, const String & abbr, const String & deflt,
  const String & valid) {
    ParseIntSet(GetStringValue(n, abbr,deflt), value, false);
}
template<>
void parsed_args::GetValue<vec<longlong> >
( String n, vec<longlong> & value, const String & abbr, const String & deflt,
  const String & valid) {
    ParseLongLongSet(GetStringValue(n, abbr,deflt), value, false);
}

template<>
void parsed_args::GetValue<vec<double> >
( String n, vec<double> & value, const String & abbr, const String & deflt,
  const String & valid) {
    ParseDoubleSet(GetStringValue(n, abbr,deflt), value, false);
}

template<>
void parsed_args::GetValue<unsigned int>
( String n, unsigned int & value, const String & abbr, const String & deflt,
  const String & valid) {
  value = deflt.IsInt()
    ? GetUnsignedIntValue(n, abbr, deflt.Int(), valid)
    : GetUnsignedIntValue(n, abbr, INVALID_UINT, valid);
  return;
}

template<>
void parsed_args::GetValue<int>
( String n, int & value, const String & abbr, const String & deflt,
  const String & valid) {
  value = deflt.IsInt()
    ? GetIntValue(n, abbr, deflt.Int(), valid)
    : GetIntValue(n, abbr, INVALID_INT, valid);
  return;
}

template<>
void parsed_args::GetValue<longlong>
( String n, longlong & value, const String & abbr, const String & deflt,
  const String & valid) {
  value = deflt.IsInt() // only checks format, not range
    ? GetLongLongValue(n, abbr, deflt.Int(), valid)
    : GetLongLongValue(n, abbr, INVALID_LONGLONG, valid);
  return;
}

template<>
void parsed_args::GetValue<double>
( String n, double & value, const String & abbr, const String & deflt,
  const String & valid) {
  value = deflt.IsDouble()
    ? GetDoubleValue(n, abbr, deflt.Double(), valid)
    : GetDoubleValue(n, abbr, INVALID_DOUBLE, valid);
  return;
}

String parsed_args::GetStringValue( String n, String abbr,
				    String deflt, String valid ) {

  if (deflt != INVALID_STRING && valid != "" && !IsMemberOf(valid, deflt))
    ValidationFailureDefault(n, deflt, valid);

  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( unsigned int i = 0; i < name_.size( ); i++ ) {
    if ( name_[i] == toFind ) {
      used_[i] = True;
      if ( def_[i].size( ) > 0 && def_[i][0] == '"'
	   && def_[i][ def_.size( ) - 1 ] == '"' ) {
	for ( unsigned int j = 1; j < def_.size( ) - 1; j++ )
	  def_[j-1] = def_[j];
	def_.resize( def_.size( ) - 2 );
      }
      if (valid == "" || IsMemberOf(valid, def_[i]))
	return def_[i];
      else
	ValidationFailure(i, valid);
    }
  }
  if ( deflt != INVALID_STRING )
    return deflt;

  NoValue(n);
  return GARBAGE;
}

Bool parsed_args::GetBoolValue( String n, String abbr, Bool deflt )
{
  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( unsigned int i = 0; i < name_.size( ); i++ )
          if ( name_[i] == toFind )
          {    used_[i] = True;
              if ( ToLower(def_[i]) == "true" ) return True;
              else if ( ToLower(def_[i]) == "false" ) return False;
               else FatalErr( "The value of " << n
                    << " must be either True or False." );    }
     if ( deflt != INVALID_BOOL ) return deflt;
     NoValue(n);
     return GARBAGE;
}

template<>
void parsed_args::GetValue<Bool>
( String n, Bool & value, const String & abbr, const String & deflt,
  const String & valid) {
    value = (!deflt.IsBool()) ? GetBoolValue(n, abbr)
    : ("True" == deflt)
      ?  GetBoolValue(n, abbr, True)
      :  GetBoolValue(n, abbr, False);
    return;
  }

unsigned int parsed_args::GetUnsignedIntValue( String n, String abbr,
					       unsigned int deflt, String valid ) {

  if (deflt != INVALID_UINT && valid != "" && !IsMemberOf(valid, deflt))
    ValidationFailureDefault(n, ToString(deflt), valid);

  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( int i = 0; i < name_.isize( ); i++ ) {
    if ( name_[i] == toFind ) {
      if ( def_[i].size( ) > 0 && def_[i].IsInt( ) ) {
	longlong answer = def_[i].Int( );
	static longlong answer_bound((longlong) 4 *
				     (longlong) (1024 * 1024 * 1024) );
	if ( answer < answer_bound ) {
	  used_[i] = True;
	  unsigned int answerUInt = static_cast<unsigned int>(answer);
	  if (valid == "" || IsMemberOf(valid, answerUInt))
	    return answerUInt;
	  else
	    ValidationFailure(i, valid);
	}
      }
      ConversionFailure(i);
    }
  }
  if ( deflt != INVALID_UINT )
    return deflt;

  NoValue(n);
  return 0;
}

int parsed_args::GetIntValue( String n, String abbr, int deflt, String valid ) {

  if (deflt != INVALID_INT && valid != "" && !IsMemberOf(valid, deflt))
    ValidationFailureDefault(n, ToString(deflt), valid);

  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( int i = 0; i < name_.isize( ); i++ ) {
    if ( name_[i] == toFind ) {
      if ( def_[i].size( ) > 0 && def_[i].IsInt( ) ) {
	longlong answer = def_[i].Int( );
	static longlong answer_top(INT_MAX);
	static longlong answer_bottom(INT_MIN);
	if ( answer <= answer_top && answer >= answer_bottom ) {
	  used_[i] = True;
	  int answerInt = static_cast<int>(answer);
	  if (valid == "" || IsMemberOf(valid, answerInt))
	    return answerInt;
	  else
	    ValidationFailure(i, valid);
	}
      }
      ConversionFailure(i);
    }
  }
  if ( deflt != INVALID_INT )
    return deflt;

  NoValue(n);
  return 0;
}

longlong parsed_args::GetLongLongValue( String n, String abbr, longlong deflt, String valid ) {

  if (deflt != INVALID_LONGLONG && valid != "" && !IsMemberOf(valid, deflt))
    ValidationFailureDefault(n, ToString(deflt), valid);

  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( int i = 0; i < name_.isize( ); i++ ) {
    if ( name_[i] == toFind ) {
      if ( def_[i].size( ) > 0 && def_[i].IsInt( ) ) {  // isInt() doesn't range check
	longlong answer = def_[i].Int( );  // Int() returns a longlong, no range checking
	used_[i] = True;
	if (valid == "" || IsMemberOf(valid, answer))
	  return answer;
	else
	  ValidationFailure(i, valid);
      }
      ConversionFailure(i);
    }
  }
  if ( deflt != INVALID_LONGLONG )
    return deflt;

  NoValue(n);
  return 0;
}

double parsed_args::GetDoubleValue( String n, String abbr,
				    double deflt, String valid ) {

  if (deflt != INVALID_INT && valid != "" && !IsMemberOf(valid, deflt))
    ValidationFailureDefault(n, ToString(deflt), valid);

  CheckEnv( n, abbr );
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( unsigned int i = 0; i < name_.size( ); i++ ) {
    if ( name_[i] == toFind ) {
      if ( def_[i].size( ) > 0 && def_[i].IsDouble( ) ) {
	double answer = def_[i].Double( );
	used_[i] = True;
	if (valid == "" || IsMemberOf(valid, answer))
	  return answer;
	else
	  ValidationFailure(i, valid);
      }
      ConversionFailure(i);
    }
  }
  if ( deflt != INVALID_DOUBLE )
    return deflt;

  NoValue(n);
  return GARBAGE;
}

void parsed_args::MemMonitor() {
  int pos = Position(name_, String("MM"));
  if (pos == -1)  pos = Position(name_, String("MEM_MONITOR"));
  if (pos != -1) {
    if ( def_[pos] == "True" ) {
      int pid = getpid();
      String cmd = "MemMonitor";
      if (IsCommandInPath(cmd) ) {
	String mmcmd = cmd + " NH=True PID=" + ToString(pid);
	for (unsigned int mmindex = 0; mmindex < used_.size( ); mmindex++) {
	  if (name_[mmindex].Contains("_MM_")) {
	    mmcmd += " " + name_[mmindex].After("_MM_") + "=" + def_[mmindex];
	  }
	}
	Fork(mmcmd, true);
      }
      used_[pos] = True;
    }
  }
}

void parsed_args::ParseTheTee()
{
  int pos = Position(name_, String("TEE"));
  if (pos != -1) {
    MakeTheTee(def_[pos]);
    used_[pos] = True;
  }
}

void parsed_args::MakeTheTee(const String filenames)
{
  if (filenames != "") {
    outputRedirectedTo = filenames;
    String pipe_command = "tee " + outputRedirectedTo;
    outputRedirectionPipe = new procbuf( pipe_command.c_str( ), ios::app );
    ostream *pipeout = new ostream( outputRedirectionPipe );
    std::cout.rdbuf( pipeout->rdbuf( ) );
  }
}

void parsed_args::RemoveTheTee()
{
  if ( outputRedirectionPipe && outputRedirectionPipe->is_open() )
    outputRedirectionPipe->close();
}

void parsed_args::PrintTheTee()
{
  if ( outputRedirectedTo != "" ) {
    cout << "\nRedirecting standard output to the following files:\n";
    String files = outputRedirectedTo;
    DeleteLeadingWhiteSpace(files);
    DeleteTrailingWhiteSpace(files);
    files.GlobalReplaceBy(" ", "\n");
    cout << files << "\n\n";
  }
}

void parsed_args::CheckForExtraArgs( bool abort_if_found )
{    Bool junk_found = False;
     for ( unsigned int i = 0; i < used_.size( ); i++ )
          if ( used_[i] == False )
          {
	       if ( name_[i] == "GDB" )
               {    if ( def_[i] == "True" ) use_gdb_for_tracebacks = True;
                    else if ( def_[i] != "False" )
                    {    cout << "illegal value for parameter GDB" << endl;
                         CleanUpAndExit(1);    }
                    continue;    }
               if ( name_[i] == "NO_HEADER" )
               {    if ( def_[i] != "True" && def_[i] != "False" )
                    {    cout << "illegal value for parameter NO_HEADER" << endl;
                         CleanUpAndExit(1);    }
                    continue;    }
               if ( name_[i] == "NH" )
               {    if ( def_[i] != "True" && def_[i] != "False" )
                    {    cout << "illegal value for parameter NH" << endl;
                         CleanUpAndExit(1);    }
                    continue;    }
               if ( name_[i] == "MEM_MONITOR" || name_[i] == "MM" )
               {    if ( def_[i] != "True" && def_[i] != "False" )
		    {    cout << "illegal value for parameter " << def_[i] << endl;
		         CleanUpAndExit(1);    }
		    continue;    }
               if ( name_[i].Contains("_MM_") ) continue;
               if ( name_[i] == "TV" )
		 {    TraceValCommon::SetStopVal( (TraceValCommon::timestamp_t)atoll(def_[i].c_str()));
                    continue;    }
               cout << "You should not have specified a value for " <<
                    name_[i] << ".\n";
               junk_found = True;    }
     if (junk_found)
       if ( abort_if_found )
       {
	 cout << "\nTo see the syntax for this command, type \"" << command_
	      << " -h\". \n" << endl;
	 CleanUpAndExit(-1);
       }
       else {
         cout << "Ignoring extra arguments.\n" << endl;
       }
}

/// The special command-line argument TEE="file1 file2..."
/// Redirects cout to the specified files.  This method tells the caller the
/// names of the files (if given) to which we are redirecting output, or the
/// empty string if not redirecting. Allows a module to turn off its own
/// redirection as needed.
String parsed_args::GetOutputRedirection() const {
  return outputRedirectedTo;
}

void parsed_args::SetOutputRedirection(const String filenames) {
  if (outputRedirectedTo != "") {
    cout << "Unable to redirect output to: " << filenames << endl;
    cout << "Output already redirected via TEE parameter." << endl;
  } else {
    MakeTheTee(filenames);
  }
}

void parsed_args::PrintVersion()
{
  cout << command_ << " r" << SVN_REVISION << endl;
  return;
}

void parsed_args::AddArgHelp( const String& arg,
			      const String& type,
			      const String& abbreviation,
			      const String& default_value,
			      const String& valid_values,
			      const String& documentation)
{
  arg_help_.push_back(parsed_arg_help
		      (arg, type, abbreviation, default_value, valid_values, documentation));
}

void parsed_args::PrintArgHelp()
{

  bool print_special = (get_help_command_ == "special");
  if (get_help_command_ != "" && print_special != true) {
    for ( unsigned int i = 0; i < arg_help_.size( ); i++ )
      if ( arg_help_[i].GetName() == get_help_command_) {
	cout << "\n" << arg_help_[i] << "\n\n"
	     << "For more help type: "<< command_ << " -h\n" << endl;
	return;
      }
    cout << "\nUnknown argument: " << get_help_command_
	 << "  - No help available.\n\nFor a list of arguments type: "
	 << command_ << " -h\n" << endl;
    return;
  }

  if (parsed_args::pretty_help) cout << usage_format;
  cout << "\nUsage: " << command_ << " arg1=value1 arg2=value2 ..." << endl;
  if (parsed_args::pretty_help) cout << END_ESCAPE;
  if (doc_) {
    WhitespaceFold(String(doc_), cout);
    cout << "\n";
  }
  vec<parsed_arg_help>::iterator firstOpt =
    stable_partition(arg_help_.begin(), arg_help_.end(),
		     mem_fun_ref(&parsed_arg_help::isRequired));
  if (firstOpt != arg_help_.begin()) {
    if (parsed_args::pretty_help) cout << header_format;
    cout << "\nRequired arguments:\n\n";
    if (parsed_args::pretty_help) cout << END_ESCAPE;
    copy( arg_help_.begin(), firstOpt,
	  ostream_iterator<parsed_arg_help>(cout, "\n") );
  }
  if (firstOpt != arg_help_.end() ) {
    if (parsed_args::pretty_help) cout << header_format;
    cout << "\nOptional arguments:\n\n";
    if (parsed_args::pretty_help) cout << END_ESCAPE;
    copy( firstOpt, arg_help_.end(),
	  ostream_iterator<parsed_arg_help>(cout, "\n") );
  }

  if (print_special) {
    if (parsed_args::pretty_help) cout << header_format;
    cout << "\nSpecial arguments:\n\n";
    if (parsed_args::pretty_help) cout << END_ESCAPE;

    cout << parsed_arg_help( "GDB", "Bool", "", "False", "", "Whether to use GDB for tracebacks." )
	 << "\n"
	 << parsed_arg_help( "NO_HEADER", "Bool", "NH", "False", "",
			     "Whether to suppress the normal command-line header block." )
	 << "\n"
	 << parsed_arg_help( "MEM_MONITOR", "Bool", "MM", "False", "",
			     "Monitor the memory usage of this module by forking MemMonitor. "
			     "All arguments specifiable to MemMonitor can be supplied here "
			     "by prefixing them with '_MM_'. "
			     "See MemMonitor help for more information. " )
	 << "\n"
	 << parsed_arg_help( "TEE", "String", "", "", "",
			     "Redirect standard out to the supplied space separated list of files." )
	 << "\n";
  } else {
    cout << endl << "To see additional special arguments, type: " << command_ << " --help special" << endl;
  }
  cout << endl;
}

ostream& operator<< (ostream& out, const parsed_arg_help& an_arg)
{
  // Output first line describing the argument briefly.
  if (parsed_args::pretty_help) out << parsed_args::param_format;
  out << an_arg.name_;
  if (parsed_args::pretty_help) out << END_ESCAPE;
  if ( !an_arg.abbreviation_.empty() )
  {    out << ", or ";
       if (parsed_args::pretty_help) out <<  parsed_args::param_format;
       out << an_arg.abbreviation_;
       if (parsed_args::pretty_help) out << END_ESCAPE;    }
  if (parsed_args::pretty_help) out <<  parsed_args::info_format;
  out << " (" << an_arg.type_;
  if ( an_arg.valid_.empty() )
    out << ") ";
  else
    out << ": " << an_arg.valid_ << ") ";
  if ( ! (an_arg.isRequired() || an_arg.default_.empty() ) )
    out << "default: " << an_arg.default_ << " ";
  if (parsed_args::pretty_help) out << END_ESCAPE;

  // Now fold and display the documentation line, if any.
  if (!an_arg.doc_.empty()) {
    if (parsed_args::pretty_help) out <<  parsed_args::doc_format;
    WhitespaceFold(an_arg.doc_, out, 70, "  ");
    if (parsed_args::pretty_help) out << END_ESCAPE;
  }
  return out;
}

String parsed_args::TheCommand( ) const
{    String com = command_;
     for ( unsigned int i = 0; i < name_.size( ); i++ )
     {    Bool need_quotes = False;
          const String& d = def_[i];
	  if ( name_[i] == "TEE" ) continue;
          for ( unsigned int j = 0; j < d.size( )  &&  !need_quotes; j++ )
          {    if ( isspace( d[j] ) ) need_quotes = True;
               if ( d[j] == '{' || d[j] == '}' ) need_quotes = True;
               if ( d[j] == '[' || d[j] == ']' ) need_quotes = True;
               if ( d[j] == '(' || d[j] == ')' ) need_quotes = True;
               if ( d[j] == '%' || d[j] == ',' || d[j] == '=' ) need_quotes = True;
               if ( d[j] == '*' ) need_quotes = True;    }
          if ( !need_quotes ) com += " " + name_[i] + "=" + d;
          else com += " " + name_[i] + "=\"" + d + "\"";    }
     return com;    }

bool parsed_args::RemoveArg(String n, String abbr)
{
  String toFind = CheckForArgAndAbbreviation( n, abbr );
  for ( int i = 0; i < name_.isize( ); i++ )
    if ( name_[i] == toFind ) {
      name_.erase(name_.begin() + i, name_.begin() + i+1);
      def_.erase(def_.begin() + i,  def_.begin() + i+1);
      used_.erase(used_.begin() + i,  used_.begin() + i+1);
      return true;
    }
  return false;
}


text:
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
  IF(BUILD_TYPE)
    STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
           CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
  ELSE(BUILD_TYPE)
    SET(CMAKE_INSTALL_CONFIG_NAME "")
  ENDIF(BUILD_TYPE)
  MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)

# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
  IF(COMPONENT)
    MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
    SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
  ELSE(COMPONENT)
    SET(CMAKE_INSTALL_COMPONENT)
  ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)


text:
#pragma once

#include <vector>
#include <algorithm>
#include <functional>

namespace mo {
namespace util {

	struct no_move {
		protected:
			no_move() = default;
			~no_move()noexcept = default;
			no_move(no_move&&)=delete;
			no_move& operator=(no_move&&)=delete;
	};
	struct no_copy {
		protected:
			no_copy() = default;
			~no_copy()noexcept = default;
			no_copy(const no_copy&)=delete;
			no_copy& operator=(const no_copy&)=delete;
	};
	struct no_copy_move : no_copy, no_move {
		protected:
			no_copy_move() = default;
			~no_copy_move()noexcept = default;
	};

	template<class Func>
	struct cleanup {
		cleanup(Func f)noexcept : active(true), f(f) {}
		cleanup(const cleanup&)=delete;
		cleanup(cleanup&& o)noexcept : active(o.active), f(o.f) {o.active=false;}
		~cleanup()noexcept{f();}

		bool active;
		Func f;
	};
	template<class Func>
	inline auto cleanup_later(Func f)noexcept {
		return cleanup<Func>{f};
	}

	template<typename T>
	constexpr bool dependent_false() {
		return false;
	}

	template<typename T>
	constexpr T max(T a, T b) {
		return a<b ? b : a;
	}

	template<typename T>
	void erase_fast(std::vector<T>& c, const T& v) {
		using std::swap;

		auto e = std::find(c.begin(), c.end(), v);
		if(e!=c.end()) {
			swap(*e, c.back());
			c.pop_back();
		}
	}
	template<typename T>
	void erase_fast_stable(std::vector<T>& c, const T& v) {
		auto ne = std::remove(c.begin(), c.end(), v);

		if(ne!=c.end()) {
			c.erase(ne, c.end());
		}
	}

	template< typename ContainerT, typename PredicateT >
	void erase_if(ContainerT& items, const PredicateT& predicate) {
		for( auto it = items.begin(); it != items.end(); ) {
			if( predicate(*it) ) it = items.erase(it);
			else ++it;
		}
	}

	template<class Iter>
	class iter_range {
		public:
			iter_range()noexcept {}
			iter_range(Iter begin, Iter end)noexcept : b(begin), e(end) {}

			bool operator==(const iter_range& o)noexcept {
				return b==o.b && e==o.e;
			}

			Iter begin()const noexcept {
				return b;
			}
			Iter end()const noexcept {
				return e;
			}

		private:
			Iter b, e;
	};
	template<class T>
	using vector_range = iter_range<typename std::vector<T>::iterator>;

	template<class T>
	using cvector_range = iter_range<typename std::vector<T>::const_iterator>;

	template<class T>
	class numeric_range {
		struct iterator : std::iterator<std::random_access_iterator_tag, T, T> {
			T p;
			T s;
			constexpr iterator(T v, T s=1)noexcept : p(v), s(s) {};
			constexpr iterator(const iterator&)noexcept = default;
			constexpr iterator(iterator&&)noexcept = default;
			iterator& operator++()noexcept {p+=s; return *this;}
			iterator operator++(int)noexcept {auto t=*this; *this++; return t;}
			iterator& operator--()noexcept {p-=s; return *this;}
			iterator operator--(int)noexcept {auto t=*this; *this--; return t;}
			bool operator==(const iterator& rhs)const noexcept {return p==rhs.p;}
			bool operator!=(const iterator& rhs)const noexcept {return p!=rhs.p;}
			const T& operator*()const noexcept {return p;}
		};
		using const_iterator = iterator;

		public:
			constexpr numeric_range()noexcept {}
			constexpr numeric_range(T begin, T end, T step=1)noexcept : b(begin), e(end), s(step) {}
			constexpr numeric_range(numeric_range&&)noexcept = default;
			constexpr numeric_range(const numeric_range&)noexcept = default;

			numeric_range& operator=(const numeric_range&)noexcept = default;
			numeric_range& operator=(numeric_range&&)noexcept = default;
			bool operator==(const numeric_range& o)noexcept {
				return b==o.b && e==o.e;
			}

			constexpr iterator begin()const noexcept {
				return b;
			}
			constexpr iterator end()const noexcept {
				return e;
			}

		private:
			T b, e, s;
	};
	template<class Iter, typename = std::enable_if_t<!std::is_arithmetic<Iter>::value> >
	constexpr iter_range<Iter> range(Iter b, Iter e) {
		return {b,e};
	}
	template<class T, typename = std::enable_if_t<std::is_arithmetic<T>::value> >
	constexpr numeric_range<T> range(T b, T e, T s=1) {
		return {b, std::max(e+1, b), s};
	}
	template<class T, typename = std::enable_if_t<std::is_arithmetic<T>::value> >
	constexpr numeric_range<T> range(T num) {
		return {0,static_cast<T>(num)};
	}
	template<class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value> >
	iter_range<typename Container::iterator> range(Container& c) {
		using namespace std;
		return {begin(c),end(c)};
	}
	template<class Container, typename = std::enable_if_t<!std::is_arithmetic<Container>::value> >
	iter_range<typename Container::const_iterator> range(const Container& c) {
		using namespace std;
		return {begin(c),end(c)};
	}

	template<class Iter, class Type>
	class cast_iterator {
		public:
			typedef typename Iter::iterator_category  iterator_category;
			typedef Type                              value_type;
			typedef std::ptrdiff_t                    difference_type;
			typedef Type*                             pointer;
			typedef Type&                             reference;

			cast_iterator(Iter iter) : iter(iter) {};

			reference operator*() {return *reinterpret_cast<pointer>(*iter);}
			pointer operator->() {return reinterpret_cast<pointer>(&*iter);}

			cast_iterator& operator++() {
				++iter;
				return *this;
			}
			cast_iterator& operator--() {
				--iter;
				return *this;
			}

			cast_iterator operator++(int) {
				cast_iterator t = *this;
				++*this;
				return t;
			}

			cast_iterator operator--(int) {
				cast_iterator t = *this;
				--*this;
				return t;
			}

			bool operator==(const cast_iterator& o) const {
				return iter==o.iter;
			}
			bool operator!=(const cast_iterator& o) const {
				return iter!=o.iter;
			}
			bool operator<(const cast_iterator& o) const {
				return iter<o.iter;
			}

		private:
			Iter iter;
	};

	template<typename F>
	void doOnce(F f) {
		static bool first = true;
		if(first) {
			first = false;
			f();
		}
	}

}
}


text:
namespace leaf = boost::leaf;

enum class ConversionErrc
{
    EmptyString = 1,
    IllegalChar,
    TooLong
};

leaf::result<int> convert(const std::string& str) noexcept
{
    if (str.empty())
        return leaf::new_error(ConversionErrc::EmptyString);

    if (!std::all_of(str.begin(), str.end(), ::isdigit))
        return leaf::new_error(ConversionErrc::IllegalChar);

    if (str.length() > 9)
        return leaf::new_error(ConversionErrc::TooLong);

    return atoi(str.c_str());
}

// Do not static_store BigInt to actually work -- it's a stub.
struct BigInt
{
    static leaf::result<BigInt> fromString(const std::string& s) { return BigInt{s}; }
    explicit BigInt(const std::string&) { }
    BigInt half() const { return BigInt{""}; }
    friend std::ostream& operator<<(std::ostream& o, const BigInt&) { return o << "big int half"; }
};

// This function handles ConversionErrc::TooLong errors, forwards any other
// error to the caller.
leaf::result<void> print_half(const std::string& text)
{
    return leaf::try_handle_some(
        [&]() -> leaf::result<void>
        {
            BOOST_LEAF_AUTO(r,convert(text));
            std::cout << r / 2 << std::endl;
            return { };
        },
        [&]( leaf::match<ConversionErrc, ConversionErrc::TooLong> ) -> leaf::result<void>
        {
            BOOST_LEAF_AUTO(i, BigInt::fromString(text));
            std::cout << i.half() << std::endl;
            return { };
        } );
}

int main( int argc, char const * argv[] )
{
    return leaf::try_handle_all(
        [&]() -> leaf::result<int>
        {
            BOOST_LEAF_CHECK( print_half(argc<2 ? "" : argv[1]) );
            std::cout << "ok" << std::endl;
            return 0;
        },

        []( leaf::match<ConversionErrc, ConversionErrc::EmptyString> )
        {
            std::cerr << "Empty string!" << std::endl;
            return 1;
        },

        []( leaf::match<ConversionErrc, ConversionErrc::IllegalChar> )
        {
            std::cerr << "Illegal char!" << std::endl;
            return 2;
        },

        []( leaf::error_info const & unmatched )
        {
            // This will never execute in this program, but it would detect
            // logic errors where an unknown error reaches main. In this case,
            // we print diagnostic information.
            std::cerr <<
                "Unknown failure detected" << std::endl <<
                "Cryptic diagnostic information follows" << std::endl <<
                unmatched;
            return 3;
        } );
}

////////////////////////////////////////

#ifdef BOOST_LEAF_NO_EXCEPTIONS

namespace boost
{
    BOOST_LEAF_NORETURN void throw_exception( std::exception const & e )
    {
        std::cerr << "Terminating due to a C++ exception under BOOST_LEAF_NO_EXCEPTIONS: " << e.what();
        std::terminate();
    }

    struct source_location;
    BOOST_LEAF_NORETURN void throw_exception( std::exception const & e, boost::source_location const & )
    {
        throw_exception(e);
    }
}

#endif


text:
package com.aparapi.codegen.test;

public class PostDecLocal {

    public void run() {
        @SuppressWarnings("unused") boolean pass = false;
        int i = 0;
        if (i-- == 0)
            pass = true;

    }
}
/**{OpenCL{
 typedef struct This_s{

 int passid;
 }This;
 int get_pass_id(This *this){
 return this->passid;
 }

 __kernel void run(
 int passid
 ){
 This thisStruct;
 This* this=&thisStruct;
 this->passid = passid;
 {
 char pass = 0;
 int i = 0;
 if (i--==0){
 pass = 1;
 }
 return;
 }
 }
 }OpenCL}**/


text:
require 'optparse'
require_relative 'issue'
require_relative 'person'
require_relative 'reporter'
require_relative 'utils'
require_relative 'volume'

options = {}

opt_parser = OptionParser.new do |opt|
  opt.banner = 'Usage: harvester [options]'
  opt.separator ''
  opt.separator 'Options:'

  opt.on('-d', '--dir DIRECTORY', 'The working directory containing people.txt and where the README.md will be written') do |directory|
    options[:directory] = directory
  end

  opt.on('-t', '--title TITLE', 'The report title') do |title|
    options[:title] = title
  end

  opt.on('-h', '--help', 'Shows this message') do
    puts opt
    exit
  end

  opt.separator ''
  opt.separator 'Example:'
  opt.separator 'harvester --dir comic-con-2013 --title "Comic-Con 2013"'
  opt.separator ''
  opt.separator 'Con Harvester will open comic-con-2013/person.txt and start harvesting information about each person,'
  opt.separator 'generating the comic-con-2013/README.md report in the process.'
  opt.separator ''
end

opt_parser.parse!

mandatory = [:directory, :title]
missing = mandatory.select{ |param| options[param].nil? }
if not missing.empty?
  puts "Missing options: #{missing.join(', ')}"
  puts opt_parser
  exit
end

url = 'http://www.comicvine.com/api/search/'.sign.accept_json.return_fields :name, :api_detail_url, :deck
url = "#{url}&resources=person&query=ron%20lim"

Utils.execute_get url

report = File.new("#{options[:directory]}/README.md", 'w:utf-8')
reporter = Reporter.new(report, options[:title])

File.open("#{options[:directory]}/people.txt", 'r:utf-8').each do |name|
  person = Person.find name.strip
  if person
    reporter.log person
  end
end


text:
<?php
$iwd_av_class = false;

if (! Mage::helper ( 'opc' )->isEnable ()) {
	// check if IWD AddressValidation exists
	$path = Mage::getBaseDir ( 'app' ) . DS . 'code' . DS . 'local' . DS;
	$file = 'IWD/AddressVerification/controllers/OnepageController.php';
	// load IWD OPC class
	if (file_exists ( $path . $file )){
		// check if IWD AV enabled
		if (Mage::helper ( 'addressverification' )->isAddressVerificationEnabled ()){
			$iwd_av_class = true;
		}
	}
}

if (! $iwd_av_class) {
	require_once Mage::getModuleDir ( 'controllers', 'Mage_Checkout' ) . DS . 'OnepageController.php';
	class IWD_Opc_Checkout_OnepageController extends Mage_Checkout_OnepageController {

		/**
		 * Checkout page
		 */
		public function indexAction() {
			$scheme = Mage::app ()->getRequest ()->getScheme ();
			if ($scheme == 'http') {
				$secure = false;
			} else {
				$secure = true;
			}

			if (Mage::helper ( 'opc' )->isEnable ()) {
				$this->_redirect ( 'onepage', array (
						'_secure' => $secure
				) );
				return;
			} else {
				parent::indexAction ();
			}
		}
	}
} else {
	require_once Mage::getModuleDir ( 'controllers', 'IWD_AddressVerification' ) . DS . 'OnepageController.php';
	class IWD_Opc_Checkout_OnepageController extends IWD_AddressVerification_OnepageController {
	}
}


text:
package com.github.neuralnetworks.samples.test;

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import com.amd.aparapi.Kernel.EXECUTION_MODE;
import com.github.neuralnetworks.architecture.NeuralNetwork;
import com.github.neuralnetworks.architecture.NeuralNetworkImpl;
import com.github.neuralnetworks.architecture.types.Autoencoder;
import com.github.neuralnetworks.architecture.types.DBN;
import com.github.neuralnetworks.architecture.types.NNFactory;
import com.github.neuralnetworks.architecture.types.RBM;
import com.github.neuralnetworks.architecture.types.StackedAutoencoder;
import com.github.neuralnetworks.calculation.CalculationFactory;
import com.github.neuralnetworks.calculation.OutputError;
import com.github.neuralnetworks.calculation.operations.OperationsFactory;
import com.github.neuralnetworks.input.CSVInputProvider;
import com.github.neuralnetworks.input.MultipleNeuronsOutputError;
import com.github.neuralnetworks.input.MultipleNeuronsSimpleOutputError;
import com.github.neuralnetworks.input.ScalingInputFunction;
import com.github.neuralnetworks.samples.iris.IrisInputProvider;
import com.github.neuralnetworks.training.DNNLayerTrainer;
import com.github.neuralnetworks.training.OneStepTrainer;
import com.github.neuralnetworks.training.TrainerFactory;
import com.github.neuralnetworks.training.TrainingInputProviderImpl;
import com.github.neuralnetworks.training.backpropagation.BackPropagationAutoencoder;
import com.github.neuralnetworks.training.backpropagation.BackPropagationTrainer;
import com.github.neuralnetworks.training.events.LogTrainingListener;
import com.github.neuralnetworks.training.random.MersenneTwisterRandomInitializer;
import com.github.neuralnetworks.training.random.NNRandomInitializer;
import com.github.neuralnetworks.training.random.RandomInitializerImpl;
import com.github.neuralnetworks.training.rbm.CDTrainerBase;
import com.github.neuralnetworks.training.rbm.DBNTrainer;
import com.github.neuralnetworks.util.Environment;
import com.github.neuralnetworks.util.RuntimeConfiguration;

/**
 * Iris test
 */
@RunWith(Parameterized.class)
@Ignore
@Deprecated // Iris input is not inplemented in Core, i.e. not necessary to test.
public class IrisTest
{
	public IrisTest(RuntimeConfiguration conf)
	{
		Environment.getInstance().setRuntimeConfiguration(conf);
	}

	@Parameters
	public static Collection<RuntimeConfiguration[]> runtimeConfigurations()
	{
		List<RuntimeConfiguration[]> configurations = new ArrayList<>();

		RuntimeConfiguration conf1 = new RuntimeConfiguration();
		conf1.getAparapiConfiguration().setExecutionMode(EXECUTION_MODE.SEQ);
		conf1.setUseDataSharedMemory(false);
		conf1.setUseWeightsSharedMemory(false);
		configurations.add(new RuntimeConfiguration[] { conf1 });

//		RuntimeConfiguration conf2 = new RuntimeConfiguration();
//		conf2.getAparapiConfiguration().setExecutionMode(EXECUTION_MODE.SEQ);
//		conf2.setUseDataSharedMemory(true);
//		conf2.setUseWeightsSharedMemory(true);
//		configurations.add(new RuntimeConfiguration[] { conf2 });

//		RuntimeConfiguration conf3 = new RuntimeConfiguration();
//		conf3.setCalculationProvider(CalculationProvider.OPENCL);
//		conf3.setUseDataSharedMemory(false);
//		conf3.setUseWeightsSharedMemory(false);
//		conf3.getOpenCLConfiguration().setAggregateOperations(true);
//		conf3.getOpenCLConfiguration().setSynchronizeAfterOpertation(false);
//		conf3.getOpenCLConfiguration().setPushToDeviceBeforeOperation(false);
//		conf3.getOpenCLConfiguration().setFinalyzeDeviceAfterPhase(true);
//		conf3.getAparapiConfiguration().setExecutionMode(EXECUTION_MODE.SEQ);
//		configurations.add(new RuntimeConfiguration[] { conf3 });

		return configurations;
	}

	@Test
	public void testMLPSigmoidBP()
	{
		// create the network
		NeuralNetworkImpl mlp = NNFactory.mlp(new int[] { 4, 2, 3 }, true);
		mlp.setLayerCalculator(CalculationFactory.lcSigmoid(mlp, OperationsFactory.softmaxFunction()));

		// training and testing data providers
		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());
		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());
		OutputError outputError = new MultipleNeuronsSimpleOutputError();

		// trainer
		BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(mlp, trainInputProvider, testInputProvider, outputError, new NNRandomInitializer(new RandomInitializerImpl(-0.01f, 0.01f), 0.5f),
				0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 5000);

		// log data
		bpt.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		// early stopping
		// bpt.addEventListener(new EarlyStoppingListener(testInputProvider, 100, 0.015f));

		// bpt.addEventListener(new FFNBPCalculationEventListener());

		// train
		bpt.train();

		// test
		bpt.test();

		assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
	}

	@Test
	public void testMLPReLUBP()
	{
		// create the network
		NeuralNetworkImpl mlp = NNFactory.mlp(new int[] { 4, 10, 10, 3 }, true);
		mlp.setLayerCalculator(CalculationFactory.lcRelu(mlp, OperationsFactory.softmaxFunction()));

		// training and testing data providers
		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());
		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());
		OutputError outputError = new MultipleNeuronsSimpleOutputError();

		// trainer
		BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(mlp, trainInputProvider, testInputProvider, outputError, new NNRandomInitializer(new RandomInitializerImpl(-0.01f, 0.01f), 0.5f),
				0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 10000);

		// log data
		LogTrainingListener ls = new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName());
		ls.setLogEpochs(false);
		bpt.addEventListener(ls);

		// early stopping
		// bpt.addEventListener(new EarlyStoppingListener(testInputProvider, 100, 0.015f));

		// bpt.addEventListener(new FFNBPCalculationEventListener());

		// train
		bpt.train();

		// test
		bpt.test();

		assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
	}

	@Ignore
	@Test
	public void testMLPSigmoidBPCSVReader()
	{
		// create the network
		NeuralNetworkImpl mlp = CalculationFactory.mlpSigmoid(new int[] { 4, 2, 3 }, true);

		// training and testing data providers
		String inputPath = Thread.currentThread().getContextClassLoader().getResource("IRISinput.txt").getPath();
		String targetPath = Thread.currentThread().getContextClassLoader().getResource("IRIStarget.txt").getPath();

		TrainingInputProviderImpl trainInputProvider = new CSVInputProvider(new File(inputPath), new File(targetPath));
		trainInputProvider.addInputModifier(new ScalingInputFunction());

		TrainingInputProviderImpl testInputProvider = new CSVInputProvider(new File(inputPath), new File(targetPath));
		testInputProvider.addInputModifier(new ScalingInputFunction());

		OutputError outputError = new MultipleNeuronsOutputError();

		// trainer
		BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(mlp, trainInputProvider, testInputProvider, outputError, new NNRandomInitializer(
				new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f), 0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);

		// log data
		bpt.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		// early stopping
		//bpt.addEventListener(new EarlyStoppingListener(testInputProvider, 0.015f));

		// train
		bpt.train();

		// test
		bpt.test();

		assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
	}

//    @Test
//    public void testMaxout() {
//	// execution mode
//	Environment.getInstance().setExecutionMode(EXECUTION_MODE.SEQ);
//	Environment.getInstance().setUseWeightsSharedMemory(true);
//
//	// create the network
//	NeuralNetworkImpl mlp = NNFactory.maxout(new int[] { 4, 2, 3 }, false, OperationsFactory.softmaxFunction());
//
//	// training and testing data providers
//	IrisInputProvider trainInputProvider = new IrisInputProvider(new IrisTargetMultiNeuronOutputConverter(), false);
//	trainInputProvider.addInputModifier(new ScalingInputFunction(trainInputProvider));
//	IrisInputProvider testInputProvider = new IrisInputProvider(new IrisTargetMultiNeuronOutputConverter(), false);
//	testInputProvider.addInputModifier(new ScalingInputFunction(testInputProvider));
//	OutputError outputError = new MultipleNeuronsOutputError();
//
//	// trainer
//	BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(mlp, trainInputProvider, testInputProvider, outputError, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.001f, 0.001f), 0.5f), 0.01f, 0.7f, 0f, 0f, 0f, 1, 1, 1000);
//
//	// log data
//	bpt.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));
//
//	// early stopping
//	//bpt.addEventListener(new EarlyStoppingListener(testInputProvider, 100, 0.015f));
//
//	// train
//	bpt.train();
//
//	// test
//	bpt.test();
//
//	assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
//    }

	/**
	 * Contrastive Divergence testing
	 */
	@Test
	@Ignore
	public void testRBMCDSigmoidBP()
	{
		// RBM with 4 visible and 3 hidden units
		RBM rbm = NNFactory.rbm(4, 3, true);

		// training and testing input providers
		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());
		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());
		MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

		// trainers
		CDTrainerBase t = TrainerFactory.cdSigmoidBinaryTrainer(rbm, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.01f,
				0.5f, 0f, 0f, 1, 1, 100, true);

		// log data
		t.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		// training
		t.train();

		// training
		t.test();

		// 2 of the iris classes are linearly not separable - an error of 2/3 illustrates that
		assertEquals(0, t.getOutputError().getTotalNetworkError(), 2 / 3f);
	}

	/**
	 * DBN testing
	 */
	@Test
	@Ignore
	public void testDBN()
	{
		// deep belief network with two rbms - 4-4 and 4-3 with biases
		DBN dbn = NNFactory.dbn(new int[] { 4, 4, 3 }, true);
		assertEquals(2, dbn.getNeuralNetworks().size(), 0);

		dbn.setLayerCalculator(CalculationFactory.lcSigmoid(dbn, null));

		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());

		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());

		// rbm trainers for each layer
		CDTrainerBase firstTrainer = TrainerFactory.cdSigmoidBinaryTrainer(dbn.getFirstNeuralNetwork(), null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)),
				0.01f, 0.5f, 0f, 0f, 1, 150, 1000, true);
		CDTrainerBase lastTrainer = TrainerFactory.cdSigmoidBinaryTrainer(dbn.getLastNeuralNetwork(), null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f)),
				0.01f, 0.5f, 0f, 0f, 1, 150, 1000, true);

		Map<NeuralNetwork, OneStepTrainer<?>> map = new HashMap<>();
		map.put(dbn.getFirstNeuralNetwork(), firstTrainer);
		map.put(dbn.getLastNeuralNetwork(), lastTrainer);

		// deep trainer
		DBNTrainer deepTrainer = TrainerFactory.dbnTrainer(dbn, map, trainInputProvider, null, null);

		// layer pre-training
		deepTrainer.train();

		// fine tuning backpropagation
		BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(dbn, trainInputProvider, testInputProvider, new MultipleNeuronsOutputError(), new NNRandomInitializer(
				new MersenneTwisterRandomInitializer(-0.01f, 0.01f)), 0.01f, 0.5f, 0f, 0f, 0f, 150, 150, 1000);

		// log data
		bpt.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		// training
		bpt.train();

		// testing
		bpt.test();

		assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
	}

	@Test
	@Ignore
	public void testAE()
	{
		Autoencoder ae = CalculationFactory.autoencoderSigmoid(4, 3, true);

		// training, testing and error
		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());

		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());

		MultipleNeuronsOutputError error = new MultipleNeuronsOutputError();

		// backpropagation autoencoder training
		BackPropagationAutoencoder bae = TrainerFactory.backPropagationAutoencoder(ae, trainInputProvider, testInputProvider, error, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f,
				0.01f)), 0.02f, 0.7f, 0f, 0f, 0f, 1, 1, 100);

		// log data to console
		bae.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		bae.train();

		// the output layer is needed only during the training phase...
		ae.removeLayer(ae.getOutputLayer());

		bae.test();

		// 2 of the iris classes are linearly not separable - an error of 1/3 illustrates that
		assertEquals(0, bae.getOutputError().getTotalNetworkError(), 2 / 3f);
	}

	@Test
	@Ignore
	public void testSAE()
	{
		// create stacked autoencoder with input layer of size 4, hidden layer of the first AE with size 4 and hidden layer of the second AE with size 3
		StackedAutoencoder sae = CalculationFactory.saeSigmoid(new int[] { 4, 4, 3 }, true);

		// data and error providers
		IrisInputProvider trainInputProvider = new IrisInputProvider();
		trainInputProvider.addInputModifier(new ScalingInputFunction());

		IrisInputProvider testInputProvider = new IrisInputProvider();
		testInputProvider.addInputModifier(new ScalingInputFunction());

		// stacked networks
		Autoencoder firstNN = sae.getFirstNeuralNetwork();
		firstNN.setLayerCalculator(CalculationFactory.lcSigmoid(firstNN, null));

		Autoencoder lastNN = sae.getLastNeuralNetwork();
		lastNN.setLayerCalculator(CalculationFactory.lcSigmoid(lastNN, null));

		// trainers for each of the stacked networks
		BackPropagationAutoencoder firstTrainer = TrainerFactory.backPropagationAutoencoder(firstNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f),
				0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);
		BackPropagationAutoencoder secondTrainer = TrainerFactory.backPropagationAutoencoder(lastNN, null, null, null, new NNRandomInitializer(new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f),
				0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);

		Map<NeuralNetwork, OneStepTrainer<?>> map = new HashMap<>();
		map.put(firstNN, firstTrainer);
		map.put(lastNN, secondTrainer);

		// deep trainer
		DNNLayerTrainer deepTrainer = TrainerFactory.dnnLayerTrainer(sae, map, trainInputProvider, testInputProvider, null);

		// layerwise pre-training
		deepTrainer.train();

		// fine tuning backpropagation
		BackPropagationTrainer<?> bpt = TrainerFactory.backPropagation(sae, trainInputProvider, testInputProvider, new MultipleNeuronsOutputError(), new NNRandomInitializer(
				new MersenneTwisterRandomInitializer(-0.01f, 0.01f), 0.5f), 0.02f, 0.7f, 0f, 0f, 0f, 150, 1, 2000);

		// log data
		bpt.addEventListener(new LogTrainingListener(Thread.currentThread().getStackTrace()[1].getMethodName()));

		bpt.train();
		bpt.test();

		assertEquals(0, bpt.getOutputError().getTotalNetworkError(), 0.1);
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
  <bool name="is_nougat_mr1">false</bool>
</resources>


text:
/**
* Package for calculate test task.
*
* @author Artem Khizhniakov (mailto:artem_khizhniakov@mail.ru).
* @version $Id$.
* @since 12.09.2017.
*/
package ru.job4j;


text:
from Plex import *

letter = Range("AZaz")
digit = Range("09")
name = letter + Rep(letter | digit)
number = Rep1(digit)
space = Any(" \t\n")

class MyScanner(Scanner):

  def begin_comment(self, text):
    if self.nesting_level == 0:
      self.begin('comment')
    self.nesting_level = self.nesting_level + 1

  def end_comment(self, text):
    self.nesting_level = self.nesting_level - 1
    if self.nesting_level == 0:
      self.begin('')

  lexicon = Lexicon([
    (name,          'ident'),
    (number,        'int'),
    (space,         IGNORE),
    (Str("(*"),     begin_comment),
    State('comment', [
      (Str("(*"),   begin_comment),
      (Str("*)"),   end_comment),
      (AnyChar,     IGNORE)
    ])
  ])

  def __init__(self, file, name):
    Scanner.__init__(self, self.lexicon, file, name)
    self.nesting_level = 0

filename = "example7.in"
f = open(filename, "r")
scanner = MyScanner(f, filename)
while 1:
  token = scanner.read()
  print token
  if token[0] is None:
    break


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Psecadia umbrina Bonord.

### Remarks
null


text:
( function() {

  var includes = {}; // Setup container for all the includes we'll be using in node.
  var settings = null; // Hold server settings.
  var secrets = null; // Hold server secrets.

  var settingsFile = "settings.json";
  var secretsFile = "secrets.json";

  var setupDependencies = function(dependencies) {
    includes.express = require('express');
    includes.app = includes.express();
    includes.http = require('http').Server(includes.app);

    includes.settingsController = require("./includes/settingsController.js");
    includes.dbController = require("./includes/dbController.js");
    includes.apiCallbacks = require("./includes/apiCallbacks.js");
    includes.httpServerController = require("./includes/httpServerController.js");
    includes.apiController = require("./includes/apiController.js");
    includes.fs = require('fs');
    includes.mongoDBClient = require('mongodb').MongoClient;
    includes.bodyParser = require('body-parser');

  };

  var init = function () {
    includes.settingsController = includes.settingsController(includes, settings, -1); //Instantiate settings controller
    includes.settingsController.init();

    settings = includes.settingsController.readSettings(settingsFile); //Load settings from settings file.
    secrets = includes.settingsController.readSettings(secretsFile); //Load settings from settings file

    if (!settings) { //Exit if settings are not loaded.
      console.log("Error: Couldn't read settings file. ");
      console.log("Exiting... ");
      process.exit(1);
    }

  };

  var setupServer = function() {

    includes.apiCallbacks = includes.apiCallbacks(includes, settings, settings.server.consoleLevel); // API Callbacks
    includes.apiCallbacks.init();

    includes.apiController = includes.apiController(includes, settings, settings.server.consoleLevel); //Instantiate api controller
    includes.apiController.init();

    includes.dbController = includes.dbController(includes, settings, settings.server.consoleLevel, secrets); //Database controller
    includes.dbController.init();

    includes.httpServerController = includes.httpServerController(includes, settings, settings.server.consoleLevel);
    includes.httpServerController.init();
    includes.httpServerController.startListening();

  };

  // Start all the things
  setupDependencies(includes);
  init();
  setupServer();

})();


text:
set -x

make k8s-pods
make k8s-save-artifacts

# cleanup
make k8s-reset


text:
from morphforge.simulation.base.result.simulationresult import SimulationResult

__all__ = ['SimulationResult']


text:
using System;
using Hardcore.Application;
using Hardcore.Logging;

namespace Hardcore.ApplicationModel
{

    /// <summary>
    /// Represents application business logic layer
    /// </summary>
    public class BizLogicLayer : ApplicationLayer
    {
        /// <summary>
        /// Provides abilities to log business events
        /// </summary>
        protected BizLog BizLog { get; private set; }

        /// <summary>
        /// Gets application service
        /// </summary>
        protected AppService App { get; private set; }

        /// <summary>
        /// Override to initialize layer resources
        /// </summary>
        protected override void OnInitialize(LayerInitializationContext context)
        {
            base.OnInitialize(context);
            BizLog = new BizLog(Log);
            App = context.ServiceProvider.Provide<AppService>(false);
        }
    }

    /// <summary>
    /// Represents application business logic layer
    /// </summary>
    public abstract class BizLogicLayer<TDal> : BizLogicLayer
        where TDal : DalLayer
    {
        /// <summary>
        /// Gets or sets DAL layer
        /// </summary>
        protected TDal Dal { get; set; }

        /// <summary>
        /// Override to sets underline layer
        /// </summary>
        protected override void OnSetUnderlineLayer(ApplicationLayer layer)
        {
            Dal = layer as TDal;

            if (Dal == null && layer != null)
                throw new NotSupportedException($"Only '{typeof(TDal).FullName}' based layer classes are supported");
        }
    }
}


text:
namespace Entity.Model
{
    using System;
    using System.Collections.Generic;

    public partial class HotelDictionary
    {
        public HotelDictionary()
        {
            this.TP_Lists = new HashSet<TP_Lists>();
        }

        public int HD_CNKEY { get; set; }
        public int HD_CTKEY { get; set; }
        public int HD_KEY { get; set; }
        public string HD_NAME { get; set; }
        public string HD_STARS { get; set; }
        public string HD_ADDRESS { get; set; }
        public string HD_PHONE { get; set; }
        public string HD_FAX { get; set; }
        public Nullable<short> HD_SITE { get; set; }
        public string HD_DESCRIPT { get; set; }
        public string HD_PERSONNAME { get; set; }
        public string HD_PERSONAPP { get; set; }
        public string HD_CODE { get; set; }
        public Nullable<int> HD_RSKEY { get; set; }
        public string HD_EMAIL { get; set; }
        public string HD_HTTP { get; set; }
        public string HD_DESCROOM { get; set; }
        public string HD_DESCMEAL { get; set; }
        public string HD_DESCSERVICE { get; set; }
        public string HD_DESCSPORT { get; set; }
        public string HD_DESCEXCUR { get; set; }
        public string HD_DESCHEALTH { get; set; }
        public Nullable<double> HD_DISTANCE { get; set; }
        public Nullable<int> HD_WEB { get; set; }
        public string HD_DESCRAZVL { get; set; }
        public string HD_WEBIMAGE { get; set; }
        public string HD_WEBIMAGE1 { get; set; }
        public string HD_WEBIMAGE2 { get; set; }
        public string HD_WEBIMAGE3 { get; set; }
        public string HD_WEBIMAGE4 { get; set; }
        public string HD_WEBIMAGE5 { get; set; }
        public string HD_WEBIMAGE6 { get; set; }
        public string HD_WEBIMAGE7 { get; set; }
        public string HD_WEBIMAGE8 { get; set; }
        public string HD_REMARK { get; set; }
        public string HD_REMARK1 { get; set; }
        public string HD_REMARK2 { get; set; }
        public string HD_REMARK3 { get; set; }
        public string HD_REMARK4 { get; set; }
        public string HD_REMARK5 { get; set; }
        public string HD_REMARK6 { get; set; }
        public string HD_REMARK7 { get; set; }
        public string HD_REMARK8 { get; set; }
        public byte[] ROWID { get; set; }
        public string HD_StdKey { get; set; }
        public string HD_UNICODE { get; set; }
        public System.DateTime HD_UPDATEDATE { get; set; }
        public Nullable<int> HD_Order { get; set; }
        public int HD_IsCruise { get; set; }
        public Nullable<int> HD_COHId { get; set; }
        public string HD_NAMELAT { get; set; }
        public Nullable<System.DateTime> HD_PayHour1 { get; set; }
        public Nullable<System.DateTime> HD_PayHour2 { get; set; }
        public string HD_Travel { get; set; }
        public string HD_PayHourNote { get; set; }
        public Nullable<int> hd_rank { get; set; }
        public string HD_HTTPAdditional { get; set; }

        public virtual CategoriesOfHotel CategoriesOfHotel { get; set; }
        public virtual CityDictionary CityDictionary { get; set; }
        public virtual ICollection<TP_Lists> TP_Lists { get; set; }
    }
}


text:
using StructureMap;
using <%=assemblyName%>.Contract;

namespace <%=assemblyName%>.Common
{
    public class ContainerRegistry : Registry
    {
        public ContainerRegistry()
        {
            For<ICryptoService>().Use<CryptoHelper>();
        }
    }
}


text:
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Globalization;
using System.Linq;
using Abp.Collections.Extensions;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using Abp.Localization.Dictionaries;
using Abp.Runtime.Caching;
using Abp.Runtime.Session;

namespace Abp.Localization
{
    /// <summary>
    /// Implements <see cref="IMultiTenantLocalizationDictionary"/>.
    /// </summary>
    public class MultiTenantLocalizationDictionary :
        IMultiTenantLocalizationDictionary
    {
        private readonly string _sourceName;
        private readonly ILocalizationDictionary _internalDictionary;
        private readonly IRepository<ApplicationLanguageText, long> _customLocalizationRepository;
        private readonly ICacheManager _cacheManager;
        private readonly IAbpSession _session;
        private readonly IUnitOfWorkManager _unitOfWorkManager;

        /// <summary>
        /// Initializes a new instance of the <see cref="MultiTenantLocalizationDictionary"/> class.
        /// </summary>
        public MultiTenantLocalizationDictionary(
            string sourceName,
            ILocalizationDictionary internalDictionary,
            IRepository<ApplicationLanguageText, long> customLocalizationRepository,
            ICacheManager cacheManager,
            IAbpSession session,
            IUnitOfWorkManager unitOfWorkManager)
        {
            _sourceName = sourceName;
            _internalDictionary = internalDictionary;
            _customLocalizationRepository = customLocalizationRepository;
            _cacheManager = cacheManager;
            _session = session;
            _unitOfWorkManager = unitOfWorkManager;
        }

        public CultureInfo CultureInfo { get { return _internalDictionary.CultureInfo; } }

        public string this[string name]
        {
            get { return _internalDictionary[name]; }
            set { _internalDictionary[name] = value; }
        }

        public LocalizedString GetOrNull(string name)
        {
            return GetOrNull(_session.TenantId, name);
        }

        public LocalizedString GetOrNull(int? tenantId, string name)
        {
            //Get cache
            var cache = _cacheManager.GetMultiTenantLocalizationDictionaryCache();

            //Get for current tenant
            var dictionary = cache.Get(CalculateCacheKey(tenantId), () => GetAllValuesFromDatabase(tenantId));
            var value = dictionary.GetOrDefault(name);
            if (value != null)
            {
                return new LocalizedString(name, value, CultureInfo);
            }

            //Fall back to host
            if (tenantId != null)
            {
                dictionary = cache.Get(CalculateCacheKey(null), () => GetAllValuesFromDatabase(null));
                value = dictionary.GetOrDefault(name);
                if (value != null)
                {
                    return new LocalizedString(name, value, CultureInfo);
                }
            }

            //Not found in database, fall back to internal dictionary
            var internalLocalizedString = _internalDictionary.GetOrNull(name);
            if (internalLocalizedString != null)
            {
                return internalLocalizedString;
            }

            //Not found at all
            return null;
        }

        public IReadOnlyList<LocalizedString> GetAllStrings()
        {
            return GetAllStrings(_session.TenantId);
        }

        public IReadOnlyList<LocalizedString> GetAllStrings(int? tenantId)
        {
            //Get cache
            var cache = _cacheManager.GetMultiTenantLocalizationDictionaryCache();

            //Create a temp dictionary to build (by underlying dictionary)
            var dictionary = new Dictionary<string, LocalizedString>();

            foreach (var localizedString in _internalDictionary.GetAllStrings())
            {
                dictionary[localizedString.Name] = localizedString;
            }

            //Override by host
            if (tenantId != null)
            {
                var defaultDictionary = cache.Get(CalculateCacheKey(null), () => GetAllValuesFromDatabase(null));
                foreach (var keyValue in defaultDictionary)
                {
                    dictionary[keyValue.Key] = new LocalizedString(keyValue.Key, keyValue.Value, CultureInfo);
                }
            }

            //Override by tenant
            var tenantDictionary = cache.Get(CalculateCacheKey(tenantId), () => GetAllValuesFromDatabase(tenantId));
            foreach (var keyValue in tenantDictionary)
            {
                dictionary[keyValue.Key] = new LocalizedString(keyValue.Key, keyValue.Value, CultureInfo);
            }

            return dictionary.Values.ToImmutableList();
        }

        private string CalculateCacheKey(int? tenantId)
        {
            return MultiTenantLocalizationDictionaryCacheHelper.CalculateCacheKey(tenantId, _sourceName, CultureInfo.Name);
        }

        [UnitOfWork]
        protected virtual Dictionary<string, string> GetAllValuesFromDatabase(int? tenantId)
        {
            using (_unitOfWorkManager.Current.SetTenantId(tenantId))
            {
                return _customLocalizationRepository
                    .GetAllList(l => l.Source == _sourceName && l.LanguageName == CultureInfo.Name)
                    .ToDictionary(l => l.Key, l => l.Value);
            }
        }
    }
}


text:
/**
 * @author Kim, Khen Gi
 * @version $Revision: 1.7 $
 */
package org.apache.harmony.harness.synchannel;

import java.util.HashMap;
import java.io.IOException;
import java.net.Socket;

/**
 * SyncChannelPool is used for registration of connected clients to the
 * Synchronization Channel Server. Is implemented as HashMap of HashMap's. At
 * the first level HashMap keys are Group names of the clients, values are
 * HashMap's, where keys are unique Ids of the clients and values are Sockets of
 * the connected clients.
 */
class SyncChannelClientPool {

    /**
     * HashMap keys - Group names, values - Hash map, where keys - unique
     * client's Ids in this Group, values - Client's Socket
     */
    private HashMap client_pool = new HashMap();

    private int     unique_id   = 0;

    /**
     * Adds the client to the Synchronization Channel Pool. If Id of the client
     * is not unique, it will not be added to the Pool, false will be returned.
     *
     * @param name The Group name of the connected client.
     * @param socket The Synchronization Channel Server side Socket for this
     *        client.
     * @return The unique Id for the connected client.
     */
    protected int add(String name, Socket socket) {
        synchronized (client_pool) {
            HashMap client;
            unique_id++;
            if (client_pool.containsKey(name)) {
                client = (HashMap)client_pool.get(name);
            } else {
                client = new HashMap();
            }
            client.put(new Integer(unique_id), socket);
            client_pool.put(name, client);
            return unique_id;
        }
    }

    /**
     * Gets the Synchronization Channel Server side Socket for client.
     *
     * @param name The Group name of the connected client.
     * @param internal_id The Id of the client.
     * @return The Synchronization Channel Server side Socket of the client with
     *         given Group name and Id or null, if client with given Id is not
     *         connected to the Server.
     */
    protected Socket getClient(String name, Integer internal_id) {
        synchronized (client_pool) {
            HashMap client;
            if (client_pool.containsKey(name)) {
                client = (HashMap)client_pool.get(name);
                if (client.containsKey(internal_id)) {
                    return (Socket)client.get(internal_id);
                }
            }
            return null;
        }
    }

    /**
     * Gets the array of Synchronization Channel Server side Sockets for group
     * of clients.
     *
     * @param name The Group name of the connected clients.
     * @return The array of the Synchronization Channel Server side Sockets of
     *         the clients with given Group name. or null, if there is no any
     *         connected clients with given Group name.
     */
    protected Socket[] getClientsInGroup(String name) {
        synchronized (client_pool) {
            HashMap client;
            if (client_pool.containsKey(name)) {
                client = (HashMap)client_pool.get(name);
                return (Socket[])client.values().toArray(new Socket[0]);
            }
            return null;
        }
    }

    /**
     * Gets the array of Ids for group of clients.
     *
     * @param name The Group name of the connected clients.
     * @return The array of the Ids of the clients with given Group name. or
     *         null, if there is no any connected clients with given Group name.
     */
    protected Integer[] getIdInGroup(String name) {
        synchronized (client_pool) {
            HashMap client;
            if (client_pool.containsKey(name)) {
                client = (HashMap)client_pool.get(name);
                return (Integer[])client.keySet().toArray(new Integer[0]);
            }
            return null;
        }
    }

    /**
     * Gets the array of the Group names of connected clients.
     *
     * @return The array of the Group names of connected clients.
     */
    protected String[] getGroups() {
        synchronized (client_pool) {
            return (String[])client_pool.keySet().toArray(new String[0]);
        }
    }

    /**
     * Count of Groups in the Synchronization Channel Pool.
     *
     * @return The count of Groups in the Synchronization Channel Pool.
     */
    protected int cnGroups() {
        synchronized (client_pool) {
            return client_pool.size();
        }
    }

    /**
     * Count of clients in the Group.
     *
     * @param name The Group name of the connected clients.
     * @return The count of clients in the Group.
     */
    protected int cnClientsInGroup(String name) {
        synchronized (client_pool) {
            if (client_pool.containsKey(name)) {
                return ((HashMap)client_pool.get(name)).size();
            } else {
                return 0;
            }
        }
    }

    /**
     * Removes the client from the Synchronization Channel Pool.
     *
     * @param name The Group name of the connected clients.
     * @param internal_id The Id of the client.
     * @return The Synchronization Channel Server side Socket of the client with
     *         given Group name and Id or null, if client with given Group name
     *         and Id is not connected to the Server.
     */
    protected Socket remove(String name, Integer internal_id) {
        synchronized (client_pool) {
            HashMap client;
            Socket res;
            if (client_pool.containsKey(name)) {
                client = (HashMap)client_pool.get(name);
                if (client.containsKey(internal_id)) {
                    res = (Socket)client.remove(internal_id);
                    try {
                        res.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    if (client.isEmpty()) {
                        client_pool.remove(name);
                    } else {
                        client_pool.put(name, client);
                    }
                    return res;
                } else
                    return null;
            } else
                return null;
        }
    }

    /**
     * Removes (disconnects) all clients from the Synchronization Channel Pool.
     */
    protected void removeAll() {
        synchronized (client_pool) {
            Integer[] keys = (Integer[])client_pool.keySet().toArray();
            int size = keys.length;
            unique_id = 0;
            try {
                for (int i = 0; i < size; i++) {
                    ((Socket)client_pool.get(keys[i])).close();
                    client_pool.remove(keys[i]);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}


text:
module Clockwork
  class SMS

    # @author James Inman <james@mediaburst.co.uk>
    # A Clockwork::SMS::Response is returned for each SMS sent by Clockwork::SMS#deliver.
    class Response

      # @!attribute error_code
      # The error code returned if the SMS fails.
      # @return [string]
      attr_accessor :error_code

      # @!attribute error_description
      # The error description returned if the SMS fails.
      # @return [string]
      attr_accessor :error_description

      # @!attribute message_id
      # The message ID returned if the SMS is sent successfully.
      # @return [string]
      attr_accessor :message_id

      # @!attribute message
      # The instance of Clockwork::SMS relating to this response.
      # @return [Clockwork::SMS]
      attr_accessor :message

      # @!attribute success
      # +true+ if the SMS is sent successfully, +false+ otherwise.
      # @return [boolean]
      attr_accessor :success

      def error_code
        @error_code.to_i unless @error_code.nil?
      end

    end
  end
end


text:
seo:
  title: Category Statistics Comparison
  description: Compare statistics from your SendGrid email categories.
  keywords: compare category statistics, SendGrid compare category statistics, category statistic comparison
title: Category Comparison
weight: 0
layout: page
navigation:
  show: true
---

{% info %}
Parent accounts will see aggregated stats for their account and all subuser accounts. Subuser accounts will only see their own stats.
{% endinfo %}

Categories can help organize your email analytics by enabling you to "tag" emails by type. As a result, you may want to compare one category to another. The category comparison tool allows you to do this.

{% anchor h2 %}
Select Your Categories
{% endanchor %}

You can compare up to 10 categories at a time. To select them, click the "+" sign next to each category name in the left-side list. Then, click the "Compare" button.

{% anchor h2 %}
Comparison Overview
{% endanchor %}

Once you have selected the categories, your top most graph will show you how each selected category has fared for each individual metric in a single graph. Each category will be assigned a color in this bar chart.

You can remove individual categories from the list of categories you selected initially, by clicking the "Categories" button and unchecking categories. The graph will refresh, showing only the selected categories.

You can change which metrics, date, or grouping by adjusting the [statistics filters]({{root_url}}/User_Guide/Statistics/index.html#-Statistics-Filters).

{% anchor h2 %}
Individual Metrics Comparison
{% endanchor %}

When you initially choose the categories to compare, this graph will be titled "Comparison for Deliveries" and will show you the delivery rates over time for each of the compared categories.

You can remove individual categories from the list of categories you selected initially, by clicking the "Categories" button and unchecking categories. The graph will refresh, showing only the selected categories.

To change this graph to see another metric for your categories, click the button next to the Categories button and choose another metric.

{% anchor h2 %}
Individual Metrics Figures
{% endanchor %}

When you initially choose the categories to compare, this table will be titled "Figures for Delivered" and will show you the actual delivery numbers over time for each of the compared categories.

You can remove individual categories from the list of categories you selected initially, by clicking the "Categories" button and unchecking categories. The graph will refresh, showing only the selected categories.

To change this graph to see another metric, click the button inline with the graph title and choose another metric.

You can also choose to show actual counts or percentages, by clicking the corresponding button above and to the right of the table.


text:
package org.ojalgo.matrix.store.operation;

public class Copy extends MatrixOperation {

    private Copy() {
        super();
    }

    @Override
    public int threshold() {
        // TODO Auto-generated method stub
        return 0;
    }

    public static void invoke(final double[] source, final int sourceOffset, final double[] destination, final int destinationOffset, final int first,
            final int limit) {
        for (int i = first; i < limit; i++) {
            destination[destinationOffset + i] = source[sourceOffset + i];
        }

    }

}


text:
@interface IDEIndex : NSObject

- (id)allSymbolsMatchingNames:(id)arg1 kind:(id)arg2;
- (BOOL)_reopenDatabaseWithRemoval:(BOOL)arg1;

@end

@interface IDEWorkspace : NSObject

@property(retain) IDEIndex *index;

- (void)didCreateIndex:(id)arg1;

@end

@interface IDEIndexCollection : NSObject <NSFastEnumeration>
@end

@interface IDEIndexSymbolOccurrence : NSObject

@property (nonatomic, readonly) DVTFilePath *file;

@end

@interface IDEIndexSymbol : IDEIndexSymbolOccurrence

@property(readonly, nonatomic) NSString *name;
@property(readonly, nonatomic) DVTSourceCodeSymbolKind *symbolKind;
@property(readonly, nonatomic) NSString *resolution;
@property(readonly, nonatomic) IDEIndexCollection *definitions;
@property(readonly, nonatomic, getter=isInProject) BOOL inProject;

- (id)file;
- (id)occurrences;

@end

@interface IDEIndexCallableSymbol : IDEIndexSymbol

- (id)containerSymbol;
- (id)returnType;
- (unsigned long long)numArguments;

@end

@interface IDEIndexContainerSymbol : IDEIndexSymbol

- (id)children;

@end

@interface IDEIndexClassSymbol : IDEIndexContainerSymbol

- (id)categories;

@end

@interface IDEIndexCategorySymbol : IDEIndexContainerSymbol

- (id)relatedClass;

@end


text:
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/queue.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <time.h>

#include <rte_keepalive.h>

#include <shm.h>

#define MAX_TIMEOUTS 4
#define SEM_TIMEOUT_SECS 2

static struct rte_keepalive_shm *ka_shm_create(void)
{
	int fd = shm_open(RTE_KEEPALIVE_SHM_NAME, O_RDWR, 0666);
	size_t size = sizeof(struct rte_keepalive_shm);
	struct rte_keepalive_shm *shm;

	if (fd < 0)
		printf("Failed to open %s as SHM:%s\n",
			RTE_KEEPALIVE_SHM_NAME,
		strerror(errno));
	else {
		shm = (struct rte_keepalive_shm *) mmap(
			0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
		close(fd);
		if (shm == MAP_FAILED)
			printf("Failed to mmap SHM:%s\n", strerror(errno));
		else
			return shm;
	}

	/* Reset to zero, as it was set to MAP_FAILED aka: (void *)-1 */
	shm = 0;
	return NULL;
}

int main(void)
{
	struct rte_keepalive_shm *shm = ka_shm_create();
	struct timespec timeout = { .tv_nsec = 0 };
	int idx_core;
	int cnt_cores;
	uint64_t last_seen_alive_time = 0;
	uint64_t most_recent_alive_time;
	int cnt_timeouts = 0;
	int sem_errno;

	if (shm == NULL) {
		printf("Unable to access shared core state\n");
		return 1;
	}
	while (1) {
		most_recent_alive_time = 0;
		for (idx_core = 0; idx_core < RTE_KEEPALIVE_MAXCORES;
				idx_core++)
			if (shm->core_last_seen_times[idx_core] >
					most_recent_alive_time)
				most_recent_alive_time =
					shm->core_last_seen_times[idx_core];

		timeout.tv_sec = time(NULL) + SEM_TIMEOUT_SECS;
		if (sem_timedwait(&shm->core_died, &timeout) == -1) {
			/* Assume no core death signals and no change in any
			 * last-seen times is the keepalive monitor itself
			 * failing.
			 */
			sem_errno = errno;
			last_seen_alive_time = most_recent_alive_time;
			if (sem_errno == ETIMEDOUT) {
				if (last_seen_alive_time ==
						most_recent_alive_time &&
						cnt_timeouts++ >
						MAX_TIMEOUTS) {
					printf("No updates. Exiting..\n");
					break;
					}
			} else
				printf("sem_timedwait() error (%s)\n",
					strerror(sem_errno));
			continue;
		}
		cnt_timeouts = 0;

		cnt_cores = 0;
		for (idx_core = 0; idx_core < RTE_KEEPALIVE_MAXCORES;
				idx_core++)
			if (shm->core_state[idx_core] == RTE_KA_STATE_DEAD)
				cnt_cores++;
		if (cnt_cores == 0) {
			/* Can happen if core was restarted since Semaphore
			 * was sent, due to agent being offline.
			 */
			printf("Warning: Empty dead core report\n");
			continue;
		}

		printf("%i dead cores: ", cnt_cores);
		for (idx_core = 0;
				idx_core < RTE_KEEPALIVE_MAXCORES;
				idx_core++)
			if (shm->core_state[idx_core] == RTE_KA_STATE_DEAD)
				printf("%d, ", idx_core);
		printf("\b\b\n");
	}
	if (munmap(shm, sizeof(struct rte_keepalive_shm)) != 0)
		printf("Warning: munmap() failed\n");
	return 0;
}