text:
bool scrape_cmdline = false;

bool parseArgs(int argc, char* argv[])
{
	Utils::FileSystem::setExePath(argv[0]);

	// We need to process --home before any call to Settings::getInstance(), because settings are loaded from homepath
	for(int i = 1; i < argc; i++)
	{
		if(strcmp(argv[i], "--home") == 0)
		{
			if(i >= argc - 1)
			{
				std::cerr << "Invalid home path supplied.";
				return false;
			}

			Utils::FileSystem::setHomePath(argv[i + 1]);
			break;
		}
	}

	for(int i = 1; i < argc; i++)
	{
		if(strcmp(argv[i], "--resolution") == 0)
		{
			if(i >= argc - 2)
			{
				std::cerr << "Invalid resolution supplied.";
				return false;
			}

			int width = atoi(argv[i + 1]);
			int height = atoi(argv[i + 2]);
			i += 2; // skip the argument value
			Settings::getInstance()->setInt("WindowWidth", width);
			Settings::getInstance()->setInt("WindowHeight", height);
		}else if(strcmp(argv[i], "--screensize") == 0)
		{
			if(i >= argc - 2)
			{
				std::cerr << "Invalid screensize supplied.";
				return false;
			}

			int width = atoi(argv[i + 1]);
			int height = atoi(argv[i + 2]);
			i += 2; // skip the argument value
			Settings::getInstance()->setInt("ScreenWidth", width);
			Settings::getInstance()->setInt("ScreenHeight", height);
		}else if(strcmp(argv[i], "--screenoffset") == 0)
		{
			if(i >= argc - 2)
			{
				std::cerr << "Invalid screenoffset supplied.";
				return false;
			}

			int x = atoi(argv[i + 1]);
			int y = atoi(argv[i + 2]);
			i += 2; // skip the argument value
			Settings::getInstance()->setInt("ScreenOffsetX", x);
			Settings::getInstance()->setInt("ScreenOffsetY", y);
		}else if (strcmp(argv[i], "--screenrotate") == 0)
		{
			if (i >= argc - 1)
			{
				std::cerr << "Invalid screenrotate supplied.";
				return false;
			}

			int rotate = atoi(argv[i + 1]);
			++i; // skip the argument value
			Settings::getInstance()->setInt("ScreenRotate", rotate);
		}else if(strcmp(argv[i], "--gamelist-only") == 0)
		{
			Settings::getInstance()->setBool("ParseGamelistOnly", true);
		}else if(strcmp(argv[i], "--ignore-gamelist") == 0)
		{
			Settings::getInstance()->setBool("IgnoreGamelist", true);
		}else if(strcmp(argv[i], "--show-hidden-files") == 0)
		{
			Settings::getInstance()->setBool("ShowHiddenFiles", true);
		}else if(strcmp(argv[i], "--draw-framerate") == 0)
		{
			Settings::getInstance()->setBool("DrawFramerate", true);
		}else if(strcmp(argv[i], "--no-exit") == 0)
		{
			Settings::getInstance()->setBool("ShowExit", false);
		}else if(strcmp(argv[i], "--no-confirm-quit") == 0)
		{
			Settings::getInstance()->setBool("ConfirmQuit", false);
		}else if(strcmp(argv[i], "--no-splash") == 0)
		{
			Settings::getInstance()->setBool("SplashScreen", false);
		}else if(strcmp(argv[i], "--debug") == 0)
		{
			Settings::getInstance()->setBool("Debug", true);
			Settings::getInstance()->setBool("HideConsole", false);
			Log::setReportingLevel(LogDebug);
		}else if(strcmp(argv[i], "--fullscreen-borderless") == 0)
		{
			Settings::getInstance()->setBool("FullscreenBorderless", true);
		}else if(strcmp(argv[i], "--windowed") == 0)
		{
			Settings::getInstance()->setBool("Windowed", true);
		}else if(strcmp(argv[i], "--vsync") == 0)
		{
			bool vsync = (strcmp(argv[i + 1], "on") == 0 || strcmp(argv[i + 1], "1") == 0) ? true : false;
			Settings::getInstance()->setBool("VSync", vsync);
			i++; // skip vsync value
		}else if(strcmp(argv[i], "--scrape") == 0)
		{
			scrape_cmdline = true;
		}else if(strcmp(argv[i], "--max-vram") == 0)
		{
			int maxVRAM = atoi(argv[i + 1]);
			Settings::getInstance()->setInt("MaxVRAM", maxVRAM);
		}
		else if (strcmp(argv[i], "--force-kiosk") == 0)
		{
			Settings::getInstance()->setBool("ForceKiosk", true);
		}
		else if (strcmp(argv[i], "--force-kid") == 0)
		{
			Settings::getInstance()->setBool("ForceKid", true);
		}
		else if (strcmp(argv[i], "--force-disable-filters") == 0)
		{
			Settings::getInstance()->setBool("ForceDisableFilters", true);
		}
		else if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0)
		{
#ifdef WIN32
			// This is a bit of a hack, but otherwise output will go to nowhere
			// when the application is compiled with the "WINDOWS" subsystem (which we usually are).
			// If you're an experienced Windows programmer and know how to do this
			// the right way, please submit a pull request!
			AttachConsole(ATTACH_PARENT_PROCESS);
			freopen("CONOUT$", "wb", stdout);
#endif
			std::cout <<
				"EmulationStation, a graphical front-end for ROM browsing.\n"
				"Written by Alec \"Aloshi\" Lofquist.\n"
				"Version " << PROGRAM_VERSION_STRING << ", built " << PROGRAM_BUILT_STRING << "\n"
				"Command line arguments:\n"
				"\nGeometry settings:\n"
				"--resolution WIDTH HEIGHT      try and force a particular resolution\n"
				"--screenrotate N               rotate a quarter turn clockwise for each N\n"
				"--screensize WIDTH HEIGHT      for a canvas smaller than the full resolution,\n"
				"                               or if rotating into portrait mode\n"
				"--screenoffset X Y             move the canvas by x,y pixels\n"
				"--windowed                     not fullscreen, should be used with --resolution\n"
				"\nGame and settings visibility in ES and behaviour of ES:\n"
				"--force-disable-filters        force the UI to ignore applied filters on\n"
				"                               gamelist (p)\n"
				"--force-kid                    force the UI mode to be Kid\n"
				"--force-kiosk                  force the UI mode to be Kiosk\n"
				"--no-confirm-quit              omit confirm dialog on actions of quit menu\n"
				"--no-exit                      don't show the exit option in the menu\n"
				"--no-splash                    don't show the splash screen\n"
				"\nGamelist related:\n"
				"--gamelist-only                use gamelist.xml as trusted source and do not\n"
				"                               check any path entries of gamelist.xml (p)\n"
				"--ignore-gamelist              do not read gamelist.xml files (useful for\n"
				"                               troubleshooting)\n"
				"\nAdvanced settings:\n"
				"--debug                        more logging, show console on Windows. Enables\n"
				"                               these keyboard shortcuts with left CTRL-key:\n"
				"                               +G: Toggle Gridlayout boundary boxes\n"
				"                               +I: Toggle image boundary box\n"
				"                               +R: Reload all UI views (theme, gamelist, system)\n"
				"                               +T: Toggle textcomponent boundary box\n"
				"--draw-framerate               display the framerate (p)\n"
				"--max-vram SIZE                maximum VRAM to use in MB before swapping,\n"
				"                               use 0 for unlimited (p)\n"
				"--show-hidden-files            show also hidden files of filesystem, no effect\n"
				"                               if --gamelist-only is also set (p)\n"
				"--vsync 1|0                    turn vsync on (1) or off (0) (default is on)\n"
				"\nGeneric switches:\n"
				"--help, -h                     summon a sentient, angry tuba\n\n"
				"--home PATH                    directory to use as home folder for\n"
				"                               .emulationstation/es_settings.cfg, aso.\n"
				"                               Subfolder .emulationstation/ will be created.\n"
				"\nScrape mode:\n"
				"--scrape                       scrape using command line interface\n\n"
				"Note: Switches marked (p) will be persisted in es_settings.cfg when any\n"
				"setting is changed via EmulationStation UI.\n\n"
				"Please refer to the online documentation for additional information:\n"
				"https://retropie.org.uk/docs/EmulationStation/\n";
			return false; //exit after printing help
		}
	}

	return true;
}

bool verifyHomeFolderExists()
{
	//make sure the config directory exists
	std::string home = Utils::FileSystem::getHomePath();
	std::string configDir = home + "/.emulationstation";
	if(!Utils::FileSystem::exists(configDir))
	{
		std::cout << "Creating config directory \"" << configDir << "\"\n";
		Utils::FileSystem::createDirectory(configDir);
		if(!Utils::FileSystem::exists(configDir))
		{
			std::cerr << "Config directory could not be created!\n";
			return false;
		}
	}

	return true;
}

// Returns true if everything is OK,
bool loadSystemConfigFile(Window* window, const char** errorString)
{
	*errorString = NULL;

	if(!SystemData::loadConfig(window))
	{
		LOG(LogError) << "Error while parsing systems configuration file!";
		*errorString = "IT LOOKS LIKE YOUR SYSTEMS CONFIGURATION FILE HAS NOT BEEN SET UP OR IS INVALID. YOU'LL NEED TO DO THIS BY HAND, UNFORTUNATELY.\n\n"
			"VISIT EMULATIONSTATION.ORG FOR MORE INFORMATION.";
		return false;
	}

	if(SystemData::sSystemVector.size() == 0)
	{
		LOG(LogError) << "No systems found! Does at least one system have a game present? (check that extensions match!)\n(Also, make sure you've updated your es_systems.cfg for XML!)";
		*errorString = "WE CAN'T FIND ANY SYSTEMS!\n"
			"CHECK THAT YOUR PATHS ARE CORRECT IN THE SYSTEMS CONFIGURATION FILE, "
			"AND YOUR GAME DIRECTORY HAS AT LEAST ONE GAME WITH THE CORRECT EXTENSION.\n\n"
			"VISIT EMULATIONSTATION.ORG FOR MORE INFORMATION.";
		return false;
	}

	return true;
}

//called on exit, assuming we get far enough to have the log initialized
void onExit()
{
	Log::close();
}

int main(int argc, char* argv[])
{
	std::locale::global(std::locale("C"));

	if(!parseArgs(argc, argv))
		return 0;

	// only show the console on Windows if HideConsole is false
#ifdef WIN32
	// MSVC has a "SubSystem" option, with two primary options: "WINDOWS" and "CONSOLE".
	// In "WINDOWS" mode, no console is automatically created for us.  This is good,
	// because we can choose to only create the console window if the user explicitly
	// asks for it, preventing it from flashing open and then closing.
	// In "CONSOLE" mode, a console is always automatically created for us before we
	// enter main. In this case, we can only hide the console after the fact, which
	// will leave a brief flash.
	// TL;DR: You should compile ES under the "WINDOWS" subsystem.
	// I have no idea how this works with non-MSVC compilers.
	if(!Settings::getInstance()->getBool("HideConsole"))
	{
		// we want to show the console
		// if we're compiled in "CONSOLE" mode, this is already done.
		// if we're compiled in "WINDOWS" mode, no console is created for us automatically;
		// the user asked for one, so make one and then hook stdin/stdout/sterr up to it
		if(AllocConsole()) // should only pass in "WINDOWS" mode
		{
			freopen("CONIN$", "r", stdin);
			freopen("CONOUT$", "wb", stdout);
			freopen("CONOUT$", "wb", stderr);
		}
	}else{
		// we want to hide the console
		// if we're compiled with the "WINDOWS" subsystem, this is already done.
		// if we're compiled with the "CONSOLE" subsystem, a console is already created;
		// it'll flash open, but we hide it nearly immediately
		if(GetConsoleWindow()) // should only pass in "CONSOLE" mode
			ShowWindow(GetConsoleWindow(), SW_HIDE);
	}
#endif

	// call this ONLY when linking with FreeImage as a static library
#ifdef FREEIMAGE_LIB
	FreeImage_Initialise();
#endif

	//if ~/.emulationstation doesn't exist and cannot be created, bail
	if(!verifyHomeFolderExists())
		return 1;

	//start the logger
	Log::init();
	Log::open();
	LOG(LogInfo) << "EmulationStation - v" << PROGRAM_VERSION_STRING << ", built " << PROGRAM_BUILT_STRING;

	//always close the log on exit
	atexit(&onExit);

	Window window;
	SystemScreenSaver screensaver(&window);
	PowerSaver::init();
	ViewController::init(&window);
	CollectionSystemManager::init(&window);
	MameNames::init();
	window.pushGui(ViewController::get());

	bool splashScreen = Settings::getInstance()->getBool("SplashScreen");

	if(!scrape_cmdline)
	{
		if(!window.init())
		{
			LOG(LogError) << "Window failed to initialize!";
			return 1;
		}

		if (splashScreen)
		{
			std::string progressText = "Loading system config...";
			window.renderLoadingScreen(progressText);
		}
	}

	const char* errorMsg = NULL;
	if(!loadSystemConfigFile(splashScreen ? &window : nullptr, &errorMsg))
	{
		// something went terribly wrong
		if(errorMsg == NULL)
		{
			LOG(LogError) << "Unknown error occured while parsing system config file.";
			if(!scrape_cmdline)
				Renderer::deinit();
			return 1;
		}

		// we can't handle es_systems.cfg file problems inside ES itself, so display the error message then quit
		window.pushGui(new GuiMsgBox(&window,
			errorMsg,
			"QUIT", [] {
				SDL_Event* quit = new SDL_Event();
				quit->type = SDL_QUIT;
				SDL_PushEvent(quit);
			}));
	}

	//run the command line scraper then quit
	if(scrape_cmdline)
	{
		return run_scraper_cmdline();
	}

	// preload what we can right away instead of waiting for the user to select it
	// this makes for no delays when accessing content, but a longer startup time
	ViewController::get()->preload();

	if(splashScreen)
		window.renderLoadingScreen("Done.");

	InputManager::getInstance()->init();

	//choose which GUI to open depending on if an input configuration already exists
	if(errorMsg == NULL)
	{
		if(Utils::FileSystem::exists(InputManager::getConfigPath()) && InputManager::getInstance()->getNumConfiguredDevices() > 0)
		{
			ViewController::get()->goToStart();
		}else{
			window.pushGui(new GuiDetectDevice(&window, true, [] { ViewController::get()->goToStart(); }));
		}
	}

	int lastTime = SDL_GetTicks();
	int ps_time = SDL_GetTicks();

	bool running = true;

	while(running)
	{
		SDL_Event event;
		bool ps_standby = PowerSaver::getState() && (int) SDL_GetTicks() - ps_time > PowerSaver::getMode();

		if(ps_standby ? SDL_WaitEventTimeout(&event, PowerSaver::getTimeout()) : SDL_PollEvent(&event))
		{
			do
			{
				InputManager::getInstance()->parseEvent(event, &window);

				if(event.type == SDL_QUIT)
					running = false;
			} while(SDL_PollEvent(&event));

			// triggered if exiting from SDL_WaitEvent due to event
			if (ps_standby)
				// show as if continuing from last event
				lastTime = SDL_GetTicks();

			// reset counter
			ps_time = SDL_GetTicks();
		}
		else if (ps_standby)
		{
			// If exitting SDL_WaitEventTimeout due to timeout. Trail considering
			// timeout as an event
			ps_time = SDL_GetTicks();
		}

		if(window.isSleeping())
		{
			lastTime = SDL_GetTicks();
			SDL_Delay(1); // this doesn't need to be accurate, we're just giving up our CPU time until something wakes us up
			continue;
		}

		int curTime = SDL_GetTicks();
		int deltaTime = curTime - lastTime;
		lastTime = curTime;

		// cap deltaTime if it ever goes negative
		if(deltaTime < 0)
			deltaTime = 1000;

		window.update(deltaTime);
		window.render();
		Renderer::swapBuffers();

		Log::flush();
	}

	while(window.peekGui() != ViewController::get())
		delete window.peekGui();

	InputManager::getInstance()->deinit();
	window.deinit();

	MameNames::deinit();
	CollectionSystemManager::deinit();
	SystemData::deleteSystems();

	// call this ONLY when linking with FreeImage as a static library
#ifdef FREEIMAGE_LIB
	FreeImage_DeInitialise();
#endif

	processQuitMode();

	ProfileDump();

	LOG(LogInfo) << "EmulationStation cleanly shutting down.";

	return 0;
}


text:
namespace Farmhand.Installers.Utilities
{
    internal enum PackageType
    {
        DeveloperFull,
        DeveloperLite,
        Player
    }
}

redpajama_set_name: RedPajamaGithub


text:
riot.tag2('confirm', '

 {opts.question}
 <button onclick="{yes}">Yes</button> <button onclick="{no}">No</button>

', 'confirm,[data-is="confirm"]{ position:absolute; top:50%; width: 100%; } confirm .outerwrap,[data-is="confirm"] .outerwrap{ text-align: center; } confirm .wrap,[data-is="confirm"] .wrap{ background-color: #fff; display:inline-block; padding: 1rem; border: 1px solid #cecece; }', '', function(opts) {
	this.observable = opts.observable;
	this.id = opts.id;

	this.yes = function(){
		this.observable.trigger('yes',this.id);
		this.unmount(true);
	}.bind(this)
	this.no = function(){

		this.unmount(true);
	}.bind(this)

});


text:
package org.apache.hadoop.mapred;

import java.io.*;
import java.security.PrivilegedExceptionAction;

import junit.framework.TestCase;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.mapred.lib.IdentityMapper;
import org.apache.hadoop.mapred.lib.IdentityReducer;
import org.apache.hadoop.mapreduce.JobSubmissionFiles;
import org.apache.hadoop.mapreduce.protocol.ClientProtocol;
import org.apache.hadoop.mapreduce.split.JobSplitWriter;
import org.apache.hadoop.mapreduce.split.JobSplit.SplitMetaInfo;
import org.apache.hadoop.security.*;

/**
 * A JUnit test to test Mini Map-Reduce Cluster with Mini-DFS.
 */
public class TestMiniMRWithDFSWithDistinctUsers extends TestCase {
  static final UserGroupInformation DFS_UGI = createUGI("dfs", true);
  static final UserGroupInformation PI_UGI = createUGI("pi", false);
  static final UserGroupInformation WC_UGI = createUGI("wc", false);

  static UserGroupInformation createUGI(String name, boolean issuper) {
    String group = issuper? "supergroup": name;

    return UserGroupInformation.createUserForTesting(name, new String[]{group});
  }

  static void mkdir(FileSystem fs, String dir) throws IOException {
    Path p = new Path(dir);
    fs.mkdirs(p);
    fs.setPermission(p, new FsPermission((short)0777));
  }

  // runs a sample job as a user (ugi)
  RunningJob runJobAsUser(final JobConf job, UserGroupInformation ugi)
  throws Exception {
    ClientProtocol jobSubmitClient =
      TestSubmitJob.getJobSubmitClient(job, ugi);
    org.apache.hadoop.mapreduce.JobID id = jobSubmitClient.getNewJobID();

    InputSplit[] splits = computeJobSplit(JobID.downgrade(id), job);
    final Path jobSubmitDir = new Path(id.toString());
    FileSystem fs = ugi.doAs(new PrivilegedExceptionAction<FileSystem>() {
      public FileSystem run() throws IOException {
        return jobSubmitDir.getFileSystem(job);
      }
    });
    Path qJobSubmitDir = jobSubmitDir.makeQualified(fs);
    uploadJobFiles(JobID.downgrade(id), splits, qJobSubmitDir, ugi, job);

    jobSubmitClient.submitJob(id, qJobSubmitDir.toString(), null);

    JobClient jc = new JobClient(job);
    return jc.getJob(JobID.downgrade(id));
  }

  // a helper api for split computation
  private InputSplit[] computeJobSplit(JobID id, JobConf conf)
  throws IOException {
    InputSplit[] splits =
      conf.getInputFormat().getSplits(conf, conf.getNumMapTasks());
    conf.setNumMapTasks(splits.length);
    return splits;
  }

  // a helper api for split submission
  private void uploadJobFiles(JobID id, InputSplit[] splits,
                             Path jobSubmitDir, UserGroupInformation ugi,
                             final JobConf conf)
  throws Exception {
    final Path confLocation = JobSubmissionFiles.getJobConfPath(jobSubmitDir);
    FileSystem fs = ugi.doAs(new PrivilegedExceptionAction<FileSystem>() {
      public FileSystem run() throws IOException {
        return confLocation.getFileSystem(conf);
      }
    });
    JobSplitWriter.createSplitFiles(jobSubmitDir, conf, fs, splits);
    FsPermission perm = new FsPermission((short)0700);

    // localize conf
    DataOutputStream confOut = FileSystem.create(fs, confLocation, perm);
    conf.writeXml(confOut);
    confOut.close();
  }

  public void testDistinctUsers() throws Exception {
    MiniMRCluster mr = null;
    Configuration conf = new Configuration();
    final MiniDFSCluster dfs = new MiniDFSCluster(conf, 4, true, null);
    try {

      FileSystem fs = DFS_UGI.doAs(new PrivilegedExceptionAction<FileSystem>() {
        public FileSystem run() throws IOException {
          return dfs.getFileSystem();
        }
      });
      mkdir(fs, "/user");
      mkdir(fs, "/mapred");

      UserGroupInformation MR_UGI = UserGroupInformation.getLoginUser();
      mr = new MiniMRCluster(0, 0, 4, dfs.getFileSystem().getUri().toString(),
           1, null, null, MR_UGI);
      String jobTrackerName = "localhost:" + mr.getJobTrackerPort();

      JobConf job1 = mr.createJobConf();
      String input = "The quick brown fox\nhas many silly\n"
                     + "red fox sox\n";
      Path inDir = new Path("/testing/distinct/input");
      Path outDir = new Path("/testing/distinct/output");
      TestMiniMRClasspath.configureWordCount(fs, jobTrackerName, job1,
                                             input, 2, 1, inDir, outDir);
      runJobAsUser(job1, PI_UGI);

      JobConf job2 = mr.createJobConf();
      Path inDir2 = new Path("/testing/distinct/input2");
      Path outDir2 = new Path("/testing/distinct/output2");
      TestMiniMRClasspath.configureWordCount(fs, jobTrackerName, job2,
                                             input, 2, 1, inDir2, outDir2);
      runJobAsUser(job2, WC_UGI);
    } finally {
      if (dfs != null) { dfs.shutdown(); }
      if (mr != null) { mr.shutdown();}
    }
  }

  public void testRestartWithDistinctUsers() {

  }
}


text:
					 Gestionar Empleados

		<form class="form-horizontal" role="form" action="<?php echo base_url() ?>abms/abmEmpleadosC/mostrarTablaEmpleados" method="post">

							Mostrar Tipo Empleado
							<select aria-controls="dynamic-table" class="form-control input-sm" name="tipoTabla" OnChange= "tipoROnChange(this)">
								<option value="1">Todos</option>

								<option value="3">Administrador de Usuarios</option>
								<option value="4">Referente</option>
								<option value="5">Coordinador</option>
								<option value="6">Facilitador</option>
							</select>

							Nº Legajo:
								<input type="search" class="form-control input-sm" placeholder="" name="nroLegajo" aria-controls="dynamic-table">

							<button class="btn btn-warning btn-xs" type="submit" nombre="CargarTabla">

							</button>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )  break;
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 $contador++;}
								}
							?>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )    break;
											if($tabla->nombreTipoE == "Facilitador"){
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 				}
									$contador++; }
								}
							?>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )    break;
											if($tabla->nombreTipoE == "Referente"){
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 				}
									$contador++; }
								}
							?>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )    break;
											if($tabla->nombreTipoE == "Coordinador"){
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 				}
									$contador++; }
								}
							?>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )    break;
											if($tabla->nombreTipoE == "Administrador"){
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 				}
									$contador++; }
								}
							?>

									Apellido y Nombre
									N° Legajo
									Nº Documento
									Teléfono
									E-Mail
									Convenio
									Tipo Empleado

											<a class="orange" href="<?php echo base_url() ?>abms/abmEmpleadosC/cargarNuevoEmpleado">
												Agregar Empleado

							<?php //Limitar los datos segun lo que trae el select de cantidad de lineas a mostrar
								if ($tablaEmpleados){
									$contador = 0;

									foreach($tablaEmpleados->result() as $tabla){
										if( $contador == $limiteTabla )    break;
											if($tabla->nombreTipoE == "Administrador de Usuarios"){
							?>

										<?php echo $tabla->apellidoE; ?> <?php echo $tabla->nombreE; ?>

								<?= $tabla->nroLegajo;?>
								<?= $tabla->dni;?>
								<?= $tabla->telefono;?>
								<?= $tabla->email;?>
								<?= $tabla->convenio;?>
								<?= $tabla->nombreTipoE;?>

											<a class="green" href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>">

											<a class="red" href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>">

												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

												</button>

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/editarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-success" data-rel="tooltip" title="Edit">

														<a href="<?php echo base_url()?>abms/abmEmpleadosC/borrarEmpleado/<?= $tabla->idEmpleado;?>" class="tooltip-error" data-rel="tooltip" title="Delete">

							<?php	 				}
									$contador++; }
								}
							?>

		</form>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>PSLAtomicPropositionsSwitch</title>
<meta name="date" content="2014-08-17">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.osate.xtext.aadl2.agcl.analysis.visitors.concrete

Class PSLAtomicPropositionsSwitch

java.lang.Object

org.eclipse.emf.ecore.util.Switch<T>

org.osate.xtext.aadl2.agcl.agcl.util.AgclSwitch<T>

org.osate.xtext.aadl2.agcl.analysis.visitors.AgclProcessingSwitch<java.util.Set<org.osate.xtext.aadl2.agcl.agcl.AtomicProposition>>

org.osate.xtext.aadl2.agcl.analysis.visitors.concrete.PSLAtomicPropositionsSwitch

public class PSLAtomicPropositionsSwitch
extends AgclProcessingSwitch<java.util.Set<org.osate.xtext.aadl2.agcl.agcl.AtomicProposition>>

This switch obtains the set of atomic propositions in a PSL expression.

Author:

Ernesto Posse

Nested Class Summary

Nested Classes

Modifier and Type
Class and Description

class
PSLAtomicPropositionsSwitch.AtomicPropStructEqWrap

Constructor Summary

Constructors

Constructor and Description

PSLAtomicPropositionsSwitch()

Method Summary

Methods

Modifier and Type
Method and Description

java.util.Set<org.osate.xtext.aadl2.agcl.agcl.AtomicProposition>
caseAtomicProposition(org.osate.xtext.aadl2.agcl.agcl.AtomicProposition obj)

Methods inherited from class org.osate.xtext.aadl2.agcl.analysis.visitors.AgclProcessingSwitch

getResults, processPreOrderAll

Methods inherited from class org.osate.xtext.aadl2.agcl.agcl.util.AgclSwitch

caseAGCLAnnexLibrary, caseAGCLAnnexSubclause, caseAGCLAssumption, caseAGCLBehaviour, caseAGCLContract, caseAGCLEnforce, caseAGCLGrammarRoot, caseAGCLGuarantee, caseAGCLPropertyDecl, caseAGCLViewpoint, caseAnnexLibrary, caseAnnexSubclause, caseBooleanConstant, caseElement, caseInput, caseModalElement, caseNamedElement, caseOutput, caseParameter, casePSLAlways, casePSLBiconditional, casePSLConjunction, casePSLDisjunction, casePSLEventually, casePSLExpression, casePSLImplication, casePSLNegation, casePSLNext, casePSLSpec, casePSLUntil, caseVar, defaultCase

Methods inherited from class org.eclipse.emf.ecore.util.Switch

doSwitch

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

PSLAtomicPropositionsSwitch

public PSLAtomicPropositionsSwitch()

Method Detail

caseAtomicProposition

public java.util.Set<org.osate.xtext.aadl2.agcl.agcl.AtomicProposition> caseAtomicProposition(org.osate.xtext.aadl2.agcl.agcl.AtomicProposition obj)

Overrides:

caseAtomicProposition in class org.osate.xtext.aadl2.agcl.agcl.util.AgclSwitch<java.util.Set<org.osate.xtext.aadl2.agcl.agcl.AtomicProposition>>

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
"""Validation functions."""

__author__ = 'api.sgrinberg@gmail.com (Stan Grinberg)'

from adspygoogle.common.Errors import ValidationError

DEPRECATED_AFTER = {
    'UserListService': 'v201306',
    'AdExtensionOverrideService': 'v201306'
}

# A map of the supported servers for each version.
_VERSION_SERVER_MAP = {
    'v201306': ('https://adwords.google.com',),
    'v201309': ('https://adwords.google.com',),
}

def ValidateServer(server, version):
  """Sanity check for API server.

  Args:
    server: str API server to access for this API call.
    version: str API version being used to access the server.

  Raises:
    ValidationError: if the given API server or version is not valid.
  """
  if version not in _VERSION_SERVER_MAP:
    raise ValidationError(
        'Given API version, \'%s\', is not valid. Expecting one of %s.'
        % (version, sorted(_VERSION_SERVER_MAP.keys())))

  if server not in _VERSION_SERVER_MAP[version]:
    raise ValidationError(
        'Given API server, \'%s\', is not a valid server for version \'%s\'. '
        'Expecting one of %s.'
        % (server, version, sorted(_VERSION_SERVER_MAP[version])))

def ValidateService(service, version):
  """Checks if this service is available in the requested version.

  Args:
    service: str Service being requested.
    version: str Version being requested.
  """
  if service in DEPRECATED_AFTER and version > DEPRECATED_AFTER[service]:
    raise ValidationError('%s is not available in %s' % (service, version))


text:
package graphql.java.generator;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

@SuppressWarnings("serial")
public class ClassWithLists {
    public List<Integer> ints = new ArrayList<Integer>() {{
        add(0);
    }};
//    public List noTypeInfo = new ArrayList<Integer>() {{
//        add(0);
//    }};
    public ArrayList<String> strings = new ArrayList<String>() {{
        add("asdf");
        add("2");
        add("test");
    }};
    public LinkedList<SimpleObject> objects = new LinkedList<SimpleObject>() {{
        add(new SimpleObject());
        add(null);
        SimpleObject obj = new SimpleObject();
        obj.objIndex = 1;
        add(new SimpleObject());
        add(obj);
    }};
    public ArrayList<String> getStrings() {
        return strings;
    }
    public List<SimpleObject> getObjects() {
        return objects;
    }
    public List<Integer> getInts() {
        return ints;
    }
}


text:
using namespace sequoia;
using namespace sequoia::unittest;
using namespace sequoia::render;

namespace {

SEQUOIA_TESTCASEFIXTURE_TEMPLATE(GLVertexDataTest, RenderSetup);

using VertexTypes = testing::Types<BOOST_PP_SEQ_ENUM(SEQUOIA_VERTICES)>;
TYPED_TEST_CASE(GLVertexDataTest, VertexTypes);

/// @brief Create a GLVertexData and allocate space for `numVertices` and `numIndices`
template <class VertexDataType>
std::shared_ptr<GLVertexData> makeVertexData(std::size_t numVertices, std::size_t numIndices,
                                             bool useVertexShadowBuffer = true,
                                             bool useIndexShadowBuffer = true) {
  RenderSystem& rsys = RenderSystem::getSingleton();
  VertexDataParameter param(render::VertexData::DM_Triangles, VertexDataType::getLayout(),
                            numVertices, numIndices, Buffer::UH_StaticWriteOnly);
  param.UseVertexShadowBuffer = useVertexShadowBuffer;
  param.UseIndexShadowBuffer = useIndexShadowBuffer;
  auto vertexData = rsys.createVertexData(param);
  EXPECT_TRUE(core::isa<GLVertexData>(vertexData.get()));
  return core::dyn_pointer_cast<GLVertexData>(vertexData);
}

TYPED_TEST(GLVertexDataTest, Allocation) {
  std::shared_ptr<GLVertexData> gldata1 = makeVertexData<TypeParam>(32, 16);
  EXPECT_EQ(gldata1->getNumVertices(), 32);
  EXPECT_EQ(gldata1->getNumIndices(), 16);
  EXPECT_TRUE(gldata1->hasIndices());

  std::shared_ptr<GLVertexData> gldata2 = makeVertexData<TypeParam>(16, 0);
  EXPECT_EQ(gldata2->getNumVertices(), 16);
  EXPECT_EQ(gldata2->getNumIndices(), 0);
  EXPECT_FALSE(gldata2->hasIndices());
}

TYPED_TEST(GLVertexDataTest, VertexAttributes) {
  std::shared_ptr<GLVertexData> gldata = makeVertexData<TypeParam>(8, 8);
  const VertexLayout& layout = gldata->getVertexBuffer()->getLayout();

  gldata->bind();

  // Check Position attribute
  {
    GLint enabled;
    glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
    EXPECT_EQ(enabled, (GLint)layout.hasPosition());

    if(layout.hasPosition()) {
      GLint bufferID;
      glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
                          &bufferID);
      EXPECT_EQ(bufferID, gldata->getVAOID());

      GLenum type;
      glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
      EXPECT_EQ(type, GLVertexData::getGLType(layout.Position.Type));

      GLint normalized;
      glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,
                          &normalized);
      EXPECT_EQ(normalized, (GLint)layout.Position.Normalize);

      GLint size;
      glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
      EXPECT_EQ(size, layout.Position.NumElements);

      GLint stride;
      glGetVertexAttribiv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
      EXPECT_EQ(stride, layout.SizeOf);

      void* pointer;
      glGetVertexAttribPointerv(GLVertexAttribute::Position, GL_VERTEX_ATTRIB_ARRAY_POINTER,
                                &pointer);
      EXPECT_EQ((std::size_t)pointer, layout.Position.Offset);
    }
  }

  // Check Normal attribute
  {
    GLint enabled;
    glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
    EXPECT_EQ(enabled, (GLint)layout.hasNormal());

    if(layout.hasNormal()) {
      GLint bufferID;
      glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
                          &bufferID);
      EXPECT_EQ(bufferID, gldata->getVAOID());

      GLenum type;
      glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
      EXPECT_EQ(type, GLVertexData::getGLType(layout.Normal.Type));

      GLint normalized;
      glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,
                          &normalized);
      EXPECT_EQ(normalized, (GLint)layout.Normal.Normalize);

      GLint size;
      glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
      EXPECT_EQ(size, layout.Normal.NumElements);

      GLint stride;
      glGetVertexAttribiv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
      EXPECT_EQ(stride, layout.SizeOf);

      void* pointer;
      glGetVertexAttribPointerv(GLVertexAttribute::Normal, GL_VERTEX_ATTRIB_ARRAY_POINTER,
                                &pointer);
      EXPECT_EQ((std::size_t)pointer, layout.Normal.Offset);
    }
  }

  // Check TexCoord attribute
  {
    GLint enabled;
    glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
    EXPECT_EQ(enabled, (GLint)layout.hasTexCoord());

    if(layout.hasTexCoord()) {
      GLint bufferID;
      glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
                          &bufferID);
      EXPECT_EQ(bufferID, gldata->getVAOID());

      GLenum type;
      glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
      EXPECT_EQ(type, GLVertexData::getGLType(layout.TexCoord.Type));

      GLint normalized;
      glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,
                          &normalized);
      EXPECT_EQ(normalized, (GLint)layout.TexCoord.Normalize);

      GLint size;
      glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
      EXPECT_EQ(size, layout.TexCoord.NumElements);

      GLint stride;
      glGetVertexAttribiv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
      EXPECT_EQ(stride, layout.SizeOf);

      void* pointer;
      glGetVertexAttribPointerv(GLVertexAttribute::TexCoord, GL_VERTEX_ATTRIB_ARRAY_POINTER,
                                &pointer);
      EXPECT_EQ((std::size_t)pointer, layout.TexCoord.Offset);
    }
  }

  // Check Color attribute
  {
    GLint enabled;
    glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &enabled);
    EXPECT_EQ(enabled, (GLint)layout.hasColor());

    if(layout.hasColor()) {
      GLint bufferID;
      glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,
                          &bufferID);
      EXPECT_EQ(bufferID, gldata->getVAOID());

      GLenum type;
      glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_TYPE, &type);
      EXPECT_EQ(type, GLVertexData::getGLType(layout.Color.Type));

      GLint normalized;
      glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &normalized);
      EXPECT_EQ(normalized, (GLint)layout.Color.Normalize);

      GLint size;
      glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_SIZE, &size);
      EXPECT_EQ(size, layout.Color.NumElements);

      GLint stride;
      glGetVertexAttribiv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &stride);
      EXPECT_EQ(stride, layout.SizeOf);

      void* pointer;
      glGetVertexAttribPointerv(GLVertexAttribute::Color, GL_VERTEX_ATTRIB_ARRAY_POINTER, &pointer);
      EXPECT_EQ((std::size_t)pointer, layout.Color.Offset);
    }
  }

  gldata->unbind();
}

/// @brief Write to all vertex attributes the index of the vertex
static void writeVertex(VertexBuffer* buffer) {
  BufferGuard guard(buffer, Buffer::LO_Discard);

  const VertexLayout& layout = buffer->getLayout();
  const std::size_t numVertices = buffer->getNumVertices();

  VertexAdapter adapter(layout);
  Byte* vertexPtr = guard.getAsByte();

  for(std::size_t i = 0; i < numVertices; ++i, vertexPtr += layout.SizeOf) {
    adapter.clear();

    adapter.setPosition(math::vec4(i));
    adapter.setNormal(math::vec4(i));
    adapter.setTexCoord(math::vec4(i));
    adapter.setColor(Color(i, i, i, i));

    adapter.copyTo(vertexPtr);
  }
}

/// @brief Real all vertex attributes and check if each attribute contains the vertex index
static void readVertex(VertexBuffer* buffer) {
  BufferGuard guard(buffer, Buffer::LO_ReadOnly);

  const VertexLayout& layout = buffer->getLayout();
  const std::size_t numVertices = buffer->getNumVertices();

  VertexAdapter adapter(layout);
  Byte* vertexPtr = guard.getAsByte();

  for(std::size_t i = 0; i < numVertices; ++i, vertexPtr += layout.SizeOf) {
    adapter.copyFrom(vertexPtr);

    // Position
    auto position = adapter.getPosition();
    for(int j = 0; j < layout.Position.NumElements; ++j)
      EXPECT_FLOAT_EQ(position[j], i) << "Vertex index: " << i << ", Attribute: Position[" << j
                                      << "]";

    // Normal
    auto normal = adapter.getNormal();
    for(int j = 0; j < layout.Normal.NumElements; ++j)
      EXPECT_FLOAT_EQ(normal[j], i) << "Vertex index: " << i << ", Attribute: Normal[" << j << "]";

    // TexCoord
    auto texCoord = adapter.getTexCoord();
    for(int j = 0; j < layout.TexCoord.NumElements; ++j)
      EXPECT_FLOAT_EQ(texCoord[j], i) << "Vertex index: " << i << ", Attribute: TexCoord[" << j
                                      << "]";

    // Color
    auto color = adapter.getColor();
    for(int j = 0; j < Color::NumChannels; ++j)
      EXPECT_EQ(color[j], i) << "Vertex index: " << i << ", Attribute: Color[" << j << "]";
  }
}

TYPED_TEST(GLVertexDataTest, ReadAndWrite) {
  using IndexType = unsigned int;
  std::vector<IndexType> indices = {1, 2};

  {
    std::shared_ptr<GLVertexData> gldata = makeVertexData<TypeParam>(2, 2, true, true);

    // Vertices
    writeVertex(gldata->getVertexBuffer());
    readVertex(gldata->getVertexBuffer());

    // Indices
    gldata->getIndexBuffer()->write(indices.data(), 0, indices.size() * sizeof(IndexType));
    std::vector<unsigned int> indicesRef(2, 0);
    gldata->getIndexBuffer()->read(0, indices.size() * sizeof(IndexType), indicesRef.data());
    EXPECT_EQ(indices, indicesRef);
  }

  {
    std::shared_ptr<GLVertexData> gldata = makeVertexData<TypeParam>(2, 2, false, false);

    // Vertices
    writeVertex(gldata->getVertexBuffer());
    readVertex(gldata->getVertexBuffer());

    // Indices
    gldata->getIndexBuffer()->write(indices.data(), 0, indices.size() * sizeof(IndexType));
    std::vector<unsigned int> indicesRef(2, 0);
    gldata->getIndexBuffer()->read(0, indices.size() * sizeof(IndexType), indicesRef.data());
    EXPECT_EQ(indices, indicesRef);
  }
}

} // anonymous namespace


text:
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dma-debug.h>
#include <linux/gfp.h>
#include <linux/memblock.h>
#include <linux/export.h>
#include <linux/pci.h>
#include <asm/vio.h>
#include <asm/bug.h>
#include <asm/machdep.h>

/*
 * Generic direct DMA implementation
 *
 * This implementation supports a per-device offset that can be applied if
 * the address at which memory is visible to devices is not 0. Platform code
 * can set archdata.dma_data to an unsigned long holding the offset. By
 * default the offset is PCI_DRAM_OFFSET.
 */

void *dma_direct_alloc_coherent(struct device *dev, size_t size,
				dma_addr_t *dma_handle, gfp_t flag,
				struct dma_attrs *attrs)
{
	void *ret;
#ifdef CONFIG_NOT_COHERENT_CACHE
	ret = __dma_alloc_coherent(dev, size, dma_handle, flag);
	if (ret == NULL)
		return NULL;
	*dma_handle += get_dma_offset(dev);
	return ret;
#else
	struct page *page;
	int node = dev_to_node(dev);

	/* ignore region specifiers */
	flag  &= ~(__GFP_HIGHMEM);

	page = alloc_pages_node(node, flag, get_order(size));
	if (page == NULL)
		return NULL;
	ret = page_address(page);
	memset(ret, 0, size);
	*dma_handle = __pa(ret) + get_dma_offset(dev);

	return ret;
#endif
}

void dma_direct_free_coherent(struct device *dev, size_t size,
			      void *vaddr, dma_addr_t dma_handle,
			      struct dma_attrs *attrs)
{
#ifdef CONFIG_NOT_COHERENT_CACHE
	__dma_free_coherent(size, vaddr);
#else
	free_pages((unsigned long)vaddr, get_order(size));
#endif
}

int dma_direct_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
			     void *cpu_addr, dma_addr_t handle, size_t size,
			     struct dma_attrs *attrs)
{
	unsigned long pfn;

#ifdef CONFIG_NOT_COHERENT_CACHE
	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
	pfn = __dma_get_coherent_pfn((unsigned long)cpu_addr);
#else
	pfn = page_to_pfn(virt_to_page(cpu_addr));
#endif
	return remap_pfn_range(vma, vma->vm_start,
			       pfn + vma->vm_pgoff,
			       vma->vm_end - vma->vm_start,
			       vma->vm_page_prot);
}

static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
			     int nents, enum dma_data_direction direction,
			     struct dma_attrs *attrs)
{
	struct scatterlist *sg;
	int i;

	for_each_sg(sgl, sg, nents, i) {
		sg->dma_address = sg_phys(sg) + get_dma_offset(dev);
		sg->dma_length = sg->length;
		__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
	}

	return nents;
}

static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
				int nents, enum dma_data_direction direction,
				struct dma_attrs *attrs)
{
}

static int dma_direct_dma_supported(struct device *dev, u64 mask)
{
#ifdef CONFIG_PPC64
	/* Could be improved so platforms can set the limit in case
	 * they have limited DMA windows
	 */
	return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
#else
	return 1;
#endif
}

static u64 dma_direct_get_required_mask(struct device *dev)
{
	u64 end, mask;

	end = memblock_end_of_DRAM() + get_dma_offset(dev);

	mask = 1ULL << (fls64(end) - 1);
	mask += mask - 1;

	return mask;
}

static inline dma_addr_t dma_direct_map_page(struct device *dev,
					     struct page *page,
					     unsigned long offset,
					     size_t size,
					     enum dma_data_direction dir,
					     struct dma_attrs *attrs)
{
	BUG_ON(dir == DMA_NONE);
	__dma_sync_page(page, offset, size, dir);
	return page_to_phys(page) + offset + get_dma_offset(dev);
}

static inline void dma_direct_unmap_page(struct device *dev,
					 dma_addr_t dma_address,
					 size_t size,
					 enum dma_data_direction direction,
					 struct dma_attrs *attrs)
{
}

#ifdef CONFIG_NOT_COHERENT_CACHE
static inline void dma_direct_sync_sg(struct device *dev,
		struct scatterlist *sgl, int nents,
		enum dma_data_direction direction)
{
	struct scatterlist *sg;
	int i;

	for_each_sg(sgl, sg, nents, i)
		__dma_sync_page(sg_page(sg), sg->offset, sg->length, direction);
}

static inline void dma_direct_sync_single(struct device *dev,
					  dma_addr_t dma_handle, size_t size,
					  enum dma_data_direction direction)
{
	__dma_sync(bus_to_virt(dma_handle), size, direction);
}
#endif

struct dma_map_ops dma_direct_ops = {
	.alloc				= dma_direct_alloc_coherent,
	.free				= dma_direct_free_coherent,
	.mmap				= dma_direct_mmap_coherent,
	.map_sg				= dma_direct_map_sg,
	.unmap_sg			= dma_direct_unmap_sg,
	.dma_supported			= dma_direct_dma_supported,
	.map_page			= dma_direct_map_page,
	.unmap_page			= dma_direct_unmap_page,
	.get_required_mask		= dma_direct_get_required_mask,
#ifdef CONFIG_NOT_COHERENT_CACHE
	.sync_single_for_cpu 		= dma_direct_sync_single,
	.sync_single_for_device 	= dma_direct_sync_single,
	.sync_sg_for_cpu 		= dma_direct_sync_sg,
	.sync_sg_for_device 		= dma_direct_sync_sg,
#endif
};
EXPORT_SYMBOL(dma_direct_ops);

#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)

int dma_set_mask(struct device *dev, u64 dma_mask)
{
	struct dma_map_ops *dma_ops = get_dma_ops(dev);

	if (ppc_md.dma_set_mask)
		return ppc_md.dma_set_mask(dev, dma_mask);
	if ((dma_ops != NULL) && (dma_ops->set_dma_mask != NULL))
		return dma_ops->set_dma_mask(dev, dma_mask);
	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
		return -EIO;
	*dev->dma_mask = dma_mask;
	return 0;
}
EXPORT_SYMBOL(dma_set_mask);

u64 dma_get_required_mask(struct device *dev)
{
	struct dma_map_ops *dma_ops = get_dma_ops(dev);

	if (ppc_md.dma_get_required_mask)
		return ppc_md.dma_get_required_mask(dev);

	if (unlikely(dma_ops == NULL))
		return 0;

	if (dma_ops->get_required_mask)
		return dma_ops->get_required_mask(dev);

	return DMA_BIT_MASK(8 * sizeof(dma_addr_t));
}
EXPORT_SYMBOL_GPL(dma_get_required_mask);

static int __init dma_init(void)
{
	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
#ifdef CONFIG_PCI
	dma_debug_add_bus(&pci_bus_type);
#endif
#ifdef CONFIG_IBMVIO
	dma_debug_add_bus(&vio_bus_type);
#endif

       return 0;
}
fs_initcall(dma_init);


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <meta content="text/html; charset=CP850" http-equiv="Content-Type" />

  <title>File: ssh_helpers.rb [rhc-1.38.4 Documentation]</title>

  <link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet" />

Last Modified

2016-06-06 13:45:57 +0200

Requires

net/ssh

rhc/vendor/sshkey

httpclient

net/ssh/multi

Description

ssh_key_helpers.rb - methods to help manipulate ssh keys

Copyright 2012 Red Hat, Inc. and/or its affiliates.

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and

limitations under the License.


text:
import { combineReducers } from 'redux';
import TweetsReducer from './reducer_tweets';
import UsersReducer from './reducer_users';
import TweetReducer from './reducer_tweet';
import TokenReducer from './reducer_token';
import RepliesReducer from './reducer_replies';
import UsernamesReducer from './reducer_usernames';
import HashtagsReducer from './reducer_hashtags';

const rootReducer = combineReducers({
  tweets: TweetsReducer,
  users: UsersReducer,
  tweet: TweetReducer,
  token: TokenReducer,
  replies: RepliesReducer,
  usernames: UsernamesReducer,
  hashtags: HashtagsReducer,
});

export default rootReducer;


text:
<?php

/**
 * Class IsEntity
 */
class IsEntity extends \Entity\Entity
{
    /**
     * @var boolean
     */
    public $isTrue = true;
}


text:
#region Copyright & License

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

#endregion

using System;
using System.IO;
using Be.Stateless.Logging;
using Microsoft.BizTalk.Streaming;

namespace Be.Stateless.BizTalk.Streaming
{
	/// <summary>
	/// An eventing read-only stream replacement of <see cref="Microsoft.BizTalk.Streaming.EventingReadStream" /> that
	/// deterministically fires the <see cref="IProvideReadStreamEvents.AfterLastReadEvent"/> event.
	/// </summary>
	/// <remarks>
	/// <para>
	/// In short terms, this stream ensures that its contents is always exhausted and end-of-stream detection happens
	/// deterministically.
	/// </para>
	/// <para>
	/// In detailed terms, regardless of whether this stream's client will assume the end-of-stream has been reached as
	/// soon as a <see cref="Stream.Read"/> operation returns less bytes than the number of bytes requested, or whether
	/// it will only assume the end-of-stream has been reached once the <see cref="Stream.Read"/> operation returns zero
	/// (0) — which is, by the way, the officially documented way of being notified the end-of-stream has been
	/// reached — an <see cref="EventingReadStream"/> instance will always fire the <see
	/// cref="IProvideReadStreamEvents.AfterLastReadEvent"/> event as soon as the inner stream's end has been reached.
	/// </para>
	/// </remarks>
	public class EventingReadStream : Microsoft.BizTalk.Streaming.EventingReadStream
	{
		/// <summary>
		/// Construct an <see cref="EventingReadStream"/> instance wrapper around <paramref name="stream"/>.
		/// </summary>
		/// <param name="stream">
		/// The inner <see cref="Stream"/> to wrap.
		/// </param>
		public EventingReadStream(Stream stream)
		{
			if (stream == null) throw new ArgumentNullException("stream");
			InnerStream = stream;
		}

		/// <summary>
		/// When overridden in a derived class, gets a value indicating whether the current stream supports reading.
		/// </summary>
		/// <returns>
		/// true if the stream supports reading; otherwise, false.
		/// </returns>
		public override bool CanRead
		{
			get
			{
				try
				{
					ThrowIfDisposed();
					return InnerStream.CanRead;
				}
				catch (Exception exception)
				{
					if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
					throw;
				}
			}
		}

		/// <summary>
		/// When overridden in a derived class, gets a value indicating whether the current stream supports seeking.
		/// </summary>
		/// <returns>
		/// true if the stream supports seeking; otherwise, false.
		/// </returns>
		public override bool CanSeek
		{
			get
			{
				try
				{
					ThrowIfDisposed();
					// prevent messing around with current position and corrupt fired events while stream is still being read for the 1st time
					return ReadCompleted && InnerStream.CanSeek;
				}
				catch (Exception exception)
				{
					if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
					throw;
				}
			}
		}

		/// <summary>
		/// This property returns the inner stream length in bytes.
		/// </summary>
		/// <returns>
		/// A long value representing the length of the stream in bytes.
		/// </returns>
		/// <remarks>
		/// The <see cref="Length"/> will be computed while the stream is being read and will consequently only be
		/// available and known accurately once the whole stream has been exhausted. While being read, <see
		/// cref="Length"/> will therefore throw a <see cref="T:System.NotSupportedException"/> exception.
		/// </remarks>
		/// <exception cref="T:System.NotSupportedException">
		/// A class derived from Stream does not support seeking.
		/// </exception>
		/// <exception cref="T:System.ObjectDisposedException">
		/// Methods were called after the stream was closed.
		/// </exception>
		/// <seealso cref="InnerStream"/>
		/// <seealso cref="CanSeek"/>
		public override long Length
		{
			get
			{
				try
				{
					ThrowIfDisposed();
					if (!ReadCompleted && !CanSeek) throw new NotSupportedException();
					return _length;
				}
				catch (NotSupportedException)
				{
					// avoid logging in this case as Microsoft.BizTalk.Internal.MessagePart.GetSize() systematically calls
					// this getter without first calling CanSeek getter as is expected against any Stream-derived class.
					// see Microsoft.BizTalk.Messaging, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
					throw;
				}
				catch (Exception exception)
				{
					if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
					throw;
				}
			}
		}

		/// <summary>
		/// When overridden in a derived class, gets or sets the position within the current stream.
		/// </summary>
		/// <returns>
		/// The current position within the stream.
		/// </returns>
		/// <exception cref="T:System.NotSupportedException">The stream does not support seeking.</exception>
		public override long Position
		{
			get
			{
				try
				{
					ThrowIfDisposed();
					return InnerStream.Position;
				}
				catch (Exception exception)
				{
					if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
					throw;
				}
			}
			set
			{
				try
				{
					ThrowIfDisposed();
					// prevent messing around with current position and corrupt fired events (stream is still being read for the 1st time)
					if (!ReadCompleted)
						throw new InvalidOperationException(
							string.Format(
								"{0} is not seekable while its contents has not been read thoroughly.",
								typeof(EventingReadStream).Name));
					InnerStream.Position = value;
				}
				catch (Exception exception)
				{
					if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
					throw;
				}
			}
		}

		/// <summary>
		/// When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be
		/// written to the underlying device.
		/// </summary>
		public override void Flush()
		{
			throw new NotSupportedException();
		}

		/// <summary>
		/// When overridden in a derived class, reads a sequence of bytes from the current stream and advances the
		/// position within the stream by the number of bytes read.
		/// </summary>
		/// <returns>
		/// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that
		/// many bytes are not currently available, or zero (0) if the end of the stream has been reached.
		/// </returns>
		/// <param name="buffer">
		/// An array of bytes. When this method returns, the buffer contains the specified byte array with the values
		/// between <paramref name="offset"/> and (<paramref name="offset"/> + <paramref name="count"/> - 1) replaced by
		/// the bytes read from the current source.
		/// </param>
		/// <param name="offset">
		/// The zero-based byte offset in <paramref name="buffer"/> at which to begin storing the data read from the
		/// current stream.
		/// </param>
		/// <param name="count">
		/// The maximum number of bytes to be read from the current stream.
		/// </param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="buffer"/> is null.
		/// </exception>
		/// <exception cref="T:System.ArgumentOutOfRangeException">
		/// <paramref name="offset"/> or <paramref name="count"/> is negative.
		/// </exception>
		/// <exception cref="T:System.ArgumentException">
		/// The sum of <paramref name="offset"/> and <paramref name="count"/> is larger than the buffer length.
		/// </exception>
		/// <remarks>
		/// <see cref="Read"/> will always try to read as many bytes as requested to circumvent idiosyncratic clients that
		/// would fail to issue the required last extra call to <see cref="Read"/>, which would return zero (0), because
		/// that they assume that the end of the stream has been reached as soon as <see cref="Read"/> returns a total
		/// number of bytes read that is less than <paramref name="count"/>.
		/// </remarks>
		public override int Read(byte[] buffer, int offset, int count)
		{
			try
			{
				ThrowIfDisposed();
				if (offset + count > buffer.Length) throw new ArgumentException("The sum of offset and count is larger than the buffer length");

				// ensures there always is a call to base Microsoft.BizTalk.Streaming.EventingReadStream.Read() that returns 0
				// so that base EventingReadStream class behaves as expected and always fires its AfterLastReadEvent event
				int totalReadCount = 0, lastReadCount;
				do
				{
					lastReadCount = base.Read(buffer, offset + totalReadCount, count - totalReadCount);
					if (_logger.IsFineEnabled) _logger.FineFormat("Read {0} bytes from inner stream.", lastReadCount);
					totalReadCount += lastReadCount;
				}
				while (totalReadCount < count && 0 < lastReadCount);
				return totalReadCount;
			}
			catch (Exception exception)
			{
				if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
				throw;
			}
		}

		/// <summary>
		/// Delegates to <see cref="InnerStream"/>.
		/// </summary>
		/// <param name="buffer">
		/// An array of bytes. When this method returns, the buffer contains the specified byte array with the values
		/// between <paramref name="offset"/> and (<paramref name="offset"/> + <paramref name="count"/> - 1) replaced by
		/// the bytes read from the current source.
		/// </param>
		/// <param name="offset">
		/// The zero-based byte offset in <paramref name="buffer"/> at which to begin storing the data read from the
		/// current stream.
		/// </param>
		/// <param name="count">
		/// The maximum number of bytes to be read from the current stream.
		/// </param>
		/// <returns>
		/// The total number of bytes read into the buffer.
		/// </returns>
		protected override int ReadInternal(byte[] buffer, int offset, int count)
		{
			ThrowIfDisposed();
			var bytesReadCount = InnerStream.Read(buffer, offset, count);
			if (!ReadCompleted) _length += bytesReadCount;
			return bytesReadCount;
		}

		/// <summary>
		/// When overridden in a derived class, sets the position within the current stream.
		/// </summary>
		/// <returns>
		/// The new position within the current stream.
		/// </returns>
		/// <param name="offset">
		/// A byte offset relative to the <paramref name="origin"/> parameter.
		/// </param>
		/// <param name="origin">
		/// A value of type <see cref="T:System.IO.SeekOrigin"/> indicating the reference point used to obtain the new
		/// position.
		/// </param>
		public override long Seek(long offset, SeekOrigin origin)
		{
			try
			{
				ThrowIfDisposed();
				// prevent messing around with current position and corrupt fired events (stream is still being read for the 1st time)
				if (!ReadCompleted)
					throw new InvalidOperationException(
						string.Format(
							"{0} cannot be sought while its contents has not been read thoroughly.",
							typeof(EventingReadStream).Name));
				return InnerStream.Seek(offset, origin);
			}
			catch (Exception exception)
			{
				if (_logger.IsWarnEnabled) _logger.Warn(string.Format("{0} stream has encountered an error.", GetType()), exception);
				throw;
			}
		}

		/// <summary>
		/// When overridden in a derived class, sets the length of the current stream.
		/// </summary>
		/// <param name="value">
		/// The desired length of the current stream in bytes.
		/// </param>
		/// <exception cref="T:System.NotSupportedException">
		/// The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or
		/// console output.
		/// </exception>
		public override void SetLength(long value)
		{
			throw new NotSupportedException();
		}

		/// <summary>
		/// The wrapped inner <see cref="Stream"/>.
		/// </summary>
		protected Stream InnerStream { get; set; }

		protected override void Dispose(bool disposing)
		{
			if (_logger.IsDebugEnabled) _logger.DebugFormat("{0} is {1}.", typeof(EventingReadStream).Name, disposing ? "disposing" : "finalizing");
			if (disposing && InnerStream != null)
			{
				InnerStream.Dispose();
				InnerStream = null;
			}
			base.Dispose(disposing);
		}

		protected void ThrowIfDisposed()
		{
			if (InnerStream == null) throw new ObjectDisposedException(GetType().Name);
		}

		private static readonly ILog _logger = LogManager.GetLogger(typeof(EventingReadStream));
		private long _length;
	}
}


text:
require 'tabula_rasa/row'
require 'tabula_rasa/column'

module TabulaRasa
  class Base
    attr_reader :collection, :options

    delegate :content_tag, :cycle, :dom_id, :dom_class, :safe_join, to: :view

    def initialize(collection, view, options = {}, &block)
      raise ArgumentError, 'TabulaRasa only works on ActiveRecord Relation instances' unless collection.is_a?(ActiveRecord::Relation)
      @collection = collection
      @options = options
      @view = view
      @klass = collection.klass
      @column_collection = []
      yield self if block_given?
      ensure_row
    end

    def render
      return if column_collection.empty?
      content_tag :table, content, table_options
    end

    def column(*args, &block)
      @column_collection << Column.new(self, *args, &block)
    end

    def columns(*args)
      args.each do |arg|
        @column_collection << Column.new(self, arg)
      end
    end

    def row(options = {}, &block)
      raise ArgumentError, 'Row definition cannot be called more than once' if @row.present?
      @row = Row.new(self, options, &block)
    end

  private

    attr_reader :view, :klass, :column_collection

    def content
      safe_join [thead, tbody]
    end

    def thead
      content_tag :thead, options[:head] do
        content_tag :tr do
          safe_join column_collection.map(&:head_content)
        end
      end
    end

    def tbody
      content_tag :tbody, options[:body] do
        collection.present? ? collection_body : empty_body
      end
    end

    def collection_body
      rows = collection.map do |member|
        content_tag :tr, @row.options_for(member) do
          cells = column_collection.map do |column|
            column.body_content_for member
          end
          safe_join cells
        end
      end
      safe_join rows
    end

    def empty_body
      content_tag :tr, class: 'empty' do
        content_tag :td, colspan: column_collection.size do
          "No #{klass.table_name.humanize.downcase} present"
        end
      end
    end

    def table_options
      options.except :head, :body
    end

    def ensure_row
      @row ||= Row.new(self)
    end
  end
end


text:
package com.fatuhiva.touch.render.layout;

import com.fatuhiva.model.container.FatuLayoutContainer;
import com.fatuhiva.touch.render.generic.CompositeRender;

@SuppressWarnings({"rawtypes","unchecked"})
public class AnyLayoutRender<T extends FatuLayoutContainer> extends CompositeRender<T> {

    public AnyLayoutRender() {
        super.addRender(new JextBorderLayoutPropertyRender<T>());
        super.addRender(new JextBorderLayoutRuleRender<T>());

        super.addRender(new JextTableLayoutPropertyRender<T>());
        super.addRender(new JextAutoLayoutPropertyRender<T>());
        super.addRender(new JextBoxLayoutPropertyRender<T>());
        super.addRender(new JextFitLayoutPropertyRender<T>());

    }

}


text:
declare namespace Jymfony.Component.Lexer {
    interface Token {
        value: any,
        type: number | string,
        position: number,
    }

    export abstract class AbstractLexer implements Iterable<Token> {
        public token: Token | undefined;
        public lookahead: Token | undefined;
        private _peek?: number;
        private _position?: number;
        private _input?: string;
        private _tokens: Token[];

        __construct(): void;
        constructor();

        /**
         * Reset the lexer
         */
        reset(): void;

        /**
         * Resets the peek pointer to 0.
         */
        resetPeek(): void;

        /**
         * Resets the lexer position on the input to the given position.
         *
         * @param [position = 0] Position to place the lexical scanner.
         */
        resetPosition(position?: number): void;

        /**
         * Retrieve the original lexer's input until a given position.
         */
        getInputUntilPosition(position: number): string;

        /**
         * Checks whether a given token matches the current lookahead.
         */
        isNextToken(token: number | string): boolean;

        /**
         * Checks whether any of the given tokens matches the current lookahead.
         */
        isNextTokenAny(tokens: (number | string)[]): boolean;

        /**
         * Moves to the next token in the input string.
         *
         * @returns {boolean}
         */
        moveNext(): boolean;

        /**
         * Tells the lexer to skip input tokens until it sees a token with the given value.
         *
         * @param type The token type to skip until.
         */
        skipUntil(type: number | string): void;

        /**
         * Checks if given value is identical to the given token.
         */
        isA(value: any, token: number | string): boolean;

        /**
         * Moves the lookahead token forward.
         *
         * @returns The next token or undefined if there are no more tokens ahead.
         */
        peek(): Token | undefined;

        /**
         * Peeks at the next token, returns it and immediately resets the peek.
         *
         * @returns The next token or undefined if there are no more tokens ahead.
         */
        glimpse(): Token | undefined;

        /**
         * Gets the literal for a given token.
         */
        getLiteral(token: number | string): string;

        /**
         * The original input data.
         *
         * When setting, the Lexer is immediately reset and the new input tokenized.
         * Any unprocessed tokens from any previous input are lost.
         */
        public input: string;

        /**
         * Scans the input string for tokens.
         *
         * @param {string} input A query string.
         */
        private _scan(input: string): void;

        /**
         * Iterates through the tokens
         */
        [Symbol.iterator](): IterableIterator<Token>;

        /**
         * Regex modifiers.
         */
        protected getModifiers(): string;

        /**
         * Lexical catchable patterns.
         */
        protected abstract getCatchablePatterns(): string[];

        /**
         * Lexical non-catchable patterns.
         */
        protected abstract getNonCatchablePatterns(): string[];

        /**
         * Retrieve token type. Also processes the token value if necessary.
         */
        protected abstract getType(holder: ValueHolder): string | number;
    }
}


text:
"use strict";

var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { "default": obj }; };

var _defaults = function (obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; };

var Metadata = require("aurelia-metadata").Metadata;

var _valueConverter = require("./value-converter");

var ValueConverter = _valueConverter.ValueConverter;
exports.EventManager = require("./event-manager").EventManager;

var _observerLocator = require("./observer-locator");

exports.ObserverLocator = _observerLocator.ObserverLocator;
exports.ObjectObservationAdapter = _observerLocator.ObjectObservationAdapter;
exports.ValueConverter = _valueConverter.ValueConverter;
exports.calcSplices = require("./array-change-records").calcSplices;

_defaults(exports, _interopRequireWildcard(require("./binding-modes")));

exports.Parser = require("./parser").Parser;
exports.BindingExpression = require("./binding-expression").BindingExpression;
exports.ListenerExpression = require("./listener-expression").ListenerExpression;
exports.NameExpression = require("./name-expression").NameExpression;
exports.CallExpression = require("./call-expression").CallExpression;
exports.DirtyChecker = require("./dirty-checking").DirtyChecker;
exports.getChangeRecords = require("./map-change-records").getChangeRecords;

var _computedObservation = require("./computed-observation");

exports.ComputedObservationAdapter = _computedObservation.ComputedObservationAdapter;
exports.declarePropertyDependencies = _computedObservation.declarePropertyDependencies;

Metadata.configure.classHelper("valueConverter", ValueConverter);
Object.defineProperty(exports, "__esModule", {
  value: true
});


text:
normr

  Normalize the rows of a matrix to unit length. See
  [http://octave.sourceforge.net/miscellaneous/function/normr.html,
  Octave's documentation] and the [tests, unit-tests].

Example


text:
<?php

namespace Amsgames\LaravelShop\Traits;

use Illuminate\Support\Facades\Config;
use InvalidArgumentException;

trait ShopUserTrait
{

    /**
     * One-to-Many relations with cart.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function cart()
    {
        return $this->hasOne(Config::get('shop.cart'), 'user_id');
    }

    /**
     * One-to-Many relations with Item.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function items()
    {
        return $this->hasMany(Config::get('shop.item'), 'user_id');
    }

    /**
     * One-to-Many relations with Order.
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function orders()
    {
        return $this->hasMany(Config::get('shop.order'), 'user_id');
    }

    /**
     * Returns the user ID value based on the primary key set for the table.
     *
     * @param mixed
     */
    public function getShopIdAttribute()
    {
        return is_array($this->primaryKey) ? 0 : $this->attributes[$this->primaryKey];
    }

}


text:
#ifndef ELEVATION_HPP_19857862_0EE5_4709_B3E9_C7E50239C2E0
#define ELEVATION_HPP_19857862_0EE5_4709_B3E9_C7E50239C2E0
#pragma once

/*
elevation.hpp

Elevation
*/
/*
Copyright © 2010 Far Group
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the authors may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

// Internal:

// Platform:
#include "platform.concurrency.hpp"
#include "platform.fwd.hpp"
#include "platform.security.hpp"

// Common:
#include "common/singleton.hpp"

// External:

//----------------------------------------------------------------------------

enum class lng : int;

enum ELEVATION_MODE
{
	ELEVATION_MODIFY_REQUEST = 0_bit,
	ELEVATION_READ_REQUEST   = 1_bit,
	ELEVATION_USE_PRIVILEGES = 31_bit
};

enum ELEVATION_COMMAND: int;

class elevation: public singleton<elevation>
{
	IMPLEMENTS_SINGLETON;

public:
	~elevation();
	void ResetApprove();
	bool Elevated() const {return m_Elevation;}

	bool create_directory(const string& TemplateObject, const string& Object, SECURITY_ATTRIBUTES* Attributes);
	bool remove_directory(const string& Object);
	bool delete_file(const string& Object);
	bool copy_file(const string& From, const string& To, LPPROGRESS_ROUTINE ProgressRoutine, void* Data, BOOL* Cancel, DWORD Flags);
	bool move_file(const string& From, const string& To, DWORD Flags);
	bool replace_file(const string& To, const string& From, const string& Backup, DWORD Flags);
	os::fs::attributes get_file_attributes(const string& Object);
	bool set_file_attributes(const string& Object, os::fs::attributes FileAttributes);
	bool create_hard_link(const string& Object, const string& Target, SECURITY_ATTRIBUTES* SecurityAttributes);

	bool fCreateSymbolicLink(string_view Object, string_view Target, DWORD Flags);
	bool fMoveToRecycleBin(string_view Object);
	bool fSetOwner(const string& Object, const string& Owner);

	HANDLE create_file(const string& Object, DWORD DesiredAccess, DWORD ShareMode, SECURITY_ATTRIBUTES* SecurityAttributes, DWORD CreationDistribution, DWORD FlagsAndAttributes, HANDLE TemplateFile);
	bool set_file_encryption(const string& Object, bool Encrypt);
	bool detach_virtual_disk(const string& Object, VIRTUAL_STORAGE_TYPE& VirtualStorageType);
	bool get_disk_free_space(const string& Object, unsigned long long* FreeBytesAvailableToCaller, unsigned long long* TotalNumberOfBytes, unsigned long long* TotalNumberOfFreeBytes);

	os::security::descriptor get_file_security(string const& Object, SECURITY_INFORMATION RequestedInformation);
	bool set_file_security(string const& Object, SECURITY_INFORMATION RequestedInformation, os::security::descriptor const& Descriptor);
	bool reset_file_security(string const& Object);

	class suppress
	{
	public:
		NONCOPYABLE(suppress);

		suppress(bool Completely = false);
		~suppress();

	private:
		elevation* m_owner;
		bool m_Completely;
	};

private:
	elevation() = default;

	template<typename T>
	T Read() const;

	template<typename T>
	void Read(T& Data) const { Data = Read<T>(); }

	template<typename... args>
	void Write(const args&... Args) const;

	void RetrieveLastError() const;

	template<typename T>
	T RetrieveLastErrorAndResult() const;

	bool Initialize();
	bool ElevationApproveDlg(lng Why, string_view Object);
	void TerminateChildProcess() const;

	template<typename T, typename F1, typename F2>
	auto execute(lng Why, string_view Object, T Fallback, const F1& PrivilegedHander, const F2& ElevatedHandler);

	void progress_routine(LPPROGRESS_ROUTINE ProgressRoutine) const;

	std::atomic_size_t m_Suppressions{};
	std::atomic_size_t m_CompleteSuppressions{};
	os::handle m_Pipe;
	os::handle m_Process;
	os::handle m_Job;

	bool m_IsApproved{};
	bool m_AskApprove{true};
	bool m_Elevation{};
	bool m_DontAskAgain{};
	bool m_DuplicateHandleGranted{};
	int m_Recurse{};
	os::critical_section m_CS;
	string m_PipeName;
};

bool ElevationRequired(ELEVATION_MODE Mode, bool UseNtStatus = true);
int ElevationMain(string_view Uuid, DWORD PID, bool UsePrivileges);
bool IsElevationArgument(const wchar_t* Argument);

#endif // ELEVATION_HPP_19857862_0EE5_4709_B3E9_C7E50239C2E0


text:
/**
*============================================================================
*  The Ohio State University Research Foundation, The University of Chicago -
*  Argonne National Laboratory, Emory University, SemanticBits LLC,
*  and Ekagra Software Technologies Ltd.
*
*  Distributed under the OSI-approved BSD 3-Clause License.
*  See http://ncip.github.com/cagrid-workflow/LICENSE.txt for details.
*============================================================================
**/
package net.sf.taverna.wsdl.soap;

import java.io.IOException;
import java.util.Map;

import javax.wsdl.WSDLException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.soap.SOAPException;

import net.sf.taverna.wsdl.parser.UnknownOperationException;

import org.apache.axis.message.SOAPBodyElement;
import org.xml.sax.SAXException;

/**
 * Interface to a class that is responsible for creating the SOAP body elements from the provided inputs
 * for invoking a SOAP based Web-service.
 *
 * @author Stuart Owen
 */
@SuppressWarnings("unchecked")
public interface BodyBuilder {

	public SOAPBodyElement build(Map inputMap)
			throws WSDLException, ParserConfigurationException, SOAPException,
			IOException, SAXException, UnknownOperationException;

}


text:
import unittest
from day21 import parse, invert_instruction
from day21 import swap_char, swap_position, reverse, \
        rotate, rotate_position, rotate_position_inverse, move

class TestParsingInstructions(unittest.TestCase):

    cases = (
        ('swap position 4 with position 0', (swap_position, [4, 0])),
        ('swap letter d with letter b', (swap_char, ['d', 'b'])),
        ('reverse positions 0 through 4', (reverse, [0, 4])),
        ('rotate left 1 step', (rotate, [-1])),
        ('rotate right 1 step', (rotate, [1])),
        ('move position 1 to position 4', (move, [1, 4])),
        ('rotate based on position of letter b', (rotate_position, ['b'])),
    )

    def test_parses_instructions(self):
        for instruction, expected in self.cases:
            self.assertEqual(parse(instruction), expected)

class TestInvertingInstructions(unittest.TestCase):

    cases = (
        ((swap_position, [4, 0]), (swap_position, [0, 4])),
        ((swap_char, ['d', 'b']), (swap_char, ['b', 'd'])),
        ((reverse, [0, 4]), (reverse, [0, 4])),
        ((rotate, [1]), (rotate, [-1])),
        ((rotate, [-1]), (rotate, [1])),
        ((move, [1, 4]), (move, [4, 1])),
        ((rotate_position, ['b']), (rotate_position_inverse, ['b'])),
    )

    def test_inverts_instructions(self):
        for parsed, expected in self.cases:
            self.assertEqual(invert_instruction(*parsed), expected)

class TestManipulatingStrings(unittest.TestCase):

    cases = (
        ('abcde', swap_position, [4, 0], 'ebcda'),
        ('ebcda', swap_char, ['d', 'b'], 'edcba'),
        ('edcba', reverse, [0, 4], 'abcde'),
        ('abcde', rotate, [-1], 'bcdea'),
        ('bcdea', rotate, [1], 'abcde'),
        ('bcdea', move, [1, 4], 'bdeac'),
        ('bdeac', move, [3, 0], 'abdec'),
        ('abdec', rotate_position, ['b'], 'ecabd'),
        ('ecabd', rotate_position, ['d'], 'decab'),
    )

    def test_manipulates_strings(self):
        for string, f, args, expected in self.cases:
            self.assertEqual(f(string, *args), expected, [f.__name__, string, args])

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


text:
var coffee = require("coffee-script");
var express = require("express");

var nconf = require("nconf").use("memory")
  .argv()
  .env()
  .file({file: "config.json"})
  .defaults({
    "PORT": 8080
  });

if (!nconf.get("host")) {
  console.error("The host option is required for Plunker to start");
} else {

  var host = nconf.get("host");

  // Configure global paths
  if (nconf.get("nosubdomains")) {
    nconf.set("url:www", "http://" + host);
    nconf.set("url:raw", "http://" + host + "/raw");
    nconf.set("url:run", "http://" + host + "/run");
    nconf.set("url:api", "http://" + host + "/api");
  } else {
    nconf.set("url:www", "http://" + host);
    nconf.set("url:raw", "http://raw." + host);
    nconf.set("url:run", "http://run." + host);
    nconf.set("url:api", "http://api." + host);
  }

  // Create and start the parent server
  express.createServer()
    //.use(express.logger())
    .use(require("express-subdomains").use("raw").use("api").use("run").use("embed").middleware)
    .use("/api", require("./servers/api"))
    .use("/raw", require("./servers/raw"))
    .use("/run", require("./servers/run"))
    .use("/embed", require("./servers/embed"))
    .use(require("./servers/www"))
    .listen(nconf.get("PORT"));

  console.log("Started plunker in", nconf.get("NODE_ENV") || "development", "at", nconf.get("host"), "on port", nconf.get("PORT"), "using subdomains:", !nconf.get("nosubdomains"));
}


text:
package com.emerginggames.ane.AirGooglePlusOne;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Window;
import android.widget.TextView;
import android.widget.Button;
import android.view.View;
import android.view.View.OnClickListener;

import com.google.android.gms.common.*;
import com.google.android.gms.common.GooglePlayServicesClient.*;
import com.google.android.gms.plus.PlusClient;
import com.google.android.gms.plus.PlusOneButton;
import com.google.android.gms.plus.PlusOneButton.OnPlusOneClickListener;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks;
import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener;

public class PlusOneActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener
{
	private PlusClient mPlusClient;
	private PlusOneButton mPlusOneButton;
	private String mURL;

	// The request code must be 0 or greater.
	private static final int PLUS_ONE_REQUEST_CODE = 0;

	private boolean mHasBeenClicked = false;
	private Button mOkButton;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{

		AirGooglePlusOneExtension.log("INFO - PlusOneActivity.onCreate");

		super.onCreate(savedInstanceState);

		// Setup views
		requestWindowFeature(Window.FEATURE_LEFT_ICON);
		setContentView(AirGooglePlusOneExtension.context.getResourceId("layout.googleplusone"));

		mPlusClient = new PlusClient.Builder(this, this, this)
        					.clearScopes()
        					.build();

        mPlusOneButton = (PlusOneButton) findViewById(AirGooglePlusOneExtension.context.getResourceId("id.plus_one_button"));
        mPlusOneButton.setOnPlusOneClickListener(new OnPlusOneClickListener() {
        	@Override
        	public void onPlusOneClick(Intent intent) {
				if (mPlusClient.isConnected()) {
					mHasBeenClicked = true;
					mOkButton.setVisibility(View.VISIBLE);
					startActivityForResult(intent, 0);
				} else {
					mPlusClient.connect();
				}
        	}
        });

        // Get extra values
		Bundle extras = this.getIntent().getExtras();
		mURL = extras.getString("url");

		TextView textView = (TextView) findViewById(AirGooglePlusOneExtension.context.getResourceId("id.plus_one_title"));
		textView.setText(extras.getString("title"));

		mOkButton = (Button) findViewById(AirGooglePlusOneExtension.context.getResourceId("id.ok_button"));
		mOkButton.setText("OK");
		mOkButton.setOnClickListener(new OnClickListener() {
		    @Override
		    public void onClick(View v) {
        		okAction();
        	}
		});
	}

	public void okAction() {
		finish();
	}

	protected void onResume() {

    	super.onResume();
	    // Refresh the state of the +1 button each time the activity receives focus.
    	mPlusOneButton.initialize(mPlusClient, mURL, PLUS_ONE_REQUEST_CODE);
	}

	@Override
    protected void onStart() {
        super.onStart();
        mPlusClient.connect();
    }

    @Override
    protected void onStop() {
		AirGooglePlusOneExtension.log("INFO - PlusOneActivity.onStop, hasBeenClicked=" + mHasBeenClicked);
		if (mHasBeenClicked) {
			AirGooglePlusOneExtension.context.dispatchStatusEventAsync("GOOGLE_PLUS_ONE_OK", "");
		}
        super.onStop();
        mPlusClient.disconnect();
    }

	@Override
	public void onConnectionFailed(ConnectionResult result) {
		AirGooglePlusOneExtension.log("INFO - PlusOneActivity.onConnectionFailed, result=" + result);
	}

	@Override
	public void onConnected(Bundle connectionHint) {
		AirGooglePlusOneExtension.log("INFO - PlusOneActivity.onConnected");
	}

	@Override
    public void onDisconnected() {
		AirGooglePlusOneExtension.log("INFO - PlusOneActivity.onDisonnected");
    }
}


text:
<?php

namespace ZendService\ZendServerAPI\DataTypes;

/**
 * GeneralDetails model implementation.
 *
 * @license        http://framework.zend.com/license/new-bsd New BSD License
 * @link           http://github.com/zendframework/zf2 for the canonical source repository
 * @author         Ingo Walz <ingo.walz@googlemail.com>
 * @category       Zend
 * @package        Zend_Service
 * @subpackage     ZendServerAPI
 */
class GeneralDetails extends DataType
{
    /**
     * Issue's creating URL string
     * @var string
     */
    protected $url = null;
    /**
     * Path to the file where the issue manifested
     * @var string
     */
    protected $sourceFile = null;
    /**
     * Line number where the issue manifests
     * within the SourceFile
     * @var int
     */
    protected $sourceLine = null;
    /**
     * Name of the function that caused the issue to manifest
     * @var string
     */
    protected $function = null;
    /**
     * A unique identifier that groups all
     * events under this issue
     * @var int
     */
    protected $aggregationHint = null;
    /**
     * The error string generated for the events
     * @var string
     */
    protected $errorString = null;
    /**
     * PHP Error type created for the event
     * @var string
     */
    protected $errorType = null;

    /**
     * Get the issue's creating URL string
     *
     * @return string
     */
    public function getUrl ()
    {
        return $this->url;
    }

    /**
     * Get the path to the file where the issue manifested
     *
     * @return string
     */
    public function getSourceFile ()
    {
        return $this->sourceFile;
    }

    /**
     * Line number where the issue manifests within the SourceFile
     *
     * @return int
     */
    public function getSourceLine ()
    {
        return $this->sourceLine;
    }

    /**
     * Get the name of the function that caused the issue to manifest
     *
     * @return string
     */
    public function getFunction ()
    {
        return $this->function;
    }

    /**
     * Get the unique identifier that groups all events under this issue
     *
     * @return int
     */
    public function getAggregationHint ()
    {
        return $this->aggregationHint;
    }

    /**
     * Get the error string generated for the events
     *
     * @return string
     */
    public function getErrorString ()
    {
        return $this->errorString;
    }

    /**
     * Get the PHP Error type created for the event
     *
     * @return string
     */
    public function getErrorType ()
    {
        return $this->errorType;
    }

    /**
     * Set the issue's creating URL string
     *
     * @param string $url
     */
    public function setUrl ($url)
    {
        $this->url = $url;
    }

    /**
     * Set the path to the file where the issue manifested
     *
     * @param  string $sourceFile
     * @return void
     */
    public function setSourceFile ($sourceFile)
    {
        $this->sourceFile = $sourceFile;
    }

    /**
     * Set the line number where the issue manifests within
     * the SourceFile
     *
     * @param  int  $sourceLine
     * @return void
     */
    public function setSourceLine ($sourceLine)
    {
        $this->sourceLine = (int) $sourceLine;
    }

    /**
     * Set the name of the function that caused the issue to manifest
     *
     * @param  string $function
     * @return void
     */
    public function setFunction ($function)
    {
        $this->function = $function;
    }

    /**
     * Set the unique identifier that groups all events under this issue
     *
     * @param  string $aggregationHint
     * @return void
     */
    public function setAggregationHint ($aggregationHint)
    {
        $this->aggregationHint = $aggregationHint;
    }

    /**
     * Set the error string generated for the events
     *
     * @param  string $errorString
     * @return void
     */
    public function setErrorString ($errorString)
    {
        $this->errorString = $errorString;
    }

    /**
     * Set the PHP Error type created for the event
     *
     * @param  string $errorType
     * @return void
     */
    public function setErrorType ($errorType)
    {
        $this->errorType = $errorType;
    }

}


text:
use core::arch::x86_64::__m128i;

use crate::memmem::{
    prefilter::{PrefilterFnTy, PrefilterState},
    NeedleInfo,
};

// Check that the functions below satisfy the Prefilter function type.
const _: PrefilterFnTy = find;

/// An SSE2 accelerated candidate finder for single-substring search.
///
/// # Safety
///
/// Callers must ensure that the sse2 CPU feature is enabled in the current
/// environment. This feature should be enabled in all x86_64 targets.
#[target_feature(enable = "sse2")]
pub(crate) unsafe fn find(
    prestate: &mut PrefilterState,
    ninfo: &NeedleInfo,
    haystack: &[u8],
    needle: &[u8],
) -> Option<usize> {
    // If the haystack is too small for SSE2, then just run memchr on the
    // rarest byte and be done with it. (It is likely that this code path is
    // rarely exercised, since a higher level routine will probably dispatch to
    // Rabin-Karp for such a small haystack.)
    fn simple_memchr_fallback(
        _prestate: &mut PrefilterState,
        ninfo: &NeedleInfo,
        haystack: &[u8],
        needle: &[u8],
    ) -> Option<usize> {
        let (rare, _) = ninfo.rarebytes.as_rare_ordered_usize();
        crate::memchr(needle[rare], haystack).map(|i| i.saturating_sub(rare))
    }
    super::super::genericsimd::find::<__m128i>(
        prestate,
        ninfo,
        haystack,
        needle,
        simple_memchr_fallback,
    )
}

#[cfg(all(test, feature = "std"))]
mod tests {
    #[test]
    #[cfg(not(miri))]
    fn prefilter_permutations() {
        use crate::memmem::prefilter::tests::PrefilterTest;
        // SAFETY: super::find is safe to call for all inputs on x86.
        unsafe { PrefilterTest::run_all_tests(super::find) };
    }
}


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__int_fgets_divide_82.h
Label Definition File: CWE369_Divide_by_Zero__int.label.xml
Template File: sources-sinks-82.tmpl.h
*/
/*
 * @description
 * CWE: 369 Divide by Zero
 * BadSource: fgets Read data from the console using fgets()
 * GoodSource: Non-zero
 * Sinks: divide
 *    GoodSink: Check for zero before dividing
 *    BadSink : Divide a constant by data
 * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer
 *
 * */

#include "std_testcase.h"

namespace CWE369_Divide_by_Zero__int_fgets_divide_82
{

class CWE369_Divide_by_Zero__int_fgets_divide_82_base
{
public:
    /* pure virtual function */
    virtual void action(int data) = 0;
};

#ifndef OMITBAD

class CWE369_Divide_by_Zero__int_fgets_divide_82_bad : public CWE369_Divide_by_Zero__int_fgets_divide_82_base
{
public:
    void action(int data);
};

#endif /* OMITBAD */

#ifndef OMITGOOD

class CWE369_Divide_by_Zero__int_fgets_divide_82_goodG2B : public CWE369_Divide_by_Zero__int_fgets_divide_82_base
{
public:
    void action(int data);
};

class CWE369_Divide_by_Zero__int_fgets_divide_82_goodB2G : public CWE369_Divide_by_Zero__int_fgets_divide_82_base
{
public:
    void action(int data);
};

#endif /* OMITGOOD */

}