text:
void configuration::default_got_message(const std::string & t,const std::string & c)  {
  std::cerr << "Using function callback > "<< t << "\t" << c << std::endl;
}
void configuration::default_got_error(const std::string & t,const int & v)  {
  std::cerr << "Error function callback: > "<< t << "\t->\t" << v << std::endl;
}
void configuration::default_unsubscribed(const std::string & t)  {
  std::cerr << "Unsubscribe function callback < "<< t << std::endl;
}

namespace configuration {

  ////////////////////////////
  // Function calls
  std::unique_ptr<ConfigurationManager<D,C> > configuration_manager;

  int Init(const char* address="localhost",
           const int& port=6379) {
    std::cout << "creating configuration manager instance" << std::endl;
    configuration_manager = make_unique<ConfigurationManager<D,C> >(address,port);
    return 0;
  }

  int Add(const std::string& conf) {
    return configuration_manager->AddConfig(conf);
  }

  std::vector<std::string> Query(const std::string& key) {
    return configuration_manager->Query(key);
  }

  bool Update(const std::string& key, const std::string& value) {
    return  configuration_manager->Update(key,value);
  }

  bool Delete(const std::string& key) {
    return configuration_manager->Delete(key);
  }

  bool Subscribe(const std::string& key,
                 std::function<void(const std::string&,const std::string&)> got_message=default_got_message,
                 std::function<void(const std::string&,const int&)> got_error=default_got_error,
                 std::function<void(const std::string&)> unsubscribed=default_unsubscribed
                 ) {
    return configuration_manager->Subscribe(key,got_message,got_error,unsubscribed);
  }

}


text:
import java.io.*;
import java.net.*;
import java.lang.Runnable;

/*
class RunnableThread implements Runnable {

    Thread runner;
    BufferedReader data_in;

    public RunnableThread() {
    }

    public RunnableThread(String threadName, BufferedReader reader) {
        data_in = reader;
        runner = new Thread(this, threadName); // (1) Create a new thread.
        System.out.println(runner.getName());
        runner.start(); // (2) Start the thread.
    }

    public void run() {
        //Display info about this particular thread
        System.out.println(Thread.currentThread());
        while (true) {
            String msg = null;
            try {
                msg = data_in.readLine();
            } catch (IOException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }

            if (msg != null) {
                System.out.println(msg);
            }
        }
    }
}
 */

public class simpleServer {

    //private static RunnableThread reader;
    private static BufferedReader data_in;
    private static PrintWriter data_out;
    // Message terminator
    private static final char EOF = (char) 0x00;

    public static void log(String message, int status) {
        switch (status) {
            case 0:
                System.out.println("Received: " + message);
                break;
            case 1:
                System.out.println("Status: " + message);
                break;
            case 2:
                System.out.println("Connection: " + message);
                break;
        }
    }

    public static void send(String message) {
        data_out.write(message + 0x00);
        data_out.flush();
    }

    public static void main(String args[]) {

        //while (true) {
        try {
            // create a serverSocket connection on port 3333
            ServerSocket s = new ServerSocket(3333);

            System.out.println("Server started. Waiting for connections...");
            // wait for incoming connections

            Socket serverSocket = s.accept();
            log("Client connection from "+serverSocket.getRemoteSocketAddress(),2);
            data_in = new BufferedReader(new InputStreamReader(serverSocket.getInputStream()));
            data_out = new PrintWriter(serverSocket.getOutputStream());
            //reader = new RunnableThread("Reader", data_in);

            boolean quit = false;

            while (!quit) {
                String msg = data_in.readLine();

                if (msg != null) {
                    if (msg.equals("<policy-file-request/>\0")) {
                        log(msg, 0);
                        send("<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>");
                        log("print-policy",1);
                        send("<?xml version=\"1.0\"?>
message
");
                        log("print-message",1);
                    }
                }

            }
        }
        catch (Exception e) {
            System.err.println("Connection lost");
        }
        //}

    }
}

redpajama_set_name: RedPajamaGithub


text:
import uuid

import sqlalchemy

from keystone.common import sql
from keystone import config
from keystone import exception
from keystone.identity.backends import sql as identity_sql
from keystone import tests
from keystone.tests import default_fixtures
from keystone.tests import test_backend

CONF = config.CONF
DEFAULT_DOMAIN_ID = CONF.identity.default_domain_id

class SqlTests(tests.TestCase, sql.Base):

    def setUp(self):
        super(SqlTests, self).setUp()
        self.config([tests.etcdir('keystone.conf.sample'),
                     tests.testsdir('test_overrides.conf'),
                     tests.testsdir('backend_sql.conf')])

        self.load_backends()

        # create tables and keep an engine reference for cleanup.
        # this must be done after the models are loaded by the managers.
        self.engine = self.get_engine()
        sql.ModelBase.metadata.create_all(bind=self.engine)

        # populate the engine with tables & fixtures
        self.load_fixtures(default_fixtures)
        #defaulted by the data load
        self.user_foo['enabled'] = True

    def tearDown(self):
        sql.ModelBase.metadata.drop_all(bind=self.engine)
        self.engine.dispose()
        sql.set_global_engine(None)
        super(SqlTests, self).tearDown()

class SqlModels(SqlTests):
    def setUp(self):
        super(SqlModels, self).setUp()

        self.metadata = sql.ModelBase.metadata
        self.metadata.bind = self.engine

    def select_table(self, name):
        table = sqlalchemy.Table(name,
                                 self.metadata,
                                 autoload=True)
        s = sqlalchemy.select([table])
        return s

    def assertExpectedSchema(self, table, cols):
        table = self.select_table(table)
        for col, type_, length in cols:
            self.assertIsInstance(table.c[col].type, type_)
            if length:
                self.assertEquals(table.c[col].type.length, length)

    def test_user_model(self):
        cols = (('id', sql.String, 64),
                ('name', sql.String, 255),
                ('password', sql.String, 128),
                ('domain_id', sql.String, 64),
                ('enabled', sql.Boolean, None),
                ('extra', sql.JsonBlob, None))
        self.assertExpectedSchema('user', cols)

    def test_group_model(self):
        cols = (('id', sql.String, 64),
                ('name', sql.String, 64),
                ('description', sql.Text, None),
                ('domain_id', sql.String, 64),
                ('extra', sql.JsonBlob, None))
        self.assertExpectedSchema('group', cols)

    def test_domain_model(self):
        cols = (('id', sql.String, 64),
                ('name', sql.String, 64),
                ('enabled', sql.Boolean, None))
        self.assertExpectedSchema('domain', cols)

    def test_project_model(self):
        cols = (('id', sql.String, 64),
                ('name', sql.String, 64),
                ('description', sql.Text, None),
                ('domain_id', sql.String, 64),
                ('enabled', sql.Boolean, None),
                ('extra', sql.JsonBlob, None))
        self.assertExpectedSchema('project', cols)

    def test_role_model(self):
        cols = (('id', sql.String, 64),
                ('name', sql.String, 255))
        self.assertExpectedSchema('role', cols)

    def test_user_project_metadata_model(self):
        cols = (('user_id', sql.String, 64),
                ('project_id', sql.String, 64),
                ('data', sql.JsonBlob, None))
        self.assertExpectedSchema('user_project_metadata', cols)

    def test_user_domain_metadata_model(self):
        cols = (('user_id', sql.String, 64),
                ('domain_id', sql.String, 64),
                ('data', sql.JsonBlob, None))
        self.assertExpectedSchema('user_domain_metadata', cols)

    def test_group_project_metadata_model(self):
        cols = (('group_id', sql.String, 64),
                ('project_id', sql.String, 64),
                ('data', sql.JsonBlob, None))
        self.assertExpectedSchema('group_project_metadata', cols)

    def test_group_domain_metadata_model(self):
        cols = (('group_id', sql.String, 64),
                ('domain_id', sql.String, 64),
                ('data', sql.JsonBlob, None))
        self.assertExpectedSchema('group_domain_metadata', cols)

    def test_user_group_membership(self):
        cols = (('group_id', sql.String, 64),
                ('user_id', sql.String, 64))
        self.assertExpectedSchema('user_group_membership', cols)

class SqlIdentity(SqlTests, test_backend.IdentityTests):
    def test_password_hashed(self):
        session = self.identity_api.get_session()
        user_ref = self.identity_api._get_user(session, self.user_foo['id'])
        self.assertNotEqual(user_ref['password'], self.user_foo['password'])

    def test_delete_user_with_project_association(self):
        user = {'id': uuid.uuid4().hex,
                'name': uuid.uuid4().hex,
                'domain_id': DEFAULT_DOMAIN_ID,
                'password': uuid.uuid4().hex}
        self.identity_api.create_user(user['id'], user)
        self.identity_api.add_user_to_project(self.tenant_bar['id'],
                                              user['id'])
        self.identity_api.delete_user(user['id'])
        self.assertRaises(exception.UserNotFound,
                          self.assignment_api.list_projects_for_user,
                          user['id'])

    def test_create_null_user_name(self):
        user = {'id': uuid.uuid4().hex,
                'name': None,
                'domain_id': DEFAULT_DOMAIN_ID,
                'password': uuid.uuid4().hex}
        self.assertRaises(exception.ValidationError,
                          self.identity_api.create_user,
                          user['id'],
                          user)
        self.assertRaises(exception.UserNotFound,
                          self.identity_api.get_user,
                          user['id'])
        self.assertRaises(exception.UserNotFound,
                          self.identity_api.get_user_by_name,
                          user['name'],
                          DEFAULT_DOMAIN_ID)

    def test_create_null_project_name(self):
        tenant = {'id': uuid.uuid4().hex,
                  'name': None,
                  'domain_id': DEFAULT_DOMAIN_ID}
        self.assertRaises(exception.ValidationError,
                          self.assignment_api.create_project,
                          tenant['id'],
                          tenant)
        self.assertRaises(exception.ProjectNotFound,
                          self.identity_api.get_project,
                          tenant['id'])
        self.assertRaises(exception.ProjectNotFound,
                          self.identity_api.get_project_by_name,
                          tenant['name'],
                          DEFAULT_DOMAIN_ID)

    def test_create_null_role_name(self):
        role = {'id': uuid.uuid4().hex,
                'name': None}
        self.assertRaises(exception.Conflict,
                          self.identity_api.create_role,
                          role['id'],
                          role)
        self.assertRaises(exception.RoleNotFound,
                          self.identity_api.get_role,
                          role['id'])

    def test_delete_project_with_user_association(self):
        user = {'id': 'fake',
                'name': 'fakeuser',
                'domain_id': DEFAULT_DOMAIN_ID,
                'password': 'passwd'}
        self.identity_api.create_user('fake', user)
        self.identity_api.add_user_to_project(self.tenant_bar['id'],
                                              user['id'])
        self.assignment_api.delete_project(self.tenant_bar['id'])
        tenants = self.assignment_api.list_projects_for_user(user['id'])
        self.assertEquals(tenants, [])

    def test_metadata_removed_on_delete_user(self):
        # A test to check that the internal representation
        # or roles is correctly updated when a user is deleted
        user = {'id': uuid.uuid4().hex,
                'name': uuid.uuid4().hex,
                'domain_id': DEFAULT_DOMAIN_ID,
                'password': 'passwd'}
        self.identity_api.create_user(user['id'], user)
        role = {'id': uuid.uuid4().hex,
                'name': uuid.uuid4().hex}
        self.identity_api.create_role(role['id'], role)
        self.identity_api.add_role_to_user_and_project(
            user['id'],
            self.tenant_bar['id'],
            role['id'])
        self.identity_api.delete_user(user['id'])

        # Now check whether the internal representation of roles
        # has been deleted
        self.assertRaises(exception.MetadataNotFound,
                          self.assignment_api._get_metadata,
                          user['id'],
                          self.tenant_bar['id'])

    def test_metadata_removed_on_delete_project(self):
        # A test to check that the internal representation
        # or roles is correctly updated when a project is deleted
        user = {'id': uuid.uuid4().hex,
                'name': uuid.uuid4().hex,
                'domain_id': DEFAULT_DOMAIN_ID,
                'password': 'passwd'}
        self.identity_api.create_user(user['id'], user)
        role = {'id': uuid.uuid4().hex,
                'name': uuid.uuid4().hex}
        self.identity_api.create_role(role['id'], role)
        self.identity_api.add_role_to_user_and_project(
            user['id'],
            self.tenant_bar['id'],
            role['id'])
        self.assignment_api.delete_project(self.tenant_bar['id'])

        # Now check whether the internal representation of roles
        # has been deleted
        self.assertRaises(exception.MetadataNotFound,
                          self.assignment_api._get_metadata,
                          user['id'],
                          self.tenant_bar['id'])

    def test_update_project_returns_extra(self):
        """This tests for backwards-compatibility with an essex/folsom bug.

        Non-indexed attributes were returned in an 'extra' attribute, instead
        of on the entity itself; for consistency and backwards compatibility,
        those attributes should be included twice.

        This behavior is specific to the SQL driver.

        """
        tenant_id = uuid.uuid4().hex
        arbitrary_key = uuid.uuid4().hex
        arbitrary_value = uuid.uuid4().hex
        tenant = {
            'id': tenant_id,
            'name': uuid.uuid4().hex,
            'domain_id': DEFAULT_DOMAIN_ID,
            arbitrary_key: arbitrary_value}
        ref = self.assignment_api.create_project(tenant_id, tenant)
        self.assertEqual(arbitrary_value, ref[arbitrary_key])
        self.assertIsNone(ref.get('extra'))

        tenant['name'] = uuid.uuid4().hex
        ref = self.assignment_api.update_project(tenant_id, tenant)
        self.assertEqual(arbitrary_value, ref[arbitrary_key])
        self.assertEqual(arbitrary_value, ref['extra'][arbitrary_key])

    def test_update_user_returns_extra(self):
        """This tests for backwards-compatibility with an essex/folsom bug.

        Non-indexed attributes were returned in an 'extra' attribute, instead
        of on the entity itself; for consistency and backwards compatibility,
        those attributes should be included twice.

        This behavior is specific to the SQL driver.

        """
        user_id = uuid.uuid4().hex
        arbitrary_key = uuid.uuid4().hex
        arbitrary_value = uuid.uuid4().hex
        user = {
            'id': user_id,
            'name': uuid.uuid4().hex,
            'domain_id': DEFAULT_DOMAIN_ID,
            'password': uuid.uuid4().hex,
            arbitrary_key: arbitrary_value}
        ref = self.identity_api.create_user(user_id, user)
        self.assertEqual(arbitrary_value, ref[arbitrary_key])
        self.assertIsNone(ref.get('password'))
        self.assertIsNone(ref.get('extra'))

        user['name'] = uuid.uuid4().hex
        user['password'] = uuid.uuid4().hex
        ref = self.identity_api.update_user(user_id, user)
        self.assertIsNone(ref.get('password'))
        self.assertIsNone(ref['extra'].get('password'))
        self.assertEqual(arbitrary_value, ref[arbitrary_key])
        self.assertEqual(arbitrary_value, ref['extra'][arbitrary_key])

    def test_sql_user_to_dict_null_default_project_id(self):
        user_id = uuid.uuid4().hex
        user = {
            'id': user_id,
            'name': uuid.uuid4().hex,
            'domain_id': DEFAULT_DOMAIN_ID,
            'password': uuid.uuid4().hex}

        self.identity_api.create_user(user_id, user)
        session = self.get_session()
        query = session.query(identity_sql.User)
        query = query.filter_by(id=user_id)
        raw_user_ref = query.one()
        self.assertIsNone(raw_user_ref.default_project_id)
        user_ref = raw_user_ref.to_dict()
        self.assertNotIn('default_project_id', user_ref)
        session.close()

class SqlTrust(SqlTests, test_backend.TrustTests):
    pass

class SqlToken(SqlTests, test_backend.TokenTests):
    pass

class SqlCatalog(SqlTests, test_backend.CatalogTests):
    def test_malformed_catalog_throws_error(self):
        service = {
            'id': uuid.uuid4().hex,
            'type': uuid.uuid4().hex,
            'name': uuid.uuid4().hex,
            'description': uuid.uuid4().hex,
        }
        self.catalog_api.create_service(service['id'], service.copy())

        malformed_url = "http://192.168.1.104:$(compute_port)s/v2/$(tenant)s"
        endpoint = {
            'id': uuid.uuid4().hex,
            'region': uuid.uuid4().hex,
            'service_id': service['id'],
            'interface': 'public',
            'url': malformed_url,
        }
        self.catalog_api.create_endpoint(endpoint['id'], endpoint.copy())

        self.assertRaises(exception.MalformedEndpoint,
                          self.catalog_api.get_catalog,
                          'fake-user',
                          'fake-tenant')

    def test_get_catalog_with_empty_public_url(self):
        service = {
            'id': uuid.uuid4().hex,
            'type': uuid.uuid4().hex,
            'name': uuid.uuid4().hex,
            'description': uuid.uuid4().hex,
        }
        self.catalog_api.create_service(service['id'], service.copy())

        endpoint = {
            'id': uuid.uuid4().hex,
            'region': uuid.uuid4().hex,
            'interface': 'public',
            'url': '',
            'service_id': service['id'],
        }
        self.catalog_api.create_endpoint(endpoint['id'], endpoint.copy())

        catalog = self.catalog_api.get_catalog('user', 'tenant')
        catalog_endpoint = catalog[endpoint['region']][service['type']]
        self.assertEqual(catalog_endpoint['name'], service['name'])
        self.assertEqual(catalog_endpoint['id'], endpoint['id'])
        self.assertEqual(catalog_endpoint['publicURL'], '')
        self.assertIsNone(catalog_endpoint.get('adminURL'))
        self.assertIsNone(catalog_endpoint.get('internalURL'))

    def test_create_endpoint_400(self):
        service = {
            'id': uuid.uuid4().hex,
            'type': uuid.uuid4().hex,
            'name': uuid.uuid4().hex,
            'description': uuid.uuid4().hex,
        }
        self.catalog_api.create_service(service['id'], service.copy())

        endpoint = {
            'id': uuid.uuid4().hex,
            'region': "0" * 256,
            'service_id': service['id'],
            'interface': 'public',
            'url': uuid.uuid4().hex,
        }

        self.assertRaises(exception.StringLengthExceeded,
                          self.catalog_api.create_endpoint,
                          endpoint['id'],
                          endpoint.copy())

class SqlPolicy(SqlTests, test_backend.PolicyTests):
    pass

class SqlInheritance(SqlTests, test_backend.InheritanceTests):
    pass

class SqlTokenCacheInvalidation(SqlTests, test_backend.TokenCacheInvalidation):
    def setUp(self):
        super(SqlTokenCacheInvalidation, self).setUp()
        self._create_test_data()


text:
/**
 * Jackrabbit extensions for JCR core interfaces
 */
@org.osgi.annotation.versioning.Version("2.7.0")
package org.apache.jackrabbit.api;


text:
/* Selectable
----------------------------------*/
.ui-selectable-helper { border:1px dotted black }


text:
package com.hida.repositories;

import com.hida.configuration.RepositoryConfiguration;
import com.hida.model.DefaultSetting;
import com.hida.model.Token;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * Tests the functionality of DefaultSettingRepository.
 *
 * @author lruffin
 */
@WebAppConfiguration
@IntegrationTest
@SpringApplicationConfiguration(classes = {RepositoryConfiguration.class})
@TestPropertySource(locations = "classpath:testConfig.properties")
@TestExecutionListeners(inheritListeners = false, listeners = {
    DependencyInjectionTestExecutionListener.class,
    DirtiesContextTestExecutionListener.class})
public class DefaultSettingRepositoryTest extends AbstractTestNGSpringContextTests {

    @Autowired
    private DefaultSettingRepository defaultSettingRepo_;

    /**
     * Tests to see if DefaultSettingDao can find an entity with an id of 1.
     */
    @Test
    public void testSaveAndFind() {
        DefaultSetting sample = getSampleDefaultSetting();
        defaultSettingRepo_.save(sample);

        DefaultSetting entity = defaultSettingRepo_.findCurrentDefaultSetting();
        Assert.assertNotNull(entity);
    }

    /**
     * Returns a sample DefaultSetting entity.
     *
     * @return
     */
    private DefaultSetting getSampleDefaultSetting() {
        DefaultSetting setting = new DefaultSetting("",
                "",
                5,
                Token.DIGIT,
                "d",
                1,
                true,
                true,
                true);

        return setting;
    }
}


text:
<?xml version="1.0"?>
<info>
	<id>user_ldap</id>
	<name>LDAP user and group backend</name>
	<description>Authenticate users and groups through LDAP, such as OpenLDAP
	    or Active Directory.

		This app is not compatible with the WebDAV user backend.
	</description>
	<licence>AGPL</licence>
	<author>Dominik Schmidt and Arthur Schiwon</author>
	<requiremin>4.93</requiremin>
	<shipped>true</shipped>
	<types>
		<authentication/>
	</types>
	<documentation>
		<admin>http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap</admin>
	</documentation>
	<ocsid>166061</ocsid>
</info>


text:
package main

import (
	"fmt"
	"os"
	"sort"
	"strings"
)

// transform translates from the XML input types into YAML output types.
func transform(p *project, rootNamespace string) (map[string]*page, tableOfContents, error) {
	pages := map[string]*page{}
	// TODO: consider grouping by namespace and by deprecation status.
	// TODO: cross references.
	// TODO: visibility.
	tocRoot := &tocItem{Name: rootNamespace}

	for _, f := range p.Files {
		if strings.HasPrefix(f.Path, "tests") {
			continue
		}

		if len(f.Constants) > 0 {
			fmt.Fprintf(os.Stderr, "Found unhandled constants in %s", f.Path)
		}
		if len(f.Functions) > 0 {
			fmt.Fprintf(os.Stderr, "Found unhandled functions in %s", f.Path)
		}

		if f.Class != nil {
			classPage := &page{}
			uid := f.Class.FullName
			if !strings.HasPrefix(uid, rootNamespace) {
				return nil, nil, fmt.Errorf("found %q which does not belong to namespace %q", uid, rootNamespace)
			}
			tocRoot.addItem(&tocItem{
				Name:   strings.TrimPrefix(uid, rootNamespace),
				UID:    uid,
				Status: f.Class.Docblock.status(),
			})
			classItem := &item{
				UID:        uid,
				Name:       f.Class.Name,
				ID:         f.Class.Name,
				Summary:    f.Class.Docblock.summary(),
				Langs:      onlyPHP,
				Type:       "class",
				Status:     f.Class.Docblock.status(),
				Implements: f.Class.Implements,
			}
			classPage.addItem(classItem)
			if _, ok := pages[uid]; ok {
				return nil, nil, fmt.Errorf("found duplicate UID: %q", uid)
			}
			pages[uid] = classPage

			for _, p := range f.Class.Properties {
				if p.InheritedFrom != "" {
					classItem.InheritedMembers = append(classItem.InheritedMembers, p.FullName)
					continue
				}
				t := ""
				desc := ""
				if p.Docblock != nil {
					// TODO: not first tag
					if len(p.Docblock.Tags) > 0 {
						t = p.Docblock.Tags[0].Type
						if len(p.Docblock.Tags[0].Description) > 0 {
							fmt.Println("TODO: found a class.tag.description for", p.FullName)
						}
					}
					// TODO p.Default
					desc = p.Docblock.summary()
				}
				classItem.Properties = append(classItem.Properties, docfxProperty{
					Name:        p.Name,
					Type:        t,
					Description: desc,
				})
			}
			for _, m := range f.Class.Methods {
				if m.InheritedFrom != "" {
					classItem.InheritedMembers = append(classItem.InheritedMembers, m.FullName)
					continue
				}
				mUID := m.FullName
				mItem := &item{
					UID:        mUID,
					Name:       m.Name,
					ID:         m.Name,
					Parent:     uid,
					Summary:    m.Docblock.summary(),
					Langs:      onlyPHP,
					Type:       "method",
					Status:     m.Docblock.status(),
					Parameters: arguments(m),
				}
				classItem.addChild(child(mUID))
				classPage.addItem(mItem)
			}
			for _, c := range f.Class.Constants {
				if c.InheritedFrom != "" {
					classItem.InheritedMembers = append(classItem.InheritedMembers, c.FullName)
					continue
				}
				cUID := c.FullName
				cItem := &item{
					UID:     cUID,
					Name:    c.Name,
					ID:      c.Name,
					Parent:  uid,
					Syntax:  syntax{Content: c.Value},
					Summary: c.Docblock.summary(),
					Langs:   onlyPHP,
					Type:    "constant",
					Status:  c.Docblock.status(),
				}
				classItem.addChild(child(cUID))
				classPage.addItem(cItem)
			}
		}

		// TODO: update template to include traits. Leads to broken pages right now.
		if f.Trait != nil {
			traitPage := &page{}
			uid := f.Trait.FullName
			if !strings.HasPrefix(uid, rootNamespace) {
				return nil, nil, fmt.Errorf("found %q which does not belong to namespace %q", uid, rootNamespace)
			}
			tocRoot.addItem(&tocItem{
				Name:   strings.TrimPrefix(uid, rootNamespace),
				UID:    uid,
				Status: f.Trait.Docblock.status(),
			})
			traitItem := &item{
				UID:     uid,
				Name:    f.Trait.Name,
				ID:      f.Trait.Name,
				Summary: f.Trait.Docblock.summary(),
				Langs:   onlyPHP,
				Type:    "trait",
				Status:  f.Trait.Docblock.status(),
				// TODO: f.Trait.Properties,
			}
			traitPage.addItem(traitItem)
			if _, ok := pages[uid]; ok {
				return nil, nil, fmt.Errorf("found duplicate UID: %q", uid)
			}
			pages[uid] = traitPage

			for _, m := range f.Trait.Methods {
				if m.InheritedFrom != "" {
					traitItem.InheritedMembers = append(traitItem.InheritedMembers, m.FullName)
					continue
				}
				mUID := m.FullName
				mItem := &item{
					UID:        mUID,
					Name:       m.Name,
					ID:         m.Name,
					Parent:     uid,
					Summary:    m.Docblock.summary(),
					Langs:      onlyPHP,
					Type:       "method",
					Status:     m.Docblock.status(),
					Parameters: arguments(m),
				}
				traitItem.addChild(child(mUID))
				traitPage.addItem(mItem)
			}
		}

		if f.Interface != nil {
			interfacePage := &page{}
			uid := f.Interface.FullName
			if !strings.HasPrefix(uid, rootNamespace) {
				return nil, nil, fmt.Errorf("found %q which does not belong to namespace %q", uid, rootNamespace)
			}
			tocRoot.addItem(&tocItem{
				Name:   strings.TrimPrefix(uid, rootNamespace),
				UID:    uid,
				Status: f.Interface.Docblock.status(),
			})
			interfaceItem := &item{
				UID:     uid,
				Name:    f.Interface.Name,
				ID:      f.Interface.Name,
				Summary: f.Interface.Docblock.summary(),
				Langs:   onlyPHP,
				Type:    "interface",
				Status:  f.Interface.Docblock.status(),
			}
			interfacePage.addItem(interfaceItem)
			if _, ok := pages[uid]; ok {
				return nil, nil, fmt.Errorf("found duplicate UID: %q", uid)
			}
			pages[f.Interface.FullName] = interfacePage

			for _, m := range f.Interface.Methods {
				if m.InheritedFrom != "" {
					interfaceItem.InheritedMembers = append(interfaceItem.InheritedMembers, m.FullName)
					continue
				}
				mUID := m.FullName
				mItem := &item{
					UID:        mUID,
					Name:       m.Name,
					ID:         m.Name,
					Parent:     uid,
					Summary:    m.Docblock.summary(),
					Langs:      onlyPHP,
					Type:       "method",
					Status:     m.Docblock.status(),
					Parameters: arguments(m),
				}
				interfaceItem.addChild(child(mUID))
				interfacePage.addItem(mItem)
			}
			for _, c := range f.Interface.Constants {
				if c.InheritedFrom != "" {
					interfaceItem.InheritedMembers = append(interfaceItem.InheritedMembers, c.FullName)
					continue
				}
				cUID := c.FullName
				cItem := &item{
					UID:     cUID,
					Name:    c.Name,
					ID:      c.Name,
					Parent:  uid,
					Syntax:  syntax{Content: c.Value},
					Summary: c.Docblock.summary(),
					Langs:   onlyPHP,
					Type:    "constant",
					Status:  c.Docblock.status(),
				}
				interfaceItem.addChild(child(cUID))
				interfacePage.addItem(cItem)
			}
		}
	}
	sort.Slice(tocRoot.Items, func(i, j int) bool {
		return tocRoot.Items[i].UID < tocRoot.Items[j].UID
	})
	return pages, tableOfContents{tocRoot}, nil
}

func arguments(m method) []parameter {
	params := []parameter{}
	for _, a := range m.Arguments {
		params = append(params, parameter{
			Name:        a.Name,
			Type:        a.Type,
			Description: m.Docblock.param(a.Name),
			// TODO: by reference, default
		})
	}
	return params
}

// tableOfContents represents a TOC.
type tableOfContents []*tocItem

// tocItem is an item in a TOC.
type tocItem struct {
	UID    string     `yaml:"uid,omitempty"`
	Name   string     `yaml:"name,omitempty"`
	Items  []*tocItem `yaml:"items,omitempty"`
	Href   string     `yaml:"href,omitempty"`
	Status string     `yaml:"status,omitempty"`
}

func (t *tocItem) addItem(i *tocItem) {
	t.Items = append(t.Items, i)
}

// page represents a single DocFX page.
//
// There is one page per package.
type page struct {
	Items      []*item `yaml:"items"`
	References []*item `yaml:"references,omitempty"`
}

// child represents an item child.
type child string

// syntax represents syntax.
type syntax struct {
	Content string `yaml:"content,omitempty"`
}

type example struct {
	Content string `yaml:"content,omitempty"`
	Name    string `yaml:"name,omitempty"`
}

type docfxProperty struct {
	Type        string `yaml:"type,omitempty"`
	Name        string `yaml:"name,omitempty"`
	Description string `yaml:"description,omitempty"`
}

type parameter struct {
	Type        string `yaml:"type,omitempty"`
	Name        string `yaml:"name,omitempty"`
	Description string `yaml:"description,omitempty"`
}

// item represents a DocFX item.
type item struct {
	UID              string          `yaml:"uid"`
	Name             string          `yaml:"name,omitempty"`
	ID               string          `yaml:"id,omitempty"`
	Summary          string          `yaml:"summary,omitempty"`
	Parent           string          `yaml:"parent,omitempty"`
	Type             string          `yaml:"type,omitempty"`
	Langs            []string        `yaml:"langs,omitempty"`
	Syntax           syntax          `yaml:"syntax,omitempty"`
	Examples         []example       `yaml:"codeexamples,omitempty"`
	Children         []child         `yaml:"children,omitempty"`
	AltLink          string          `yaml:"alt_link,omitempty"`
	Status           string          `yaml:"status,omitempty"`
	Implements       []string        `yaml:"implements,omitempty"`
	InheritedMembers []string        `yaml:"inheritedMembers,omitempty"`
	Properties       []docfxProperty `yaml:"properties,omitempty"`
	Parameters       []parameter     `yaml:"parameters,omitempty"`
}

func (p *page) addItem(i *item) {
	p.Items = append(p.Items, i)
}

func (i *item) addChild(c child) {
	i.Children = append(i.Children, c)
}

var onlyPHP = []string{"php"}


text:
#nullable enable
namespace Core2D.Model.Input;

public abstract class InputTarget
{
    public abstract void BeginDown(InputArgs args);

    public abstract void BeginUp(InputArgs args);

    public abstract void EndDown(InputArgs args);

    public abstract void EndUp(InputArgs args);

    public abstract void Move(InputArgs args);

    public abstract bool IsBeginDownAvailable();

    public abstract bool IsBeginUpAvailable();

    public abstract bool IsEndDownAvailable();

    public abstract bool IsEndUpAvailable();

    public abstract bool IsMoveAvailable();
}


text:
module Fog
  module Parsers
    module Voxel
      module Compute

        class Basic < Fog::Parsers::Base

          def reset
            @response = {}
          end

          def start_element(name, attrs = [])
            super

            case name
            when 'err'
              @response['err'] = {
                'code'  => attr_value('code', attrs),
                'msg'   => attr_value('msg', attrs)
              }
            when 'rsp'
              @response['stat'] = attr_value('stat', attrs)
            end
          end

        end

      end
    end
  end
end


text:
package com.github.sandor_balazs.nosql_java.service.impl;

import com.github.sandor_balazs.nosql_java.service.CountryService;
import com.github.sandor_balazs.nosql_java.domain.Country;
import com.github.sandor_balazs.nosql_java.repository.CountryRepository;
import com.github.sandor_balazs.nosql_java.web.rest.dto.CountryDTO;
import com.github.sandor_balazs.nosql_java.web.rest.mapper.CountryMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;

import javax.inject.Inject;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
 * Service Implementation for managing Country.
 */
@Service
@Transactional
public class CountryServiceImpl implements CountryService{

    private final Logger log = LoggerFactory.getLogger(CountryServiceImpl.class);

    @Inject
    private CountryRepository countryRepository;

    @Inject
    private CountryMapper countryMapper;

    /**
     * Save a country.
     * @return the persisted entity
     */
    public CountryDTO save(CountryDTO countryDTO) {
        log.debug("Request to save Country : {}", countryDTO);
        Country country = countryMapper.countryDTOToCountry(countryDTO);
        country = countryRepository.save(country);
        CountryDTO result = countryMapper.countryToCountryDTO(country);
        return result;
    }

    /**
     *  get all the countrys.
     *  @return the list of entities
     */
    @Transactional(readOnly = true)
    public List<CountryDTO> findAll() {
        log.debug("Request to get all Countrys");
        List<CountryDTO> result = countryRepository.findAll().stream()
            .map(countryMapper::countryToCountryDTO)
            .collect(Collectors.toCollection(LinkedList::new));
        return result;
    }

    /**
     *  get one country by id.
     *  @return the entity
     */
    @Transactional(readOnly = true)
    public CountryDTO findOne(Long id) {
        log.debug("Request to get Country : {}", id);
        Country country = countryRepository.findOne(id);
        CountryDTO countryDTO = countryMapper.countryToCountryDTO(country);
        return countryDTO;
    }

    /**
     *  delete the  country by id.
     */
    public void delete(Long id) {
        log.debug("Request to delete Country : {}", id);
        countryRepository.delete(id);
    }
}


text:
module Kaya
  module API
    module Suites

      # @param [hash] options = {:running, :active, :ip}
      def self.list(options ={})

        start = Time.now.to_f

        response = {
          "project_name" => Dir.pwd.split("/").last,
          "size" => 0,
          "suites" => [],
          "message" => nil
        }
        suites = if options[:running]
          response["request"] = "Running Suites"
          Kaya::Suites.running_suites
        else
          response["request"] = options[:active] ? "Active Suites" : "Suites"
          Kaya::Suites.suites options[:active]
        end

        if suites.size.zero?
          response["message"] = options[:running] ? "Running suites not found" : "Suites not found"
        else
          # Gets the executions for given ip
          suites = suites.map do |suite|
            results_for_suite = Kaya::Results.results_ids_for suite["_id"]
            suite["results"]={
              "size" => results_for_suite.size,
              "ids" => results_for_suite
            }
            suite
          end

          suites = suites.map do |suite|
            unless Kaya::Results.results_for_suite_id_and_ip(suite["_id"], options[:ip]).empty?
              suite["status"]="RUNNING"
              suite
            else
              suite
            end
          end

          response["suites"] = suites
          $K_LOG.debug "#{suites.size} retrieved in (#{Time.now.to_f - start} s)" if $K_LOG

          response["size"] = suites.size
        end
        response
      end
    end
  end
end


text:
package simcity.Bank;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Semaphore;

import simcity.PersonAgent;
import simcity.Bank.gui.BankCustomerGui;
import simcity.Bank.gui.BankManagerGui;
import simcity.PersonAgent.MoneyState;
import simcity.gui.SimCityGui;
import simcity.gui.trace.AlertLog;
import simcity.gui.trace.AlertTag;
import simcity.interfaces.BankCustomer;
import simcity.interfaces.BankLoanOfficer;
import simcity.interfaces.BankManager;
import simcity.interfaces.BankTeller;
import agent.Role;

public class BankCustomerRole extends Role implements BankCustomer {
	//data
	public int num;
	public BankManager manager;
	public BankTeller teller;
	public BankLoanOfficer loanOfficer;
	public enum bankCustomerState { arrived, waiting, inProgress, exiting, done};
	public bankCustomerState state=bankCustomerState.arrived;
	//public String purpose;
	public Integer accountNum=null;

	//Gui
	private Semaphore atDest = new Semaphore(0,true);
	private BankCustomerGui bankcustomerGui;
	private SimCityGui gui;

	//messages
	public void msgGoToLoanOfficer(BankLoanOfficer BL){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Told to go to loan officer");

		Do("Told to go to loan officer");
		loanOfficer=BL;
		stateChanged();
	}

	public void msgGoToTeller(BankTeller BT){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Told to go to teller");
		Do("Told to go to teller");
		teller=BT;
		stateChanged();
	}

	public void msgTransactionComplete(double amount){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Finished transaction");
		Do("Finished transaction");
		myPerson.money-=amount;
		state=bankCustomerState.done;
		stateChanged();
	}

	public void msgHeresLoan(double amount){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Received loan");
		Do("Received loan");
		myPerson.money+=amount;
		stateChanged();
	}

	public void msgLoanDenied(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Denied loan");
		Do("Denied loan");
		state=bankCustomerState.done;
		stateChanged();
	}

	public void msgBalance(Double Balance){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Got my balance");
		Do("Got my balance");
		if(Balance<1.0) myPerson.moneystate=MoneyState.poor;
		else if(Balance>1000) myPerson.moneystate=MoneyState.rich;
		else myPerson.moneystate=MoneyState.middle;
	}

	public void msgAccountMade(int AN){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Got an account");
		Do("Got an account");
		accountNum=AN;
		state=bankCustomerState.waiting;
		stateChanged();
	}

	@Override
	public void msgLeaveBank() {
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Going to leave");
		Do("Going to leave");
		state=bankCustomerState.done;
		stateChanged();
	}

	public BankCustomerRole(SimCityGui G, int N) {
		super();
		num=N;
		gui=G;
		state=bankCustomerState.arrived;
		//purpose="transaction";						//NEED A GOOD WAY FOR PERSON TO DECIDE
	}

	public void msgAtTellerPos() {
		atDest.release();

	}

	public void msgAnimationFinishedLeaveBank() {
		atDest.release();
		state=bankCustomerState.arrived;
		this.isActive=false;
		myPerson.msgLeftBuilding();
	}

	public void msgAtLoanPos() {
		atDest.release();
	}

	@Override
	public boolean pickAndExecuteAnAction() {
		if(state==bankCustomerState.arrived){
			tellManagerArrived();
			return true;
		}
		if((loanOfficer!=null || teller!=null) && accountNum==null && state==bankCustomerState.waiting){
			makeAccount();
			return true;
		}
		if(loanOfficer!=null && accountNum!=null && state==bankCustomerState.waiting){
			requestLoan();
			return true;
		}
		if(teller!=null && state==bankCustomerState.waiting){
			makeTransaction();
			return true;
		}
		if(state==bankCustomerState.done){
			leaveBank();
			return true;
		}
		return false;
	}

	//actions
	private void tellManagerArrived(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Arriving at bank with $"+ myPerson.money);
		Do("Arriving at bank with $"+ myPerson.money);
		if(bankcustomerGui == null) {
			bankcustomerGui = new BankCustomerGui(this, manager);
			gui.myPanels.get(myPerson.BankChoice).panel.addGui(bankcustomerGui);
		}
		bankcustomerGui.setPresent(true);

		if(purpose.equals("withdraw")||purpose.equals("deposit")||purpose.equals("rob")){
			manager.msgIAmHere(this,"transaction");
			bankcustomerGui.goToTeller();
			finishTask();
		}
		else if(purpose.equals("loan")){
			manager.msgIAmHere(this,"loan");
			bankcustomerGui.goToLoanPos();
			finishTask();
		}
		else if(purpose.equals("job")){
			manager.msgIAmHere(this, "job");
			//GUI???
		}
		state=bankCustomerState.waiting;
	}

	private void makeAccount(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Making account");
		Do("Making account");
		if(loanOfficer!=null){
			loanOfficer.msgMakeAccount(this);
		}
		else if(teller!=null){
			teller.msgMakeAccount(this);
		}
		state=bankCustomerState.inProgress;
	}

	private void requestLoan(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Requesting for loan");
		Do("Requesting for loan");
		String job=jobString();
		loanOfficer.msgINeedALoan(this, accountNum, 1000, job);		//Need a way to decide how much $$ to request
		state=bankCustomerState.inProgress;
	}

	private String jobString(){
		if(myPerson.jobLocation.contains("restaurant")) return "waiter";
		else if(myPerson.jobLocation.contains("Bank")) return "bankteller";
		else return "";
	}

	private void makeTransaction(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Making a transaction");
		Do("Making a transaction");

		//HACK TO TEST
		if(myPerson.money>myPerson.depositThreshold){
			teller.msgDeposit(this, accountNum, myPerson.money-myPerson.depositThreshold);
		}
		if(myPerson.money<myPerson.withdrawalThreshold){
			teller.msgWithdrawal(this, accountNum, myPerson.withdrawalThreshold-myPerson.money);
		}

		state=bankCustomerState.inProgress;
	}

	private void leaveBank(){
		AlertLog.getInstance().logMessage(AlertTag.Bank, "BankCustomer", "Leaving bank with $"+myPerson.money);
		Do("Leaving bank with $"+myPerson.money);
		//System.err.println(manager);
		manager.msgCheckBalance(this, accountNum);
		bankcustomerGui.DoExitBank();
		state=bankCustomerState.exiting;
	}

	public void setManager(BankManager m){
		manager=m;
	}

	//GUI
	public void setGui(BankCustomerGui BC){
		bankcustomerGui=BC;
	}

	private void finishTask(){			//Semaphore to make waiter finish task before running scheduler
		try {
			atDest.acquire();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void setMarketManager(BankManagerRole bankManager) {
		manager = bankManager;
	}

	@Override
	public PersonAgent getPerson() {
		return myPerson;
	}

}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Bull. Torrey bot. Club 31(6): 343 (1904)

#### Original name
Boletus cinnamomeus Jacq., 1787

### Remarks
null


text:
<?php

/*
 StringReplacementFilterFactory from Swift Mailer.

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.

 */

//@require 'Swift/StreamFilters/StringReplacementFilter.php';
//@require 'Swift/StreamFilterFactory.php';

/**
 * Creates filters for replacing needles in a string buffer.
 * @package Swift
 * @author Chris Corbyn
 */
class Swift_StreamFilters_StringReplacementFilterFactory
  implements Swift_ReplacementFilterFactory
{

  /** Lazy-loaded filters */
  private $_filters = array();

  /**
   * Create a new StreamFilter to replace $search with $replace in a string.
   * @param string $search
   * @param string $replace
   * @return Swift_StreamFilter
   */
  public function createFilter($search, $replace)
  {
    if (!isset($this->_filters[$search][$replace]))
    {
      if (!isset($this->_filters[$search]))
      {
        $this->_filters[$search] = array();
      }

      if (!isset($this->_filters[$search][$replace]))
      {
        $this->_filters[$search][$replace] = array();
      }

      $this->_filters[$search][$replace]
        = new Swift_StreamFilters_StringReplacementFilter($search, $replace);
    }

    return $this->_filters[$search][$replace];
  }

}


text:
#if ! defined(EPPCOMMANDUPDATEHOST_HPP)    /* { */
#define       EPPCOMMANDUPDATEHOST_HPP        1

#include "EppCommandUpdate.hpp"
#include "EppIpAddress.hpp"

#define	MAX_NUM_OF_UPDATE_ADDRESSES	16

/**
 * This EppCommandUpdateHost class implements EPP Command Update
 * entity for EPP Host objects.
 *
 * @author Ning Zhang ning.zhang@neustar.com
 * @version $Revision: 1.1 $ $Date: 2005/12/06 20:11:35 $
 */
class EPP_EXPORT EppCommandUpdateHost : public EppCommandUpdate
{
private:
	DOMString                     name;
	ValueVectorOf<EppIpAddress> * addrAdded;
	ValueVectorOf<EppIpAddress> * addrRemoved;
	DOMString                     newName;

	/**
	 * Converts a list of IP addresses into XML
	 *
	 * @param doc  the XML DOM_Element object
	 * @param body the XML DOM_Element object to which the list
	 *             of IP addresses is appended
	 * @param list the list of IP addresses to be converted
	 */
	void addressToXML( DOM_Document& doc, DOM_Element& body, ValueVectorOf<EppIpAddress> * list );

	/**
	 * Converts a list of IP addresses from XML format
	 *
	 * @param root the XML Node object containing the list
	 *             of IP addresses
	 * @param addressList the list of IP addresses to be stored
	 */
	void addressFromXML( const DOM_Node& root, ValueVectorOf<EppIpAddress> * addressList );

public:
	/**
	 * Creates an EppCommandUpdateHost
	 */
	EppCommandUpdateHost()
	{
		this->name        = null;
		this->addrAdded   = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->addrRemoved = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->newName     = null;
	};

	/**
	 * Creates an EppCommandUpdateHost given the name of the
	 * host
	 */
	EppCommandUpdateHost( DOMString name )
	{
		this->name        = name;
		this->addrAdded   = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->addrRemoved = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->newName     = null;
	};

	/**
	 * Creates an EppCommandUpdateHost given the name of the
	 * host with a client transaction id associated with operation
	 */
	EppCommandUpdateHost( DOMString name, DOMString xid )
	{
		this->name        = name;
		this->addrAdded   = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->addrRemoved = new ValueVectorOf<EppIpAddress>(MAX_NUM_OF_UPDATE_ADDRESSES);
		this->newName     = null;
		this->clTRID      = xid;
	};

	/**
	 * Destructor
	 */
	~EppCommandUpdateHost()
	{
		if( this->addrAdded != null )
		{
			delete this->addrAdded;
			this->addrAdded = null;
		}
		if( this->addrRemoved != null )
		{
			delete this->addrRemoved;
			this->addrRemoved = null;
		}
	};

	/**
	 * Returns the run-time type of an EppEntity object
	 */
	virtual int getEntityType()
	{
		return EppEntity::TYPE_EppCommandUpdateHost;
	};

	/**
	 * Gets the name of the host to be updated
	 */
	DOMString getName()
	{
		return this->name;
	};

	/**
	 * Sets the name of the host to be updated
	 */
	void setName( DOMString name )
	{
		this->name= name;
	};

	/**
	 * Gets the list of new IP addresses to be added to the host
	 */
	ValueVectorOf<EppIpAddress> * getAddressAdded()
	{
		return this->addrAdded;
	};

	/**
	 * Adds a new IP address to be associated with the host
	 */
	void addAddress( EppIpAddress& address )
	{
		this->addrAdded->addElement(address);
	};

	/**
	 * Gets the list of old IP addresses to be removed from the host
	 */
	ValueVectorOf<EppIpAddress> * getAddressRemoved()
	{
		return this->addrRemoved;
	};

	/*
	 * Removes an old IP address associated with the host
	 */
	void removeAddress( EppIpAddress& address )
	{
		this->addrRemoved->addElement(address);
	};

	/**
	 * Gets the new name for the host, or null if the name of the
	 * the host is not to be changed
	 */
	DOMString getNewName()
	{
		return this->newName;
	};

	/**
	 * Sets the new name for the host if the name of the
	 * the host needs to be changed
	 */
	void setNewName( DOMString name )
	{
		this->newName = name;
	};

	/**
	 * Converts the EppCommandUpdateHost object into
	 * an XML element
	 *
	 * @param doc the XML DOM_Element object
	 * @param tag the tag/element name for the
	 *            EppCommandUpdateHost object
	 *
	 * @return an DOM_Element object
	 */
	DOM_Element toXML( DOM_Document& doc, const DOMString& tag );

	/**
	 * Converts an XML element into an EppCommandUpdateHost
	 * object. The caller of this method must make sure that the root node
	 * is of an EPP Command Update entity for an EPP Host object.
	 *
	 * @param root root node for an EppCommandUpdate object
	 *	     in XML format
	 *
	 * @return an EppCommandUpdate object, or null if the node
	 *	 is invalid
	 */
	static EppCommandUpdateHost * fromXML( const DOM_Node& root );
};

#endif     /* EPPCOMMANDUPDATEHOST_HPP */  /* } */


text:
package hello.config;

import java.util.Properties;

import javax.sql.DataSource;

import org.apache.commons.dbcp.datasources.SharedPoolDataSource;
import org.restexpress.common.exception.ConfigurationException;

import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;

public class MysqlConfig {
	private static final String PREFIX = "mysql.";
	private static final String URI_PROPERTY = PREFIX + "uri";
	private static final String USE_CONFIGS_PROPERTY = PREFIX + "useConfigs";
	private static final String USER_NAME = PREFIX + "user";
	private static final String PASSWORD = PREFIX + "password";
	private static final String MAX_POOL_SIZE = PREFIX + "maxPoolSize";
	private static final String MIN_POOL_SIZE = PREFIX + "minPoolSize";

	private DataSource dataSource;

	public MysqlConfig(Properties p) {
		String uri = p.getProperty(URI_PROPERTY);
		String useConfigs = p.getProperty(USE_CONFIGS_PROPERTY);
		String dbUser = p.getProperty(USER_NAME);
		String dbPassword = p.getProperty(PASSWORD);
		int maxPoolSize = Integer.valueOf(p.getProperty(MAX_POOL_SIZE, "100"));
		int minPoolSize = Integer.valueOf(p.getProperty(MIN_POOL_SIZE, "3"));

		if (uri == null) {
			throw new ConfigurationException("Please define a MySQL URI for property: "
					+ URI_PROPERTY);
		}

		MysqlConnectionPoolDataSource ds = configureMysqlConnections(uri, dbUser, dbPassword,
				useConfigs);
		this.dataSource = configurePoolingDataSource(ds, maxPoolSize, minPoolSize);
	}

	private MysqlConnectionPoolDataSource configureMysqlConnections(String uri, String dbUser,
			String dbPassword, String useConfigs) {
		MysqlConnectionPoolDataSource ds = new MysqlConnectionPoolDataSource();
		ds.setUrl(uri);

		if (dbUser != null) {
			ds.setUser(dbUser);
		}

		if (dbPassword != null) {
			ds.setPassword(dbPassword);
		}

		if (useConfigs != null) {
			ds.setUseConfigs(useConfigs);
		}
		return ds;
	}

	public DataSource getDataSource() {
		return dataSource;
	}

	private DataSource configurePoolingDataSource(MysqlConnectionPoolDataSource ds,
			int maxPoolSize, int minPoolSize) {
		SharedPoolDataSource spds = new SharedPoolDataSource();
		spds.setConnectionPoolDataSource(ds);
		spds.setMaxActive(maxPoolSize);
		spds.setMaxIdle(minPoolSize);
		return spds;
	}
}


text:
package com.asana.resources;

import com.asana.Client;
import com.asana.models.*;
import com.asana.requests.CollectionRequest;
import com.asana.requests.ItemRequest;
import com.asana.resources.gen.WorkspacesBase;

public class Workspaces extends WorkspacesBase {
    public Workspaces(Client client) {
        super(client);
    }

    public CollectionRequest<Task> taskTypeahead(String workspace) {
        String path = String.format("/workspaces/%s/typeahead", workspace);
        CollectionRequest<Task> request = new CollectionRequest<>(this, Task.class, path, "GET");
        return request.query("type", "task");
    }

    public CollectionRequest<User> userTypeahead(String workspace) {
        String path = String.format("/workspaces/%s/typeahead", workspace);
        CollectionRequest<User> request = new CollectionRequest<>(this, User.class, path, "GET");
        return request.query("type", "user");
    }

    public CollectionRequest<Project> projectTypeahead(String workspace) {
        String path = String.format("/workspaces/%s/typeahead", workspace);
        CollectionRequest<Project> request = new CollectionRequest<>(this, Project.class, path, "GET");
        return request.query("type", "project");
    }

    public CollectionRequest<Tag> tagTypeahead(String workspace) {
        String path = String.format("/workspaces/%s/typeahead", workspace);
        CollectionRequest<Tag> request = new CollectionRequest<>(this, Tag.class, path, "GET");
        return request.query("type", "tag");
    }

    /**
     * Returns the full workspace record for a single workspace.
     *
     * @param  workspace Globally unique identifier for the workspace or organization.
     * @return Request object
     */
    public ItemRequest<Workspace> findById(String workspace) {

        String path = String.format("/workspaces/%s", workspace);
        return new ItemRequest<Workspace>(this, Workspace.class, path, "GET");
    }

    /**
     * Returns the compact records for all workspaces visible to the authorized user.
     *
     * @return Request object
     */
    public CollectionRequest<Workspace> findAll() {

        return new CollectionRequest<Workspace>(this, Workspace.class, "/workspaces", "GET");
    }

    /**
     * A specific, existing workspace can be updated by making a PUT request on
     * the URL for that workspace. Only the fields provided in the data block
     * will be updated; any unspecified fields will remain unchanged.
     *
     * Currently the only field that can be modified for a workspace is its `name`.
     *
     * Returns the complete, updated workspace record.
     *
     * @param  workspace The workspace to update.
     * @return Request object
     */
    public ItemRequest<Workspace> update(String workspace) {

        String path = String.format("/workspaces/%s", workspace);
        return new ItemRequest<Workspace>(this, Workspace.class, path, "PUT");
    }

    /**
     * Retrieves objects in the workspace based on an auto-completion/typeahead
     * search algorithm. This feature is meant to provide results quickly, so do
     * not rely on this API to provide extremely accurate search results. The
     * result set is limited to a single page of results with a maximum size,
     * so you won't be able to fetch large numbers of results.
     *
     * @param  workspace The workspace to fetch objects from.
     * @return Request object
     */
    public CollectionRequest<ResourceWithSubtype> typeahead(String workspace) {

        String path = String.format("/workspaces/%s/typeahead", workspace);
        return new CollectionRequest<ResourceWithSubtype>(this, ResourceWithSubtype.class, path, "GET");
    }

    /**
     * The user can be referenced by their globally unique user ID or their email address.
     * Returns the full user record for the invited user.
     *
     * @param  workspace The workspace or organization to invite the user to.
     * @return Request object
     */
    public ItemRequest<Workspace> addUser(String workspace) {

        String path = String.format("/workspaces/%s/addUser", workspace);
        return new ItemRequest<Workspace>(this, Workspace.class, path, "POST");
    }

    /**
     * The user making this call must be an admin in the workspace.
     * Returns an empty data record.
     *
     * @param  workspace The workspace or organization to invite the user to.
     * @return Request object
     */
    public ItemRequest<Workspace> removeUser(String workspace) {

        String path = String.format("/workspaces/%s/removeUser", workspace);
        return new ItemRequest<Workspace>(this, Workspace.class, path, "POST");
    }
}


text:
/* This file was generated by upbc (the upb compiler) from the input
 * file:
 *
 *     envoy/extensions/transport_sockets/tls/v3/cert.proto
 *
 * Do not edit -- your changes will be discarded when the file is
 * regenerated. */

#ifndef ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_TLS_V3_CERT_PROTO_UPB_H_
#define ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_TLS_V3_CERT_PROTO_UPB_H_

#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/decode_fast.h"
#include "upb/encode.h"

/* Public Imports. */
#include "envoy/extensions/transport_sockets/tls/v3/common.upb.h"
#include "envoy/extensions/transport_sockets/tls/v3/secret.upb.h"
#include "envoy/extensions/transport_sockets/tls/v3/tls.upb.h"

#include "upb/port_def.inc"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}  /* extern "C" */
#endif

#include "upb/port_undef.inc"

#endif  /* ENVOY_EXTENSIONS_TRANSPORT_SOCKETS_TLS_V3_CERT_PROTO_UPB_H_ */


text:
namespace IntegrationTests
{
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore.Identity;
    using Microsoft.AspNetCore.Identity.DocumentDB;
    using Microsoft.Extensions.DependencyInjection;
    using Xunit;

    public class EnsureWeCanExtendIdentityUserTests : UserIntegrationTestsBase
    {
        private UserManager<ExtendedIdentityUser> _Manager;
        private ExtendedIdentityUser _User;

        public class ExtendedIdentityUser : IdentityUser
        {
            public string ExtendedField { get; set; }
        }

        public EnsureWeCanExtendIdentityUserTests()
        {
            BeforeEachTestAfterBase();
        }

        public void BeforeEachTestAfterBase()
        {
            _Manager = CreateServiceProvider<ExtendedIdentityUser, IdentityRole>()
                .GetService<UserManager<ExtendedIdentityUser>>();
            _User = new ExtendedIdentityUser
            {
                UserName = "bob"
            };
        }

        [Fact]
        public async Task Create_ExtendedUserType_SavesExtraFields()
        {
            _User.ExtendedField = "extendedField";

            await _Manager.CreateAsync(_User);

            var savedUser = Client.CreateDocumentQuery<ExtendedIdentityUser>(Users.DocumentsLink).AsEnumerable().FirstOrDefault();
            Assert.Equal("extendedField", savedUser.ExtendedField);
        }

        [Fact]
        public async Task Create_ExtendedUserType_ReadsExtraFields()
        {
            _User.ExtendedField = "extendedField";

            await _Manager.CreateAsync(_User);

            var savedUser = await _Manager.FindByIdAsync(_User.Id);
            Assert.Equal("extendedField", savedUser.ExtendedField);
        }
    }
}


text:
import { getDiffCommand } from '../../lib/getDiffCommand.js'

describe('chunkFiles', () => {
  const customDiffString = 'origin/main..custom-branch'
  const customDiffSpaceSeparatedString = 'origin/main custom-branch'
  const customDiffFilter = 'a'

  it('should default to sane value', () => {
    const diff = getDiffCommand()
    expect(diff).toEqual(['diff', '--name-only', '-z', `--diff-filter=ACMR`, '--staged'])
  })

  it('should work only with diff set as string', () => {
    const diff = getDiffCommand(customDiffString)
    expect(diff).toEqual([
      'diff',
      '--name-only',
      '-z',
      `--diff-filter=ACMR`,
      'origin/main..custom-branch',
    ])
  })

  it('should work only with diff set as space separated string', () => {
    const diff = getDiffCommand(customDiffSpaceSeparatedString)
    expect(diff).toEqual([
      'diff',
      '--name-only',
      '-z',
      `--diff-filter=ACMR`,
      'origin/main',
      'custom-branch',
    ])
  })

  it('should work only with diffFilter set', () => {
    const diff = getDiffCommand(undefined, customDiffFilter)
    expect(diff).toEqual(['diff', '--name-only', '-z', `--diff-filter=a`, '--staged'])
  })

  it('should work with both diff and diffFilter set', () => {
    const diff = getDiffCommand(customDiffString, customDiffFilter)
    expect(diff).toEqual([
      'diff',
      '--name-only',
      '-z',
      `--diff-filter=a`,
      'origin/main..custom-branch',
    ])
  })
})