text:
import React from 'react';
import PropTypes from 'prop-types';
import ViewListIcon from 'material-ui/svg-icons/action/view-list';

const componentPropType = PropTypes.oneOfType([PropTypes.func, PropTypes.string]);

const Resource = () => <Resource> elements are for configuration only and should not be rendered;

Resource.propTypes = {
    name: PropTypes.string.isRequired,
    list: componentPropType,
    create: componentPropType,
    edit: componentPropType,
    show: componentPropType,
    remove: componentPropType,
    icon: componentPropType,
    options: PropTypes.object,
    checkCredentials: PropTypes.func,
};

Resource.defaultProps = {
    icon: ViewListIcon,
    options: {},
};

export default Resource;

redpajama_set_name: RedPajamaGithub


text:
package com.hazelcast.simulator.protocol.processors;

import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.simulator.protocol.core.ResponseType;
import com.hazelcast.simulator.protocol.operation.CreateTestOperation;
import com.hazelcast.simulator.protocol.operation.IntegrationTestOperation;
import com.hazelcast.simulator.protocol.operation.IsPhaseCompletedOperation;
import com.hazelcast.simulator.protocol.operation.SimulatorOperation;
import com.hazelcast.simulator.protocol.operation.StartTestOperation;
import com.hazelcast.simulator.protocol.operation.StartTestPhaseOperation;
import com.hazelcast.simulator.protocol.operation.StopTestOperation;
import com.hazelcast.simulator.test.TestCase;
import com.hazelcast.simulator.test.TestPhase;
import com.hazelcast.simulator.tests.FailingTest;
import com.hazelcast.simulator.tests.SuccessTest;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import static com.hazelcast.simulator.protocol.core.ResponseType.EXCEPTION_DURING_OPERATION_EXECUTION;
import static com.hazelcast.simulator.protocol.core.ResponseType.SUCCESS;
import static com.hazelcast.simulator.protocol.core.ResponseType.TEST_PHASE_IS_RUNNING;
import static com.hazelcast.simulator.protocol.core.ResponseType.UNSUPPORTED_OPERATION_ON_THIS_PROCESSOR;
import static com.hazelcast.simulator.protocol.operation.OperationCodec.toJson;
import static com.hazelcast.simulator.protocol.operation.OperationType.getOperationType;
import static com.hazelcast.simulator.utils.CommonUtils.sleepMillis;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class WorkerOperationProcessorTest {

    private static final Logger LOGGER = Logger.getLogger(WorkerOperationProcessorTest.class);

    private static final Class DEFAULT_TEST = SuccessTest.class;
    private static final String DEFAULT_TEST_ID = DEFAULT_TEST.getSimpleName();

    private final TestCase defaultTestCase = mock(TestCase.class);

    private final TestExceptionLogger exceptionLogger = new TestExceptionLogger();

    private final HazelcastInstance serverInstance = mock(HazelcastInstance.class);
    private final HazelcastInstance clientInstance = mock(HazelcastInstance.class);

    private Map<String, String> properties;
    private WorkerOperationProcessor processor;

    @Before
    public void setUp() throws Exception {
        properties = new HashMap<String, String>();
        setTestCaseClass(DEFAULT_TEST.getName());

        when(defaultTestCase.getId()).thenReturn(DEFAULT_TEST_ID);
        when(defaultTestCase.getProperties()).thenReturn(properties);

        when(serverInstance.getUserContext()).thenReturn(new ConcurrentHashMap<String, Object>());
        when(clientInstance.getUserContext()).thenReturn(new ConcurrentHashMap<String, Object>());

        processor = new WorkerOperationProcessor(exceptionLogger, serverInstance, clientInstance);
    }

    @Test
    public void process_unsupportedCommand() throws Exception {
        SimulatorOperation operation = new IntegrationTestOperation(IntegrationTestOperation.TEST_DATA);
        ResponseType responseType = processor.processOperation(getOperationType(operation), operation);

        assertEquals(UNSUPPORTED_OPERATION_ON_THIS_PROCESSOR, responseType);
        exceptionLogger.assertNoException();
    }

    @Test
    public void process_CreateTest() throws Exception {
        ResponseType responseType = createTestCase(defaultTestCase);

        assertEquals(SUCCESS, responseType);
        exceptionLogger.assertNoException();
    }

    @Test
    public void process_CreateTest_sameTestIdTwice() throws Exception {
        ResponseType responseType = createTestCase(defaultTestCase);
        assertEquals(SUCCESS, responseType);

        responseType = createTestCase(defaultTestCase);
        assertEquals(EXCEPTION_DURING_OPERATION_EXECUTION, responseType);
        exceptionLogger.assertException(IllegalStateException.class);
    }

    @Test
    public void process_CreateTest_invalidTestId() {
        ResponseType responseType = createTestCase(SuccessTest.class, "%&/?!");

        assertEquals(EXCEPTION_DURING_OPERATION_EXECUTION, responseType);
        exceptionLogger.assertException(IllegalArgumentException.class);
    }

    @Test
    public void process_CreateTest_invalidClassPath() {
        setTestCaseClass("not.found.SuccessTest");
        ResponseType responseType = createTestCase(defaultTestCase);

        assertEquals(EXCEPTION_DURING_OPERATION_EXECUTION, responseType);
        exceptionLogger.assertException(ClassNotFoundException.class);
    }

    @Test
    public void process_StartTest() {
        createTestCase(defaultTestCase);
        runPhase(DEFAULT_TEST_ID, TestPhase.SETUP);
        stopTest(DEFAULT_TEST_ID, 500);
        runTest(DEFAULT_TEST_ID);

        exceptionLogger.assertNoException();
    }

    @Test
    public void process_StartTest_failingTest() {
        Class testClass = FailingTest.class;
        String testId = testClass.getSimpleName();

        createTestCase(testClass, testId);
        runPhase(testId, TestPhase.SETUP);
        runTest(testId);

        exceptionLogger.assertException(RuntimeException.class);
    }

    @Test
    public void process_StartTest_noSetUp() {
        createTestCase(defaultTestCase);
        runTest(DEFAULT_TEST_ID);

        // no setup was executed, so TestContext is null
        exceptionLogger.assertException(NullPointerException.class);
    }

    @Test
    public void process_StartTest_testNotFound() {
        runTest("notFound");

        exceptionLogger.assertNoException();
    }

    @Test
    public void process_StartTest_passiveMember() {
        processor = new WorkerOperationProcessor(exceptionLogger, serverInstance, null);

        createTestCase(defaultTestCase);
        StartTestOperation operation = new StartTestOperation(DEFAULT_TEST_ID, true);
        ResponseType responseType = processor.process(operation);
        assertEquals(SUCCESS, responseType);

        waitForPhaseCompletion(DEFAULT_TEST_ID, TestPhase.RUN);

        exceptionLogger.assertNoException();
    }

    @Test
    public void process_StopTest_testNotFound() {
        stopTest("notFound", 0);
    }

    @Test
    public void process_StartTestPhase_testNotFound() {
        runPhase("notFound", TestPhase.SETUP);
    }

    @Test
    public void process_StartTestPhase_failingTest() {
        String testId = "FailingTest";
        createTestCase(FailingTest.class, testId);
        runPhase(testId, TestPhase.GLOBAL_VERIFY);

        exceptionLogger.assertException(RuntimeException.class);
    }

    @Test
    public void process_StartTestPhase_oldPhaseStillRunning() {
        createTestCase(defaultTestCase);
        runPhase(DEFAULT_TEST_ID, TestPhase.SETUP);

        StartTestPhaseOperation operation = new StartTestPhaseOperation(DEFAULT_TEST_ID, TestPhase.RUN);
        processor.process(operation);

        runPhase(DEFAULT_TEST_ID, TestPhase.LOCAL_VERIFY, EXCEPTION_DURING_OPERATION_EXECUTION);

        exceptionLogger.assertException(IllegalStateException.class, IllegalStateException.class);
    }

    @Test
    public void process_StartTestPhase_removeTestAfterLocalTearDown() {
        createTestCase(defaultTestCase);
        runPhase(DEFAULT_TEST_ID, TestPhase.LOCAL_TEARDOWN);

        // we should be able to init the test again, after it has been removed
        createTestCase(defaultTestCase);

        exceptionLogger.assertNoException();
    }

    private void setTestCaseClass(String className) {
        properties.put("class", className);
    }

    private ResponseType createTestCase(Class testClass, String testId) {
        setTestCaseClass(testClass.getName());
        TestCase testCase = mock(TestCase.class);
        when(testCase.getId()).thenReturn(testId);
        when(testCase.getProperties()).thenReturn(properties);

        return createTestCase(testCase);
    }

    private ResponseType createTestCase(TestCase testCase) {
        SimulatorOperation operation = new CreateTestOperation(testCase);
        LOGGER.debug("Serialized operation: " + toJson(operation));

        return processor.process(operation);
    }

    private void waitForPhaseCompletion(String testId, TestPhase testPhase) {
        IsPhaseCompletedOperation operation = new IsPhaseCompletedOperation(testId, testPhase);
        ResponseType responseType;
        do {
            sleepMillis(100);
            responseType = processor.process(operation);
            if (responseType == null) {
                fail("Got null response on IsPhaseCompletedCommand");
            }
            LOGGER.info("Phase " + testPhase + ": " + responseType);
        } while (TEST_PHASE_IS_RUNNING.equals(responseType));
    }

    private void runPhase(String testId, TestPhase testPhase) {
        runPhase(testId, testPhase, SUCCESS);
    }

    private void runPhase(String testId, TestPhase testPhase, ResponseType expectedResponseType) {
        StartTestPhaseOperation operation = new StartTestPhaseOperation(testId, testPhase);
        ResponseType responseType = processor.process(operation);

        assertEquals(expectedResponseType, responseType);

        waitForPhaseCompletion(testId, testPhase);
    }

    private void runTest(String testId) {
        StartTestOperation operation = new StartTestOperation(testId, false);
        processor.process(operation);

        waitForPhaseCompletion(testId, TestPhase.RUN);
    }

    private void stopTest(final String testId, final int delayMs) {
        Thread stopThread = new Thread() {
            @Override
            public void run() {
                sleepMillis(delayMs);
                StopTestOperation operation = new StopTestOperation(testId);
                processor.process(operation);
            }
        };
        stopThread.start();
    }
}


text:
@implementation Macro

//手机屏幕宽高
#define screenWith [UIScreen mainScreen].bounds.size.width
#define screenHeight [UIScreen mainScreen].bounds.size.height

//快速设置颜色
#define RGB(a,b,c) [UIColor colorWithRed:(a)/255.0 green:(b)/255.0 blue:(c)/255.0 alpha:1.0]
#define RGBA(a,b,c,d) [UIColor colorWithRed:(a)/255.0 green:(b)/255.0 blue:(c)/255.0 alpha:(d)]
#define randomColor [UIColor colorWithRed:arc4random_uniform(255)/255.0 green:arc4random_uniform(255)/255.0 blue:arc4random_uniform(255)/255.0 alpha:1]

@end


text:
/**
 *
 */
package net.npg.abattle.communication.network.impl;

import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.List;

import net.npg.abattle.communication.CommunicationConstants;

/**
 * @author Spatzenegger
 *
 */
public class AddressFinder {

	public static InetAddress getInetAddress() {
		try {
			final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
			while (networkInterfaces.hasMoreElements()) {
				final NetworkInterface networkInterface = networkInterfaces.nextElement();
				final InetAddress inetAddress = getInterfaceAddress(networkInterface);
				if (inetAddress != null) {
					return inetAddress;
				}
			}
		} catch (final SocketException e) {
			CommunicationConstants.LOG.info("Ignored, try to use localhost:" + e.getMessage(), e);
		}
		try {
			return InetAddress.getLocalHost();
		} catch (final UnknownHostException e) {
			throw new RuntimeException(e.getMessage(), e);
		}
	}

	private static InetAddress getInterfaceAddress(final InterfaceAddress interfaceAddress) {
		if (interfaceAddress.getBroadcast() != null && !interfaceAddress.getAddress().isAnyLocalAddress() && !interfaceAddress.getAddress().isLoopbackAddress()
				&& !interfaceAddress.getAddress().isLinkLocalAddress()) {
			CommunicationConstants.LOG.debug("Found:" + interfaceAddress.getAddress().toString() + " " + interfaceAddress.getBroadcast().toString());
			return interfaceAddress.getAddress();
		}
		return null;
	}

	private static InetAddress getInterfaceAddress(final NetworkInterface networkInterface) {
		final List<InterfaceAddress> interfaceAddresses = networkInterface.getInterfaceAddresses();
		for (final InterfaceAddress interfaceAddress : interfaceAddresses) {
			final InetAddress inetAddress = getInterfaceAddress(interfaceAddress);
			if (inetAddress != null) {
				return inetAddress;
			}
		}
		return null;
	}
}


text:
LOG_SETUP(".searchcorespi.index.warmupindexcollection");

namespace searchcorespi {

using index::IDiskIndex;
using search::fef::MatchDataLayout;
using search::index::FieldLengthInfo;
using search::query::StringBase;
using search::queryeval::Blueprint;
using search::queryeval::ISourceSelector;
using search::queryeval::SearchIterator;
using TermMap = vespalib::hash_set<vespalib::string>;

class FieldTermMap : public vespalib::hash_map<uint32_t, TermMap>
{

};

WarmupIndexCollection::WarmupIndexCollection(const WarmupConfig & warmupConfig,
                                             ISearchableIndexCollection::SP prev,
                                             ISearchableIndexCollection::SP next,
                                             IndexSearchable & warmup,
                                             vespalib::Executor & executor,
                                             const vespalib::Clock & clock,
                                             IWarmupDone & warmupDone) :
    _warmupConfig(warmupConfig),
    _prev(std::move(prev)),
    _next(std::move(next)),
    _warmup(warmup),
    _executor(executor),
    _clock(clock),
    _warmupDone(warmupDone),
    _warmupEndTime(vespalib::steady_clock::now() + warmupConfig.getDuration()),
    _handledTerms(std::make_unique<FieldTermMap>()),
    _pendingTasks()
{
    if (_next->valid()) {
        setCurrentIndex(_next->getCurrentIndex());
    } else {
        LOG(warning, "Next index is not valid, Dangerous !! : %s", _next->toString().c_str());
    }
    LOG(debug, "For %g seconds I will warm up '%s' %s unpack.", vespalib::to_s(warmupConfig.getDuration()), typeid(_warmup).name(), warmupConfig.getUnpack() ? "with" : "without");
    LOG(debug, "%s", toString().c_str());
}

void
WarmupIndexCollection::setSource(uint32_t docId)
{
    assert(_prev->valid());
    assert(_next->valid());
    _prev->setSource(docId);
    _next->setSource(docId);
}

vespalib::string
WarmupIndexCollection::toString() const
{
    vespalib::asciistream os;
    os << "warmup : ";
    if (dynamic_cast<const IDiskIndex *>(&_warmup) != nullptr) {
        os << static_cast<const IDiskIndex &>(_warmup).getIndexDir();
    } else {
        os << typeid(_warmup).name();
    }
    os << "\n";
    os << "next   : " << _next->toString() << "\n";
    os << "prev   : " << _prev->toString() << "\n";
    return os.str();
}

WarmupIndexCollection::~WarmupIndexCollection()
{
    if (_warmupEndTime != vespalib::steady_time()) {
        LOG(info, "Warmup aborted due to new state change or application shutdown");
    }
    assert(_pendingTasks.has_zero_ref_count());
}

const ISourceSelector &
WarmupIndexCollection::getSourceSelector() const
{
    return _next->getSourceSelector();
}

size_t
WarmupIndexCollection::getSourceCount() const
{
    return _next->getSourceCount();
}

IndexSearchable &
WarmupIndexCollection::getSearchable(uint32_t i) const
{
    return _next->getSearchable(i);
}

uint32_t
WarmupIndexCollection::getSourceId(uint32_t i) const
{
    return _next->getSourceId(i);
}

void
WarmupIndexCollection::fireWarmup(Task::UP task)
{
    vespalib::steady_time now(vespalib::steady_clock::now());
    if (now < _warmupEndTime) {
        _executor.execute(std::move(task));
    } else {
        std::unique_lock<std::mutex> guard(_lock);
        if (_warmupEndTime != vespalib::steady_time()) {
            _warmupEndTime = vespalib::steady_time();
            guard.unlock();
            LOG(info, "Done warming up. Posting WarmupDoneTask");
            _warmupDone.warmupDone(shared_from_this());
        }
    }
}

bool
WarmupIndexCollection::handledBefore(uint32_t fieldId, const Node &term)
{
    const StringBase * sb(dynamic_cast<const StringBase *>(&term));
    if (sb != nullptr) {
        const vespalib::string & s = sb->getTerm();
        std::lock_guard<std::mutex> guard(_lock);
        TermMap::insert_result found = (*_handledTerms)[fieldId].insert(s);
        return ! found.second;
    }
    return true;
}
Blueprint::UP
WarmupIndexCollection::createBlueprint(const IRequestContext & requestContext,
                                       const FieldSpec &field,
                                       const Node &term)
{
    FieldSpecList fsl;
    fsl.add(field);
    return createBlueprint(requestContext, fsl,term);
}

Blueprint::UP
WarmupIndexCollection::createBlueprint(const IRequestContext & requestContext,
                                       const FieldSpecList &fields,
                                       const Node &term)
{
    if ( _warmupEndTime == vespalib::steady_time()) {
        // warmup done
        return _next->createBlueprint(requestContext, fields, term);
    }
    MatchDataLayout mdl;
    FieldSpecList fsl;
    bool needWarmUp(false);
    for(size_t i(0); i < fields.size(); i++) {
        const FieldSpec & f(fields[i]);
        FieldSpec fs(f.getName(), f.getFieldId(), mdl.allocTermField(f.getFieldId()), f.isFilter());
        fsl.add(fs);
        needWarmUp = needWarmUp || ! handledBefore(fs.getFieldId(), term);
    }
    if (needWarmUp) {
        auto task = std::make_unique<WarmupTask>(mdl.createMatchData(), shared_from_this());
        task->createBlueprint(fsl, term);
        fireWarmup(std::move(task));
    }
    return _prev->createBlueprint(requestContext, fields, term);
}

search::SearchableStats
WarmupIndexCollection::getSearchableStats() const
{
    return _prev->getSearchableStats();
}

search::SerialNum
WarmupIndexCollection::getSerialNum() const
{
    return std::max(_prev->getSerialNum(), _next->getSerialNum());
}

void
WarmupIndexCollection::accept(IndexSearchableVisitor &visitor) const
{
    _prev->accept(visitor);
    _next->accept(visitor);
}

FieldLengthInfo
WarmupIndexCollection::get_field_length_info(const vespalib::string& field_name) const
{
    return _next->get_field_length_info(field_name);
}

void
WarmupIndexCollection::append(uint32_t id, const IndexSearchable::SP &source)
{
    _next->append(id, source);
}

void
WarmupIndexCollection::replace(uint32_t id, const IndexSearchable::SP &source)
{
    _next->replace(id, source);
}

IndexSearchable::SP
WarmupIndexCollection::getSearchableSP(uint32_t i) const
{
    return _next->getSearchableSP(i);
}

void
WarmupIndexCollection::drainPending() {
    _pendingTasks.waitForZeroRefCount();
}

WarmupIndexCollection::WarmupRequestContext::WarmupRequestContext(const vespalib::Clock & clock)
    : _doom(clock, vespalib::steady_time::max(), vespalib::steady_time::max(), false)
{}
WarmupIndexCollection::WarmupRequestContext::~WarmupRequestContext() = default;

const vespalib::eval::Value*
WarmupIndexCollection::WarmupRequestContext::get_query_tensor(const vespalib::string&) const {
    return {};
}
WarmupIndexCollection::WarmupTask::WarmupTask(std::unique_ptr<MatchData> md, std::shared_ptr<WarmupIndexCollection> warmup)
    : _warmup(std::move(warmup)),
      _retainGuard(_warmup->_pendingTasks),
      _matchData(std::move(md)),
      _bluePrint(),
      _requestContext(_warmup->_clock)
{
}

WarmupIndexCollection::WarmupTask::~WarmupTask() = default;

void
WarmupIndexCollection::WarmupTask::run()
{
    if (_warmup->_warmupEndTime != vespalib::steady_time()) {
        LOG(debug, "Warming up %s", _bluePrint->asString().c_str());
        _bluePrint->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
        SearchIterator::UP it(_bluePrint->createSearch(*_matchData, true));
        it->initFullRange();
        for (uint32_t docId = it->seekFirst(1); !it->isAtEnd(); docId = it->seekNext(docId+1)) {
            if (_warmup->doUnpack()) {
                it->unpack(docId);
            }
        }
    } else {
        LOG(debug, "Warmup has finished, ignoring task.");
    }
}

}


text:
namespace {
constexpr gfx::Rect TERMINAL_DEFAULT_BOUNDS(gfx::Point(64, 64),
                                            gfx::Size(652, 484));
constexpr gfx::Size TERMINAL_SETTINGS_DEFAULT_SIZE(768, 512);
}  // namespace

std::unique_ptr<WebApplicationInfo> CreateWebAppInfoForTerminalSystemWebApp() {
  auto info = std::make_unique<WebApplicationInfo>();
  // URL used for crostini::kCrostiniTerminalSystemAppId.
  const GURL terminal_url("chrome-untrusted://terminal/html/terminal.html");
  info->start_url = terminal_url;
  info->scope = GURL(chrome::kChromeUIUntrustedTerminalURL);
  info->title = l10n_util::GetStringUTF16(IDS_CROSTINI_TERMINAL_APP_NAME);
  web_app::CreateIconInfoForSystemWebApp(
      info->start_url, {{"app_icon_256.png", 256, IDR_LOGO_CROSTINI_TERMINAL}},
      *info);
  info->background_color = 0xFF202124;
  info->display_mode = blink::mojom::DisplayMode::kStandalone;
  {
    apps::FileHandler handler;
    handler.accept.emplace_back();
    handler.accept.back().mime_type =
        extensions::app_file_handler_util::kMimeTypeInodeDirectory;
    info->file_handlers.push_back(std::move(handler));
  }
  info->additional_search_terms = {
      "linux", "terminal", "crostini", "ssh",
      l10n_util::GetStringUTF8(IDS_CROSTINI_TERMINAL_APP_SEARCH_TERMS)};
  return info;
}

gfx::Rect GetDefaultBoundsForTerminal(Browser* browser) {
  if (browser->is_type_app_popup()) {
    gfx::Rect bounds =
        display::Screen::GetScreen()->GetDisplayForNewWindows().work_area();
    bounds.ClampToCenteredSize(TERMINAL_SETTINGS_DEFAULT_SIZE);
    return bounds;
  }
  return TERMINAL_DEFAULT_BOUNDS;
}

TerminalSystemAppDelegate::TerminalSystemAppDelegate(Profile* profile)
    : web_app::SystemWebAppDelegate(web_app::SystemAppType::TERMINAL,
                                    "Terminal",
                                    GURL(chrome::kChromeUIUntrustedTerminalURL),
                                    profile) {}

std::unique_ptr<WebApplicationInfo> TerminalSystemAppDelegate::GetWebAppInfo()
    const {
  return CreateWebAppInfoForTerminalSystemWebApp();
}

bool TerminalSystemAppDelegate::ShouldReuseExistingWindow() const {
  return false;
}

bool TerminalSystemAppDelegate::ShouldShowNewWindowMenuOption() const {
  return true;
}

bool TerminalSystemAppDelegate::ShouldHaveTabStrip() const {
  return true;
}

bool TerminalSystemAppDelegate::HasTitlebarTerminalSelectNewTabButton() const {
  return base::FeatureList::IsEnabled(chromeos::features::kTerminalSSH);
}

gfx::Rect TerminalSystemAppDelegate::GetDefaultBounds(Browser* browser) const {
  return GetDefaultBoundsForTerminal(browser);
}

bool TerminalSystemAppDelegate::HasCustomTabMenuModel() const {
  return true;
}

std::unique_ptr<ui::SimpleMenuModel> TerminalSystemAppDelegate::GetTabMenuModel(
    ui::SimpleMenuModel::Delegate* delegate) const {
  auto result = std::make_unique<ui::SimpleMenuModel>(delegate);
  result->AddItemWithStringId(TabStripModel::CommandNewTabToRight,
                              IDS_TAB_CXMENU_NEWTABTORIGHT);
  result->AddSeparator(ui::NORMAL_SEPARATOR);
  result->AddItemWithStringId(TabStripModel::CommandCloseTab,
                              IDS_TAB_CXMENU_CLOSETAB);
  result->AddItemWithStringId(TabStripModel::CommandCloseOtherTabs,
                              IDS_TAB_CXMENU_CLOSEOTHERTABS);
  result->AddItemWithStringId(TabStripModel::CommandCloseTabsToRight,
                              IDS_TAB_CXMENU_CLOSETABSTORIGHT);
  return result;
}

bool TerminalSystemAppDelegate::ShouldShowTabContextMenuShortcut(
    Profile* profile,
    int command_id) const {
  if (command_id == TabStripModel::CommandCloseTab) {
    return crostini::GetTerminalSettingPassCtrlW(profile);
  }
  return true;
}


text:
Available since version 1.8.0.

```ruby
Faker::FunnyName.name #=> "Sam Pull"

Faker::FunnyName.two_word_name #=> "Shirley Knot"

Faker::FunnyName.three_word_name #=> "Carson O. Gin"

Faker::FunnyName.four_word_name #=> "Maude L. T. Ford"

Faker::FunnyName.name_with_initial #=> "Heather N. Yonn"
```


text:
package fixtures.bodycomplex;

import okhttp3.logging.HttpLoggingInterceptor;
import fixtures.bodycomplex.models.Fish;
import fixtures.bodycomplex.models.Goblinshark;
import fixtures.bodycomplex.models.Salmon;
import fixtures.bodycomplex.models.Sawshark;
import fixtures.bodycomplex.models.Shark;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import java.util.ArrayList;

public class PolymorphismTests {
    private static AutoRestComplexTestService client;

    @BeforeClass
    public static void setup() {
        client = new AutoRestComplexTestServiceImpl("http://localhost:3000");
        client.setLogLevel(HttpLoggingInterceptor.Level.BODY);
    }

    @Test
    public void getValid() throws Exception {
        Fish result = client.getPolymorphismOperations().getValid().getBody();
        Assert.assertEquals(Salmon.class, result.getClass());
        Salmon salmon = (Salmon) result;
        Assert.assertEquals("alaska", salmon.getLocation());
        Assert.assertEquals(1.0, salmon.getLength(), 0f);
        Assert.assertEquals(3, salmon.getSiblings().size());
        Assert.assertEquals(Shark.class, salmon.getSiblings().get(0).getClass());
        Shark sib1 = (Shark) (salmon.getSiblings().get(0));
        Assert.assertEquals(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC), sib1.getBirthday());
        Assert.assertEquals(Sawshark.class, salmon.getSiblings().get(1).getClass());
        Sawshark sib2 = (Sawshark) (salmon.getSiblings().get(1));
        Assert.assertArrayEquals(
                new byte[]{(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254},
                sib2.getPicture());
        Goblinshark sib3 = (Goblinshark) (salmon.getSiblings().get(2));
        Assert.assertEquals(1, sib3.getAge().longValue());
        Assert.assertEquals(5, sib3.getJawsize().longValue());
    }

    @Test
    public void putValid() throws Exception {
        Salmon body = new Salmon();
        body.setLocation("alaska");
        body.setIswild(true);
        body.setSpecies("king");
        body.setLength(1.0);
        body.setSiblings(new ArrayList<Fish>());

        Shark sib1 = new Shark();
        sib1.setAge(6);
        sib1.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC));
        sib1.setLength(20.0);
        sib1.setSpecies("predator");
        body.getSiblings().add(sib1);

        Sawshark sib2 = new Sawshark();
        sib2.setAge(105);
        sib2.setBirthday(new DateTime(1900, 1, 5, 1, 0, 0, DateTimeZone.UTC));
        sib2.setLength(10.0);
        sib2.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254});
        sib2.setSpecies("dangerous");
        body.getSiblings().add(sib2);

        Goblinshark sib3 = new Goblinshark();
        sib3.setAge(1);
        sib3.setBirthday(new DateTime(2015, 8, 8, 0, 0, 0, DateTimeZone.UTC));
        sib3.setLength(30.0);
        sib3.setSpecies("scary");
        sib3.setJawsize(5);
        body.getSiblings().add(sib3);

        client.getPolymorphismOperations().putValid(body);
    }

    @Test
    public void putValidMissingRequired() throws Exception {
        try {
            Salmon body = new Salmon();
            body.setLocation("alaska");
            body.setIswild(true);
            body.setSpecies("king");
            body.setLength(1.0);
            body.setSiblings(new ArrayList<Fish>());

            Shark sib1 = new Shark();
            sib1.setAge(6);
            sib1.setBirthday(new DateTime(2012, 1, 5, 1, 0, 0, DateTimeZone.UTC));
            sib1.setLength(20.0);
            sib1.setSpecies("predator");
            body.getSiblings().add(sib1);

            Sawshark sib2 = new Sawshark();
            sib2.setAge(105);
            sib2.setLength(10.0);
            sib2.setPicture(new byte[] {(byte) 255, (byte) 255, (byte) 255, (byte) 255, (byte) 254});
            sib2.setSpecies("dangerous");
            body.getSiblings().add(sib2);

            client.getPolymorphismOperations().putValidMissingRequired(body);
        } catch (IllegalArgumentException ex) {
            //expected
            Assert.assertTrue(ex.getMessage().contains("siblings.birthday is required and cannot be null."));
        }
    }
}


text:
%%
%% Qt5xHb - Bindings libraries for Harbour/xHarbour and Qt Framework 5
%%
%% Copyright (C) 2020 Marcos Antonio Gambeta <marcosgambeta AT outlook DOT com>
%%

$project=Qt5xHb
$module=QtWidgets

$header

$includes

$beginSlotsClass
$slot=|changed()
$slot=|hovered()
$slot=|toggled( bool checked )
$slot=|triggered( bool checked )
$endSlotsClass


text:
<?php

c('Begin search.php',2);

get_header();

$allsearch = &new WP_Query("s=$s&showposts=-1");
$key = wp_specialchars($s, 1);
$count = $allsearch->post_count;
wp_reset_query();

e(apply_filters('dc_search_title','
'.$count.' results for "'.$key.'"
'));

dc_the_loop('post_format_search');

get_footer();

c('End search.php',3);

?>


text:
using namespace Poco::Zip;

CompressTest::CompressTest(const std::string& name): CppUnit::TestCase(name)
{
}

CompressTest::~CompressTest()
{
}

void CompressTest::testSingleFile()
{
	std::ofstream out("appinf.zip", std::ios::binary);
	Poco::Path theFile(ZipTest::getTestFile("test.zip"));
	Compress c(out, true);
	c.addFile(theFile, theFile.getFileName());
	ZipArchive a(c.close());
}

void CompressTest::testDirectory()
{
	std::ofstream out("pocobin.zip", std::ios::binary);
	Poco::File aFile("some/");
	if (aFile.exists())
		aFile.remove(true);
	Poco::File aDir("some/recursive/dir/");
	aDir.createDirectories();
	Poco::File aDir2("some/other/recursive/dir/");
	aDir2.createDirectories();
	Poco::File aF("some/recursive/dir/test.file");
	aF.createFile();
	Poco::FileOutputStream fos(aF.path());
	fos << "just some test data";
	fos.close();

	Poco::Path theFile(aFile.path());
	theFile.makeDirectory();
	Compress c(out, true);
	c.addRecursive(theFile, ZipCommon::CL_MAXIMUM, false, theFile);
	ZipArchive a(c.close());
}

void CompressTest::testManipulator()
{
	{
		std::ofstream out("appinf.zip", std::ios::binary);
		Poco::Path theFile(ZipTest::getTestFile("test.zip"));
		Compress c(out, true);
		c.addFile(theFile, theFile.getFileName());
		ZipArchive a(c.close());
	}
	ZipManipulator zm("appinf.zip", true);
	zm.renameFile("test.zip", "renamedtest.zip");
	zm.addFile("doc/othertest.zip", ZipTest::getTestFile("test.zip"));
	ZipArchive archive=zm.commit();
	assert (archive.findHeader("doc/othertest.zip") != archive.headerEnd());
}

void CompressTest::testManipulatorDel()
{
	{
		std::ofstream out("appinf.zip", std::ios::binary);
		Poco::Path theFile(ZipTest::getTestFile("test.zip"));
		Compress c(out, true);
		c.addFile(theFile, theFile.getFileName());
		ZipArchive a(c.close());
	}
	ZipManipulator zm("appinf.zip", true);
	zm.deleteFile("test.zip");
	zm.addFile("doc/data.zip", ZipTest::getTestFile("data.zip"));
	ZipArchive archive=zm.commit();
	assert (archive.findHeader("test.zip") == archive.headerEnd());
	assert (archive.findHeader("doc/data.zip") != archive.headerEnd());
}

void CompressTest::testManipulatorReplace()
{
	{
		std::ofstream out("appinf.zip", std::ios::binary);
		Poco::Path theFile(ZipTest::getTestFile("test.zip"));
		Compress c(out, true);
		c.addFile(theFile, theFile.getFileName());
		ZipArchive a(c.close());
	}
	ZipManipulator zm("appinf.zip", true);
	zm.replaceFile("test.zip", ZipTest::getTestFile("doc.zip"));

	ZipArchive archive=zm.commit();
	assert (archive.findHeader("test.zip") != archive.headerEnd());
	assert (archive.findHeader("doc.zip") == archive.headerEnd());
}

void CompressTest::setUp()
{
}

void CompressTest::tearDown()
{
}

CppUnit::Test* CompressTest::suite()
{
	CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CompressTest");

	CppUnit_addTest(pSuite, CompressTest, testSingleFile);
	CppUnit_addTest(pSuite, CompressTest, testDirectory);
	CppUnit_addTest(pSuite, CompressTest, testManipulator);
	CppUnit_addTest(pSuite, CompressTest, testManipulatorDel);
	CppUnit_addTest(pSuite, CompressTest, testManipulatorReplace);

	return pSuite;
}


text:
export default interface TagList {
  year: number;
  semester: number;
  updated_at?: number;
  tags: {
    classification: string[],
    department: string[],
    academic_year: string[],
    credit: string[],
    instructor: string[],
    category: string[],
    etc: string[]
  };
};


text:
#include <aws/redshift/model/CreateClusterSnapshotRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

using namespace Aws::Redshift::Model;
using namespace Aws::Utils;

CreateClusterSnapshotRequest::CreateClusterSnapshotRequest() :
    m_snapshotIdentifierHasBeenSet(false),
    m_clusterIdentifierHasBeenSet(false),
    m_tagsHasBeenSet(false)
{
}

Aws::String CreateClusterSnapshotRequest::SerializePayload() const
{
  Aws::StringStream ss;
  ss << "Action=CreateClusterSnapshot&";
  if(m_snapshotIdentifierHasBeenSet)
  {
    ss << "SnapshotIdentifier=" << StringUtils::URLEncode(m_snapshotIdentifier.c_str()) << "&";
  }

  if(m_clusterIdentifierHasBeenSet)
  {
    ss << "ClusterIdentifier=" << StringUtils::URLEncode(m_clusterIdentifier.c_str()) << "&";
  }

  if(m_tagsHasBeenSet)
  {
    unsigned tagsCount = 1;
    for(auto& item : m_tags)
    {
      item.OutputToStream(ss, "Tags.member.", tagsCount, "");
      tagsCount++;
    }
  }

  ss << "Version=2012-12-01";
  return ss.str();
}


text:
<?php
	namespace Register;

	class CustomerList {
		public $error;
		public $count = 0;

		public function flagActive() {
			$find_session_query = "
				SELECT 	MAX(user_id)
				FROM	session_sessions
				WHERE	user_id > 0
				AND		session.last_hit > date_sub(sysdate(),interval 3 month)
				GROUP BY user_id
			";
			$rs = $GLOBALS['_database']->Execute($find_session_query);
			if (! $rs) {
				$this->error = "SQL Error in Register::CustomerList::flagActive(): ".$GLOBALS['_database']->ErrorMsg();
				return null;
			}
			$counter = 0;
			while (list($id) = $rs->FetchRow()) {
				$counter ++;
				$update_customer_query = "
					UPDATE	register_users
					SET		status = 'ACTIVE'
					WHERE	id = ?
				";
				$GLOBALS['_database']->Execute(
					$update_customer_query,
					array($id)
				);
				if ($GLOBALS['_database']->ErrorMsg()) {
					$this->error = "SQL Error in Register::CustomerList::flagActive(): ".$GLOBALS['_database']->ErrorMsg();
					return null;
				}
			}
			app_log("Activated ".$counter." customers",'info',__FILE__,__LINE__);
			return $counter;
		}
		public function expireInactive($age = 14) {
			if (! is_numeric($age)) {
				$this->error = "Age must be a number";
				return null;
			}

			$update_people_query = "
				UPDATE	register_users
				SET		status = 'EXPIRED'
				WHERE	status = 'NEW'
				AND		date_created < date_sub(sysdate(),INTERVAL ? day)
			";

			$GLOBALS['_database']->Execute(
				$update_people_query,
				array($age)
			);
			if ($GLOBALS['_database']->ErrorMsg()) {
				$this->error = "SQL Error in Register::CustomerList::expireInactive(): ".$GLOBALS['_database']->ErrorMsg();
				return false;
			}
			return true;
		}
		public function expire($date_threshold) {
			if (get_mysql_date($date_threshold))
				$date = get_mysql_date($date_threshold);
			else {
				$this->error = "Invalid date: '$date_threshold'";
				return null;
			}

			$bind_params = array();
			$find_people_query = "
				SELECT	u.id,
						u.login,
						u.date_created,
						IFNULL(max(s.last_hit_date),'0000-00-00 00:00:00') last_login
				FROM	register_users u
				LEFT OUTER JOIN session_sessions s
				ON		s.user_id = u.id
				AND		s.company_id = ?
				WHERE	u.status in ('ACTIVE','NEW')
				GROUP BY u.id
				HAVING	last_login < ?
				AND		u.date_created < ?
			";
			array_push($bind_params,$GLOBALS['_SESSION_']->company->id,$date,$date);

			$people = $GLOBALS['_database']->Execute($find_people_query,$bind_params);
			if (! $people) {
				$this->error = "SQL Error in Register::Customers::expire(): ".$GLOBALS['_database']->ErrorMsg();
				return null;
			}

			$count = 0;
			while($record = $people->FetchNextObject(false)) {
				app_log("Expiring ".$record->login."' [".$record->id."]",'notice');
				$customer = new Customer($record->id);
				$customer->update(array("status" => "EXPIRED"));
				$count ++;
			}
			return $count;
		}
		public function find($parameters = array(),$count = false) {
			if ($count == true) $ADODB_COUNTRECS = true;

			$bind_params = array();

			$find_person_query = "
				SELECT	id
				FROM	register_users
				WHERE	id = id";

			if (!empty($parameters['_search'])) $searchTerm = $parameters['_search'];
			elseif (!empty($parameters['searchTerm'])) $searchTerm = $parameters['searchTerm'];

			if (isset($searchTerm)) {
				if (! preg_match('/^[\w\-\.\_\s\*]{3,64}$/',$searchTerm)) {
					$this->error = "Invalid search string";
					return null;
				}
				if (preg_match('/\*/',$searchTerm))
					$string = preg_replace('/\*/','%',$searchTerm);
				else
					$string = '%'.$searchTerm.'%';

				$find_person_query .= "
				AND		(	login LIKE '$string'
					OR		first_name LIKE '$string'
					OR		last_name LIKE '$string'
					OR		middle_name LIKE '$string'
					OR		last_name LIKE '$string'
				)
				";
			}
			if (isset($parameters['id']) && preg_match('/^\d+$/',$parameters['id'])) {
				$find_person_query .= "
				AND		id = ?";
				array_push($bind_params,$parameters['id']);
			}
			elseif (isset($parameters['id'])) {
				$this->error = "Invalid id in Person::find";
				return null;
			}
			if (isset($parameters['code'])) {
				$find_person_query .= "
				AND		login = ?";
				array_push($bind_params,$parameters['code']);
			}
			if (isset($parameters['status']) && !empty($parameters['status'])) {
				if (is_array($parameters['status'])) {
					$icount = 0;
					$find_person_query .= "
					AND	status IN (";
					foreach ($parameters['status'] as $status) {
						if ($icount > 0) $find_person_query .= ",";
						$icount ++;
						if (preg_match('/^[\w\-\_\.]+$/',$status))
						$find_person_query .= "'".$status."'";
					}
					$find_person_query .= ")";
				}
				else {
					$find_person_query .= "
						AND		status = ?";
					array_push($bind_params,$parameters['status']);
				}
			}
			else {
				$find_person_query .= "
				AND		status not in ('EXPIRED','HIDDEN','DELETED')";
			}

			if (isset($parameters['first_name'])) {
				$find_person_query .= "
				AND		first_name = ?";
				array_push($bind_params,$parameters['first_name']);
			}

			if (isset($parameters['last_name'])) {
				$find_person_query .= "
				AND		last_name = ?";
				array_push($bind_params,$parameters['last_name']);
			}

			if (isset($parameters['email_address'])) {
				$find_person_query .= "
				AND		email_address = ?";
				array_push($bind_params,$parameters['email_address']);
			}

			if (isset($parameters['department_id'])) {
				$find_person_query .= "
				AND		department_id = ?";
				array_push($bind_params,$parameters['department_id']);
			}
			if (isset($parameters['organization_id'])) {
				$find_person_query .= "
				AND		organization_id = ?";
				array_push($bind_params,$parameters['organization_id']);
			}
			if (isset($parameters['automation'])) {
				if ($parameters['automation']) $find_person_query .= "
					AND		automation = 1";
				else $find_person_query .= "
					AND		automation = 0";
			}

			if (isset($parameters['_sort']) && preg_match('/^(login|first_name|last_name|organization_id)$/',$parameters['_sort'])) {
				$find_person_query .= " ORDER BY ".$parameters['_sort'];
			}
			elseif (isset($parameters['sort']) && $parameters['_sort'] == 'full_name') {
				$find_person_query .= " ORDER BY first_name,last_name";
			}
			else
				$find_person_query .= " ORDER BY login";

			if (isset($parameters['_limit']) && preg_match('/^\d+$/',$parameters['_limit'])) {
				if (preg_match('/^\d+$/',$parameters['_offset']))
					$find_person_query .= "
					LIMIT	".$parameters['_offset'].",".$parameters['_limit'];
				else
					$find_person_query .= "
					LIMIT	".$parameters['_limit'];
			}
			query_log($find_person_query,$bind_params,true);
			$rs = $GLOBALS['_database']->Execute($find_person_query,$bind_params);
			if (! $rs) {
				$this->error = "SQL Error in Register::Person::find(): ".$GLOBALS['_database']->ErrorMsg();
				return null;
			}

			$people = array();
			while (list($id) = $rs->FetchRow()) {
				if (isset($parameters['role']) || ! $count) {
					$customer = new Customer($id);
				}
				if (isset($parameters['role']) && ! $customer->has_role($parameters['role'])) continue;
				if (! $count) array_push($people,$customer);
				$this->count ++;
			}
			if ($count) return $this->count;
			return $people;
		}
		public function search($search_string,$limit = 0,$offset = 0) {
			if (is_bool($limit) && $limit == true) $count = true;
			else $count = false;

			$bind_params = array();

			app_log("Customer Search Requested",'debug',__FILE__,__LINE__);
			$this->count = 0;

			if (! preg_match('/^[\w\-\.\_\s\*]{3,64}$/',$search_string)) {
				$this->error = "Invalid search string";
				return null;
			}
			if (preg_match('/\*/',$search_string))
				$search_string = preg_replace('/\*/','%',$search_string);
			else
				$search_string = '%'.$search_string.'%';

			if (empty($search_string)) {
				$this->error = "Search string required";
				return null;
			}
			$find_person_query = "
				SELECT	id
				FROM	register_users
				WHERE	id = id
				AND		(	login LIKE '$search_string'
					OR		first_name LIKE '$search_string'
					OR		last_name LIKE '$search_string'
					OR		middle_name LIKE '$search_string'
					OR		last_name LIKE '$search_string'
				)
			";
			if (isset($parameters['status'])) {
				if (is_array($parameters['status'])) {
					$icount = 0;
					$find_person_query .= "
					AND	status IN (";
					foreach ($parameters['status'] as $status) {
						if ($icount > 0) $find_person_query .= ",";
						$icount ++;
						if (preg_match('/^[\w\-\_\.]+$/',$status))
						$find_person_query .= "'".$status."'";
					}
					$find_person_query .= ")";
				}
				else {
					$find_person_query .= "
						AND		status = ?";
					array_push($bind_params,$parameters['status']);
				}
			}
			else {
				$find_person_query .= "
				AND		status not in ('EXPIRED','HIDDEN','DELETED')";
			}

			if ($count == false && $limit > 0 && preg_match('/^\d+$/',$limit)) {
				if (preg_match('/^\d+$/',$offset))
					$find_person_query .= "
					LIMIT	$offset,$limit";
				else
					$find_person_query .= "
					LIMIT	$limit";
			}
			app_log("Search query: ".$find_person_query,'trace',__FILE__,__LINE__);
			$rs = $GLOBALS['_database']->Execute($find_person_query,$bind_params);
			if (! $rs) {
				$this->error = "SQL Error in \Register\Customer::search(): ".$GLOBALS['_database']->ErrorMsg();
				return null;
			}

			$people = array();
			while (list($id) = $rs->FetchRow()) {
				if ($count == false) {
					$customer = new Customer($id);
					array_push($people,$customer);
				}
				$this->count ++;
			}
			app_log($this->count." records found",'debug',__FILE__,__LINE__);
			if ($count == true) return $this->count;
			return $people;
		}

		public function error() {
			return $this->error;
		}

		public function count() {
			return $this->count;
		}
	}


text:
namespace extensions {

// Represents a single feature accessible to an extension developer, such as a
// top-level manifest key, a permission, or a programmatic API. A feature can
// express requirements for where it can be accessed, and supports testing
// support for those requirements.
class Feature {
 public:
  // The JavaScript contexts the feature is supported in.
  enum Context {
    UNSPECIFIED_CONTEXT,

    // A context in a privileged extension process.
    BLESSED_EXTENSION_CONTEXT,

    // A context in an unprivileged extension process.
    UNBLESSED_EXTENSION_CONTEXT,

    // A context from a content script.
    CONTENT_SCRIPT_CONTEXT,

    // A normal web page. This should have an associated URL matching pattern.
    WEB_PAGE_CONTEXT,
  };

  // The location required of extensions the feature is supported in.
  enum Location {
    UNSPECIFIED_LOCATION,
    COMPONENT_LOCATION
  };

  // The platforms the feature is supported in.
  enum Platform {
    UNSPECIFIED_PLATFORM,
    CHROMEOS_PLATFORM
  };

  // Whether a feature is available in a given situation or not, and if not,
  // why not.
  enum Availability {
    IS_AVAILABLE,
    NOT_FOUND_IN_WHITELIST,
    INVALID_TYPE,
    INVALID_CONTEXT,
    INVALID_LOCATION,
    INVALID_PLATFORM,
    INVALID_MIN_MANIFEST_VERSION,
    INVALID_MAX_MANIFEST_VERSION
  };

  Feature();
  ~Feature();

  // Parses a feature from its JSON representation.
  static scoped_ptr<Feature> Parse(const DictionaryValue* value);

  // Gets the platform the code is currently running on.
  static Platform GetCurrentPlatform();

  // Gets the Feature::Location value for the specified Extension::Location.
  static Location ConvertLocation(Extension::Location extension_location);

  std::set<std::string>* whitelist() { return &whitelist_; }
  std::set<Extension::Type>* extension_types() { return &extension_types_; }
  std::set<Context>* contexts() { return &contexts_; }

  Location location() const { return location_; }
  void set_location(Location location) { location_ = location; }

  Platform platform() const { return platform_; }
  void set_platform(Platform platform) { platform_ = platform; }

  int min_manifest_version() const { return min_manifest_version_; }
  void set_min_manifest_version(int min_manifest_version) {
    min_manifest_version_ = min_manifest_version;
  }

  int max_manifest_version() const { return max_manifest_version_; }
  void set_max_manifest_version(int max_manifest_version) {
    max_manifest_version_ = max_manifest_version;
  }

  // Returns true if the feature is available to the specified extension. Use
  // this overload for features that are not associated with a specific context.
  Availability IsAvailable(const Extension* extension) {
    return IsAvailable(extension, UNSPECIFIED_CONTEXT);
  }

  // Returns true if the feature is available to the specified extension, in the
  // specified context type.
  Availability IsAvailable(const Extension* extension, Context context) {
    return IsAvailable(extension->id(), extension->GetType(),
                       ConvertLocation(extension->location()), context,
                       GetCurrentPlatform(),
                       extension->manifest_version());
  }

  // Returns true if the feature is available to extensions with the specified
  // properties. Use this overload for features that are not associated with a
  // specific context, and when a full Extension object is not available.
  Availability IsAvailable(const std::string& extension_id,
                           Extension::Type type, Location location,
                           int manifest_version) {
    return IsAvailable(extension_id, type, location, UNSPECIFIED_CONTEXT,
                       GetCurrentPlatform(), manifest_version);
  }

  // Returns true if the feature is available to extensions with the specified
  // properties, in the specified context type, and on the specified platform.
  // This overload is mainly used for testing.
  Availability IsAvailable(const std::string& extension_id,
                           Extension::Type type, Location location,
                           Context context, Platform platform,
                           int manifest_version);

  // Returns an error message for an Availability code.
  std::string GetErrorMessage(Availability result);

 private:
  // For clarify and consistency, we handle the default value of each of these
  // members the same way: it matches everything. It is up to the higher level
  // code that reads Features out of static data to validate that data and set
  // sensible defaults.
  std::set<std::string> whitelist_;
  std::set<Extension::Type> extension_types_;
  std::set<Context> contexts_;
  Location location_;  // we only care about component/not-component now
  Platform platform_;  // we only care about chromeos/not-chromeos now
  int min_manifest_version_;
  int max_manifest_version_;

  DISALLOW_COPY_AND_ASSIGN(Feature);
};

}  // namespace extensions

#endif  // CHROME_COMMON_EXTENSIONS_FEATURE_H_


text:
package com.intellij.cvsSupport2.cvsoperations.cvsMessages;

import com.intellij.cvsSupport2.application.CvsEntriesManager;
import com.intellij.cvsSupport2.cvshandlers.CvsMessagePattern;
import com.intellij.cvsSupport2.cvsoperations.common.UpdatedFilesManager;
import com.intellij.util.PatternUtil;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.netbeans.lib.cvsclient.admin.Entry;
import org.netbeans.lib.cvsclient.command.update.UpdateFileInfo;
import org.netbeans.lib.cvsclient.command.update.UpdatedFileInfo;
import org.netbeans.lib.cvsclient.event.EventManager;
import org.netbeans.lib.cvsclient.event.IEntryListener;
import org.netbeans.lib.cvsclient.event.IFileInfoListener;
import org.netbeans.lib.cvsclient.event.IMessageListener;
import org.netbeans.lib.cvsclient.file.FileObject;
import org.netbeans.lib.cvsclient.file.ICvsFileSystem;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.regex.Pattern;

/**
 * author: lesya
 */
public class CvsMessagesTranslator implements IFileInfoListener, IMessageListener, IEntryListener {

  private static final CvsMessagePattern ABORTED_PATTERD = new CvsMessagePattern("cvs [* aborted]*");
  @NonNls private static final CvsMessagePattern[] ERRORS_PATTERNS = new CvsMessagePattern[]{ABORTED_PATTERD,
    new CvsMessagePattern("cvs* server: invalid option*"), new CvsMessagePattern(new String[]{"cvs checkout: could not check out ", "*"}, 2),
    new CvsMessagePattern("cvs* update: could not merge revision * of *: No such file or directory"),
    new CvsMessagePattern(new String[]{"cvs* update: could not patch ", "*", "; will refetch"}, 2),
    new CvsMessagePattern("dying gasps from * unexpected"),
    new CvsMessagePattern("end of file from server (consult above messages if any)"),
    new CvsMessagePattern("\\*PANIC\\* administration files missing"),
    new CvsMessagePattern(new String[]{"cvs*: Up-to-date check failed for `", "*", "'"}, 2),
    new CvsMessagePattern("cvs* server: cannot add file on non-branch tag *"), new CvsMessagePattern("Cannot access *"),
    new CvsMessagePattern("error  Permission denied"),
    new CvsMessagePattern(new String[]{"cvs* server: ", "*", " already exists, with version number *"}, 2),
    new CvsMessagePattern(new String[]{"cvs* server: cannot commitAssertingNoCircularDependency with sticky date for file `", "*", "'"}, 2),
    new CvsMessagePattern(new String[]{"cvs* server: nothing known about `", "*", "'"}, 2),
    new CvsMessagePattern("cvs* server: sticky tag `" + "*" + "' for file `" + "*" + "' is not a branch"),
    new CvsMessagePattern("cvs* server: ERROR: cannot mkdir * -- not added: No such file or directory"),
    new CvsMessagePattern(new String[]{"cvs server: nothing known about ", "*"}, 2),
    new CvsMessagePattern("Root * must be an absolute pathname"), new CvsMessagePattern("protocol error: *"),
    new CvsMessagePattern("cvs* tag: nothing known about *")};

  private static final CvsMessagePattern[] WARNINGS_PATTERNS = new CvsMessagePattern[]{
    new CvsMessagePattern("cvs server: cannot open *: mismission denied"),
    new CvsMessagePattern("cvs server: cannot make path to *: Permission denied"),
    new CvsMessagePattern("cvs server: cannot find module `*' - ignored"),
    new CvsMessagePattern("W * : * already exists on version * : NOT MOVING tag to version *"),
    new CvsMessagePattern(new String[]{"cvs server: ", "*", " added independently by second party"}, 2),
    new CvsMessagePattern("cvs server: failed to create lock directory for `*' (*#cvs.lock): No such file or directory"),
    new CvsMessagePattern("cvs server: failed to obtain dir lock in repository `*'")};

  private static final Pattern[] FILE_MESSAGE_PATTERNS = new Pattern[]{PatternUtil.fromMask("cvs server: Updating*"),
    PatternUtil.fromMask("Directory * added to the repository"), PatternUtil.fromMask("cvs server: scheduling file `*' for addition"),
    PatternUtil.fromMask("cvs *: [*] waiting for *'s lock in *"), PatternUtil.fromMask("RCS file: *,v"),
    PatternUtil.fromMask("cvs server: Tagging*"), PatternUtil.fromMask("cvs add: scheduling file `*' for addition")};

  private static final Pattern[] MESSAGE_PATTERNS = new Pattern[]{PatternUtil.fromMask("cvs *: [*] waiting for *'s lock in *")};

  private final CvsMessagesListener myListener;
  private final ICvsFileSystem myCvsFileSystem;
  private final UpdatedFilesManager myUpdatedFilesManager;
  private final String myCvsRoot;
  private final Map<File, Object> myFileToInfoMap = new HashMap<File, Object>();

  private final Collection<String> myPreviousErrorMessages = new ArrayList<String>();
  @NonNls private static final String CORRECT_ABOVE_ERRORS_FIRST_PREFIX = "correct above errors first";

  public CvsMessagesTranslator(CvsMessagesListener listener,
                               ICvsFileSystem cvsFileSystem,
                               UpdatedFilesManager mergedFilesCollector,
                               String cvsroot) {
    myListener = listener;
    myCvsFileSystem = cvsFileSystem;
    myUpdatedFilesManager = mergedFilesCollector;
    myCvsRoot = cvsroot;
  }

  public void fileInfoGenerated(Object info) {
    if (info instanceof UpdateFileInfo) {
      UpdateFileInfo updateFileInfo = (UpdateFileInfo)info;
      File file = updateFileInfo.getFile();
      if (!myUpdatedFilesManager.fileIsNotUpdated(file) && !myFileToInfoMap.containsKey(file)) {
        myFileToInfoMap.put(file, updateFileInfo);
      }
    }
    else if (info instanceof UpdatedFileInfo) {
      UpdatedFileInfo updatedFileInfo = ((UpdatedFileInfo)info);
      File file = updatedFileInfo.getFile();
      if (!myUpdatedFilesManager.fileIsNotUpdated(file)) {
        myFileToInfoMap.put(file, updatedFileInfo);
      }
    }
  }

  public void gotEntry(FileObject fileObject, Entry entry) {

  }

  public void messageSent(String message, final byte[] byteMessage, boolean error, boolean tagged) {
    myListener.addMessage(new MessageEvent(message, error, tagged));
    if (message.length() == 0) return;

    if (isFileMessage(message)) {
      myListener.addFileMessage(message, myCvsFileSystem);
      return;
    }

    if (isMessage(message)) {
      myListener.addMessage(message);
      return;
    }

    CvsMessagePattern errorMessagePattern = getErrorMessagePattern(message, ERRORS_PATTERNS);
    if (errorMessagePattern != null) {
      if (message.indexOf(CORRECT_ABOVE_ERRORS_FIRST_PREFIX) >= 0) {
        for (String s : myPreviousErrorMessages) {
          myListener.addError(s, null, myCvsFileSystem, myCvsRoot);
        }
        myPreviousErrorMessages.clear();
      }
      myListener.addError(message, errorMessagePattern.getRelativeFileName(message), myCvsFileSystem, myCvsRoot);
      return;
    }
    CvsMessagePattern warningMessagePattern = getErrorMessagePattern(message, WARNINGS_PATTERNS);
    if (warningMessagePattern != null) {
      myListener.addWarning(message, warningMessagePattern.getRelativeFileName(message), myCvsFileSystem, myCvsRoot);
      return;
    }

    if (error) {
      myPreviousErrorMessages.add(message);
    }

  }

  private static boolean isFileMessage(String message) {
    for (Pattern pattern : FILE_MESSAGE_PATTERNS) {
      if (pattern.matcher(message).matches()) return true;
    }
    return false;
  }

  private static boolean isMessage(String message) {
    for (Pattern pattern : MESSAGE_PATTERNS) {
      if (pattern.matcher(message).matches()) return true;
    }
    return false;
  }

  @Nullable
  private static CvsMessagePattern getErrorMessagePattern(String message, CvsMessagePattern[] patterns) {
    for (CvsMessagePattern pattern : patterns) {
      if (pattern.matches(message)) return pattern;
    }
    return null;
  }

  public void registerTo(EventManager eventManager) {
    eventManager.addFileInfoListener(this);
    eventManager.addMessageListener(this);
  }

  public void operationCompleted() {
    if (!CvsEntriesManager.getInstance().isActive()) return;
    for (File file : myFileToInfoMap.keySet()) {
      addFileMessage(myFileToInfoMap.get(file), file);
    }
  }

  private void addFileMessage(Object info, File file) {
    if (info instanceof UpdateFileInfo) {
      addUpdateFileInfo(file, (UpdateFileInfo)info);
    }
    else if (info instanceof UpdatedFileInfo) {
      addUpdatedFileInfo(file, ((UpdatedFileInfo)info));
    }
  }

  private void addUpdatedFileInfo(File file, UpdatedFileInfo updatedFileInfo) {
    if (!myUpdatedFilesManager.fileIsNotUpdated(file)) {
      myListener.addFileMessage(new FileMessage(updatedFileInfo, myUpdatedFilesManager));

    }
  }

  private void addUpdateFileInfo(File file, UpdateFileInfo updateFileInfo) {
    if (!myUpdatedFilesManager.fileIsNotUpdated(file)) {
      myListener.addFileMessage(new FileMessage(updateFileInfo, myUpdatedFilesManager, myUpdatedFilesManager));
    }
  }

  public void binaryMessageSent(final byte[] bytes) {
  }
}


text:
function [ mse ] = NTSDay (inputSeries, targetSeries, inputDelays, hiddenLayerSize)
% Solve an Autoregression Problem with External Input with a NARX Neural Network

% Fix data format
inputSeries = tonndata(inputSeries,false,false);
targetSeries = tonndata(targetSeries,false,false);

% Create a Nonlinear Autoregressive Network with External Input
feedbackDelays = inputDelays;
net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize);

% Prepare the Data for Training and Simulation
% The function PREPARETS prepares timeseries data for a particular network,
% shifting time by the minimum amount to fill input states and layer states.
% Using PREPARETS allows you to keep your original time series data unchanged, while
% easily customizing it for networks with differing numbers of delays, with
% open loop or closed loop feedback modes.
[inputs,inputStates,layerStates,targets] = preparets(net,inputSeries,{},targetSeries);

% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;

% Train the Network
[net,tr] = train(net,inputs,targets,inputStates,layerStates);

% Test the Network
outputs = net(inputs,inputStates,layerStates);
%errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs);

mse = performance;
% View the Network
% view(net)

% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, plotregression(targets,outputs)
%figure, plotresponse(targets,outputs)
%figure, ploterrcorr(errors)
%figure, plotinerrcorr(inputs,errors)

end


text:
<?php

/**
 * Folder controller for the sizequota module.
 *
 * @property Sizequota_FolderQuotaDao $Sizequota_FolderQuota
 */
class Sizequota_FolderController extends Sizequota_AppController
{
    /** @var array */
    public $_models = array('Assetstore', 'Folder', 'Setting');

    /** @var array */
    public $_moduleModels = array('FolderQuota');

    /**
     * Index action.
     *
     * @throws Zend_Exception
     */
    public function indexAction()
    {
        $this->disableLayout();

        if (!$this->getParam('folderId')) {
            throw new Zend_Exception('Invalid folder id parameter');
        }

        $folder = $this->Folder->load($this->getParam('folderId'));

        if (!$folder || !$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ)) {
            throw new Zend_Exception('The folder does not exist or you do not have the necessary permissions');
        }

        if ($folder->getParentId() == -1) {
            $defaultQuota = $this->Setting->getValueByName(MIDAS_SIZEQUOTA_DEFAULT_USER_QUOTA_KEY, $this->moduleName);
        } elseif ($folder->getParentId() == -2) {
            $defaultQuota = $this->Setting->getValueByName(MIDAS_SIZEQUOTA_DEFAULT_COMMUNITY_QUOTA_KEY, $this->moduleName);
        } else {
            throw new Zend_Exception('Must be a community or root user folder');
        }

        $form = new Sizequota_Form_Folder();

        $currentQuota = $this->Sizequota_FolderQuota->getQuota($folder);

        if ($currentQuota == false) {
            $quota = $defaultQuota;
            $useDefaultFolderQuota = 1;
        } else {
            $quota = $currentQuota->getQuota();
            $useDefaultFolderQuota = 0;
        }

        $quotaValueAndUnit = self::computeQuotaValueAndUnit($quota);

        $form->setDefault('folder_id', $folder->getFolderId());
        $form->setDefault('use_default_folder_quota', $useDefaultFolderQuota);
        $form->setDefault('folder_quota_value', $quotaValueAndUnit['value']);
        $form->setDefault('folder_quota_unit', $quotaValueAndUnit['unit']);

        $usedSpace = $this->Folder->getSize($folder);

        if ($quota == '') {
            $hQuota = $this->t('Unlimited');
            $hFreeSpace = '';
        } else {
            $hQuota = UtilityComponent::formatSize($quota);
            $hFreeSpace = UtilityComponent::formatSize($quota - $usedSpace);
        }

        $this->view->form = $form;
        $this->view->hDefaultQuota = UtilityComponent::formatSize($defaultQuota);
        $this->view->hFreeSpace = $hFreeSpace;
        $this->view->hQuota = $hQuota;
        $this->view->hUsedSpace = UtilityComponent::formatSize($usedSpace);
        $this->view->isAdmin = $this->userSession->Dao->isAdmin();
        $this->view->quota = $quota;
        $this->view->usedSpace = $usedSpace;

        session_start();
    }

    /** Submit action. */
    public function submitAction()
    {
        $this->requireAdminPrivileges();
        $this->disableLayout();
        $this->_helper->viewRenderer->setNoRender();

        $quota = $this->getParam('folder_quota_value');
        $multiplier = $this->getParam('folder_quota_unit');

        if ($this->getParam('use_default_folder_quota') === 1) {
            $quota = null;
        }

        $folder = $this->Folder->load($this->getParam('folder_id'));

        if (!$folder) {
            echo JsonComponent::encode(array(false, 'Invalid folderId parameter'));

            return;
        }

        if (!is_null($quota) && $quota !== '') {
            if (!is_numeric($quota) || $quota < 0) {
                echo JsonComponent::encode(array(false, 'Invalid quota value. Please enter a positive number.'));

                return;
            }

            $quota *= $multiplier;
        }

        $this->Sizequota_FolderQuota->setQuota($folder, $quota);
        echo JsonComponent::encode(array(true, 'Changes saved'));
    }

    /** Get the amount of free space available for a folder. */
    public function getfreespaceAction()
    {
        $this->disableLayout();
        $this->_helper->viewRenderer->setNoRender();

        $folderId = $this->getParam('folderId');
        if (!isset($folderId)) {
            echo JsonComponent::encode(array('status' => false, 'message' => 'Missing folderId parameter'));

            return;
        }

        $folder = $this->Folder->load($folderId);
        if (!$folder) {
            echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid folder'));

            return;
        }
        if (!$this->Folder->policyCheck($folder, $this->userSession->Dao, MIDAS_POLICY_READ)
        ) {
            echo JsonComponent::encode(array('status' => false, 'message' => 'Invalid policy'));

            return;
        }

        if ($folder->getParentId() < 0) {
            $rootFolder = $folder;
        } else {
            $rootFolder = $this->Folder->getRoot($folder);
        }
        $quota = $this->Sizequota_FolderQuota->getFolderQuota($rootFolder);
        $assetstoreFree = UtilityComponent::diskFreeSpace($this->Assetstore->getDefault()->getPath());
        if ($quota == '') {
            $free = $assetstoreFree;
        } else {
            $used = $this->Folder->getSize($rootFolder);
            $free = min($assetstoreFree, $quota - $used);
        }

        $free = number_format($free, 0, '.', '');
        $hFree = UtilityComponent::formatSize($free);
        echo JsonComponent::encode(array('status' => true, 'freeSpace' => $free, 'hFreeSpace' => $hFree));
    }

    /**
     * Compute quota value and unit.
     *
     * @param int|string $bytes
     * @return array
     */
    protected static function computeQuotaValueAndUnit($bytes)
    {
        if ($bytes >= MIDAS_SIZE_TB) {
            return array('value' => $bytes / MIDAS_SIZE_TB, 'unit' => MIDAS_SIZE_TB);
        }

        if ($bytes >= MIDAS_SIZE_GB) {
            return array('value' => $bytes / MIDAS_SIZE_GB, 'unit' => MIDAS_SIZE_GB);
        }

        if ($bytes >= MIDAS_SIZE_MB) {
            return array('value' => $bytes / MIDAS_SIZE_MB, 'unit' => MIDAS_SIZE_MB);
        }

        if ($bytes >= MIDAS_SIZE_KB) {
            return array('value' => $bytes / MIDAS_SIZE_KB, 'unit' => MIDAS_SIZE_KB);
        }

        if ($bytes > 0) {
            return array('value' => $bytes, 'unit' => MIDAS_SIZE_TB);
        }

        return array('value' => '', 'unit' => MIDAS_SIZE_MB);
    }
}


text:
/**
 *
 * \file context.h
 * @brief getdns context management functions
 *
 * Originally taken from the getdns API description pseudo implementation.
 *
 */

/*
 * Copyright (c) 2013, NLnet Labs, Verisign, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * * Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * * Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the distribution.
 * * Neither the names of the copyright holders nor the
 *   names of its contributors may be used to endorse or promote products
 *   derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _GETDNS_CONTEXT_H_
#define _GETDNS_CONTEXT_H_

#include "getdns/getdns.h"
#include "getdns/getdns_extra.h"
#include "config.h"
#include "types-internal.h"
#include "extension/default_eventloop.h"
#include "util/rbtree.h"
#include "ub_loop.h"

struct getdns_dns_req;
struct ub_ctx;

#define GETDNS_FN_RESOLVCONF "/etc/resolv.conf"
#define GETDNS_FN_HOSTS      "/etc/hosts"

enum filechgs { GETDNS_FCHG_ERRORS = -1
 , GETDNS_FCHG_NOERROR   = 0
 , GETDNS_FCHG_NOCHANGES = 0
 , GETDNS_FCHG_MTIME     = 1
 , GETDNS_FCHG_CTIME     = 2};

/** function pointer typedefs */
typedef void (*getdns_update_callback) (struct getdns_context *,
    getdns_context_code_t);

typedef void (*getdns_update_callback2) (struct getdns_context *,
    getdns_context_code_t, void *userarg);

/* internal use only for detecting changes to system files */
struct filechg {
	char *fn;
	int  changes;
	int  errors;
	struct stat *prevstat;
};

typedef enum getdns_tls_hs_state {
	GETDNS_HS_NONE,
	GETDNS_HS_WRITE,
	GETDNS_HS_READ,
	GETDNS_HS_DONE,
	GETDNS_HS_FAILED
} getdns_tls_hs_state_t;

typedef enum getdns_tsig_algo {
	GETDNS_NO_TSIG     = 0, /* Do not use tsig */
	GETDNS_HMAC_MD5    = 1, /* 128 bits */
	GETDNS_GSS_TSIG    = 2, /* Not supported */
	GETDNS_HMAC_SHA1   = 3, /* 160 bits */
	GETDNS_HMAC_SHA224 = 4,
	GETDNS_HMAC_SHA256 = 5,
	GETDNS_HMAC_SHA384 = 6,
	GETDNS_HMAC_SHA512 = 7
} getdns_tsig_algo;

typedef struct getdns_tsig_info {
	getdns_tsig_algo  alg;
	const char       *name;
	size_t            strlen_name;
	const uint8_t    *dname;
	size_t            dname_len;
	size_t            min_size; /* in # octets */
	size_t            max_size; /* Actual size in # octets */
} getdns_tsig_info;

const getdns_tsig_info *_getdns_get_tsig_info(getdns_tsig_algo tsig_alg);

/* for doing public key pinning of TLS-capable upstreams: */
typedef struct sha256_pin {
	char pin[SHA256_DIGEST_LENGTH];
	struct sha256_pin *next;
} sha256_pin_t;

typedef struct getdns_upstream {
	/* backpointer to containing upstreams structure */
	struct getdns_upstreams *upstreams;

	socklen_t                addr_len;
	struct sockaddr_storage  addr;

	/* How is this upstream doing? */
	size_t                   writes_done;
	size_t                   responses_received;
	uint64_t                 keepalive_timeout;
	int                      to_retry;
	int                      back_off;

	/* For sharing a TCP socket to this upstream */
	int                      fd;
	getdns_transport_list_t  transport;
	SSL*                     tls_obj;
	getdns_tls_hs_state_t    tls_hs_state;
	getdns_eventloop_event   event;
	getdns_eventloop        *loop;
	getdns_tcp_state         tcp;
	char                     tls_auth_name[256];
	size_t                   tls_auth_failed;
	sha256_pin_t            *tls_pubkey_pinset;

	/* Pipelining of TCP network requests */
	getdns_network_req      *write_queue;
	getdns_network_req      *write_queue_last;
	_getdns_rbtree_t          netreq_by_query_id;

	/* When requests have been scheduled asynchronously on an upstream
	 * that is kept open, and a synchronous call is then done with the
	 * upstream before all scheduled requests have been answered, answers
	 * for the asynchronous requests may be received on the open upstream.
	 * Those cannot be processed immediately, because then asynchronous
	 * callbacks will be fired as a side-effect.
	 *
	 * finished_dnsreqs is a list of dnsreqs for which answers have been
	 * received during a synchronous request.  They will be processed
	 * when the asynchronous eventloop is run.  For this the finished_event
	 * will be scheduled to the registered asynchronous event loop with a
	 * timeout of 1, so it will fire immediately (but not while scheduling)
	 * when the asynchronous eventloop is run.
	 */
	getdns_dns_req          *finished_dnsreqs;
	getdns_eventloop_event   finished_event;

	/* EDNS cookies */
	uint32_t secret;
	uint8_t  client_cookie[8];
	uint8_t  prev_client_cookie[8];
	uint8_t  server_cookie[32];

	unsigned has_client_cookie : 1;
	unsigned has_prev_client_cookie : 1;
	unsigned has_server_cookie : 1;
	unsigned server_cookie_len : 5;
	unsigned tls_fallback_ok : 1;

	/* TSIG */
	uint8_t          tsig_dname[256];
	size_t           tsig_dname_len;
	size_t           tsig_size;
	uint8_t          tsig_key[256];
	getdns_tsig_algo tsig_alg;

} getdns_upstream;

typedef struct getdns_upstreams {
	struct mem_funcs mf;
	size_t referenced;
	size_t count;
	size_t current;
	getdns_upstream upstreams[];
} getdns_upstreams;

struct getdns_context {
	/* Context values */
	getdns_resolution_t  resolution_type;
	getdns_namespace_t   *namespaces;
	int                  namespace_count;
	uint64_t             timeout;
	uint64_t             idle_timeout;
	getdns_redirects_t   follow_redirects;
	getdns_list          *dns_root_servers;

#if defined(HAVE_LIBUNBOUND) && !defined(HAVE_UB_CTX_SET_STUB)
	char                 root_servers_fn[FILENAME_MAX];
#endif
	getdns_append_name_t append_name;
	/* Suffix buffer containing a list of (length byte | dname) where
	 * length bytes contains the length of the following dname.
	 * The last dname should be the zero byte.
	 */
	const uint8_t        *suffixes;
	/* Length of all suffixes in the suffix buffer */
	size_t               suffixes_len;
	uint8_t              *trust_anchors;
	size_t                trust_anchors_len;
	getdns_upstreams     *upstreams;
	uint16_t             limit_outstanding_queries;
	uint32_t             dnssec_allowed_skew;
	getdns_tls_authentication_t  tls_auth;  /* What user requested for TLS*/
	getdns_tls_authentication_t  tls_auth_min; /* Derived minimum auth allowed*/

	getdns_transport_list_t   *dns_transports;
	size_t                     dns_transport_count;
	size_t                     dns_transport_current;

	uint8_t edns_extended_rcode;
	uint8_t edns_version;
	uint8_t edns_do_bit;
	int edns_maximum_udp_payload_size; /* -1 is unset */
	uint8_t edns_client_subnet_private;
	uint16_t tls_query_padding_blocksize;
	SSL_CTX* tls_ctx;

	getdns_update_callback  update_callback;
	getdns_update_callback2 update_callback2;
	void                   *update_userarg;

	int processing;
	int destroying;

	struct mem_funcs mf;
	struct mem_funcs my_mf;

#ifdef HAVE_LIBUNBOUND
	/* The underlying contexts that do the real work */
	struct ub_ctx *unbound_ctx;
	int            unbound_ta_set;
#ifdef HAVE_UNBOUND_EVENT_API
	_getdns_ub_loop ub_loop;
#endif
#endif
	/* A tree to hold local host information*/
	_getdns_rbtree_t local_hosts;

	int return_dnssec_status;

	/* which resolution type the contexts are configured for
	 * 0 means nothing set
	 */
	getdns_resolution_t resolution_type_set;

	/*
	 * outbound requests -> transaction to getdns_dns_req
	 */
	_getdns_rbtree_t outbound_requests;

	/* Event loop extension.  */
	getdns_eventloop       *extension;

#ifdef HAVE_LIBUNBOUND
	getdns_eventloop_event  ub_event;
	/* lock to prevent nested ub_event scheduling */
	int                     ub_event_scheduling;
#endif

	/* The default extension */
	_getdns_default_eventloop default_eventloop;
	_getdns_default_eventloop sync_eventloop;

	/*
	 * state data used to detect changes to the system config files
	 */
	struct filechg *fchg_resolvconf;
	struct filechg *fchg_hosts;

	uint8_t trust_anchors_spc[1024];

#ifdef USE_WINSOCK
	/* We need to run WSAStartup() to be able to use getaddrinfo() */
	WSADATA wsaData;
#endif
}; /* getdns_context */

/** internal functions **/
/**
 * Sets up the unbound contexts with stub or recursive behavior
 * if needed.
 * @param context previously initialized getdns_context
 * @param usenamespaces if 0 then only use the DNS, else use context namespace list
 * @return GETDNS_RETURN_GOOD on success
 */
getdns_return_t _getdns_context_prepare_for_resolution(struct getdns_context *context,
 int usenamespaces);

/* track an outbound request */
getdns_return_t _getdns_context_track_outbound_request(struct getdns_dns_req
    *req);
/* clear the outbound request from being tracked - does not cancel it */
getdns_return_t _getdns_context_clear_outbound_request(struct getdns_dns_req
    *req);

getdns_return_t _getdns_context_request_timed_out(struct getdns_dns_req
    *req);

/* cancel callback internal - flag to indicate if req should be freed and callback fired */
getdns_return_t _getdns_context_cancel_request(struct getdns_context *context,
    getdns_transaction_t transaction_id, int fire_callback);

char *_getdns_strdup(const struct mem_funcs *mfs, const char *str);

struct getdns_bindata *_getdns_bindata_copy(
    struct mem_funcs *mfs, size_t size, const uint8_t *data);

void _getdns_bindata_destroy(
    struct mem_funcs *mfs,
    struct getdns_bindata *bindata);

/* perform name resolution in /etc/hosts */
getdns_return_t _getdns_context_local_namespace_resolve(
    getdns_dns_req* req, struct getdns_dict **response);

int _getdns_filechg_check(struct getdns_context *context, struct filechg *fchg);

void _getdns_context_ub_read_cb(void *userarg);

void _getdns_upstreams_dereference(getdns_upstreams *upstreams);

void _getdns_upstream_shutdown(getdns_upstream *upstream);

#endif /* _GETDNS_CONTEXT_H_ */


text:
/*eslint-env node */
/*eslint-disable one-var, no-var, strict*/
"use strict";
var webpack =      require('webpack'),
    autoprefixer = require('autoprefixer-core'),
    HtmlPlugin =    require('html-webpack-plugin');

// definePlugin takes raw strings and inserts them, so you can put strings of JS if you want.
var envPlugin = new webpack.DefinePlugin({
    "process.env": {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV || "development"),
    },
});

var babelConfig = "babel?stage=0&optional=runtime";
var cssConfig = "css?localIdentName=[path][name]---[local]---[hash:base64:5]";

module.exports = {
    entry: ['webpack/hot/dev-server', './src/main.js'],
    output: {
        filename: "main.js",
        path: process.cwd() + "/dist",
        publicPath: "/",
    },
    module: {
        loaders: [
            {test: /\.css$/, loaders: ["style",cssConfig,"postcss"]},
            {test: /\.js$/, exclude: /node_modules/, loader: babelConfig},
            {test: /\.jsx$/, loaders: ["react-hot", babelConfig] },
            {test: /\.json$/, loader: "json-loader"},
        ],
    },
    postcss: {
        defaults: [autoprefixer],
    },
    plugins: [
        envPlugin,
        new webpack.HotModuleReplacementPlugin(),
        new HtmlPlugin({
            title: "HyperYak Loading...",
        }),
    ],
    resolve: {
        extensions: ['', '.js','.json','.jsx'],
        modulesDirectories: ['node_modules','src'],
    },
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Biblthca Lichenol. 96: 115 (2007)

#### Original name
Taeniolella atricerebrina Hafellner

### Remarks
null


text:
<?
namespace weizmannSchedule;
?>
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">

    <title>weizmannSchedule</title>

    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">

    <link href="../bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">

    <link href="../dist/css/sb-admin-2.css" rel="stylesheet">

    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

        <?php include("../topbar/navigation.php"); ?>

            <?php include dirname(__file__).'/weizmannScheduleinc.php';?>

    <link rel="stylesheet" type="text/css" href="./css/WeizmannSchedule.css">

    <link rel="stylesheet" type="text/css" href="../opendeopentr\opendeopentr.css">


text:
#nullable disable
using PasPasPas.Globals.Options.DataTypes;
using PasPasPas.Globals.Parsing;

namespace PasPasPas.Parsing.SyntaxTree.CompilerDirectives {

    /// <summary>
    ///     weak link rtti switch
    /// </summary>
    public class WeakLinkRtti : CompilerDirectiveBase {

        /// <summary>
        ///     create a new weak link rtti directive
        /// </summary>
        /// <param name="symbol"></param>
        /// <param name="mode"></param>
        /// <param name="parsedMode"></param>
        public WeakLinkRtti(Terminal symbol, Terminal mode, RttiLinkMode parsedMode) {
            Symbol = symbol;
            ModeSymbol = mode;
            Mode = parsedMode;
        }

        /// <summary>
        ///     switch mode
        /// </summary>
        public RttiLinkMode Mode { get; }

        /// <summary>
        ///     mode symbol
        /// </summary>
        public Terminal ModeSymbol { get; }

        /// <summary>
        ///     symbol
        /// </summary>
        public Terminal Symbol { get; }

        /// <summary>
        ///     accept visitor
        /// </summary>
        /// <param name="visitor">node visitor</param>
        public override void Accept(IStartEndVisitor visitor) {
            visitor.StartVisit(this);
            AcceptPart(this, Symbol, visitor);
            AcceptPart(this, ModeSymbol, visitor);
            visitor.EndVisit(this);
        }

    }
}