text:
namespace lldb_private {

//----------------------------------------------------------------------
/// @class DataExtractor DataExtractor.h "lldb/Core/DataExtractor.h"
/// @brief An data extractor class.
///
/// DataExtractor is a class that can extract data (swapping if needed)
/// from a data buffer. The data buffer can be caller owned, or can be
/// shared data that can be shared between multiple DataExtractor
/// instances. Multiple DataExtractor objects can share the same data,
/// yet extract values in different address sizes and byte order modes.
/// Each object can have a unique position in the shared data and extract
/// data from different offsets.
///
/// @see DataBuffer
//----------------------------------------------------------------------
class DataExtractor
{
public:
    //------------------------------------------------------------------
    /// @typedef DataExtractor::Type
    /// @brief Type enumerations used in the dump routines.
    /// @see DataExtractor::Dump()
    /// @see DataExtractor::DumpRawHexBytes()
    //------------------------------------------------------------------
    typedef enum
    {
        TypeUInt8,      ///< Format output as unsigned 8 bit integers
        TypeChar,       ///< Format output as characters
        TypeUInt16,     ///< Format output as unsigned 16 bit integers
        TypeUInt32,     ///< Format output as unsigned 32 bit integers
        TypeUInt64,     ///< Format output as unsigned 64 bit integers
        TypePointer,    ///< Format output as pointers
        TypeULEB128,    ///< Format output as ULEB128 numbers
        TypeSLEB128     ///< Format output as SLEB128 numbers
    } Type;

    static void
    DumpHexBytes (Stream *s,
                  const void *src,
                  size_t src_len,
                  uint32_t bytes_per_line,
                  lldb::addr_t base_addr); // Pass LLDB_INVALID_ADDRESS to not show address at start of line
    //------------------------------------------------------------------
    /// Default constructor.
    ///
    /// Initialize all members to a default empty state.
    //------------------------------------------------------------------
    DataExtractor ();

    //------------------------------------------------------------------
    /// Construct with a buffer that is owned by the caller.
    ///
    /// This constructor allows us to use data that is owned by the
    /// caller. The data must stay around as long as this object is
    /// valid.
    ///
    /// @param[in] data
    ///     A pointer to caller owned data.
    ///
    /// @param[in] data_length
    ///     The length in bytes of \a data.
    ///
    /// @param[in] byte_order
    ///     A byte order of the data that we are extracting from.
    ///
    /// @param[in] addr_size
    ///     A new address byte size value.
    //------------------------------------------------------------------
    DataExtractor (const void* data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size);

    //------------------------------------------------------------------
    /// Construct with shared data.
    ///
    /// Copies the data shared pointer which adds a reference to the
    /// contained in \a data_sp. The shared data reference is reference
    /// counted to ensure the data lives as long as anyone still has a
    /// valid shared pointer to the data in \a data_sp.
    ///
    /// @param[in] data_sp
    ///     A shared pointer to data.
    ///
    /// @param[in] byte_order
    ///     A byte order of the data that we are extracting from.
    ///
    /// @param[in] addr_size
    ///     A new address byte size value.
    //------------------------------------------------------------------
    DataExtractor (const lldb::DataBufferSP& data_sp, lldb::ByteOrder byte_order, uint32_t addr_size);

    //------------------------------------------------------------------
    /// Construct with a subset of \a data.
    ///
    /// Initialize this object with a subset of the data bytes in \a
    /// data. If \a data contains shared data, then a reference to the
    /// shared data will be added to ensure the shared data stays around
    /// as long as any objects have references to the shared data. The
    /// byte order value and the address size settings are copied from \a
    /// data. If \a offset is not a valid offset in \a data, then no
    /// reference to the shared data will be added. If there are not
    /// \a length bytes available in \a data starting at \a offset,
    /// the length will be truncated to contain as many bytes as
    /// possible.
    ///
    /// @param[in] data
    ///     Another DataExtractor object that contains data.
    ///
    /// @param[in] offset
    ///     The offset into \a data at which the subset starts.
    ///
    /// @param[in] length
    ///     The length in bytes of the subset of data.
    //------------------------------------------------------------------
    DataExtractor (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length);

    DataExtractor (const DataExtractor& rhs);
    //------------------------------------------------------------------
    /// Assignment operator.
    ///
    /// Copies all data, byte order and address size settings from \a rhs into
    /// this object. If \a rhs contains shared data, a reference to that
    /// shared data will be added.
    ///
    /// @param[in] rhs
    ///     Another DataExtractor object to copy.
    ///
    /// @return
    ///     A const reference to this object.
    //------------------------------------------------------------------
    const DataExtractor&
    operator= (const DataExtractor& rhs);

    //------------------------------------------------------------------
    /// Destructor
    ///
    /// If this object contains a valid shared data reference, the
    /// reference count on the data will be decremented, and if zero,
    /// the data will be freed.
    //------------------------------------------------------------------
    ~DataExtractor ();

    //------------------------------------------------------------------
    /// Clears the object state.
    ///
    /// Clears the object contents back to a default invalid state, and
    /// release any references to shared data that this object may
    /// contain.
    //------------------------------------------------------------------
    void
    Clear ();

    //------------------------------------------------------------------
    /// Dumps the binary data as \a type objects to stream \a s (or to
    /// Log() if \a s is NULL) starting \a offset bytes into the data
    /// and stopping after dumping \a length bytes. The offset into the
    /// data is displayed at the beginning of each line and can be
    /// offset by base address \a base_addr. \a num_per_line objects
    /// will be displayed on each line.
    ///
    /// @param[in] s
    ///     The stream to dump the output to. If NULL the output will
    ///     be dumped to Log().
    ///
    /// @param[in] offset
    ///     The offset into the data at which to start dumping.
    ///
    /// @param[in] length
    ///     The number of bytes to dump.
    ///
    /// @param[in] base_addr
    ///     The base address that gets added to the offset displayed on
    ///     each line.
    ///
    /// @param[in] num_per_line
    ///     The number of \a type objects to display on each line.
    ///
    /// @param[in] type
    ///     The type of objects to use when dumping data from this
    ///     object. See DataExtractor::Type.
    ///
    /// @param[in] type_format
    ///     The optional format to use for the \a type objects. If this
    ///     is NULL, the default format for the \a type will be used.
    ///
    /// @return
    ///     The offset at which dumping ended.
    //------------------------------------------------------------------
    lldb::offset_t
    PutToLog (Log *log,
              lldb::offset_t offset,
              lldb::offset_t length,
              uint64_t base_addr,
              uint32_t num_per_line,
              Type type,
              const char *type_format = NULL) const;

    //------------------------------------------------------------------
    /// Dumps \a item_count objects into the stream \a s.
    ///
    /// Dumps \a item_count objects using \a item_format, each of which
    /// are \a item_byte_size bytes long starting at offset \a offset
    /// bytes into the contained data, into the stream \a s. \a
    /// num_per_line objects will be dumped on each line before a new
    /// line will be output. If \a base_addr is a valid address, then
    /// each new line of output will be prededed by the address value
    /// plus appropriate offset, and a colon and space. Bitfield values
    /// can be dumped by calling this function multiple times with the
    /// same start offset, format and size, yet differing \a
    /// item_bit_size and \a item_bit_offset values.
    ///
    /// @param[in] s
    ///     The stream to dump the output to. This value can not be NULL.
    ///
    /// @param[in] offset
    ///     The offset into the data at which to start dumping.
    ///
    /// @param[in] item_format
    ///     The format to use when dumping each item.
    ///
    /// @param[in] item_byte_size
    ///     The byte size of each item.
    ///
    /// @param[in] item_count
    ///     The number of items to dump.
    ///
    /// @param[in] num_per_line
    ///     The number of items to display on each line.
    ///
    /// @param[in] base_addr
    ///     The base address that gets added to the offset displayed on
    ///     each line if the value is valid. Is \a base_addr is
    ///     LLDB_INVALID_ADDRESS then no address values will be prepended
    ///     to any lines.
    ///
    /// @param[in] item_bit_size
    ///     If the value to display is a bitfield, this value should
    ///     be the number of bits that the bitfield item has within the
    ///     item's byte size value. This function will need to be called
    ///     multiple times with identical \a offset and \a item_byte_size
    ///     values in order to display multiple bitfield values that
    ///     exist within the same integer value. If the items being
    ///     displayed are not bitfields, this value should be zero.
    ///
    /// @param[in] item_bit_offset
    ///     If the value to display is a bitfield, this value should
    ///     be the offset in bits, or shift right amount, that the
    ///     bitfield item occupies within the item's byte size value.
    ///     This function will need to be called multiple times with
    ///     identical \a offset and \a item_byte_size values in order
    ///     to display multiple bitfield values that exist within the
    ///     same integer value. If the items being displayed are not
    ///     bitfields, this value should be zero.
    ///
    /// @return
    ///     The offset at which dumping ended.
    //------------------------------------------------------------------
    lldb::offset_t
    Dump (Stream *s,
          lldb::offset_t offset,
          lldb::Format item_format,
          size_t item_byte_size,
          size_t item_count,
          size_t num_per_line,
          uint64_t base_addr,
          uint32_t item_bit_size,
          uint32_t item_bit_offset,
          ExecutionContextScope *exe_scope = NULL) const;

    //------------------------------------------------------------------
    /// Dump a UUID value at \a offset.
    ///
    /// Dump a UUID starting at \a offset bytes into this object's data.
    /// If the stream \a s is NULL, the output will be sent to Log().
    ///
    /// @param[in] s
    ///     The stream to dump the output to. If NULL the output will
    ///     be dumped to Log().
    ///
    /// @param[in] offset
    ///     The offset into the data at which to extract and dump a
    ///     UUID value.
    //------------------------------------------------------------------
    void
    DumpUUID (Stream *s, lldb::offset_t offset) const;

    //------------------------------------------------------------------
    /// Extract an arbitrary number of bytes in the specified byte
    /// order.
    ///
    /// Attemps to extract \a length bytes starting at \a offset bytes
    /// into this data in the requested byte order (\a dst_byte_order)
    /// and place the results in \a dst. \a dst must be at least \a
    /// length bytes long.
    ///
    /// @param[in] offset
    ///     The offset in bytes into the contained data at which to
    ///     start extracting.
    ///
    /// @param[in] length
    ///     The number of bytes to extract.
    ///
    /// @param[in] dst_byte_order
    ///     A byte order of the data that we want when the value in
    ///     copied to \a dst.
    ///
    /// @param[out] dst
    ///     The buffer that will receive the extracted value if there
    ///     are enough bytes available in the current data.
    ///
    /// @return
    ///     The number of bytes that were extracted which will be \a
    ///     length when the value is successfully extracted, or zero
    ///     if there aren't enough bytes at the specified offset.
    //------------------------------------------------------------------
    size_t
    ExtractBytes (lldb::offset_t offset, lldb::offset_t length, lldb::ByteOrder dst_byte_order, void *dst) const;

    //------------------------------------------------------------------
    /// Extract an address from \a *offset_ptr.
    ///
    /// Extract a single address from the data and update the offset
    /// pointed to by \a offset_ptr. The size of the extracted address
    /// comes from the \a m_addr_size member variable and should be
    /// set correctly prior to extracting any address values.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted address value.
    //------------------------------------------------------------------
    uint64_t
    GetAddress (lldb::offset_t *offset_ptr) const;

    uint64_t
    GetAddress_unchecked (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Get the current address size.
    ///
    /// Return the size in bytes of any address values this object will
    /// extract.
    ///
    /// @return
    ///     The size in bytes of address values that will be extracted.
    //------------------------------------------------------------------
    uint32_t
    GetAddressByteSize () const
    {
        return m_addr_size;
    }

    //------------------------------------------------------------------
    /// Get the number of bytes contained in this object.
    ///
    /// @return
    ///     The total number of bytes of data this object refers to.
    //------------------------------------------------------------------
    uint64_t
    GetByteSize () const
    {
        return m_end - m_start;
    }

    //------------------------------------------------------------------
    /// Extract a C string from \a *offset_ptr.
    ///
    /// Returns a pointer to a C String from the data at the offset
    /// pointed to by \a offset_ptr. A variable length NULL terminated C
    /// string will be extracted and the \a offset_ptr will be
    /// updated with the offset of the byte that follows the NULL
    /// terminator byte.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     A pointer to the C string value in the data. If the offset
    ///     pointed to by \a offset_ptr is out of bounds, or if the
    ///     offset plus the length of the C string is out of bounds,
    ///     NULL will be returned.
    //------------------------------------------------------------------
    const char *
    GetCStr (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract a C string from \a *offset_ptr with field size \a len.
    ///
    /// Returns a pointer to a C String from the data at the offset
    /// pointed to by \a offset_ptr, with a field length of \a len.
    /// A NULL terminated C string will be extracted and the \a offset_ptr
    /// will be updated with the offset of the byte that follows the fixed
    /// length field.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     A pointer to the C string value in the data. If the offset
    ///     pointed to by \a offset_ptr is out of bounds, or if the
    ///     offset plus the length of the field is out of bounds, or if
    ///     the field does not contain a NULL terminator byte, NULL will
    ///     be returned.
    const char *
    GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const;

    //------------------------------------------------------------------
    /// Extract \a length bytes from \a *offset_ptr.
    ///
    /// Returns a pointer to a bytes in this object's data at the offset
    /// pointed to by \a offset_ptr. If \a length is zero or too large,
    /// then the offset pointed to by \a offset_ptr will not be updated
    /// and NULL will be returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] length
    ///     The optional length of a string to extract. If the value is
    ///     zero, a NULL terminated C string will be extracted.
    ///
    /// @return
    ///     A pointer to the bytes in this object's data if the offset
    ///     and length are valid, or NULL otherwise.
    //------------------------------------------------------------------
    const void*
    GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const
    {
        const uint8_t *ptr = PeekData (*offset_ptr, length);
        if (ptr)
            *offset_ptr += length;
        return ptr;
    }

    //------------------------------------------------------------------
    /// Copy \a dst_len bytes from \a *offset_ptr and ensure the copied
    /// data is treated as a value that can be swapped to match the
    /// specified byte order.
    ///
    /// For values that are larger than the supported integer sizes,
    /// this function can be used to extract data in a specified byte
    /// order. It can also be used to copy a smaller integer value from
    /// to a larger value. The extra bytes left over will be padded
    /// correctly according to the byte order of this object and the
    /// \a dst_byte_order. This can be very handy when say copying a
    /// partial data value into a register.
    ///
    /// @param[in] src_offset
    ///     The offset into this data from which to start copying an
    ///     endian entity
    ///
    /// @param[in] src_len
    ///     The length of the endian data to copy from this object
    ///     into the \a dst object
    ///
    /// @param[out] dst
    ///     The buffer where to place the endian data. The data might
    ///     need to be byte swapped (and appropriately padded with
    ///     zeroes if \a src_len != \a dst_len) if \a dst_byte_order
    ///     does not match the byte order in this object.
    ///
    /// @param[in] dst_len
    ///     The length number of bytes that the endian value will
    ///     occupy is \a dst.
    ///
    /// @param[in] byte_order
    ///     The byte order that the endian value should be in the \a dst
    ///     buffer.
    ///
    /// @return
    ///     Returns the number of bytes that were copied, or zero if
    ///     anything goes wrong.
    //------------------------------------------------------------------
    lldb::offset_t
    CopyByteOrderedData (lldb::offset_t src_offset,
                         lldb::offset_t src_len,
                         void *dst,
                         lldb::offset_t dst_len,
                         lldb::ByteOrder dst_byte_order) const;

    //------------------------------------------------------------------
    /// Get the data end pointer.
    ///
    /// @return
    ///     Returns a pointer to the next byte contained in this
    ///     object's data, or NULL of there is no data in this object.
    //------------------------------------------------------------------
    const uint8_t *
    GetDataEnd () const
    {
        return m_end;
    }

    //------------------------------------------------------------------
    /// Get the shared data offset.
    ///
    /// Get the offset of the first byte of data in the shared data (if
    /// any).
    ///
    /// @return
    ///     If this object contains shared data, this function returns
    ///     the offset in bytes into that shared data, zero otherwise.
    //------------------------------------------------------------------
    size_t
    GetSharedDataOffset () const;

    //------------------------------------------------------------------
    /// Get a the data start pointer.
    ///
    /// @return
    ///     Returns a pointer to the first byte contained in this
    ///     object's data, or NULL of there is no data in this object.
    //------------------------------------------------------------------
    const uint8_t *
    GetDataStart () const
    {
        return m_start;
    }

    //------------------------------------------------------------------
    /// Extract a float from \a *offset_ptr.
    ///
    /// Extract a single float value.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The floating value that was extracted, or zero on failure.
    //------------------------------------------------------------------
    float
    GetFloat (lldb::offset_t *offset_ptr) const;

    double
    GetDouble (lldb::offset_t *offset_ptr) const;

    long double
    GetLongDouble (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract a GNU encoded pointer value from \a *offset_ptr.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] eh_ptr_enc
    ///     The GNU pointer encoding type.
    ///
    /// @param[in] pc_rel_addr
    ///     The PC relative address to use when the encoding is
    ///     \c DW_GNU_EH_PE_pcrel.
    ///
    /// @param[in] text_addr
    ///     The text (code) relative address to use when the encoding is
    ///     \c DW_GNU_EH_PE_textrel.
    ///
    /// @param[in] data_addr
    ///     The data relative address to use when the encoding is
    ///     \c DW_GNU_EH_PE_datarel.
    ///
    /// @return
    ///     The extracted GNU encoded pointer value.
    //------------------------------------------------------------------
    uint64_t
    GetGNUEHPointer (lldb::offset_t *offset_ptr,
                     uint32_t eh_ptr_enc,
                     lldb::addr_t pc_rel_addr,
                     lldb::addr_t text_addr,
                     lldb::addr_t data_addr);

    //------------------------------------------------------------------
    /// Extract an integer of size \a byte_size from \a *offset_ptr.
    ///
    /// Extract a single integer value and update the offset pointed to
    /// by \a offset_ptr. The size of the extracted integer is specified
    /// by the \a byte_size argument. \a byte_size should have a value
    /// >= 1 and <= 4 since the return value is only 32 bits wide. Any
    /// \a byte_size values less than 1 or greater than 4 will result in
    /// nothing being extracted, and zero being returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] byte_size
    ///     The size in byte of the integer to extract.
    ///
    /// @return
    ///     The integer value that was extracted, or zero on failure.
    //------------------------------------------------------------------
    uint32_t
    GetMaxU32 (lldb::offset_t *offset_ptr, size_t byte_size) const;

    //------------------------------------------------------------------
    /// Extract an unsigned integer of size \a byte_size from \a
    /// *offset_ptr.
    ///
    /// Extract a single unsigned integer value and update the offset
    /// pointed to by \a offset_ptr. The size of the extracted integer
    /// is specified by the \a byte_size argument. \a byte_size should
    /// have a value greater than or equal to one and less than or equal
    /// to eight since the return value is 64 bits wide. Any
    /// \a byte_size values less than 1 or greater than 8 will result in
    /// nothing being extracted, and zero being returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] byte_size
    ///     The size in byte of the integer to extract.
    ///
    /// @return
    ///     The unsigned integer value that was extracted, or zero on
    ///     failure.
    //------------------------------------------------------------------
    uint64_t
    GetMaxU64 (lldb::offset_t *offset_ptr, size_t byte_size) const;

    uint64_t
    GetMaxU64_unchecked (lldb::offset_t *offset_ptr, size_t byte_size) const;

    //------------------------------------------------------------------
    /// Extract an signed integer of size \a byte_size from \a *offset_ptr.
    ///
    /// Extract a single signed integer value (sign extending if required)
    /// and update the offset pointed to by \a offset_ptr. The size of
    /// the extracted integer is specified by the \a byte_size argument.
    /// \a byte_size should have a value greater than or equal to one
    /// and less than or equal to eight since the return value is 64
    /// bits wide. Any \a byte_size values less than 1 or greater than
    /// 8 will result in nothing being extracted, and zero being returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] byte_size
    ///     The size in byte of the integer to extract.
    ///
    /// @return
    ///     The sign extended signed integer value that was extracted,
    ///     or zero on failure.
    //------------------------------------------------------------------
    int64_t
    GetMaxS64 (lldb::offset_t *offset_ptr, size_t size) const;

    //------------------------------------------------------------------
    /// Extract an unsigned integer of size \a byte_size from \a
    /// *offset_ptr, then extract the bitfield from this value if
    /// \a bitfield_bit_size is non-zero.
    ///
    /// Extract a single unsigned integer value and update the offset
    /// pointed to by \a offset_ptr. The size of the extracted integer
    /// is specified by the \a byte_size argument. \a byte_size should
    /// have a value greater than or equal to one and less than or equal
    /// to 8 since the return value is 64 bits wide. Any
    /// \a byte_size values less than 1 or greater than 8 will result in
    /// nothing being extracted, and zero being returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] byte_size
    ///     The size in byte of the integer to extract.
    ///
    /// @param[in] bitfield_bit_size
    ///     The size in bits of the bitfield value to extract, or zero
    ///     to just extract the entire integer value.
    ///
    /// @param[in] bitfield_bit_offset
    ///     The bit offset of the bitfield value in the extracted
    ///     integer (the number of bits to shift the integer to the
    ///     right).
    ///
    /// @return
    ///     The unsigned bitfield integer value that was extracted, or
    ///     zero on failure.
    //------------------------------------------------------------------
    uint64_t
    GetMaxU64Bitfield (lldb::offset_t *offset_ptr,
                       size_t size,
                       uint32_t bitfield_bit_size,
                       uint32_t bitfield_bit_offset) const;

    //------------------------------------------------------------------
    /// Extract an signed integer of size \a byte_size from \a
    /// *offset_ptr, then extract and signe extend the bitfield from
    /// this value if \a bitfield_bit_size is non-zero.
    ///
    /// Extract a single signed integer value (sign extending if required)
    /// and update the offset pointed to by \a offset_ptr. The size of
    /// the extracted integer is specified by the \a byte_size argument.
    /// \a byte_size should have a value greater than or equal to one
    /// and less than or equal to eight since the return value is 64
    /// bits wide. Any \a byte_size values less than 1 or greater than
    /// 8 will result in nothing being extracted, and zero being returned.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[in] byte_size
    ///     The size in bytes of the integer to extract.
    ///
    /// @param[in] bitfield_bit_size
    ///     The size in bits of the bitfield value to extract, or zero
    ///     to just extract the entire integer value.
    ///
    /// @param[in] bitfield_bit_offset
    ///     The bit offset of the bitfield value in the extracted
    ///     integer (the number of bits to shift the integer to the
    ///     right).
    ///
    /// @return
    ///     The signed bitfield integer value that was extracted, or
    ///     zero on failure.
    //------------------------------------------------------------------
    int64_t
    GetMaxS64Bitfield (lldb::offset_t *offset_ptr,
                       size_t size,
                       uint32_t bitfield_bit_size,
                       uint32_t bitfield_bit_offset) const;

    //------------------------------------------------------------------
    /// Extract an pointer from \a *offset_ptr.
    ///
    /// Extract a single pointer from the data and update the offset
    /// pointed to by \a offset_ptr. The size of the extracted pointer
    /// comes from the \a m_addr_size member variable and should be
    /// set correctly prior to extracting any pointer values.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted pointer value as a 64 integer.
    //------------------------------------------------------------------
    uint64_t
    GetPointer (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Get the current byte order value.
    ///
    /// @return
    ///     The current byte order value from this object's internal
    ///     state.
    //------------------------------------------------------------------
    lldb::ByteOrder
    GetByteOrder() const
    {
        return m_byte_order;
    }

    //------------------------------------------------------------------
    /// Extract a uint8_t value from \a *offset_ptr.
    ///
    /// Extract a single uint8_t from the binary data at the offset
    /// pointed to by \a offset_ptr, and advance the offset on success.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted uint8_t value.
    //------------------------------------------------------------------
    uint8_t
    GetU8 ( lldb::offset_t *offset_ptr) const;

    uint8_t
    GetU8_unchecked (lldb::offset_t *offset_ptr) const
    {
        uint8_t val = m_start[*offset_ptr];
        *offset_ptr += 1;
        return val;
    }

    uint16_t
    GetU16_unchecked (lldb::offset_t *offset_ptr) const;

    uint32_t
    GetU32_unchecked (lldb::offset_t *offset_ptr) const;

    uint64_t
    GetU64_unchecked (lldb::offset_t *offset_ptr) const;
    //------------------------------------------------------------------
    /// Extract \a count uint8_t values from \a *offset_ptr.
    ///
    /// Extract \a count uint8_t values from the binary data at the
    /// offset pointed to by \a offset_ptr, and advance the offset on
    /// success. The extracted values are copied into \a dst.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[out] dst
    ///     A buffer to copy \a count uint8_t values into. \a dst must
    ///     be large enough to hold all requested data.
    ///
    /// @param[in] count
    ///     The number of uint8_t values to extract.
    ///
    /// @return
    ///     \a dst if all values were properly extracted and copied,
    ///     NULL otherise.
    //------------------------------------------------------------------
    void *
    GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;

    //------------------------------------------------------------------
    /// Extract a uint16_t value from \a *offset_ptr.
    ///
    /// Extract a single uint16_t from the binary data at the offset
    /// pointed to by \a offset_ptr, and update the offset on success.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted uint16_t value.
    //------------------------------------------------------------------
    uint16_t
    GetU16 (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract \a count uint16_t values from \a *offset_ptr.
    ///
    /// Extract \a count uint16_t values from the binary data at the
    /// offset pointed to by \a offset_ptr, and advance the offset on
    /// success. The extracted values are copied into \a dst.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[out] dst
    ///     A buffer to copy \a count uint16_t values into. \a dst must
    ///     be large enough to hold all requested data.
    ///
    /// @param[in] count
    ///     The number of uint16_t values to extract.
    ///
    /// @return
    ///     \a dst if all values were properly extracted and copied,
    ///     NULL otherise.
    //------------------------------------------------------------------
    void *
    GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;

    //------------------------------------------------------------------
    /// Extract a uint32_t value from \a *offset_ptr.
    ///
    /// Extract a single uint32_t from the binary data at the offset
    /// pointed to by \a offset_ptr, and update the offset on success.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted uint32_t value.
    //------------------------------------------------------------------
    uint32_t
    GetU32 (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract \a count uint32_t values from \a *offset_ptr.
    ///
    /// Extract \a count uint32_t values from the binary data at the
    /// offset pointed to by \a offset_ptr, and advance the offset on
    /// success. The extracted values are copied into \a dst.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[out] dst
    ///     A buffer to copy \a count uint32_t values into. \a dst must
    ///     be large enough to hold all requested data.
    ///
    /// @param[in] count
    ///     The number of uint32_t values to extract.
    ///
    /// @return
    ///     \a dst if all values were properly extracted and copied,
    ///     NULL otherise.
    //------------------------------------------------------------------
    void *
    GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;

    //------------------------------------------------------------------
    /// Extract a uint64_t value from \a *offset_ptr.
    ///
    /// Extract a single uint64_t from the binary data at the offset
    /// pointed to by \a offset_ptr, and update the offset on success.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted uint64_t value.
    //------------------------------------------------------------------
    uint64_t
    GetU64 (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract \a count uint64_t values from \a *offset_ptr.
    ///
    /// Extract \a count uint64_t values from the binary data at the
    /// offset pointed to by \a offset_ptr, and advance the offset on
    /// success. The extracted values are copied into \a dst.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @param[out] dst
    ///     A buffer to copy \a count uint64_t values into. \a dst must
    ///     be large enough to hold all requested data.
    ///
    /// @param[in] count
    ///     The number of uint64_t values to extract.
    ///
    /// @return
    ///     \a dst if all values were properly extracted and copied,
    ///     NULL otherise.
    //------------------------------------------------------------------
    void *
    GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;

    //------------------------------------------------------------------
    /// Extract a signed LEB128 value from \a *offset_ptr.
    ///
    /// Extracts an signed LEB128 number from this object's data
    /// starting at the offset pointed to by \a offset_ptr. The offset
    /// pointed to by \a offset_ptr will be updated with the offset of
    /// the byte following the last extracted byte.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted signed integer value.
    //------------------------------------------------------------------
    int64_t
    GetSLEB128 (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Extract a unsigned LEB128 value from \a *offset_ptr.
    ///
    /// Extracts an unsigned LEB128 number from this object's data
    /// starting at the offset pointed to by \a offset_ptr. The offset
    /// pointed to by \a offset_ptr will be updated with the offset of
    /// the byte following the last extracted byte.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    ///     The extracted unsigned integer value.
    //------------------------------------------------------------------
    uint64_t
    GetULEB128 (lldb::offset_t *offset_ptr) const;

    lldb::DataBufferSP &
    GetSharedDataBuffer ()
    {
        return m_data_sp;
    }

    //------------------------------------------------------------------
    /// Peek at a C string at \a offset.
    ///
    /// Peeks at a string in the contained data. No verification is done
    /// to make sure the entire string lies within the bounds of this
    /// object's data, only \a offset is verified to be a valid offset.
    ///
    /// @param[in] offset
    ///     An offset into the data.
    ///
    /// @return
    ///     A non-NULL C string pointer if \a offset is a valid offset,
    ///     NULL otherwise.
    //------------------------------------------------------------------
    const char *
    PeekCStr (lldb::offset_t offset) const;

    //------------------------------------------------------------------
    /// Peek at a bytes at \a offset.
    ///
    /// Returns a pointer to \a length bytes at \a offset as long as
    /// there are \a length bytes available starting at \a offset.
    ///
    /// @return
    ///     A non-NULL data pointer if \a offset is a valid offset and
    ///     there are \a length bytes available at that offset, NULL
    ///     otherwise.
    //------------------------------------------------------------------
    const uint8_t*
    PeekData (lldb::offset_t offset, lldb::offset_t length) const
    {
        if (length > 0 && ValidOffsetForDataOfSize(offset, length))
            return m_start + offset;
        return NULL;
    }

    //------------------------------------------------------------------
    /// Set the address byte size.
    ///
    /// Set the size in bytes that will be used when extracting any
    /// address and pointer values from data contained in this object.
    ///
    /// @param[in] addr_size
    ///     The size in bytes to use when extracting addresses.
    //------------------------------------------------------------------
    void
    SetAddressByteSize (uint32_t addr_size)
    {
        m_addr_size = addr_size;
    }

    //------------------------------------------------------------------
    /// Set data with a buffer that is caller owned.
    ///
    /// Use data that is owned by the caller when extracting values.
    /// The data must stay around as long as this object, or any object
    /// that copies a subset of this object's data, is valid. If \a
    /// bytes is NULL, or \a length is zero, this object will contain
    /// no data.
    ///
    /// @param[in] bytes
    ///     A pointer to caller owned data.
    ///
    /// @param[in] length
    ///     The length in bytes of \a bytes.
    ///
    /// @param[in] byte_order
    ///     A byte order of the data that we are extracting from.
    ///
    /// @return
    ///     The number of bytes that this object now contains.
    //------------------------------------------------------------------
    lldb::offset_t
    SetData (const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order);

    //------------------------------------------------------------------
    /// Adopt a subset of \a data.
    ///
    /// Set this object's data to be a subset of the data bytes in \a
    /// data. If \a data contains shared data, then a reference to the
    /// shared data will be added to ensure the shared data stays around
    /// as long as any objects have references to the shared data. The
    /// byte order and the address size settings are copied from \a
    /// data. If \a offset is not a valid offset in \a data, then no
    /// reference to the shared data will be added. If there are not
    /// \a length bytes available in \a data starting at \a offset,
    /// the length will be truncated to contains as many bytes as
    /// possible.
    ///
    /// @param[in] data
    ///     Another DataExtractor object that contains data.
    ///
    /// @param[in] offset
    ///     The offset into \a data at which the subset starts.
    ///
    /// @param[in] length
    ///     The length in bytes of the subset of \a data.
    ///
    /// @return
    ///     The number of bytes that this object now contains.
    //------------------------------------------------------------------
    lldb::offset_t
    SetData (const DataExtractor& data, lldb::offset_t offset, lldb::offset_t length);

    //------------------------------------------------------------------
    /// Adopt a subset of shared data in \a data_sp.
    ///
    /// Copies the data shared pointer which adds a reference to the
    /// contained in \a data_sp. The shared data reference is reference
    /// counted to ensure the data lives as long as anyone still has a
    /// valid shared pointer to the data in \a data_sp. The byte order
    /// and address byte size settings remain the same. If
    /// \a offset is not a valid offset in \a data_sp, then no reference
    /// to the shared data will be added. If there are not \a length
    /// bytes available in \a data starting at \a offset, the length
    /// will be truncated to contains as many bytes as possible.
    ///
    /// @param[in] data_sp
    ///     A shared pointer to data.
    ///
    /// @param[in] offset
    ///     The offset into \a data_sp at which the subset starts.
    ///
    /// @param[in] length
    ///     The length in bytes of the subset of \a data_sp.
    ///
    /// @return
    ///     The number of bytes that this object now contains.
    //------------------------------------------------------------------
    lldb::offset_t
    SetData (const lldb::DataBufferSP& data_sp, lldb::offset_t offset = 0, lldb::offset_t length = LLDB_INVALID_OFFSET);

    //------------------------------------------------------------------
    /// Set the byte_order value.
    ///
    /// Sets the byte order of the data to extract. Extracted values
    /// will be swapped if necessary when decoding.
    ///
    /// @param[in] byte_order
    ///     The byte order value to use when extracting data.
    //------------------------------------------------------------------
    void
    SetByteOrder (lldb::ByteOrder byte_order)
    {
        m_byte_order = byte_order;
    }

    //------------------------------------------------------------------
    /// Skip an LEB128 number at \a *offset_ptr.
    ///
    /// Skips a LEB128 number (signed or unsigned) from this object's
    /// data starting at the offset pointed to by \a offset_ptr. The
    /// offset pointed to by \a offset_ptr will be updated with the
    /// offset of the byte following the last extracted byte.
    ///
    /// @param[in,out] offset_ptr
    ///     A pointer to an offset within the data that will be advanced
    ///     by the appropriate number of bytes if the value is extracted
    ///     correctly. If the offset is out of bounds or there are not
    ///     enough bytes to extract this value, the offset will be left
    ///     unmodified.
    ///
    /// @return
    //      The number of bytes consumed during the extraction.
    //------------------------------------------------------------------
    uint32_t
    Skip_LEB128 (lldb::offset_t *offset_ptr) const;

    //------------------------------------------------------------------
    /// Test the validity of \a offset.
    ///
    /// @return
    ///     \b true if \a offset is a valid offset into the data in this
    ///     object, \b false otherwise.
    //------------------------------------------------------------------
    bool
    ValidOffset (lldb::offset_t offset) const
    {
        return offset < GetByteSize();
    }

    //------------------------------------------------------------------
    /// Test the availability of \a length bytes of data from \a offset.
    ///
    /// @return
    ///     \b true if \a offset is a valid offset and there are \a
    ///     length bytes available at that offset, \b false otherwise.
    //------------------------------------------------------------------
    bool
    ValidOffsetForDataOfSize (lldb::offset_t offset, lldb::offset_t length) const
    {
        return length <= BytesLeft (offset);
    }

    size_t
    Copy (DataExtractor& dest_data) const;

    bool
    Append (DataExtractor& rhs);

    bool
    Append (void* bytes, lldb::offset_t length);

    lldb::offset_t
    BytesLeft (lldb::offset_t offset) const
    {
        const lldb::offset_t size = GetByteSize();
        if (size > offset)
            return size - offset;
        return 0;
    }

protected:

    //------------------------------------------------------------------
    // Member variables
    //------------------------------------------------------------------
    const uint8_t * m_start;        ///< A pointer to the first byte of data.
    const uint8_t * m_end;          ///< A pointer to the byte that is past the end of the data.
    lldb::ByteOrder m_byte_order;   ///< The byte order of the data we are extracting from.
    uint32_t m_addr_size;           ///< The address size to use when extracting pointers or addresses
    mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
};

} // namespace lldb_private

#endif  // #if defined (__cplusplus)
#endif  // #ifndef liblldb_DataExtractor_h_


text:
module AiGames
  # This class provides an abstract parser that can be extended to implement
  # the logic that is required for a specific competition. It provides methods
  # to communicate with the game engine, but does NOT contain any logic how to
  # parse the engine's commands. This is totally up to the implementations of
  # this class.
  class Parser
    VERSION = '0.4.0'

    # Initializes the parser. Pass in options using a hash structure.
    def initialize(options = nil)
      initialize_streams options if options
    end

    # Starts the main loop. This loop runs until the game engine closes the
    # console line. During the loop, the parser reads from the game engine,
    # sanitizes the input a little bit, and then passes it to a method that
    # needs to be overwritten by parsers extending this interface.
    def run
      AiGames::Logger.info 'Parser.run : Starting loop'

      loop do
        command = read_from_engine
        break if command.nil?

        command.strip!
        next if command.length == 0

        response = parse split_line command
        write_to_engine response unless response.nil? || response.length < 1
      end

      AiGames::Logger.info 'Parser.run : Stopping loop'
    end

    # Parses the given command array. This method MUST return a valid response
    # string that can be send to the engine.
    # rubocop:disable Lint/UnusedMethodArgument
    def parse(command_array)
      fail 'Method must be overwritten'
    end
    # rubocop:enable Lint/UnusedMethodArgument

    private

    # Initializes the input and output streams that the parser uses. The
    # expected format for the options is a hash with the keys `:input` and
    # `:output`. Use this to mock `STDIN` and `STDOUT` for tests.
    def initialize_streams(options)
      @input = options[:input] if options.key? :input
      @output = options[:output] if options.key? :output
    end

    # Returns the input stream. If no stream has been configured, $stdin is
    # returned.
    def input
      @input ||= $stdin
    end

    # Returns the output stream. If no stream has been configured, $stdout is
    # returned.
    def output
      @output ||= $stdout
    end

    # Reads from the input stream.
    def read_from_engine
      input.gets
    end

    # Writes to the output stream.
    def write_to_engine(string)
      output.puts string
      output.flush
    end

    # Formats a command line for further processing. The input is split at the
    # whitespace character, and all its parts are converted to downcase.
    def split_line(line)
      line.split(' ').map(&:downcase)
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
module Ebay
  module EbayOperation

    # Constructs the appropriate routing url for the Ebay API
    # see: http://developer.ebay.com/Devzone/xml/docs/Concepts/MakingACall.html#SOAPURLParameters
    def endpoint
      base_url = @wsdl.endpoint.to_s

      params = {
        version: Ebay::Api.schema_version,
        siteid: Ebay::Api.site_id,
        callname: camelcase(@name),
        Routing: 'new'
      }
      if @name == :get_account
        params[:appid] = Ebay::Api.app_id
      end

      base_url += base_url.index('?') ? '&' : '?'
      base_url + URI.encode_www_form(params)
    end

    # Adds required standard input field Version and sets the correct
    # message tag name to support operation without a wsdl
    def build(locals={}, &block)
      set_locals(locals, block)
      @locals[:message][:version] = Ebay::Api.schema_version
      @locals.message_tag camelcase(@name.to_s =~ /_request$/ ? @name : "#{@name}_request")
      Savon::Builder.new(@name, @wsdl, @globals, @locals)
    end

    private

    def camelcase(string)
      string.to_s.capitalize.gsub(/_+(id(?=_|$)|[a-z])/) {$1.upcase}
    end

  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/show_season_list_label"
        style="@style/defaultText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="TextView" />
    <TextView
        android:id="@+id/show_season_list_count"
        style="@style/defaultText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingRight="10dp"
        android:layout_alignParentRight="true"
        android:text="0/0" />

</RelativeLayout>


text:
from django import template
from django.utils.safestring import mark_safe

register = template.Library()

@register.simple_tag
def message_attribute(message, attribute):
    """
    Return the attribute from the SafeMIMEMessage

    This is required to deal with case insensitivity and some attributes use
    a hyphen in the name.  In a template, message.message-id, for example does
    not work due to the hyphen.
    """
    return message.get(attribute)

@register.simple_tag
def message_lookup_id(message):
    """
    Return the message id of an email message.

    Useful because the value is stored in a dict with a hyphen in the key,
    making it inaccessible directly.
    """

    return mark_safe(message.get('message-id', '').strip('<>'))

@register.simple_tag
def display_message_attribute(message, attribute):
    return mark_safe(message_attribute(message, attribute))


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

namespace Quicklogons.Client
{
    public interface ILoginProvider
    {
        string GetLoginPageLink(string returnUrl = null);
        IEnumerable<ILoginLink> GetLoginLinks(string returnUrl = null);
    }
}


text:
import { environment } from './../../../../../../../environments/environment';
import { Product } from './../../../../../../core/models/product';
import {
  Component,
  OnInit,
  Input,
  ChangeDetectionStrategy
} from '@angular/core';

@Component({
  selector: 'app-search-result-item',
  changeDetection: ChangeDetectionStrategy.OnPush,
  templateUrl: './search-result-item.component.html',
  styleUrls: ['./search-result-item.component.scss']
})
export class SearchResultItemComponent implements OnInit {
  @Input() product: Product;
  noImageUrl = '/assets/default/image-placeholder.svg';
  loaderImageUrl = '/assets/default/loader.svg';
  currency = environment.config.currency_symbol;
  imageLoaded = false;

  constructor() {}

  ngOnInit() {}

  getProductImageUrl(format = '.jpg') {
    if (this.defaultImage) {
      return this.defaultImage.product_url.replace(/.\jpg/, format);
    } else {
      return this.noImageUrl;
    }
  }

  imageLoadedSuccess(event: boolean) {
    this.imageLoaded = event;
  }

  get discount() {
    return Math.ceil(
      +this.product.max_retail_price.amount - +this.product.selling_price.amount
    );
  }

  get discountPercent() {
    return `(${Math.ceil(
      (this.discount / +this.product.max_retail_price.amount) * 100
    )}% OFF)`;
  }

  get reviewCount() {
    const count = this.product.rating_summary.review_count;
    return count > 0 ? `${count} reviews` : '';
  }

  get defaultImage() {
    return this.product.images[0];
  }
}


text:
package energy.usef.agr.workflow.plan.connection.profile;

/**
 * This class contains the enumerations of possible parameters for the workflow population the Profile power values in the
 * connecion portfolio.
 */
public class CreateConnectionProfileStepParameter {

    /**
     * Input parameters.
     */
    public enum IN {
        PERIOD,
        PTU_DURATION,
        CONNECTION_PORTFOLIO_DTO_LIST,
        ELEMENT_PER_CONNECTION_MAP
    }

    /**
     * Output parameters.
     */
    public enum OUT {
        CONNECTION_PORTFOLIO_DTO_LIST

    }
}


text:
title:  Misjonsfortelling
date:  17/07/2020
---

#### Den lange veien hjem

_Alphanso Peter Juah (48), Liberia_

19 år gammel flyktet Alphanso Peter Juah fra borgerkrigen i Liberia i 1992. Det var harde tider, og han forlot snart Adventistkirken. I Guinea og andre land solgte han heroin og lurte folk for penger. Han drev også med hvitvask av penger. Slik levde han i årevis, i Senegal, Tunisia, Jordan, India, Thailand og Indonesia.

I Jakarta begynte han å tenke over livet. Han visste at han ikke levde etter Guds bud. Han kom i prat med en spanjol, som ba ham med til kirken sin neste søndag. Misjonæren der hørte på Alphansos livshistorie og tilbød seg å betale hans husleie mot at Alphanso tok seg av hagen og lydsystemet i kirken.

Alphanso tenkte på sabbaten. Han begynte å gå i en adventistmenighet. Han ville gjerne ta universitetsstudier, men ingen kunne hjelpe ham. Men adventistene satte ham i kontakt med foreldrene i Liberia, som han ikke hadde snakket med på år og dag.

Tre år gikk, søndagskirken sluttet å støtte ham, så han begynte å selge stoffer og svindle folk igjen. Samtidig giftet han seg med en slektning av misjonærens hushjelp, Wastinah. Senere flyttet de til Kina, der han igjen tenkte på Gud. Han kjøpte en engelsk bibel og oppdaget Forkynneren 1,2: "Forgjeves, sier Forkynneren, forgjeves og forgjengelig – alt er forgjeves!" Mitt liv er fylt av tomhet, tenkte han. "Jeg må hjem til Afrika."

Han og Wastinah fløy til Liberia i 2006. Her fant han tilbake til foreldrene, overga seg til Jesus og gikk i kirken hver sabbat. Wastinah ble også en kristen. I dag er Alphanso tømmerhogger i Buchanan, og Wastinah selger ris, olje og annet. De har tre barn på 12, 8 og 5 år. Alphanso forteller gjerne om Guds nåde mot ham.

En del av offeret 13. sabbat går til å bygge en ny K-6-skole i Buchanan i Liberia, der den gamle skolen ble ødelagt i borgerkrigen. Alphanso håper å kunne sende barna sine til skolen.

Du kan se Alphanso på YouTube: bit.ly/Alphanso-Juah


text:
"""
Test cases for the key classes.
"""

from jacket.storage.keymgr import key
from jacket.storage import test

class KeyTestCase(test.TestCase):

    def _create_key(self):
        raise NotImplementedError()

    def setUp(self):
        super(KeyTestCase, self).setUp()

        self.key = self._create_key()

class SymmetricKeyTestCase(KeyTestCase):

    def _create_key(self):
        return key.SymmetricKey(self.algorithm, self.encoded)

    def setUp(self):
        self.algorithm = 'AES'
        self.encoded = [0] * 32

        super(SymmetricKeyTestCase, self).setUp()

    def test_get_algorithm(self):
        self.assertEqual(self.algorithm, self.key.get_algorithm())

    def test_get_format(self):
        self.assertEqual('RAW', self.key.get_format())

    def test_get_encoded(self):
        self.assertEqual(self.encoded, self.key.get_encoded())

    def test___eq__(self):
        self.assertTrue(self.key == self.key)

        self.assertFalse(self.key is None)
        self.assertFalse(None == self.key)

    def test___ne__(self):
        self.assertFalse(self.key != self.key)

        self.assertTrue(self.key is not None)
        self.assertTrue(None != self.key)


text:
package model.utilities.pid.tuners;

import org.junit.Assert;
import org.junit.Test;

public class ControlGuruTableFOPDTTest {

    @Test
    public void testSimple() throws Exception {

        ControlGuruTableFOPDT table = new ControlGuruTableFOPDT();

        Assert.assertEquals(table.getDerivativeParameter(1f,2f, 0, 0),0,.0001f);
        Assert.assertEquals(table.getProportionalParameter(1f,2f,0 , 0),1,.0001f);
        Assert.assertEquals(table.getIntegralParameter(1f,2f,0 , 0),0.5,.0001f);

    }
}


text:
package org.seeknresolve.test;

import org.seeknresolve.domain.entity.*;
import org.seeknresolve.domain.repository.*;
import org.seeknresolve.domain.test.builders.BugBuilder;
import org.seeknresolve.domain.test.builders.ProjectBuilder;
import org.seeknresolve.domain.test.builders.UserBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

@Component
@Transactional
public class TestEntityFactory {
    @Autowired
    private UserRepository userRepository;

    @Autowired
    private RoleRepository roleRepository;

    @Autowired
    private ProjectRepository projectRepository;

    @Autowired
    private BugRepository bugRepository;

    @Autowired
    private UserProjectRoleRepository userProjectRoleRepository;

    public User createAndSaveUser(String login) {
        User user = new UserBuilder().withLogin(login)
                .withFirstName("R").withLastName("N")
                .withEmail(System.currentTimeMillis() + "r@r.pl").withRole(createAndSaveUserRole("TEST_USER"))
                .build();
        user.setPassword("abcd");
        return userRepository.save(user);
    }

    public UserRole createAndSaveUserRole(String roleName) {
        UserRole userRole = new UserRole(roleName);
        return roleRepository.save(userRole);
    }

    public Project createAndSaveProject(String name, String tag) {
        Project project = new ProjectBuilder().withName(name).withTag(tag).withDescription("Description").build();
        return projectRepository.save(project);
    }

    public Bug createAndSaveBug(String tag, User user, Project project) {
        Bug bug = new BugBuilder().withTag(tag).withName("Name").withDescription("Description").withAssignee(user).withReporter(user).withProject(project).build();
        return bugRepository.save(bug);
    }

    public ProjectRole grantUserProjectRoleWithPermissions(User user, Project project, String roleName, String... permissions) {
        ProjectRole projectRole = createAndSaveProjectRole(roleName, permissions);
        createAndSaveRoleInProject(user, project, projectRole);
        return projectRole;
    }

    private ProjectRole createAndSaveProjectRole(String roleName, String... permissions) {
        ProjectRole projectRole = new ProjectRole(roleName);
        addPermissionsToProjectRole(projectRole, permissions);
        roleRepository.save(projectRole);
        return projectRole;
    }

    private void addPermissionsToProjectRole(ProjectRole projectRole, String... permissions) {
        for(String permissionName : permissions) {
            Permission permission = new Permission(permissionName);
            projectRole.addPermission(permission);
        }
    }

    private void createAndSaveRoleInProject(User user, Project project, ProjectRole projectRole) {
        UserProjectRole userProjectRole = new UserProjectRole(user, project, projectRole);
        userProjectRoleRepository.save(userProjectRole);
    }
}


text:
// Generated from /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar

#pragma once

#include <fwd-POI.hpp>
#include <java/io/fwd-POI.hpp>
#include <java/lang/fwd-POI.hpp>
#include <java/util/fwd-POI.hpp>
#include <java/lang/Enum.hpp>

template<typename ComponentType, typename... Bases> struct SubArray;
namespace java
{
    namespace io
    {
typedef ::SubArray< ::java::io::Serializable, ::java::lang::ObjectArray > SerializableArray;
    } // io

    namespace lang
    {
typedef ::SubArray< ::java::lang::Comparable, ObjectArray > ComparableArray;
typedef ::SubArray< ::java::lang::Enum, ObjectArray, ComparableArray, ::java::io::SerializableArray > EnumArray;
typedef ::SubArray< ::java::lang::Character_UnicodeScript, EnumArray > Character_UnicodeScriptArray;
    } // lang
} // java

struct default_init_tag;

class java::lang::Character_UnicodeScript final
    : public Enum
{

public:
    typedef Enum super;

private:
    static Character_UnicodeScriptArray* $VALUES_;

public:
    static Character_UnicodeScript* ARABIC;
    static Character_UnicodeScript* ARMENIAN;
    static Character_UnicodeScript* AVESTAN;
    static Character_UnicodeScript* BALINESE;
    static Character_UnicodeScript* BAMUM;
    static Character_UnicodeScript* BATAK;
    static Character_UnicodeScript* BENGALI;
    static Character_UnicodeScript* BOPOMOFO;
    static Character_UnicodeScript* BRAHMI;
    static Character_UnicodeScript* BRAILLE;
    static Character_UnicodeScript* BUGINESE;
    static Character_UnicodeScript* BUHID;
    static Character_UnicodeScript* CANADIAN_ABORIGINAL;
    static Character_UnicodeScript* CARIAN;
    static Character_UnicodeScript* CHAKMA;
    static Character_UnicodeScript* CHAM;
    static Character_UnicodeScript* CHEROKEE;
    static Character_UnicodeScript* COMMON;
    static Character_UnicodeScript* COPTIC;
    static Character_UnicodeScript* CUNEIFORM;
    static Character_UnicodeScript* CYPRIOT;
    static Character_UnicodeScript* CYRILLIC;
    static Character_UnicodeScript* DESERET;
    static Character_UnicodeScript* DEVANAGARI;
    static Character_UnicodeScript* EGYPTIAN_HIEROGLYPHS;
    static Character_UnicodeScript* ETHIOPIC;
    static Character_UnicodeScript* GEORGIAN;
    static Character_UnicodeScript* GLAGOLITIC;
    static Character_UnicodeScript* GOTHIC;
    static Character_UnicodeScript* GREEK;
    static Character_UnicodeScript* GUJARATI;
    static Character_UnicodeScript* GURMUKHI;
    static Character_UnicodeScript* HAN;
    static Character_UnicodeScript* HANGUL;
    static Character_UnicodeScript* HANUNOO;
    static Character_UnicodeScript* HEBREW;
    static Character_UnicodeScript* HIRAGANA;
    static Character_UnicodeScript* IMPERIAL_ARAMAIC;
    static Character_UnicodeScript* INHERITED;
    static Character_UnicodeScript* INSCRIPTIONAL_PAHLAVI;
    static Character_UnicodeScript* INSCRIPTIONAL_PARTHIAN;
    static Character_UnicodeScript* JAVANESE;
    static Character_UnicodeScript* KAITHI;
    static Character_UnicodeScript* KANNADA;
    static Character_UnicodeScript* KATAKANA;
    static Character_UnicodeScript* KAYAH_LI;
    static Character_UnicodeScript* KHAROSHTHI;
    static Character_UnicodeScript* KHMER;
    static Character_UnicodeScript* LAO;
    static Character_UnicodeScript* LATIN;
    static Character_UnicodeScript* LEPCHA;
    static Character_UnicodeScript* LIMBU;
    static Character_UnicodeScript* LINEAR_B;
    static Character_UnicodeScript* LISU;
    static Character_UnicodeScript* LYCIAN;
    static Character_UnicodeScript* LYDIAN;
    static Character_UnicodeScript* MALAYALAM;
    static Character_UnicodeScript* MANDAIC;
    static Character_UnicodeScript* MEETEI_MAYEK;
    static Character_UnicodeScript* MEROITIC_CURSIVE;
    static Character_UnicodeScript* MEROITIC_HIEROGLYPHS;
    static Character_UnicodeScript* MIAO;
    static Character_UnicodeScript* MONGOLIAN;
    static Character_UnicodeScript* MYANMAR;
    static Character_UnicodeScript* NEW_TAI_LUE;
    static Character_UnicodeScript* NKO;
    static Character_UnicodeScript* OGHAM;
    static Character_UnicodeScript* OLD_ITALIC;
    static Character_UnicodeScript* OLD_PERSIAN;
    static Character_UnicodeScript* OLD_SOUTH_ARABIAN;
    static Character_UnicodeScript* OLD_TURKIC;
    static Character_UnicodeScript* OL_CHIKI;
    static Character_UnicodeScript* ORIYA;
    static Character_UnicodeScript* OSMANYA;
    static Character_UnicodeScript* PHAGS_PA;
    static Character_UnicodeScript* PHOENICIAN;
    static Character_UnicodeScript* REJANG;
    static Character_UnicodeScript* RUNIC;
    static Character_UnicodeScript* SAMARITAN;
    static Character_UnicodeScript* SAURASHTRA;
    static Character_UnicodeScript* SHARADA;
    static Character_UnicodeScript* SHAVIAN;
    static Character_UnicodeScript* SINHALA;
    static Character_UnicodeScript* SORA_SOMPENG;
    static Character_UnicodeScript* SUNDANESE;
    static Character_UnicodeScript* SYLOTI_NAGRI;
    static Character_UnicodeScript* SYRIAC;
    static Character_UnicodeScript* TAGALOG;
    static Character_UnicodeScript* TAGBANWA;
    static Character_UnicodeScript* TAI_LE;
    static Character_UnicodeScript* TAI_THAM;
    static Character_UnicodeScript* TAI_VIET;
    static Character_UnicodeScript* TAKRI;
    static Character_UnicodeScript* TAMIL;
    static Character_UnicodeScript* TELUGU;
    static Character_UnicodeScript* THAANA;
    static Character_UnicodeScript* THAI;
    static Character_UnicodeScript* TIBETAN;
    static Character_UnicodeScript* TIFINAGH;
    static Character_UnicodeScript* UGARITIC;
    static Character_UnicodeScript* UNKNOWN;
    static Character_UnicodeScript* VAI;
    static Character_UnicodeScript* YI;

private:
    static ::java::util::HashMap* aliases_;
    static ::int32_tArray* scriptStarts_;
    static Character_UnicodeScriptArray* scripts_;

    /*void ctor(::java::lang::String* name, int ordinal); (private) */

public:
    static Character_UnicodeScript* forName(String* scriptName);
    static Character_UnicodeScript* of(int32_t codePoint);
    static Character_UnicodeScript* valueOf(String* arg0);
    static Character_UnicodeScriptArray* values();

    // Generated
    Character_UnicodeScript(::java::lang::String* name, int ordinal);
protected:
    Character_UnicodeScript(const ::default_init_tag&);

public:
    static ::java::lang::Class *class_();
    static Enum* valueOf(Class* enumType, String* name);

private:
    static Character_UnicodeScriptArray*& $VALUES();
    static ::java::util::HashMap*& aliases();
    static ::int32_tArray*& scriptStarts();
    static Character_UnicodeScriptArray*& scripts();
    virtual ::java::lang::Class* getClass0();
};


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Statistics of compound in UD_Serbian</title>
    <link rel="root" href=""/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="../../css/jquery-ui-redmond.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style-vis.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/hint.css"/>

          home

          edit page
          issue tracker

          <gcse:search></gcse:search>

        This page pertains to UD version 2.

            It appears that you have Javascript disabled.
            Please consider enabling Javascript for this page to see the visualizations.

Treebank Statistics: UD_Serbian: Relations: compound

This relation is universal.

1197 nodes (1%) are attached to their parents as compound.

910 instances of compound (76%) are right-to-left (child precedes parent).
Average distance between parent and child is 1.7702589807853.

The following 3 pairs of parts of speech are connected with compound: <tt>VERB</tt>-<tt>PRON</tt> (1181; 99% instances), <tt>ADV</tt>-<tt>PRON</tt> (14; 1% instances), <tt>NOUN</tt>-<tt>PRON</tt> (2; 0% instances).

# visual-style 3	bgColor:blue
# visual-style 3	fgColor:white
# visual-style 5	bgColor:blue
# visual-style 5	fgColor:white
# visual-style 5 3 compound	color:blue
1	Strane	stran	ADJ	_	Case=Nom|Definite=Def|Degree=Pos|Gender=Fem|Number=Plur	2	amod	_	_
2	investicije	investicija	NOUN	_	Case=Nom|Gender=Fem|Number=Plur	5	nsubj	_	_
3	se	sebe	PRON	_	Case=Acc|Number=Sing|Reflex=Yes	5	compound	_	_
4	takođe	takođe	ADV	_	Degree=Pos	5	advmod	_	_
5	smanjuju	smanjivati	VERB	_	Number=Plur|Person=3|Tense=Pres	0	root	_	SpaceAfter=No
6	.	.	PUNCT	_	_	5	punct	_	_

# visual-style 9	bgColor:blue
# visual-style 9	fgColor:white
# visual-style 8	bgColor:blue
# visual-style 8	fgColor:white
# visual-style 8 9 compound	color:blue
1	Vlada	vlada	NOUN	_	Case=Nom|Gender=Fem|Number=Sing	6	nsubj	_	_
2	Srbije	Srbija	PROPN	_	Case=Gen|Gender=Fem|Number=Sing	1	nmod	_	_
3	je	biti	AUX	_	Number=Sing|Person=3|Tense=Pres	6	aux	_	_
4	u	u	ADP	_	Case=Acc	5	case	_	_
5	subotu	subota	NOUN	_	Case=Acc|Gender=Fem|Number=Sing	6	obl	_	_
6	objavila	objaviti	VERB	_	Gender=Fem|Number=Sing|VerbForm=Part	0	root	_	_
7	saopštenje	saopštenje	NOUN	_	Case=Acc|Gender=Neut|Number=Sing	6	obj	_	_
8	zalažući	zalagati	ADV	_	VerbForm=Part	6	xcomp	_	_
9	se	sebe	PRON	_	Case=Acc|Number=Sing|Reflex=Yes	8	compound	_	_
10	za	za	ADP	_	Case=Acc	13	case	_	_
11	"	"	PUNCT	_	_	13	punct	_	SpaceAfter=No
12	nadziranu	nadziran	ADJ	_	Case=Acc|Definite=Def|Degree=Pos|Gender=Fem|Number=Sing	13	amod	_	_
13	autonomiju	autonomija	NOUN	_	Case=Acc|Gender=Fem|Number=Sing	8	obl	_	SpaceAfter=No
14	"	"	PUNCT	_	_	13	punct	_	_
15	kao	kao	SCONJ	_	_	17	case	_	_
16	kompromisno	kompromisan	ADJ	_	Case=Acc|Definite=Def|Degree=Pos|Gender=Neut|Number=Sing	17	amod	_	_
17	rešenje	rešenje	NOUN	_	Case=Acc|Gender=Neut|Number=Sing	13	obl	_	SpaceAfter=No
18	.	.	PUNCT	_	_	6	punct	_	_

# visual-style 21	bgColor:blue
# visual-style 21	fgColor:white
# visual-style 22	bgColor:blue
# visual-style 22	fgColor:white
# visual-style 22 21 compound	color:blue
1	Iako	iako	SCONJ	_	_	6	mark	_	_
2	se	sebe	PRON	_	Case=Acc|Number=Sing|Reflex=Yes	6	compound	_	_
3	mnogi	mnogi	ADJ	_	Case=Nom|Definite=Def|Degree=Pos|Gender=Masc|Number=Plur	4	det	_	_
4	građani	građanin	NOUN	_	Case=Nom|Gender=Masc|Number=Plur	6	nsubj	_	_
5	Unije	unija	NOUN	_	Case=Gen|Gender=Fem|Number=Sing	4	nmod	_	_
6	protive	protiviti	VERB	_	Number=Plur|Person=3|Tense=Pres	18	advcl	_	_
7	eventualnom	eventualan	ADJ	_	Case=Dat|Definite=Def|Degree=Pos|Gender=Masc|Number=Sing	8	amod	_	_
8	ulasku	ulazak	NOUN	_	Case=Dat|Gender=Masc|Number=Sing	6	obl	_	_
9	u	u	ADP	_	Case=Loc	10	case	_	_
10	EU	EU	PROPN	_	Case=Nom|Gender=Masc|Number=Sing	8	nmod	_	_
11	te	te	CCONJ	_	_	14	det	_	_
12	većinski	većinski	ADV	_	Degree=Pos	13	advmod	_	_
13	muslimanske	muslimanski	ADJ	_	Case=Gen|Definite=Def|Degree=Pos|Gender=Fem|Number=Sing	14	amod	_	_
14	zemlje	zemlja	NOUN	_	Case=Gen|Gender=Fem|Number=Sing	8	nmod	_	SpaceAfter=No
15	,	,	PUNCT	_	_	6	punct	_	_
16	ti	taj	PRON	_	Case=Nom|Gender=Masc|Number=Plur|PronType=Dem	17	det	_	_
17	stavovi	stav	NOUN	_	Case=Nom|Gender=Masc|Number=Plur	18	nsubj	_	_
18	mogli	moći	VERB	_	Gender=Masc|Number=Plur|VerbForm=Part	0	root	_	_
19	bi	biti	AUX	_	Number=Plur|Person=3|Tense=Past	18	aux	_	_
20	da	da	SCONJ	_	_	22	mark	_	_
21	se	sebe	PRON	_	Case=Acc|Number=Sing|Reflex=Yes	22	compound	_	_
22	promene	promena	NOUN	_	Case=Nom|Gender=Fem|Number=Plur	18	xcomp	_	_
23	ako	ako	SCONJ	_	_	25	mark	_	_
24	Turska	Turska	PROPN	_	Case=Nom|Gender=Fem|Number=Sing	25	nsubj	_	_
25	sprovede	sprovesti	VERB	_	Number=Sing|Person=3|Tense=Pres	18	advcl	_	_
26	promene	promena	NOUN	_	Case=Acc|Gender=Fem|Number=Plur	25	obj	_	SpaceAfter=No
27	.	.	PUNCT	_	_	18	punct	_	_

© 2014–2021
            Universal Dependencies contributors.
            Site powered by Annodoc and brat
.


text:
layout: post
title: "When I Appeared on CNN"
description: "Back in 2012 when I was running my own business I wrote a followers analytics algorithm for Twitter."
tags: [cnn, development, twitter, php]
published: true
---

Back in 2012 when I was running my own business I wrote a followers analytics [algorithm for Twitter](https://twitter.com). It got quite big and I appeared on CNN as a result. One of the most surreal episodes of my life, here is the video...

<iframe width="560" height="315" src="https://www.youtube.com/embed/CFZyxNbkv5k" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


text:
from astroNN.gaia.downloader import anderson_2017_parallax, gaiadr2_parallax
from astroNN.gaia.downloader import tgas, gaia_source
from astroNN.gaia.downloader import tgas_load
from astroNN.gaia.gaia_shared import gaia_default_dr, gaia_env
from astroNN.gaia.gaia_shared import mag_to_absmag, mag_to_fakemag, absmag_to_pc, fakemag_to_absmag, absmag_to_fakemag, \
    fakemag_to_pc, fakemag_to_logsol, absmag_to_logsol, logsol_to_fakemag, logsol_to_absmag, extinction_correction, \
    fakemag_to_parallax, fakemag_to_mag


text:
angular.module('MyModule').factory('UtilityService', function ($window) {
   'use strict';
   var UtilityServiceFactory = {};

   UtilityServiceFactory.randomInt = function (min, max) {
      return Math.floor(Math.random() * (max - min + 1)) + min;
   };

   UtilityServiceFactory.random = function (min, max) {
      return Math.random() * (max - min) + min;
   };

   return UtilityServiceFactory;
});


text:
package HxCKDMS.HxCBlocks.Items;
// Reimplementation of "Methylene Blue" from MineChem
import HxCKDMS.HxCBlocks.Registry.CreativeTabHxCBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class ItemMetBlue extends ItemFood {
    public ItemMetBlue() {
        super(0, 0F, false);
        this.setCreativeTab(CreativeTabHxCBlocks.tabHxCBlocks);
        this.setUnlocalizedName("MetBlue");
        this.setTextureName("HxCBlocks:MetBlue");
        this.setMaxStackSize(32);
        this.setAlwaysEdible();
    }

    @Override
    public EnumAction getItemUseAction(ItemStack f){
        return EnumAction.drink;
    }

    @Override
    protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
        List<PotionEffect> activePotions = new ArrayList<>((Collection<PotionEffect>) player.getActivePotionEffects());
        for(PotionEffect potionEffect : activePotions) player.removePotionEffect(potionEffect.getPotionID());
        player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 600, 1));
        player.addPotionEffect(new PotionEffect(Potion.weakness.getId(), 1200, 2));
        player.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle));
        super.onFoodEaten(stack, world, player);
    }

    @Override
    @SuppressWarnings("unchecked")
    public void addInformation(ItemStack stack, EntityPlayer player, List tt, boolean boo) {
        super.addInformation(stack, player, tt, boo);
        try {
            tt.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("metblue.tooltip"));
        } catch (Exception ignored){}
    }

}


text:
Zezwoliæ na niewiarygodny routing

<tt>allow_untrusted_routing</tt>

Ten parametr okre¶la, czy Postfix bêdzie kierowa³ pocztê od niewiarygodnych
klientów do miejsc przeznaczenia b³ogos³awionych przez parametr
<tt>relay_domains</tt> drog± okre¶lon± przez nadawcê
(uzytkownik[@%!]zdalne[@%!]miejsce).

Domy¶lnie, niewiarygodnym klientom nie wolno okre¶laæ routingu. Zamyka to
wstrêtn± lukê "open relay", gdy zapasowy host MX mo¿e zostaæ oszukany
w celu przekazania niechcianej poczty podstawowemu hostowi MX, który
nastêpnie rozsy³a j± jako spam po ¶wiecie.


text:
<?php
namespace Application;

use Application\BaseApi;

class ContactApi extends BaseApi
{
    public function contact($name, $email, $subject, $comment, $clientId, $clientSecret)
    {

        $url = $this->baseApiUrl . '/v2.1/contact';
        $params = array(
            'client_id'     => $clientId,
            'client_secret' => $clientSecret,
            'name'          => $name,
            'email'         => $email,
            'subject'       => $subject,
            'comment'       => $comment,
        );

        list($status, $result) = $this->apiPost($url, $params);

        if ($status == 202) {
            return true;
        }

        $result = json_decode($result);
        $message = $result[0];

        throw new \Exception("Failed: " . $message);
    }
}


text:
#pragma once
#include <limits>
#include <string>
#include <algorithm>
#include <vector>
#include <ostream>
#include "util/lp/lp_settings.h"
namespace lean {
template <typename T, typename X> class lp_core_solver_base; // forward definition

template <typename T, typename X>
class core_solver_pretty_printer {
    std::ostream & m_out;
    template<typename A> using vector = std::vector<A>;
    typedef std::string string;
    lp_core_solver_base<T, X> & m_core_solver;
    vector<unsigned> m_column_widths;
    vector<vector<string>> m_A;
    vector<vector<string>> m_signs;
    vector<string> m_costs;
    vector<string> m_cost_signs;
    vector<string> m_lows; // low bounds
    vector<string> m_upps; // upper bounds
    vector<string> m_lows_signs;
    vector<string> m_upps_signs;
    unsigned m_rs_width;
    vector<X> m_rs;
    unsigned m_title_width;
    std::string m_cost_title;
    std::string m_basis_heading_title;
    std::string m_x_title;
    std::string m_low_bounds_title = "low";
    std::string m_upp_bounds_title = "upp";
    std::string m_exact_norm_title = "exact cn";
    std::string m_approx_norm_title = "approx cn";

    unsigned ncols() { return m_core_solver.m_A.column_count(); }
    unsigned nrows() { return m_core_solver.m_A.row_count(); }
    unsigned m_artificial_start = std::numeric_limits<unsigned>::max();
    T * m_w_buff;
    T * m_ed_buff;
    vector<T> m_exact_column_norms;

public:
    core_solver_pretty_printer(lp_core_solver_base<T, X > & core_solver, std::ostream & out);

    void init_costs();

    ~core_solver_pretty_printer();
    void init_rs_width();

    T current_column_norm();

    void init_m_A_and_signs();

    void init_column_widths();

    void adjust_width_with_low_bound(unsigned column, unsigned & w);
    void adjust_width_with_upper_bound(unsigned column, unsigned & w);

    void adjust_width_with_bounds(unsigned column, unsigned & w);

    void adjust_width_with_basis_heading(unsigned column, unsigned & w) {
        w = std::max(w, (unsigned)T_to_string(m_core_solver.m_basis_heading[column]).size());
    }

    unsigned get_column_width(unsigned column);

    unsigned regular_cell_width(unsigned row, unsigned column, std::string name) {
        return regular_cell_string(row, column, name).size();
    }

    std::string regular_cell_string(unsigned row, unsigned column, std::string name);

    void set_coeff(vector<string>& row, vector<string> & row_signs, unsigned col, const T & t, string name);

    void print_x();

    std::string get_low_bound_string(unsigned j);

    std::string get_upp_bound_string(unsigned j);

    void print_lows();

    void print_upps();

    string get_exact_column_norm_string(unsigned col) {
        return T_to_string(m_exact_column_norms[col]);
    }

    void print_exact_norms();

    void print_approx_norms();

    void print();

    void print_basis_heading();

    void print_bottom_line() {
        m_out << "----------------------" << std::endl;
    }

    void print_cost();

    void print_given_rows(vector<string> & row, vector<string> & signs, X rst);

    void print_row(unsigned i);
};
}


text:
<?php

namespace Enhavo\Bundle\UserBundle\Command;

use Enhavo\Bundle\UserBundle\Mapper\UserMapperInterface;
use Enhavo\Bundle\UserBundle\Model\UserInterface;
use Enhavo\Bundle\UserBundle\User\UserManager;
use Sylius\Component\Resource\Factory\FactoryInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;

/**
 * Class CreateUserCommand
 * @package Enhavo\Bundle\UserBundle\Command
 *
 * @property $userFactory UserFactory
 */
class CreateUserCommand extends Command
{
    protected static $defaultName = 'enhavo:user:create';

    /** @var UserManager */
    private $userManager;

    /** @var FactoryInterface */
    private $userFactory;

    /** @var UserMapperInterface */
    private $userMapper;

    /**
     * CreateUserCommand constructor.
     * @param UserManager $userManager
     * @param FactoryInterface $userFactory
     * @param UserMapperInterface $userMapper
     */
    public function __construct(UserManager $userManager, FactoryInterface $userFactory, UserMapperInterface $userMapper)
    {
        $this->userManager = $userManager;
        $this->userFactory = $userFactory;
        $this->userMapper = $userMapper;

        parent::__construct();
    }

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $definition = [];
        $properties = $this->userMapper->getRegisterProperties();
        foreach ($properties as $property) {
            $definition[] = new InputArgument($property, InputArgument::REQUIRED, sprintf('The %s required for login', $property));
        }
        $definition[] = new InputArgument('password', InputArgument::REQUIRED, 'The password');
        $definition[] = new InputOption('super-admin', null, InputOption::VALUE_NONE, 'Set the user as super admin');
        $definition[] = new InputOption('inactive', null, InputOption::VALUE_NONE, 'Set the user as inactive');

        $this
            ->setName('enhavo:user:create')
            ->setDescription('Create a user.')
            ->setDefinition($definition)
            ->setHelp(<<<'EOT'
The <info>enhavo:user:create</info> command creates a user:

  <info>php %command.full_name% matthieu</info>

This interactive shell will ask you for credentials and then a password.

You can alternatively specify the credentials and password as the following arguments:

  <info>php %command.full_name% matthieu@example.com mypassword</info>

You can create a super admin via the super-admin flag:

  <info>php %command.full_name% admin --super-admin</info>

You can create an inactive user (will not be able to log in):

  <info>php %command.full_name% thibault --inactive</info>

EOT
            );
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $credentials = [];
        $properties = $this->userMapper->getRegisterProperties();
        foreach ($properties as $property) {
            $credentials[$property] = $input->getArgument($property);
        }

        $password = $input->getArgument('password');
        $inactive = $input->getOption('inactive');
        $superadmin = $input->getOption('super-admin');

        /** @var UserInterface $user */
        $user = $this->userFactory->createNew();
        $user->setPlainPassword($password);
        $user->setEnabled((bool) !$inactive);
        $user->setSuperAdmin((bool) $superadmin);
        $this->userMapper->mapValues($user, $credentials);
        $this->userManager->add($user);

        $output->writeln(sprintf('Created user <comment>%s</comment>', $user->getUsername()));
    }

    /**
     * {@inheritdoc}
     */
    protected function interact(InputInterface $input, OutputInterface $output)
    {
        $questions = [];
        $properties = $this->userMapper->getRegisterProperties();

        foreach ($properties as $property) {
            if (!$input->getArgument($property)) {
                $question = new Question(sprintf('Please choose a %s:', $property));
                $question->setValidator(function ($username) use ($property) {
                    if (empty($username)) {
                        throw new \Exception(sprintf('%s can not be empty', $property));
                    }

                    return $username;
                });
                $questions[$property] = $question;
            }
        }

        if (!$input->getArgument('password')) {
            $question = new Question('Please choose a password:');
            $question->setValidator(function ($password) {
                if (empty($password)) {
                    throw new \Exception('Password can not be empty');
                }

                return $password;
            });
            $question->setHidden(true);
            $questions['password'] = $question;
        }

        foreach ($questions as $name => $question) {
            $answer = $this->getHelper('question')->ask($input, $output, $question);
            $input->setArgument($name, $answer);
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">

    <title>A Pen by  Benjamin Cashman</title>

        <link rel="stylesheet" href="css/style.css">

    <!DOCTYPE html>

  <title>Ben's Notes</title>

Welcome to my notes.

Lesson 1, HTML and the Web

  HTML is the language of the web,it stands  for Hyper Text Markup language. The majority of the web pages that we view are based in HTML. In order to access these HTML documents we must what we call the Web,
  which is a massive agregate of computeres that communicate with one another. Because the web has such a wealth of data we employ the use of a search engine/browser such as Google Chrome to assist us in finding the files that are relevant to what we
  are looking for.

 HTML     continued

The HTML documents of the web are made up primarily with two items, which are: Elements, and Tags. Elements hold all of the content and how they are displayed is determined using tags. For example I have made the
  word Bold bold with a bold tag. There are two types of elements which are:
  Block and Inline. Inline elements usually happen on the same line of text as they are written, and block elements form invisible boxes arount the content they enclose.

Lesson 2, The structure of HTML

HTML as I stated earlier is made up of elements and tags. By using developer tools via google chrome you can inspect a page and the elements within it. When looking at a page with developer tools you can see the entire structure of a page and all of its elements.

   When you break down the structure of an HTML page you can see that it is made up of many boxes. Some of these boxes are even nested within other boxes creating a tree like structure.


text:
[![CI Status](http://img.shields.io/travis/saorsa/saorsa.PXQLinkedIn.svg?style=flat)](https://travis-ci.org/Atanas Dragolov/PXQLinkedIn)
[![Version](https://img.shields.io/cocoapods/v/PXQLinkedIn.svg?style=flat)](http://cocoapods.org/pods/PXQLinkedIn)
[![License](https://img.shields.io/cocoapods/l/PXQLinkedIn.svg?style=flat)](http://cocoapods.org/pods/PXQLinkedIn)
[![Platform](https://img.shields.io/cocoapods/p/PXQLinkedIn.svg?style=flat)](http://cocoapods.org/pods/PXQLinkedIn)

## Usage

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

## Installation

PXQLinkedIn is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "PXQLinkedIn"
```

## Author

Atanas Dragolov, atanas.dragolov@saorsa.bg

## License

PXQLinkedIn is available under the MIT license. See the LICENSE file for more info.