text:
package org.relib.http.request;

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

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.relib.http.HttpMethod;
import org.relib.http.MediaType;

/**
 * Tests the {@link RequestDefinitionComparator} to ensure sorting is working as expected.
 *
 * @author Troy Histed
 */
public class RequestDefinitionComparatorTest {

	private final RequestDefinitionComparator comparator = new RequestDefinitionComparator();
	private List<RequestDefinition> requestDefinitions;

	/**
	 * Setup.
	 */
	@Before
	public void setup() {
		this.requestDefinitions = new ArrayList<RequestDefinition>();
		this.requestDefinitions.add(new RequestDefinition());
		this.requestDefinitions.add(new RequestDefinition());
		this.requestDefinitions.add(new RequestDefinition());

		this.requestDefinitions.get(0).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(0).setAccept(MediaType.UNKNOWN);
		this.requestDefinitions.get(0).setContentType(MediaType.UNKNOWN);
		this.requestDefinitions.get(1).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(1).setAccept(MediaType.UNKNOWN);
		this.requestDefinitions.get(1).setContentType(MediaType.UNKNOWN);
		this.requestDefinitions.get(2).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(2).setAccept(MediaType.UNKNOWN);
		this.requestDefinitions.get(2).setContentType(MediaType.UNKNOWN);
	}

	/**
	 * Test to ensure that http method type takes precedence over anything else.
	 */
	@Test
	public void testHttpMethodPriorityVsUnknown() {

		this.requestDefinitions.get(0).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(1).setHttpMethod(HttpMethod.GET);
		this.requestDefinitions.get(2).setHttpMethod(HttpMethod.UNKNOWN);

		final List<RequestDefinition> expected = Arrays.asList(this.requestDefinitions.get(1),
				this.requestDefinitions.get(0), this.requestDefinitions.get(2));

		Collections.sort(this.requestDefinitions, this.comparator);
		Assert.assertEquals(expected, this.requestDefinitions);
	}

	/**
	 * Test to ensure that http method type takes precedence over anything else.
	 */
	@Test
	public void testHttpMethodPriorityVsOtherAttributes() {

		this.requestDefinitions.get(0).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(0).setAccept(MediaType.HTML);

		this.requestDefinitions.get(1).setHttpMethod(HttpMethod.GET);
		this.requestDefinitions.get(1).setAccept(MediaType.UNKNOWN);

		this.requestDefinitions.get(2).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(2).setAccept(MediaType.HTML);

		final List<RequestDefinition> expected = Arrays.asList(this.requestDefinitions.get(1),
				this.requestDefinitions.get(0), this.requestDefinitions.get(2));

		Collections.sort(this.requestDefinitions, this.comparator);
		Assert.assertEquals(expected, this.requestDefinitions);
	}

	/**
	 * Test to ensure that basic sorting uses HttpMethod first, followed by ContentType, and then Accept.
	 */
	@Test
	public void testDefinitionPriority() {

		this.requestDefinitions.get(0).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(0).setContentType(MediaType.UNKNOWN);
		this.requestDefinitions.get(0).setAccept(MediaType.HTML);

		this.requestDefinitions.get(1).setHttpMethod(HttpMethod.UNKNOWN);
		this.requestDefinitions.get(1).setContentType(MediaType.HTML);
		this.requestDefinitions.get(1).setAccept(MediaType.UNKNOWN);

		this.requestDefinitions.get(2).setHttpMethod(HttpMethod.GET);
		this.requestDefinitions.get(2).setContentType(MediaType.UNKNOWN);
		this.requestDefinitions.get(2).setAccept(MediaType.UNKNOWN);

		final List<RequestDefinition> expected = Arrays.asList(this.requestDefinitions.get(2),
				this.requestDefinitions.get(1), this.requestDefinitions.get(0));

		Collections.sort(this.requestDefinitions, this.comparator);
		Assert.assertEquals(expected, this.requestDefinitions);
	}

	/**
	 * Test to ensure that path sorting will give the longer path a greater priority
	 */
	@Test
	public void testPathPriorityByLength() {

		this.requestDefinitions.get(0).setPathParts(new PathDefinition[1]);
		this.requestDefinitions.get(1).setPathParts(new PathDefinition[3]);
		this.requestDefinitions.get(2).setPathParts(new PathDefinition[2]);

		final List<RequestDefinition> expected = Arrays.asList(this.requestDefinitions.get(1),
				this.requestDefinitions.get(2), this.requestDefinitions.get(0));

		Collections.sort(this.requestDefinitions, this.comparator);
		Assert.assertEquals(expected, this.requestDefinitions);
	}

	/**
	 * Test to ensure that path sorting will give parts with wild cards lower priority.
	 */
	@Test
	public void testPathPriorityByWildCard() {

		this.requestDefinitions.get(0).setPathParts(new PathDefinition[2]);
		this.requestDefinitions.get(0).getPathParts()[0] = new PathDefinition();
		this.requestDefinitions.get(0).getPathParts()[0].setValue("a");
		this.requestDefinitions.get(0).getPathParts()[1] = new PathDefinition();
		this.requestDefinitions.get(0).getPathParts()[1].setValue(null);

		this.requestDefinitions.get(1).setPathParts(new PathDefinition[2]);
		this.requestDefinitions.get(1).getPathParts()[0] = new PathDefinition();
		this.requestDefinitions.get(1).getPathParts()[0].setValue("a");
		this.requestDefinitions.get(1).getPathParts()[1] = new PathDefinition();
		this.requestDefinitions.get(1).getPathParts()[1].setValue("a");

		this.requestDefinitions.get(2).setPathParts(new PathDefinition[2]);
		this.requestDefinitions.get(2).getPathParts()[0] = new PathDefinition();
		this.requestDefinitions.get(2).getPathParts()[0].setValue(null);
		this.requestDefinitions.get(2).getPathParts()[1] = new PathDefinition();
		this.requestDefinitions.get(2).getPathParts()[1].setValue("a");

		final List<RequestDefinition> expected = Arrays.asList(this.requestDefinitions.get(1),
				this.requestDefinitions.get(0), this.requestDefinitions.get(2));

		Collections.sort(this.requestDefinitions, this.comparator);
		Assert.assertEquals(expected, this.requestDefinitions);
	}
}


text:
layout: post
author: "Tiffany Timbers"
title: "Virtual Instructors Retreat"
date: 2015-08-24
time: "11:00:00"
category: ["Community"]
---

  The Mentoring sub-committee is planning a Virtual Instructors Retreat this
  fall. The goal of the event is to build community between instructors, as
  well as give us all a chance to practice our teaching and give and receive
  feedback from each other. This will be a day-long event where we meet in
  person with our local community, where possible, and remotely where meeting
  in person is not possible. World-wide, all groups will also interact with
  each other via internet conferencing for specific portions of the event.

  We want as many of our instructors as possible to be able to participate,
  so please help us to do this by filling out
  this Doodle poll.

  Also, we are interested in your ideas about such an event. Please feel free
  to mail any ideas, comments or questions to
  the Mentoring sub-committee.

redpajama_set_name: RedPajamaGithub


text:
Compilador
==========

Compilador para a disciplina de Introdução a Compiladores


text:
POWER9 Changes to OPAL API
==========================

This document is a summary of POWER9 changes to the OPAL API over what it
was for POWER7 and POWER8. As the POWER series of processors (at least up
to POWER9) require changes in the hypervisor to work on a new processor
generation, this gives us an opportunity with POWER9 to clean up several
parts of the OPAL API.

Eventually, when the kernel drops support for POWER8 and before, we can then
remove the associated kernel code too.

OPAL_REINIT_CPUS
----------------
Can now be extended beyond HILE BE/LE bits. If invalid flags are set on
POWER9, OPAL_UNSUPPORTED will be returned.

Device Tree
-----------

- ``/ibm,opal/`` compatible property now just lists ``ibm,opal-v3`` and no longer ``ibm,opal-v2`` (power9 and above only)

TODO
----
Things we still have to do for POWER9:

- PCI to use async API rather than returning delays
- deprecate/remove v1 APIs where there's a V2
- Fix this FWTS warning: ::

   FAILED [MEDIUM] DeviceTreeBaseDTCWarnings: Test 3, dtc reports warnings from
   device tree: Warning (reg_format): "reg" property in /ibm,opal/flash@0 has
   invalid length (8 bytes) (#address-cells == 0, #size-cells == 0)

- Remove mi-version / ml-version from ``/ibm,opal/firmware`` and replace with something better and more portable


text:
import logging

from django.core.management.base import BaseCommand

from trello_webhooks.models import Webhook

logger = logging.getLogger(__name__)

class Command(BaseCommand):
    args = u"<token token ...>"
    help = "Sync webhooks locally with those on Trello."

    def handle(self, *args, **options):
        """Sync webhooks between local database and Trello.

        The syncing process is bidirectional - you may have webhooks registered
        with Trello that are not in the local database, and you may also
        webhooks in the local database that are not registered with Trello.

        Webhooks are registered in Trello against a combination of the Trello
        model id and a user token. The `list_hooks` API call requires a user
        token, and this _may_ be supplied as a command option (--token, -t).

        Alternatively, any tokens that are in the local database are also used,
        when calling `list_hooks`.

        The logic works like this:

        1. Sync all local webhooks to Trello
        2. Fetch all remote webhooks, using all available tokens
        3. Save any remote webhooks not already stored locally

        At this point you should have the same webhooks locally and remotely.
        Any further edits (e.g. deletion) can be made from the admin site.

        """
        local_webhooks = Webhook.objects.all()
        for webhook in local_webhooks:
            logger.info(u"Syncing local webhook (%r) to Trello", webhook)
            webhook.sync()

        # set of unique tokens that we know about from local webhooks,
        # combined with those that were passed in from the command args
        tokens = set([w.auth_token for w in local_webhooks] + [a for a in args])

        # used to match webhooks when comparing with remote hooks
        local_match = lambda h: h.id in [w.trello_id for w in local_webhooks]

        if len(tokens) == 0:
            logger.info(u"There are no user tokens with which to check Trello.")  # noqa
            logger.info(u"Usage: sync_webhooks <token token ...>")  # noqa
            return

        logger.info(u"Checking %i Trello user tokens for missing local webhooks", len(tokens))  # noqa
        for token in tokens:
            for hook in Webhook.remote_objects.list_hooks(token):
                if local_match(hook):
                    logger.info(u"Remote webhook (%s) already exists locally", hook)  # noqa
                else:
                    logger.info(u"Remote webhook (%s) does not exist locally", hook)  # noqa
                    Webhook(
                        trello_id=hook.id,
                        trello_model_id=hook.id_model,
                        description=hook.desc,
                        auth_token=hook.token,
                        is_active=hook.active
                    ).save(sync=False)

        local_webhooks = Webhook.objects.all()
        logger.info(u"Sync complete. There are %i webhooks.", local_webhooks.count())
        for webhook in Webhook.objects.all():
            logger.info(u"%s", webhook)


text:
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

with open('README.rst') as readme_file:
    readme = readme_file.read()

with open('HISTORY.rst') as history_file:
    history = history_file.read().replace('.. :changelog:', '')

requirements = [
    # TODO: put package requirements here
    'ws4py==0.3.4',
    'protobuf==2.6.1'
]

test_requirements = [
    # TODO: put package test requirements here
]

setup(
    name='pyleanrtm',
    version='0.1.0',
    description="A python client of LeanCloud messaging service",
    long_description=readme + '\n\n' + history,
    author="Ning Sun",
    author_email='sunng@about.me',
    url='https://github.com/sunng87/pyleanrtm',
    packages=[
        'pyleanrtm',
    ],
    package_dir={'pyleanrtm':
                 'pyleanrtm'},
    include_package_data=True,
    install_requires=requirements,
    license="BSD",
    zip_safe=False,
    keywords='pyleanrtm',
    classifiers=[
        'Development Status :: 2 - Pre-Alpha',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        "Programming Language :: Python :: 2",
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
    ],
    test_suite='tests',
    tests_require=test_requirements
)


text:
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/cr_elements/cr_icons.css.js';
import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.js';
import 'chrome://resources/cr_elements/cr_button/cr_button.js';
import 'chrome://resources/cr_elements/cr_radio_group/cr_radio_group.js';
import 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.js';
import 'chrome://resources/cr_elements/policy/cr_policy_indicator.js';

import {CrRadioButtonElement} from 'chrome://resources/cr_elements/cr_radio_button/cr_radio_button.js';
import {DomRepeat, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {getTemplate} from './customize_modules.html.js';
import {I18nMixin, loadTimeData} from './i18n_setup.js';
import {ChromeCartProxy} from './modules/cart/chrome_cart_proxy.js';
import {ModuleRegistry} from './modules/module_registry.js';
import {NewTabPageProxy} from './new_tab_page_proxy.js';

interface ModuleSetting {
  name: string;
  id: string;
  checked: boolean;
  initiallyChecked: boolean;
  disabled: boolean;
}

export interface CustomizeModulesElement {
  $: {
    container: HTMLElement,
    customizeButton: CrRadioButtonElement,
    hideButton: CrRadioButtonElement,
    toggleRepeat: DomRepeat,
  };
}

/** Element that lets the user configure modules settings. */
export class CustomizeModulesElement extends I18nMixin
(PolymerElement) {
  static get is() {
    return 'ntp-customize-modules';
  }

  static get template() {
    return getTemplate();
  }

  static get properties() {
    return {
      /**
       * If true, modules are customizable. If false, all modules are hidden.
       */
      show_: {
        type: Boolean,
        observer: 'onShowChange_',
      },

      showManagedByPolicy_: {
        type: Boolean,
        value: () => loadTimeData.getBoolean('modulesVisibleManagedByPolicy'),
      },

      modules_: {
        type: Array,
        value: () => ModuleRegistry.getInstance().getDescriptors().map(
            d => ({name: d.name, id: d.id, checked: true, hidden: false})),
      },

      // Discount toggle is a workaround for crbug.com/1199465 and will be
      // removed after module customization is better defined. Please avoid
      // using similar pattern for other features.
      discountToggle_: {
        type: Object,
        value: {enabled: false, initiallyEnabled: false},
      },

      discountToggleEligible_: {
        type: Boolean,
        value: false,
      },
    };
  }

  private show_: boolean;
  private showManagedByPolicy_: boolean;
  private modules_: ModuleSetting[];
  private discountToggle_: {enabled: boolean, initiallyEnabled: boolean};
  private discountToggleEligible_: boolean;

  private setDisabledModulesListenerId_: number|null = null;

  override connectedCallback() {
    super.connectedCallback();
    this.setDisabledModulesListenerId_ =
        NewTabPageProxy.getInstance()
            .callbackRouter.setDisabledModules.addListener(
                (all: boolean, ids: string[]) => {
                  this.$.container.hidden = false;
                  this.show_ = !all;
                  this.modules_.forEach(({id}, i) => {
                    const checked = !all && !ids.includes(id);
                    this.set(`modules_.${i}.checked`, checked);
                    this.set(`modules_.${i}.initiallyChecked`, checked);
                    this.set(`modules_.${i}.disabled`, ids.includes(id));
                  });
                });
    NewTabPageProxy.getInstance().handler.updateDisabledModules();

    if (this.modules_.some(module => module.id === 'chrome_cart')) {
      ChromeCartProxy.getHandler().getDiscountToggleVisible().then(
          ({toggleVisible}) => {
            this.set('discountToggleEligible_', toggleVisible);
          });

      ChromeCartProxy.getHandler().getDiscountEnabled().then(({enabled}) => {
        this.set('discountToggle_.enabled', enabled);
        this.discountToggle_.initiallyEnabled = enabled;
      });
    }
  }

  override disconnectedCallback() {
    super.disconnectedCallback();
    NewTabPageProxy.getInstance().callbackRouter.removeListener(
        this.setDisabledModulesListenerId_!);
  }

  override ready() {
    // |window.CrPolicyStrings.controlledSettingPolicy| populates the tooltip
    // text of <cr-policy-indicator indicator-type="devicePolicy" /> elements.
    // Needs to be called before |super.ready()| so that the string is available
    // when <cr-policy-indicator> gets instantiated.
    window.CrPolicyStrings = {
      controlledSettingPolicy:
          loadTimeData.getString('controlledSettingPolicy'),
    };
    super.ready();
  }

  apply() {
    const handler = NewTabPageProxy.getInstance().handler;
    handler.setModulesVisible(this.show_);
    this.modules_
        .filter(({checked, initiallyChecked}) => checked !== initiallyChecked)
        .forEach(({id, checked}) => {
          // Don't set disabled status of a module if we are in hide all mode to
          // preserve the status for the next time we go into customize mode.
          if (this.show_) {
            handler.setModuleDisabled(id, !checked);
          }
          const base = `NewTabPage.Modules.${checked ? 'Enabled' : 'Disabled'}`;
          chrome.metricsPrivate.recordSparseValueWithPersistentHash(base, id);
          chrome.metricsPrivate.recordSparseValueWithPersistentHash(
              `${base}.Customize`, id);
        });
    // Discount toggle is a workaround for crbug.com/1199465 and will be
    // removed after module customization is better defined. Please avoid
    // using similar pattern for other features.
    if (this.discountToggleEligible_ &&
        this.discountToggle_.enabled !==
            this.discountToggle_.initiallyEnabled) {
      ChromeCartProxy.getHandler().setDiscountEnabled(
          this.discountToggle_.enabled);
      chrome.metricsPrivate.recordUserAction(`NewTabPage.Carts.${
          this.discountToggle_.enabled ? 'EnableDiscount' :
                                         'DisableDiscount'}`);
    }
  }

  private onShowRadioSelectionChanged_(e: CustomEvent<{value: string}>) {
    this.show_ = e.detail.value === 'customize';
  }

  private onShowChange_() {
    this.modules_.forEach(
        (m, i) => this.set(`modules_.${i}.checked`, this.show_ && !m.disabled));
  }

  private radioSelection_(): string {
    return this.show_ ? 'customize' : 'hide';
  }

  private moduleToggleDisabled_(): boolean {
    return this.showManagedByPolicy_ || !this.show_;
  }

  private showDiscountToggle_(
      id: string, checked: boolean, eligible: boolean): boolean {
    return id === 'chrome_cart' && checked && eligible;
  }
}

declare global {
  interface HTMLElementTagNameMap {
    'ntp-customize-modules': CustomizeModulesElement;
  }
}

customElements.define(CustomizeModulesElement.is, CustomizeModulesElement);


text:
def add_native_methods(clazz):
    def setState__boolean__(a0, a1):
        raise NotImplementedError()

    clazz.setState__boolean__ = setState__boolean__


text:
@interface SCRPickFeedsViewController : UIViewController<UITableViewDelegate, UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end


text:
import React from 'react';
import {Card, CardActions, CardHeader, CardTitle, CardText} from 'material-ui/Card';
import {List} from 'material-ui/List';
import FlatButton from 'material-ui/FlatButton';

const items = [
  {
    id: 1,
    title: 'First Header Title',
    subtitle: 'First Header Subtitle',
    avatar: 'http://lorempixel.com/100/100/nature/1'
  }, {
    id: 2,
    title: 'Second Header Title',
    subtitle: 'Second Header Subtitle',
    avatar: 'http://lorempixel.com/100/100/nature/2'
  }, {
    id: 3,
    title: 'Third Header Title',
    subtitle: 'Third Header Subtitle',
    avatar: 'http://lorempixel.com/100/100/nature/3'
  }, {
    id: 4,
    title: 'Fourth Header Title',
    subtitle: 'Fourth Header Subtitle',
    avatar: 'http://lorempixel.com/100/100/nature/4'
  }
]

const ExampleCard = (item) => (

    <Card>
      <CardHeader
        title={item.title}
        subtitle={item.subtitle}
        avatar={item.avatar}
      />
      <CardTitle title="Card title" subtitle="Card subtitle"/>
      <CardText>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
        Donec mattis pretium massa. Aliquam erat volutpat. Nulla facilisi.
        Donec vulputate interdum sollicitudin. Nunc lacinia auctor quam sed pellentesque.
        Aliquam dui mauris, mattis quis lacus id, pellentesque lobortis odio.
      </CardText>
      <CardActions>
        <FlatButton label="Share"/>
        <FlatButton label="Like"/>
      </CardActions>
    </Card>

)

const ExampleCards = () => {
  const cards = items.map(item => ExampleCard(item));
  return (

Cards

      <List>
        {cards}
      </List>

  );
}

export default ExampleCards;


text:
from ghidra.app.util.datatype import DataTypeSelectionDialog
from ghidra.framework.plugintool import PluginTool
from ghidra.program.model.data import DataType
from ghidra.program.model.data import DataTypeManager
from ghidra.util.data.DataTypeParser import AllowedDataTypes

tool = state.getTool()
dtm = currentProgram.getDataTypeManager()
selectionDialog = DataTypeSelectionDialog(tool, dtm, -1, AllowedDataTypes.FIXED_LENGTH)
tool.showDialog(selectionDialog)
dataType = selectionDialog.getUserChosenDataType()
if dataType is not None:
    print "Chosen data type: " + str(dataType)


text:
    #define vfs_infof(MSG, ...)         fprintf(stderr, "[ info     ] "  MSG  "\n", ##__VA_ARGS__)
    #define vfs_info(MSG)               vfs_infof(MSG,)

    #define vfs_warningf(MSG, ...)      fprintf(stderr, "[ warning  ] "  MSG  "\n", ##__VA_ARGS__)
    #define vfs_warning(MSG)            vfs_warningf(MSG,)

    #define vfs_errorf(MSG, ...)        fprintf(stderr, "[ error    ] "  MSG  "\n", ##__VA_ARGS__)
    #define vfs_error(MSG)              vfs_errorf(MSG,)

    #define vfs_criticalf(MSG, ...)     fprintf(stderr, "[ critical ] "  MSG  "\n", ##__VA_ARGS__)
    #define vfs_critical(MSG)           vfs_criticalf(MSG,)

    #define vfs_check(EXPR)             assert(EXPR)

#endif // VFS_DISABLE_DEFAULT_ERROR_HANDLING

#if VFS_PLATFORM_WIN

    //----------------------------------------------------------------------------------------------
    // Returns the last Win32 error, in string format. Returns an empty string if there is no error.
    inline std::string get_last_error_as_string(DWORD errorCode)
    {
        auto message = std::string{};

        // Get the error message, if any.
        if (errorCode != ERROR_SUCCESS)
        {
            LPSTR messageBuffer = nullptr;
            size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
                NULL, errorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&messageBuffer, 0, NULL);

            message = std::string (messageBuffer, size);

            LocalFree(messageBuffer);
        }

        return message;
    }

#elif VFS_PLATFORM_POSIX

    //----------------------------------------------------------------------------------------------
    inline std::string get_last_error_as_string(int errorCode)
    {
        auto message = std::string{};

        if (errorCode != 0)
        {
            constexpr auto MESSAGE_LENGTH = 1024;
            message.resize(MESSAGE_LENGTH);

            // XSI-compliant strerror_r() does not work with clang and g++/
            // We must use the GNU-specific strerror_r() which returns a char* rather than int.
            // GNU-specific strerror_r() will either fill the buffer we provide and return a pointer to a string that the function stores in the buffer, or return a pointer to some immutable static string.
            char *staticErrorMessage = strerror_r(errorCode, &message[0], MESSAGE_LENGTH);
            strncpy(&message[0], staticErrorMessage, MESSAGE_LENGTH);
        }

        return message;
    }

#endif


text:
<phpunit colors="true" bootstrap="tests/bootstrap.php">
	<testsuites>
		<testsuite name="Mako Framework Tests">
			<directory>tests/unit</directory>
			<directory>tests/integration</directory>
		</testsuite>
	</testsuites>
</phpunit>


text:
set -e

# check if we are root
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit 1
fi

if [[ $# -eq 4 ]]; then
  WIFI_SSID=$1
  WIFI_PASSWORD=$2
  SSID=$3
  PASSWORD=$4
else
  echo "Usage:"
  echo "$0 WIFI_SSID WIFI_PASSWORD SSID PASSWORD"
  echo "  WIFI_SSID/PASSWORD: info for wifi network with access to internet"
  echo "  SSID/PASSWORD: info for RPi access point to create"
  exit 1
fi

echo ">> Disabling old network system and enabling new one"

# disable classic networking
systemctl mask networking.service
systemctl mask dhcpcd.service
mv /etc/network/interfaces /etc/network/interfaces~
sed -i '1i resolvconf=NO' /etc/resolvconf.conf

# enable systemd-networkd
systemctl enable systemd-networkd.service
systemctl enable systemd-resolved.service
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

# setup wlan0 ---------------------------------------------------
# connects to local wifi network
echo ">> Internet access on wlan0: ${WIFI_SSID}/${WIFI_PASSWORD}"

cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="${WIFI_SSID}"
    psk="${WIFI_PASSWORD}"
}
EOF

chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
systemctl enable wpa_supplicant@wlan0.service

mkdir -p /etc/systemd/system/wpa_suplicant@wlan0.service.d
cat > /etc/systemd/system/wpa_suplicant@wlan0.service.d/override.conf <<EOF
[Service]
ExecStartPre=/sbin/iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
ExecStopPost=-/sbin/iptables -t nat -D POSTROUTING -o wlan0 -j MASQUERADE
EOF

# setup wlan1 ---------------------------------------------------
# creates an access point
echo ">> RPi AP on wlan1: ${SSID}/${PASSWORD}"

cat > /etc/wpa_supplicant/wpa_supplicant-wlan1.conf <<EOF
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

ap_scan=2
network={
    ssid="${SSID}"
    mode=2
    key_mgmt=WPA-PSK
    psk="${PASSWORD}"
}
EOF

chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan1.conf
systemctl enable wpa_supplicant@wlan1.service

# setup eth0 -------------------------------------------------
echo ">> Setting up eth0"

cat >/etc/systemd/network/04-eth.network <<EOF
[Match]
Name=eth0
[Network]
DHCP=yes
# to use static IP uncomment these instead of DHCP
#Address=192.168.1.86/24
#Gateway=192.168.1.1
EOF

chown systemd-network:adm /etc/systemd/network/04-eth.network

echo ">> Enabling interfaces"

# setup interface to wifi with access to internet
cat > /etc/systemd/network/08-wlan0.network <<EOF
[Match]
Name=wlan0
[Network]
DHCP=yes
EOF

# setup interface for access point
cat > /etc/systemd/network/12-wlan1.network <<EOF
[Match]
Name=wlan1
[Network]
Address=10.10.10.1/24
IPForward=yes
DHCPServer=yes
EOF

echo "*******************************"
echo "* All done, please reboot now *"
echo "*******************************"

# systemctl --no-pager enable hostapd
# sleep 1
# systemctl --no-pager start dnsmasq
# sleep 1
# systemctl --no-pager start hostapd
# sleep 1


text:
title: todo
date: 2018-09-26
---
# todo
http://flight-manual.atom.io/

# File

## clipboard
copy to the relative path is better.
https://github.com/bigyuki/markdown-image-helper
https://github.com/noizbuster/img-paste/blob/master/lib/img-paste.coffee
upload
https://github.com/sagaraya/image-copipe/blob/master/lib/image-copipe.coffee

## filePath

  editor = atom.workspace.getActivePaneItem()
  file = editor?.buffer.file
  filePath = file?.path

# debug
`alt-cmd-I`

## reload
When working on packages locally, here's the recommended workflow:

  # Clone your package from GitHub using
  apm develop <package-name> #This will clone the package's repo to your local ~/.atom/dev/packages/<package-name>
  cd into this directory
  #Start Atom in this directory using:
  atom -d .

Now you can work on the package, make changes, etc.
Once you're ready to reload, you can use `View > Reload` to restart Atom with the changed package.

If you have your package sources locally on your machine, you can skip the first step (apm develop) and simply create a symbolic link from your sources to `~/.atom/dev/packages/<package-name>`


text:
#include "Fiber.h"

#include <sys/syscall.h>
#include <unistd.h>

#include <algorithm>
#include <cassert>
#include <cstring>
#include <stdexcept>

#include <folly/Likely.h>
#include <folly/Portability.h>
#include <folly/experimental/fibers/BoostContextCompatibility.h>
#include <folly/experimental/fibers/FiberManager.h>

namespace folly { namespace fibers {

namespace {
static const uint64_t kMagic8Bytes = 0xfaceb00cfaceb00c;

pid_t localThreadId() {
  static thread_local pid_t threadId = syscall(SYS_gettid);
  return threadId;
}

/* Size of the region from p + nBytes down to the last non-magic value */
static size_t nonMagicInBytes(const FContext& context) {
  uint64_t* begin = static_cast<uint64_t*>(context.stackLimit());
  uint64_t* end = static_cast<uint64_t*>(context.stackBase());

  auto firstNonMagic = std::find_if(
    begin, end,
    [](uint64_t val) {
      return val != kMagic8Bytes;
    }
  );

  return (end - firstNonMagic) * sizeof(uint64_t);
}

}  // anonymous namespace

void Fiber::setData(intptr_t data) {
  assert(state_ == AWAITING);
  data_ = data;
  state_ = READY_TO_RUN;

  if (fiberManager_.observer_) {
    fiberManager_.observer_->runnable(reinterpret_cast<uintptr_t>(this));
  }

  if (LIKELY(threadId_ == localThreadId())) {
    fiberManager_.readyFibers_.push_back(*this);
    fiberManager_.ensureLoopScheduled();
  } else {
    fiberManager_.remoteReadyInsert(this);
  }
}

Fiber::Fiber(FiberManager& fiberManager) :
    fiberManager_(fiberManager) {

  auto size = fiberManager_.options_.stackSize;
  auto limit = fiberManager_.stackAllocator_.allocate(size);

  fcontext_ = makeContext(limit, size, &Fiber::fiberFuncHelper);
}

void Fiber::init(bool recordStackUsed) {
// It is necessary to disable the logic for ASAN because we change
// the fiber's stack.
#ifndef FOLLY_SANITIZE_ADDRESS
  recordStackUsed_ = recordStackUsed;
  if (UNLIKELY(recordStackUsed_ && !stackFilledWithMagic_)) {
    auto limit = fcontext_.stackLimit();
    auto base = fcontext_.stackBase();

    std::fill(static_cast<uint64_t*>(limit),
              static_cast<uint64_t*>(base),
              kMagic8Bytes);

    // newer versions of boost allocate context on fiber stack,
    // need to create a new one
    auto size = fiberManager_.options_.stackSize;
    fcontext_ = makeContext(limit, size, &Fiber::fiberFuncHelper);

    stackFilledWithMagic_ = true;
  }
#endif
}

Fiber::~Fiber() {
  fiberManager_.stackAllocator_.deallocate(
    static_cast<unsigned char*>(fcontext_.stackLimit()),
    fiberManager_.options_.stackSize);
}

void Fiber::recordStackPosition() {
  int stackDummy;
  auto currentPosition = static_cast<size_t>(
     static_cast<unsigned char*>(fcontext_.stackBase()) -
     static_cast<unsigned char*>(static_cast<void*>(&stackDummy)));
  fiberManager_.stackHighWatermark_ =
    std::max(fiberManager_.stackHighWatermark_, currentPosition);
  VLOG(4) << "Stack usage: " << currentPosition;
}

void Fiber::fiberFuncHelper(intptr_t fiber) {
  reinterpret_cast<Fiber*>(fiber)->fiberFunc();
}

/*
 * Some weird bug in ASAN causes fiberFunc to allocate boundless amounts of
 * memory inside __asan_handle_no_return.  Work around this in ASAN builds by
 * tricking the compiler into thinking it may, someday, return.
 */
#ifdef FOLLY_SANITIZE_ADDRESS
volatile bool loopForever = true;
#else
static constexpr bool loopForever = true;
#endif

void Fiber::fiberFunc() {
  while (loopForever) {
    assert(state_ == NOT_STARTED);

    threadId_ = localThreadId();
    state_ = RUNNING;

    try {
      if (resultFunc_) {
        assert(finallyFunc_);
        assert(!func_);

        resultFunc_();
      } else {
        assert(func_);
        func_();
      }
    } catch (...) {
      fiberManager_.exceptionCallback_(std::current_exception(),
                                       "running Fiber func_/resultFunc_");
    }

    if (UNLIKELY(recordStackUsed_)) {
      fiberManager_.stackHighWatermark_ =
        std::max(fiberManager_.stackHighWatermark_,
                 nonMagicInBytes(fcontext_));
      VLOG(3) << "Max stack usage: " << fiberManager_.stackHighWatermark_;
      CHECK(fiberManager_.stackHighWatermark_ <
              fiberManager_.options_.stackSize - 64) << "Fiber stack overflow";
    }

    state_ = INVALID;

    fiberManager_.activeFiber_ = nullptr;

    auto fiber = reinterpret_cast<Fiber*>(
      jumpContext(&fcontext_, &fiberManager_.mainContext_, 0));
    assert(fiber == this);
  }
}

intptr_t Fiber::preempt(State state) {
  assert(fiberManager_.activeFiber_ == this);
  assert(state_ == RUNNING);
  assert(state != RUNNING);

  fiberManager_.activeFiber_ = nullptr;
  state_ = state;

  recordStackPosition();

  auto ret = jumpContext(&fcontext_, &fiberManager_.mainContext_, 0);

  assert(fiberManager_.activeFiber_ == this);
  assert(state_ == READY_TO_RUN);
  state_ = RUNNING;

  return ret;
}

Fiber::LocalData::LocalData(const LocalData& other) : data_(nullptr) {
  *this = other;
}

Fiber::LocalData& Fiber::LocalData::operator=(const LocalData& other) {
  reset();
  if (!other.data_) {
    return *this;
  }

  dataSize_ = other.dataSize_;
  dataType_ = other.dataType_;
  dataDestructor_ = other.dataDestructor_;
  dataCopyConstructor_ = other.dataCopyConstructor_;

  if (dataSize_ <= kBufferSize) {
    data_ = &buffer_;
  } else {
    data_ = allocateHeapBuffer(dataSize_);
  }

  dataCopyConstructor_(data_, other.data_);

  return *this;
}

void Fiber::LocalData::reset() {
  if (!data_) {
    return;
  }

  dataDestructor_(data_);
  data_ = nullptr;
}

void* Fiber::LocalData::allocateHeapBuffer(size_t size) {
  return new char[size];
}

void Fiber::LocalData::freeHeapBuffer(void* buffer) {
  delete[] reinterpret_cast<char*>(buffer);
}

}}


text:
(function($) {
  $.extend(Coolerator, {
    Filters : {
      count : function count() {
        return __count__;
      },

      clear : function clear() {
        __database__ = {};
        __count__    = 0;
      },

      prepare : function prepare() {
        if(2 !== arguments.length) {
          throw("InvalidArgumentException");
        }

        var view  = arguments[0];
        var scope = arguments[1];

        if('object' !== typeof view || 'string' !== typeof scope) {
          throw("InvalidArgumentException");
        }

        $.each(view, function prepare_views(name, content) {
          view[name] = $(content);
        });

        var filters = retrieve(scope);
        function before() {
          $.each(filters, function(i, filter) {
            filter.before(view);
          });

          return { after : after };
        }

        function after() {
          $.each(filters, function(i, filter) {
            filter.after(view);
          });

          return { before : before };
        }

        return {
          filters : filters, // TODO: see about removing this... it's currently only need for the specs.
          before  : before,
          after   : after
        };
      }
    },

    Filter : function Filter() {
      var scopes = arguments.length ? arguments : ['*'];
      var filter = {
        before : no_op,
        after  : no_op
      }

      $.each(scopes, function(i, scope) {
        store(scope, filter);
      });

      function before(fn) {
        filter.before = fn;
        return { after : after };
      }

      function after(fn) {
        filter.after = fn;
        return { before : before };
      }

      return {
        before : before,
        after  : after
      };
    }
  });

  // private...................................................................

  var __count__    = 0;
  var __database__ = {};

  function no_op() {}

  function store(scope, filter) {
    if('object' === typeof scope) {
      filter = scope;
      scope  = '*';
    }

    __database__[scope] = __database__[scope] || [];
    __database__[scope].push(filter);
    __count__ += 1;
  }

  function retrieve(scope) {
    if('*' === scope) {
      return __database__['*'] || [];
    }

    return $.merge($.merge([], __database__['*'] || []), __database__[scope] || []);
  }
})(jQuery);


text:
keyword = gets.chomp
puts keyword
f=open("test.txt")
counter = 0
f.each { |line|
  counter += 1
  puts line.chomp + ":" + counter.to_s if line =~ /#{keyword}/
}
f.close


text:
PaymentService paymentService = paymillContext.PaymentService;
Payment payment = paymentService.CreateWithTokenAndClientAsync(
    "12a46bcd462sd3r3care4e8336ssb4f5",
    "client_88a388d9dd48f86c3136"
).Result;


text:
<?php namespace VacStatus\Http\Requests;

use Illuminate\Validation\Validator;

use VacStatus\Http\Requests\Request;

class UserListRequest extends Request
{
	public function authorize()
	{
		return true;
	}

	public function rules()
	{
		return [
			'title' => 'required|max:15',
			'privacy' => 'required|numeric'
		];
	}

	protected function formatErrors(Validator $validator)
	{
	    return ['error' => $validator->errors()->all()[0]];
	}

}


text:
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Block, Col } from 'jsxstyle'
import EnvironmentHeader from './EnvironmentHeader'
import { Link, Switch, Route } from 'react-router-dom'
import ChevronLeft from 'react-icons/lib/md/chevron-left'
import { RED } from '../Theme'
import Example from './Example'
import API from './APISmall'
import Guide from './Guide'

const Animated = require('../animated/targets/react-dom')

const paths = {
  api: match => `${match.path}/api/:mod`,
  example: match => `${match.path}/example/:example`,
  guide: match => `${match.path}/guides/:mod/:header?`
}

class EnvironmentSmall extends Component {
  static propTypes = {
    data: PropTypes.object,
    match: PropTypes.object,
    location: PropTypes.object,
    history: PropTypes.object
  }

  state = {
    // 0 = parent is active
    // 1 = child is active
    anim: new Animated.Value(
      this.props.match.isExact ? 0 : 1
    ),
    animating: false
  }

  componentDidMount() {
    this.preloadExamples()
  }

  preloadExamples() {
    const { data } = this.props
    data.examples.forEach((example) => {
      // native doesn't have `load`
      if (example.load)
        example.load(() => {})
      // all have `loadSource`
      if (example.loadSource)
        example.loadSource(() => {})
    })
  }

  componentWillReceiveProps(nextProps) {
    const { anim } = this.state

    // only animate if we're going from here to direct child.
    // child to child we'll ignore
    const goingToChild = (
      nextProps.match.isExact === false &&
      this.props.match.isExact === true
    )

    const comingFromChild = (
      nextProps.match.isExact === true &&
      this.props.match.isExact === false
    )

    if (goingToChild || comingFromChild) {
      this.setState({
        animating: true
      }, () => {
        Animated.timing(anim, {
          toValue: goingToChild ? 1 : 0,
          duration: 350
        }).start(() => {
          this.setState({
            animating: false
          })
        })
      })
    }
  }

  render() {
    const { data, match, location } = this.props
    const { anim, animating } = this.state

    return (
      <Block
        position="absolute"
        left="0"
        right="0"
        bottom="0"
        top="0"
        overflow="hidden"
      >
        <Block position="relative" zIndex="1">
          <AnimatedHeaderBg anim={anim}>
            <AnimatedParentHeader anim={anim}>
              <EnvironmentHeader/>
            </AnimatedParentHeader>
            <AnimatedChildHeader
              anim={anim}
              atParent={match.isExact}
              animating={animating}
            >
              <Switch location={location}>
                <Route
                  path={paths.api(match)}
                  render={({ match: { params: { mod } } }) => (
                    {getApiTitle(data, mod)}
                  )}
                />
                <Route
                  path={paths.example(match)}
                  render={({ match: { params: { example }} }) => (
                    {getExampleTitle(data, example)}
                  )}
                />
                <Route
                  path={paths.guide(match)}
                  render={({ match: { params: { mod }} }) => (
                    {getGuideTitle(data, mod)}
                  )}
                />
              </Switch>
            </AnimatedChildHeader>
          </AnimatedHeaderBg>
        </Block>

        <AnimatedNav anim={anim}>

        </AnimatedNav>

        <AnimatedChild
          anim={anim}
          atParent={match.isExact}
          animating={animating}
        >
          <Page>
            <Switch location={location}>
              <Route
                path={paths.api(match)}
                render={(props) => (
                  <API {...props} data={data} location={location}/>
                )}
              />
              <Route
                path={paths.example(match)}
                render={(props) => (
                  <Example {...props} data={data}/>
                )}
              />
              <Route
                path={paths.guide(match)}
                render={(props) => (
                  <Guide {...props} data={data}/>
                )}
              />
            </Switch>
          </Page>
        </AnimatedChild>

      </Block>
    )
  }
}

class AnimatedHeaderBg extends Component {
  static propTypes = {
    anim: PropTypes.object,
    children: PropTypes.node
  }

  render() {
    const { anim, children } = this.props
    return (
      <Block
        position="absolute"
        top="0"
        left="0"
        right="0"
        fontSize="13px"
        background="linear-gradient(to bottom, rgba(221,221,221,1) 0%,rgba(221,221,221,1) 33%,rgba(221,221,221,0.9) 100%)"
        overflow="hidden"
      >
        <Animated.div style={{
          height: anim.interpolate({
            inputRange: [ 0, 1 ],
            outputRange: [ 150, 50 ]
          })
        }}>
          {children}
        </Animated.div>
      </Block>
    )
  }
}

class AnimatedParentHeader extends Component {
  static propTypes = {
    anim: PropTypes.object,
    children: PropTypes.node
  }

  render() {
    const { anim, children } = this.props
    return (
      <Animated.div children={children} style={{
        position: 'relative',
        top: anim.interpolate({
          inputRange: [ 0, 1 ],
          outputRange: [ 0, -50 ]
        }),
        opacity: anim.interpolate({
          inputRange: [ 0, 0.5 ],
          outputRange: [ 1, 0 ]
        })
      }}/>
    )
  }
}

class AnimatedNav extends Component {

  static propTypes = {
    children: PropTypes.node,
    anim: PropTypes.object
  }

  render() {
    const { anim, children } = this.props
    return (
      <Animated.div style={{
        position: 'absolute',
        top: 0,
        width: '100%',
        bottom: 0,
        background: 'white',
        left: anim.interpolate({
          inputRange: [ 0, 1 ],
          outputRange: [ '0%', '-25%' ]
        })
      }}>
        {children}
      </Animated.div>
    )
  }
}

class AnimatedChild extends Component {

  static propTypes = {
    children: PropTypes.node,
    anim: PropTypes.object,
    atParent: PropTypes.bool,
    animating: PropTypes.bool
  }

  state = {
    previousChildren: null
  }

  componentWillReceiveProps(nextProps) {
    const navigatingToParent = nextProps.atParent && !this.props.atParent
    const animationEnded = this.props.animating && !nextProps.animating

    if (navigatingToParent) {
      this.setState({
        previousChildren: this.props.children
      })
    } else if (animationEnded) {
      this.setState({
        previousChildren: null
      })
    }
  }

  render() {
    const { anim, children } = this.props
    const { previousChildren } = this.state
    return (
      <Animated.div style={{
        position: 'absolute',
        top: 0,
        width: '100%',
        bottom: 0,
        background: 'white',
        left: anim.interpolate({
          inputRange: [ 0, 1 ],
          outputRange: [ '100%', '0%' ]
        })
      }}>
        <Animated.div style={{
          position: 'absolute',
          top: 0,
          width: '80px',
          bottom: 0,
          background: 'linear-gradient(to left, rgba(0,0,0,0.20) 10%, rgba(255,255,255,0) 100%)',
          left: anim.interpolate({
            inputRange: [ 0, 1 ],
            outputRange: [ '0px', '-80px' ]
          })
        }}/>
        {previousChildren || children}
      </Animated.div>
    )
  }
}

class AnimatedChildHeader extends Component {

  static propTypes = {
    children: PropTypes.node,
    anim: PropTypes.object,
    atParent: PropTypes.bool,
    animating: PropTypes.bool
  }

  state = {
    previousChildren: null
  }

  componentWillReceiveProps(nextProps) {
    const navigatingToParent = nextProps.atParent && !this.props.atParent
    const animationEnded = this.props.animating && !nextProps.animating

    if (navigatingToParent) {
      this.setState({
        previousChildren: this.props.children
      })
    } else if (animationEnded) {
      this.setState({
        previousChildren: null
      })
    }
  }

  render() {
    const { anim, children } = this.props
    const { previousChildren } = this.state
    return (
      <Animated.div style={{
        position: 'absolute',
        left: 0,
        right: 0,
        top: anim.interpolate({
          inputRange: [ 0, 1 ],
          outputRange: [ 20, 0 ]
        }),
        opacity: anim.interpolate({
          inputRange: [ 0, 0.75 ],
          outputRange: [ 0, 1 ]
        })
      }}>
        {previousChildren || children}
      </Animated.div>
    )
  }
}

const getApiTitle = (data, slug) => {
  const item = data.api.find(item => item.title.slug === slug)
  return item ? item.title.text : null
}

const getExampleTitle = (data, slug) => {
  const item = data.examples.find(item => item.slug === slug)
  return item ? item.label : null
}

const getGuideTitle = (data, slug) => {
  const item = data.guides.find(item => item.title.slug === slug)
  return item ? item.title.text : null
}

class GoUp extends React.Component {
  static propTypes = {
    url: PropTypes.string
  }

  state = {
    justClicked: false
  }

  render() {
    const { url } = this.props
    const { justClicked } = this.state
    return (
      <Block
        component={Link}
        fontSize="45px"
        color={RED}
        opacity={justClicked ? '0.25' : '1'}
        lineHeight="0"
        className="no-tap-highlight"
        props={{
          to: url,
          onClick: () => this.setState({ justClicked: true })
        }}
        position="absolute"
        top="3px"
        left="-8px"
      >
        <ChevronLeft/>
      </Block>
    )
  }
}

const Header = ({ children, url, ...rest }) => (
  <Col
    justifyContent="center"
    fontSize="14px"
    width="100%"
    height="50px"
    textAlign="center"
    textTransform="uppercase"
    fontWeight="bold"
    position="relative"
    {...rest}
  >
    {children}
    <GoUp url={url}/>
  </Col>
)

Header.propTypes = {
  children: PropTypes.node,
  url: PropTypes.string
}

class Page extends Component {
  static childContextTypes = {
    scrollToDoc: PropTypes.string
  }

  getChildContext() {
    return {
      scrollToDoc: 'mobile-page'
    }
  }

  render() {
    return (
      <Block
        props={{ id: 'mobile-page' }}
        position="absolute"
        top="0"
        left="0"
        right="0"
        bottom="0"
        background="white"
        paddingTop="50px"
        overflow="auto"
        className="mobile-scroll"
        {...this.props}
      />
    )
  }
}

const Title = (props) => (
  <Block
    textTransform="uppercase"
    fontWeight="bold"
    color="#aaa"
    padding="10px"
    fontSize="13px"
    marginTop="20px"
    {...props}
  />
)

const NavLink = ({ to, ...props }) => (
  <Route path={to} children={({ match }) => (
    <Block
      component={Link}
      className="no-tap-highlight"
      props={{ to }}
      padding="10px"
      borderTop="solid 1px #eee"
      background={match ? '#eee' : ''}
      activeBackground="#eee"
      {...props}
    />
  )}/>
)

NavLink.propTypes = { to: PropTypes.string }

class Nav extends Component {
  static propTypes = {
    data: PropTypes.object,
    environment: PropTypes.string
  }

  render() {
    const { environment, data } = this.props
    return (
      <Block
        position="absolute"
        className="mobile-scroll"
        top="0"
        bottom="0"
        left="0"
        width="100%"
        overflow="scroll"
        paddingTop="150px"
      >
        {data.examples && (
          <Block>
            <Title>Examples</Title>
            <Block>
              {data.examples.map((item, i) => (
                <NavLink
                  key={i}
                  to={`/${environment}/example/${item.slug}`}
                  children={item.label}
                />
              ))}
            </Block>
          </Block>
        )}

        <Block>
          <Title>Guides</Title>
          {data.guides.map((item, i) => (
            <NavLink
              key={i}
              to={`/${environment}/guides/${item.title.slug}`}
              children={item.title.text}
            />
          ))}
        </Block>

        <Block>
          <Title>API</Title>
          {data.api.map((item, i) => (
            <Block key={i} marginBottom="10px" fontFamily="Menlo, monospace">
              <NavLink
                key={i}
                to={`/${environment}/api/${item.title.slug}`}
                children={item.title.text}
              />
              <Block paddingLeft="10px" fontSize="90%">
                {item.headers.map((header, i) => (
                  <NavLink
                    key={i}
                    to={`/${environment}/api/${item.title.slug}/${header.slug}`}
                    children={header.text}
                  />
                ))}
              </Block>
            </Block>
          ))}
        </Block>
      </Block>
    )
  }
}

export default EnvironmentSmall


text:
<?php

use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\RequestContext;

/**
 * appDevUrlMatcher.
 *
 * This class has been auto-generated
 * by the Symfony Routing Component.
 */
class appDevUrlMatcher extends Symfony\Bundle\FrameworkBundle\Routing\RedirectableUrlMatcher
{
    /**
     * Constructor.
     */
    public function __construct(RequestContext $context)
    {
        $this->context = $context;
    }

    public function match($pathinfo)
    {
        $allow = array();
        $pathinfo = rawurldecode($pathinfo);

        if (0 === strpos($pathinfo, '/_')) {
            // _wdt
            if (0 === strpos($pathinfo, '/_wdt') && preg_match('#^/_wdt/(?P<token>[^/]++)$#s', $pathinfo, $matches)) {
                return $this->mergeDefaults(array_replace($matches, array('_route' => '_wdt')), array (  '_controller' => 'web_profiler.controller.profiler:toolbarAction',));
            }

            if (0 === strpos($pathinfo, '/_profiler')) {
                // _profiler_home
                if (rtrim($pathinfo, '/') === '/_profiler') {
                    if (substr($pathinfo, -1) !== '/') {
                        return $this->redirect($pathinfo.'/', '_profiler_home');
                    }

                    return array (  '_controller' => 'web_profiler.controller.profiler:homeAction',  '_route' => '_profiler_home',);
                }

                if (0 === strpos($pathinfo, '/_profiler/search')) {
                    // _profiler_search
                    if ($pathinfo === '/_profiler/search') {
                        return array (  '_controller' => 'web_profiler.controller.profiler:searchAction',  '_route' => '_profiler_search',);
                    }

                    // _profiler_search_bar
                    if ($pathinfo === '/_profiler/search_bar') {
                        return array (  '_controller' => 'web_profiler.controller.profiler:searchBarAction',  '_route' => '_profiler_search_bar',);
                    }

                }

                // _profiler_purge
                if ($pathinfo === '/_profiler/purge') {
                    return array (  '_controller' => 'web_profiler.controller.profiler:purgeAction',  '_route' => '_profiler_purge',);
                }

                // _profiler_info
                if (0 === strpos($pathinfo, '/_profiler/info') && preg_match('#^/_profiler/info/(?P<about>[^/]++)$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_info')), array (  '_controller' => 'web_profiler.controller.profiler:infoAction',));
                }

                // _profiler_phpinfo
                if ($pathinfo === '/_profiler/phpinfo') {
                    return array (  '_controller' => 'web_profiler.controller.profiler:phpinfoAction',  '_route' => '_profiler_phpinfo',);
                }

                // _profiler_search_results
                if (preg_match('#^/_profiler/(?P<token>[^/]++)/search/results$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_search_results')), array (  '_controller' => 'web_profiler.controller.profiler:searchResultsAction',));
                }

                // _profiler
                if (preg_match('#^/_profiler/(?P<token>[^/]++)$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler')), array (  '_controller' => 'web_profiler.controller.profiler:panelAction',));
                }

                // _profiler_router
                if (preg_match('#^/_profiler/(?P<token>[^/]++)/router$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_router')), array (  '_controller' => 'web_profiler.controller.router:panelAction',));
                }

                // _profiler_exception
                if (preg_match('#^/_profiler/(?P<token>[^/]++)/exception$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_exception')), array (  '_controller' => 'web_profiler.controller.exception:showAction',));
                }

                // _profiler_exception_css
                if (preg_match('#^/_profiler/(?P<token>[^/]++)/exception\\.css$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_profiler_exception_css')), array (  '_controller' => 'web_profiler.controller.exception:cssAction',));
                }

            }

            if (0 === strpos($pathinfo, '/_configurator')) {
                // _configurator_home
                if (rtrim($pathinfo, '/') === '/_configurator') {
                    if (substr($pathinfo, -1) !== '/') {
                        return $this->redirect($pathinfo.'/', '_configurator_home');
                    }

                    return array (  '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::checkAction',  '_route' => '_configurator_home',);
                }

                // _configurator_step
                if (0 === strpos($pathinfo, '/_configurator/step') && preg_match('#^/_configurator/step/(?P<index>[^/]++)$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => '_configurator_step')), array (  '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::stepAction',));
                }

                // _configurator_final
                if ($pathinfo === '/_configurator/final') {
                    return array (  '_controller' => 'Sensio\\Bundle\\DistributionBundle\\Controller\\ConfiguratorController::finalAction',  '_route' => '_configurator_final',);
                }

            }

        }

        // _portada
        if (rtrim($pathinfo, '/') === '') {
            if (substr($pathinfo, -1) !== '/') {
                return $this->redirect($pathinfo.'/', '_portada');
            }

            return array (  '_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirectAction',  'route' => 'portada',  'ciudad' => 'barcelona',  '_route' => '_portada',);
        }

        // portada
        if (preg_match('#^/(?P<ciudad>[^/]++)$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'portada')), array (  '_controller' => 'Cupon\\OfertaBundle\\Controller\\DefaultController::portadaAction',));
        }

        if (0 === strpos($pathinfo, '/usuario')) {
            // usuario_homepage
            if (0 === strpos($pathinfo, '/usuario/hello') && preg_match('#^/usuario/hello/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
                return $this->mergeDefaults(array_replace($matches, array('_route' => 'usuario_homepage')), array (  '_controller' => 'Cupon\\UsuarioBundle\\Controller\\DefaultController::indexAction',));
            }

            // usuario_compras
            if ($pathinfo === '/usuario/compras') {
                return array (  '_controller' => 'Cupon\\UsuarioBundle\\Controller\\DefaultController::comprasAction',  '_route' => 'usuario_compras',);
            }

            if (0 === strpos($pathinfo, '/usuario/log')) {
                if (0 === strpos($pathinfo, '/usuario/login')) {
                    // usuario_login
                    if ($pathinfo === '/usuario/login') {
                        return array (  '_controller' => 'Cupon\\UsuarioBundle\\Controller\\DefaultController::loginAction',  '_route' => 'usuario_login',);
                    }

                    // usuario_login_check
                    if ($pathinfo === '/usuario/login_check') {
                        return array('_route' => 'usuario_login_check');
                    }

                }

                // usuario_logout
                if ($pathinfo === '/usuario/logout') {
                    return array('_route' => 'usuario_logout');
                }

            }

            // usuario_registro
            if ($pathinfo === '/usuario/registro') {
                return array (  '_controller' => 'Cupon\\UsuarioBundle\\Controller\\DefaultController::registroAction',  '_route' => 'usuario_registro',);
            }

            // usuario_perfil
            if ($pathinfo === '/usuario/perfil') {
                return array (  '_controller' => 'Cupon\\UsuarioBundle\\Controller\\DefaultController::perfilAction',  '_route' => 'usuario_perfil',);
            }

        }

        // tienda_homepage
        if (0 === strpos($pathinfo, '/hello') && preg_match('#^/hello/(?P<name>[^/]++)$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'tienda_homepage')), array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\DefaultController::indexAction',));
        }

        if (0 === strpos($pathinfo, '/extranet')) {
            if (0 === strpos($pathinfo, '/extranet/log')) {
                if (0 === strpos($pathinfo, '/extranet/login')) {
                    // extranet_login
                    if ($pathinfo === '/extranet/login') {
                        return array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::loginAction',  '_route' => 'extranet_login',);
                    }

                    // extranet_login_check
                    if ($pathinfo === '/extranet/login_check') {
                        return array('_route' => 'extranet_login_check');
                    }

                }

                // extranet_logout
                if ($pathinfo === '/extranet/logout') {
                    return array('_route' => 'extranet_logout');
                }

            }

            // extranet_portada
            if (rtrim($pathinfo, '/') === '/extranet') {
                if (substr($pathinfo, -1) !== '/') {
                    return $this->redirect($pathinfo.'/', 'extranet_portada');
                }

                return array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::portadaAction',  '_route' => 'extranet_portada',);
            }

            if (0 === strpos($pathinfo, '/extranet/oferta')) {
                // extranet_oferta_nueva
                if ($pathinfo === '/extranet/oferta/nueva') {
                    return array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::ofertaNuevaAction',  '_route' => 'extranet_oferta_nueva',);
                }

                // extranet_oferta_editar
                if (0 === strpos($pathinfo, '/extranet/oferta/editar') && preg_match('#^/extranet/oferta/editar/(?P<id>[^/]++)$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => 'extranet_oferta_editar')), array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::ofertaEditarAction',));
                }

                // extranet_oferta_ventas
                if (0 === strpos($pathinfo, '/extranet/oferta/ventas') && preg_match('#^/extranet/oferta/ventas/(?P<id>[^/]++)$#s', $pathinfo, $matches)) {
                    return $this->mergeDefaults(array_replace($matches, array('_route' => 'extranet_oferta_ventas')), array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::ofertaVentasAction',));
                }

            }

            // extranet_perfil
            if ($pathinfo === '/extranet/perfil') {
                return array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\ExtranetController::perfilAction',  '_route' => 'extranet_perfil',);
            }

        }

        // pagina_ayuda
        if (rtrim($pathinfo, '/') === '/ayuda') {
            if (substr($pathinfo, -1) !== '/') {
                return $this->redirect($pathinfo.'/', 'pagina_ayuda');
            }

            return array (  '_controller' => 'Cupon\\OfertaBundle\\Controller\\DefaultController::ayudaAction',  '_route' => 'pagina_ayuda',);
        }

        // pagina_estatica
        if (0 === strpos($pathinfo, '/post') && preg_match('#^/post/(?P<pagina>[^/]++)/?$#s', $pathinfo, $matches)) {
            if (substr($pathinfo, -1) !== '/') {
                return $this->redirect($pathinfo.'/', 'pagina_estatica');
            }

            return $this->mergeDefaults(array_replace($matches, array('_route' => 'pagina_estatica')), array (  '_controller' => 'Cupon\\OfertaBundle\\Controller\\PostController::verPaginaAction',));
        }

        // ciudad_cambiar
        if (0 === strpos($pathinfo, '/ciudad/cambiar-a') && preg_match('#^/ciudad/cambiar\\-a\\-(?P<ciudad>.+)$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'ciudad_cambiar')), array (  '_controller' => 'Cupon\\CiudadBundle\\Controller\\DefaultController::cambiarAction',));
        }

        // oferta
        if (preg_match('#^/(?P<ciudad>[^/]++)/ofertas/(?P<slug>[^/]++)$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'oferta')), array (  '_controller' => 'Cupon\\OfertaBundle\\Controller\\DefaultController::ofertaAction',));
        }

        // ciudad_recientes
        if (preg_match('#^/(?P<ciudad>[^/]++)/recientes$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'ciudad_recientes')), array (  '_controller' => 'Cupon\\CiudadBundle\\Controller\\DefaultController::recientesAction',));
        }

        // tienda_portada
        if (preg_match('#^/(?P<ciudad>[^/]++)/tiendas/(?P<tienda>[^/]++)$#s', $pathinfo, $matches)) {
            return $this->mergeDefaults(array_replace($matches, array('_route' => 'tienda_portada')), array (  '_controller' => 'Cupon\\TiendaBundle\\Controller\\DefaultController::portadaAction',));
        }

        throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
    }
}


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Annuaire Conserv. Jard. Bot. Genève 2:65. 1898

#### Original name
null

### Remarks
null


text:
using OfficeOlympicsLib.Services.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OfficeOlympicsLib.Models;

namespace OfficeOlympicsLib.Services
{
    public class EventTypeService : IEventTypeService
    {
        public IEnumerable<EventType> GetEventTypes()
        {
            using (var context = new OfficeOlympicsDbEntities())
            {
                return context.EventTypes.ToList();
            }
        }
    }
}


text:
#include "includes.h"

DWORD
VmDirQuerySecurityDescriptorInfo(
    SECURITY_INFORMATION SecurityInformationNeeded,
    PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptorInput,
    PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptorOutput,
    PULONG Length
    )
{
    return LwNtStatusToWin32Error(
            RtlQuerySecurityDescriptorInfo(SecurityInformationNeeded,
                                           SecurityDescriptorOutput,
                                           Length,
                                           SecurityDescriptorInput));
}

DWORD
VmDirSelfRelativeToAbsoluteSD(
    PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
    PSECURITY_DESCRIPTOR_ABSOLUTE AbsoluteSecurityDescriptor,
    PULONG AbsoluteSecurityDescriptorSize,
    PACL pDacl,
    PULONG pDaclSize,
    PACL pSacl,
    PULONG pSaclSize,
    PSID Owner,
    PULONG pOwnerSize,
    PSID PrimaryGroup,
    PULONG pPrimaryGroupSize
    )
{
    return LwNtStatusToWin32Error(
            RtlSelfRelativeToAbsoluteSD(SelfRelativeSecurityDescriptor,
                                        AbsoluteSecurityDescriptor,
                                        AbsoluteSecurityDescriptorSize,
                                        pDacl,
                                        pDaclSize,
                                        pSacl,
                                        pSaclSize,
                                        Owner,
                                        pOwnerSize,
                                        PrimaryGroup,
                                        pPrimaryGroupSize));
}

BOOLEAN
VmDirAccessCheck(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PACCESS_TOKEN AccessToken,
    ACCESS_MASK DesiredAccess,
    ACCESS_MASK PreviouslyGrantedAccess,
    PGENERIC_MAPPING GenericMapping,
    PACCESS_MASK GrantedAccess,
    PDWORD pAccessError
    )
{
    BOOLEAN bRet = FALSE;
    NTSTATUS ntStatus = STATUS_SUCCESS;

    bRet = RtlAccessCheck(SecurityDescriptor,
                          AccessToken,
                          DesiredAccess,
                          PreviouslyGrantedAccess,
                          GenericMapping,
                          GrantedAccess,
                          &ntStatus);

    *pAccessError = LwNtStatusToWin32Error(ntStatus);

    return bRet;
}

DWORD
VmDirGetOwnerSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PSID* Owner,
    PBOOLEAN pIsOwnerDefaulted
    )
{
    return LwNtStatusToWin32Error(
            RtlGetOwnerSecurityDescriptor(SecurityDescriptor,
                                          Owner,
                                          pIsOwnerDefaulted));
}

DWORD
VmDirGetGroupSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PSID* Group,
    PBOOLEAN pIsGroupDefaulted
    )
{
    return LwNtStatusToWin32Error(
            RtlGetGroupSecurityDescriptor(SecurityDescriptor,
                                          Group,
                                          pIsGroupDefaulted));
}

DWORD
VmDirGetDaclSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PBOOLEAN pIsDaclPresent,
    PACL* Dacl,
    PBOOLEAN pIsDaclDefaulted
    )
{
    return LwNtStatusToWin32Error(
            RtlGetDaclSecurityDescriptor(SecurityDescriptor,
                                         pIsDaclPresent,
                                         Dacl,
                                         pIsDaclDefaulted));
}

DWORD
VmDirGetSaclSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PBOOLEAN pIsSaclPresent,
    PACL* Sacl,
    PBOOLEAN pIsSaclDefaulted
    )
{
    return LwNtStatusToWin32Error(
            RtlGetSaclSecurityDescriptor(SecurityDescriptor,
                                         pIsSaclPresent,
                                         Sacl,
                                         pIsSaclDefaulted));
}

BOOLEAN
VmDirValidRelativeSecurityDescriptor(
    PSECURITY_DESCRIPTOR_RELATIVE SecurityDescriptor,
    ULONG SecurityDescriptorLength,
    SECURITY_INFORMATION RequiredInformation
    )
{
    return RtlValidRelativeSecurityDescriptor(SecurityDescriptor,
                                              SecurityDescriptorLength,
                                              RequiredInformation);
}

DWORD
VmDirSetSecurityDescriptorInfo(
    SECURITY_INFORMATION SecurityInformation,
    PSECURITY_DESCRIPTOR_RELATIVE InputSecurityDescriptor,
    PSECURITY_DESCRIPTOR_RELATIVE ObjectSecurityDescriptor,
    PSECURITY_DESCRIPTOR_RELATIVE NewObjectSecurityDescriptor,
    PULONG NewObjectSecurityDescriptorLength,
    PGENERIC_MAPPING GenericMapping
    )
{
    return LwNtStatusToWin32Error(RtlSetSecurityDescriptorInfo(SecurityInformation,
                                        InputSecurityDescriptor,
                                        ObjectSecurityDescriptor,
                                        NewObjectSecurityDescriptor,
                                        NewObjectSecurityDescriptorLength,
                                        GenericMapping));
}

DWORD
VmDirCreateSecurityDescriptorAbsolute(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    ULONG Revision
    )
{
    return LwNtStatusToWin32Error(
            RtlCreateSecurityDescriptorAbsolute(SecurityDescriptor, Revision));
}

VOID
VmDirReleaseAccessToken(
    PACCESS_TOKEN* AccessToken
    )
{
    RtlReleaseAccessToken(AccessToken);
}

DWORD
VmDirSetOwnerSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PSID Owner,
    BOOLEAN IsOwnerDefaulted
    )
{
    return LwNtStatusToWin32Error(
             RtlSetOwnerSecurityDescriptor(
                                SecurityDescriptor,
                                Owner,
                                IsOwnerDefaulted));
}

DWORD
VmDirSetGroupSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    PSID Group,
    BOOLEAN IsGroupDefaulted
    )
{
    return LwNtStatusToWin32Error(
             RtlSetGroupSecurityDescriptor(SecurityDescriptor, Group, IsGroupDefaulted));
}

ULONG
VmDirLengthSid(
    PSID Sid
    )
{
    return RtlLengthSid(Sid);
}

DWORD
VmDirCreateAcl(
    PACL Acl,
    ULONG AclLength,
    ULONG AclRevision
    )
{
    return LwNtStatusToWin32Error(RtlCreateAcl(Acl, AclLength, AclRevision));
}

DWORD
VmDirAddAccessAllowedAceEx(
    PACL Acl,
    ULONG AceRevision,
    ULONG AceFlags,
    ACCESS_MASK AccessMask,
    PSID Sid
    )
{
    return LwNtStatusToWin32Error(RtlAddAccessAllowedAceEx(Acl,
                                                           AceRevision,
                                                           AceFlags,
                                                           AccessMask,
                                                           Sid));
}

DWORD
VmDirSetDaclSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor,
    BOOLEAN IsDaclPresent,
    PACL Dacl,
    BOOLEAN IsDaclDefaulted
    )
{
    return LwNtStatusToWin32Error(
    RtlSetDaclSecurityDescriptor(SecurityDescriptor,
                                 IsDaclPresent,
                                 Dacl,
                                 IsDaclDefaulted));
}

BOOLEAN
VmDirValidSecurityDescriptor(
    PSECURITY_DESCRIPTOR_ABSOLUTE SecurityDescriptor
    )
{
    return RtlValidSecurityDescriptor(SecurityDescriptor);
}

DWORD
VmDirAbsoluteToSelfRelativeSD(
    PSECURITY_DESCRIPTOR_ABSOLUTE AbsoluteSecurityDescriptor,
    PSECURITY_DESCRIPTOR_RELATIVE SelfRelativeSecurityDescriptor,
    PULONG BufferLength
    )
{
    return LwNtStatusToWin32Error(RtlAbsoluteToSelfRelativeSD(
                                  AbsoluteSecurityDescriptor,
                                  SelfRelativeSecurityDescriptor,
                                  BufferLength));
}

DWORD VmDirCreateWellKnownSid(
    WELL_KNOWN_SID_TYPE wellKnownSidType,
    PSID pDomainSid,
    PSID pSid,
    DWORD* pcbSid
)
{
    DWORD dwError = ERROR_SUCCESS;

    dwError = LwNtStatusToWin32Error(
                    RtlCreateWellKnownSid(
                        wellKnownSidType,
                        pDomainSid,
                        pSid,
                        pcbSid));
    BAIL_ON_VMDIR_ERROR(dwError);

error:

    return dwError;
}

VOID
VmDirMapGenericMask(
    PDWORD pdwAccessMask,
    PGENERIC_MAPPING pGenericMapping
)
{
    RtlMapGenericMask(pdwAccessMask, pGenericMapping);
}

DWORD
VmDirQueryAccessTokenInformation(
    HANDLE hTokenHandle,
    TOKEN_INFORMATION_CLASS tokenInformationClass,
    PVOID pTokenInformation,
    DWORD dwTokenInformationLength,
    PDWORD pdwReturnLength
)
{
    DWORD dwError = ERROR_SUCCESS;

    dwError = LwNtStatusToWin32Error(
                       RtlQueryAccessTokenInformation(
                               hTokenHandle,
                               tokenInformationClass,
                               pTokenInformation,
                               dwTokenInformationLength,
                               pdwReturnLength));
    BAIL_ON_VMDIR_ERROR(dwError);

error:

    return dwError;
}

DWORD
VmDirAllocateSddlCStringFromSecurityDescriptor(
    PSECURITY_DESCRIPTOR_RELATIVE pSecurityDescriptor,
    DWORD dwRequestedStringSDRevision,
    SECURITY_INFORMATION securityInformation,
    PSTR* ppStringSecurityDescriptor
)
{
    DWORD dwError = ERROR_SUCCESS;

    dwError = LwNtStatusToWin32Error(
                      RtlAllocateSddlCStringFromSecurityDescriptor(
                              ppStringSecurityDescriptor,
                              pSecurityDescriptor,
                              dwRequestedStringSDRevision,
                              securityInformation));
   BAIL_ON_VMDIR_ERROR(dwError);

error:

    return dwError;
}


text:
layout: page
title: Link
subtitle: 不念过去,不畏未来
---
友情链接:

javascript秘密花园

淘宝UED

腾讯大讲堂

新浪公开课

HTML5/CSS3

JSON格式化

新浪UED

w3cfuns

阿里巴巴

携程UED

网易UED

雷锋网

HTML5研究小组

jQuery API

FISING’S BLOG

李磊博客

逸航网

Evoup’s Blog


text:
.LdsEdit-layerButton {
  display: none;
  position: absolute;
}
.LdsEdit-layer {
  position: absolute;
  display: none;
  background: #fff;
  width: 500px;
  max-width: 100%;
  right: 0;
  paddig: 20px;
  border: 3px solid #000;
}


text:
using System;
using SwitchAppDesign.AniListAPI.v2.Types;
using System.Collections.Generic;
using System.Linq;
using SwitchAppDesign.AniListAPI.v2.Common;
using SwitchAppDesign.AniListAPI.v2.Graph.Arguments;
using SwitchAppDesign.AniListAPI.v2.Graph.Common;
using SwitchAppDesign.AniListAPI.v2.Graph.Types;
using SwitchAppDesign.AniListAPI.v2.Utility;

namespace SwitchAppDesign.AniListAPI.v2.Graph.Fields
{

    /// <summary>
    /// All available media edge query fields.
    /// </summary>
	public class MediaEdgeQueryFields
	{
	    private readonly List<AniListQueryType> _allowedQueryTypes;
	    private readonly AniListQueryType _queryType;

        internal MediaEdgeQueryFields(AniListQueryType queryType)
        {
            _queryType = queryType;
            _allowedQueryTypes = new List<AniListQueryType> {AniListQueryType.Media, AniListQueryType.Page};
        }

        /// <summary>
        /// <param name="fields">The list of media query fields (found in <see cref="MediaQueryFields"/>) to be used in the graph query (at least of media query field is required).</param>
        /// </summary>
        public GraphQueryField NodeQueryField(IList<GraphQueryField> fields)
		{
		    var field = new GraphQueryField("node", GetType(), _queryType, InitilizeDefaultFieldRules(), typeof(MediaQueryFields)).GetGraphFieldAndSetFieldArguments(fields);

            FieldAndArgumentHelper.ValidateQueryFields(field, fields, typeof(MediaQueryFields));

		    return field;
        }

		/// <summary>
		/// The id of the connection
		/// </summary>
		public GraphQueryField IdQueryField()
		{
		    return new GraphQueryField("id", GetType(), _queryType, InitilizeDefaultFieldRules());

        }

		/// <summary>
		/// The type of relation to the parent model
		/// </summary>
		public GraphQueryField RelationTypeQueryField()
		{
		    return new GraphQueryField("relationType", GetType(), _queryType, InitilizeDefaultFieldRules());

        }

		/// <summary>
		/// If the studio is the main animation studio of the media (For Studio->MediaConnection field only)
		/// </summary>
		public GraphQueryField IsMainStudioQueryField()
		{
		    return new GraphQueryField("isMainStudio", GetType(), _queryType, InitilizeDefaultFieldRules());

        }

        /// <summary>
        /// The characters in the media voiced by the parent actor
        /// </summary>
        public GraphQueryField CharactersQueryField(IList<GraphQueryField> fields)
		{
		    var field = new GraphQueryField("characters", GetType(), _queryType, InitilizeDefaultFieldRules(), typeof(CharacterQueryFields)).GetGraphFieldAndSetFieldArguments(fields);

            FieldAndArgumentHelper.ValidateQueryFields(field, fields, typeof(CharacterQueryFields));

		    return field;
        }

		/// <summary>
		/// The characters role in the media
		/// </summary>
		public GraphQueryField CharacterRoleQueryField()
		{
		    return new GraphQueryField("characterRole", GetType(), _queryType, InitilizeDefaultFieldRules());

        }

		/// <summary>
		/// The role of the staff member in the production of the media
		/// </summary>
		public GraphQueryField StaffRoleQueryField()
		{
		    return new GraphQueryField("staffRole", GetType(), _queryType, InitilizeDefaultFieldRules());

        }

        /// <summary>
        /// The voice actors of the character
        /// </summary>
        public GraphQueryField VoiceActorsQueryField(IList<GraphQueryField> fields, IList<object> arguments = null)
		{
		    var field = new GraphQueryField("voiceActors", GetType(), _queryType, InitilizeDefaultFieldRules(), typeof(StaffQueryFields)).GetGraphFieldAndSetFieldArguments(fields, arguments);

            FieldAndArgumentHelper.ValidateQueryFieldsAndArguments(field, fields, arguments, typeof(StaffQueryFields), typeof(StaffQueryArguments));

		    return field;
        }

		/// <summary>
		/// The order the media should be displayed from the users favourites
		/// </summary>
		public GraphQueryField FavouriteOrderQueryField()
		{
		    return new GraphQueryField("favouriteOrder", GetType(), _queryType, InitilizeDefaultFieldRules());
        }

        private FieldRules InitilizeDefaultFieldRules(bool authenticationRequired = false)
	    {
	        return new FieldRules(authenticationRequired, _allowedQueryTypes);
	    }
    }
}