text:
package org.apache.zeppelin.notebook.repo;

import static org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_MONGO_URI;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.Map;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;
import de.flapdoodle.embed.process.runtime.Network;
import org.apache.zeppelin.conf.ZeppelinConfiguration;
import org.apache.zeppelin.notebook.Note;
import org.apache.zeppelin.notebook.NoteInfo;
import org.apache.zeppelin.notebook.Paragraph;
import org.apache.zeppelin.user.AuthenticationInfo;

public class MongoNotebookRepoTest {

  private MongodExecutable mongodExecutable;

  private ZeppelinConfiguration zConf;

  private MongoNotebookRepo notebookRepo;

  @Before
  public void setUp() throws IOException {
    String bindIp = "localhost";
    ServerSocket socket = new ServerSocket(0);
    int port = socket.getLocalPort();
    socket.close();

    IMongodConfig mongodConfig = new MongodConfigBuilder()
        .version(Version.Main.PRODUCTION)
        .net(new Net(bindIp, port, Network.localhostIsIPv6()))
        .build();

    mongodExecutable = MongodStarter.getDefaultInstance()
        .prepare(mongodConfig);
    mongodExecutable.start();

    System.setProperty(ZEPPELIN_NOTEBOOK_MONGO_URI.getVarName(), "mongodb://" + bindIp + ":" + port);
    zConf = ZeppelinConfiguration.create();
    notebookRepo = new MongoNotebookRepo();
    notebookRepo.init(zConf);
  }

  @After
  public void tearDown() throws IOException {
    if (mongodExecutable != null) {
      mongodExecutable.stop();
    }
  }

  @Test
  public void testBasics() throws IOException {
    assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());

    // create note1
    Note note1 = new Note();
    note1.setPath("/my_project/my_note1");
    Paragraph p1 = note1.insertNewParagraph(0, AuthenticationInfo.ANONYMOUS);
    p1.setText("%md hello world");
    p1.setTitle("my title");
    notebookRepo.save(note1, AuthenticationInfo.ANONYMOUS);

    Map<String, NoteInfo> noteInfos = notebookRepo.list(AuthenticationInfo.ANONYMOUS);
    assertEquals(1, noteInfos.size());
    Note note1Loaded = notebookRepo.get(note1.getId(), note1.getPath(), AuthenticationInfo.ANONYMOUS);
    assertEquals(note1.getId(), note1Loaded.getId());
    assertEquals(note1.getName(), note1Loaded.getName());

    // create note2
    Note note2 = new Note();
    note2.setPath("/my_note2");
    Paragraph p2 = note2.insertNewParagraph(0, AuthenticationInfo.ANONYMOUS);
    p2.setText("%md hello world2");
    p2.setTitle("my title2");
    notebookRepo.save(note2, AuthenticationInfo.ANONYMOUS);

    noteInfos = notebookRepo.list(AuthenticationInfo.ANONYMOUS);
    assertEquals(2, noteInfos.size());

    // move note2
    String newPath = "/my_project2/my_note2";
    notebookRepo.move(note2.getId(), note2.getPath(), "/my_project2/my_note2", AuthenticationInfo.ANONYMOUS);

    Note note3 = notebookRepo.get(note2.getId(), newPath, AuthenticationInfo.ANONYMOUS);
    assertEquals(note2, note3);

    // move folder
    notebookRepo.move("/my_project2", "/my_project3/my_project2", AuthenticationInfo.ANONYMOUS);
    noteInfos = notebookRepo.list(AuthenticationInfo.ANONYMOUS);
    assertEquals(2, noteInfos.size());

    Note note4 = notebookRepo.get(note3.getId(), "/my_project3/my_project2/my_note2", AuthenticationInfo.ANONYMOUS);
    assertEquals(note3, note4);

    // remove note1
    notebookRepo.remove(note1.getId(), note1.getPath(), AuthenticationInfo.ANONYMOUS);
    assertEquals(1, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());

    notebookRepo.remove("/my_project3", AuthenticationInfo.ANONYMOUS);
    assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());
  }

  @Test
  public void testGetNotePath() throws IOException {
    assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());

    Note note = new Note();
    String notePath = "/folder1/folder2/folder3/folder4/folder5/my_note";
    note.setPath(notePath);
    notebookRepo.save(note, AuthenticationInfo.ANONYMOUS);

    notebookRepo.init(zConf);
    Map<String, NoteInfo> noteInfos = notebookRepo.list(AuthenticationInfo.ANONYMOUS);
    assertEquals(1, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());
    assertEquals(notePath, noteInfos.get(note.getId()).getPath());

    notebookRepo.remove(note.getId(), note.getPath(), AuthenticationInfo.ANONYMOUS);
    assertEquals(0, notebookRepo.list(AuthenticationInfo.ANONYMOUS).size());
  }
}


text:
package prob078.subset;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Solution {
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> result = new ArrayList<>();
        Arrays.sort(nums);
        backtrack(result, new ArrayList<Integer>(), nums, 0);
        return result;
    }

    private void backtrack(List<List<Integer>> list, List<Integer> tempList, int[] nums, int start) {
        list.add(new ArrayList<Integer>(tempList));
        for (int i = start; i < nums.length; i++) {
            tempList.add(nums[i]);
            backtrack(list, tempList, nums, i + 1);
            tempList.remove(tempList.size() - 1);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Sign up

<form method="post" action="" name="frmSignUp" ng-submit="signup(frmSignUp.$valid)" novalidate>

        <input id="firstname" name="firstname" type="text" placeholder="Firstname" ng-model="user.firstname" ng-minlength="3" ng-maxlength="32" required>

         Firstname is too short.
         Firstname is too long.
         Firstname is required.

        <input id="lastname" name="lastname" type="text" placeholder="Lastname" ng-model="user.lastname" ng-minlength="3" ng-maxlength="32" required>

         Lastname is too short.
         Lastname is too long.
         Lastname is required.

        <input id="email" name="email" type="email" placeholder="Email Address" ng-model="user.email" required>

         Enter a valid email.
         Email is required.

        <input id="username" name="username" type="text" placeholder="Username" ng-model="user.username" ng-minlength="3" ng-maxlength="32" required>

         Lastname is too short.
         Lastname is too long.
         Username is required.

        <input id="password" name="password" type="password" placeholder="Password" ng-model="user.password" ng-minlength="5" required>

         Password is too short.
         Password is required.

        <input id="password2" name="password2" type="password" placeholder="Password" ng-model="user.password2" ng-minlength="5" required>

         Password is too short.
         Password is required.

    <button type="submit" ng-disabled="frmSignUp.$invalid">SIGN UP</button>
</form>


text:
<?php

/**
 * Index all documents from mysql to SOLR
 * Usage: php -f cmd_indexall.php [prod/dev]
 */

require "/var/www/html/include/include_connection.php";
require "/var/www/html/include/Html2Text.php";
//require "/home/adminloc/public_html/include/include_connection.php";
//require "/home/adminloc/public_html/include/Html2Text.php";

//check input parameters
if (count($argv) < 2) {
    echo "You need to specify the environment as param: dev/prod\n";
    exit;
}
switch ($argv[1]) {
case "dev":
    $paramTest = true;
    break;
case "prod":
    $paramTest = false;
    break;
default:
    echo "You need to specify the environment as param: dev/prod\n";
    exit;
}

$numDecisions = 0;
$numDocuments = 0;
$ids = [];
$id = 0;

//load the list of IDs
$sql = "select DocumentID from Documents ".
"WHERE DocumentType='MAIN' OR DocumentType='ANEX'";
try {
    $result =  $conn->query($sql);
    while ($row = $result->fetch_assoc()) {
        $ids[] = (int)$row["DocumentID"];
    }
} catch (Exception $e) {
    signal_error($e);
}

$htmlconv = new \Html2Text\Html2Text("");

//prepare sql
if ($paramTest) {
	$sql = "SELECT DocumentID, Documents_DEV.DecisionID, Contents, ".
	"Year, Number, DecisionType, EntityID, Title ".
	"FROM Documents_DEV INNER JOIN Decisions_DEV ".
	"On Documents_DEV.DecisionID = Decisions_DEV.DecisionID ".
	"WHERE DocumentID = ? AND (DocumentType='MAIN' OR DocumentType='ANEX') ".
	"ORDER BY DocumentID limit 1";
}
else {
	$sql = "SELECT DocumentID, Documents.DecisionID, Contents, ".
	"Year, Number, DecisionType, EntityID, Title ".
	"FROM Documents INNER JOIN Decisions ".
	"On Documents.DecisionID = Decisions.DecisionID ".
	"WHERE DocumentID = ? AND (DocumentType='MAIN' OR DocumentType='ANEX') ".
	"ORDER BY DocumentID limit 1";
}

try {

    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $id);

    foreach($ids as $id) {
		$stmt->execute();
		$result = $stmt->get_result();
		$row = $result->fetch_assoc();

		if (substr($row["Contents"], 0, 5) != "ERROR" ) {
			$htmlconv->setHtml($row["Contents"]);
			$plaintext = $htmlconv->getText();
			$plaintext = str_replace("\xc2\xa0", " ", $plaintext);
			$plaintext = trim(preg_replace("/\s+/", " ", $plaintext));
			$plaintext = $row["Title"]."\n".$plaintext;
			$doc = array(
			"id" => $row["DocumentID"],
			"text" => $plaintext,
			"decisionid" => $row["DecisionID"],
			"year" => $row["Year"],
			"entity" => $row["EntityID"],
			"number" => $row["Number"],
			"type" => $row["DecisionType"]
			);
			//write the document details
			$response = addDocument(
				$doc, $paramTest?$solrserver_test:$solrserver
			);
			if ($response != "" ) {
				echo $response;
				$conn->close();
				exit;
			}
		}

		$numDocuments++;
        if (($numDocuments % 100) == 0) {
            echo "Processed:".$numDocuments."\n";
        }
	}

    $stmt->close();

} catch (Exception $e) {
    $conn->close();
    die($e);
}

$conn->close();
echo "SUCCESS:".$numDecisions.":".$numDocuments;

/**
 * Adds a document to SOLR
 *
 * @param array  $doc        document info
 * (id,text,decisionid,year,entity, number, type)
 * @param string $solrServer SOLR server link with core
 *
 * @return string error message in case of error, "" in case of success
 */
function addDocument($doc, $solrServer)
{
    $ch = curl_init($solrServer."update/json/docs?commit=true");
    if ($ch === false ) {
        return "ERROR: opening search URL";
    }
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt(
        $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')
    );
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($doc));
    $result = curl_exec($ch);
    if ($result === false ) {
        return "ERROR: SOLR not responding";
    }
    $arr = json_decode($result, true);
    if (isset($arr["error"])) {
        return "ERROR: ".$arr["error"]["msg"];
    }
    return "";
}

?>


text:
<?php
include_once('../conexion/db.php');
 $mensajeok=false;
 $mensajeError='Error al Conectar a la Base de Datos';
/*var_dump($_POST);
exit;*/
 if(isset($_POST['cedula'],$_POST['usuario'],$_POST['telefono'],$_POST['clave'])):
 	$nombre=$_POST['nombre'];
 	$apellidopat=$_POST['apellidopat'];
 	$apellidomat=$_POST['apellidomat'];
 	$cedula=$_POST['cedula'];
 	$usuario=$_POST['usuario'];
 	$telefono=$_POST['telefono'];
 	$clave=$_POST['clave'];
 	$foto=$_POST['foto'];
 	$direcion=$_POST['direcion'];
  $tipo=$_POST['tipo'];
	$foto0=$_POST['foto'];
 	$foto="subirfoto/".$foto0;
 	$insertar=pg_query($conexion,"insert into personas(nombre,apellidopat,apellidomat,cedula,direccion,telefono) values ('$nombre','$apellidopat','$apellidomat','$cedula','$direcion','$telefono')");
		if(!$insertar):
				$mensajeError='Error al insertar Usuario';
	//BUSCAMOS EN ID DEL PERSONA QUE SE REGISTRO
		else:
						$getbyeId=pg_query($conexion,"select max(id) from personas");
		 					if(pg_num_rows($getbyeId)>0):
		 						$Usua=pg_fetch_array($getbyeId);
		 						$getid=$Usua[0];
								$insertar2=pg_query($conexion,"insert into usuarios(idpersona,username,clave,foto,tipo) values('$getid','$usuario','$clave','$foto','$tipo')") ;
								$mensajeError="Usuario Registrado";
								$mensajeok=true;
		 					else:
		 						$mensajeError='usuario no encontrado';
		 					endif;
		endif;
  					// INSERTAMOS NUEVO USUARIOS
else:
 		$mensajeError='Todos los datos son requeridos 2';
endif;
$salidaJson=array('respuesta'=> $mensajeok, 'mensaje' => $mensajeError);
 echo json_encode($salidaJson);
?>


text:
package org.apache.camel.component.aws.secretsmanager.integration;

import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

import static org.junit.jupiter.api.Assertions.assertThrows;

public class SecretsManagerPropertiesSourceTestIT extends CamelTestSupport {

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:start").setBody(simple("{{aws:hello}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("hello");

        template.sendBody("direct:start", "Hello World");

        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexPropertiesFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:database_sample/username}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:database_sample/password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "password123");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:normalkey/username}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:normalkey/password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("pippo", "pippo");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testSecretNotFoundFunction() {
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:start").setBody(simple("{{aws:testExample}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("hello");

            template.sendBody("direct:start", "Hello World");

            MockEndpoint.assertIsSatisfied(context);
        });
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexNoSubkeyPropertiesFunction() {
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:username").setBody(simple("{{aws:database_sample/not_existent}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("admin");

            template.sendBody("direct:username", "Hello World");
            MockEndpoint.assertIsSatisfied(context);
        });
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesDefaultValueFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:postgresql/additional1:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:postgresql/additional2:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesDefaultValueExceptionFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:test-3/additional1:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:test-3/additional2:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesExceptionFunction() {
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:username").setBody(simple("{{aws:test-3/additional1}}")).to("mock:bar");
                    from("direct:password").setBody(simple("{{aws:test-3/additional2}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

            template.sendBody("direct:username", "Hello World");
            template.sendBody("direct:password", "Hello World");
            MockEndpoint.assertIsSatisfied(context);
        });
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexSimpleDefaultValueExceptionFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:test-3:admin}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:test-1:secret}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexSimpleNoDefaultValueExceptionFunction() {
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:username").setBody(simple("{{aws:secretsuper}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("admin");

            template.sendBody("direct:username", "Hello World");
            MockEndpoint.assertIsSatisfied(context);
        });
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesNoDefaultValueFunction() {
        Exception exception = assertThrows(FailedToCreateRouteException.class, () -> {
            context.addRoutes(new RouteBuilder() {
                @Override
                public void configure() {
                    from("direct:username").setBody(simple("{{aws:postgresql/additional1}}")).to("mock:bar");
                    from("direct:password").setBody(simple("{{aws:postgresql/additional2}}")).to("mock:bar");
                }
            });
            context.start();

            getMockEndpoint("mock:bar").expectedBodiesReceived("admin", "secret");

            template.sendBody("direct:username", "Hello World");
            template.sendBody("direct:password", "Hello World");
            MockEndpoint.assertIsSatisfied(context);
        });
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesNotExistentDefaultValueFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:newsecret/additional1:admin}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin");

        template.sendBody("direct:username", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_USE_DEFAULT_CREDENTIALS_PROVIDER", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testComplexCustomPropertiesDefaultCredsDefaultValueFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:newsecret/additional1:admin}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("admin");

        template.sendBody("direct:username", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithDefaultFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:postgresql/username:oscerd}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:postgresql/password:password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("postgres", "secret");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithDefaultNotExistentFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:username").setBody(simple("{{aws:db_sample/username:oscerd}}")).to("mock:bar");
                from("direct:password").setBody(simple("{{aws:db_sample/password:password}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("oscerd", "password");

        template.sendBody("direct:username", "Hello World");
        template.sendBody("direct:password", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test/id@e8d0e680-a504-4b70-a9b2-acf5efe0ba23}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("27");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionAndNoFieldFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test@e8d0e680-a504-4b70-a9b2-acf5efe0ba23}}")).to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("{\"id\":\"27\"}");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionNoFieldAndDefaultValueFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test:pippo@e8d0e680-a504-4b70-a9b2-acf5efe0ba23}}"))
                        .to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("{\"id\":\"27\"}");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionNoFieldDefaultValueNotExistentSecretFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test1:pippo@e8d0e680-a504-4b70-a9b2-acf5efe0ba23}}"))
                        .to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("pippo");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionNoFieldDefaultValueNotExistentVersionFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test1:pippo@e8d0e680-a504-4b70-a9b2-acf5efe0ba29}}"))
                        .to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("pippo");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }

    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_ACCESS_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_SECRET_KEY", matches = ".*")
    @EnabledIfEnvironmentVariable(named = "CAMEL_VAULT_AWS_REGION", matches = ".*")
    @Test
    public void testPropertiesWithVersionFieldAndDefaultValueFunction() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() {
                from("direct:version").setBody(simple("{{aws:test/id:pippo@e8d0e680-a504-4b70-a9b2-acf5efe0ba23}}"))
                        .to("mock:bar");
            }
        });
        context.start();

        getMockEndpoint("mock:bar").expectedBodiesReceived("27");

        template.sendBody("direct:version", "Hello World");
        MockEndpoint.assertIsSatisfied(context);
    }
}


text:
@implementation SDTScriptableAction

-(instancetype)initWithCommandData:(NSDictionary*)data {
  self = [super init];

  if (self && data) {
    self.actionID = data[@"id"];
    self.name = data[@"name"];
    self.origin = data[@"origin"];
    self.trigger = data[@"trigger"];
    self.target = data[@"target"];
    self.enabled = [data[@"enabled"] boolValue];

    if ([data[@"external"] boolValue]) {
      self.scriptFilePath = data[@"filePath"];
      self.scriptSource = @"";
    } else {
      self.scriptSource = data[@"source"];
      self.scriptFilePath = @"";
    }
  }

  return self;
}

-(instancetype)initWithCoder:(NSCoder *)decoder {
  self = [super init];

  if (self){
    self.actionID = [decoder decodeObjectForKey:@"actionID"];
    self.enabled = [decoder decodeBoolForKey:@"enabled"];
    self.name = [decoder decodeObjectForKey:@"name"];
    self.scriptFilePath = [decoder decodeObjectForKey:@"scriptFilePath"];
    self.scriptSource = [decoder decodeObjectForKey:@"scriptSource"];
    self.origin = [decoder decodeObjectForKey:@"origin"];
    self.target = [decoder decodeObjectForKey:@"target"];
    self.trigger = [decoder decodeObjectForKey:@"trigger"];
  }

  return self;
}

-(void)encodeWithCoder:(NSCoder *)coder {
  [coder encodeObject:self.actionID forKey:@"actionID"];
  [coder encodeBool:self.enabled forKey:@"enabled"];
  [coder encodeObject:self.name forKey:@"name"];
  [coder encodeObject:self.scriptFilePath forKey:@"scriptFilePath"];
  [coder encodeObject:self.scriptSource forKey:@"scriptSource"];
  [coder encodeObject:self.origin forKey:@"origin"];
  [coder encodeObject:self.target forKey:@"target"];
  [coder encodeObject:self.trigger forKey:@"trigger"];
}

-(void)execute {
  if (!self.enabled) {
    return;
  }

  // Executing script from source.
  if ([self.scriptFilePath isEqualToString:@""] && ![self.scriptSource isEqualToString:@""]) {
    // [SDTScriptLauncher launchScript:self.scriptSource];
    [SDTActionsController runScript:self.scriptSource target:self.target];
    return;
  }

  // Executing script from file.
  if (![self.scriptFilePath isEqualToString:@""] && [self.scriptSource isEqualToString:@""]) {
    if ([[NSFileManager defaultManager] fileExistsAtPath:self.scriptFilePath isDirectory:nil]) {
      // [SDTScriptLauncher launchScriptAtURL:[NSURL fileURLWithPath:self.scriptFilePath]];
      [SDTActionsController runScriptAtPath:self.scriptFilePath target:self.target];
    } else {
      // TODO: Should throw an error here.
    }
  }
}

-(NSDictionary*)objectAsDictionary {
  return @{
    @"id": self.actionID,
    @"name": self.name,
    @"enabled": @(self.enabled),
    @"scriptFilePath": self.scriptFilePath,
    @"scriptSource": self.scriptSource,
    @"origin": self.origin,
    @"target": self.target,
    @"trigger": self.trigger
  };
}

-(BOOL)compare:(SDTScriptableAction*)other {
  return [self.actionID isEqualToString:other.actionID]
    && [self.name isEqualToString:other.name]
    && [self.scriptFilePath isEqualToString:other.scriptFilePath]
    && [self.scriptSource isEqualToString:other.scriptSource]
    && [self.target isEqualToString:other.target];
}

@end


text:
package com.ibm.streamsx.topology.internal.core;

public interface InternalProperties {

    String PREFIX = "topology.internal.";

    /**
     * Properties with the prefix SPL_PREFIX ({@value}
     * are turned into JSON properties in an {@code spl}
     * JSON config object the property name stripped of
     * the prefix.
     *
     * E.g.
     * topology.internal.spl.toolkits becomes toolkits
     * in the spl JSON object.
     */
    String SPL_PREFIX = PREFIX + "spl.";

    /**
     * List of toolkits & toolkit dependencies used by the topology.
     * JSONArray containing a JSON object with fields:
     * name - Name of toolkit
     * version - dependency version string
     * root (optional) - location of toolkit.
     *
     */
    String TOOLKITS_JSON = "toolkits";
    String TOOLKITS = SPL_PREFIX + TOOLKITS_JSON;
}


text:
import { Component } from '@angular/core';
import { trigger, animate, animateChild, transition, keyframes, style } from '@angular/animations';

@Component({
	selector: 'ng-animation',
	templateUrl: './ng-animation.html',
	animations: [
		trigger('routeAnimation', [
			transition('void => *', [
				animate('0.5s ease-out', keyframes([
					style({ opacity: 0, offset: 0 }),
					style({ opacity: 0.25, offset: 0.5 }),
					style({ opacity: 0.5, offset: 1 })
				]))
				// animateChild()
			], { delay: '10s' })
		])
	]
})
export class NgAnimationComponent {
	constructor() {
	}

	getRouteAnimation(outlet: any) {
		return 'firstPage';
	}
}


text:
#pragma once

#include <QWidget>
#include <QTreeView>
#include <QWidget>
//#include <phonon/MediaObject>
#include <QTreeView>
#include <QToolBar>
#include <QLabel>
#include <QProgressBar>

#include <core/T.h>
#include <core/interfaces/IPlayQueue.h>
#include <core/data/MediaItem.h>
#include <core/coreutils/Utils.h>
#include <uicommon/uiutils/AudioLoader.h>
#include <uicommon/itemmodels/MediaItemModel.h>

namespace GreenChilli {

class PlayQueueTrackModel : public Tanyatu::Ui::MediaItemModel
{
public:
    explicit PlayQueueTrackModel( QObject *parent )
        : Tanyatu::Ui::MediaItemModel( 3, parent )
    {

    }

    QVariant data( const QModelIndex &index, int role ) const
    {
        if( role == Qt::BackgroundColorRole ) {
            if( PLAYQUEUE()->currentIndex() == index.row() ) {
                return QColor( 0xB2, 0x6B, 0x00 );
            }
        }
        if( role == Qt::TextAlignmentRole && index.column() == 2 ) {
            return Qt::AlignRight;
        }
        return Tanyatu::Ui::MediaItemModel::data( index, role );
    }

    QVariant dataForTrack( Tanyatu::Data::MediaItem *item,
                           int column ) const
    {
        if( item != nullptr
                && ( item->type() == Tanyatu::Data::Media_LocalAudio
                     || item->type() == Tanyatu::Data::Media_StoredAudio )) {
            Tanyatu::Data::AudioTrack *audio =
                    static_cast< Tanyatu::Data::AudioTrack *>( item );
            switch( column ) {
            case 0: return audio->trackId();
            case 1: return audio->title();
            case 2: return Tanyatu::Utils::getStringTime(
                            audio->duration() );
            }
        }
        return "";
    }

    QString headerForColumn( int column ) const
    {
        switch( column ) {
        case 0: return tr( "Track Id" );
        case 1: return tr( "Title" );
        case 2: return tr( "Len" );
        }
        return "";
    }

    void clearSelection( int /*row*/ ) {
        beginResetModel();
        endResetModel();
    }
};

class PlaylistWidget : public QWidget
{
    Q_OBJECT

public:
    explicit PlaylistWidget(QWidget *parent = 0);

public slots:
    void addFolder();

    void addFiles();

    void removeItems();

    void addUrls( QList< QUrl > urls );

    void setSelectedAsCurrent();

protected:
    void dragEnterEvent(QDragEnterEvent * event);

    void dropEvent(QDropEvent *event);

    void contextMenuEvent(QContextMenuEvent *event);

private slots:
    void indexChanged( Tanyatu::Data::MediaItem *dummy, int index);

    void onPlaylistChanged();

    void setStatus(QString text);

    void clearStatus();

    void setupUi();

    void setupConnections();

    void setupToolbar();

    void showLoadProgress( int numFilesLoaded, int totalFilesToLoad );

    void onAudioTrackLoaded( Tanyatu::Data::AudioTrack *track );

    void onLoadingStarted( int numFilesToLoad );

    void onLoadingFinished( QList< QUrl > *inputUrls,
                            QList< Tanyatu::Data::AudioTrack *> *loadedTracks );

    void rowSelected( QModelIndex index );

private:
    QTreeView *m_view;

    QToolBar *m_toolBar;

    Tanyatu::Worker::AudioLoader *m_loader;

    QProgressBar *m_progress;

    QLabel *m_status;

    Tanyatu::IPlayQueue *m_playlist;

    QAction *m_removeAction;

    QAction *m_removeAllAction;

    QAction *m_addFolderAction;

    QAction *m_addFilesAction;

    QAction *m_randomize;

    QAction *m_loopAction;

    PlayQueueTrackModel *m_model;

    int m_prevSelection;
};

}


text:
#ifndef PRELUDE_HPP_
#define PRELUDE_HPP_

/*
 * Author: jrahm
 * created: 2015/01/18
 * prelude.hpp:
 *  This header contains basic classes, macros and routines
 *  that should be included by default.
 */

#include <types.h>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>

#define ENUM_TO_STRING(EnumType, Num, ...) \
    inline std::string toString(EnumType en) { \
        const char* names[] = { __VA_ARGS__ }; \
        return en >= Num ? "(Unknown)" : names[en]; \
    }

#define FOR_EACH(itr, vec)\
    for( itr = (vec).begin() ; itr != (vec).end() ; ++ itr )

/**
 * @brief A simple class that acts like a pointer, but deletes itself after going out of scope
 *
 * This is very similar to the unique pointer definition from C++ 11,
 * but the support for C++ 11 on these different platforms is shotty at best
 */
template <class T>
class uptr { /* unique pointer definition from C++ 11 */
public:
    template <class U>
    uptr(U* val) {
        mine = val;
        nref = new int(1);
    }

    uptr() {
        mine = NULL;
        nref = NULL;
    }

    uptr(const uptr<T>& oth) {
        mine = oth.mine;
        nref = oth.nref;
        if(nref) (*nref) ++;
    }

    void operator=( const uptr<T>& oth ) {
        unref();
        mine = oth.mine;
        nref = oth.nref;
        if(nref) (*nref) ++;
    }

    bool operator==(T* oth) {
        return mine == oth;
    }

    void unref() {
        if(nref) {
            (*nref) --;
            if( *nref == 0 ) {
                delete mine;
                delete nref;
            }
        }
    }

    void operator=( T* oth ) {
        unref();
        nref = new int(1);
        mine = oth;
    }

    T& operator *() {
        return *mine;
    };

    T* operator ->() {
        return get();
    }

    const T* operator ->() const {
        return mine;
    }

    T*& get() {
        return mine;
    }

    const T*& get() const {
        return mine;
    }

    T*& cleanref() {
        delete mine;
        mine = NULL;
        return mine;
    }

    /* Free the pointer from this structure */
    T* save() {
        T* ret = mine;
        mine = NULL;
        return ret;
    }

    ~uptr() {
        unref();
    }
private:
    T* mine;
    int* nref;
};

class Exception {
public:
    inline Exception( const std::string& message ) : message(message) {}
    inline Exception( const char* message ) : message(message) {}
    inline Exception() : message() {};

    const char* getMessage() const {
        return message.c_str();
    }
protected:
    void setMessage( const char* mesg ) {
        this->message = mesg;
    }
    std::string message;
};

class InvalidArgumentException: public Exception {
public:
    inline InvalidArgumentException( const char* msg ):
        Exception(msg) {}
};

class CException : public Exception {
public:
    inline CException(const char* message, int rc) :
        Exception(message) {
        char buf[4096];
        snprintf(buf, sizeof(buf), "%s (%d): %s",
            message, rc, strerror(rc));
        this->message = buf;
    }

    inline CException( int rc ) {
        this->rc = rc;
        setMessage(strerror(this->rc));
    }

    inline int getCode() {
        return rc;
    }
private:
    int rc;
};

class ExceptionHandler {
public:
    virtual void onException(Exception& exp) = 0;

    static void setGlobalUncaughtExceptionHandler(ExceptionHandler* handler);
    static ExceptionHandler* getGlobalUncaughtExceptionHandler();
    static ExceptionHandler* getDefaultGlobalUncaughtExceptionHandler();
};

#endif /* PRELUDE_HPP_ */


text:
package com.plexobject.handler;

/**
 * This interface defines method to handle requests of given type
 *
 * @author shahzad bhatti
 *
 * @param <T>
 */
public interface Handler<T> {
    void handle(T request);
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>%pageTitle%</title>
    <meta name="description" content="%pageDescription%" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="img/favicon.png" />

    <link href="css/notices.css" type="text/css" rel="stylesheet" />
    <link href="css/normalize.css" type="text/css" rel="stylesheet" />
    <link href="css/foundation.css" type="text/css" rel="stylesheet" />
    <link href="icons/foundation-icons.css" type="text/css" rel="stylesheet" />
    <link href="css/animate.css" type="text/css" rel="stylesheet" />
    <link href="css/pizza.css" type="text/css" rel="stylesheet" />
    <link href="css/app.css" type="text/css" rel="stylesheet" />
    <link href="css/print.css" rel="stylesheet" type="text/css" media="print" />

%name%

%description%

            %basicInfo%

 个人简介

                    %information%

 技能专长

                    %specialities%

 技能评价

编程技能

                        %skillsList%

能力简述

                        %skillsDescription%

 社区经验

Github:

                                领域
                                日常社区活动

                            %community%

 个人经验

                    %experience%

 项目经历(部分)

                        %project%

 开源项目

                    %openSource%

 扩展技能

                    %interests%

2017-2018 晋先森


text:
package com.huawei.streaming.window;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.huawei.streaming.view.IDataCollection;
import com.huawei.streaming.view.IRenew;
import com.huawei.streaming.view.ViewImpl;

/**
 * <长度窗口抽象类>
 *
 */
public abstract class LengthBasedWindow extends ViewImpl implements IWindow, IRenew
{
    /**
     * 序列化ID
     */
    private static final long serialVersionUID = -591855531989393141L;

    /**
     * 日志打印对象
     */
    private static final Logger LOG = LoggerFactory.getLogger(LengthBasedWindow.class);

    /**
     * 窗口事件保持长度
     */
    private int keepLength;

    /**
     * 窗口事件缓存集合
     */
    private IDataCollection dataCollection;

    /**
     * <默认构造函数>
     *@param keepLength 窗口保持长度
     */
    public LengthBasedWindow(int keepLength)
    {
        super();
        if (keepLength > 0)
        {
            this.keepLength = keepLength;
            LOG.debug("Length Window Keep Length: {}.", keepLength);
        }
        else
        {
            LOG.error("Invalid keepLength:  {}.", keepLength);
            throw new IllegalArgumentException("Invalid keepLength: " + keepLength);
        }
    }

    /**
     * <获取窗口保持长度 >
     * @return 窗口保持长度
     */
    public int getKeepLength()
    {
        return keepLength;
    }

    /**
     * {@inheritDoc}
     */
    public void setDataCollection(IDataCollection dataCollection)
    {
        if (dataCollection == null)
        {
            LOG.error("Invalid dataCollection.");
            throw new IllegalArgumentException("Invalid dataCollection");
        }

        this.dataCollection = dataCollection;
    }

    /**
     * 返回窗口事件缓存集
     * @return 窗口事件缓存集
     */
    public IDataCollection getDataCollection()
    {
        return dataCollection;
    }
}


text:
package net.quantium.harvester.entity;

import java.io.Serializable;

import net.quantium.harvester.entity.hitbox.Hitbox;
import net.quantium.harvester.item.ItemSlot;
import net.quantium.harvester.render.Renderer;
import net.quantium.harvester.world.PassingInfo;
import net.quantium.harvester.world.World;

public abstract class Entity implements Serializable, Comparable<Entity>{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	public int x = 24, y = 24;
	public Hitbox hitbox = new Hitbox(12, 12);
	public World world;
	public boolean removed;

	public abstract void init();

	public abstract void update();

	public abstract void render(Renderer render);

	public abstract void bump(Entity ent);

	public abstract boolean isPassable(Entity ent);

	public void remove(){
		this.removed = true;
	}

	public void move(int xx, int yy){
		PassingInfo infx = world.tryPass(this, xx, 0);
		PassingInfo infy = world.tryPass(this, 0, yy);
		if(infx.isPassed()){
			x += xx;
			infx.getSteppedOn().onInteract(world, infx.getTileX(), infx.getTileY(), this, InteractionMode.STEP);
			for(Entity e : infx.getBumped())
				e.bump(this);
		}
		if(infy.isPassed()){
			y += yy;
			infy.getSteppedOn().onInteract(world, infy.getTileX(), infy.getTileY(), this, InteractionMode.STEP);
			for(Entity e : infy.getBumped())
				e.bump(this);
		}
	}

	public abstract boolean onInteract(World world2, PlayerEntity playerEntity, InteractionMode im, ItemSlot active);

	public enum InteractionMode{
		LEFT, RIGHT, OTHER, BUTTON, STEP;
	}

	@Override
	public int compareTo(Entity b) {
		if(b == null) return 0;
		if (b.y < y) return 1;
		if (b.y > y) return -1;
		return 0;
	}

	public int sqrDistanceTo(Entity e){
		return (x - e.x) * (x - e.x) + (y - e.y) * (y - e.y);
	}

	public int sqrDistanceTo(int x, int y){
		return (this.x - x) * (this.x - x) + (this.y - y) * (this.y - y);
	}
}


text:
'use strict';

const assert = require('assert');

const dsalg = require('../../../..');

const StackDynamicArray = dsalg.data_structures.stack.stack.StackDynamicArray;

describe('StackDynamicArray', function() {
    it('Instantiation', function() {
        const stack = new StackDynamicArray();
        assert.ok(stack instanceof StackDynamicArray);
    });
});


text:
package com.springsource.petclinic.domain;

import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import javax.validation.constraints.Size;
import javax.validation.constraints.NotNull;
import java.util.Date;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.springframework.format.annotation.DateTimeFormat;

@RooJavaBean
@RooToString
@RooEntity
public abstract class AbstractPerson {

    @Size(min = 3, max = 30)
    private String firstName;

    @NotNull
    @Size(min = 3, max = 30)
    private String lastName;

    @NotNull
    @Size(min = 1, max = 50)
    private String address;

    @NotNull
    @Size(max = 30)
    private String city;

    @NotNull
    private String telephone;

    @Size(max = 30)
    private String homePage;

    @Size(min = 6, max = 30)
    private String email;

    @NotNull
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(style = "M-")
    private Date birthDay;
}


text:
local _, Addon = ...

-- the expected size of an icon
local ICON_SIZE = 36
local DEFAULT_STATE = 'seconds'

local After = _G.C_Timer.After
local GetTickTime = _G.GetTickTime
local min = math.min
local round = _G.Round
local UIParent = _G.UIParent

local displays = {}

local Display = Addon:CreateHiddenFrame('Frame')

Display.__index = Display

function Display:Get(owner)
    return displays[owner]
end

function Display:GetOrCreate(owner)
    if not owner then
        return
    end

    return displays[owner] or self:Create(owner)
end

function Display:Create(owner)
    local display = setmetatable(Addon:CreateHiddenFrame('Frame', nil, owner), Display)

    display.text = display:CreateFontString(nil, 'OVERLAY')
    display.cooldowns = {}

    display.updateSize = function()
        local oldSize = display.sizeRatio
        local newSize = display:CalculateSizeRatio()

        local oldScale = display.scaleRatio
        local newScale = display:CalculateScaleRatio()

        if not (oldSize == newSize and oldScale == newScale) then
            display:UpdateCooldownTextPositionSizeAndColor()
        end

        display.updatingSize = nil
    end

    display:UpdateSize()
    display:SetScript('OnSizeChanged', self.UpdateSize)

    displays[owner] = display
    return display
end

-- defer updating size until the next frame
-- this is to work around SUF scaling auras after setting timers
function Display:UpdateSize()
    if self.updatingSize then
        return
    end

    self.updatingSize = true
    After(GetTickTime(), self.updateSize)
end

-- update text when the timer notifies us of a change
function Display:OnTimerTextUpdated(timer, text)
    if timer ~= self.timer then
        return
    end

    self.text:SetText(text or '')
end

function Display:OnTimerStateUpdated(timer, state)
    if timer ~= self.timer then
        return
    end

    state = state or DEFAULT_STATE

    if (self.state ~= state) then
        self.state = state
        self:UpdateCooldownTextPositionSizeAndColor()
    end
end

function Display:OnTimerDestroyed(timer)
    if self.timer == timer then
        self:RemoveCooldown(self.activeCooldown)
    end
end

function Display:CalculateSizeRatio()
    local sizeRatio
    local sets = self:GetSettings()

    if sets and sets.scaleText then
        sizeRatio = round(min(self:GetSize())) / ICON_SIZE
    else
        sizeRatio = 1
    end

    self.sizeRatio = sizeRatio

    return sizeRatio
end

function Display:CalculateScaleRatio()
    local scaleRatio = self:GetEffectiveScale() / UIParent:GetEffectiveScale()

    self.scaleRatio = scaleRatio

    return scaleRatio
end

function Display:AddCooldown(cooldown)
    self.cooldowns[cooldown] = true
    self:UpdateActiveCooldown()
end

function Display:RemoveCooldown(cooldown)
    local cooldowns = self.cooldowns

    if cooldowns[cooldown] then
        cooldowns[cooldown] = nil
        self:UpdateActiveCooldown()
    end
end

function Display:UpdateActiveCooldown()
    local cooldown = self:GetCooldownWithHighestPriority()

    if self.activeCooldown ~= cooldown then
        self.activeCooldown = cooldown

        -- reposition the display to be above the cooldown
        if cooldown then
            self:SetAllPoints(cooldown)
            self:SetFrameLevel(cooldown:GetFrameLevel() + 7)
            self:UpdateCooldownTextFont()
            self:UpdateCooldownTextPositionSizeAndColor()
        end
    end

    -- always try to update the timer here
    -- as the active cooldown's duration may have changed
    self:UpdateTimer()
end

function Display:UpdateTimer()
    local oldTimer = self.timer and self.timer
    local oldTimerKey = oldTimer and oldTimer.key

    local newTimer = self.activeCooldown and Addon.Timer:GetOrCreate(self.activeCooldown)
    local newTimerKey = newTimer and newTimer.key

    -- update subscription if we're watching a different timer
    if oldTimer ~= newTimer then
        self.timer = newTimer

        if oldTimer then
            oldTimer:Unsubscribe(self)
        end
    end

    -- only show display if we have a timer to watch
    if newTimer then
        newTimer:Subscribe(self)

        -- only update text if the timer we're watching has changed
        if newTimerKey ~= oldTimerKey then
            self:OnTimerTextUpdated(newTimer, newTimer.text)
            self:OnTimerStateUpdated(newTimer, newTimer.state)
            self:Show()
        end

        self:UpdateSize()
    else
        self:Hide()
    end
end

do
    -- given two cooldown cooldowns, returns the more important one
    local function cooldown_Compare(lhs, rhs)
        if lhs == rhs then
            return lhs
        end

        -- prefer the one that isn't nil
        if rhs == nil then
            return lhs
        end

        if lhs == nil then
            return rhs
        end

        -- prefer cooldownProxies ending first
        local lEnd = lhs._occ_start + lhs._occ_duration
        local rEnd = rhs._occ_start + rhs._occ_duration

        if lEnd < rEnd then
            return lhs
        end

        if lEnd > rEnd then
            return rhs
        end

        -- then check priority
        if lhs._occ_priority < rhs._occ_priority then
            return lhs
        end

        return rhs
    end

    function Display:GetCooldownWithHighestPriority()
        local result

        for cooldown in pairs(self.cooldowns) do
            result = cooldown_Compare(cooldown, result)
        end

        return result
    end
end

function Display:UpdateCooldownText()
    self:UpdateCooldownTextFont()
    self:UpdateCooldownTextPositionSizeAndColor()
end

function Display:UpdateCooldownTextFont()
    local sets = self:GetSettings()
    local text = self.text

    if sets then
        if not text:SetFont(sets.fontFace, sets.fontSize, sets.fontOutline) then
            text:SetFont(STANDARD_TEXT_FONT, sets.fontSize, sets.fontOutline)
        end

        local shadow = sets.fontShadow
        text:SetShadowColor(shadow.r, shadow.g, shadow.b, shadow.a)
        text:SetShadowOffset(shadow.x, shadow.y)
    else
        text:SetFont(STANDARD_TEXT_FONT, 8, 'OUTLINE')
    end
end

-- props:{size, scale, state, anchor, xOff, yOff}
function Display:UpdateCooldownTextPositionSizeAndColor()
    local sets = self:GetSettings()
    if not sets then
        return
    end

    local text = self.text
    local sizeRatio = self.sizeRatio or self:CalculateSizeRatio()
    local scaleRatio = self.scaleRatio or self:CalculateScaleRatio()

    -- hide text if the display size is below our min ratio
    if (sizeRatio * scaleRatio) <= (sets.minSize or 0) then
        text:Hide()
        return
    end

    local style = sets.textStyles[self.state or DEFAULT_STATE]
    local styleRatio = style and style.scale or 1

    -- hide text if the scale ratio is zero or below
    if styleRatio <= 0 then
        text:Hide()
        return
    end

    local textScale = sizeRatio * styleRatio
    text:Show()
    text:SetScale(textScale)
    text:SetTextColor(style.r, style.g, style.b, style.a)

    text:ClearAllPoints()
    text:SetPoint(sets.anchor, sets.xOff / textScale, sets.yOff / textScale)
end

function Display:GetSettings()
    return self.activeCooldown and self.activeCooldown._occ_settings
end

function Display:ForAll(method, ...)
    for _, display in pairs(displays) do
        local func = display[method]
        if type(func) == 'function' then
            func(display, ...)
        end
    end
end

function Display:ForActive(method, ...)
    for _, display in pairs(displays) do
        if display.timer ~= nil then
            local func = display[method]
            if type(func) == 'function' then
                func(display, ...)
            end
        end
    end
end

-- exports
Addon.Display = Display


text:
using System.Text;
using System.Text.RegularExpressions;
using System.Security.Cryptography;

namespace Exceptionless.Core.Extensions;

public static class StringExtensions {
    public static bool IsLocalHost(this string ip) {
        if (String.IsNullOrEmpty(ip))
            return false;

        return String.Equals(ip, "127.0.0.1") || String.Equals(ip, "::1");
    }

    /// <summary>
    /// Very basic check to try and remove the port from any ipv4 or ipv6 address.
    /// </summary>
    /// <returns>ip address without port</returns>
    public static string ToAddress(this string ip) {
        if (String.IsNullOrEmpty(ip) || String.Equals(ip, "::1"))
            return ip;

        string[] parts = ip.Split(new[] { ':' }, 9);
        if (parts.Length == 2)  // 1.2.3.4:port
            return parts[0];
        if (parts.Length > 8) // 1:2:3:4:5:6:7:8:port
            return String.Join(":", parts.Take(8));

        return ip;
    }

    public static bool IsPrivateNetwork(this string ip) {
        if (String.IsNullOrEmpty(ip))
            return false;

        if (ip.IsLocalHost())
            return true;

        // 10.0.0.0 – 10.255.255.255 (Class A)
        if (ip.StartsWith("10."))
            return true;

        // 172.16.0.0 – 172.31.255.255 (Class B)
        if (ip.StartsWith("172.")) {
            for (int range = 16; range < 32; range++) {
                if (ip.StartsWith("172." + range + "."))
                    return true;
            }
        }

        // 192.168.0.0 – 192.168.255.255 (Class C)
        return ip.StartsWith("192.168.");
    }

    public static string TrimScript(this string script) {
        if (String.IsNullOrEmpty(script))
            return script;

        return script
            .Replace("\r", String.Empty)
            .Replace("\n", String.Empty)
            .Replace("  ", " ");
    }

    public static string GetNewToken() {
        return GetRandomString(40);
    }

    public static string GetRandomString(int length, string allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") {
        if (length < 0)
            throw new ArgumentOutOfRangeException(nameof(length), "length cannot be less than zero.");

        if (String.IsNullOrEmpty(allowedChars))
            throw new ArgumentException("allowedChars may not be empty.");

        const int byteSize = 0x100;
        char[] allowedCharSet = new HashSet<char>(allowedChars).ToArray();
        if (byteSize < allowedCharSet.Length)
            throw new ArgumentException($"allowedChars may contain no more than {byteSize} characters.");

        var result = new StringBuilder();
        byte[] buf = new byte[128];

        while (result.Length < length) {
            RandomNumberGenerator.Fill(buf);
            for (int i = 0; i < buf.Length && result.Length < length; ++i) {
                int outOfRangeStart = byteSize - (byteSize % allowedCharSet.Length);
                if (outOfRangeStart <= buf[i])
                    continue;
                result.Append(allowedCharSet[buf[i] % allowedCharSet.Length]);
            }
        }

        return result.ToString();
    }

    // TODO: Add support for detecting the culture number separators as well as suffix (Ex. 100d)
    public static bool IsNumeric(this string value) {
        if (String.IsNullOrEmpty(value))
            return false;

        for (int i = 0; i < value.Length; i++) {
            if (Char.IsNumber(value[i]))
                continue;

            if (i == 0 && value[i] == '-')
                continue;

            return false;
        }

        return true;
    }

    public static bool IsValidFieldName(this string value) {
        if (value == null || value.Length > 25)
            return false;

        return IsValidIdentifier(value);
    }

    public static bool IsValidIdentifier(this string value) {
        if (value == null)
            return false;

        for (int index = 0; index < value.Length; index++) {
            if (!Char.IsLetterOrDigit(value[index]) && value[index] != '-')
                return false;
        }

        return true;
    }

    public static string ToSaltedHash(this string password, string salt) {
        byte[] passwordBytes = Encoding.Unicode.GetBytes(password);
        byte[] saltBytes = Convert.FromBase64String(salt);
        var hashStrategy = new HMACSHA256();
        if (hashStrategy.Key.Length == saltBytes.Length) {
            hashStrategy.Key = saltBytes;
        }
        else if (hashStrategy.Key.Length < saltBytes.Length) {
            byte[] keyBytes = new byte[hashStrategy.Key.Length];
            Buffer.BlockCopy(saltBytes, 0, keyBytes, 0, keyBytes.Length);
            hashStrategy.Key = keyBytes;
        }
        else {
            byte[] keyBytes = new byte[hashStrategy.Key.Length];
            for (int i = 0; i < keyBytes.Length;) {
                int len = Math.Min(saltBytes.Length, keyBytes.Length - i);
                Buffer.BlockCopy(saltBytes, 0, keyBytes, i, len);
                i += len;
            }
            hashStrategy.Key = keyBytes;
        }

        byte[] result = hashStrategy.ComputeHash(passwordBytes);
        return Convert.ToBase64String(result);
    }

    public static string ToDelimitedString(this IEnumerable<string> values, string delimiter = ",") {
        if (String.IsNullOrEmpty(delimiter))
            delimiter = ",";

        var sb = new StringBuilder();
        foreach (string i in values) {
            if (sb.Length > 0)
                sb.Append(delimiter);

            sb.Append(i);
        }

        return sb.ToString();
    }

    public static string[] FromDelimitedString(this string value, string delimiter = ",") {
        if (String.IsNullOrEmpty(value))
            return null;

        if (String.IsNullOrEmpty(delimiter))
            delimiter = ",";

        return value.Split(new[] { delimiter }, StringSplitOptions.RemoveEmptyEntries).ToArray();
    }

    public static string ToLowerUnderscoredWords(this string value, char delimiter = '_') {
        if (value == null)
            return null;

        var builder = new StringBuilder(value.Length + 10);
        for (int index = 0; index < value.Length; index++) {
            char c = value[index];
            if (Char.IsUpper(c)) {
                if (index > 0 && value[index - 1] != delimiter)
                    builder.Append(delimiter);

                builder.Append(Char.ToLower(c));
            }
            else {
                builder.Append(c);
            }
        }

        return builder.ToString();
    }

    public static bool AnyWildcardMatches(this string value, IEnumerable<string> patternsToMatch, bool ignoreCase = false) {
        if (ignoreCase)
            value = value.ToLowerInvariant();

        return patternsToMatch.Any(pattern => CheckForMatch(pattern, value, ignoreCase));
    }

    private static bool CheckForMatch(string pattern, string value, bool ignoreCase = true) {
        bool startsWithWildcard = pattern.StartsWith("*");
        if (startsWithWildcard)
            pattern = pattern.Substring(1);

        bool endsWithWildcard = pattern.EndsWith("*");
        if (endsWithWildcard)
            pattern = pattern.Substring(0, pattern.Length - 1);

        if (ignoreCase)
            pattern = pattern.ToLowerInvariant();

        if (startsWithWildcard && endsWithWildcard)
            return value.Contains(pattern);

        if (startsWithWildcard)
            return value.EndsWith(pattern);

        if (endsWithWildcard)
            return value.StartsWith(pattern);

        return value.Equals(pattern);
    }

    public static string ToConcatenatedString<T>(this IEnumerable<T> values, Func<T, string> stringSelector) {
        return values.ToConcatenatedString(stringSelector, String.Empty);
    }

    public static string ToConcatenatedString<T>(this IEnumerable<T> values, Func<T, string> action, string separator) {
        var sb = new StringBuilder();
        foreach (var item in values) {
            if (sb.Length > 0)
                sb.Append(separator);

            sb.Append(action(item));
        }

        return sb.ToString();
    }

    public static string ReplaceFirst(this string input, string find, string replace) {
        if (String.IsNullOrEmpty(input))
            return input;

        int i = input.IndexOf(find, StringComparison.Ordinal);
        if (i < 0)
            return input;

        string pre = input.Substring(0, i);
        string post = input.Substring(i + find.Length);
        return String.Concat(pre, replace, post);
    }

    public static IEnumerable<string> SplitLines(this string text) {
        return text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).Where(l => !String.IsNullOrWhiteSpace(l)).Select(l => l.Trim());
    }

    public static string StripInvisible(this string s) {
        return s.Replace("\r\n", " ").Replace('\n', ' ').Replace('\t', ' ');
    }

    public static string NormalizeLineEndings(this string text, string lineEnding = null) {
        if (String.IsNullOrEmpty(lineEnding))
            lineEnding = Environment.NewLine;

        text = text.Replace("\r\n", "\n");
        if (lineEnding != "\n")
            text = text.Replace("\r\n", lineEnding);

        return text;
    }

    public static string Truncate(this string text, int keep) {
        if (String.IsNullOrEmpty(text))
            return String.Empty;

        string buffer = NormalizeLineEndings(text);
        if (buffer.Length <= keep)
            return buffer;

        return String.Concat(buffer.Substring(0, keep - 3), "...");
    }

    public static string TypeName(this string typeFullName) {
        return typeFullName?.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries).Last();
    }

    public static string ToLowerFiltered(this string value, char[] charsToRemove) {
        var builder = new StringBuilder(value.Length);

        for (int index = 0; index < value.Length; index++) {
            char c = value[index];
            if (Char.IsUpper(c))
                c = Char.ToLowerInvariant(c);

            bool includeChar = true;
            for (int i = 0; i < charsToRemove.Length; i++) {
                if (charsToRemove[i] == c) {
                    includeChar = false;
                    break;
                }
            }

            if (includeChar)
                builder.Append(c);
        }

        return builder.ToString();
    }

    public static string[] SplitAndTrim(this string s, char[] separator) {
        if (s.IsNullOrEmpty())
            return new string[0];

        string[] result = s.Split(separator, StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < result.Length; i++)
            result[i] = result[i].Trim();

        return result;

    }

    public static bool IsNullOrEmpty(this string item) {
        return String.IsNullOrEmpty(item);
    }

    private static readonly Regex _entityResolver = new Regex("([&][#](?'decimal'[0-9]+);)|([&][#][(x|X)](?'hex'[0-9a-fA-F]+);)|([&](?'html'\\w+);)");

    public static string HtmlEntityDecode(this string encodedText) {
        return _entityResolver.Replace(encodedText, new MatchEvaluator(ResolveEntityAngleAmp));
    }

    private static string ResolveEntityAngleAmp(Match matchToProcess) {
        return !matchToProcess.Groups["decimal"].Success ? (!matchToProcess.Groups["hex"].Success ? (!matchToProcess.Groups["html"].Success ? "Y" : EntityLookup(matchToProcess.Groups["html"].Value)) : Convert.ToChar(HexToInt(matchToProcess.Groups["hex"].Value)).ToString()) : Convert.ToChar(Convert.ToInt32(matchToProcess.Groups["decimal"].Value)).ToString();
    }

    public static int HexToInt(string input) {
        int num = 0;
        input = input.ToUpperInvariant();
        char[] chArray = input.ToCharArray();
        for (int index = chArray.Length - 1; index >= 0; --index) {
            if ((int)chArray[index] >= 48 && (int)chArray[index] <= 57)
                num += ((int)chArray[index] - 48) * (int)Math.Pow(16.0, (double)(chArray.Length - 1 - index));
            else if ((int)chArray[index] >= 65 && (int)chArray[index] <= 70) {
                num += ((int)chArray[index] - 55) * (int)Math.Pow(16.0, (double)(chArray.Length - 1 - index));
            }
            else {
                num = 0;
                break;
            }
        }
        return num;
    }

    private static string EntityLookup(string entity) {
        string str = "";
        switch (entity) {
            case "Aacute":
                str = Convert.ToChar(193).ToString();
                break;
            case "aacute":
                str = Convert.ToChar(225).ToString();
                break;
            case "acirc":
                str = Convert.ToChar(226).ToString();
                break;
            case "Acirc":
                str = Convert.ToChar(194).ToString();
                break;
            case "acute":
                str = Convert.ToChar(180).ToString();
                break;
            case "AElig":
                str = Convert.ToChar(198).ToString();
                break;
            case "aelig":
                str = Convert.ToChar(230).ToString();
                break;
            case "Agrave":
                str = Convert.ToChar(192).ToString();
                break;
            case "agrave":
                str = Convert.ToChar(224).ToString();
                break;
            case "alefsym":
                str = Convert.ToChar(8501).ToString();
                break;
            case "Alpha":
                str = Convert.ToChar(913).ToString();
                break;
            case "alpha":
                str = Convert.ToChar(945).ToString();
                break;
            case "amp":
                str = Convert.ToChar(38).ToString();
                break;
            case "and":
                str = Convert.ToChar(8743).ToString();
                break;
            case "ang":
                str = Convert.ToChar(8736).ToString();
                break;
            case "aring":
                str = Convert.ToChar(229).ToString();
                break;
            case "Aring":
                str = Convert.ToChar(197).ToString();
                break;
            case "asymp":
                str = Convert.ToChar(8776).ToString();
                break;
            case "Atilde":
                str = Convert.ToChar(195).ToString();
                break;
            case "atilde":
                str = Convert.ToChar(227).ToString();
                break;
            case "auml":
                str = Convert.ToChar(228).ToString();
                break;
            case "Auml":
                str = Convert.ToChar(196).ToString();
                break;
            case "bdquo":
                str = Convert.ToChar(8222).ToString();
                break;
            case "Beta":
                str = Convert.ToChar(914).ToString();
                break;
            case "beta":
                str = Convert.ToChar(946).ToString();
                break;
            case "brvbar":
                str = Convert.ToChar(166).ToString();
                break;
            case "bull":
                str = Convert.ToChar(8226).ToString();
                break;
            case "cap":
                str = Convert.ToChar(8745).ToString();
                break;
            case "Ccedil":
                str = Convert.ToChar(199).ToString();
                break;
            case "ccedil":
                str = Convert.ToChar(231).ToString();
                break;
            case "cedil":
                str = Convert.ToChar(184).ToString();
                break;
            case "cent":
                str = Convert.ToChar(162).ToString();
                break;
            case "chi":
                str = Convert.ToChar(967).ToString();
                break;
            case "Chi":
                str = Convert.ToChar(935).ToString();
                break;
            case "circ":
                str = Convert.ToChar(710).ToString();
                break;
            case "clubs":
                str = Convert.ToChar(9827).ToString();
                break;
            case "cong":
                str = Convert.ToChar(8773).ToString();
                break;
            case "copy":
                str = Convert.ToChar(169).ToString();
                break;
            case "crarr":
                str = Convert.ToChar(8629).ToString();
                break;
            case "cup":
                str = Convert.ToChar(8746).ToString();
                break;
            case "curren":
                str = Convert.ToChar(164).ToString();
                break;
            case "dagger":
                str = Convert.ToChar(8224).ToString();
                break;
            case "Dagger":
                str = Convert.ToChar(8225).ToString();
                break;
            case "darr":
                str = Convert.ToChar(8595).ToString();
                break;
            case "dArr":
                str = Convert.ToChar(8659).ToString();
                break;
            case "deg":
                str = Convert.ToChar(176).ToString();
                break;
            case "Delta":
                str = Convert.ToChar(916).ToString();
                break;
            case "delta":
                str = Convert.ToChar(948).ToString();
                break;
            case "diams":
                str = Convert.ToChar(9830).ToString();
                break;
            case "divide":
                str = Convert.ToChar(247).ToString();
                break;
            case "eacute":
                str = Convert.ToChar(233).ToString();
                break;
            case "Eacute":
                str = Convert.ToChar(201).ToString();
                break;
            case "Ecirc":
                str = Convert.ToChar(202).ToString();
                break;
            case "ecirc":
                str = Convert.ToChar(234).ToString();
                break;
            case "Egrave":
                str = Convert.ToChar(200).ToString();
                break;
            case "egrave":
                str = Convert.ToChar(232).ToString();
                break;
            case "empty":
                str = Convert.ToChar(8709).ToString();
                break;
            case "emsp":
                str = Convert.ToChar(8195).ToString();
                break;
            case "ensp":
                str = Convert.ToChar(8194).ToString();
                break;
            case "epsilon":
                str = Convert.ToChar(949).ToString();
                break;
            case "Epsilon":
                str = Convert.ToChar(917).ToString();
                break;
            case "equiv":
                str = Convert.ToChar(8801).ToString();
                break;
            case "Eta":
                str = Convert.ToChar(919).ToString();
                break;
            case "eta":
                str = Convert.ToChar(951).ToString();
                break;
            case "eth":
                str = Convert.ToChar(240).ToString();
                break;
            case "ETH":
                str = Convert.ToChar(208).ToString();
                break;
            case "Euml":
                str = Convert.ToChar(203).ToString();
                break;
            case "euml":
                str = Convert.ToChar(235).ToString();
                break;
            case "euro":
                str = Convert.ToChar(8364).ToString();
                break;
            case "exist":
                str = Convert.ToChar(8707).ToString();
                break;
            case "fnof":
                str = Convert.ToChar(402).ToString();
                break;
            case "forall":
                str = Convert.ToChar(8704).ToString();
                break;
            case "frac12":
                str = Convert.ToChar(189).ToString();
                break;
            case "frac14":
                str = Convert.ToChar(188).ToString();
                break;
            case "frac34":
                str = Convert.ToChar(190).ToString();
                break;
            case "frasl":
                str = Convert.ToChar(8260).ToString();
                break;
            case "gamma":
                str = Convert.ToChar(947).ToString();
                break;
            case "Gamma":
                str = Convert.ToChar(915).ToString();
                break;
            case "ge":
                str = Convert.ToChar(8805).ToString();
                break;
            case "gt":
                str = Convert.ToChar(62).ToString();
                break;
            case "hArr":
                str = Convert.ToChar(8660).ToString();
                break;
            case "harr":
                str = Convert.ToChar(8596).ToString();
                break;
            case "hearts":
                str = Convert.ToChar(9829).ToString();
                break;
            case "hellip":
                str = Convert.ToChar(8230).ToString();
                break;
            case "Iacute":
                str = Convert.ToChar(205).ToString();
                break;
            case "iacute":
                str = Convert.ToChar(237).ToString();
                break;
            case "icirc":
                str = Convert.ToChar(238).ToString();
                break;
            case "Icirc":
                str = Convert.ToChar(206).ToString();
                break;
            case "iexcl":
                str = Convert.ToChar(161).ToString();
                break;
            case "Igrave":
                str = Convert.ToChar(204).ToString();
                break;
            case "igrave":
                str = Convert.ToChar(236).ToString();
                break;
            case "image":
                str = Convert.ToChar(8465).ToString();
                break;
            case "infin":
                str = Convert.ToChar(8734).ToString();
                break;
            case "int":
                str = Convert.ToChar(8747).ToString();
                break;
            case "Iota":
                str = Convert.ToChar(921).ToString();
                break;
            case "iota":
                str = Convert.ToChar(953).ToString();
                break;
            case "iquest":
                str = Convert.ToChar(191).ToString();
                break;
            case "isin":
                str = Convert.ToChar(8712).ToString();
                break;
            case "iuml":
                str = Convert.ToChar(239).ToString();
                break;
            case "Iuml":
                str = Convert.ToChar(207).ToString();
                break;
            case "kappa":
                str = Convert.ToChar(954).ToString();
                break;
            case "Kappa":
                str = Convert.ToChar(922).ToString();
                break;
            case "Lambda":
                str = Convert.ToChar(923).ToString();
                break;
            case "lambda":
                str = Convert.ToChar(955).ToString();
                break;
            case "lang":
                str = Convert.ToChar(9001).ToString();
                break;
            case "laquo":
                str = Convert.ToChar(171).ToString();
                break;
            case "larr":
                str = Convert.ToChar(8592).ToString();
                break;
            case "lArr":
                str = Convert.ToChar(8656).ToString();
                break;
            case "lceil":
                str = Convert.ToChar(8968).ToString();
                break;
            case "ldquo":
                str = Convert.ToChar(8220).ToString();
                break;
            case "le":
                str = Convert.ToChar(8804).ToString();
                break;
            case "lfloor":
                str = Convert.ToChar(8970).ToString();
                break;
            case "lowast":
                str = Convert.ToChar(8727).ToString();
                break;
            case "loz":
                str = Convert.ToChar(9674).ToString();
                break;
            case "lrm":
                str = Convert.ToChar(8206).ToString();
                break;
            case "lsaquo":
                str = Convert.ToChar(8249).ToString();
                break;
            case "lsquo":
                str = Convert.ToChar(8216).ToString();
                break;
            case "lt":
                str = Convert.ToChar(60).ToString();
                break;
            case "macr":
                str = Convert.ToChar(175).ToString();
                break;
            case "mdash":
                str = Convert.ToChar(8212).ToString();
                break;
            case "micro":
                str = Convert.ToChar(181).ToString();
                break;
            case "middot":
                str = Convert.ToChar(183).ToString();
                break;
            case "minus":
                str = Convert.ToChar(8722).ToString();
                break;
            case "Mu":
                str = Convert.ToChar(924).ToString();
                break;
            case "mu":
                str = Convert.ToChar(956).ToString();
                break;
            case "nabla":
                str = Convert.ToChar(8711).ToString();
                break;
            case "nbsp":
                str = Convert.ToChar(160).ToString();
                break;
            case "ndash":
                str = Convert.ToChar(8211).ToString();
                break;
            case "ne":
                str = Convert.ToChar(8800).ToString();
                break;
            case "ni":
                str = Convert.ToChar(8715).ToString();
                break;
            case "not":
                str = Convert.ToChar(172).ToString();
                break;
            case "notin":
                str = Convert.ToChar(8713).ToString();
                break;
            case "nsub":
                str = Convert.ToChar(8836).ToString();
                break;
            case "ntilde":
                str = Convert.ToChar(241).ToString();
                break;
            case "Ntilde":
                str = Convert.ToChar(209).ToString();
                break;
            case "Nu":
                str = Convert.ToChar(925).ToString();
                break;
            case "nu":
                str = Convert.ToChar(957).ToString();
                break;
            case "oacute":
                str = Convert.ToChar(243).ToString();
                break;
            case "Oacute":
                str = Convert.ToChar(211).ToString();
                break;
            case "Ocirc":
                str = Convert.ToChar(212).ToString();
                break;
            case "ocirc":
                str = Convert.ToChar(244).ToString();
                break;
            case "OElig":
                str = Convert.ToChar(338).ToString();
                break;
            case "oelig":
                str = Convert.ToChar(339).ToString();
                break;
            case "ograve":
                str = Convert.ToChar(242).ToString();
                break;
            case "Ograve":
                str = Convert.ToChar(210).ToString();
                break;
            case "oline":
                str = Convert.ToChar(8254).ToString();
                break;
            case "Omega":
                str = Convert.ToChar(937).ToString();
                break;
            case "omega":
                str = Convert.ToChar(969).ToString();
                break;
            case "Omicron":
                str = Convert.ToChar(927).ToString();
                break;
            case "omicron":
                str = Convert.ToChar(959).ToString();
                break;
            case "oplus":
                str = Convert.ToChar(8853).ToString();
                break;
            case "or":
                str = Convert.ToChar(8744).ToString();
                break;
            case "ordf":
                str = Convert.ToChar(170).ToString();
                break;
            case "ordm":
                str = Convert.ToChar(186).ToString();
                break;
            case "Oslash":
                str = Convert.ToChar(216).ToString();
                break;
            case "oslash":
                str = Convert.ToChar(248).ToString();
                break;
            case "otilde":
                str = Convert.ToChar(245).ToString();
                break;
            case "Otilde":
                str = Convert.ToChar(213).ToString();
                break;
            case "otimes":
                str = Convert.ToChar(8855).ToString();
                break;
            case "Ouml":
                str = Convert.ToChar(214).ToString();
                break;
            case "ouml":
                str = Convert.ToChar(246).ToString();
                break;
            case "para":
                str = Convert.ToChar(182).ToString();
                break;
            case "part":
                str = Convert.ToChar(8706).ToString();
                break;
            case "permil":
                str = Convert.ToChar(8240).ToString();
                break;
            case "perp":
                str = Convert.ToChar(8869).ToString();
                break;
            case "Phi":
                str = Convert.ToChar(934).ToString();
                break;
            case "phi":
                str = Convert.ToChar(966).ToString();
                break;
            case "Pi":
                str = Convert.ToChar(928).ToString();
                break;
            case "pi":
                str = Convert.ToChar(960).ToString();
                break;
            case "piv":
                str = Convert.ToChar(982).ToString();
                break;
            case "plusmn":
                str = Convert.ToChar(177).ToString();
                break;
            case "pound":
                str = Convert.ToChar(163).ToString();
                break;
            case "Prime":
                str = Convert.ToChar(8243).ToString();
                break;
            case "prime":
                str = Convert.ToChar(8242).ToString();
                break;
            case "prod":
                str = Convert.ToChar(8719).ToString();
                break;
            case "prop":
                str = Convert.ToChar(8733).ToString();
                break;
            case "psi":
                str = Convert.ToChar(968).ToString();
                break;
            case "Psi":
                str = Convert.ToChar(936).ToString();
                break;
            case "quot":
                str = Convert.ToChar(34).ToString();
                break;
            case "radic":
                str = Convert.ToChar(8730).ToString();
                break;
            case "rang":
                str = Convert.ToChar(9002).ToString();
                break;
            case "raquo":
                str = Convert.ToChar(187).ToString();
                break;
            case "rarr":
                str = Convert.ToChar(8594).ToString();
                break;
            case "rArr":
                str = Convert.ToChar(8658).ToString();
                break;
            case "rceil":
                str = Convert.ToChar(8969).ToString();
                break;
            case "rdquo":
                str = Convert.ToChar(8221).ToString();
                break;
            case "real":
                str = Convert.ToChar(8476).ToString();
                break;
            case "reg":
                str = Convert.ToChar(174).ToString();
                break;
            case "rfloor":
                str = Convert.ToChar(8971).ToString();
                break;
            case "rho":
                str = Convert.ToChar(961).ToString();
                break;
            case "Rho":
                str = Convert.ToChar(929).ToString();
                break;
            case "rlm":
                str = Convert.ToChar(8207).ToString();
                break;
            case "rsaquo":
                str = Convert.ToChar(8250).ToString();
                break;
            case "rsquo":
                str = Convert.ToChar(8217).ToString();
                break;
            case "sbquo":
                str = Convert.ToChar(8218).ToString();
                break;
            case "Scaron":
                str = Convert.ToChar(352).ToString();
                break;
            case "scaron":
                str = Convert.ToChar(353).ToString();
                break;
            case "sdot":
                str = Convert.ToChar(8901).ToString();
                break;
            case "sect":
                str = Convert.ToChar(167).ToString();
                break;
            case "shy":
                str = Convert.ToChar(173).ToString();
                break;
            case "sigma":
                str = Convert.ToChar(963).ToString();
                break;
            case "Sigma":
                str = Convert.ToChar(931).ToString();
                break;
            case "sigmaf":
                str = Convert.ToChar(962).ToString();
                break;
            case "sim":
                str = Convert.ToChar(8764).ToString();
                break;
            case "spades":
                str = Convert.ToChar(9824).ToString();
                break;
            case "sub":
                str = Convert.ToChar(8834).ToString();
                break;
            case "sube":
                str = Convert.ToChar(8838).ToString();
                break;
            case "sum":
                str = Convert.ToChar(8721).ToString();
                break;
            case "sup":
                str = Convert.ToChar(8835).ToString();
                break;
            case "sup1":
                str = Convert.ToChar(185).ToString();
                break;
            case "sup2":
                str = Convert.ToChar(178).ToString();
                break;
            case "sup3":
                str = Convert.ToChar(179).ToString();
                break;
            case "supe":
                str = Convert.ToChar(8839).ToString();
                break;
            case "szlig":
                str = Convert.ToChar(223).ToString();
                break;
            case "Tau":
                str = Convert.ToChar(932).ToString();
                break;
            case "tau":
                str = Convert.ToChar(964).ToString();
                break;
            case "there4":
                str = Convert.ToChar(8756).ToString();
                break;
            case "theta":
                str = Convert.ToChar(952).ToString();
                break;
            case "Theta":
                str = Convert.ToChar(920).ToString();
                break;
            case "thetasym":
                str = Convert.ToChar(977).ToString();
                break;
            case "thinsp":
                str = Convert.ToChar(8201).ToString();
                break;
            case "thorn":
                str = Convert.ToChar(254).ToString();
                break;
            case "THORN":
                str = Convert.ToChar(222).ToString();
                break;
            case "tilde":
                str = Convert.ToChar(732).ToString();
                break;
            case "times":
                str = Convert.ToChar(215).ToString();
                break;
            case "trade":
                str = Convert.ToChar(8482).ToString();
                break;
            case "Uacute":
                str = Convert.ToChar(218).ToString();
                break;
            case "uacute":
                str = Convert.ToChar(250).ToString();
                break;
            case "uarr":
                str = Convert.ToChar(8593).ToString();
                break;
            case "uArr":
                str = Convert.ToChar(8657).ToString();
                break;
            case "Ucirc":
                str = Convert.ToChar(219).ToString();
                break;
            case "ucirc":
                str = Convert.ToChar(251).ToString();
                break;
            case "Ugrave":
                str = Convert.ToChar(217).ToString();
                break;
            case "ugrave":
                str = Convert.ToChar(249).ToString();
                break;
            case "uml":
                str = Convert.ToChar(168).ToString();
                break;
            case "upsih":
                str = Convert.ToChar(978).ToString();
                break;
            case "Upsilon":
                str = Convert.ToChar(933).ToString();
                break;
            case "upsilon":
                str = Convert.ToChar(965).ToString();
                break;
            case "Uuml":
                str = Convert.ToChar(220).ToString();
                break;
            case "uuml":
                str = Convert.ToChar(252).ToString();
                break;
            case "weierp":
                str = Convert.ToChar(8472).ToString();
                break;
            case "Xi":
                str = Convert.ToChar(926).ToString();
                break;
            case "xi":
                str = Convert.ToChar(958).ToString();
                break;
            case "yacute":
                str = Convert.ToChar(253).ToString();
                break;
            case "Yacute":
                str = Convert.ToChar(221).ToString();
                break;
            case "yen":
                str = Convert.ToChar(165).ToString();
                break;
            case "Yuml":
                str = Convert.ToChar(376).ToString();
                break;
            case "yuml":
                str = Convert.ToChar((int)Byte.MaxValue).ToString();
                break;
            case "zeta":
                str = Convert.ToChar(950).ToString();
                break;
            case "Zeta":
                str = Convert.ToChar(918).ToString();
                break;
            case "zwj":
                str = Convert.ToChar(8205).ToString();
                break;
            case "zwnj":
                str = Convert.ToChar(8204).ToString();
                break;
        }
        return str;
    }
}


text:
.. highlightlang:: c

.. _codeobjects:

Code Objects
------------

.. sectionauthor:: Jeffrey Yasskin <jyasskin@gmail.com>

.. index::
   object: code

Code objects are a low-level detail of the CPython implementation.
Each one represents a chunk of executable code that hasn't yet been
bound into a function.

.. ctype:: PyCodeObject

   The C structure of the objects used to describe code objects.  The
   fields of this type are subject to change at any time.

.. cvar:: PyTypeObject PyCode_Type

   This is an instance of :ctype:`PyTypeObject` representing the Python
   :class:`code` type.

.. cfunction:: int PyCode_Check(PyObject *co)

   Return true if *co* is a :class:`code` object

.. cfunction:: int PyCode_GetNumFree(PyObject *co)

   Return the number of free variables in *co*.

.. cfunction:: PyCodeObject *PyCode_New(int argcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)

   Return a new code object.  If you need a dummy code object to
   create a frame, use :cfunc:`PyCode_NewEmpty` instead.  Calling
   :cfunc:`PyCode_New` directly can bind you to a precise Python
   version since the definition of the bytecode changes often.

.. cfunction:: int PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)

   Return a new empty code object with the specified filename,
   function name, and first line number.  It is illegal to
   :keyword:`exec` or :func:`eval` the resulting code object.