text:
#ifndef QWIDGETLINECONTROL_P_H
#define QWIDGETLINECONTROL_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtWidgets/private/qtwidgetsglobal_p.h>

#ifndef QT_NO_LINEEDIT
#include "private/qwidget_p.h"
#include "QtWidgets/qlineedit.h"
#include "QtGui/qtextlayout.h"
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qpointer.h"
#include "QtGui/qclipboard.h"
#include "QtGui/qinputmethod.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qthread.h"

#include "qplatformdefs.h"

#include <vector>

#ifdef DrawText
#  undef DrawText
#endif

QT_BEGIN_NAMESPACE

class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject
{
    Q_OBJECT

public:
    QWidgetLineControl(const QString &txt = QString())
        : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
        m_hideCursor(false), m_separator(0), m_readOnly(0),
        m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
        m_validInput(1), m_blinkStatus(0), m_blinkEnabled(false), m_blinkTimer(0), m_deleteAllTimer(0),
        m_ascent(0), m_maxLength(32767), m_lastCursorPos(-1),
        m_tripleClickTimer(0), m_maskData(0), m_modifiedState(0), m_undoState(0),
        m_selstart(0), m_selend(0), m_passwordEchoEditing(false)
        , m_passwordEchoTimer(0)
        , m_passwordMaskDelay(-1)
#if 0 // Used to be included in Qt4 for Q_WS_MAC
        , m_threadChecks(false)
        , m_textLayoutThread(0)
 #endif
#if defined(QT_BUILD_INTERNAL)
        , m_passwordMaskDelayOverride(-1)
#endif
        , m_keyboardScheme(0)
        , m_accessibleObject(0)
    {
        init(txt);
    }

    ~QWidgetLineControl()
    {
        delete [] m_maskData;
    }

    void setAccessibleObject(QObject *object)
    {
        Q_ASSERT(object);
        m_accessibleObject = object;
    }

    QObject *accessibleObject()
    {
        if (m_accessibleObject)
            return m_accessibleObject;
        return parent();
    }

    int nextMaskBlank(int pos)
    {
        int c = findInMask(pos, true, false);
        m_separator |= (c != pos);
        return (c != -1 ?  c : m_maxLength);
    }

    int prevMaskBlank(int pos)
    {
        int c = findInMask(pos, false, false);
        m_separator |= (c != pos);
        return (c != -1 ? c : 0);
    }

    bool isUndoAvailable() const;
    bool isRedoAvailable() const;
    void clearUndo() { m_history.clear(); m_modifiedState = m_undoState = 0; }

    bool isModified() const { return m_modifiedState != m_undoState; }
    void setModified(bool modified) { m_modifiedState = modified ? -1 : m_undoState; }

    bool allSelected() const { return !m_text.isEmpty() && m_selstart == 0 && m_selend == (int)m_text.length(); }
    bool hasSelectedText() const { return !m_text.isEmpty() && m_selend > m_selstart; }

    int width() const { return qRound(m_textLayout.lineAt(0).width()) + 1; }
    int height() const { return qRound(m_textLayout.lineAt(0).height()) + 1; }
    int ascent() const { return m_ascent; }
    qreal naturalTextWidth() const { return m_textLayout.lineAt(0).naturalTextWidth(); }

    void setSelection(int start, int length);

    inline QString selectedText() const { return hasSelectedText() ? m_text.mid(m_selstart, m_selend - m_selstart) : QString(); }
    QString textBeforeSelection() const { return hasSelectedText() ? m_text.left(m_selstart) : QString(); }
    QString textAfterSelection() const { return hasSelectedText() ? m_text.mid(m_selend) : QString(); }

    int selectionStart() const { return hasSelectedText() ? m_selstart : -1; }
    int selectionEnd() const { return hasSelectedText() ? m_selend : -1; }
    bool inSelection(int x) const
    {
        if (m_selstart >= m_selend)
            return false;
        int pos = xToPos(x, QTextLine::CursorOnCharacter);
        return pos >= m_selstart && pos < m_selend;
    }

    void removeSelection()
    {
        int priorState = m_undoState;
        removeSelectedText();
        finishChange(priorState);
    }

    int start() const { return 0; }
    int end() const { return m_text.length(); }

#ifndef QT_NO_CLIPBOARD
    void copy(QClipboard::Mode mode = QClipboard::Clipboard) const;
    void paste(QClipboard::Mode mode = QClipboard::Clipboard);
#endif

    int cursor() const{ return m_cursor; }
    int preeditCursor() const { return m_preeditCursor; }

    int cursorWidth() const { return m_cursorWidth; }
    void setCursorWidth(int value) { m_cursorWidth = value; }

    Qt::CursorMoveStyle cursorMoveStyle() const { return m_textLayout.cursorMoveStyle(); }
    void setCursorMoveStyle(Qt::CursorMoveStyle style) { m_textLayout.setCursorMoveStyle(style); }

    void moveCursor(int pos, bool mark = false);
    void cursorForward(bool mark, int steps)
    {
        int c = m_cursor;
        if (steps > 0) {
            while (steps--)
                c = cursorMoveStyle() == Qt::VisualMoveStyle ? m_textLayout.rightCursorPosition(c)
                                                             : m_textLayout.nextCursorPosition(c);
        } else if (steps < 0) {
            while (steps++)
                c = cursorMoveStyle() == Qt::VisualMoveStyle ? m_textLayout.leftCursorPosition(c)
                                                             : m_textLayout.previousCursorPosition(c);
        }
        moveCursor(c, mark);
    }

    void cursorWordForward(bool mark) { moveCursor(m_textLayout.nextCursorPosition(m_cursor, QTextLayout::SkipWords), mark); }
    void cursorWordBackward(bool mark) { moveCursor(m_textLayout.previousCursorPosition(m_cursor, QTextLayout::SkipWords), mark); }

    void home(bool mark) { moveCursor(0, mark); }
    void end(bool mark) { moveCursor(text().length(), mark); }

    int xToPos(int x, QTextLine::CursorPosition = QTextLine::CursorBetweenCharacters) const;
    QRect rectForPos(int pos) const;
    QRect cursorRect() const;
    QRect anchorRect() const;

    qreal cursorToX(int cursor) const { return m_textLayout.lineAt(0).cursorToX(cursor); }
    qreal cursorToX() const
    {
        int cursor = m_cursor;
        if (m_preeditCursor != -1)
            cursor += m_preeditCursor;
        return cursorToX(cursor);
    }

    bool isReadOnly() const { return m_readOnly; }
    void setReadOnly(bool enable);

    QString text() const
    {
        QString content = m_text;
        QString res = m_maskData ? stripString(content) : content;
        return (res.isNull() ? QString::fromLatin1("") : res);
    }
    void setText(const QString &txt)
    {
#ifndef QT_NO_IM
        if (composeMode())
            QGuiApplication::inputMethod()->reset();
#endif
        internalSetText(txt, -1, false);
    }
    void commitPreedit();

    QString displayText() const { return m_textLayout.text(); }

    void backspace();
    void del();
    void deselect() { internalDeselect(); finishChange(); }
    void selectAll() { m_selstart = m_selend = m_cursor = 0; moveCursor(m_text.length(), true); }

    void insert(const QString &);
    void clear();
    void undo();
    void redo() { internalRedo(); finishChange(); }
    void selectWordAtPos(int);

    uint echoMode() const { return m_echoMode; }
    void setEchoMode(uint mode)
    {
        cancelPasswordEchoTimer();
        m_echoMode = mode;
        m_passwordEchoEditing = false;
        updateDisplayText();
    }

    int maxLength() const { return m_maxLength; }
    void setMaxLength(int maxLength)
    {
        if (m_maskData)
            return;
        m_maxLength = maxLength;
        setText(m_text);
    }

#ifndef QT_NO_VALIDATOR
    const QValidator *validator() const { return m_validator; }
    void setValidator(const QValidator *v) { m_validator = const_cast<QValidator*>(v); }
#endif

#ifndef QT_NO_COMPLETER
    QCompleter *completer() const { return m_completer; }
    /* Note that you must set the widget for the completer separately */
    void setCompleter(const QCompleter *c) { m_completer = const_cast<QCompleter*>(c); }
    void complete(int key);
#endif

    int cursorPosition() const { return m_cursor; }
    void setCursorPosition(int pos) { if (pos <= m_text.length()) moveCursor(qMax(0, pos)); }

    bool hasAcceptableInput() const { return hasAcceptableInput(m_text); }
    bool fixup();

    QString inputMask() const
    {
        QString mask;
        if (m_maskData) {
            mask = m_inputMask;
            if (m_blank != QLatin1Char(' ')) {
                mask += QLatin1Char(';');
                mask += m_blank;
            }
        }
        return mask;
    }
    void setInputMask(const QString &mask)
    {
        parseInputMask(mask);
        if (m_maskData)
            moveCursor(nextMaskBlank(0));
    }

    // input methods
#ifndef QT_NO_IM
    bool composeMode() const { return !m_textLayout.preeditAreaText().isEmpty(); }
    void setPreeditArea(int cursor, const QString &text) { m_textLayout.setPreeditArea(cursor, text); }
#endif

    QString preeditAreaText() const { return m_textLayout.preeditAreaText(); }

    void updatePasswordEchoEditing(bool editing);
    bool passwordEchoEditing() const {
        if (m_passwordEchoTimer != 0)
            return true;
        return m_passwordEchoEditing ;
    }

    QChar passwordCharacter() const { return m_passwordCharacter; }
    void setPasswordCharacter(QChar character) { m_passwordCharacter = character; updateDisplayText(); }

    int passwordMaskDelay() const { return m_passwordMaskDelay; }
    void setPasswordMaskDelay(int delay) { m_passwordMaskDelay = delay; }

    Qt::LayoutDirection layoutDirection() const {
        if (m_layoutDirection == Qt::LayoutDirectionAuto) {
            if (m_text.isEmpty())
                return QGuiApplication::inputMethod()->inputDirection();
            return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
        }
        return m_layoutDirection;
    }
    void setLayoutDirection(Qt::LayoutDirection direction)
    {
        if (direction != m_layoutDirection) {
            m_layoutDirection = direction;
            updateDisplayText();
        }
    }

    void setFont(const QFont &font) { m_textLayout.setFont(font); updateDisplayText(); }

    void processInputMethodEvent(QInputMethodEvent *event);
    void processKeyEvent(QKeyEvent* ev);

    void setBlinkingCursorEnabled(bool enable);
    void updateCursorBlinking();
    void resetCursorBlinkTimer();

    bool cursorBlinkStatus() const { return m_blinkStatus; }

    QString cancelText() const { return m_cancelText; }
    void setCancelText(const QString &text) { m_cancelText = text; }

    const QPalette &palette() const { return m_palette; }
    void setPalette(const QPalette &p) { m_palette = p; }

    enum DrawFlags {
        DrawText = 0x01,
        DrawSelections = 0x02,
        DrawCursor = 0x04,
        DrawAll = DrawText | DrawSelections | DrawCursor
    };
    void draw(QPainter *, const QPoint &, const QRect &, int flags = DrawAll);

#ifndef QT_NO_SHORTCUT
    void processShortcutOverrideEvent(QKeyEvent *ke);
#endif

    QTextLayout *textLayout() const
    {
#if 0 // Used to be included in Qt4 for Q_WS_MAC
        if (m_threadChecks && QThread::currentThread() != m_textLayoutThread)
            redoTextLayout();
#endif
        return &m_textLayout;
    }

#if 0 // Used to be included in Qt4 for Q_WS_MAC
    void setThreadChecks(bool threadChecks)
    {
        m_threadChecks = threadChecks;
    }

    bool threadChecks() const
    {
        return m_threadChecks;
    }
#endif

private:
    void init(const QString &txt);
    void removeSelectedText();
    void internalSetText(const QString &txt, int pos = -1, bool edited = true);
    void updateDisplayText(bool forceUpdate = false);

    void internalInsert(const QString &s);
    void internalDelete(bool wasBackspace = false);
    void internalRemove(int pos);

    inline void internalDeselect()
    {
        m_selDirty |= (m_selend > m_selstart);
        m_selstart = m_selend = 0;
    }

    void internalUndo(int until = -1);
    void internalRedo();

    QString m_text;
    QPalette m_palette;
    int m_cursor;
    int m_preeditCursor;
    int m_cursorWidth;
    Qt::LayoutDirection m_layoutDirection;
    uint m_hideCursor : 1; // used to hide the m_cursor inside preedit areas
    uint m_separator : 1;
    uint m_readOnly : 1;
    uint m_dragEnabled : 1;
    uint m_echoMode : 2;
    uint m_textDirty : 1;
    uint m_selDirty : 1;
    uint m_validInput : 1;
    uint m_blinkStatus : 1;
    uint m_blinkEnabled : 1;
    int m_blinkTimer;
    int m_deleteAllTimer;
    int m_ascent;
    int m_maxLength;
    int m_lastCursorPos;
    QList<int> m_transactions;
    QPoint m_tripleClick;
    int m_tripleClickTimer;
    QString m_cancelText;

    void emitCursorPositionChanged();

    bool finishChange(int validateFromState = -1, bool update = false, bool edited = true);

#ifndef QT_NO_VALIDATOR
    QPointer<QValidator> m_validator;
#endif
    QPointer<QCompleter> m_completer;
#ifndef QT_NO_COMPLETER
    bool advanceToEnabledItem(int dir);
#endif

    struct MaskInputData {
        enum Casemode { NoCaseMode, Upper, Lower };
        QChar maskChar; // either the separator char or the inputmask
        bool separator;
        Casemode caseMode;
    };
    QString m_inputMask;
    QChar m_blank;
    MaskInputData *m_maskData;

    // undo/redo handling
    enum CommandType { Separator, Insert, Remove, Delete, RemoveSelection, DeleteSelection, SetSelection };
    struct Command {
        inline Command(CommandType t, int p, QChar c, int ss, int se) : type(t),uc(c),pos(p),selStart(ss),selEnd(se) {}
        uint type : 4;
        QChar uc;
        int pos, selStart, selEnd;
    };
    int m_modifiedState;
    int m_undoState;
    std::vector<Command> m_history;
    void addCommand(const Command& cmd);

    inline void separate() { m_separator = true; }

    // selection
    int m_selstart;
    int m_selend;

    // masking
    void parseInputMask(const QString &maskFields);
    bool isValidInput(QChar key, QChar mask) const;
    bool hasAcceptableInput(const QString &text) const;
    QString maskString(uint pos, const QString &str, bool clear = false) const;
    QString clearString(uint pos, uint len) const;
    QString stripString(const QString &str) const;
    int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const;

    // complex text layout (must be mutable so it can be reshaped at will)
    mutable QTextLayout m_textLayout;

    bool m_passwordEchoEditing;
    QChar m_passwordCharacter;
    int m_passwordEchoTimer;
    int m_passwordMaskDelay;
    void cancelPasswordEchoTimer()
    {
        if (m_passwordEchoTimer != 0) {
            killTimer(m_passwordEchoTimer);
            m_passwordEchoTimer = 0;
        }
    }

    int redoTextLayout() const;
#if 0 // Used to be included in Qt4 for Q_WS_MAC
    bool m_threadChecks;
    mutable QThread *m_textLayoutThread;
#endif

public:
#if defined(QT_BUILD_INTERNAL)
    int m_passwordMaskDelayOverride;
#endif

Q_SIGNALS:
    void cursorPositionChanged(int, int);
    void selectionChanged();

    void displayTextChanged(const QString &);
    void textChanged(const QString &);
    void textEdited(const QString &);

    void resetInputContext();
    void updateMicroFocus();

    void accepted();
    void editingFinished();
    void updateNeeded(const QRect &);

#ifdef QT_KEYPAD_NAVIGATION
    void editFocusChange(bool);
#endif
protected:
    virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;

private Q_SLOTS:
    void _q_deleteSelected();

private:
    int m_keyboardScheme;

    // accessibility events are sent for this object
    QObject *m_accessibleObject;
};

QT_END_NAMESPACE

#endif // QT_NO_LINEEDIT

#endif // QWIDGETLINECONTROL_P_H


text:
module Netstat
  PROC_NET_TCP = "/proc/net/tcp"

  # States from http://snippets.dzone.com/posts/show/12653
  TCP_STATES = {
    '00' => 'UNKNOWN',  # Bad state ... Impossible to achieve ...
    'FF' => 'UNKNOWN',  # Bad state ... Impossible to achieve ...
    '01' => 'ESTABLISHED',
    '02' => 'SYN_SENT',
    '03' => 'SYN_RECV',
    '04' => 'FIN_WAIT1',
    '05' => 'FIN_WAIT2',
    '06' => 'TIME_WAIT',
    '07' => 'CLOSE',
    '08' => 'CLOSE_WAIT',
    '09' => 'LAST_ACK',
    '0A' => 'LISTEN',
    '0B' => 'CLOSING'
  }

  # Read all the TCP data and return it.
  def self.read_tcp
    sockets = []
    File.readlines(PROC_NET_TCP)[1..-1].each do |line|
      # These are currently the fields listed in /proc/net/tcp
      # sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode
      splitline = line.split
      localaddr, localport = splitline[1].split(':')
      remoteaddr, remoteport = splitline[2].split(':')
      socket = {
        :remote_address => remoteaddr,
        :remote_address_quad => [remoteaddr].pack("H*").unpack("C*").reverse.join("."),
        :remote_port => remoteport.to_i(16),
        :local_address => localaddr,
        :local_address_quad => [localaddr].pack("H*").unpack("C*").reverse.join("."),
        :local_port => localport.to_i(16),
        :state => TCP_STATES[splitline[3]]
      }

      sockets << socket
    end
    return sockets
  end

  # Takes a hash with the key and value to search for and returns all
  # matches.  If there are multiple parameters, has an AND behavior.
  def self.filter(params)
    return Netstat.read_tcp.select do |sock|
      retval = true
      params.keys.each do |k|
        unless sock[k] && (sock[k].to_s == params[k].to_s)
          retval = false
          break
        end
      end
      retval
    end
  end

end

redpajama_set_name: RedPajamaGithub


text:
"""Pale is an HTTP API specification tool for Flask and webapp2."""

import inspect
import logging
from os import path
import types
import re

from . import adapters
from . import arguments
from . import config
from . import context
from . import doc
from .endpoint import (Endpoint,
                        PatchEndpoint, ResourcePatch,
                        PutResourceEndpoint,
                        )
from .resource import NoContentResource, Resource, ResourceList

try:
    """Google App Engine won't let you read a file from the file system like
    this, so __version__ will be different on a GAE server when used in
    production.  In real world use cases, we don't really expect this to be
    a problem, since the __version__ string is usually just useful for
    debugging."""
    with open(path.join(path.dirname(__file__), 'VERSION')) as version_file:
        __version__ = version_file.read().strip()
except Exception, exc:
    logging.warn(
        "Pale's VERSION file couldn't be loaded. __version__ will be inaccurate.")
    __version__ = None

ImplementationModule = "_pale__api_implementation"

def is_pale_module(obj):
    is_it = isinstance(obj, types.ModuleType) and \
            hasattr(obj, '_module_type') and \
            obj._module_type == ImplementationModule
    return is_it

def extract_endpoints(api_module):
    """Return the endpoints from an API implementation module.

    The results returned by this are used to populate your HTTP layer's
    route handler, as well as by the documentation generator.
    """
    if not hasattr(api_module, 'endpoints'):
        raise ValueError(("pale.extract_endpoints expected the passed in "
            "api_module to have an `endpoints` attribute, but it didn't!"))

    endpoints = api_module.endpoints
    if isinstance(endpoints, types.ModuleType):
        classes = [v for (k,v) in inspect.getmembers(endpoints,
                                                     inspect.isclass)]
    elif isinstance(endpoints, (list, tuple)):
        classes = endpoints
    else:
        raise ValueError("Endpoints is not a module or list type!")

    instances = []

    for cls in classes:
        if cls not in (Endpoint, PatchEndpoint, PutResourceEndpoint) and \
                Endpoint in inspect.getmro(cls):
            source_code = inspect.getsource(cls)
            if "@requires_permission" in source_code:
                permission_match = re.search(r"@requires_permission\(\[?[\'\"]+(\w+)[\'\"]+", source_code)
                if permission_match != None:
                    cls._requires_permission = permission_match.group(1)
            instances.append(cls())
    return instances

def extract_resources(api_module):
    """Return the resources from an API implementation module.

    The results returned here are used to generate documentation.  They aren't
    currently used for anything in production.
    """
    endpoints = extract_endpoints(api_module)
    resource_classes = [ e._returns.__class__ for e in endpoints ]

    return list(set(resource_classes))


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
var pkg = require('../../package'),
    core = require('gengojs-core'),
    pack = require('gengojs-default-pack');

exports.default = (function () {
  'use strict'
  /**
   * Global scope
   * @private
   */
  ;
  var global;

  function hapi(plugin, options, next) {
    plugin.ext('onPreHandler', function (request, reply) {
      global.ship.bind(global)(request);
      reply.continue();
    });
    plugin.ext('onPreResponse', function (request, reply) {
      global.ship.bind(global)(request);
      reply.continue();
    });
    next();
  }

  var gengo = function gengo(options) {
    var plugins = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

    global = core(options, plugins, pack());
    var register = hapi;
    register.attributes = {
      name: pkg.name
    };
    return {
      register: register,
      options: options || {}
    };
  };
  /**
   * @method clone
   * @description Returns the API.
   * @return {Function} The API.
   * @public
   */
  gengo.clone = function () {
    return global.assign.apply(global, arguments);
  };
  /**
   * version.
   * @type {String}
   * @public
   */
  gengo.version = pkg.version;
  // Export
  return gengo;
})();
//# sourceMappingURL=../source maps/hapi/index.js.map


text:
package org.bidtime.dbutils.gson;

public enum PropAdapt {
	NULL, NOTNULL, FULL
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace DotVVM.Framework.Security {
    // For various purposes within DotVVM (ViewModel protection, CSRF blocking...) we need
    // number of cryptographic keys. From crypto perspective it's unwise to reuse symmetric
    // keys and is not feasible to request a whole bunch of them from user.
    //
    // So we need some key derivation function (KDF), to use it for generating specific keys
    // from single specified master one. Sadly, .NET Framework does not offer any key-based
    // KDF (KBKDF), only password-based oned (PBKDF, like Rfc2898DeriveBytes). So I had to
    // implement one. I'm not too happy about writing crypto on this level myself, but there
    // is no other way currently.
    //
    // The following is implementation of KBKDF according to the NIST SP800-108 standard,
    // using HMAC as PRF and working in counter mode. See the followinf URL for specification:
    // http://csrc.nist.gov/publications/nistpubs/800-108/sp800-108.pdf

    /// <summary>
    /// This class is implementation of the Key-based Key Derivation Function (KBKDF), as specified in the NIST SP800-108 standard.
    /// </summary>
    internal class NistSP800108DeriveBytes : DeriveBytes {
        private byte[] labelBytes, contextBytes;
        private HMAC pseudoRandomFunction;

        /// <summary>
        /// Initializes a new instance of the NistSP800108DeriveBytes using HMACSHA512 algorithm.
        /// </summary>
        /// <param name="masterKey">The master key to derive from.</param>
        /// <param name="label">The primary purpose string.</param>
        /// <param name="context">The secondary purpose strings.</param>
        public NistSP800108DeriveBytes(byte[] masterKey, string label, string[] context)
            : this(masterKey, label, context, new HMACSHA512()) { }

        /// <summary>
        /// Initializes a new instance of the NistSP800108DeriveBytes using specified algorithm.
        /// </summary>
        /// <param name="masterKey">The master key to derive from.</param>
        /// <param name="label">The primary purpose string.</param>
        /// <param name="context">The secondary purpose strings.</param>
        /// <param name="pseudoRandomFunction">The HMAC function to use as PRF.</param>
        public NistSP800108DeriveBytes(byte[] masterKey, string label, string[] context, HMAC pseudoRandomFunction) {
            // Validate arguments
            if (masterKey == null) throw new ArgumentNullException("masterKey");
            if (masterKey.Length == 0) throw new ArgumentException("The argument cannot be empty.", "masterKey");
            if (label == null) throw new ArgumentNullException("label");
            if (string.IsNullOrWhiteSpace(label)) throw new ArgumentException("Value cannot be empty or whitespace only string.", "label");
            if (pseudoRandomFunction == null) throw new ArgumentNullException("pseudoRandomFunction");

            // Setup internal parameters
            this.pseudoRandomFunction = pseudoRandomFunction;
            this.pseudoRandomFunction.Key = masterKey;

            // Convert label and context to byte arrays
            var safeUtf8 = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
            this.labelBytes = safeUtf8.GetBytes(label);
            if(context== null || context.Length > 0) {
                this.contextBytes = new byte[0];
            }
            else {
                using (MemoryStream stream = new MemoryStream())
                using (BinaryWriter writer = new BinaryWriter(stream, safeUtf8)) {
                    foreach (string item in context) {
                        if (string.IsNullOrWhiteSpace(item)) continue;  // Skip empty context item
                        writer.Write(item);
                    }
                    this.contextBytes = stream.ToArray();
                }
            }
        }

        /// <summary>
        /// Returns pseudo-random key bytes.
        /// </summary>
        /// <param name="cb">Number of bytes to generate</param>
        /// <returns>Returns pseudo-random key bytes.</returns>
        public override byte[] GetBytes(int cb) {
            if (cb < 1) throw new ArgumentOutOfRangeException("cb");
            var cbBits = (uint)cb * 8;

            checked {
                // Initialize buffer to generate new key from.
                // The buffer structure is:
                //      Step counter    (4 bytes)           sequentially increased counter
                //      Label           (variable length)   primary purpose
                //      0x00            (1 byte)            separator
                //      Context         (variable length)   secondary purpose
                //      Length          (4 bytes)           size of derived key
                var bufferLength = 4 + this.labelBytes.Length + 1 + this.contextBytes.Length + 4;
                var buffer = new byte[bufferLength];
                Buffer.BlockCopy(this.labelBytes, 0, buffer, 4, this.labelBytes.Length);
                if (this.contextBytes.Length > 0) Buffer.BlockCopy(this.contextBytes, 0, buffer, this.labelBytes.Length + 4 + 1, this.contextBytes.Length);
                Buffer.BlockCopy(UInt32ToByteArrayBigEndian(cbBits), 0, buffer, buffer.Length - 4, 4);

                // Calculate output
                // We compute HMAC of changing buffer (increasing the counter part) and join it to generate
                // required number of output bytes
                var bytesRemaining = cb;
                var bytesWritten = 0;
                var output = new byte[cb];
                uint stepCounter = 1;
                while (bytesRemaining > 0) {
                    Buffer.BlockCopy(UInt32ToByteArrayBigEndian(stepCounter), 0, buffer, 0, 4);
                    var stepKey = this.pseudoRandomFunction.ComputeHash(buffer);
                    var bytesCopied = Math.Min(bytesRemaining, stepKey.Length);
                    Buffer.BlockCopy(stepKey, 0, output, bytesWritten, bytesCopied);
                    bytesWritten += bytesCopied;
                    bytesRemaining -= bytesCopied;
                    stepCounter++;
                }
                return output;
            }
        }

        /// <summary>
        /// Resets the state of the operation.
        /// </summary>
        public override void Reset() {
            // NOOP
        }

        protected override void Dispose(bool disposing) {
            base.Dispose(disposing);
            if (disposing) {
                this.pseudoRandomFunction.Dispose();
            }
        }

        private static byte[] UInt32ToByteArrayBigEndian(uint value) {
            return new byte[] {
                (byte)(value >> 24),
                (byte)(value >> 16),
                (byte)(value >> 8),
                (byte)(value)
            };
        }

    }
}


text:
const {
  assertSame, assertThrows
} = Assert;

// 22.2.3.2, 22.2.3.3, 22.2.3.17: Incorrect detached buffer checks
// https://bugs.ecmascript.org/show_bug.cgi?id=2908

// let ta = new class extends Int16Array { constructor() { /* no super */ } };
// assertThrows(TypeError, () => ta.byteLength);
// assertThrows(TypeError, () => ta.byteOffset);
// assertThrows(TypeError, () => ta.length);
// assertThrows(TypeError, () => ta.buffer);

let buf = new ArrayBuffer(10);
// Int16Array.call(ta, buf, 2, 3);
let ta = new Int16Array(buf, 2, 3);
assertSame(6, ta.byteLength);
assertSame(2, ta.byteOffset);
assertSame(3, ta.length);
assertSame(buf, ta.buffer);

// Internal API call to detach buffer
detachArrayBuffer(buf);

assertSame(0, ta.byteLength);
assertSame(0, ta.byteOffset);
assertSame(0, ta.length);
assertSame(buf, ta.buffer);


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.livescribe.community.orm">
	<class name="Country" table="Country">

		<id name="primaryKey" column="primaryKey" type="binary">
			<generator class="assigned"/>
		</id>

		<property name="isActive"			column="isActive"			type="integer" />
		<property name="IsoCode2"			column="ISOCode2"			type="string"	length="2" />
		<property name="IsoCode3"			column="ISOCode3"			type="string"	length="3" />
		<property name="IsoNumericCode"		column="ISONumericCode"		type="integer" />
		<property name="metaInfo"			column="metaInfo"			type="clob" />
		<property name="name"				column="name"				type="string"	length="64" />

	</class>
</hibernate-mapping>


text:
#include "geo_reader_3ds.h"

#include <algorithm>
#include <fstream>

#include "utils/string_helpers.h"
#include "utils/file_helpers.h"

#include "objects/mesh.h"
#include "objects/compound_object.h"
#include "materials/standard_material.h"

namespace Imagine
{

GeoReader3ds::GeoReader3ds() : GeoReader()
{
}

bool GeoReader3ds::readFile(const std::string& path, const GeoReaderOptions& options)
{
	m_readOptions = options;

	std::fstream fileStream(path.c_str(), std::ios::in | std::ios::binary);

	if (!fileStream)
		return false;

	m_originalPath = path;

	m_pNewMesh = new Mesh();
	EditableGeometryInstance* pNewGeoInstance = new EditableGeometryInstance();
	m_pNewMesh->setGeometryInstance(pNewGeoInstance);

	processChunks(fileStream, options);

	fileStream.close();

	// make sure the last subobject gets added
	if (m_pNewMesh)
	{
		if (!getSubObjectPoints(m_pNewMesh).empty())
		{
			m_pNewMesh->getGeometryInstance()->calculateBoundaryBox();
			m_aSubObjects.emplace_back(m_pNewMesh);
		}
	}

	if (m_aSubObjects.empty())
	{
		// we've got nothing

		if (m_pNewMesh)
			delete m_pNewMesh;

		return false;
	}

	// rotate 90 deg on x axis
	Matrix4 rotate;
	rotate.setRotationX(-90.0f);

	if (m_aSubObjects.size() == 1)
	{
		// just the one object
		m_newObject = m_aSubObjects[0];

		Mesh* pMeshObj = dynamic_cast<Mesh*>(m_newObject);
		EditableGeometryInstance* pGeoInstance = reinterpret_cast<EditableGeometryInstance*>(pMeshObj->getGeometryInstance());

		if (options.rotate90NegX)
		{
			applyMatrixToMesh(rotate, pMeshObj, true);
		}
		else
		{
			std::deque<Face>::iterator itFace = pGeoInstance->getFaces().begin();
			for (; itFace != pGeoInstance->getFaces().end(); ++itFace)
			{
				Face& face = *itFace;
				face.calculateNormal(pGeoInstance);
			}
		}
	}
	else
	{
		CompoundObject* pCO = new CompoundObject();

		std::vector<Object*>::iterator it = m_aSubObjects.begin();
		for (; it != m_aSubObjects.end(); ++it)
		{
			Object* pObject = *it;

			Mesh* pMeshObj = dynamic_cast<Mesh*>(pObject);
			EditableGeometryInstance* pGeoInstance = reinterpret_cast<EditableGeometryInstance*>(pMeshObj->getGeometryInstance());

			if (options.rotate90NegX)
			{
				applyMatrixToMesh(rotate, pMeshObj, true);
			}
			else
			{
				std::deque<Face>::iterator itFace = pGeoInstance->getFaces().begin();
				for (; itFace != pGeoInstance->getFaces().end(); ++itFace)
				{
					Face& face = *itFace;
					face.calculateNormal(pGeoInstance);
				}
			}

			pCO->addObject(pMeshObj);
		}

		m_newObject = pCO;
	}

	postProcess();

	MaterialManager& mm = m_newObject->getMaterialManager();

	// add materials
	std::map<std::string, StandardMaterial*>::iterator itMat = m_materials.materials.begin();
	for (; itMat != m_materials.materials.end(); ++itMat)
	{
		StandardMaterial* pBMaterial = (*itMat).second;

		Material* pMaterial = static_cast<Material*>(pBMaterial);

		mm.addMaterial(pMaterial, true);

		m_aNewMaterials.emplace_back(pMaterial);
	}

	return true;
}

bool GeoReader3ds::processChunks(std::fstream& stream, const GeoReaderOptions& options)
{
	unsigned int vertexCount = 0;
	unsigned int lastVertexCount = 0;
	while (true)
	{
		unsigned short chunkID = readShort(stream);
		uint32_t chunkLength = readLong(stream);

		switch (chunkID)
		{
			case 0x4D4D: // main chunk
				break;
			case 0x3d3d: // 3d editor
				break;
			case 0x4000: // object
			{
				// read in name
				std::string name;
				char cName;
				unsigned int count = 0;
				do
				{
					stream.read((char *) &cName, sizeof(char));
					count ++;
					if (cName != 0)
						name += cName;
				}
				while (cName != 0 && count < 20);

				if (m_pNewMesh)
				{
					m_pNewMesh->setName(name);
				}

				break;
			}
			case 0x4100: // triangle mesh
			{
				// if we don't want compound objects, ignore this so we just get a single mesh
				if (!options.importCompoundObjects)
					continue;

				// new object - allocate a new mesh if the current one's valid
				// if it's valid, add the old one to the list
				if (m_pNewMesh)
				{
					if (!getSubObjectPoints(m_pNewMesh).empty())
					{
						m_pNewMesh->getGeometryInstance()->calculateBoundaryBox();
						m_aSubObjects.emplace_back(m_pNewMesh);
					}
				}
				// create the new one
				m_pNewMesh = new Mesh();
				EditableGeometryInstance* pNewGeoInstance = new EditableGeometryInstance();
				m_pNewMesh->setGeometryInstance(pNewGeoInstance);
				m_pNewMesh->setMaterial(m_pNewMesh->getMaterialManager().getMaterialFromID(1));

				break;
			}
			case 0x4110: // vertices
			{
				unsigned short numVertices = readShort(stream);

				for (unsigned int i = 0; i < numVertices; i++)
				{
					float x = readFloat(stream);
					float y = readFloat(stream);
					float z = readFloat(stream);

					Point newPoint(x, y, z);

					getSubObjectPoints(m_pNewMesh).emplace_back(newPoint);
				}

				if (options.importCompoundObjects)
					continue;

				lastVertexCount = vertexCount;
				vertexCount += numVertices;

				break;
			}
			case 0x4120: // faces
			{
				unsigned int vertexOffset = lastVertexCount;
				unsigned short numFaces = readShort(stream);

				bool haveUVs = !getSubObjectVertexUVs(m_pNewMesh).empty();

				for (unsigned int i = 0; i < numFaces; i++)
				{
					unsigned int vert1 = readShort(stream);
					unsigned int vert2 = readShort(stream);
					unsigned int vert3 = readShort(stream);

					// read in the flags
					readShort(stream);

					Face newFace(vert1 + vertexOffset, vert2 + vertexOffset, vert3 + vertexOffset);

					if (haveUVs)
					{
						newFace.addUV(vert1 + vertexOffset);
						newFace.addUV(vert2 + vertexOffset);
						newFace.addUV(vert3 + vertexOffset);
					}

					getSubObjectFaces(m_pNewMesh).emplace_back(newFace);
				}

				if (haveUVs)
					m_pNewMesh->getGeometryInstance()->setHasPerVertexUVs(true);

				break;
			}
			case 0x4130: // faces material
			{
				// read in name
				std::string materialName;

				char cName;
				unsigned int count = 0;
				do
				{
					stream.read((char *) &cName, sizeof(char));
					count ++;
					if (cName != 0)
						materialName += cName;
				}
				while (cName != 0 && count < 80);

				if (options.importMaterials && m_materials.hasMaterialName(materialName))
				{
					StandardMaterial* pStandardMaterial = m_materials.materials[materialName];

					Material* pMaterial = static_cast<Material*>(pStandardMaterial);
					m_pNewMesh->setMaterial(pMaterial);
				}

				unsigned short numFaces = readShort(stream);

				for (unsigned int i = 0; i < numFaces; i++)
				{
					readShort(stream);
				}

				break;
			}
			case 0x4140: // UV co-ords
			{
				unsigned short numUVs = readShort(stream);

				for (unsigned int i = 0; i < numUVs; i++)
				{
					float u = readFloat(stream);
					float v = readFloat(stream);

					UV newUV(u, v);

					getSubObjectVertexUVs(m_pNewMesh).emplace_back(newUV);
				}
				break;
			}
			case 0x4160: // local coords
			{
				Matrix4 localMatrix;
				processMeshMatrix(stream, localMatrix);

	//			std::deque<Point>& points = getSubObjectPoints(m_pNewMesh);
	//			applyMatrixToPoints(points, localMatrix);

				break;
			}
			case 0xAFFF: // materials
			{
				processMaterialChunks(stream);

				break;
			}
			case 0xB011: // instance
			{
				break;
			}
			case 0xb013: // pivot
			{
				Vector pivotPos;
				pivotPos.x = readFloat(stream);
				pivotPos.y = readFloat(stream);
				pivotPos.z = readFloat(stream);
				break;
			}
			case 0xB020: // position animation track (for initial position)
			{
				Vector finalPosition;
				processPositionChunks(stream, finalPosition);

		//		Point finalPos(finalPosition);

//				m_pNewMesh->setPosition(finalPos);

				break;
			}
			default:
			{
				stream.seekg(chunkLength - 6, std::ios_base::cur);
				break;
			}
		}

		if (stream.eof() || stream.fail())
			break;
	}

	return true;
}

bool GeoReader3ds::processMaterialChunks(std::fstream& stream)
{
	StandardMaterial* pMaterial = new StandardMaterial();

	bool process = true;

	int lastColour = -1;

	while (process)
	{
		unsigned short chunkID = readShort(stream);
		uint32_t chunkLength = readLong(stream);

		switch (chunkID)
		{
			case 0xA000: // material name
			{
//				stream.seekg(6, std::ios_base::cur);
				std::string name;
				// read in name
				char cName;
				unsigned int count = 0;
				do
				{
					stream.read((char *) &cName, sizeof(char));
					count ++;
					if (cName != 0)
						name += cName;
				}
				while (cName != 0 && count < 80);

				std::string newName = name;
				pMaterial->setName(newName);

				break;
			}
			case 0x0010: // float colour
			{
				float r = readFloat(stream);
				float g = readFloat(stream);
				float b = readFloat(stream);

				if (lastColour != -1)
				{
					Colour3f colour(r, g, b);
					if (lastColour == 1)
						pMaterial->setDiffuseColour(colour);
					else if (lastColour == 2)
						pMaterial->setSpecularColour(colour);
				}

				break;
			}
			case 0x0011: // 24-bit colour
			{
				unsigned char r = readChar(stream);
				unsigned char g = readChar(stream);
				unsigned char b = readChar(stream);

				if (lastColour != -1)
				{
					Colour3f colour(r / 255.0f, g / 255.0f, b / 255.0f);
					if (lastColour == 1)
						pMaterial->setDiffuseColour(colour);
					else if (lastColour == 2)
						pMaterial->setSpecularColour(colour);
				}

				break;
			}
			case 0xA010: // ambient colour
			{
//				lastColour = 0;

				break;
			}
			case 0xA020: // diffuse colour
			{
				lastColour = 1;

				break;
			}
			case 0xA030: // specular colour
			{
				lastColour = 2;

				break;
			}
			case 0xA040: // shininess
			{
//				lastColour = -1;
				break;
			}
			case 0xA041: // shine strength
			{
//				lastColour = -1;
				break;
			}
			case 0xA050: // transparency
			{
//				lastColour = -1;
				break;
			}
			case 0xA200: // texture map
			{
				std::string name;
				// read in name
				char cName;
				unsigned int count = 0;
				do
				{
					stream.read((char *) &cName, sizeof(char));
					count ++;
					if (cName != 0)
						name += cName;
				}
				while (cName != 0 && count < 80);

				std::string diffuseTextureMapFile = name;

				if (!diffuseTextureMapFile.empty())
				{
					if (diffuseTextureMapFile.find('.') != std::string::npos)
					{
						std::string basePath = FileHelpers::getFileDirectory(m_originalPath);

						std::string diffuseTextureMapFullPath = basePath + diffuseTextureMapFile;
						pMaterial->setDiffuseTextureMapPath(diffuseTextureMapFullPath, false);
					}
				}
				break;
			}
			default:
			{
				process = false;
				stream.seekg(chunkLength - 6, std::ios_base::cur);
				break;
			}
		}

		if (stream.eof() || stream.fail())
			break;
	}

	// if it's valid, add the old one to the list
	if (!pMaterial->getName().empty())
	{
		m_materials.materials[pMaterial->getName()] = pMaterial;
	}

	return true;
}

bool GeoReader3ds::processMeshMatrix(std::fstream& stream, Matrix4& matrix)
{
	Matrix4 localMatrix;

	for (unsigned int y = 0; y < 4; y++)
	{
		for (unsigned int x = 0; x < 3; x++)
		{
			localMatrix.at(y, x) = readFloat(stream);
		}
	}

	localMatrix.at(3, 3) = 1.0f;
/*
	float transY = localMatrix.m[1][3];
	float transZ = localMatrix.m[2][3];

	localMatrix.m[1][3] = transZ;
	localMatrix.m[2][3] = -transY;
*/
//	localMatrix.transpose();
//	localMatrix = localMatrix.inverse();

//	matrix = localMatrix;

	return true;
}

bool GeoReader3ds::processPositionChunks(std::fstream& stream, Vector& finalPosition)
{
	unsigned short dummy;
	unsigned short keys;

	dummy = readShort(stream);
	dummy = readShort(stream);
	dummy = readShort(stream);
	dummy = readShort(stream);
	dummy = readShort(stream);
	keys = readShort(stream);
	dummy = readShort(stream);

	// the last key is the final position
	for (unsigned short i = 0; i < keys; i++)
	{
		dummy = readShort(stream);
		unsigned int iDummy = readLong(stream);

		float x = readFloat(stream);
		float y = readFloat(stream);
		float z = readFloat(stream);

		finalPosition = Vector(x, y, z);
	}

	return true;
}

void GeoReader3ds::copyVerticeIndexesToUVIndexes(Mesh* pMesh)
{

}

float GeoReader3ds::readFloat(std::fstream& stream)
{
	float value;
	stream.read((char*)&value, sizeof(float));
	return value;
}

unsigned short GeoReader3ds::readShort(std::fstream& stream)
{
	unsigned short value;
	stream.read((char*)&value, sizeof(unsigned short));
	return value;
}

unsigned long GeoReader3ds::readLong(std::fstream& stream)
{
	uint32_t value;
	stream.read((char*)&value, sizeof(uint32_t));
	return (unsigned long)value;
}

unsigned char GeoReader3ds::readChar(std::fstream& stream)
{
	unsigned char value;
	stream.read((char*)&value, sizeof(unsigned char));
	return value;
}

} // namespace Imagine

namespace
{
	Imagine::GeoReader* createGeoReader3ds()
	{
		return new Imagine::GeoReader3ds();
	}

	const bool registered = Imagine::FileIORegistry::instance().registerGeoReader("3ds", createGeoReader3ds);
}


text:
package com.google.gerrit.client.ui;

import com.google.gerrit.client.Gerrit;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gwt.core.client.GWT;

public class ChangeLink extends InlineHyperlink {
  public static String permalink(final Change.Id c) {
    return GWT.getHostPageBaseURL() + c.get();
  }

  protected Change.Id cid;

  public ChangeLink(final String text, final Change.Id c) {
    super(text, PageLinks.toChange(c));
    getElement().setPropertyString("href", permalink(c));
    cid = c;
  }

  @Override
  public void go() {
    Gerrit.display(getTargetHistoryToken());
  }
}


text:
/* Creates instance and notifies it through the window element */
const createInstance = function(classObj, options) {
    let event;
    const eventString = "LazyLoad::Initialized";
    const instance = new classObj(options);
    try {
        // Works in modern browsers
        event = new CustomEvent(eventString, { detail: { instance } });
    } catch (err) {
        // Works in Internet Explorer (all versions)
        event = document.createEvent("CustomEvent");
        event.initCustomEvent(eventString, false, false, { instance });
    }
    window.dispatchEvent(event);
};

/* Auto initialization of one or more instances of lazyload, depending on the
    options passed in (plain object or an array) */
export const autoInitialize = (classObj, options) => {
    if (!options) {
        return;
    }
    if (!options.length) {
        // Plain object
        createInstance(classObj, options);
    } else {
        // Array of objects
        for (let i = 0, optionsItem; (optionsItem = options[i]); i += 1) {
            createInstance(classObj, optionsItem);
        }
    }
};


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlatRedBall.Glue.ContentPipeline;
using System.Windows.Forms;
using FlatRedBall.Glue.Elements;
using FlatRedBall.Glue.FormHelpers;
using FlatRedBall.Glue.Plugins.ExportedImplementations;
using FlatRedBall.IO;
using FlatRedBall.Glue.Controls;
using Glue;
using System.IO;
using FlatRedBall.Glue.SaveClasses;
using FlatRedBall.Glue.AutomatedGlue;
using FlatRedBall.Glue.Plugins.ExportedImplementations.CommandInterfaces;
using FlatRedBall.Glue.IO;
using FlatRedBall.Glue.Parsing;
using FlatRedBall.Glue.Managers;
using FlatRedBall.Glue.Plugins;
using System.Threading.Tasks;

namespace FlatRedBall.Glue.SetVariable
{
    public class ReferencedFileSaveSetPropertyManager
    {
        internal void ReactToChangedReferencedFile(string changedMember, object oldValue, ref bool updateTreeView)
        {
            ReferencedFileSave rfs = GlueState.Self.CurrentReferencedFileSave;

            #region Opens With

            if (changedMember == "OpensWith")
            {
                if (rfs.OpensWith == "New Application...")
                {
                    string newApplication = EditorData.FileAssociationSettings.SetApplicationForExtension(null, "New Application...");

                    if (!string.IsNullOrEmpty(newApplication))
                    {
                        rfs.OpensWith = newApplication;
                    }
                    else
                    {
                        rfs.OpensWith = "<DEFAULT>";
                    }
                }
            }

            #endregion

            #region Name

            else if (changedMember == "Name")
            {
                if ((string)oldValue != rfs.Name && ProjectManager.GlueProjectSave != null)
                {
                    if ((string)oldValue != null)
                    {
                        ReactToRenamedReferencedFile((string)oldValue, rfs.Name, rfs, GlueState.Self.CurrentElement);
                    }
                }
            }

            #endregion

            #region LoadedAtRuntime

            if (changedMember == "LoadedAtRuntime")
            {

                updateTreeView = false;
            }

            #endregion

            #region Loaded only when referenced

            else if (changedMember == "LoadedOnlyWhenReferenced")
            {
                updateTreeView = false;
                if (rfs.LoadedOnlyWhenReferenced)
                {
                    // We need to make this public, or else it won't work on WP7 and Silverlight.
                    // Update - The preferred method to get access to this stuff by string is either
                    // GetMember or GetStaticMember, so there's no reason to force this stuff as public
                    // when LoadedWhenReferenced is set to true.
                    //rfs.HasPublicProperty = true;
                }
            }

            #endregion

            #region Has public property

            else if (changedMember == "HasPublicProperty")
            {
                updateTreeView = false;
                // GetMember and GetStaticMember
                // make it so we no longer require
                // the member to be public.
                //if (rfs.LoadedOnlyWhenReferenced && !rfs.HasPublicProperty)
                //{
                //    System.Windows.Forms.MessageBox.Show("This file must have a public property if it " +
                //        "is \"Loaded Only When Referenced\" so that it can be accessed through reflection " +
                //        "on non-PC platforms.");

                //    rfs.HasPublicProperty = true;
                //}

                //if (rfs.ContainerType == ContainerType.None && rfs.HasPublicProperty == false)
                //{
                //    System.Windows.Forms.MessageBox.Show("Global content must be public so custom code can access it.");
                //    rfs.HasPublicProperty = true;
                //}
            }

            #endregion

            #region IsSharedStatic

            else if (changedMember == "IsSharedStatic")
            {
                updateTreeView = false;
                // If this is made IsSharedStatic, that means that the file will not be added to managers
                // We should see if any named objects reference this and notify the user
                List<NamedObjectSave> namedObjects = GlueState.Self.CurrentElement.NamedObjects;

                foreach (NamedObjectSave namedObject in namedObjects)
                {
                    if (namedObject.SourceType == SourceType.File && namedObject.SourceFile == rfs.Name && namedObject.AddToManagers == false)
                    {
                        DialogResult result = MessageBox.Show("The object " + namedObject.InstanceName + " references this file.  " +
                            "Shared files are not added to the engine, but since the object has its AddToManagers also set to false " +
                            "the content in this file will not be added to managers.  Would you like to set the object's AddToManagers to " +
                            "true?", "Add to managers?", MessageBoxButtons.YesNo);

                        if (result == DialogResult.Yes)
                        {
                            namedObject.AddToManagers = true;
                        }
                    }
                }
            }

            #endregion

            #region IsDatabaseForLocalizing

            else if (changedMember == "IsDatabaseForLocalizing")
            {
                updateTreeView = false;
                bool oldValueAsBool = (bool)oldValue;
                bool newValue = rfs.IsDatabaseForLocalizing;

                if(newValue)
                {
                    TaskManager.Self.Add(() => RemoveCodeForCsv(rfs), "Removing old CSV");

                }
                else
                {
                    CsvCodeGenerator.GenerateAndSaveDataClass(rfs, rfs.CsvDelimiter);
                }

                // Let's revert the change just to see if
                // things have changed project-wide, and if
                // have to tell the user to re-generate all code.
                rfs.IsDatabaseForLocalizing = oldValueAsBool;
                ObjectFinder.Self.GlueProject.UpdateIfTranslationIsUsed();
                bool oldProjectLocalization = ObjectFinder.Self.GlueProject.UsesTranslation;

                rfs.IsDatabaseForLocalizing = newValue;
                ObjectFinder.Self.GlueProject.UpdateIfTranslationIsUsed();
                bool newProjectLocalization = ObjectFinder.Self.GlueProject.UsesTranslation;

                if (oldProjectLocalization != newProjectLocalization)
                {
                    MessageBox.Show("Because of the change to the \"Is Database For Localizing\" the generated code for the entire project is likely out of date." +
                        "We recommend closing and re-opening the project in Glue to cause a full regeneration.", "Generated code is out of date");
                }
            }

            #endregion

            #region UseContentPipeline

            else if (changedMember == "UseContentPipeline")
            {
                ContentPipelineHelper.ReactToUseContentPipelineChange(rfs);

                // Make sure that
                // all other RFS's
                // that use this file
                // get changed too.
                List<ReferencedFileSave> matchingRfses = ObjectFinder.Self.GetMatchingReferencedFiles(rfs);

                foreach (ReferencedFileSave rfsToUpdate in matchingRfses)
                {
                    rfsToUpdate.UseContentPipeline = rfs.UseContentPipeline;
                    // No need to
                    // call this method
                    // because there's only
                    // one file in the project
                    // even though there's multiple
                    // ReferencedFileSaves, and this
                    // method just modifies the content
                    // project.
                    //ContentPipelineHelper.ReactToUseContentPipelineChange(rfsToUpdate);

                    var container = rfsToUpdate.GetContainer();

                    if (container != null)
                    {
                        //CodeWriter.GenerateCode(container);
                        GlueCommands.Self.GenerateCodeCommands.GenerateElementCodeAsync(container);
                        //CodeWriter.GenerateCode(container);
                    }
                    else
                    {
                        GlueCommands.Self.GenerateCodeCommands.GenerateGlobalContentCode();
                    }
                }

                updateTreeView = false;
            }

            #endregion

            #region TextureFormat

            //else if (changedMember == "TextureFormat")
            //{
            //    ContentPipelineHelper.UpdateTextureFormatFor(rfs);

            //    // See the UseContentPipeline section for comments on what this
            //    // code does.
            //    List<ReferencedFileSave> matchingRfses = ObjectFinder.Self.GetMatchingReferencedFiles(rfs);
            //    foreach (ReferencedFileSave rfsToUpdate in matchingRfses)
            //    {
            //        rfsToUpdate.TextureFormat = rfs.TextureFormat;
            //        IElement container = rfsToUpdate.GetContainer();

            //        if (container != null)
            //        {
            //            CodeWriter.GenerateCode(container);
            //        }
            //        else
            //        {
            //            GlueCommands.Self.GenerateCodeCommands.GenerateGlobalContentCode();
            //        }
            //    }

            //    updateTreeView = false;
            //}

            #endregion

            #region IncludeDirectoryRelativeToContainer

            else if (changedMember == "IncludeDirectoryRelativeToContainer")
            {
                if (rfs.GetContainerType() == ContainerType.None)
                {
                    // This RFS
                    // is in GlobalContent
                    // so we need to find all
                    // RFS's that use this RFS
                    // and regenerate them
                    var elements = ObjectFinder.Self.GetAllElementsReferencingFile(rfs.Name);

                    foreach (var element in elements)
                    {
                        CodeWriter.GenerateCode(element);
                    }
                }
                else
                {

                }
            }

            #endregion

            #region AdditionalArguments

            else if (changedMember == "AdditionalArguments")
            {
                rfs.PerformExternalBuild(runAsync:true);

            }

            #endregion

            #region CreatesDictionary

            else if (changedMember == "CreatesDictionary")
            {
                // This could change things like the constants added to the code file, so let's generate the code now.
                GlueCommands.Self.GenerateCodeCommands.GenerateCurrentCsvCode();
            }

            #endregion

            PluginManager.ReactToReferencedFileChangedValue(changedMember, oldValue);
        }

        public static void ReactToRenamedReferencedFile(string oldName, string newName, ReferencedFileSave rfs, IElement container)
        {
            string oldDirectory = FileManager.GetDirectory(oldName);
            string newDirectory = FileManager.GetDirectory(newName);

            // it's a RFS so it's gotta be content
            // Note - MakeAbsolute will do its best
            // to determine if a file is content. However,
            // a rename may change the extension to something
            // unrecognizable. In this case we still want to have
            // it be content
            bool forceAsContent = true;
            var oldFilePath = new FilePath(GlueCommands.Self.GetAbsoluteFileName(oldName, forceAsContent));
            var newFilePath = new FilePath(GlueCommands.Self.GetAbsoluteFileName(newName, forceAsContent));

            string instanceName = FileManager.RemovePath(FileManager.RemoveExtension(newName));
            string whyIsntValid;
            if (oldDirectory != newDirectory)
            {
                MessageBox.Show("The old file was located in \n" + oldDirectory + "\n" +
                    "The new file is located in \n" + newDirectory + "\n" +
                    "Currently Glue does not support changing directories.", "Warning");

                rfs.SetNameNoCall(oldName);
            }
            else if (NameVerifier.IsReferencedFileNameValid(instanceName, rfs.GetAssetTypeInfo(), rfs, container, out whyIsntValid) == false)
            {
                MessageBox.Show(whyIsntValid);
                rfs.SetNameNoCall(oldName);

            }
            else
            {
                bool shouldMove = true;
                bool shouldContinue = true;

                CheckForExistingFileOfSameName(oldName, rfs, newFilePath, ref shouldMove, ref shouldContinue);

                if (shouldContinue)
                {
                    if(shouldMove && oldFilePath.Exists())
                    {
                        File.Move(oldFilePath.FullPath, newFilePath.FullPath);
                    }

                    UpdateObjectsUsingFile(container, oldName, rfs);

                    TaskManager.Self.AddAsync(() => RegenerateCodeAndUpdateUiAccordingToRfsRename(oldName, newName, rfs), "Generating code due to renamed file");

                    UpdateBuildItemsForRenamedRfs(oldName, newName);

                    AdjustDataFilesIfIsCsv(oldName, rfs);

                    GluxCommands.Self.SaveGlux();

                    GlueCommands.Self.ProjectCommands.SaveProjects();
                }
            }
        }

        private static void UpdateObjectsUsingFile(IElement element, string oldName, ReferencedFileSave rfs)
        {
            string newName = rfs.Name;
            string oldNameUnqualified = FileManager.RemoveExtension(FileManager.RemovePath(oldName));
            string newNameUnqualified = FileManager.RemoveExtension(FileManager.RemovePath(newName));
            if (element != null)
            {
                AdjustAccordingToRenamedRfs(element, oldName, rfs, newName, oldNameUnqualified, newNameUnqualified);
            }
            foreach (IElement derived in ObjectFinder.Self.GetAllElementsThatInheritFrom(element))
            {
                AdjustAccordingToRenamedRfs(derived, oldName, rfs, newName, oldNameUnqualified, newNameUnqualified);
            }
        }

        private static void AdjustAccordingToRenamedRfs(IElement element, string oldName, ReferencedFileSave rfs, string newName, string oldNameUnqualified, string newNameUnqualified)
        {
            foreach (NamedObjectSave nos in element.GetAllNamedObjectsRecurisvely())
            {
                UpdateObjectToRenamedFile(oldName, newName, nos, rfs);
            }

            foreach (CustomVariable cv in element.CustomVariables.Where(item =>  item.DefaultValue is string && ((string)item.DefaultValue) == oldNameUnqualified))
            {
                cv.DefaultValue = newNameUnqualified;
            }
            foreach (var state in element.AllStates)
            {
                foreach (var variable in state.InstructionSaves.Where(item => item.Value is string && ((string)item.Value) == oldNameUnqualified))
                {
                    variable.Value = newNameUnqualified;
                }

            }
        }

        private static void UpdateObjectToRenamedFile(string oldName, string newName, NamedObjectSave nos, ReferencedFileSave rfs)
        {
            if (nos.SourceType == SourceType.Entity && nos.SourceFile == oldName)
            {
                nos.SourceFile = newName;
            }

            string oldNameUnqualified = FileManager.RemoveExtension( FileManager.RemovePath(oldName) );
            string newNameUnqualified = FileManager.RemoveExtension(FileManager.RemovePath(newName));
            // see if any variables use this
            foreach (var customVariable in nos.InstructionSaves)
            {
                // December 29, 2021
                // This code used to only
                // compare against unqualified
                // RuntimeTypes. I believe this is
                // because older Glue would always use
                // unqualified names, but newer Glue uses
                // qualified names in most places. We'll check
                // for both in case there are any older projects.
                string rfsType = rfs.RuntimeType;
                string rfsTypeUnqualified = rfsType;
                if (rfsType != null && rfsType.Contains("."))
                {
                    rfsTypeUnqualified = FileManager.GetExtension(rfsType);
                }

                var matches =
                    customVariable.Value is string && (customVariable.Value as string) == oldNameUnqualified &&
                        (customVariable.Type.ToLower() == rfsType.ToLower() ||
                            customVariable.Type.ToLower() == rfsTypeUnqualified.ToLower());
                if (matches)
                {
                    customVariable.Value = newNameUnqualified;
                    Plugins.PluginManager.ReceiveOutput("Changed " + nos.InstanceName + "." + customVariable.Member + " from " + oldNameUnqualified + " to " + newNameUnqualified);
                }

            }
        }

        public static void AdjustDataFilesIfIsCsv(string oldName, ReferencedFileSave rfs)
        {
            // We'll remove the old file from the project, delete it, then have the RFS regenerate/add the new one to the project

            //////////////Early Out///////////////////

            if (!rfs.IsCsvOrTreatedAsCsv || UsesAlterntaiveClass(rfs))
            {
                return;
            }
            ////////////End Early Out/////////////////
            RemoveCodeForCsv(rfs, oldName);

            CsvCodeGenerator.GenerateAndSaveDataClass(rfs, rfs.CsvDelimiter);
        }

        private static void RemoveCodeForCsv(ReferencedFileSave rfs, string alternativeName = null, bool saveProject = true)
        {
            if(alternativeName == null)
            {
                alternativeName = rfs.Name;
            }
            string className = rfs.GetTypeForCsvFile(alternativeName);

            // the class name will be fully qualified, but we don't want that, we want just the end:
            if(className.Contains("."))
            {
                // provides the name after the dot:
                className = FileManager.GetExtension(className);
            }

            string whatToRemove = "DataTypes/" + className + ".Generated.cs";

            if (ProjectManager.ProjectBase.RemoveItem(whatToRemove) && saveProject)
            {
                GlueCommands.Self.ProjectCommands.SaveProjects();
            }
            string fileToDelete = whatToRemove;
            fileToDelete = GlueCommands.Self.GetAbsoluteFileName(fileToDelete, false);
            if (System.IO.File.Exists(fileToDelete))
            {
                try
                {
                    FileHelper.DeleteFile(fileToDelete);
                }
                catch (Exception e)
                {
                    GlueGui.ShowMessageBox("Could not delete the file " + fileToDelete + "\n\nThe file is no longer referneced by the project so it is not necessary to delete this file manually.");
                }
            }
        }

        private static bool UsesAlterntaiveClass(ReferencedFileSave rfs)
        {
            CustomClassSave ccs = ObjectFinder.Self.GlueProject.GetCustomClassReferencingFile(rfs.Name);
            return ccs != null;
        }

        private static void UpdateBuildItemsForRenamedRfs(string oldName, string newName)
        {
            if (ProjectManager.ContentProject != null)
            {
                var oldNameWithContentPrefix = "content\\" + oldName.ToLower().Replace("/", "\\");
                var item = ProjectManager.ContentProject.GetItem(oldNameWithContentPrefix);

                // The item could be null if this file is excluded from the project
                if (item != null)
                {
                    if (newName.ToLower().Replace("/", "\\").StartsWith("content\\"))
                    {
                        newName = newName.Substring("content\\".Length);
                    }

                    var newNameWithContentPrefix = "content\\" + newName.ToLower().Replace("/", "\\");
                    item.UnevaluatedInclude = newNameWithContentPrefix;

                    string nameWithoutExtensions = FileManager.RemovePath(FileManager.RemoveExtension(newName));

                    item.SetMetadataValue("Name", nameWithoutExtensions);

                    ProjectManager.ContentProject.RenameInDictionary(oldNameWithContentPrefix, newNameWithContentPrefix, item);
                }
            }
        }

        private static async Task RegenerateCodeAndUpdateUiAccordingToRfsRename(string oldName, string newName, ReferencedFileSave fileSave)
        {
            foreach (var element in ProjectManager.GlueProjectSave.AllElements())
            {
                bool wasAnythingChanged = element.ReactToRenamedReferencedFile(oldName, newName);

                if (wasAnythingChanged)
                {
                    await CodeWriter.GenerateCode(element);
                }

                if (element.ReferencedFiles.Contains(fileSave))
                {
                    GlueCommands.Self.RefreshCommands.RefreshTreeNodeFor(element);
                }
            }
        }

        private static void CheckForExistingFileOfSameName(string oldName, ReferencedFileSave fileSave, FilePath newFilePath, ref bool shouldMove, ref bool shouldContinue)
        {
            if (newFilePath.Exists())
            {
                string message = "The new file name already exists.  What would you like to do?";

                var mbmb = new MultiButtonMessageBoxWpf();

                mbmb.MessageText = message;

                mbmb.AddButton("Use existing file", DialogResult.Yes);
                mbmb.AddButton("Cancel the rename", DialogResult.Cancel);

                mbmb.ShowDialog();
                var result = (DialogResult)mbmb.ClickedResult;

                if (result == DialogResult.Cancel)
                {
                    fileSave.SetNameNoCall(oldName);
                    shouldContinue = false;
                }
                else if (result == DialogResult.Yes)
                {
                    shouldMove = false;
                }
            }
        }
    }
}


text:
NS_ASSUME_NONNULL_BEGIN

@interface ALAssetsGroup (BBMediaPickerExtensions)

- (NSString *)BB_identifier;
- (nullable ALAsset *)BB_assetAtIndex:(NSUInteger)index;
- (nullable ALAsset *)BB_assetAtIndex:(NSUInteger)index reverse:(BOOL)reverse;
- (NSUInteger)BB_indexOfAsset:(ALAsset *)asset;

@end

NS_ASSUME_NONNULL_END


text:
<form id="pagerForm" method="post" action="<?php echo site_url('manage/list_position')?>">
    <input type="hidden" name="pageNum" value="<?php echo $pageNum;?>" />
    <input type="hidden" name="numPerPage" value="<?php echo $numPerPage;?>" />
    <input type="hidden" name="orderField" value="<?php echo $this->input->post('orderField');?>" />
    <input type="hidden" name="orderDirection" value="<?php echo $this->input->post('orderDirection');?>" />
</form>

            <?php if($this->session->userdata('permission_id') == 1): ?>

<a class="add" href="<?php echo site_url('manage/add_position')?>" target="dialog" rel="add_position" title="新建">新建

<a class="delete" href="<?php echo site_url('manage/delete_position')?>/{id}" target="ajaxTodo"  title="确定要删除?" warn="请选择一条记录">删除

            <?php endif ?>

<a class="edit" href="<?php echo site_url('manage/edit_position/{id}')?>" target="dialog" rel="edit_position" warn="请选择一条记录" title="查看">查看

                ID
                名称

            <?php
            if (!empty($res_list)):
                foreach ($res_list as $row):
                    ?>
                    <tr target="id" rel=<?php echo $row->id; ?>>
                        <?php echo $row->id;?>
                        <?php echo $row->name;?>

                    <?php
                endforeach;
            endif;
            ?>

            显示
            <select name="numPerPage" class="combox" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="20" <?php echo $this->input->post('numPerPage')==20?'selected':''?>>20</option>
                <option value="50" <?php echo  $this->input->post('numPerPage')==50?'selected':''?>>50</option>
                <option value="100" <?php echo $this->input->post('numPerPage')==100?'selected':''?>>100</option>
                <option value="200" <?php echo $this->input->post('numPerPage')==200?'selected':''?>>200</option>
            </select>
            条,共<?php  echo $countPage;?>条

        <div class="pagination" targetType="navTab" totalCount="<?php echo $countPage;?>" numPerPage="<?php echo $numPerPage;?>" pageNumShown="10" currentPage="<?php echo $pageNum;?>">


text:
//
//  NSString+HTML.h
//
//  Copyright (c) 2010 Michael Waterfall
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  1. The above copyright notice and this permission notice shall be included
//     in all copies or substantial portions of the Software.
//
//  2. This Software cannot be used to archive or collect data such as (but not
//     limited to) that of events, news, experiences and activities, for the
//     purpose of any concept relating to diary/journal keeping.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
//

#import <Foundation/Foundation.h>

// Dependant upon GTMNSString+HTML

/**
 * NSString category (NSString+HTML) contains methods that allow
 * you to manipulate HTML content strings.
 */
@interface NSString (HTML)

/*
 * Convert HTML to Plain Text (Strips HTML tags & comments, removes extra
 * whitespace and decodes HTML character entities).
 */
- (NSString *)stringByConvertingHTMLToPlainText;

- (NSString *)stringByDecodingHTMLEntities;
- (NSString *)stringByEncodingHTMLEntities;
- (NSString *)stringWithNewLinesAsBRs;
- (NSString *)stringByRemovingNewLinesAndWhitespace;

@end


text:
<?php

namespace Ems\Contracts\View;

use Ems\Contracts\Core\Renderable;
use ArrayAccess;
use IteratorAggregate;
use Countable;

interface View extends Renderable, ArrayAccess, IteratorAggregate, Countable
{
    /**
     * Return the name of the view (its path or a string translatable
     * into a path.
     *
     * @return string
     **/
    public function name();

    /**
     * Fill the view variables.
     *
     * @param array|\Traversable|string $name
     * @param mixed                     $value (optional)
     *
     * @return self
     **/
    public function assign($name, $value = null);

    /**
     * Return all assigned variables as an array.
     *
     * @return array
     **/
    public function assignments();
}


text:
#include <Plasma/Animation/BasicNode.h>

#include <CGMath/Random.h>

/*==============================================================================
  UNNAMED NAMESPACE
==============================================================================*/
UNNAMESPACE_BEGIN

RNG_WELL _rng;

UNNAMESPACE_END

NAMESPACE_BEGIN

/*==============================================================================
   CLASS BasicNode
==============================================================================*/

//------------------------------------------------------------------------------
//!
BasicNode::BasicNode()
{
}

//------------------------------------------------------------------------------
//!
BasicNode::~BasicNode()
{
}

//------------------------------------------------------------------------------
//!
RCP<AnimationNode>
BasicNode::clone() const
{
   RCP<BasicNode> node( new BasicNode() );
   node->_name  = _name;
   node->_anims = _anims;
   return node;
}

//------------------------------------------------------------------------------
//!
void BasicNode::getAnimations( Vector< SkeletalAnimation* >& anims )
{
   for( uint i = 0; i < _anims.size(); ++i )
   {
      anims.pushBack( _anims[i].ptr() );
   }
}

//------------------------------------------------------------------------------
//!
void BasicNode::replaceAnimations(
   const Map< SkeletalAnimation*, RCP<SkeletalAnimation> >& anims
)
{
   for( uint i = 0; i < _anims.size(); ++i )
   {
      auto it = anims.find( _anims[i].ptr() );
      if( it != anims.end() ) _anims[i] = (*it).second;
   }
}

//------------------------------------------------------------------------------
//!
RCP<AnimationState>
BasicNode::createState( AnimationParameter* p ) const
{
   RCP<BasicState> state = new BasicState();

   state->parameters( p );
   state->canExit( true );
   state->pose( new SkeletalPose( Reff::identity(), _anims[0]->pose(0)->numBones() ) );
   state->time(0);
   switchAnimation( state.ptr() );

   return state;
}

//------------------------------------------------------------------------------
//!
void
BasicNode::perform( AnimationState* state, double deltaTime )
{
   BasicState* curState = (BasicState*)state;

   double time = curState->time() + deltaTime;
   SkeletalAnimation* anim = curState->currentAnimation();

   // Loop animation?
   if( time > anim->duration() )
   {
      time -= anim->duration();
      switchAnimation( curState );
      anim = curState->currentAnimation();
      time = CGM::fmod( time, (double)anim->duration() );
   }

   // Compute current pose.
   float t;
   SkeletalPose* p0;
   SkeletalPose* p1;
   SkeletalPose* cp = curState->pose();

   anim->getPoses( (float)time, p0, p1, t );
   CHECK( p0->numBones() == p1->numBones() );
   CHECK( p0->numBones() == cp->numBones() );
   cp->referential( p0->referential().slerp( p1->referential(), t ) );
   for( uint i = 0; i < cp->numBones(); ++i )
   {
      cp->bones()[i] = p0->bones()[i].slerp( p1->bones()[i], t );
   }

   curState->orientation( curState->parameters()->entity()->orientation() );

   // Update state time.
   curState->time( time );
}

//------------------------------------------------------------------------------
//!
void
BasicNode::switchAnimation( BasicState* state ) const
{
   state->currentAnimation( _anims[_rng.getUInt( uint(_anims.size()) )].ptr() );
   state->orientation( state->parameters()->entity()->orientation() );

   // FIXME: Maybe animation should contain speed and direction.
   Vec3f vel = state->currentAnimation()->velocity();
   state->speed( length(vel) );
   state->direction( state->speed() == 0.0f ? Vec3f(0.0f,0.0f,1.0f) : normalize(vel) );
}

NAMESPACE_END


text:
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include <sys/mman.h>
#include "hosthooks.h"
#include "hosthooks-def.h"

#undef HOST_HOOKS_GT_PCH_USE_ADDRESS
#define HOST_HOOKS_GT_PCH_USE_ADDRESS sol_gt_pch_use_address

/* Map SIZE bytes of FD+OFFSET at BASE.  Return 1 if we succeeded at
   mapping the data at BASE, -1 if we couldn't.  */

static int
sol_gt_pch_use_address (void *base, size_t size, int fd, size_t offset)
{
  void *addr;

  /* We're called with size == 0 if we're not planning to load a PCH
     file at all.  This allows the hook to free any static space that
     we might have allocated at link time.  */
  if (size == 0)
    return -1;

  addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE,
               fd, offset);

  /* Solaris isn't good about honoring the mmap START parameter
     without MAP_FIXED set.  Before we give up, search the desired
     address space with mincore to see if the space is really free.  */
  if (addr != base)
    {
      size_t page_size = getpagesize();
      char one_byte;
      size_t i;

      if (addr != (void *) MAP_FAILED)
        munmap (addr, size);

      errno = 0;
      for (i = 0; i < size; i += page_size)
        if (mincore ((char *)base + i, page_size, (void *)&one_byte) == -1
            && errno == ENOMEM)
          continue; /* The page is not mapped.  */
        else
          break;

      if (i >= size)
        addr = mmap (base, size,
                     PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED,
                     fd, offset);
    }

  return addr == base ? 1 : -1;
}

const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER;


text:
//---------------------------------------------------------------------
// <copyright file="EdmEntityContainerTests.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Test.Edm.TDD.Tests
{
    using System.Linq;
    using FluentAssertions;
    using Microsoft.OData.Edm;
    using Microsoft.OData.Edm.Library;
    using Microsoft.OData.Edm.Library.Expressions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class EdmEntityContainerTests
    {
        #region AddActionImport Api tests.
        [TestMethod]
        public void EnsureActionImportIsAddedWithActionSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var actionImport = container.AddActionImport(action);

            actionImport.Action.Should().Be(action);
            actionImport.Name.Should().Be(action.Name);
            container.Elements.ToArray()[0].Should().Be(actionImport);
        }

        [TestMethod]
        public void EnsureActionImportIsAddedAndWithCorrectSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var actionImport = container.AddActionImport("OtherName", action);

            actionImport.Action.Should().Be(action);
            actionImport.Name.Should().Be("OtherName");
            container.Elements.ToArray()[0].Should().Be(actionImport);
        }

        [TestMethod]
        public void EnsureActionImportIsAddedAndWithCorrectEntitySetExpression()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var edmEntitySet = new EdmEntitySet(container, "EntitySet", new EdmEntityType("DS", "TestEntity"));
            var entitySetExpression = new EdmEntitySetReferenceExpression(edmEntitySet);
            var actionImport = container.AddActionImport("OtherName", action, entitySetExpression);

            actionImport.Action.Should().Be(action);
            actionImport.Name.Should().Be("OtherName");
            actionImport.EntitySet.Should().Be(entitySetExpression);
            container.Elements.ToArray()[0].Should().Be(actionImport);
        }
        #endregion

        #region AddFunctionImport Api tests.
        [TestMethod]
        public void EnsureFunctionImportIsAddedWithActionSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmFunction function = new EdmFunction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var functionImport = container.AddFunctionImport(function);

            functionImport.Function.Should().Be(function);
            functionImport.Name.Should().Be(function.Name);
            container.Elements.ToArray()[0].Should().Be(functionImport);
        }

        [TestMethod]
        public void EnsureFunctionImportIsAddedAndWithCorrectSuppliedName()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmFunction function = new EdmFunction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var functionImport = container.AddFunctionImport("OtherName", function);

            functionImport.Function.Should().Be(function);
            functionImport.Name.Should().Be("OtherName");
            container.Elements.ToArray()[0].Should().Be(functionImport);
        }

        [TestMethod]
        public void EnsureFunctionImportIsAddedAndWithCorrectEntitySetExpression()
        {
            EdmEntityContainer container = new EdmEntityContainer("Default", "Container");
            EdmAction action = new EdmAction("DS", "TestAction", EdmCoreModel.Instance.GetBoolean(false));
            var edmEntitySet = new EdmEntitySet(container, "EntitySet", new EdmEntityType("DS", "TestEntity"));
            var entitySetExpression = new EdmEntitySetReferenceExpression(edmEntitySet);
            var functionImport = container.AddActionImport("OtherName", action, entitySetExpression);

            functionImport.Action.Should().Be(action);
            functionImport.Name.Should().Be("OtherName");
            functionImport.EntitySet.Should().Be(entitySetExpression);
            container.Elements.ToArray()[0].Should().Be(functionImport);
        }
        #endregion
    }
}


text:
package main

import (
	"github.com/kataras/iris/v12"
)

func main() {
	app := iris.New()

	// Subdomain method is just another Party.
	admin := app.Subdomain("admin")
	{
		// admin.mydomain.com
		admin.Get("/", func(c iris.Context) {
			c.Writef("INDEX FROM admin.mydomain.com")
		})
		// admin.mydomain.com/hey
		admin.Get("/hey", func(c iris.Context) {
			c.Writef("HEY FROM admin.mydomain.com/hey")
		})
		// admin.mydomain.com/hey2
		admin.Get("/hey2", func(c iris.Context) {
			c.Writef("HEY SECOND FROM admin.mydomain.com/hey")
		})
	}

	// mydomain.com
	app.Get("/", func(c iris.Context) {
		c.Writef("INDEX FROM no-subdomain hey")
	})

	// mydomain.com/hey
	app.Get("/hey", func(c iris.Context) {
		c.Writef("HEY FROM no-subdomain hey")
	})

	// http://admin.mydomain.com
	// http://admin.mydomain.com/hey
	// http://admin.mydomain.com/hey2
	// http://mydomain.com
	// http://mydomain.com/hey
	app.Listen("mydomain.com:80") // for beginners: look ../hosts file
}


text:
int test_main(int, char* [])
{
  return 0;
}
#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES

#include <boost/optional.hpp>
#include <boost/ref.hpp>
#include <boost/signals2.hpp>
#include <functional>

template<typename T>
struct max_or_default {
  typedef T result_type;
  template<typename InputIterator>
  typename InputIterator::value_type
  operator()(InputIterator first, InputIterator last) const
  {
    boost::optional<T> max;
    for (; first != last; ++first)
    {
      try
      {
        if(!max) max = *first;
        else max = (*first > max.get())? *first : max;
      }
      catch(const boost::bad_weak_ptr &)
      {}
    }
    if(max) return max.get();
    return T();
  }
};

struct make_int {
  make_int(int n, int cn) : N(n), CN(n) {}
  int operator()() { return N; }
  int operator()() const { return CN; }

  int N;
  int CN;
};

template<int N>
struct make_increasing_int {
  make_increasing_int() : n(N) {}

  int operator()() const { return n++; }

  mutable int n;
};

int get_37() { return 37; }

static void
test_zero_args()
{
  make_int i42(42, 41);
  make_int i2(2, 1);
  make_int i72(72, 71);
  make_int i63(63, 63);
  make_int i62(62, 61);

  {
    boost::signals2::signal0<int, max_or_default<int>, std::string> s0;
    boost::signals2::connection c2 = s0.connect(i2);
    boost::signals2::connection c72 = s0.connect("72", i72);
    boost::signals2::connection c62 = s0.connect("6x", i62);
    boost::signals2::connection c42 = s0.connect(i42);
    boost::signals2::connection c37 = s0.connect(&get_37);

    BOOST_CHECK(s0() == 72);

    s0.disconnect("72");
    BOOST_CHECK(s0() == 62);

    c72.disconnect(); // Double-disconnect should be safe
    BOOST_CHECK(s0() == 62);

    s0.disconnect("72"); // Triple-disconect should be safe
    BOOST_CHECK(s0() == 62);

    // Also connect 63 in the same group as 62
    s0.connect("6x", i63);
    BOOST_CHECK(s0() == 63);

    // Disconnect all of the 60's
    s0.disconnect("6x");
    BOOST_CHECK(s0() == 42);

    c42.disconnect();
    BOOST_CHECK(s0() == 37);

    c37.disconnect();
    BOOST_CHECK(s0() == 2);

    c2.disconnect();
    BOOST_CHECK(s0() == 0);
  }

  {
    boost::signals2::signal0<int, max_or_default<int> > s0;
    boost::signals2::connection c2 = s0.connect(i2);
    boost::signals2::connection c72 = s0.connect(i72);
    boost::signals2::connection c62 = s0.connect(i62);
    boost::signals2::connection c42 = s0.connect(i42);

    const boost::signals2::signal0<int, max_or_default<int> >& cs0 = s0;
    BOOST_CHECK(cs0() == 72);
  }

  {
    make_increasing_int<7> i7;
    make_increasing_int<10> i10;

    boost::signals2::signal0<int, max_or_default<int> > s0;
    boost::signals2::connection c7 = s0.connect(i7);
    boost::signals2::connection c10 = s0.connect(i10);

    BOOST_CHECK(s0() == 10);
    BOOST_CHECK(s0() == 11);
  }
}

static void
test_one_arg()
{
  boost::signals2::signal1<int, int, max_or_default<int> > s1;

  s1.connect(std::negate<int>());
  s1.connect(boost::bind(std::multiplies<int>(), 2, _1));

  BOOST_CHECK(s1(1) == 2);
  BOOST_CHECK(s1(-1) == 1);
}

static void
test_signal_signal_connect()
{
  typedef boost::signals2::signal1<int, int, max_or_default<int> > signal_type;
  signal_type s1;

  s1.connect(std::negate<int>());

  BOOST_CHECK(s1(3) == -3);

  {
    signal_type s2;
    s1.connect(s2);
    s2.connect(boost::bind(std::multiplies<int>(), 2, _1));
    s2.connect(boost::bind(std::multiplies<int>(), -3, _1));

    BOOST_CHECK(s2(-3) == 9);
    BOOST_CHECK(s1(3) == 6);
  } // s2 goes out of scope and disconnects

  BOOST_CHECK(s1(3) == -3);

  // test auto-track of signal wrapped in a reference_wrapper
  {
    signal_type s2;
    s1.connect(boost::cref(s2));
    s2.connect(boost::bind(std::multiplies<int>(), 2, _1));
    s2.connect(boost::bind(std::multiplies<int>(), -3, _1));

    BOOST_CHECK(s2(-3) == 9);
    BOOST_CHECK(s1(3) == 6);
  } // s2 goes out of scope and disconnects

  BOOST_CHECK(s1(3) == -3);
}

struct EventCounter
{
  EventCounter() : count(0) {}

  void operator()()
  {
    ++count;
  }

  int count;
};

static void
test_ref()
{
  EventCounter ec;
  boost::signals2::signal0<void> s;

  {
    boost::signals2::scoped_connection c(s.connect(boost::ref(ec)));
    BOOST_CHECK(ec.count == 0);
    s();
    BOOST_CHECK(ec.count == 1);
  }
  s();
  BOOST_CHECK(ec.count == 1);
}

static void test_default_combiner()
{
  boost::signals2::signal0<int> sig;
  boost::optional<int> result;
  result = sig();
  BOOST_CHECK(!result);

  sig.connect(make_int(0, 0));
  result = sig();
  BOOST_CHECK(result);
  BOOST_CHECK(*result == 0);

  sig.connect(make_int(1, 1));
  result = sig();
  BOOST_CHECK(result);
  BOOST_CHECK(*result == 1);
}

template<typename ResultType>
  ResultType disconnecting_slot(const boost::signals2::connection &conn, int)
{
  conn.disconnect();
  return ResultType();
}

#ifdef BOOST_NO_VOID_RETURNS
template<>
  void disconnecting_slot<void>(const boost::signals2::connection &conn, int)
{
  conn.disconnect();
  return;
}
#endif

template<typename ResultType>
  void test_extended_slot()
{
  {
    typedef boost::signals2::signal1<ResultType, int> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig(0);
    BOOST_CHECK(sig.num_slots() == 0);
  }
  { // test 0 arg signal
    typedef boost::signals2::signal0<ResultType> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp, _1, 0);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig();
    BOOST_CHECK(sig.num_slots() == 0);
  }
  // test disconnection by slot
  {
    typedef boost::signals2::signal1<ResultType, int> signal_type;
    typedef typename signal_type::extended_slot_type slot_type;
    signal_type sig;
    // attempting to work around msvc 7.1 bug by explicitly assigning to a function pointer
    ResultType (*fp)(const boost::signals2::connection &conn, int) = &disconnecting_slot<ResultType>;
    slot_type myslot(fp);
    sig.connect_extended(myslot);
    BOOST_CHECK(sig.num_slots() == 1);
    sig.disconnect(fp);
    BOOST_CHECK(sig.num_slots() == 0);
  }
}
class dummy_combiner
{
public:
  typedef int result_type;

  dummy_combiner(result_type return_value): _return_value(return_value)
  {}
  template<typename SlotIterator>
  result_type operator()(SlotIterator, SlotIterator)
  {
    return _return_value;
  }
private:
  result_type _return_value;
};

static void
test_set_combiner()
{
  typedef boost::signals2::signal0<int, dummy_combiner> signal_type;
  signal_type sig(dummy_combiner(0));
  BOOST_CHECK(sig() == 0);
  BOOST_CHECK(sig.combiner()(0,0) == 0);
  sig.set_combiner(dummy_combiner(1));
  BOOST_CHECK(sig() == 1);
  BOOST_CHECK(sig.combiner()(0,0) == 1);
}

static void
test_swap()
{
  typedef boost::signals2::signal0<int, dummy_combiner> signal_type;
  signal_type sig1(dummy_combiner(1));
  BOOST_CHECK(sig1() == 1);
  signal_type sig2(dummy_combiner(2));
  BOOST_CHECK(sig2() == 2);

  sig1.swap(sig2);
  BOOST_CHECK(sig1() == 2);
  BOOST_CHECK(sig2() == 1);

  using std::swap;
  swap(sig1, sig2);
  BOOST_CHECK(sig1() == 1);
  BOOST_CHECK(sig2() == 2);
}

int
test_main(int, char* [])
{
  test_zero_args();
  test_one_arg();
  test_signal_signal_connect();
  test_ref();
  test_default_combiner();
  test_extended_slot<void>();
  test_extended_slot<int>();
  test_set_combiner();
  test_swap();
  return 0;
}

#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES


text:
package prtest_md;

public class Root implements io.datawire.quark.runtime.QObject {
    public static quark.reflect.Class prtest_Test_md = prtest_Test.singleton;
    public Root() {}
    public String _getClass() {
        return (String) (null);
    }
    public Object _getField(String name) {
        return null;
    }
    public void _setField(String name, Object value) {}
}


text:
package org.jeo.geojson;

import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.LinkedHashMap;
import java.util.Map;

import org.json.simple.parser.ParseException;

/**
 * TODO: handle nested objects and arrays
 */
class PropertiesHandler extends BaseHandler {

    String key;
    Deque<Map<String,Object>> stack = new ArrayDeque<Map<String,Object>>();

    @Override
    public boolean startObject() throws ParseException, IOException {
        Map<String,Object> map = new LinkedHashMap<String, Object>();

        //top level?
        if (!stack.isEmpty()) {
            stack.peek().put(key, map);
        }

        stack.push(map);
        return true;
    }

    @Override
    public boolean endObject() throws ParseException, IOException {
        Map<String,Object> map = stack.pop();
        if (stack.isEmpty()) {
            node.setValue(map);
            pop();
        }

        return true;
    }

    @Override
    public boolean startObjectEntry(String key) throws ParseException,
            IOException {
        this.key = key;
        return true;
    }

    @Override
    public boolean primitive(Object value) throws ParseException, IOException {
        stack.peek().put(key, value);
        return true;
    }

    @Override
    public boolean endObjectEntry() throws ParseException, IOException {
        return true;
    }
}