text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_schedule"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/myColorOneBody"
    tools:context=".ui.SetScheduleActivity">

    <include
        android:id="@+id/toolbar_liveSchedule"
        layout="@layout/tool_bar_live_schedule" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/toolbar_schedule"
        android:gravity="center"
        android:orientation="vertical">

        <com.vumobile.utils.MyTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Set Schedule Time"
            android:textColor="#fff"
            android:textSize="25sp"
            android:visibility="gone" />

        <EditText
            android:id="@+id/etDateLive"
            android:layout_width="150dp"
            android:layout_height="50dp"
            android:background="#fff"
            android:clickable="true"
            android:drawableLeft="@drawable/ic_calendar"
            android:focusable="false"
            android:gravity="center"
            android:hint="Set Date"
            android:inputType="date"
            android:padding="2dp" />

        <EditText
            android:id="@+id/etTimeLive"
            android:layout_width="150dp"
            android:layout_height="50dp"
            android:layout_marginTop="5dp"
            android:background="#fff"
            android:clickable="true"
            android:drawableLeft="@drawable/ic_clock"
            android:focusable="false"
            android:gravity="center"
            android:hint="Set Time"
            android:inputType="time"
            android:padding="2dp" />

        <Button
            android:id="@+id/btnConfirmTimeLive"
            android:layout_width="150dp"
            android:layout_height="50dp"
            android:layout_margin="12dp"
            android:background="@drawable/confirm" />

    </LinearLayout>

</RelativeLayout>


text:
import PropTypes from 'prop-types';
import React from 'react';
import isEqual from 'lodash.isequal';
import getDerivedStateFromProps from './state/getDerivedStateFromProps';
import { getNextSortState } from './state/sorting';
import { getCellId } from './tools/cells';
import denormalize from './tools/denormalize';
import { composeEventHandlers } from '../../tools/events';
import { defaultFilterRows } from './tools/filter';
import { defaultSortRow } from './tools/sorting';
import setupGetInstanceId from './tools/instanceId';

const getInstanceId = setupGetInstanceId();

const translationKeys = {
  expandRow: 'carbon.table.row.expand',
  collapseRow: 'carbon.table.row.collapse',
  expandAll: 'carbon.table.all.expand',
  collapseAll: 'carbon.table.all.collapse',
  selectAll: 'carbon.table.all.select',
  unselectAll: 'carbon.table.all.unselect',
  selectRow: 'carbon.table.row.select',
  unselectRow: 'carbon.table.row.unselect',
};

const defaultTranslations = {
  [translationKeys.expandAll]: 'Expand all rows',
  [translationKeys.collapseAll]: 'Collapse all rows',
  [translationKeys.expandRow]: 'Expand current row',
  [translationKeys.collapseRow]: 'Collapse current row',
  [translationKeys.selectAll]: 'Select all rows',
  [translationKeys.unselectAll]: 'Unselect all rows',
  [translationKeys.selectRow]: 'Select row',
  [translationKeys.unselectRow]: 'Unselect row',
};

const translateWithId = (id) => defaultTranslations[id];

/**
 * Data Tables are used to represent a collection of resources, displaying a
 * subset of their fields in columns, or headers. We prioritize direct updates
 * to the state of what we're rendering, so internally we end up normalizing the
 * given data and then denormalizing it when rendering.
 *
 * As a result, each part of the DataTable is accessible through look-up by id,
 * and updating the state of the single entity will cascade updates to the
 * consumer.
 */
export default class DataTable extends React.Component {
  static propTypes = {
    /**
     * Optional hook to manually control filtering of the rows from the
     * TableToolbarSearch component
     */
    filterRows: PropTypes.func,

    /**
     * The `headers` prop represents the order in which the headers should
     * appear in the table. We expect an array of objects to be passed in, where
     * `key` is the name of the key in a row object, and `header` is the name of
     * the header.
     */
    headers: PropTypes.arrayOf(
      PropTypes.shape({
        key: PropTypes.string.isRequired,
        header: PropTypes.node.isRequired,
      })
    ).isRequired,

    /**
     * Specify whether the table should be able to be sorted by its headers
     */
    isSortable: PropTypes.bool,

    /**
     * Provide a string for the current locale
     */
    locale: PropTypes.string,

    /**
     * Specify whether the overflow menu (if it exists) should be shown always, or only on hover
     */
    overflowMenuOnHover: PropTypes.bool,

    /**
     * Specify whether the control should be a radio button or inline checkbox
     */
    radio: PropTypes.bool,

    /**
     * The `rows` prop is where you provide us with a list of all the rows that
     * you want to render in the table. The only hard requirement is that this
     * is an array of objects, and that each object has a unique `id` field
     * available on it.
     */
    rows: PropTypes.arrayOf(
      PropTypes.shape({
        id: PropTypes.string.isRequired,
        disabled: PropTypes.bool,
        isSelected: PropTypes.bool,
        isExpanded: PropTypes.bool,
      })
    ).isRequired,

    /**
     * `false` If true, will remove the table border
     */
    shouldShowBorder: PropTypes.bool,

    /**
     *  Change the row height of table. Currently supports `xs`, `sm`, `md`, `lg`, and `xl`.
     *  The previous terms (`compact`, `short`, `normal`, and `tall`) will be removed in the next major release.
     */
    size: PropTypes.oneOf([
      'compact',
      'short',
      'normal',
      'tall',
      'xs',
      'sm',
      'md',
      'lg',
      'xl',
    ]),

    /**
     * Optional hook to manually control sorting of the rows.
     */
    sortRow: PropTypes.func,

    /**
     * Specify whether the header should be sticky.
     * Still experimental: may not work with every combination of table props
     */
    stickyHeader: PropTypes.bool,

    /**
     * Optional method that takes in a message id and returns an
     * internationalized string. See `DataTable.translationKeys` for all
     * available message ids.
     */
    translateWithId: PropTypes.func,

    /**
     * `false` If true, will use a width of 'auto' instead of 100%
     */
    useStaticWidth: PropTypes.bool,

    /**
     * `true` to add useZebraStyles striping.
     */
    useZebraStyles: PropTypes.bool,
  };

  static defaultProps = {
    sortRow: defaultSortRow,
    filterRows: defaultFilterRows,
    locale: 'en',
    size: 'normal',
    overflowMenuOnHover: true,
    translateWithId,
  };

  static translationKeys = Object.values(translationKeys);

  constructor(props) {
    super(props);
    this.state = {
      ...getDerivedStateFromProps(props, {}),
      isExpandedAll: false, // Start with collapsed state, treat `undefined` as neutral state
    };
    this.instanceId = getInstanceId();
  }

  componentDidUpdate(prevProps) {
    if (prevProps === this.props) {
      return;
    }

    const prevRowIds = prevProps.rows.map((row) => row.id);
    const rowIds = this.props.rows.map((row) => row.id);

    if (!isEqual(prevRowIds, rowIds)) {
      this.setState((state) => getDerivedStateFromProps(this.props, state));
      return;
    }

    const prevHeaders = prevProps.headers.map((header) => header.key);
    const headers = this.props.headers.map((header) => header.key);

    if (!isEqual(prevHeaders, headers)) {
      this.setState((state) => getDerivedStateFromProps(this.props, state));
      return;
    }

    if (!isEqual(prevProps.rows, this.props.rows)) {
      this.setState((state) => getDerivedStateFromProps(this.props, state));
      return;
    }
  }

  /**
   * Get the props associated with the given header. Mostly used for adding in
   * sorting behavior.
   *
   * @param {object} config
   * @param {string} config.header the header we want the props for
   * @param {Function} config.onClick a custom click handler for the header
   * @param {boolean} config.isSortable
   * @returns {object}
   */
  getHeaderProps = ({
    header,
    onClick,
    isSortable = this.props.isSortable,
    ...rest
  }) => {
    const { sortDirection, sortHeaderKey } = this.state;
    return {
      ...rest,
      key: header.key,
      sortDirection,
      isSortable,
      isSortHeader: sortHeaderKey === header.key,
      onClick: (event) => {
        const nextSortState = getNextSortState(this.props, this.state, {
          key: header.key,
        });
        this.setState(nextSortState, () => {
          onClick &&
            this.handleOnHeaderClick(onClick, {
              sortHeaderKey: header.key,
              sortDirection: nextSortState.sortDirection,
            })(event);
        });
      },
    };
  };

  /**
   * Get the props associated with the given expand header.
   *
   * @param {object} config
   * @param {Function} config.onClick a custom click handler for the expand header
   * @returns {object}
   */
  getExpandHeaderProps = ({ onClick, ...rest } = {}) => {
    const { translateWithId: t } = this.props;
    const { isExpandedAll, rowIds, rowsById } = this.state;
    const isExpanded =
      isExpandedAll || rowIds.every((id) => rowsById[id].isExpanded);
    const translationKey = !isExpanded
      ? translationKeys.collapseAll
      : translationKeys.expandAll;
    return {
      ...rest,
      ariaLabel: t(translationKey),
      isExpanded,
      // Compose the event handlers so we don't overwrite a consumer's `onClick`
      // handler
      onExpand: composeEventHandlers([
        this.handleOnExpandAll,
        onClick
          ? this.handleOnExpandHeaderClick(onClick, {
              isExpanded,
            })
          : null,
      ]),
    };
  };

  /**
   * Decorate consumer's `onClick` event handler with sort parameters
   *
   * @param {Function} onClick
   * @param {object} sortParams
   * @returns {Function}
   */
  handleOnHeaderClick = (onClick, sortParams) => {
    return (e) => onClick(e, sortParams);
  };

  /**
   * Decorate consumer's `onClick` event handler with sort parameters
   *
   * @param {Function} onClick
   * @param {object} expandParams
   * @returns {Function}
   */
  handleOnExpandHeaderClick = (onClick, expandParams) => {
    return (e) => onClick(e, expandParams);
  };

  /**
   * Get the props associated with the given row. Mostly used for expansion.
   *
   * @param {object} config
   * @param {object} config.row the row we want the props for
   * @param {Function} config.onClick a custom click handler for the header
   * @returns {object}
   */
  getRowProps = ({ row, onClick, ...rest }) => {
    const { translateWithId: t } = this.props;
    const translationKey = row.isExpanded
      ? translationKeys.collapseRow
      : translationKeys.expandRow;
    return {
      ...rest,
      key: row.id,
      // Compose the event handlers so we don't overwrite a consumer's `onClick`
      // handler
      onExpand: composeEventHandlers([this.handleOnExpandRow(row.id), onClick]),
      isExpanded: row.isExpanded,
      ariaLabel: t(translationKey),
      isSelected: row.isSelected,
      disabled: row.disabled,
    };
  };

  /**
   * Gets the props associated with selection for a header or a row, where
   * applicable. Most often used to indicate selection status of the table or
   * for a specific row.
   *
   * @param {object} [row] an optional row that we want to access the props for
   * @param {Function} row.onClick
   * @param {object} row.row
   * @returns {object}
   */
  getSelectionProps = ({ onClick, row, ...rest } = {}) => {
    const { translateWithId: t } = this.props;

    // If we're given a row, return the selection state values for that row
    if (row) {
      const translationKey = row.isSelected
        ? translationKeys.unselectRow
        : translationKeys.selectRow;
      return {
        ...rest,
        checked: row.isSelected,
        onSelect: composeEventHandlers([
          this.handleOnSelectRow(row.id),
          onClick,
        ]),
        id: `${this.getTablePrefix()}__select-row-${row.id}`,
        name: `select-row-${row.id}`,
        ariaLabel: t(translationKey),
        disabled: row.disabled,
        radio: this.props.radio || null,
      };
    }

    // Otherwise, we're working on `TableSelectAll` which handles toggling the
    // selection state of all rows.
    const rowCount = this.state.rowIds.length;
    const selectedRowCount = this.getSelectedRows().length;
    const checked = rowCount > 0 && selectedRowCount === rowCount;
    const indeterminate =
      rowCount > 0 && selectedRowCount > 0 && selectedRowCount !== rowCount;
    const translationKey =
      checked || indeterminate
        ? translationKeys.unselectAll
        : translationKeys.selectAll;

    return {
      ...rest,
      ariaLabel: t(translationKey),
      checked,
      id: `${this.getTablePrefix()}__select-all`,
      indeterminate,
      name: 'select-all',
      onSelect: composeEventHandlers([this.handleSelectAll, onClick]),
    };
  };

  getToolbarProps = (props = {}) => {
    const { size } = this.props;
    // Remove compact, short in V11
    let isSmall =
      size === 'compact' || size === 'short' || size === 'xs' || size === 'sm';
    return {
      ...props,
      size: isSmall ? 'small' : 'normal',
    };
  };

  getBatchActionProps = (props = {}) => {
    const { shouldShowBatchActions } = this.state;
    const totalSelected = this.getSelectedRows().length;
    return {
      ...props,
      shouldShowBatchActions: shouldShowBatchActions && totalSelected > 0,
      totalSelected,
      onCancel: this.handleOnCancel,
    };
  };
  /**
   * Helper utility to get the Table Props.
   */
  getTableProps = () => {
    const {
      useZebraStyles,
      size,
      isSortable,
      useStaticWidth,
      shouldShowBorder,
      stickyHeader,
      overflowMenuOnHover,
    } = this.props;
    return {
      useZebraStyles,
      size,
      isSortable,
      useStaticWidth,
      shouldShowBorder,
      stickyHeader,
      overflowMenuOnHover,
    };
  };

  /**
   * Helper utility to get the TableContainer Props.
   */
  getTableContainerProps = () => {
    const { stickyHeader, useStaticWidth } = this.props;

    return {
      stickyHeader,
      useStaticWidth,
    };
  };

  /**
   * Helper utility to get all the currently selected rows
   * @returns {Array<string>} the array of rowIds that are currently selected
   */
  getSelectedRows = () =>
    this.state.rowIds.filter((id) => {
      const row = this.state.rowsById[id];
      return row.isSelected && !row.disabled;
    });

  /**
   * Helper utility to get all of the available rows after applying the filter
   * @returns {Array<string>} the array of rowIds that are currently included through the filter
   *  */
  getFilteredRowIds = () => {
    const filteredRowIds =
      typeof this.state.filterInputValue === 'string'
        ? this.props.filterRows({
            rowIds: this.state.rowIds,
            headers: this.props.headers,
            cellsById: this.state.cellsById,
            inputValue: this.state.filterInputValue,
            getCellId,
          })
        : this.state.rowIds;
    if (filteredRowIds.length == 0) {
      return [];
    }
    return filteredRowIds;
  };

  /**
   * Helper for getting the table prefix for elements that require an
   * `id` attribute that is unique.
   *
   * @returns {string}
   */
  getTablePrefix = () => `data-table-${this.instanceId}`;

  /**
   * Helper for toggling all selected items in a state. Does not call
   * setState, so use it when setting state.
   * @param {object} initialState
   * @returns {object} object to put into this.setState (use spread operator)
   */
  setAllSelectedState = (initialState, isSelected, filteredRowIds) => {
    const { rowIds } = initialState;
    return {
      rowsById: rowIds.reduce(
        (acc, id) => ({
          ...acc,
          [id]: {
            ...initialState.rowsById[id],
            ...(!initialState.rowsById[id].disabled && {
              isSelected: filteredRowIds.includes(id) && isSelected,
            }),
          },
        }),
        {}
      ),
    };
  };

  /**
   * Handler for the `onCancel` event to hide the batch action bar and
   * deselect all selected rows
   */
  handleOnCancel = () => {
    this.setState((state) => {
      return {
        shouldShowBatchActions: false,
        ...this.setAllSelectedState(state, false, this.getFilteredRowIds()),
      };
    });
  };

  /**
   * Handler for toggling the selection state of all rows in the database
   */
  handleSelectAll = () => {
    this.setState((state) => {
      const filteredRowIds = this.getFilteredRowIds();
      const { rowsById } = state;
      const isSelected = !(
        Object.values(rowsById).filter((row) => row.isSelected && !row.disabled)
          .length > 0
      );
      return {
        shouldShowBatchActions: isSelected,
        ...this.setAllSelectedState(state, isSelected, filteredRowIds),
      };
    });
  };

  /**
   * Handler for toggling the selection state of a given row.
   *
   * @param {string} rowId
   * @returns {Function}
   */
  handleOnSelectRow = (rowId) => () => {
    this.setState((state) => {
      const row = state.rowsById[rowId];
      if (this.props.radio) {
        // deselect all radio buttons
        const rowsById = Object.entries(state.rowsById).reduce((p, c) => {
          const [key, val] = c;
          val.isSelected = false;
          p[key] = val;
          return p;
        }, {});
        return {
          shouldShowBatchActions: false,
          rowsById: {
            ...rowsById,
            [rowId]: {
              ...row,
              isSelected: !row.isSelected,
            },
          },
        };
      }
      const selectedRows = state.rowIds.filter(
        (id) => state.rowsById[id].isSelected
      ).length;
      // Predict the length of the selected rows after this change occurs
      const selectedRowsCount = !row.isSelected
        ? selectedRows + 1
        : selectedRows - 1;
      return {
        // Basic assumption here is that we want to show the batch action bar if
        // the row is being selected. If it's being unselected, then see if we
        // have a non-zero number of selected rows that batch actions could
        // still apply to
        shouldShowBatchActions: !row.isSelected || selectedRowsCount > 0,
        rowsById: {
          ...state.rowsById,
          [rowId]: {
            ...row,
            isSelected: !row.isSelected,
          },
        },
      };
    });
  };

  /**
   * Handler for toggling the expansion state of a given row.
   *
   * @param {string} rowId
   * @returns {Function}
   */
  handleOnExpandRow = (rowId) => () => {
    this.setState((state) => {
      const row = state.rowsById[rowId];
      const { isExpandedAll } = state;
      return {
        isExpandedAll: row.isExpanded ? false : isExpandedAll,
        rowsById: {
          ...state.rowsById,
          [rowId]: {
            ...row,
            isExpanded: !row.isExpanded,
          },
        },
      };
    });
  };

  /**
   * Handler for changing the expansion state of all rows.
   */
  handleOnExpandAll = () => {
    this.setState((state) => {
      const { rowIds, isExpandedAll } = state;
      return {
        isExpandedAll: !isExpandedAll,
        rowsById: rowIds.reduce(
          (acc, id) => ({
            ...acc,
            [id]: {
              ...state.rowsById[id],
              isExpanded: !isExpandedAll,
            },
          }),
          {}
        ),
      };
    });
  };

  /**
   * Handler for transitioning to the next sort state of the table
   *
   * @param {string} headerKey the field for the header that we are sorting by
   * @returns {Function}
   */
  handleSortBy = (headerKey) => () => {
    this.setState((state) =>
      getNextSortState(this.props, state, { key: headerKey })
    );
  };

  /**
   * Event handler for transitioning input value state changes for the table
   * filter component.
   *
   * @param {Event} event
   */
  handleOnInputValueChange = (event, defaultValue) => {
    if (event.target) {
      this.setState({ filterInputValue: event.target.value });
    }

    if (defaultValue) {
      this.setState({ filterInputValue: defaultValue });
    }
  };

  render() {
    // eslint-disable-next-line react/prop-types
    const { children, filterRows, headers, render } = this.props;
    const { filterInputValue, rowIds, rowsById, cellsById } = this.state;
    const filteredRowIds =
      typeof filterInputValue === 'string'
        ? filterRows({
            rowIds,
            headers,
            cellsById,
            inputValue: filterInputValue,
            getCellId,
          })
        : rowIds;
    const renderProps = {
      // Data derived from state
      rows: denormalize(filteredRowIds, rowsById, cellsById),
      headers: this.props.headers,
      selectedRows: denormalize(this.getSelectedRows(), rowsById, cellsById),

      // Prop accessors/getters
      getHeaderProps: this.getHeaderProps,
      getExpandHeaderProps: this.getExpandHeaderProps,
      getRowProps: this.getRowProps,
      getSelectionProps: this.getSelectionProps,
      getToolbarProps: this.getToolbarProps,
      getBatchActionProps: this.getBatchActionProps,
      getTableProps: this.getTableProps,
      getTableContainerProps: this.getTableContainerProps,

      // Custom event handlers
      onInputChange: this.handleOnInputValueChange,

      // Expose internal state change actions
      sortBy: (headerKey) => this.handleSortBy(headerKey)(),
      selectAll: this.handleSelectAll,
      selectRow: (rowId) => this.handleOnSelectRow(rowId)(),
      expandRow: (rowId) => this.handleOnExpandRow(rowId)(),
      expandAll: this.handleOnExpandAll,
      radio: this.props.radio,
    };

    if (render !== undefined) {
      return render(renderProps);
    }

    if (children !== undefined) {
      return children(renderProps);
    }

    return null;
  }
}

redpajama_set_name: RedPajamaGithub


text:
using PcapDotNet.Packets.Arp;
using PcapDotNet.Packets.IpV4;
using PcapDotNet.Packets.IpV6;

namespace PcapDotNet.Packets.Ethernet
{
    internal class EthernetPayloadDatagrams
    {
        public EthernetPayloadDatagrams(Datagram payload)
        {
            _payload = payload;
        }

        public Datagram Get(EthernetType ethernetType)
        {
            switch (ethernetType)
            {
                case EthernetType.IpV4:
                    return IpV4;

                case EthernetType.IpV6:
                    return IpV6;

                case EthernetType.Arp:
                    return Arp;

                case EthernetType.VLanTaggedFrame:
                    return VLanTaggedFrame;

                default:
                    return null;
            }
        }

        /// <summary>
        /// The Ethernet payload as an IPv4 datagram.
        /// </summary>
        public IpV4Datagram IpV4
        {
            get
            {
                if (_ipV4 == null && _payload != null)
                    _ipV4 = new IpV4Datagram(_payload.Buffer, _payload.StartOffset, IpV4Datagram.GetTotalLength(_payload));
                return _ipV4;
            }
        }

        /// <summary>
        /// The Ethernet payload as an IPv6 datagram.
        /// </summary>
        public IpV6Datagram IpV6
        {
            get
            {
                if (_ipV6 == null && _payload != null)
                    _ipV6 = new IpV6Datagram(_payload.Buffer, _payload.StartOffset, IpV6Datagram.GetTotalLength(_payload));
                return _ipV6;
            }
        }

        /// <summary>
        /// The Ethernet payload as an ARP datagram.
        /// </summary>
        public ArpDatagram Arp
        {
            get
            {
                if (_arp == null && _payload != null)
                    _arp = ArpDatagram.CreateInstance(_payload.Buffer, _payload.StartOffset, _payload.Length);
                return _arp;
            }
        }

        public VLanTaggedFrameDatagram VLanTaggedFrame
        {
            get
            {
                if (_vLanTaggedFrame == null && _payload != null)
                    _vLanTaggedFrame = new VLanTaggedFrameDatagram(_payload.Buffer, _payload.StartOffset, _payload.Length);
                return _vLanTaggedFrame;
            }
        }

        /// <summary>
        /// The Ethernet payload.
        /// </summary>
        public Datagram Payload
        {
            get { return _payload; }
        }

        private readonly Datagram _payload;
        private IpV4Datagram _ipV4;
        private IpV6Datagram _ipV6;
        private ArpDatagram _arp;
        private VLanTaggedFrameDatagram _vLanTaggedFrame;
    }
}


text:
#pragma once

#include <string>

class Functions
{
	public:
		// Get filename from path
		static std::string getFilenameFromPath(const std::string& _strPath);

		// Get extension from path
		static std::string getExtensionFromPath(const std::string& _strPath);

		// Get filename + extension from path
		static std::string getFullFilenameFromPath(const std::string& _strPath);

		// Get directory from path
		static std::string getDirectoryFromPath(const std::string& _strPath);

		// Create path, ensuring each directory exists along the way
		static bool createPath(const std::string& _strDirectory);

		// Convert int string to int
		static int convertStringToInt(const std::string& _strString);

		// Log2
		static double log2(double _fNumber)
		{
			return	log(_fNumber) / log(2.0f);
		}
};


text:
@interface GetAUserController : UIViewController<UITextFieldDelegate> {

	IBOutlet UITextView *textView;
	IBOutlet UITextField *inputField;
	IBOutlet UIButton *buttonGo;
}

@property (nonatomic, retain) IBOutlet UITextView *textView;
@property (nonatomic, retain) IBOutlet UITextField *inputField;
@property (nonatomic, retain) IBOutlet UIButton *buttonGo;

-(IBAction)getUser;

@end


text:
const express = require('express');

const router = express.Router();

const authenticationController = require('../controllers/authentication');

router.use('/user', require('./user'));
router.use('/car', require('./car'));
router.use('/role', require('./role'));

router.post('/login', authenticationController.login);

// Generate 404s
router.use((req, res, next) => {
  const err = new Error('Not Found');
  err.status = 404;
  next(err);
});

// Handle errors
router.use((err, req, res) => {
  res.status(err.status || 500);
  if (err.status === 500) {
    console.log(err.stack);
  }
  res.json({
    message: err.message,
    error: err.stack,
  });
});

module.exports = router;


text:
## is-nil-x

Checks if `value` is `null` or `undefined`.

### `module.exports(value)` ⇒ boolean ⏏

Checks if `value` is `null` or `undefined`.

**Kind**: Exported function
**Returns**: boolean - Returns `true` if `value` is nullish, else `false`.

| Param | Type            | Description         |
| ----- | --------------- | ------------------- |
| value | \* | The value to check. |

**Example**

```js
import isNil from 'is-nil-x';

console.log(isNil(null)); // => true
console.log(isNil(void 0)); // => true
console.log(isNil(NaN)); // => false
```


text:
package com.github.rodionmoiseev.c10n.resources;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/**
 * @author rodion
 */
@RunWith(Suite.class)
@Suite.SuiteClasses({ExternalResourceTest.class})
public class AllTests {
}


text:
import {Document} from '../model/model';
import {Options as ElementOptions, PolymerElement, ScannedPolymerElement} from '../polymer/polymer-element';

export interface Options extends ElementOptions {}

/**
 * The metadata for a Polymer behavior mixin.
 */
export class ScannedBehavior extends ScannedPolymerElement {
  tagName: undefined;
  className?: string;

  resolve(document: Document) {
    return new Behavior(this, document);
  }
}

declare module '../model/queryable' {
  interface FeatureKindMap {
    'behavior': Behavior;
  }
}

export class Behavior extends PolymerElement {
  readonly tagName: undefined = undefined;
  constructor(scannedBehavior: ScannedBehavior, document: Document) {
    super(scannedBehavior, document);
    this.kinds.delete('element');
    this.kinds.delete('polymer-element');
    this.kinds.add('behavior');
  }

  toString() {
    return `<Behavior className=${this.className}>`;
  }
}


text:
package org.springframework.jdbc.core.simple;

import java.sql.SQLException;
import java.util.List;

import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.jdbc.core.AbstractRowMapperTests;
import org.springframework.jdbc.core.test.ConcretePerson;
import org.springframework.jdbc.core.test.Person;

/**
 * @author Thomas Risberg
 */
public class ParameterizedBeanPropertyRowMapperTests extends AbstractRowMapperTests {

	private SimpleJdbcTemplate simpleJdbcTemplate;

	protected void setUp() throws SQLException {
		super.setUp();
		simpleJdbcTemplate = new SimpleJdbcTemplate(jdbcTemplate);
	}

	public void testOverridingClassDefinedForMapping() {
		ParameterizedBeanPropertyRowMapper<Person> mapper =
				ParameterizedBeanPropertyRowMapper.newInstance(Person.class);
		try {
			((ParameterizedBeanPropertyRowMapper) mapper).setMappedClass(Long.class);
			fail("Setting new class should have thrown InvalidDataAccessApiUsageException");
		}
		catch (InvalidDataAccessApiUsageException ex) {
			// expected
		}
		try {
			mapper.setMappedClass(Person.class);
		}
		catch (InvalidDataAccessApiUsageException ex) {
			fail("Setting same class should not have thrown InvalidDataAccessApiUsageException");
		}
	}

	public void testStaticQueryWithRowMapper() throws SQLException {
		List<Person> result = simpleJdbcTemplate.query("select name, age, birth_date, balance from people",
				ParameterizedBeanPropertyRowMapper.newInstance(Person.class));
		assertEquals(1, result.size());
		Person bean = result.get(0);
		verifyPerson(bean);
	}

	public void testMappingWithInheritance() throws SQLException {
		List<ConcretePerson> result = simpleJdbcTemplate.query("select name, age, birth_date, balance from people",
				ParameterizedBeanPropertyRowMapper.newInstance(ConcretePerson.class));
		assertEquals(1, result.size());
		ConcretePerson bean = result.get(0);
		verifyConcretePerson(bean);
	}

}


text:
package microcms

import "testing"

type testdata struct {
}

//TestDefaultTemplate tests if there is default template
func TestDefaultTemplate(t *testing.T) {
	tmpl := Templates["default.html"]
	if tmpl == nil {
		t.Errorf("Cannot find default template")
	}
}


text:
from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {
    'metadata_version': '1.1',
    'status': ['preview'],
    'supported_by': 'community'
}

DOCUMENTATION = '''
---
module: ipa_dnsrecord
author: Abhijeet Kasurde (@Akasurde)
short_description: Manage FreeIPA DNS records
description:
- Add, modify and delete an IPA DNS Record using IPA API.
options:
  zone_name:
    description:
    - The DNS zone name to which DNS record needs to be managed.
    required: true
  record_name:
    description:
    - The DNS record name to manage.
    required: true
    aliases: ["name"]
  record_type:
    description:
    - The type of DNS record name.
    - Currently, 'A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV' and 'MX' are supported.
    - "'A6', 'CNAME', 'DNAME' and 'TXT' are added in version 2.5."
    - "'SRV' and 'MX' are added in version 2.8."
    required: false
    default: 'A'
    choices: ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV', 'MX']
  record_value:
    description:
    - Manage DNS record name with this value.
    - In the case of 'A' or 'AAAA' record types, this will be the IP address.
    - In the case of 'A6' record type, this will be the A6 Record data.
    - In the case of 'CNAME' record type, this will be the hostname.
    - In the case of 'DNAME' record type, this will be the DNAME target.
    - In the case of 'PTR' record type, this will be the hostname.
    - In the case of 'TXT' record type, this will be a text.
    - In the case of 'SRV' record type, this will be a service record.
    - In the case of 'MX' record type, this will be a mail exchanger record.
    required: true
  record_ttl:
    description:
    - Set the TTL for the record.
    - Applies only when adding a new or changing the value of record_value.
    version_added: "2.7"
  state:
    description: State to ensure
    required: false
    default: present
    choices: ["present", "absent"]
extends_documentation_fragment: ipa.documentation
version_added: "2.4"
'''

EXAMPLES = '''
# Ensure dns record is present
- ipa_dnsrecord:
    ipa_host: spider.example.com
    ipa_pass: Passw0rd!
    state: present
    zone_name: example.com
    record_name: vm-001
    record_type: 'AAAA'
    record_value: '::1'

# Ensure that dns record exists with a TTL
- ipa_dnsrecord:
    name: host02
    zone_name: example.com
    record_type: 'AAAA'
    record_value: '::1'
    record_ttl: 300
    ipa_host: ipa.example.com
    ipa_pass: topsecret
    state: present

# Ensure a PTR record is present
- ipa_dnsrecord:
    ipa_host: spider.example.com
    ipa_pass: Passw0rd!
    state: present
    zone_name: 2.168.192.in-addr.arpa
    record_name: 5
    record_type: 'PTR'
    record_value: 'internal.ipa.example.com'

# Ensure a TXT record is present
- ipa_dnsrecord:
    ipa_host: spider.example.com
    ipa_pass: Passw0rd!
    state: present
    zone_name: example.com
    record_name: _kerberos
    record_type: 'TXT'
    record_value: 'EXAMPLE.COM'

# Ensure an SRV record is present
- ipa_dnsrecord:
    ipa_host: spider.example.com
    ipa_pass: Passw0rd!
    state: present
    zone_name: example.com
    record_name: _kerberos._udp.example.com
    record_type: 'SRV'
    record_value: '10 50 88 ipa.example.com'

# Ensure an MX record is present
- ipa_dnsrecord:
    ipa_host: spider.example.com
    ipa_pass: Passw0rd!
    state: present
    zone_name: example.com
    record_name: '@'
    record_type: 'MX'
    record_value: '1 mailserver.example.com'

# Ensure that dns record is removed
- ipa_dnsrecord:
    name: host01
    zone_name: example.com
    record_type: 'AAAA'
    record_value: '::1'
    ipa_host: ipa.example.com
    ipa_user: admin
    ipa_pass: topsecret
    state: absent
'''

RETURN = '''
dnsrecord:
  description: DNS record as returned by IPA API.
  returned: always
  type: dict
'''

import traceback

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ipa import IPAClient, ipa_argument_spec
from ansible.module_utils._text import to_native

class DNSRecordIPAClient(IPAClient):
    def __init__(self, module, host, port, protocol):
        super(DNSRecordIPAClient, self).__init__(module, host, port, protocol)

    def dnsrecord_find(self, zone_name, record_name):
        if record_name == '@':
            return self._post_json(method='dnsrecord_show', name=zone_name, item={'idnsname': record_name, 'all': True})
        else:
            return self._post_json(method='dnsrecord_find', name=zone_name, item={'idnsname': record_name, 'all': True})

    def dnsrecord_add(self, zone_name=None, record_name=None, details=None):
        item = dict(idnsname=record_name)
        if details['record_type'] == 'A':
            item.update(a_part_ip_address=details['record_value'])
        elif details['record_type'] == 'AAAA':
            item.update(aaaa_part_ip_address=details['record_value'])
        elif details['record_type'] == 'A6':
            item.update(a6_part_data=details['record_value'])
        elif details['record_type'] == 'CNAME':
            item.update(cname_part_hostname=details['record_value'])
        elif details['record_type'] == 'DNAME':
            item.update(dname_part_target=details['record_value'])
        elif details['record_type'] == 'PTR':
            item.update(ptr_part_hostname=details['record_value'])
        elif details['record_type'] == 'TXT':
            item.update(txtrecord=details['record_value'])
        elif details['record_type'] == 'SRV':
            item.update(srvrecord=details['record_value'])
        elif details['record_type'] == 'MX':
            item.update(mxrecord=details['record_value'])

        if details.get('record_ttl'):
            item.update(dnsttl=details['record_ttl'])

        return self._post_json(method='dnsrecord_add', name=zone_name, item=item)

    def dnsrecord_mod(self, zone_name=None, record_name=None, details=None):
        item = get_dnsrecord_dict(details)
        item.update(idnsname=record_name)
        if details.get('record_ttl'):
            item.update(dnsttl=details['record_ttl'])
        return self._post_json(method='dnsrecord_mod', name=zone_name, item=item)

    def dnsrecord_del(self, zone_name=None, record_name=None, details=None):
        item = get_dnsrecord_dict(details)
        item.update(idnsname=record_name)
        return self._post_json(method='dnsrecord_del', name=zone_name, item=item)

def get_dnsrecord_dict(details=None):
    module_dnsrecord = dict()
    if details['record_type'] == 'A' and details['record_value']:
        module_dnsrecord.update(arecord=details['record_value'])
    elif details['record_type'] == 'AAAA' and details['record_value']:
        module_dnsrecord.update(aaaarecord=details['record_value'])
    elif details['record_type'] == 'A6' and details['record_value']:
        module_dnsrecord.update(a6record=details['record_value'])
    elif details['record_type'] == 'CNAME' and details['record_value']:
        module_dnsrecord.update(cnamerecord=details['record_value'])
    elif details['record_type'] == 'DNAME' and details['record_value']:
        module_dnsrecord.update(dnamerecord=details['record_value'])
    elif details['record_type'] == 'PTR' and details['record_value']:
        module_dnsrecord.update(ptrrecord=details['record_value'])
    elif details['record_type'] == 'TXT' and details['record_value']:
        module_dnsrecord.update(txtrecord=details['record_value'])
    elif details['record_type'] == 'SRV' and details['record_value']:
        module_dnsrecord.update(srvrecord=details['record_value'])
    elif details['record_type'] == 'MX' and details['record_value']:
        module_dnsrecord.update(mxrecord=details['record_value'])

    if details.get('record_ttl'):
        module_dnsrecord.update(dnsttl=details['record_ttl'])

    return module_dnsrecord

def get_dnsrecord_diff(client, ipa_dnsrecord, module_dnsrecord):
    details = get_dnsrecord_dict(module_dnsrecord)
    return client.get_diff(ipa_data=ipa_dnsrecord, module_data=details)

def ensure(module, client):
    zone_name = module.params['zone_name']
    record_name = module.params['record_name']
    record_ttl = module.params.get('record_ttl')
    state = module.params['state']

    ipa_dnsrecord = client.dnsrecord_find(zone_name, record_name)

    module_dnsrecord = dict(
        record_type=module.params['record_type'],
        record_value=module.params['record_value'],
        record_ttl=to_native(record_ttl, nonstring='passthru'),
    )

    changed = False
    if state == 'present':
        if not ipa_dnsrecord:
            changed = True
            if not module.check_mode:
                client.dnsrecord_add(zone_name=zone_name,
                                     record_name=record_name,
                                     details=module_dnsrecord)
        else:
            diff = get_dnsrecord_diff(client, ipa_dnsrecord, module_dnsrecord)
            if len(diff) > 0:
                changed = True
                if not module.check_mode:
                    client.dnsrecord_mod(zone_name=zone_name,
                                         record_name=record_name,
                                         details=module_dnsrecord)
    else:
        if ipa_dnsrecord:
            changed = True
            if not module.check_mode:
                client.dnsrecord_del(zone_name=zone_name,
                                     record_name=record_name,
                                     details=module_dnsrecord)

    return changed, client.dnsrecord_find(zone_name, record_name)

def main():
    record_types = ['A', 'AAAA', 'A6', 'CNAME', 'DNAME', 'PTR', 'TXT', 'SRV', 'MX']
    argument_spec = ipa_argument_spec()
    argument_spec.update(
        zone_name=dict(type='str', required=True),
        record_name=dict(type='str', aliases=['name'], required=True),
        record_type=dict(type='str', default='A', choices=record_types),
        record_value=dict(type='str', required=True),
        state=dict(type='str', default='present', choices=['present', 'absent']),
        record_ttl=dict(type='int'),
    )

    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=True
    )

    client = DNSRecordIPAClient(
        module=module,
        host=module.params['ipa_host'],
        port=module.params['ipa_port'],
        protocol=module.params['ipa_prot']
    )

    try:
        client.login(
            username=module.params['ipa_user'],
            password=module.params['ipa_pass']
        )
        changed, record = ensure(module, client)
        module.exit_json(changed=changed, record=record)
    except Exception as e:
        module.fail_json(msg=to_native(e), exception=traceback.format_exc())

if __name__ == '__main__':
    main()


text:
module Kyukon
  class Board

    def ignore?
      false
    end

    def resume
      # Do nothing by default
    end

  end
end


text:
<!DOCTYPE HTML>

<title>WGLNVRenderDepthTexture (LWJGL 3.1.0 - OpenGL)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2016-10-30">
<link rel="stylesheet" type="text/css" href="../../../javadoc.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../jquery/jquery-ui.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

SEARCH:
<input type="text" id="search" value=" " disabled="disabled">
<input type="reset" id="reset" value=" " disabled="disabled">

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Package org.lwjgl.opengl

Class WGLNVRenderDepthTexture

java.lang.Object

org.lwjgl.opengl.WGLNVRenderDepthTexture

public final class WGLNVRenderDepthTexture
extends java.lang.Object

Native bindings to the WGL_NV_render_depth_texture extension.

This extension allows a depth buffer to be used for both rendering and texturing. It is built upon the ARB_render_texture extension; the only addition
 in this extension is the ability to use a depth buffer as a DEPTH_COMPONENT texture map.

Field Summary

Fields

Modifier and Type
Field and Description

static int
WGL_BIND_TO_TEXTURE_DEPTH_NV

WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV

Accepted by the piAttributes parameter of wglGetPixelFormatAttribivARB, wglGetPixelFormatAttribfvARB, and the piAttribIList and
 pfAttribIList parameters of wglChoosePixelFormatARB.

static int
WGL_DEPTH_COMPONENT_NV

Accepted by the iBuffer parameter of wglBindTexImageARB.

static int
WGL_DEPTH_TEXTURE_FORMAT_NV

Accepted by the piAttribList parameter of wglCreatePbufferARB and by the iAttribute parameter of wglQueryPbufferARB.

static int
WGL_NO_TEXTURE_ARB

WGL_TEXTURE_DEPTH_COMPONENT_NV

Accepted as a value in the piAttribList parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when
 iAttribute is WGL_DEPTH_TEXTURE_FORMAT_NV.

Method Summary

Methods inherited from class java.lang.Object

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

Field Detail

WGL_BIND_TO_TEXTURE_DEPTH_NV, WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV

Accepted by the piAttributes parameter of wglGetPixelFormatAttribivARB, wglGetPixelFormatAttribfvARB, and the piAttribIList and
 pfAttribIList parameters of wglChoosePixelFormatARB.

WGL_DEPTH_TEXTURE_FORMAT_NV

Accepted by the piAttribList parameter of wglCreatePbufferARB and by the iAttribute parameter of wglQueryPbufferARB.

WGL_TEXTURE_DEPTH_COMPONENT_NV, WGL_NO_TEXTURE_ARB

Accepted as a value in the piAttribList parameter of wglCreatePbufferARB and returned in the value parameter of wglQueryPbufferARB when
 iAttribute is WGL_DEPTH_TEXTURE_FORMAT_NV.

WGL_DEPTH_COMPONENT_NV

Accepted by the iBuffer parameter of wglBindTexImageARB.

Skip navigation links

Package

Class

Deprecated

Index

Prev Class

Next Class

Frames

No Frames

All Classes

JavaScript is disabled on your browser.

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright LWJGL. All Rights Reserved. License terms.


text:
package org.apache.camel.support.service;

import org.apache.camel.RuntimeCamelException;
import org.apache.camel.ServiceStatus;
import org.apache.camel.StatefulService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A useful base class which ensures that a service is only initialized once and
 * provides some helper methods for enquiring of its status.
 *

 * Implementations can extend this base class and implement {@link org.apache.camel.SuspendableService}
 * in case they support suspend/resume.
 *

 * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()}},
 * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
 * NOT be overridden as they are used internally to keep track of the state of this service and properly
 * invoke the operation in a safe manner.
 */
public abstract class ServiceSupport implements StatefulService {

    protected static final int NEW = 0;
    protected static final int BUILDED = 1;
    protected static final int INITIALIZED = 2;
    protected static final int STARTING = 3;
    protected static final int STARTED = 4;
    protected static final int SUSPENDING = 5;
    protected static final int SUSPENDED = 6;
    protected static final int STOPPING = 7;
    protected static final int STOPPED = 8;
    protected static final int SHUTTINGDOWN = 9;
    protected static final int SHUTDOWN = 10;
    protected static final int FAILED = 11;

    protected final Logger log = LoggerFactory.getLogger(getClass());
    protected final Object lock = new Object();
    protected volatile int status = NEW;

    @Override
    public void build() {
        if (status == NEW) {
            synchronized (lock) {
                if (status == NEW) {
                    log.trace("Building service: {}", this);
                    try {
                        doBuild();
                    } catch (Exception e) {
                        throw RuntimeCamelException.wrapRuntimeException(e);
                    }
                    status = BUILDED;
                }
            }
        }
    }

    @Override
    public void init() {
        if (status <= BUILDED) {
            synchronized (lock) {
                if (status <= BUILDED) {
                    log.trace("Initializing service: {}", this);
                    try {
                        doInit();
                    } catch (Exception e) {
                        throw RuntimeCamelException.wrapRuntimeException(e);
                    }
                    status = INITIALIZED;
                }
            }
        }
    }

    /**
     * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
     * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
     * NOT be overridden as they are used internally to keep track of the state of this service and properly
     * invoke the operation in a safe manner.
     */
    @Override
    public void start() {
        synchronized (lock) {
            if (status == STARTED) {
                log.trace("Service: {} already started", this);
                return;
            }
            if (status == STARTING) {
                log.trace("Service: {} already starting", this);
                return;
            }
            try {
                init();
            } catch (Exception e) {
                status = FAILED;
                log.trace("Error while initializing service: " + this, e);
                throw e;
            }
            try {
                status = STARTING;
                log.trace("Starting service: {}", this);
                doStart();
                status = STARTED;
                log.trace("Service started: {}", this);
            } catch (Exception e) {
                // need to stop as some resources may have been started during startup
                try {
                    stop();
                } catch (Exception e2) {
                    // ignore
                    log.trace("Error while stopping service after it failed to start: " + this + ". This exception is ignored", e);
                }
                status = FAILED;
                log.trace("Error while starting service: " + this, e);
                throw RuntimeCamelException.wrapRuntimeException(e);
            }
        }
    }

    /**
     * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
     * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
     * NOT be overridden as they are used internally to keep track of the state of this service and properly
     * invoke the operation in a safe manner.
     */
    @Override
    public void stop() {
        synchronized (lock) {
            if (status == FAILED) {
                log.trace("Service: {} failed and regarded as already stopped", this);
                return;
            }
            if (status == STOPPED || status == SHUTTINGDOWN || status == SHUTDOWN) {
                log.trace("Service: {} already stopped", this);
                return;
            }
            if (status == STOPPING) {
                log.trace("Service: {} already stopping", this);
                return;
            }
            status = STOPPING;
            log.trace("Stopping service: {}", this);
            try {
                doStop();
                status = STOPPED;
                log.trace("Service: {} stopped service", this);
            } catch (Exception e) {
                status = FAILED;
                log.trace("Error while stopping service: " + this, e);
                throw RuntimeCamelException.wrapRuntimeException(e);
            }
        }
    }

    /**
     * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
     * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
     * NOT be overridden as they are used internally to keep track of the state of this service and properly
     * invoke the operation in a safe manner.
     */
    @Override
    public void suspend() {
        synchronized (lock) {
            if (status == SUSPENDED) {
                log.trace("Service: {} already suspended", this);
                return;
            }
            if (status == SUSPENDING) {
                log.trace("Service: {} already suspending", this);
                return;
            }
            status = SUSPENDING;
            log.trace("Suspending service: {}", this);
            try {
                doSuspend();
                status = SUSPENDED;
                log.trace("Service suspended: {}", this);
            } catch (Exception e) {
                status = FAILED;
                log.trace("Error while suspending service: " + this, e);
                throw RuntimeCamelException.wrapRuntimeException(e);
            }
        }
    }

    /**
     * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
     * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
     * NOT be overridden as they are used internally to keep track of the state of this service and properly
     * invoke the operation in a safe manner.
     */
    @Override
    public void resume() {
        synchronized (lock) {
            if (status != SUSPENDED) {
                log.trace("Service is not suspended: {}", this);
                return;
            }
            status = STARTING;
            log.trace("Resuming service: {}", this);
            try {
                doResume();
                status = STARTED;
                log.trace("Service resumed: {}", this);
            } catch (Exception e) {
                status = FAILED;
                log.trace("Error while resuming service: " + this, e);
                throw RuntimeCamelException.wrapRuntimeException(e);
            }
        }
    }

    /**
     * Important:  You should override the lifecycle methods that start with <tt>do</tt>, eg {@link #doStart()},
     * {@link #doStop()}, etc. where you implement your logic. The methods {@link #start()}, {@link #stop()} should
     * NOT be overridden as they are used internally to keep track of the state of this service and properly
     * invoke the operation in a safe manner.
     */
    @Override
    public void shutdown() {
        synchronized (lock) {
            if (status == SHUTDOWN) {
                log.trace("Service: {} already shut down", this);
                return;
            }
            if (status == SHUTTINGDOWN) {
                log.trace("Service: {} already shutting down", this);
                return;
            }
            stop();
            status = SHUTDOWN;
            log.trace("Shutting down service: {}", this);
            try {
                doShutdown();
                log.trace("Service: {} shut down", this);
                status = SHUTDOWN;
            } catch (Exception e) {
                status = FAILED;
                log.trace("Error shutting down service: " + this, e);
                throw RuntimeCamelException.wrapRuntimeException(e);
            }
        }
    }

    @Override
    public ServiceStatus getStatus() {
        switch (status) {
        case STARTING:
            return ServiceStatus.Starting;
        case STARTED:
            return ServiceStatus.Started;
        case SUSPENDING:
            return ServiceStatus.Suspending;
        case SUSPENDED:
            return ServiceStatus.Suspended;
        case STOPPING:
            return ServiceStatus.Stopping;
        default:
            return ServiceStatus.Stopped;
        }
    }

    public boolean isNew() {
        return status == NEW;
    }

    public boolean isBuild() {
        return status == BUILDED;
    }

    public boolean isInit() {
        return status == INITIALIZED;
    }

    @Override
    public boolean isStarted() {
        return status == STARTED;
    }

    @Override
    public boolean isStarting() {
        return status == STARTING;
    }

    @Override
    public boolean isStopping() {
        return status == STOPPING;
    }

    @Override
    public boolean isStopped() {
        return status == NEW || status == INITIALIZED || status == BUILDED || status == STOPPED || status == SHUTTINGDOWN || status == SHUTDOWN || status == FAILED;
    }

    @Override
    public boolean isSuspending() {
        return status == SUSPENDING;
    }

    @Override
    public boolean isSuspended() {
        return status == SUSPENDED;
    }

    @Override
    public boolean isRunAllowed() {
        return isStartingOrStarted() || isSuspendingOrSuspended();
    }

    public boolean isShutdown() {
        return status == SHUTDOWN;
    }

    /**
     * Is the service in progress of being stopped or already stopped
     */
    public boolean isStoppingOrStopped() {
        return isStopping() || isStopped();
    }

    /**
     * Is the service in progress of being suspended or already suspended
     */
    public boolean isSuspendingOrSuspended() {
        return isSuspending() || isSuspended();
    }

    /**
     * Is the service in progress of being suspended or already suspended
     */
    public boolean isStartingOrStarted() {
        return isStarting() || isStarted();
    }

    /**
     * Optional build phase of the service.
     * This method will only be called by frameworks which supports pre-building projects such as camel-quarkus.
     */
    protected void doBuild() throws Exception {
    }

    /**
     * Initialize the service.
     * This method will only be called once before starting.
     */
    protected void doInit() throws Exception {
    }

    /**
     * Implementations override this method to support customized start/stop.
     *

     * Important:  See {@link #doStop()} for more details.
     *
     * @see #doStop()
     */
    protected abstract void doStart() throws Exception;

    /**
     * Implementations override this method to support customized start/stop.
     *

     * Important: Camel will invoke this {@link #doStop()} method when
     * the service is being stopped. This method will also be invoked
     * if the service is still in uninitialized state (eg has not
     * been started). The method is always called to allow the service
     * to do custom logic when the service is being stopped, such as when
     * {@link org.apache.camel.CamelContext} is shutting down.
     *
     * @see #doStart()
     */
    protected abstract void doStop() throws Exception;

    /**
     * Implementations override this method to support customized suspend/resume.
     */
    protected void doSuspend() throws Exception {
        // noop
    }

    /**
     * Implementations override this method to support customized suspend/resume.
     */
    protected void doResume() throws Exception {
        // noop
    }

    /**
     * Implementations override this method to perform customized shutdown.
     */
    protected void doShutdown() throws Exception {
        // noop
    }

}


text:
<?php

namespace TechnoBureau\reStructuredText\RST;

/**
 * A reference is something that can be resolved in the document, for instance:
 *
 * :method:`helloWorld()`
 *
 * Will be resolved as a reference of type method and the given reference will
 * be called to resolve it
 */
abstract class Reference
{
    /**
     * The name of the reference, i.e the :something:
     */
    abstract public function getName();

    /**
     * Resolve the reference and returns an array
     *
     * @param $environment the Environment in use
     * @param $data the data of the reference
     *
     * @return array an array with key title and url
     */
    abstract public function resolve(Environment $environment, $data);

    /**
     * Called when a reference is just found
     *
     * @param $environment the Environment in use
     * @param $data the data of the reference
     */
    public function found(Environment $environment, $data)
    {
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Windows;
using System.Windows.Shell;
using Caliburn.Micro;
using Cocoa.Events;
using Cocoa.Settings;
using Cocoa.Settings.Models;

namespace Cocoa.Infrastructure
{
    /// <summary>
    /// Class for interacting with the Windows7 JumpList
    /// </summary>
    public class JumpListIntegration : IHandle<FileOpenEvent>, IHandle<AppReadyEvent>, IDisposable
    {
        readonly ISettingsProvider settingsService;
        JumpList jumpList;

        public JumpListIntegration(ISettingsProvider settingsService)
        {
            this.settingsService = settingsService;
        }

        public void Handle(FileOpenEvent message)
        {
            var x = new Thread(new ParameterizedThreadStart(delegate { OpenFileAsync(message.Path); }));
            x.SetApartmentState(ApartmentState.STA);
            x.Start();
        }

        public void OpenFileAsync(string openedFile)
        {
            if (!IsWin7OrAbove())
                return;

            var currentFiles = jumpList.JumpItems.OfType<JumpTask>().Select(t => t.Arguments).ToList();

            if (currentFiles.Contains(openedFile))
            {
                // find file in list
                var settings = settingsService.GetSettings<CocoaSettings>();
                var index = settings.RecentFiles.IndexOf(openedFile);
                if (index >= 0)
                    settings.RecentFiles.RemoveAt(index);
                settings.RecentFiles.Insert(0, openedFile);
                settingsService.SaveSettings(settings);

                // Sometimes the settings and the jumplist can get out of sequence.
                index = currentFiles.IndexOf(openedFile);

                if (index >= 0) jumpList.JumpItems.RemoveAt(index);
                InsertFileFirst(openedFile);
            }
            else
            {
                // update settings
                var settings = settingsService.GetSettings<CocoaSettings>();

                settings.RecentFiles.Insert(0, openedFile);
                if (settings.RecentFiles.Count > 5)
                    settings.RecentFiles.RemoveAt(5);
                settingsService.SaveSettings(settings);

                InsertFileFirst(openedFile);
            }
        }

        private void InsertFileFirst(string openedFile)
        {
            if (!IsWin7OrAbove())
                return;

            if (jumpList != null)
            {
                var item = CreateJumpListItem(openedFile);
                jumpList.JumpItems.Insert(0, item);
                jumpList.Apply();
            }
        }

        public void Handle(AppReadyEvent message)
        {
            if (!IsWin7OrAbove())
                return;

            jumpList = GetJumpList();

            var x = new Thread(new ParameterizedThreadStart(delegate { PopulateJumpList(settingsService.GetSettings<CocoaSettings>().RecentFiles); }));
            x.SetApartmentState(ApartmentState.STA);
            x.Start();
        }

        public void Dispose()
        {
            //settingsService.Save();
        }

        private void PopulateJumpList(IEnumerable<string> recentFiles)
        {
            if (!IsWin7OrAbove())
                return;

            if (recentFiles == null) return;

            foreach (var file in recentFiles.Distinct())
            {
                if (!File.Exists(file)) continue;
                var item = CreateJumpListItem(file);
                jumpList.JumpItems.Add(item);
            }

            jumpList.Apply();
        }

        private static JumpItem CreateJumpListItem(string file)
        {
            if (!IsWin7OrAbove())
                return null;

            var path = Assembly.GetEntryAssembly().CodeBase;
            return new JumpTask
                           {
                               Arguments = file,
                               ApplicationPath = path,
                               IconResourcePath = Path.Combine(Constants.IconDir, Constants.Icons[0]),
                               Title = new FileInfo(file).Name,
                               CustomCategory = "Recent Files"
                           };
        }

        private static bool IsWin7OrAbove()
        {
            // check for Windows7
            var os = Environment.OSVersion.Version;
            if (os.Major < 6) return false;
            if (os.Minor < 1) return false;

            return true;
        }

        private static JumpList GetJumpList()
        {
            if (!IsWin7OrAbove())
                return null;

            var list = JumpList.GetJumpList(Application.Current);
            if (list != null) return list;

            list = new JumpList { ShowFrequentCategory = false, ShowRecentCategory = false };

            JumpList.SetJumpList(Application.Current, list);
            return list;
        }
    }
}


text:
from templeplus.pymod import PythonModifier
from toee import *
import math

print "Registering Brutal Throw"

def BrutalThrowAttackBonus(attachee, args, evt_obj):

	#Always add the bonus for thrown only weapons.  Also add the bonus if the thrown flag is set (for weapons like dagger)
	wpn = evt_obj.attack_packet.get_weapon_used()

	if wpn == OBJ_HANDLE_NULL:
		return 0

	if not wpn.is_thrown_only_weapon():
		if evt_obj.attack_packet.get_flags() & D20CAF_THROWN == 0:
			return 0

	#Add differece between strength and dex bonus
	strScore = attachee.stat_level_get(stat_strength)
	strMod = math.floor((strScore - 10)/2)

	dexScore = attachee.stat_level_get(stat_dexterity)
	dexMod = math.floor((dexScore - 10)/2)

	bonus = int(strMod - dexMod)

	if bonus > 0:
		evt_obj.bonus_list.add_from_feat(bonus, 0, 114, "Brutal Throw")

	return 0

brutalThrow = PythonModifier("Brutal Throw", 2) # args are just-in-case placeholders
brutalThrow.MapToFeat("Brutal Throw")
brutalThrow.AddHook(ET_OnToHitBonus2, EK_NONE, BrutalThrowAttackBonus, ())


text:
ARG AIRFLOW_VERSION="2.2.5"
ARG AIRFLOW_EXTRAS="amazon,async,celery,cncf.kubernetes,dask,docker,elasticsearch,ftp,google,google_auth,grpc,hashicorp,http,ldap,microsoft.azure,mysql,odbc,pandas,postgres,redis,sendgrid,sftp,slack,ssh,statsd,virtualenv"

ARG AIRFLOW_HOME=/opt/airflow
ARG AIRFLOW_UID="50000"
ARG AIRFLOW_USER_HOME_DIR=/home/airflow
ARG AIRFLOW_PIP_VERSION="21.3.1"

FROM marketplace.gcr.io/google/debian11:latest as airflow-build-image

SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "nolog", "-c"]
ENV DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \
    LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8

ENV DEV_APT_DEPS="\
     apt-transport-https \
     apt-utils \
     build-essential \
     ca-certificates \
     dirmngr \
     freetds-bin \
     freetds-dev \
     gosu \
     krb5-user \
     ldap-utils \
     libffi-dev \
     libkrb5-dev \
     libldap2-dev \
     libpq-dev \
     libsasl2-2 \
     libsasl2-dev \
     libsasl2-modules \
     libssl-dev \
     locales  \
     lsb-release \
     nodejs \
     openssh-client \
     postgresql-client \
     python3 \
     python3-pip \
     python3-dev \
     sasl2-bin \
     software-properties-common \
     sqlite3 \
     sudo \
     unixodbc \
     unixodbc-dev \
     yarn"

ENV DEV_APT_COMMAND="\
    curl --silent --fail --location https://deb.nodesource.com/setup_14.x | \
    bash -o pipefail -o errexit -o nolog - \
    && curl --silent https://dl.yarnpkg.com/debian/pubkey.gpg | \
    apt-key add - >/dev/null 2>&1\
    && echo 'deb https://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list"

RUN apt-get update \
    && apt-get install --no-install-recommends -yqq apt-utils >/dev/null 2>&1 \
    && apt-get install -y --no-install-recommends curl gnupg2 \
    && mkdir -pv /usr/share/man/man1 \
    && mkdir -pv /usr/share/man/man7 \
    && bash -o pipefail -o errexit -o nounset -o nolog -c "${DEV_APT_COMMAND}" \
    && apt-get update \
    && apt-get install -y --no-install-recommends ${DEV_APT_DEPS} \
    && apt-get autoremove -yqq --purge \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

ARG AIRFLOW_EXTRAS
ARG AIRFLOW_VERSION
ARG AIRFLOW_PIP_VERSION
ARG AIRFLOW_HOME
ARG AIRFLOW_USER_HOME_DIR
ARG AIRFLOW_UID

ENV AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
    AIRFLOW_VERSION=${AIRFLOW_VERSION} \
    AIRFLOW_EXTRAS=${AIRFLOW_EXTRAS} \
    AIRFLOW_PRE_CACHED_PIP_PACKAGES="false" \
    INSTALL_PROVIDERS_FROM_SOURCES="false" \
    AIRFLOW_INSTALLATION_METHOD="apache-airflow" \
    PATH=${PATH}:${AIRFLOW_USER_HOME_DIR}/.local/bin \
    AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION} \
    AIRFLOW_USER_HOME_DIR=${AIRFLOW_USER_HOME_DIR} \
    AIRFLOW_HOME=${AIRFLOW_HOME} \
    AIRFLOW_UID=${AIRFLOW_UID} \
    INSTALL_MYSQL_CLIENT="true" \
    INSTALL_MSSQL_CLIENT="true" \
    PIP_USER="true"

COPY scripts/docker/install_mysql.sh scripts/docker/install_mssql.sh /scripts/docker/

RUN /scripts/docker/install_mysql.sh dev && /scripts/docker/install_mssql.sh
ENV PATH=${PATH}:/opt/mssql-tools/bin

RUN adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password \
       --quiet "airflow" --uid "${AIRFLOW_UID}" --gid "0" --home "${AIRFLOW_USER_HOME_DIR}" && \
    mkdir -p ${AIRFLOW_HOME} && chown -R "airflow:0" "${AIRFLOW_USER_HOME_DIR}" ${AIRFLOW_HOME}

USER airflow

COPY --chown=airflow:0 scripts/docker/install_pip_version.sh /scripts/docker/

RUN /scripts/docker/install_pip_version.sh

ENV INSTALL_FROM_PYPI="true" \
    EAGER_UPGRADE_ADDITIONAL_REQUIREMENTS="dill<0.3.3 certifi<2021.0.0 google-ads<14.0.1"

WORKDIR /opt/airflow

COPY --chown=airflow:0 scripts/docker/install_airflow.sh /scripts/docker/

RUN /scripts/docker/install_airflow.sh \
    && find "${AIRFLOW_USER_HOME_DIR}/.local/" -name '*.pyc' -print0 | xargs -0 rm -f || true \
    && find "${AIRFLOW_USER_HOME_DIR}/.local/" -type d -name '__pycache__' -print0 | xargs -0 rm -rf || true \
    && find "${AIRFLOW_USER_HOME_DIR}/.local" -executable -print0 | xargs --null chmod g+x \
    && find "${AIRFLOW_USER_HOME_DIR}/.local" -print0 | xargs --null chmod g+rw

FROM marketplace.gcr.io/google/debian11:latest as main

SHELL ["/bin/bash", "-o", "pipefail", "-o", "errexit", "-o", "nounset", "-o", "nolog", "-c"]

ARG AIRFLOW_USER_HOME_DIR
ARG AIRFLOW_HOME
ARG AIRFLOW_UID
ARG AIRFLOW_PIP_VERSION
ARG AIRFLOW_VERSION

ENV AIRFLOW_VERSION=${AIRFLOW_VERSION} \
    DEBIAN_FRONTEND=noninteractive LANGUAGE=C.UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 \
    LC_CTYPE=C.UTF-8 LC_MESSAGES=C.UTF-8 \
    AIRFLOW_PIP_VERSION=${AIRFLOW_PIP_VERSION}

ENV RUNTIME_APT_DEPS="\
       apt-transport-https \
       apt-utils \
       ca-certificates \
       curl \
       dumb-init \
       freetds-bin \
       gosu \
       krb5-user \
       ldap-utils \
       libffi7 \
       libldap-2.4-2 \
       libsasl2-2 \
       libsasl2-modules \
       libssl1.1 \
       locales  \
       lsb-release \
       netcat \
       openssh-client \
       postgresql-client \
       python2 \
       python3 \
       python3-pip \
       rsync \
       sasl2-bin \
       sqlite3 \
       sudo \
       unixodbc"

ENV RUNTIME_APT_COMMAND="echo" \
    INSTALL_MYSQL_CLIENT="true" \
    INSTALL_MSSQL_CLIENT="true" \
    AIRFLOW_INSTALLATION_METHOD="apache-airflow" \
    AIRFLOW_UID=${AIRFLOW_UID} \
    AIRFLOW__CORE__LOAD_EXAMPLES="false" \
    AIRFLOW_USER_HOME_DIR=${AIRFLOW_USER_HOME_DIR} \
    AIRFLOW_HOME=${AIRFLOW_HOME} \
    PATH="${AIRFLOW_USER_HOME_DIR}/.local/bin:${PATH}" \
    GUNICORN_CMD_ARGS="--worker-tmp-dir /dev/shm" \
    PIP_USER="true"

RUN apt-get update \
    && apt-get install --no-install-recommends -yqq apt-utils >/dev/null 2>&1 \
    && apt-get install -y --no-install-recommends curl gnupg2 \
    && mkdir -pv /usr/share/man/man1 \
    && mkdir -pv /usr/share/man/man7 \
    && bash -o pipefail -o errexit -o nounset -o nolog -c "${RUNTIME_APT_COMMAND}" \
    && apt-get update \
    && apt-get install -y --no-install-recommends ${RUNTIME_APT_DEPS} \
    && apt-get autoremove -yqq --purge \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* \
    && rm -rf /var/log/* \
    && ln -s /usr/bin/python3 /usr/bin/python

COPY scripts/docker/install_mysql.sh /scripts/docker/install_mssql.sh /scripts/docker/
RUN chmod a+x /scripts/docker/install_mysql.sh /scripts/docker/install_mssql.sh \
    && sync \
    && /scripts/docker/install_mysql.sh prod \
    && /scripts/docker/install_mssql.sh \
    && adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password \
       --quiet "airflow" --uid "${AIRFLOW_UID}" --gid "0" --home "${AIRFLOW_USER_HOME_DIR}" \
    && mkdir -pv "${AIRFLOW_HOME}" \
    && mkdir -pv "${AIRFLOW_HOME}/dags" \
    && mkdir -pv "${AIRFLOW_HOME}/logs" \
    && chown -R airflow:0 "${AIRFLOW_USER_HOME_DIR}" "${AIRFLOW_HOME}" \
    && chmod -R g+rw "${AIRFLOW_USER_HOME_DIR}" "${AIRFLOW_HOME}" \
    && find "${AIRFLOW_HOME}" -executable -print0 | xargs --null chmod g+x \
    && find "${AIRFLOW_USER_HOME_DIR}" -executable -print0 | xargs --null chmod g+x

COPY --chown=airflow:0 --from=airflow-build-image \
     "${AIRFLOW_USER_HOME_DIR}/.local" "${AIRFLOW_USER_HOME_DIR}/.local"
COPY --chown=airflow:0 scripts/prod/entrypoint_prod.sh /entrypoint
COPY --chown=airflow:0 scripts/prod/clean-logs.sh /clean-logs

RUN chmod a+x /entrypoint /clean-logs \
    && chmod g=u /etc/passwd \
    && chmod g+w "${AIRFLOW_USER_HOME_DIR}/.local" \
    && usermod -g 0 airflow -G 0

RUN sed --in-place=.bak "s/secure_path=\"/secure_path=\"\/.venv\/bin:/" /etc/sudoers

ENV DUMB_INIT_SETSID="1" \
    PS1="(airflow)" \
    LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6"

WORKDIR ${AIRFLOW_HOME}
EXPOSE 8080
USER ${AIRFLOW_UID}

ENV C2D_RELEASE 2.2.5

ENTRYPOINT ["/usr/bin/dumb-init", "--", "/entrypoint"]
CMD [""]


text:
using System;
using System.ComponentModel;
using System.Drawing;
using DotSpatial.Serialization;

namespace DotSpatial.Symbology
{
    /// <summary>
    /// Common symbolizer for features.
    /// </summary>
    [TypeConverter(typeof(ExpandableObjectConverter))]
    [Serializable]
    public class FeatureSymbolizer : LegendItem, IFeatureSymbolizer
    {
        #region Fields

        private bool _isVisible;
        private ScaleMode _scaleMode;
        private bool _smoothing;
        private GraphicsUnit _unit;

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="FeatureSymbolizer"/> class.
        /// </summary>
        protected FeatureSymbolizer()
        {
            _scaleMode = ScaleMode.Simple;
            _smoothing = true;
            _isVisible = true;
            _unit = GraphicsUnit.Pixel;
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether or not this specific feature should be drawn.
        /// </summary>
        [Category("Appearance")]
        [Description("Gets or sets a boolean indicating whether or not this should be drawn.")]
        [Serialize("IsVisible")]
        public virtual bool IsVisible
        {
            get
            {
                return _isVisible;
            }

            set
            {
                _isVisible = value;
            }
        }

        /// <summary>
        /// Gets or Sets a ScaleModes enumeration that determines whether non-coordinate drawing
        /// properties like width or size use pixels or world coordinates. If pixels are
        /// specified, a back transform is used to approximate pixel sizes.
        /// </summary>
        [Serialize("ScaleModes")]
        public virtual ScaleMode ScaleMode
        {
            get
            {
                return _scaleMode;
            }

            set
            {
                _scaleMode = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether things should be anti-aliased. By default this is set to antialias.
        /// </summary>
        [Serialize("Smoothing")]
        public virtual bool Smoothing
        {
            get
            {
                return _smoothing;
            }

            set
            {
                _smoothing = value;
            }
        }

        /// <summary>
        /// Gets or sets the graphics unit to work with.
        /// </summary>
        [Serialize("Units")]
        public GraphicsUnit Units
        {
            get
            {
                return _unit;
            }

            set
            {
                _unit = value;
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Draws a simple rectangle in the specified location.
        /// </summary>
        /// <param name="g">The graphics object used for drawing.</param>
        /// <param name="target">The rectangle that gets drawn.</param>
        public virtual void Draw(Graphics g, Rectangle target)
        {
            g.DrawRectangle(Pens.Black, target);
        }

        /// <summary>
        /// Sets the outline, assuming that the symbolizer either supports outlines, or
        /// else by using a second symbol layer.
        /// </summary>
        /// <param name="outlineColor">The color of the outline.</param>
        /// <param name="width">The width of the outline in pixels.</param>
        public virtual void SetOutline(Color outlineColor, double width)
        {
            OnItemChanged(this);
        }

        /// <summary>
        /// Occurs during the copy properties method, when copying properties from the source symbolizer
        /// to this symbolizer.
        /// </summary>
        /// <param name="source">The source symbolizer to copy properties from.</param>
        protected override void OnCopyProperties(object source)
        {
            base.OnCopyProperties(source);
            OnItemChanged();
        }

        #endregion
    }
}


text:
package api

func Screen_Instance() uintptr {
	ret, _, _ := screen_Instance.Call()
	return ret
}


text:
'use strict'

const { Router } = require('express')
const router = Router()

const { json } = require('body-parser')

const session = require('express-session')
const RedisStore = require('connect-redis')(session)

const Users = require('../models/user')
const Tasks = require('../models/task')
const Groups = require('../models/group')

const checkRepeatable = require('../controllers/taskRepeat')
const { checkArray, removeFromArray } = require('../controllers/arrayCtrl')

// get friend lists
router.get('/api/friends', (req, res, err) => {
  Users
    .findById(req.session.user._id)
    .then(user => {
      Users
        .find({ "_id": { $in: user.friends }})
        .then( friends => {
          Users
            .find({ "_id": { $in: user.friendsWaiting }})
            .then( friendsWaiting => {
              Users
                .find({ "_id": { $in: user.friendRequests }})
                .then( friendRequests => {
                  res.status(200).json( { friends, friendsWaiting, friendRequests } )
                })
                .catch(err)
            })
            .catch(err)
        })
        .catch(err)
    })
    .catch(err)
})

// make friend request
router.post('/api/friends', (req, res, err) => {
  const email = req.body.email
  Users
    .findOne({ email })
    .then( friend => {
      Users
        .findOne({ '_id' : req.session.user._id })
        .then( user => {
          if ( checkArray( friend._id, user.friends ) ) {
            res.status(423).json(err)
          } else {
            if ( checkArray( user._id, friend.friendRequests || checkArray( friend._id, user.friendsWaiting ) ) ) {
              res.status(432).json(err)
            } else {
              user.friendsWaiting.push(friend._id)
              friend.friendRequests.push(user._id)
              user.save()
              friend.save()
            }
          }
        })
        .catch(err)
    })
    .catch(err)
})

// accept friend request
router.post('/api/friends/accept/:friendId', (req, res, err) => {
  Users
    .findById( req.params.friendId )
    .then( friend => {
      Users
        .findById( req.session.user._id )
        .then( user => {
          user.friends.push(friend._id)
          friend.friends.push(user._id)
          user.friendRequests.splice(user.friendRequests.indexOf(friend._id), 1)
          friend.friendsWaiting.splice(friend.friendsWaiting.indexOf(user._id), 1)
          user.save()
          friend.save()
          res.status(200)
        })
    })
})

// reject friend request
router.post('/api/friends/reject/:friendId', (req, res, err) => {
  Users
    .findById( req.params.friendId )
    .then( friend => {
      Users
        .findById( req.session.user._id )
        .then( user => {
          user.friendRequests.splice(user.friendRequests.indexOf(friend._id), 1)
          friend.friendsWaiting.splice(friend.friendsWaiting.indexOf(user._id), 1)
          user.save()
          friend.save()
          res.status(200)
        })
    })
})

module.exports = router


text:
package org.broad.igv.sam.mods;

import htsjdk.samtools.util.SequenceUtil;
import org.broad.igv.prefs.PreferencesManager;
import org.broad.igv.sam.Alignment;
import org.broad.igv.sam.AlignmentBlock;
import org.broad.igv.sam.AlignmentTrack;

import java.util.*;

/**
 * @author Jim Robinson
 * @date 2/6/12
 */
public class BaseModificationCounts {

    public static Key Key5mC = new Key('C', '+', "m");
    public static Key Key5mCcomplement = new Key('G', '-', "m");
    public static Key Key5hmC = new Key('C', '+', "hm");
    public static Key Key5hmCcomplement = new Key('G', '-', "hm");

    /**
     * Set of all modification seen.
     */
    LinkedHashSet<Key> allModifications;

    /**
     * Map for counts for each modification (e.g. m, h, etc). Key is base+modification identifier, value is map of position -> count
     */
    Map<Key, Map<Integer, Integer>> counts;

    /**
     * Map for capturing modification likelihood "pileup", key is modification identifier,
     * value is map of position -> sum of likelihoods for modifications at that position
     */
    Map<Key, Map<Integer, Integer>> likelihoodSums;

    public BaseModificationCounts() {
        allModifications = new LinkedHashSet<>();
        counts = new HashMap<>();
        likelihoodSums = new HashMap<>();
    }

    /**
     * Increment modification counts for each position spanned by the supplied alignments.  Currently both thresholded
     * and total counts are tallied to support different coloring schemes.
     *
     * @param alignment
     */
    public void incrementCounts(Alignment alignment) {

        // Only works with block formats
        if (alignment.getAlignmentBlocks() == null) return;

        List<BaseModificationSet> baseModificationSets = alignment.getBaseModificationSets();
        if (baseModificationSets != null) {

            for (AlignmentBlock block : alignment.getAlignmentBlocks()) {

                // Loop through read sequence index ("i")
                for (int i = block.getBases().startOffset; i < block.getBases().startOffset + block.getBases().length; i++) {

                    for (BaseModificationSet bmset : baseModificationSets) {

                        //String modification = bmset.getModification();
                        Key key = new Key(bmset.getBase(), bmset.getStrand(), bmset.getModification());
                        Map<Integer, Byte> likelihoods = bmset.getLikelihoods();

                        if (bmset.containsPosition(i)) {

                            int lh = Byte.toUnsignedInt(likelihoods.get(i));

                            Map<Integer, Integer> modCounts = counts.get(key);
                            if (modCounts == null) {
                                modCounts = new HashMap<>();
                                counts.put(key, modCounts);
                            }

                            Map<Integer, Integer> modLikelihoods = likelihoodSums.get(key);
                            if (modLikelihoods == null) {
                                modLikelihoods = new HashMap<>();
                                likelihoodSums.put(key, modLikelihoods);
                            }

                            int blockIdx = i - block.getBases().startOffset;
                            int position = block.getStart() + blockIdx;   // genomic position

                            int c = modCounts.containsKey(position) ? modCounts.get(position) + 1 : 1;

                            int l = modLikelihoods.containsKey(position) ? modLikelihoods.get(position) + lh : lh;
                            modCounts.put(position, c);
                            modLikelihoods.put(position, l);

                        }
                        allModifications.add(key);
                    }
                }
            }
        }
    }

    public int getCount(int position, Key key) {
        Map<Integer, Integer> modCounts = counts.get(key);
        if (modCounts != null && modCounts.containsKey(position)) {
            return modCounts.get(position);
        } else {
            return 0;
        }
    }

    public int getLikelhoodSum(int position, Key key) {
        Map<Integer, Integer> modLikelihoods = likelihoodSums.get(key);
        if (modLikelihoods != null && modLikelihoods.containsKey(position)) {
            return modLikelihoods.get(position);
        } else {
            return getCount(position, key) * 255;
        }
    }

    public Collection<Key> getAllModifications() {
        return allModifications;
    }

    public String getValueString(int position, AlignmentTrack.ColorOption colorOption) {
        StringBuffer buffer = new StringBuffer();
            for (Map.Entry<Key, Map<Integer, Integer>> entry : counts.entrySet()) {
                String modification = entry.getKey().modification;
                Map<Integer, Integer> modCounts = entry.getValue();
                if (modCounts.containsKey(position)) {
                    final Integer count = modCounts.get(position);
                    int lh = (int) (((100.0f / 255) * getLikelhoodSum(position, entry.getKey())) / count);
                    buffer.append("Modification: " + modification + " (" + count + "  @ " + lh + "%)<br>");
                }
            }
        return buffer.toString();
    }

    /**
     * For debugging
     */
    public void dump() {
        for (Map.Entry<Key, Map<Integer, Integer>> entry : counts.entrySet()) {

            String modification = entry.getKey().toString();
            Map<Integer, Integer> modCounts = entry.getValue();
            System.out.println("Modification: " + modification);
            for (Map.Entry<Integer, Integer> modKey : modCounts.entrySet()) {
                System.out.println(modKey.getKey() + "  " + modKey.getValue());
            }
        }
    }

    public static class Key {
        char base;
        char strand;
        String modification;

        public Key(char base, char strand, String modification) {
            this.base = base;
            this.strand = strand;
            this.modification = modification;
        }

        public char getBase() {
            return base;
        }

        public char getCanonicalBase() {
            return strand == '+' ? base : (char) SequenceUtil.complement((byte) base);
        }

        public char getStrand() {
            return strand;
        }

        public String getModification() {
            return modification;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Key key = (Key) o;
            return base == key.base && strand == key.strand && modification.equals(key.modification);
        }

        @Override
        public int hashCode() {
            return Objects.hash(base, strand, modification);
        }

        @Override
        public String toString() {
            return "" + base + strand + modification;
        }
    }

}


text:
using Common.Logging;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Management.WebSites;
using ScriptCs.AzureManagement.Common;
using ScriptCs.AzureManagement.Common.Credentials;

namespace ScriptCs.AzureManagement.WebSite
{
  public class WebSiteManagement
  {
    private readonly ILog _logger;
    private readonly ICredentialManager _credentialManager;

    public WebSiteManagement(ManagementContext managementContext)
    {
      _logger = managementContext.Logger;
      _credentialManager = managementContext.CredentialManager;
    }

    public WebSiteManagementClient CreateClient()
    {
      var credentials = _credentialManager.GetManagementCredentials();
      return CloudContext.Clients.CreateWebSiteManagementClient(credentials);
    }
  }
}


text:
using namespace appc::schema;

TEST(ImageManifest, ImageManifest) {
  Json json = {{"acKind", "ImageManifest"}};
  auto result = ImageManifest::from_json(json);
  //ASSERT_TRUE(result->validate());
}


text:
require 'rails_helper'

describe PushCourseToSalesforce do
  let(:course) { create(:course, flags: flags, expected_students: 51) }
  let(:content_expert) { create(:admin) }
  let(:subject) { described_class.new(course) }
  let(:salesforce_id) { 'a2qQ0101015h4HF' }
  let(:week) { create(:week, course: course) }

  before do
    Setting.create(key: 'content_expert_salesforce_ids',
                   value: { content_expert.username => 'abcdefg' })
    JoinCourse.new(course: course, user: content_expert,
                   role: CoursesUsers::Roles::WIKI_ED_STAFF_ROLE)
  end

  context 'when a course has a Salesforce record already' do
    let(:flags) { { salesforce_id: salesforce_id } }
    it 'updates the record' do
      expect_any_instance_of(Restforce::Data::Client).to receive(:update!).and_return(true)
      expect(subject.result).to eq(true)
    end

    it 'works for a VisitingScholarship' do
      expect_any_instance_of(Restforce::Data::Client).to receive(:update!).and_return(true)
      visiting_scholarship = create(:visiting_scholarship, flags: flags)
      subject = described_class.new(visiting_scholarship)
      expect(subject.result).to eq(true)
    end

    it 'handles Salesforce API downtime gracefully' do
      expect_any_instance_of(Restforce::Data::Client).to receive(:update!)
        .and_raise(Faraday::ParsingError.new('Salesforce is down'))
      expect(subject.result).to be_nil
    end

    context 'when the course has sandbox and mainspace blocks' do
      before do
        # These are used for generate date for some optional fields.
        create(:block, week: week, title: 'Draft your article')
        create(:block, week: week, title: 'Begin moving your work to Wikipedia')
      end

      it 'sets the sandbox and mainspace assignment blocks' do
        expect_any_instance_of(Restforce::Data::Client).to receive(:update!).and_return(true)
        expect(subject.instance_variable_get(:@sandbox_block)).not_to be_nil
        expect(subject.instance_variable_get(:@mainspace_block)).not_to be_nil
      end
    end

    context 'when the course lacks sandbox and mainspace blocks' do
      it 'the sandbox and mainspace assignment blocks are nil' do
        expect_any_instance_of(Restforce::Data::Client).to receive(:update!).and_return(true)
        expect(subject.instance_variable_get(:@sandbox_block)).to be_nil
        expect(subject.instance_variable_get(:@mainspace_block)).to be_nil
      end
    end
  end

  context 'when a course does not have a Salesforce record' do
    let(:flags) { {} }
    it 'creates the record and saves the ID as a course flag' do
      expect_any_instance_of(Restforce::Data::Client).to receive(:create!).and_return(salesforce_id)
      expect(subject.result).to eq(salesforce_id)
      expect(course.reload.flags[:salesforce_id]).to eq(salesforce_id)
    end
  end
end


text:
using System;
using OpenUtau.Core.Ustx;

namespace OpenUtau.Core {
    public class UNotification : UCommand {
        public UProject project;
        public UPart part;
        public override void Execute() { }
        public override void Unexecute() { }
        public override string ToString() => "Notification";
    }

    public class ErrorMessageNotification : UNotification {
        public readonly string message = string.Empty;
        public readonly Exception e;
        public ErrorMessageNotification(Exception e) {
            this.e = e;
        }
        public ErrorMessageNotification(string message) {
            this.message = message;
        }
        public ErrorMessageNotification(string message, Exception e) {
            this.message = message;
            this.e = e;
        }
        public override string ToString() => $"Error message: {message} {e}";
    }

    public class LoadPartNotification : UNotification {
        public readonly int tick;
        public LoadPartNotification(UPart part, UProject project, int tick) {
            this.part = part;
            this.project = project;
            this.tick = tick;
        }
        public override string ToString() => "Load part";
    }

    public class LoadProjectNotification : UNotification {
        public LoadProjectNotification(UProject project) {
            this.project = project;
        }
        public override string ToString() => "Load project";
    }

    public class SaveProjectNotification : UNotification {
        public string Path;
        public SaveProjectNotification(string path) {
            Path = path;
        }
        public override string ToString() => "Save project";
    }

    public class ValidateProjectNotification : UNotification {
        public override string ToString() => "Validate Project";
    }

    public class PhonemizedNotification : UNotification {
        public override string ToString() => "Phonemized";
    }

    public class SelectExpressionNotification : UNotification {
        public string ExpKey;
        public bool UpdateShadow;
        public int SelectorIndex;
        public SelectExpressionNotification(string expKey, int index, bool updateShadow) {
            ExpKey = expKey;
            SelectorIndex = index;
            UpdateShadow = updateShadow;
        }
        public override string ToString() => $"Select expression {ExpKey}";
    }

    // Notification for UI to move PlayPosMarker
    public class SetPlayPosTickNotification : UNotification {
        public readonly int playPosTick;
        public readonly bool waitingRendering;
        public override bool Silent => true;
        public SetPlayPosTickNotification(int tick, bool waitingRendering = false) {
            playPosTick = tick;
            this.waitingRendering = waitingRendering;
        }
        public override string ToString() => $"Set play position to tick {playPosTick}";
    }

    // Notification for playback manager to change play position
    public class SeekPlayPosTickNotification : UNotification {
        public int playPosTick;
        public override bool Silent => true;
        public SeekPlayPosTickNotification(int tick) {
            playPosTick = tick;
        }
        public override string ToString() => $"Seek play position to tick {playPosTick}";
    }

    public class ProgressBarNotification : UNotification {
        public double Progress;
        public string Info;
        public override bool Silent => true;
        public ProgressBarNotification(double progress, string info) {
            Progress = progress;
            Info = info;
        }
        public override string ToString() => $"Set progress {Progress} {Info}";
    }

    public class VolumeChangeNotification : UNotification {
        public double Volume;
        public int TrackNo;
        public override bool Silent => true;
        public VolumeChangeNotification(int trackNo, double volume) {
            TrackNo = trackNo;
            Volume = volume;
        }
        public override string ToString() => $"Set track {TrackNo} volume to {Volume}";
    }

    public class SoloTrackNotification : UNotification {
        public readonly int trackNo;
        public readonly bool solo;
        public SoloTrackNotification(int trackNo, bool solo) {
            this.trackNo = trackNo;
            this.solo = solo;
        }
        public override string ToString() => $"Solo track {solo}";
    }

    public class SingersChangedNotification : UNotification {
        public SingersChangedNotification() { }
        public override string ToString() => "Singers changed.";
    }

    public class SingersRefreshedNotification : UNotification {
        public SingersRefreshedNotification() { }
        public override string ToString() => "Singers refreshed.";
    }

    public class OtoChangedNotification : UNotification {
        public readonly bool external;
        public OtoChangedNotification(bool external = false) {
            this.external = external;
        }
        public override string ToString() => "Oto changed.";
    }

    public class WillRemoveTrackNotification : UNotification {
        public int TrackNo;
        public WillRemoveTrackNotification(int trackNo) {
            TrackNo = trackNo;
        }
        public override string ToString() => $"Will remove track {TrackNo}.";
    }

    public class FocusNoteNotification : UNotification {
        public readonly UNote note;
        public FocusNoteNotification(UPart part, UNote note) {
            this.part = part;
            this.note = note;
        }
        public override string ToString() => $"Focus note {note.lyric} at {note.position}.";
    }

    public class PreRenderNotification : UNotification {
        public override string ToString() => $"Pre-render notification.";
    }

    public class PartRenderedNotification : UNotification {
        public PartRenderedNotification(UVoicePart part) {
            this.part = part;
        }
        public override string ToString() => "Part rendered.";
    }

    public class GotoOtoNotification : UNotification {
        public readonly USinger singer;
        public readonly UOto oto;
        public GotoOtoNotification(USinger singer, UOto oto) {
            this.singer = singer;
            this.oto = oto;
        }
        public override string ToString() => "Goto oto.";
    }
}