text:
#pragma once

#include "crypto/s2n_hash.h"

/* Codes from http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-5 */
#define TLS_NULL_WITH_NULL_NULL             0x00, 0x00
#define TLS_RSA_WITH_AES_256_CBC_SHA256     0x00, 0x3D
#define TLS_RSA_WITH_AES_256_CBC_SHA        0x00, 0x35
#define TLS_RSA_WITH_AES_128_CBC_SHA256     0x00, 0x3C
#define TLS_RSA_WITH_AES_128_CBC_SHA        0x00, 0x2F
#define TLS_RSA_WITH_3DES_EDE_CBC_SHA       0x00, 0x0A
#define TLS_RSA_WITH_RC4_128_MD5            0x00, 0x04
#define TLS_RSA_WITH_RC4_128_SHA            0x00, 0x05

#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA    0x00, 0x33
#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x00, 0x67
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA    0x00, 0x39
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x00, 0x6B
#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA   0x00, 0x16

#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA       0xC0, 0x09
#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256    0xC0, 0x23
#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA       0xC0, 0x0A
#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384    0xC0, 0x24

#define TLS_ECDHE_RSA_WITH_RC4_128_SHA           0xC0, 0x11
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA       0xC0, 0x13
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256    0xC0, 0x27
#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA       0xC0, 0x14
#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384    0xC0, 0x28
#define TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA      0xC0, 0x12

#define TLS_RSA_WITH_AES_128_GCM_SHA256          0x00, 0x9C
#define TLS_RSA_WITH_AES_256_GCM_SHA384          0x00, 0x9D
#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256      0x00, 0x9E
#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384      0x00, 0x9F
#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256  0xC0, 0x2B
#define TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384  0xC0, 0x2C
#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256    0xC0, 0x2F
#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384    0xC0, 0x30

#define TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256    0xCC, 0xA8
#define TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256  0xCC, 0xA9
#define TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256      0xCC, 0xAA

/* TLS 1.2 hybrid post-quantum definitions from https://tools.ietf.org/html/draft-campagna-tls-bike-sike-hybrid */
#define TLS_ECDHE_BIKE_RSA_WITH_AES_256_GCM_SHA384 0xFF, 0x04
#define TLS_ECDHE_SIKE_RSA_WITH_AES_256_GCM_SHA384 0xFF, 0x08
#define TLS_ECDHE_KYBER_RSA_WITH_AES_256_GCM_SHA384 0xFF, 0x0C
#define TLS_EXTENSION_PQ_KEM_PARAMETERS 0xFE01
#define TLS_PQ_KEM_EXTENSION_ID_BIKE1_L1_R1 1
#define TLS_PQ_KEM_EXTENSION_ID_BIKE1_L1_R2 13
#define TLS_PQ_KEM_EXTENSION_ID_BIKE1_L1_R3 25
#define TLS_PQ_KEM_EXTENSION_ID_SIKE_P503_R1 10
#define TLS_PQ_KEM_EXTENSION_ID_SIKE_P434_R3 19
#define TLS_PQ_KEM_EXTENSION_ID_KYBER_512_R2 23
#define TLS_PQ_KEM_EXTENSION_ID_KYBER_512_90S_R2 24
#define TLS_PQ_KEM_EXTENSION_ID_KYBER_512_R3 28

/* TLS 1.3 hybrid post-quantum definitions are from the proposed reserved range defined
 * in https://tools.ietf.org/html/draft-stebila-tls-hybrid-design. Values for interoperability are defined in
 * https://github.com/open-quantum-safe/openssl/blob/OQS-OpenSSL_1_1_1-stable/oqs-template/oqs-kem-info.md */
#define TLS_PQ_KEM_GROUP_ID_X25519_SIKE_P434_R3     0x2F27
#define TLS_PQ_KEM_GROUP_ID_SECP256R1_SIKE_P434_R3  0x2F1F
#define TLS_PQ_KEM_GROUP_ID_X25519_BIKE1_L1_R2      0x2F28
#define TLS_PQ_KEM_GROUP_ID_SECP256R1_BIKE1_L1_R2   0x2F23
#define TLS_PQ_KEM_GROUP_ID_X25519_KYBER_512_R2     0x2F26
#define TLS_PQ_KEM_GROUP_ID_SECP256R1_KYBER_512_R2  0x2F0F
#define TLS_PQ_KEM_GROUP_ID_X25519_BIKE_L1_R3       0x2F37
#define TLS_PQ_KEM_GROUP_ID_SECP256R1_BIKE_L1_R3    0x2F38
#define TLS_PQ_KEM_GROUP_ID_X25519_KYBER_512_R3     0x2F39
#define TLS_PQ_KEM_GROUP_ID_SECP256R1_KYBER_512_R3  0x2F3A

/* From https://tools.ietf.org/html/rfc7507 */
#define TLS_FALLBACK_SCSV                   0x56, 0x00
#define TLS_EMPTY_RENEGOTIATION_INFO_SCSV   0x00, 0xff

/* TLS 1.3 cipher suites from https://tools.ietf.org/html/rfc8446#appendix-B.4 */
#define TLS_AES_128_GCM_SHA256              0x13, 0x01
#define TLS_AES_256_GCM_SHA384              0x13, 0x02
#define TLS_CHACHA20_POLY1305_SHA256        0x13, 0x03
#define TLS_AES_128_CCM_SHA256              0x13, 0x04
#define TLS_AES_128_CCM_8_SHA256            0x13, 0x05

/* TLS extensions from https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml */
#define TLS_EXTENSION_SERVER_NAME           0
#define TLS_EXTENSION_MAX_FRAG_LEN          1
#define TLS_EXTENSION_STATUS_REQUEST        5
#define TLS_EXTENSION_SUPPORTED_GROUPS     10
#define TLS_EXTENSION_EC_POINT_FORMATS     11
#define TLS_EXTENSION_SIGNATURE_ALGORITHMS 13
#define TLS_EXTENSION_ALPN                 16
#define TLS_EXTENSION_SCT_LIST             18
#define TLS_EXTENSION_EMS                  23
#define TLS_EXTENSION_SESSION_TICKET       35
#define TLS_EXTENSION_PRE_SHARED_KEY       41
#define TLS_EXTENSION_CERT_AUTHORITIES     47
#define TLS_EXTENSION_RENEGOTIATION_INFO   65281

/* TLS 1.3 extensions from https://tools.ietf.org/html/rfc8446#section-4.2 */
#define TLS_EXTENSION_EARLY_DATA             42
#define TLS_EXTENSION_SUPPORTED_VERSIONS     43
#define TLS_EXTENSION_COOKIE                 44
#define TLS_EXTENSION_PSK_KEY_EXCHANGE_MODES 45
#define TLS_EXTENSION_KEY_SHARE              51

/* TLS 1.3 pre-shared key exchange modes from https://tools.ietf.org/html/rfc8446#section-4.2.9 */
#define TLS_PSK_KE_MODE     0
#define TLS_PSK_DHE_KE_MODE 1

/**
 *= https://tools.ietf.org/id/draft-ietf-quic-tls-32.txt#8.2
 *#   enum {
 *#      quic_transport_parameters(0xffa5), (65535)
 *#   } ExtensionType;
 */
#define TLS_QUIC_TRANSPORT_PARAMETERS      0xffa5

/* TLS SignatureScheme (Backwards compatible with SigHash and SigAlg values above) */
/* Defined here: https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-signaturescheme */
#define TLS_SIGNATURE_SCHEME_RSA_PKCS1_SHA1             0x0201
#define TLS_SIGNATURE_SCHEME_RSA_PKCS1_SHA224           0x0301
#define TLS_SIGNATURE_SCHEME_RSA_PKCS1_SHA256           0x0401
#define TLS_SIGNATURE_SCHEME_RSA_PKCS1_SHA384           0x0501
#define TLS_SIGNATURE_SCHEME_RSA_PKCS1_SHA512           0x0601

/* In TLS 1.0 and 1.1 the hard-coded default scheme was RSA_PKCS1_MD5_SHA1, but there's no IANA defined backwards
 * compatible value for that Scheme for TLS 1.2 and 1.3. So we define an internal value in the private range that won't
 * match anything in the valid range so that all TLS Versions can use the same SignatureScheme negotiation abstraction
 * layer. This scheme isn't in any preference list, so it can't be negotiated even if a client sent it in its pref list. */
#define TLS_SIGNATURE_SCHEME_PRIVATE_INTERNAL_RSA_PKCS1_MD5_SHA1         0xFFFF

/* TLS 1.2 Backwards Compatible ECDSA Schemes */
#define TLS_SIGNATURE_SCHEME_ECDSA_SHA1                 0x0203
#define TLS_SIGNATURE_SCHEME_ECDSA_SHA224               0x0303
#define TLS_SIGNATURE_SCHEME_ECDSA_SHA256               0x0403
#define TLS_SIGNATURE_SCHEME_ECDSA_SHA384               0x0503
#define TLS_SIGNATURE_SCHEME_ECDSA_SHA512               0x0603

/* TLS 1.3 ECDSA Signature Schemes */
#define TLS_SIGNATURE_SCHEME_ECDSA_SECP256R1_SHA256     0x0403
#define TLS_SIGNATURE_SCHEME_ECDSA_SECP384R1_SHA384     0x0503
#define TLS_SIGNATURE_SCHEME_ECDSA_SECP521R1_SHA512     0x0603
#define TLS_SIGNATURE_SCHEME_RSA_PSS_RSAE_SHA256        0x0804
#define TLS_SIGNATURE_SCHEME_RSA_PSS_RSAE_SHA384        0x0805
#define TLS_SIGNATURE_SCHEME_RSA_PSS_RSAE_SHA512        0x0806
#define TLS_SIGNATURE_SCHEME_ED25519                    0x0807
#define TLS_SIGNATURE_SCHEME_ED448                      0x0808
#define TLS_SIGNATURE_SCHEME_RSA_PSS_PSS_SHA256         0x0809
#define TLS_SIGNATURE_SCHEME_RSA_PSS_PSS_SHA384         0x080A
#define TLS_SIGNATURE_SCHEME_RSA_PSS_PSS_SHA512         0x080B

#define TLS_SIGNATURE_SCHEME_LEN                        2
#define TLS_SIGNATURE_SCHEME_LIST_MAX_LEN               64

/* The TLS record types we support */
#define SSLv2_CLIENT_HELLO     1
#define TLS_CHANGE_CIPHER_SPEC 20
#define TLS_ALERT              21
#define TLS_HANDSHAKE          22
#define TLS_APPLICATION_DATA   23

/* Elliptic curve formats from http://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-9
 * Only uncompressed is supported.
 */
#define TLS_EC_FORMAT_UNCOMPRESSED               0
#define TLS_EC_FORMAT_ANSIX962_COMPRESSED_PRIME  1
#define TLS_EC_FORMAT_ANSIX962_COMPRESSED_CHAR2  2

/* Elliptic curves from https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#tls-parameters-8 */
#define TLS_EC_CURVE_SECP_256_R1           23
#define TLS_EC_CURVE_SECP_384_R1           24
#define TLS_EC_CURVE_SECP_521_R1           25
#define TLS_EC_CURVE_ECDH_X25519           29
#define TLS_EC_CURVE_ECDH_X448             30

/* Ethernet maximum transmission unit (MTU)
 * MTU is usually associated with the Ethernet protocol,
 * where a 1500-byte packet is the largest allowed in it
 */
#define ETH_MTU 1500

#define IP_V4_HEADER_LENGTH 20
#define IP_V6_HEADER_LENGTH 40

#define TCP_HEADER_LENGTH 20
#define TCP_OPTIONS_LENGTH 40

#define S2N_TLS_MAX_FRAG_LEN_EXT_NONE   0

/* The maximum size of an SSL2 message is 2^14 - 1, as neither of the first two
 * bits in the length field are usable. Per;
 * http://www-archive.mozilla.org/projects/security/pki/nss/ssl/draft02.html
 * section 1.1
 */
#define S2N_SSL2_RECORD_HEADER_LENGTH   2
#define S2N_SSL2_MAXIMUM_MESSAGE_LENGTH 16383
#define S2N_SSL2_MAXIMUM_RECORD_LENGTH  (S2N_SSL2_MAXIMUM_MESSAGE_LENGTH + S2N_SSL2_RECORD_HEADER_LENGTH)

/* s2n can use a "small" record length that is aligned to the dominant internet MTU;
 * 1500 bytes, minus 20 bytes for an IP header, minus 20 bytes for a tcp
 * header and 20 bytes for tcp/ip options (timestamp, sack etc) and a "large" record
 * length that is designed to maximize throughput (fewer MACs per byte transferred
 * and better efficiency of crypto engines).
 */
#define S2N_SMALL_RECORD_LENGTH (1500 - 20 - 20 - 20)
#define S2N_SMALL_FRAGMENT_LENGTH (S2N_SMALL_RECORD_LENGTH - S2N_TLS_RECORD_HEADER_LENGTH)

/* Testing in the wild has found 8k max record sizes give a good balance of low latency
 * and throughput.
 */
#define S2N_DEFAULT_RECORD_LENGTH 8092
#define S2N_DEFAULT_FRAGMENT_LENGTH (S2N_DEFAULT_RECORD_LENGTH - S2N_TLS_RECORD_HEADER_LENGTH)

/* S2N_LARGE_RECORD_LENGTH is used for initializing output buffers, we use the largest
 * possible value of all supported protocols to avoid branching at runtime
 */
#define S2N_LARGE_RECORD_LENGTH S2N_TLS_MAXIMUM_RECORD_LENGTH
#define S2N_LARGE_FRAGMENT_LENGTH S2N_TLS_MAXIMUM_FRAGMENT_LENGTH

/* Cap dynamic record resize threshold to 8M */
#define S2N_TLS_MAX_RESIZE_THRESHOLD (1024 * 1024 * 8)

/* Put a 64k cap on the size of any handshake message */
#define S2N_MAXIMUM_HANDSHAKE_MESSAGE_LENGTH (64 * 1024)

/* Maximum size for full encoded TLSInnerPlaintext (https://tools.ietf.org/html/rfc8446#section-5.4) */
#define S2N_MAXIMUM_INNER_PLAINTEXT_LENGTH ((1 << 14) + 1)

/* Alert messages are always 2 bytes long */
#define S2N_ALERT_LENGTH 2

/* Handshake messages have their own header too */
#define TLS_HANDSHAKE_HEADER_LENGTH   4

#define S2N_MAX_SERVER_NAME 255


text:
"""Constants for the pi_hole intergration."""
from datetime import timedelta

DOMAIN = "pi_hole"

CONF_LOCATION = "location"

DEFAULT_HOST = "pi.hole"
DEFAULT_LOCATION = "admin"
DEFAULT_METHOD = "GET"
DEFAULT_NAME = "Pi-Hole"
DEFAULT_SSL = False
DEFAULT_VERIFY_SSL = True

SERVICE_DISABLE = "disable"
SERVICE_ENABLE = "enable"
SERVICE_DISABLE_ATTR_DURATION = "duration"

ATTR_BLOCKED_DOMAINS = "domains_blocked"

MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=5)

SENSOR_DICT = {
    "ads_blocked_today": ["Ads Blocked Today", "ads", "mdi:close-octagon-outline"],
    "ads_percentage_today": [
        "Ads Percentage Blocked Today",
        "%",
        "mdi:close-octagon-outline",
    ],
    "clients_ever_seen": ["Seen Clients", "clients", "mdi:account-outline"],
    "dns_queries_today": [
        "DNS Queries Today",
        "queries",
        "mdi:comment-question-outline",
    ],
    "domains_being_blocked": ["Domains Blocked", "domains", "mdi:block-helper"],
    "queries_cached": ["DNS Queries Cached", "queries", "mdi:comment-question-outline"],
    "queries_forwarded": [
        "DNS Queries Forwarded",
        "queries",
        "mdi:comment-question-outline",
    ],
    "unique_clients": ["DNS Unique Clients", "clients", "mdi:account-outline"],
    "unique_domains": ["DNS Unique Domains", "domains", "mdi:domain"],
}

SENSOR_LIST = list(SENSOR_DICT)

redpajama_set_name: RedPajamaGithub


text:
#ifndef BERRYEVALUATIONAUTHORITY_H
#define BERRYEVALUATIONAUTHORITY_H

#include "berryExpressionAuthority.h"

#include <berryIPropertyChangeListener.h>

#include <QHash>

namespace berry {

struct IEvaluationReference;

class EvaluationReference;
class Expression;
class Shell;

class EvaluationAuthority : public ExpressionAuthority
{

public:

  berryObjectMacro(berry::EvaluationAuthority);

private:

  static const QString COMPONENT;

  typedef QHash<SmartPointer<Expression>, QSet<SmartPointer<EvaluationReference> > > ExprToEvalsMapType;

  /**
   * A bucket sort of the evaluation references based on source priority. Each
   * reference will appear only once per set, but may appear in multiple sets.
   * If no references are defined for a particular priority level, then the
   * array at that index will only contain null.
   */
  QHash<QString,ExprToEvalsMapType> cachesBySourceName;
  IPropertyChangeListener::Events serviceListeners;
  MessageExceptionHandler<EvaluationAuthority> serviceExceptionHandler;
  int notifying;

  // private final Map cachesByExpression = new HashMap();

  QStringList GetNames(const SmartPointer<IEvaluationReference>& ref) const;

  /**
   * This will evaluate all refs with the same expression.
   *
   * @param refs
   */
  void RefsWithSameExpression(const QList<SmartPointer<EvaluationReference> >& refs);

  /**
   * @param sourceNames
   */
  void StartSourceChange(const QStringList& sourceNames);

  /**
   * @param sourceNames
   */
  void EndSourceChange(const QStringList& sourceNames);

  /**
   * @param ref
   * @param oldValue
   * @param newValue
   */
  void FirePropertyChange(const SmartPointer<IEvaluationReference>& ref,
                          Object::Pointer oldValue, Object::Pointer newValue);

  void FireServiceChange(const QString& property, Object::Pointer oldValue, Object::Pointer newValue);

  void ServiceChangeException(const std::exception& exc);

  Object::Pointer ValueOf(bool result);

protected:

  /**
   * Returns the currently active shell.
   *
   * @return The currently active shell; may be null.
   */
  SmartPointer<const Shell> GetActiveShell() const;

public:

  EvaluationAuthority();

  /*
   * @see ExpressionAuthority#SourceChanged(int)
   */
  void SourceChanged(int sourcePriority) override;

  /*
   * @see ExpressionAuthority#SourceChanged(QString)
   */
  void SourceChanged(const QStringList& sourceNames) override;

  using ExpressionAuthority::SourceChanged;

  void AddEvaluationListener(const SmartPointer<IEvaluationReference>& ref);

  /**
   * @param ref
   */
  void RemoveEvaluationListener(const SmartPointer<IEvaluationReference>& ref);

  /**
   * @param listener
   */
  void AddServiceListener(IPropertyChangeListener* listener);

  /**
   * @param listener
   */
  void RemoveServiceListener(IPropertyChangeListener* listener);

};

}

#endif // BERRYEVALUATIONAUTHORITY_H


text:
namespace suic
{

static int InternalGetHorizontalAlignment(const String& align)
{
    int val = HoriAlign::haCenter;

    if (align.Equals(_T("Left")) || align.Empty())
    {
        val = HoriAlign::haLeft;
    }
    else if (align.Equals(_T("Right")))
    {
        val = HoriAlign::haRight;
    }
    else if (align.Equals(_T("Stretch")))
    {
        val = HoriAlign::haStretch;
    }

    return val;
}

static int InternalGetVerticalAlignment(const String & align)
{
    int val = VertAlign::vaCenter;

    if (align.Equals(_T("Top")) || align.Empty())
    {
        val = VertAlign::vaTop;
    }
    else if (align.Equals(_T("Bottom")))
    {
        val = VertAlign::vaBottom;
    }
    else if (align.Equals(_T("Stretch")))
    {
        val = VertAlign::vaStretch;
    }

    return val;
}

AlignmentConvert::AlignmentConvert()
{

}

AlignmentConvert* AlignmentConvert::Convert = new AlignmentConvert();

AutoObj AlignmentConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (dp == FrameworkElement::HorizontalAlignmentProperty)
    {
        return HoriAlignBox::From(InternalGetHorizontalAlignment(val));
    }
    else if (dp == FrameworkElement::VerticalAlignmentProperty)
    {
        return VertAlignBox::From(InternalGetVerticalAlignment(val));
    }
    else if (dp == Control::HorizontalContentAlignmentProperty)
    {
        return HoriAlignBox::From(InternalGetHorizontalAlignment(val));
    }
    else if (dp == Control::VerticalContentAlignmentProperty)
    {
        return VertAlignBox::From(InternalGetVerticalAlignment(val));
    }
    else
    {
        return DpProperty::UnsetValue();
    }
}

OrientationConvert* OrientationConvert::Convert = new OrientationConvert();

OrientationConvert::OrientationConvert()
{

}

AutoObj OrientationConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_T("Vertical")))
    {
        return OrientationBox::VerticalBox;
    }
    else
    {
        return OrientationBox::HorizontalBox;
    }
}

//==========================================================
//

VisibilityConvert* VisibilityConvert::Convert = new VisibilityConvert();

VisibilityConvert::VisibilityConvert()
{

}

AutoObj VisibilityConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    Expression* expr = RTTICast<Expression>(prop);
    if (NULL == expr)
    {
        String val = prop->ToString();

        if (val.Equals(_T("Hidden")))
        {
            return VisibilityBox::HiddenBox;
        }
        else if (val.Equals(_T("Visible")))
        {
            return VisibilityBox::VisibleBox;
        }
        else if (val.Equals(_T("Collapsed")))
        {
            return VisibilityBox::CollapsedBox;
        }
        else
        {
            return VisibilityBox::VisibleBox;
        }
    }
    else
    {
        return DpProperty::UnsetValue();
    }
}

WindowStateConvert* WindowStateConvert::Convert = new WindowStateConvert();

AutoObj WindowStateConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_T("Maximized")))
    {
        return WindowStateBox::MaximizedBox;
    }
    else if (val.Equals(_T("Minimized")))
    {
        return WindowStateBox::MinimizedBox;
    }
    else
    {
        return WindowStateBox::NormalBox;
    }
}

DockConvert* DockConvert::Convert = new DockConvert();

AutoObj DockConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_T("Left")))
    {
        return Integer::GetPosInt(Dock::dockLeft);
    }
    else if (val.Equals(_T("Top")))
    {
        return Integer::GetPosInt(Dock::dockTop);
    }
    else if (val.Equals(_T("Right")))
    {
        return Integer::GetPosInt(Dock::dockRight);
    }
    else if (val.Equals(_T("Bottom")))
    {
        return Integer::GetPosInt(Dock::dockBottom);
    }
    else
    {
        throw ArgumentException(_U("Value of dock in invalid!"), __FILELINE__);
    }
}

DockConvert::DockConvert()
{
}

AutoP0Convert* AutoP0Convert::Convert = new AutoP0Convert();

AutoObj AutoP0Convert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();
    if (val.Equals(_U("Auto")))
    {
        return Integer::GetZeroInt();
    }
    else
    {
        return DpProperty::UnsetValue();
    }
}

AutoP0Convert::AutoP0Convert()
{

}

AutoN1Convert* AutoN1Convert::Convert = new AutoN1Convert();

AutoObj AutoN1Convert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();
    if (val.Equals(_U("Auto")))
    {
        return new Integer(-1);
    }
    else
    {
        return new Integer(val.ToInt());
    }
}

AutoN1Convert::AutoN1Convert()
{

}

FontWeightConvert* FontWeightConvert::Convert = new FontWeightConvert();

AutoObj FontWeightConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    static ValueDic<int, int> WeightDic;
    if (WeightDic.GetCount() == 0)
    {
        WeightDic.Add(String(_U("Black")).GetHashCode(), FontWeightStyle::fwBlack);
        WeightDic.Add(String(_U("Bold")).GetHashCode(), FontWeightStyle::fwBold);
        WeightDic.Add(String(_U("Light")).GetHashCode(), FontWeightStyle::fwLight);
        WeightDic.Add(String(_U("Medium")).GetHashCode(), FontWeightStyle::fwMedium);
        WeightDic.Add(String(_U("Normal")).GetHashCode(), FontWeightStyle::fwNormal);
        WeightDic.Add(String(_U("Thin")).GetHashCode(), FontWeightStyle::fwThin);
        WeightDic.Add(String(_U("SemiBold")).GetHashCode(), FontWeightStyle::fwSemiBold);
        WeightDic.Add(String(_U("ExtraBold")).GetHashCode(), FontWeightStyle::fwExtraBold);
        WeightDic.Add(String(_U("ExtraBlack")).GetHashCode(), FontWeightStyle::fwExtraBlack);
        WeightDic.Add(String(_U("ExtraLight")).GetHashCode(), FontWeightStyle::fwExtraLight);
    }

    // Black Bold Light Medium Normal Thin SemiBold ExtraBold ExtraBlack ExtraLight
    String val = prop->ToString();
    int iWeight = 0;

    if (WeightDic.TryGetValue(val.GetHashCode(), iWeight))
    {
        return new Integer(iWeight);
    }
    else
    {
        return new Integer(400);
    }
}

FontStyleConvert* FontStyleConvert::Convert = new FontStyleConvert();

AutoObj FontStyleConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    // Italic Normal Oblique

    String val = prop->ToString();

    if (val.Equals(_U("Italic")))
    {
        return Integer::GetPosInt(FontStyleStyle::fssItalic);
    }
    else if (val.Equals(_U("Underline")))
    {
        return Integer::GetPosInt(FontStyleStyle::fssUnderline);
    }
    else if (val.Equals(_U("Oblique")))
    {
        return Integer::GetPosInt(FontStyleStyle::fssOblique);
    }
    else
    {
        return Integer::GetPosInt(FontStyleStyle::fssNormal);
    }
}

TextTrimmingConvert* TextTrimmingConvert::Convert = new TextTrimmingConvert();

AutoObj TextTrimmingConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_U("CharacterEllipsis")))
    {
        return Integer::GetPosInt(TextTrimming::tCharacterEllipsis);
    }
    else if (val.Equals(_U("WordEllipsis")))
    {
        return Integer::GetPosInt(TextTrimming::tWordEllipsis);
    }
    else
    {
        return Integer::GetPosInt(TextTrimming::tNone);
    }
}

TextAlignmentConvert* TextAlignmentConvert::Convert = new TextAlignmentConvert();

AutoObj TextAlignmentConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_U("Left")))
    {
        return Integer::GetPosInt(TextAlignment::tLeft);
    }
    else if (val.Equals(_U("Center")))
    {
        return Integer::GetPosInt(TextAlignment::tCenter);
    }
    else if (val.Equals(_U("Right")))
    {
        return Integer::GetPosInt(TextAlignment::tRight);
    }
    else
    {
        return Integer::GetPosInt(TextAlignment::tJustify);
    }
}

TextDecorationsConvert* TextDecorationsConvert::Convert = new TextDecorationsConvert();

AutoObj TextDecorationsConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();
    if (val.Equals(_U("Underline")))
    {
        return TextDecorations::underline;
    }
    else if (val.Equals(_U("Overline")))
    {
        return TextDecorations::overline;
    }
    else if (val.Equals(_U("Baseline")))
    {
        return TextDecorations::baseline;
    }
    else if (val.Equals(_U("StrikeThrough")))
    {
        return TextDecorations::strikethrough;
    }
    else
    {
        return suic::DpProperty::UnsetValue();
    }
}

TextWrappingConvert* TextWrappingConvert::Convert = new TextWrappingConvert();

AutoObj TextWrappingConvert::ConvertValue(DpProperty* dp, Object* prop)
{
    String val = prop->ToString();

    if (val.Equals(_U("Wrap")))
    {
        return Integer::GetPosInt(TextWrapping::tWrap);
    }
    else if (val.Equals(_U("WrapWithOverflow")))
    {
        return Integer::GetPosInt(TextWrapping::tWrapWithOverflow);
    }
    else
    {
        return Integer::GetPosInt(TextWrapping::tNoWrap);
    }
}

}


text:
#ifndef PG_UPGRADE_H
#define PG_UPGRADE_H

#include <unistd.h>
#include <assert.h>
#include <sys/stat.h>
#include <sys/time.h>

#include "postgres.h"
#include "libpq-fe.h"
#include "pqexpbuffer.h"

/* Use port in the private/dynamic port number range */
#define DEF_PGUPORT			50432

/* Allocate for null byte */
#define USER_NAME_SIZE		128

#define MAX_STRING			1024
#define LINE_ALLOC			4096
#define QUERY_ALLOC			8192

#define MIGRATOR_API_VERSION	1

#define MESSAGE_WIDTH		60

#define GET_MAJOR_VERSION(v)	((v) / 100)

/* contains both global db information and CREATE DATABASE commands */
#define GLOBALS_DUMP_FILE	"pg_upgrade_dump_globals.sql"
#define DB_DUMP_FILE_MASK	"pg_upgrade_dump_%u.custom"

#define DB_DUMP_LOG_FILE_MASK	"pg_upgrade_dump_%u.log"
#define SERVER_LOG_FILE		"pg_upgrade_server.log"
#define UTILITY_LOG_FILE	"pg_upgrade_utility.log"
#define INTERNAL_LOG_FILE	"pg_upgrade_internal.log"

extern char *output_files[];

/*
 * WIN32 files do not accept writes from multiple processes
 *
 * On Win32, we can't send both pg_upgrade output and command output to the
 * same file because we get the error: "The process cannot access the file
 * because it is being used by another process." so send the pg_ctl
 * command-line output to a new file, rather than into the server log file.
 * Ideally we could use UTILITY_LOG_FILE for this, but some Windows platforms
 * keep the pg_ctl output file open by the running postmaster, even after
 * pg_ctl exits.
 *
 * We could use the Windows pgwin32_open() flags to allow shared file
 * writes but is unclear how all other tools would use those flags, so
 * we just avoid it and log a little differently on Windows;  we adjust
 * the error message appropriately.
 */
#ifndef WIN32
#define SERVER_START_LOG_FILE	SERVER_LOG_FILE
#define SERVER_STOP_LOG_FILE	SERVER_LOG_FILE
#else
#define SERVER_START_LOG_FILE	"pg_upgrade_server_start.log"
/*
 *	"pg_ctl start" keeps SERVER_START_LOG_FILE and SERVER_LOG_FILE open
 *	while the server is running, so we use UTILITY_LOG_FILE for "pg_ctl
 *	stop".
 */
#define SERVER_STOP_LOG_FILE	UTILITY_LOG_FILE
#endif

#ifndef WIN32
#define pg_mv_file			rename
#define pg_link_file		link
#define PATH_SEPARATOR		'/'
#define PATH_QUOTE	'\''
#define RM_CMD				"rm -f"
#define RMDIR_CMD			"rm -rf"
#define SCRIPT_PREFIX		"./"
#define SCRIPT_EXT			"sh"
#define ECHO_QUOTE	"'"
#define ECHO_BLANK	""
#else
#define pg_mv_file			pgrename
#define pg_link_file		win32_pghardlink
#define PATH_SEPARATOR		'\\'
#define PATH_QUOTE	'"'
#define RM_CMD				"DEL /q"
#define RMDIR_CMD			"RMDIR /s/q"
#define SCRIPT_PREFIX		""
#define SCRIPT_EXT			"bat"
#define EXE_EXT				".exe"
#define ECHO_QUOTE	""
#define ECHO_BLANK	"."
#endif

#define atooid(x)  ((Oid) strtoul((x), NULL, 10))

/* OID system catalog preservation added during PG 9.0 development */
#define TABLE_SPACE_SUBDIRS_CAT_VER 201001111
/* postmaster/postgres -b (binary_upgrade) flag added during PG 9.1 development */
/* In GPDB, it was introduced during GPDB 5.0 development. */
#define BINARY_UPGRADE_SERVER_FLAG_CAT_VER 301607301

/*
 *	Visibility map changed with this 9.2 commit,
 *	8f9fe6edce358f7904e0db119416b4d1080a83aa; pick later catalog version.
 */
#define VISIBILITY_MAP_CRASHSAFE_CAT_VER 201107031

/*
 * change in JSONB format during 9.4 beta
 */
#define JSONB_FORMAT_CHANGE_CAT_VER 201409291

/*
 * The format of visibility map is changed with this 9.6 commit,
 */
#define VISIBILITY_MAP_FROZEN_BIT_CAT_VER 201603011

/*
 * pg_multixact format changed in 9.3 commit 0ac5ad5134f2769ccbaefec73844f85,
 * ("Improve concurrency of foreign key locking") which also updated catalog
 * version to this value.  pg_upgrade behavior depends on whether old and new
 * server versions are both newer than this, or only the new one is.
 *
 * In GPDB: that upstream change was merged into GPDB in the big 9.3 merge
 * commit.
 */
#define MULTIXACT_FORMATCHANGE_CAT_VER 301809211

/*
 * Extra information stored for each Append-only table.
 * This is used to transfer the information from the auxiliary
 * AO table to the new cluster.
 */

/* To hold contents of pg_visimap_<oid> */
typedef struct
{
	int			segno;
	int64		first_row_no;
	char	   *visimap;		/* text representation of the "bit varying" field */
} AOVisiMapInfo;

typedef struct
{
	int			segno;
	int			columngroup_no;
	int64		first_row_no;
	char	   *minipage;		/* text representation of the "bit varying" field */
} AOBlkDir;

/* To hold contents of pg_aoseg_<oid> */
typedef struct
{
	int			segno;
	int64		eof;
	int64		tupcount;
	int64		varblockcount;
	int64		eofuncompressed;
	int64		modcount;
	int16		version;
	int16		state;
} AOSegInfo;

/* To hold contents of pf_aocsseg_<oid> */
typedef struct
{
	int         segno;
	int64		tupcount;
	int64		varblockcount;
	char       *vpinfo;
	int64		modcount;
	int16		state;
	int16		version;
} AOCSSegInfo;

typedef struct
{
	int16		attlen;
	char		attalign;
	bool		is_numeric;
} AttInfo;

typedef enum
{
	HEAP,
	AO,
	AOCS,
	FSM
} RelType;

/*
 * large object chunk size added to pg_controldata,
 * commit 5f93c37805e7485488480916b4585e098d3cc883
 */
#define LARGE_OBJECT_SIZE_PG_CONTROL_VER 942

/*
 * change in JSONB format during 9.4 beta
 */
#define JSONB_FORMAT_CHANGE_CAT_VER 201409291

/*
 * Each relation is represented by a relinfo structure.
 */
typedef struct
{
	/* Can't use NAMEDATALEN; not guaranteed to be same on client */
	char	   *nspname;		/* namespace name */
	char	   *relname;		/* relation name */
	Oid			reloid;			/* relation oid */
	char		relstorage;
	Oid			relfilenode;	/* relation relfile node */
	Oid			indtable;		/* if index, OID of its table, else 0 */
	Oid			toastheap;		/* if toast table, OID of base table, else 0 */
	char	   *tablespace;		/* tablespace path; "" for cluster default */
	bool		nsp_alloc;		/* should nspname be freed? */
	bool		tblsp_alloc;	/* should tablespace be freed? */

	RelType		reltype;

	/* Extra information for append-only tables */
	AOSegInfo  *aosegments;
	AOCSSegInfo *aocssegments;
	int			naosegments;
	AOVisiMapInfo *aovisimaps;
	int			naovisimaps;
	AOBlkDir   *aoblkdirs;
	int			naoblkdirs;

	/* Extra information for heap tables */
	bool		gpdb4_heap_conversion_needed;
	bool		has_numerics;
	AttInfo	   *atts;
	int			natts;
} RelInfo;

typedef struct
{
	RelInfo    *rels;
	int			nrels;
} RelInfoArr;

/*
 * The following structure represents a relation mapping.
 */
typedef struct
{
	const char *old_tablespace;
	const char *new_tablespace;
	const char *old_tablespace_suffix;
	const char *new_tablespace_suffix;
	Oid			old_db_oid;
	Oid			new_db_oid;

	/*
	 * old/new relfilenodes might differ for pg_largeobject(_metadata) indexes
	 * due to VACUUM FULL or REINDEX.  Other relfilenodes are preserved.
	 */
	Oid			old_relfilenode;
	Oid			new_relfilenode;
	/* the rest are used only for logging and error reporting */
	char	   *nspname;		/* namespaces */
	char	   *relname;

	bool		missing_seg0_ok;

	RelType		type;			/* Type of relation */

	/* Extra information for heap tables */
	bool		gpdb4_heap_conversion_needed;
	bool		has_numerics;
	AttInfo	   *atts;
	int			natts;
} FileNameMap;

/*
 * Structure to store database information
 */
typedef struct
{
	Oid			db_oid;			/* oid of the database */
	char	   *db_name;		/* database name */
	char		db_tablespace[MAXPGPATH];	/* database default tablespace
											 * path */
	char	   *db_collate;
	char	   *db_ctype;
	int			db_encoding;
	RelInfoArr	rel_arr;		/* array of all user relinfos */
} DbInfo;

typedef struct
{
	DbInfo	   *dbs;			/* array of db infos */
	int			ndbs;			/* number of db infos */
} DbInfoArr;

/*
 * The following structure is used to hold pg_control information.
 * Rather than using the backend's control structure we use our own
 * structure to avoid pg_control version issues between releases.
 */
typedef struct
{
	uint32		ctrl_ver;
	uint32		cat_ver;
	char		nextxlogfile[25];
	uint32		chkpnt_nxtxid;
	uint32		chkpnt_nxtepoch;
	uint64		chkpnt_nxtgxid;
	uint32		chkpnt_nxtoid;
	uint32		chkpnt_nxtmulti;
	uint32		chkpnt_nxtmxoff;
	uint32		chkpnt_oldstMulti;
	uint32		align;
	uint32		blocksz;
	uint32		largesz;
	uint32		walsz;
	uint32		walseg;
	uint32		ident;
	uint32		index;
	uint32		toast;
	uint32		large_object;
	bool		date_is_int;
	bool		float8_pass_by_value;
	bool		data_checksum_version;
} ControlData;

/*
 * Enumeration to denote transfer modes
 */
typedef enum
{
	TRANSFER_MODE_CLONE,
	TRANSFER_MODE_COPY,
	TRANSFER_MODE_LINK
} transferMode;

/*
 * Enumeration to denote pg_log modes
 */
typedef enum
{
	PG_VERBOSE,
	PG_STATUS,
	PG_REPORT,
	PG_WARNING,
	PG_FATAL
} eLogType;

typedef long pgpid_t;

/*
 * cluster
 *
 *	information about each cluster
 */
typedef struct
{
	ControlData controldata;	/* pg_control information */
	DbInfoArr	dbarr;			/* dbinfos array */
	char	   *pgdata;			/* pathname for cluster's $PGDATA directory */
	char	   *pgconfig;		/* pathname for cluster's config file
								 * directory */
	char	   *bindir;			/* pathname for cluster's executable directory */
	char	   *pgopts;			/* options to pass to the server, like pg_ctl
								 * -o */
	char	   *sockdir;		/* directory for Unix Domain socket, if any */
	unsigned short port;		/* port number where postmaster is waiting */
	uint32		major_version;	/* PG_VERSION of cluster */
	char		major_version_str[64];	/* string PG_VERSION of cluster */
	uint32		bin_version;	/* version returned from pg_ctl */
	const char *tablespace_suffix;	/* directory specification */
} ClusterInfo;

/*
 *	LogOpts
*/
typedef struct
{
	FILE	   *internal;		/* internal log FILE */
	bool		verbose;		/* true -> be verbose in messages */
	bool		retain;			/* retain log files on success */
} LogOpts;

/*
 *	UserOpts
*/
typedef struct
{
	bool		check;			/* true -> ask user for permission to make
								 * changes */
	transferMode transfer_mode; /* copy files or link them? */
	int			jobs;			/* number of processes/threads to use */
	char	   *socketdir;		/* directory to use for Unix sockets */
} UserOpts;

typedef struct
{
	char	   *name;
	int			dbnum;
} LibraryInfo;

/*
 * OSInfo
 */
typedef struct
{
	const char *progname;		/* complete pathname for this program */
	char	   *exec_path;		/* full path to my executable */
	char	   *user;			/* username for clusters */
	bool		user_specified; /* user specified on command-line */
	char	  **old_tablespaces;	/* tablespaces */
	int			num_old_tablespaces;
	LibraryInfo *libraries;		/* loadable libraries */
	int			num_libraries;
	ClusterInfo *running_cluster;
} OSInfo;

/*
 * Global variables
 */
extern LogOpts log_opts;
extern UserOpts user_opts;
extern ClusterInfo old_cluster,
			new_cluster;
extern OSInfo os_info;

/* check.c */

void		output_check_banner(bool live_check);
void		check_and_dump_old_cluster(bool live_check, char **sequence_script_file_name);
void		check_new_cluster(void);
void		report_clusters_compatible(void);
void		issue_warnings_and_set_wal_level(char *sequence_script_file_name);
void		output_completion_banner(char *analyze_script_file_name,
									 char *deletion_script_file_name);
void		check_cluster_versions(void);
void		check_cluster_compatibility(bool live_check);
void		create_script_for_old_cluster_deletion(char **deletion_script_file_name);
void		create_script_for_cluster_analyze(char **analyze_script_file_name);

/* controldata.c */

void		get_control_data(ClusterInfo *cluster, bool live_check);
void		check_control_data(ControlData *oldctrl, ControlData *newctrl);
void		disable_old_cluster(void);

/* dump.c */

void		generate_old_dump(void);

/* exec.c */

#define EXEC_PSQL_ARGS "--echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1"

bool		exec_prog(const char *log_file, const char *opt_log_file,
					  bool report_error, bool exit_on_error, const char *fmt,...) pg_attribute_printf(5, 6);
void		verify_directories(void);
bool		pid_lock_file_exists(const char *datadir);

/* file.c */

void		cloneFile(const char *src, const char *dst,
					  const char *schemaName, const char *relName);
void		copyFile(const char *src, const char *dst,
					 const char *schemaName, const char *relName);
void		linkFile(const char *src, const char *dst,
					 const char *schemaName, const char *relName);
void		rewriteVisibilityMap(const char *fromfile, const char *tofile,
								 const char *schemaName, const char *relName);
void		check_file_clone(void);
void		check_hard_link(void);

/* fopen_priv() is no longer different from fopen() */
#define fopen_priv(path, mode)	fopen(path, mode)

/* function.c */

void		get_loadable_libraries(void);
void		check_loadable_libraries(void);

/* info.c */

FileNameMap *gen_db_file_maps(DbInfo *old_db,
							  DbInfo *new_db, int *nmaps, const char *old_pgdata,
							  const char *new_pgdata);
void		get_db_and_rel_infos(ClusterInfo *cluster);
void		print_maps(FileNameMap *maps, int n,
					   const char *db_name);

/* option.c */

void		parseCommandLine(int argc, char *argv[]);
void		adjust_data_dir(ClusterInfo *cluster);
void		get_sock_dir(ClusterInfo *cluster, bool live_check);

/* relfilenode.c */

void		transfer_all_new_tablespaces(DbInfoArr *old_db_arr,
										 DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata);
void		transfer_all_new_dbs(DbInfoArr *old_db_arr,
								 DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata,
								 char *old_tablespace);

/* tablespace.c */

void		init_tablespaces(void);

/* server.c */

PGconn	   *connectToServer(ClusterInfo *cluster, const char *db_name);
PGresult   *executeQueryOrDie(PGconn *conn, const char *fmt,...) pg_attribute_printf(2, 3);

char	   *cluster_conn_opts(ClusterInfo *cluster);

bool		start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error);
void		stop_postmaster(bool in_atexit);
uint32		get_major_server_version(ClusterInfo *cluster);
void		check_pghost_envvar(void);

/* util.c */

char	   *quote_identifier(const char *s);
extern void appendShellString(PQExpBuffer buf, const char *str);
extern void appendConnStrVal(PQExpBuffer buf, const char *str);
extern void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname);
int			get_user_info(char **user_name_p);
void		check_ok(void);
void		report_status(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3);
void		pg_log(eLogType type, const char *fmt,...) pg_attribute_printf(2, 3);
void		pg_fatal(const char *fmt,...) pg_attribute_printf(1, 2) pg_attribute_noreturn();
void		end_progress_output(void);
void		prep_status(const char *fmt,...) pg_attribute_printf(1, 2);
void		check_ok(void);
unsigned int str2uint(const char *str);
uint64		str2uint64(const char *str);
void		pg_putenv(const char *var, const char *val);

/* version.c */

void		new_9_0_populate_pg_largeobject_metadata(ClusterInfo *cluster,
													 bool check_mode);
void		old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster);
void		old_9_6_check_for_unknown_data_type_usage(ClusterInfo *cluster);
void		old_9_6_invalidate_hash_indexes(ClusterInfo *cluster,
											bool check_mode);

/* version_old_8_3.c */

void		old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster);
void		old_8_3_check_for_tsquery_usage(ClusterInfo *cluster);
void		old_8_3_check_ltree_usage(ClusterInfo *cluster);
void		old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode);
void		old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode);
void old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
											  bool check_mode);
char	   *old_8_3_create_sequence_script(ClusterInfo *cluster);

/* parallel.c */
void		parallel_exec_prog(const char *log_file, const char *opt_log_file,
							   const char *fmt,...) pg_attribute_printf(3, 4);
void		parallel_transfer_all_new_dbs(DbInfoArr *old_db_arr, DbInfoArr *new_db_arr,
										  char *old_pgdata, char *new_pgdata,
										  char *old_tablespace);
bool		reap_child(bool wait_for_child);

/*
 * Hack to make backend macros that check for assertions to work.
 */
#ifdef AssertMacro
#undef AssertMacro
#endif
#define AssertMacro(condition) ((void) true)
#ifdef Assert
#undef Assert
#endif
#define Assert(condition) ((void) (true || (condition)))

#endif /* PG_UPGRADE_H */


text:
awscli ssm describe-instance-information --output table --query "InstanceInformationList[$(auto_filter InstanceId PlatformType PlatformName PlatformVersion AgentVersion PingStatus -- $@)].{
  \"1.Id\":InstanceId,
  \"2.Ping Status/LastPing\":join(':',[PingStatus,LastPingDateTime]),
  \"3.AgentVersion/Latest\":join('/',[AgentVersion,to_string(IsLatestVersion)]),
  \"4.Platform\":join('/',[PlatformType,PlatformName,PlatformVersion]),
  \"5.ResourceType\":ResourceType,
  \"6.IPAddress\":IPAddress}"


text:
<!DOCTYPE html>

    <title>About – </title>

    <meta charset="utf-8" />
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0'>

<meta name="description" content="My background and education has given me a strong foundation for using data to answer interesting questions and communicate about technical topics with diverse audience.">
<meta property="og:description" content="My background and education has given me a strong foundation for using data to answer interesting questions and communicate about technical topics with diverse audience." />

<meta name="author" content="" />

<meta property="og:title" content="About" />
<meta property="twitter:title" content="About" />

    <link rel="stylesheet" type="text/css" href="/style.css" />
    <link rel="alternate" type="application/rss+xml" title=" - My background and education has given me a strong foundation for using data to answer interesting questions and communicate about technical topics with diverse audience." href="/feed.xml" />

My background and education has given me a strong foundation for using data to answer interesting questions and communicate about technical topics with diverse audience.

          /blog/
          /publications/
         /activities/
         /about/

About

Experienced Data Scientist with a demonstrated history of working in higher education industry and for fortune 500 company. Skilled in using analytical tools (Python, R, SQL) and techniques (Machine learning, Natural language processing, and data mining) to answer interesting question. Proven ability to think critically with an innate ability to ask insightful questions to map data driven solutions. Strong research professional with a Doctor of Philosophy (PhD) focused in Computational Material Science and Engineering from Texas A&M University.

Analyzing and interpreting complex datasets makes me happy, and I am known for being flexible, resourceful, and for achieving goals while maintaining a positive outlook. I work effectively in both independent and collaborative environments, and excel at communicating with diverse collaborators.

My resume highlighting data science skills CV.


text:
import React from 'react';
import Link from '../Link';

class Navigation extends React.Component {

	componentDidMount() {
		window.componentHandler.upgradeElement(this.root);
	}

	componentWillUnmount() {
		window.componentHandler.downgradeElements(this.root);
	}

	render() {
		return (
			 (this.root = node)}>
				<Link className="mdl-navigation__link" to="/">Home</Link>
				<Link className="mdl-navigation__link" to="/resources">Resources</Link>
				<Link className="mdl-navigation__link" to="/blog">Blog</Link>
				Slack

		);
	}

}

export default Navigation;


text:
package edu.isi.karma.metadata;

import edu.isi.karma.webserver.KarmaException;
import edu.isi.karma.webserver.ServletContextParameterMap;
import edu.isi.karma.webserver.ServletContextParameterMap.ContextParameter;

public class GraphVizMetadata extends KarmaUserMetadata {

	public GraphVizMetadata(ServletContextParameterMap contextParameters) throws KarmaException {
		super(contextParameters);
	}

	@Override
	protected ContextParameter getDirectoryContextParameter() {
		return ContextParameter.GRAPHVIZ_MODELS_DIR;
	}

	@Override
	protected String getDirectoryPath() {
		return "models-graphviz/";
	}

	@Override
	public KarmaMetadataType getType() {
		return StandardUserMetadataTypes.GRAPHVIZ_MODELS;
	}
}


text:
$(document).ready(function(){

	/*******  Purchase Form Jquery ********/

		var ajaxBootup = ajaxCall('purchase/displayItems',{});
		$('#tableData').html(ajaxBootup);
		disableSelection(document.body);

		var totalBillAmount = ajaxCall('purchase/getTotalAmount',{},'json');
		$('#totalPricePurchase').html(totalBillAmount.total+'/-');

		$('input[name=startAddItem]').click(function(){

			var result = purchaseBillValidations();
			if(result == true){
				$('input[name=billnum]').attr('disabled','disabled');
				$('select[name=vendor]').attr('disabled','disabled');
				$('input[name=billDate]').attr('disabled','disabled');
				$('.ShowHide').prop('disabled',false);
			}

		});

		$('input[name=addToList]').click(function(){

			var SendData = {};
			$('input, select, textarea').each(function(index){

				var input = $(this);
				SendData[input.attr('name')] = input.val();
			});

			var result = purchaseItemValidation(SendData);
			if(result == true){

				var ajaxResult = ajaxCall('purchase/insertIntoGrid',SendData);
				$('#tableData').html(ajaxResult);
				setValueBlankPurchase();
			}
			var totalBillAmount = ajaxCall('purchase/getTotalAmount',{},'json');
			$('#totalPricePurchase').html(totalBillAmount.total);

		});

		$('input[name=savePurchaseList]').click(function(){

			if(confirm('Are you sure to save the list?')){

					$('#saveSpinner').show();
					ajaxCall('purchase/savePurchaseList',{});
					$('#tableData').html('');
					$('input[name=billnum]').prop("disabled", false);
					$('select[name=vendor]').prop("disabled", false);
					$('input[name=billDate]').prop("disabled", false);
					$('#ItemDetails').fadeOut(300);
					$('#saveSpinner').hide();
					alert('Your bill saved successfully!');
			}

		});

		$('input[name=resetData]').click(function(){

			window.location.reload();
		});

		$(document).on('dblclick','.tbDatagrid_PurchaseItem tr', function(){
			var input = $(this);
			if(confirm('Are you sure to delete that row?')){

					var barCode = input.children('td:nth-child(4)').html();
					var result = ajaxCall('purchase/deleteFromList',{'barCode':barCode});
					$('.tbDatagrid_PurchaseItem').html(result);

					var totalBillAmount = ajaxCall('purchase/getTotalAmount',{},'json');
					$('#totalPricePurchase').html(totalBillAmount.total);

			};
		});

		$('#barCode').keyup(function(event){

			if(event.keyCode == 13){

				var barCode = $(this).val();
				var result = ajaxCall('purchase/getItemDetails',{'barcode':barCode},'json');
				$('input[name=prodName]').val(result[0].item_name);
				$('textarea[name=prodDesc]').val(result[0].item_desc);
			}
		});

		function purchaseBillValidations(){

			if(
				$('input[name=billnum]').val().trim() == ''  ||
			    $('select[name=vendor]').val().trim() == ''  ||
			    $('input[name=billDate]').val().trim() == ''
			   ){

				alert('Please fill required fields');
			return false;
			}else{

				return true;
			}
		}

		function purchaseItemValidation(objData){

			if(
					objData.barCode == '' ||
					objData.billDate == '' ||
					objData.billnum == '' ||
					objData.prodName == '' ||
					objData.sku == '' ||
					objData.expiryDate == '' ||
					objData.prodDesc == '' ||
					objData.purchasePrice == '' ||
					objData.qty == '' ||
					objData.salePrice == '' ||
					objData.mrp == ''
			  ){

				alert('Please fill required fields');
				return false;
			}else{

				return true;
			}
		}

		function setValueBlankPurchase(){

			$('input[name=barCode]').val('');
			$('input[name=prodName]').val('');
			$('textarea[name=prodDesc]').val('');
			$('input[name=mrp]').val('');
			$('input[name=sku]').val('');
			$('input[name=expiryDate]').val('');
			$('input[name=salePrice]').val('');
			$('input[name=purchasePrice]').val('');
			$('input[name=qty]').val('');
			$('input[name=FreeItemCode]').val('');
			$('input[name=FreeQty]').val('');
			$('input[name=freeMrp]').val('');
			$('input[name=barCode]').focus();
		}

	/******* End Purchase Form Jquery *******/

	function ajaxCall(ctrlFunc, jsonData, resType){

			var finalResult = '';
			$.ajax({
				type:'POST',
				url: base_url+'index.php/'+ctrlFunc,
				data: jsonData,
				async: false,
				success: function(result){

					finalResult = result;
				}
			});
			if(resType == 'json'){

				return $.parseJSON(finalResult);
			}else{
				return finalResult
			}
	}

	setInterval(
		function(){
			$('#blink').fadeToggle(300);
		}, 600);

/*
*
*
*
*
*
*
*
*        Store Trsnafer Work
*
*
*
*
*
*
*
/

	/*****************  Store Transfer  *****************/

	$('select[name=transferStore]').change(function(){

		$('#blink').html($('select[name=transferStore] option:selected').html());
		$(this).attr('disabled','disabled');
	});

	$('input[name=barcode]').keyup(function(event){

		if(event.keyCode == 13){

            var barcValue = $('input[name=barcode]').val();
            $('.spinLoader').fadeIn(300);
            var getByBarcode = ajaxCall('stores/getItemDetails',{'barcode':barcValue},'json');
			console.log(getByBarcode);
			if(getByBarcode.status == 'false'){

				$('.spinLoader').fadeOut(300);
				alert('Item not found');
			}else{

				$('input[name=prodName]').val(getByBarcode.data[0].item_name);
				$('input[name=cqty]').val(getByBarcode.data[0].item_qty);
				$('input[name=sale_price]').val(getByBarcode.data[0].free_item_price);
				$('input[name=free_item_barcode]').val(getByBarcode.data[0].free_item_barcode);
				$('input[name=free_item_name]').val(getByBarcode.data[0].free_item_name);
				$('input[name=free_item_qty]').val(getByBarcode.data[0].free_item_qty);
				$('input[name=mrp]').val(getByBarcode.data[0].item_mrp);
				$('input[name=sale_price]').val(getByBarcode.data[0].item_sale_price);
				$('input[name=item_desc]').val(getByBarcode.data[0].item_desc);
				$('input[name=item_sku]').val(getByBarcode.data[0].item_sku);
				$('input[name=item_expiry]').val(getByBarcode.data[0].item_expiry);
				$('input[name=item_unit]').val(getByBarcode.data[0].item_unit);
				$('input[name=item_category]').val(getByBarcode.data[0].item_category);
				$('input[name=category]').val(getByBarcode.data[0].item_category);
				$('input[name=unit]').val(getByBarcode.data[0].item_unit);
				$('.expDate').html(getByBarcode.data[0].item_expiry);
				$('.spinLoader').fadeOut(300);
				var SqlDate = getByBarcode.data[0].item_expiry;
				var splitedDate = SqlDate.split('-');

				var sDD = splitedDate[2];
				var sMM = splitedDate[1];
				var sYY = splitedDate[0];

				var today = new Date();
				var dd = today.getDate();
				var mm = today.getMonth()+1; //January is 0!
				var yyyy = today.getFullYear();

				var date1 = new Date(dd+'/'+mm+'/'+yyyy);
				var date2 = new Date(sMM+'/'+sDD+'/'+sYY);
				var timeDiff = Math.abs(date2.getTime() - date1.getTime());
				var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));

				if(diffDays<=0){
					$('.expryLabel').html('(Your product has been expired!)');
					$('input[name=qty]').attr('disabled','disabled');
				}else{

					$('.expryLabel').html('(Your product hwill expire in '+diffDays+')');
				}
				$('input[name=qty]').focus();
			}
	    }
	});

	$('input[name=qty]').keyup(function(event){

		if(event.keyCode == 13){
			$('input[name=addToTransferList]').click();
		}
	});

	var gridTable = ajaxCall('stores/displayTransferGrid', {});

	$('.transferGrid').html(gridTable);

	var totalItems = ajaxCall('stores/getTotalItems',{},'json');
	$('#totalItm').html(totalItems.total);

	var totalData = ajaxCall('stores/getSalePriceAndMrp',{},'json');
	if(totalData != null){
		$('#totalSale').html(totalData[0]+'/-');
		$('#totalMrp').html(totalData[1]+'/-');
	}

	$('input[name=addToTransferList]').click(function(){

		if(parseInt($('input[name=qty]').val()) > parseInt($('input[name=cqty]').val())){

			alert('You cannot enter more than current quantity!!');
			return false;
		}
		var SendData = {};
		$('input, select, textarea').each(function(index){

			var input = $(this);
			SendData[input.attr('name')] = input.val();
		});

		var gridTable = ajaxCall('stores/insertToStoreGrid', SendData);
		var totalItems = ajaxCall('stores/getTotalItems',{},'json');
		$('#totalItm').html(totalItems.total);

		$('.transferGrid').html(gridTable);
		$(".transferGrid").animate({ scrollTop: $(document).height() }, 1000);

		var totalData = ajaxCall('stores/getSalePriceAndMrp',{},'json');
		$('#totalSale').html(totalData[0]+'/-');
		$('#totalMrp').html(totalData[1]+'/-');

		$('input, textarea').each(function(index){

			if($(this).attr('type') != 'submit'){

				$(this).val('');
			}
		});

		$('input[name=barcode]').focus();

		console.log(SendData);
	});

	$(document).on('dblclick','.tbDatagrid_StoreTransferItem tr', function(){
		var row = $(this);
		$(this).children('td').addClass('color-danger');
		//console.log($(this).html());
		// return false;
		if(confirm('Are you sure to delete that row?')){

				var barCode = row.children('td:nth-child(1)').html();
				$('input[name=barcode]').val(barCode);
				$('input[name=barcode]').focus();
				var result = ajaxCall('stores/deleteGridTableRow',{'index':row.index()});
				var totalData = ajaxCall('stores/getSalePriceAndMrp',{},'json');
				var totalItems = ajaxCall('stores/getTotalItems',{},'json');
				if(totalData != null){

					$('#totalItm').html(totalItems.total);
					$('#totalSale').html(totalData[0]+'/-');
					$('#totalMrp').html(totalData[1]+'/-');
					$('.tbDatagrid_StoreTransferItem').html(result);
				}else{

					$('#totalItm').html('');
					$('#totalSale').html('');
					$('#totalMrp').html('');
					$('.tbDatagrid_StoreTransferItem').fadeOut(200);
				}

		}
	});

	$(".qsbsearch_fieldox").keyup(function() {
	    $('.crud_search').click();
	});

	$(document).on('dblclick',"#flex1 tr", function(){

		$('input[name=barcode]').val($(this).children('td:nth-child(1)').children('div').html());
		$('input[name=barcode]').focus();
	});

	$('input[name=SaveTransfer]').click(function(){

    	window.open(base_url+'index.php/stores/viewInvoice','winname','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=800,height=350,left=250,top=150,status=1,directories=1,dialog');

    	setTimeout(
		  function()
		  {
		    ajaxCall('stores/saveStoreStransfer',{});
		  }, 3000);

    	$('#totalItm').html('');
    	$('#totalMrp').html('');
    	$('#totalItm').html('');
    	$('#blink').html('');
		$('.transferGrid').html('');

	});

	/****************   Store End   ********************/

	function disableSelection(target){
        if (typeof target.onselectstart!="undefined") //IE route
            target.onselectstart=function(){return false}
        else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
            target.style.MozUserSelect="none"
        else //All other route (ie: Opera)
            target.onmousedown=function(e){if(e && e.target && e.target.tagName){if(/^(input|select|textarea)$/i.test(e.target.tagName)){return true;}}return false;}
        target.style.cursor = "default"
    }
});


text:
template <int...> struct Seq {};

template <class S1, class S2> struct Concat;
template <class S1, class S2> using  Concat_t = typename Concat<S1,S2>::type;

template <int... I1s, int... I2s>
struct Concat<Seq<I1s...>, Seq<I2s...>>
{
  using type = Seq<I1s..., I2s...>;
};

template <int I, int N> struct MakeSeqImpl;
template <int I, int N> using  MakeSeqImpl_t = typename MakeSeqImpl<I, N>::type;
template <int N>        using  MakeSeq_t     = typename MakeSeqImpl<0, N-1>::type;

template <int Start, int End>
struct MakeSeqImpl
{
  using type = Concat_t<MakeSeqImpl_t<Start, (Start+End)/2>,
			MakeSeqImpl_t<(Start+End)/2+1, End> >;
};

// break condition
template <int I> struct MakeSeqImpl<I,I> { using type = Seq<I>; };

template <int... Is>
constexpr unsigned size(Seq<Is...>)
{
  return sizeof...(Is);
}

int main()
{
  static_assert( size(MakeSeq_t<(LENGTH)>()) == (LENGTH), "" );
}


text:
#import <CoreText/CTFont.h>
#import <Foundation/Foundation.h>

@interface TollBridgeExample : NSObject

@end

@implementation TollBridgeExample

- (void)bridgeTransfer {
  CFLocaleRef nameRef = CFLocaleCreate(NULL, NULL);
  NSLocale* a = (__bridge_transfer NSLocale*)nameRef;
}

- (void)bridge {
  CFLocaleRef nameRef = CFLocaleCreate(NULL, NULL);
  NSLocale* a = (__bridge NSLocale*)nameRef;
}

- (void)brideRetained {
  id observer = [NSLocale alloc];
  CFLocaleRef a = (__bridge_retained CFLocaleRef)observer;
}

- (void)_readHTTPHeader;
{
  CFDictionaryRef ref = CFHTTPMessageCopyAllHeaderFields(NULL);
  CFBridgingRelease(ref);
}

CTFontRef cfautorelease_test() {
  return CFAutorelease(CTFontCreateWithName(CFSTR("Icon"), 17.0, NULL));
}

void bridgeDictionaryNoLeak() {
  NSDictionary* bufferAttributes = @{(NSString*)@"key" : @{} };
  CFDictionaryRef dict = (__bridge CFDictionaryRef)bufferAttributes;
}

@end


text:
import os
from django.forms.models import modelform_factory
from django.test import TestCase
from django.core.files import File as DjangoFile
from django.conf import settings

from filer.models.foldermodels import Folder
from filer.models.imagemodels import Image
from filer.models.filemodels import File
from filer.models.clipboardmodels import Clipboard
from filer.tests.helpers import (create_superuser, create_folder_structure,
                                 create_image, create_clipboard_item)
from filer import settings as filer_settings

class FilerApiTests(TestCase):

    def setUp(self):
        self.superuser = create_superuser()
        self.client.login(username='admin', password='secret')
        self.img = create_image()
        self.image_name = 'test_file.jpg'
        self.filename = os.path.join(settings.FILE_UPLOAD_TEMP_DIR, self.image_name)
        self.img.save(self.filename, 'JPEG')

    def tearDown(self):
        self.client.logout()
        os.remove(self.filename)
        for f in File.objects.all():
            f.delete()

    def create_filer_image(self):
        file_obj = DjangoFile(open(self.filename), name=self.image_name)
        image = Image.objects.create(owner=self.superuser,
                                     original_filename=self.image_name,
                                     file=file_obj)
        return image

    def test_create_folder_structure(self):
        create_folder_structure(depth=3, sibling=2, parent=None)
        self.assertEqual(Folder.objects.count(), 26)

    def test_create_and_delete_image(self):
        self.assertEqual(Image.objects.count(), 0)
        image = self.create_filer_image()
        image.save()
        self.assertEqual(Image.objects.count(), 1)
        image = Image.objects.all()[0]
        image.delete()
        self.assertEqual(Image.objects.count(), 0)

    def test_upload_image_form(self):
        self.assertEqual(Image.objects.count(), 0)
        file_obj = DjangoFile(open(self.filename), name=self.image_name)
        ImageUploadForm = modelform_factory(Image, fields=('original_filename', 'owner', 'file'))
        upoad_image_form = ImageUploadForm({'original_filename': self.image_name,
                                                'owner': self.superuser.pk},
                                                {'file': file_obj})
        if upoad_image_form.is_valid():
            image = upoad_image_form.save()
        self.assertEqual(Image.objects.count(), 1)

    def test_create_clipboard_item(self):
        image = self.create_filer_image()
        image.save()
        # Get the clipboard of the current user
        clipboard_item = create_clipboard_item(user=self.superuser,
            file_obj=image)
        clipboard_item.save()
        self.assertEqual(Clipboard.objects.count(), 1)

    def test_create_icons(self):
        image = self.create_filer_image()
        image.save()
        icons = image.icons
        file_basename = os.path.basename(image.file.path)
        self.assertEqual(len(icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))
        for size in filer_settings.FILER_ADMIN_ICON_SIZES:
            self.assertEqual(os.path.basename(icons[size]),
                             file_basename + u'__%sx%s_q85_crop_upscale.jpg' % (size, size))

    def test_file_upload_public_destination(self):
        """
        Test where an image `is_public` == True is uploaded.
        """
        image = self.create_filer_image()
        image.is_public = True
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PUBLICMEDIA_STORAGE.location))

    def test_file_upload_private_destination(self):
        """
        Test where an image `is_public` == False is uploaded.
        """
        image = self.create_filer_image()
        image.is_public = False
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))

    def test_file_move_location(self):
        """
        Test the method that move a file between filer_public, filer_private
        and vice et versa
        """
        image = self.create_filer_image()
        image.is_public = False
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))
        image.is_public = True
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PUBLICMEDIA_STORAGE.location))

    def test_file_change_upload_to_destination(self):
        """
        Test that the file is actualy move from the private to the public
        directory when the is_public is checked on an existing private file.
        """
        file_obj = DjangoFile(open(self.filename), name=self.image_name)

        image = Image.objects.create(owner=self.superuser,
                                     is_public=False,
                                     original_filename=self.image_name,
                                     file=file_obj)
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))
        image.is_public = True
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PUBLICMEDIA_STORAGE.location))
        self.assertEqual(len(image.icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))
        image.is_public = False
        image.save()
        self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))
        self.assertEqual(len(image.icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))

    def test_deleting_image_deletes_file_from_filesystem(self):
        file_1 = self.create_filer_image()
        self.assertTrue(file_1.file.storage.exists(file_1.file.name))

        # create some thumbnails
        thumbnail_urls = file_1.thumbnails

        # check if the thumnails exist
        thumbnails = [x for x in file_1.file.get_thumbnails()]
        for tn in thumbnails:
            self.assertTrue(tn.storage.exists(tn.name))
        storage, name = file_1.file.storage, file_1.file.name

        # delete the file
        file_1.delete()

        # file should be gone
        self.assertFalse(storage.exists(name))
        # thumbnails should be gone
        for tn in thumbnails:
            self.assertFalse(tn.storage.exists(tn.name))

    def test_deleting_file_does_not_delete_file_from_filesystem_if_other_references_exist(self):
        file_1 = self.create_filer_image()
        # create another file that references the same physical file
        file_2 = File.objects.get(pk=file_1.pk)
        file_2.pk = None
        file_2.id = None
        file_2.save()
        self.assertTrue(file_1.file.storage.exists(file_1.file.name))
        self.assertTrue(file_2.file.storage.exists(file_2.file.name))
        self.assertEqual(file_1.file.name, file_2.file.name)
        self.assertEqual(file_1.file.storage, file_2.file.storage)

        storage, name = file_1.file.storage, file_1.file.name

        # delete one file
        file_1.delete()

        # file should still be here
        self.assertTrue(storage.exists(name))

    def test_folder_quoted_logical_path(self):
        root_folder = Folder.objects.create(name=u"Foo's Bar", parent=None)
        child = Folder.objects.create(name=u'Bar"s Foo', parent=root_folder)
        self.assertEqual(child.quoted_logical_path, u'/Foo%27s%20Bar/Bar%22s%20Foo')

    def test_folder_quoted_logical_path_with_unicode(self):
        root_folder = Folder.objects.create(name=u"Foo's Bar", parent=None)
        child = Folder.objects.create(name=u'Bar"s 日本 Foo', parent=root_folder)
        self.assertEqual(child.quoted_logical_path,
                         u'/Foo%27s%20Bar/Bar%22s%20%E6%97%A5%E6%9C%AC%20Foo')


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starters</artifactId>
		<version>2.0.0.BUILD-SNAPSHOT</version>
	</parent>
	<artifactId>spring-boot-starter-remote-shell</artifactId>
	<name>Spring Boot Remote Shell Starter</name>
	<description>Starter for using the CRaSH remote shell to monitor and manage your
		application over SSH</description>
	<url>http://projects.spring.io/spring-boot/</url>
	<organization>
		<name>Pivotal Software, Inc.</name>
		<url>http://www.spring.io</url>
	</organization>
	<properties>
		<main.basedir>${basedir}/../..</main.basedir>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.cli</artifactId>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.connectors.ssh</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-all</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.connectors.telnet</artifactId>
			<exclusions>
				<exclusion>
					<groupId>javax.servlet</groupId>
					<artifactId>servlet-api</artifactId>
				</exclusion>
				<exclusion>
					<groupId>log4j</groupId>
					<artifactId>log4j</artifactId>
				</exclusion>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.embed.spring</artifactId>
			<exclusions>
				<exclusion>
					<artifactId>spring-web</artifactId>
					<groupId>org.springframework</groupId>
				</exclusion>
				<exclusion>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-all</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.plugins.cron</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-all</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.plugins.mail</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-all</artifactId>
				</exclusion>
				<exclusion>
					<groupId>javax.mail</groupId>
					<artifactId>mail</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.crashub</groupId>
			<artifactId>crash.shell</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.codehaus.groovy</groupId>
					<artifactId>groovy-all</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.codehaus.groovy</groupId>
			<artifactId>groovy</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun.mail</groupId>
			<artifactId>javax.mail</artifactId>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.basepom.maven</groupId>
				<artifactId>duplicate-finder-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>duplicate-dependencies</id>
						<phase>validate</phase>
						<goals>
							<goal>check</goal>
						</goals>
						<configuration>
							<ignoredResourcePatterns>
								<ignoredResourcePattern>crash/crash.properties</ignoredResourcePattern>
							</ignoredResourcePatterns>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>


text:
<?php

namespace Termite\Admin\View\Helper;

use Cake\Event\EventManager;
use Cake\Routing\Router;
use Cake\View\Helper;
use Termite\Admin\Event\Section;
use Termite\Admin\Event\SideBarMenuEvent;

final class SideBarMenuHelper extends Helper
{
    public function render(): string
    {
        $event = SideBarMenuEvent::create();
        EventManager::instance()->dispatch($event);

        $html = '
';
        $html .= '
NAVIGATION
';

        $html .= $this->renderSections(...$event->getSections());

        $html .= '
';

        return $html;
    }

    private function renderSections(Section ...$sections): string
    {
        $html = '';

        foreach ($sections as $section) {
            $html .= $this->renderSection($section);
        }

        return $html;
    }

    private function renderSection(Section $section): string
    {
        $subSections = $section->getSubSections();

        $html = '';
        if (count($subSections) > 0) {
            $html .= '
';
            $html .= '';
            $html .= ' ' . $section->getLabel() . '';
            $html .= '';
            $html .= '';
            $html .= '';
            $html .= '';
            $html .= '
';
            $html .= $this->renderSections(...$subSections);
            $html .= '
';
            $html .= '
';
            return $html;
        }

        $html .= '
';
        $html .= 'getRoute())) . '">';
        if (isset($section->getOptions()['image'])) {
            $html .= 'getOptions()['image'] . '" class="img-circle" alt="' . $section->getLabel() . '" style="width: 20px;"> ';
        } else {
            $html .= ' ';
        }
        $html .= '' . $section->getLabel() . '';
        $html .= '';
        $html .= '
';
        return $html;
    }
}


text: knitr::knit2html('testrgl.Rmd', "html_document")


text:
/**
 */
package org.wso2.developerstudio.datamapper;

/**
 *
 * A representation of the model object 'Celi'.
 *
 *
 *
 * @see org.wso2.developerstudio.datamapper.DataMapperPackage#getCeli()
 * @model
 * @generated
 */
public interface Celi extends Operator {
} // Celi


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ch.obermuhlner.math.big (ch.obermuhlner.math.big 2.3.2 API)</title>
<meta name="date" content="2022-11-13">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

ch.obermuhlner.math.big

Classes

BigComplex

BigComplexMath

BigDecimalMath

BigFloat

BigFloat.Context

BigRational

DefaultBigDecimalMath

DefaultBigDecimalMath.LocalMathContext


text:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="Test/bootstrap.php" colors="true" backupGlobals="false">
    <testsuites>
        <testsuite name="Tinify Magento Plugin Integration Test Suite">
            <directory suffix="Test.php">Test/integration</directory>
        </testsuite>
        <testsuite name="Tinify Magento Plugin Unit Test Suite">
            <directory suffix="Test.php">Test/unit</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist>
            <directory>src</directory>
        </whitelist>
    </filter>
</phpunit>


text:
var foo = function() {
    return Math.abs(-1);
};

root.foo = foo;

foo = undefined;


text:
#pragma once

struct EntityHuman;
struct EntityActor;

#include "Condition.h"

class ConditionCanSeePlayer: public Condition
{
	EntityHuman* m_player;
	EntityActor* m_actor;
	f32 m_fov;
	f32 m_maxViewDistance;

public:
	ConditionCanSeePlayer(EntityHuman* player, EntityActor* actor, f32 fovRad, f32 maxViewDistance);
	~ConditionCanSeePlayer();

	u8 test() const override;
};

class ConditionCanNotSeePlayer : public ConditionCanSeePlayer
{
	EntityHuman* m_player;
	EntityActor* m_actor;
	f32 m_fov;

public:
	ConditionCanNotSeePlayer(EntityHuman* player, EntityActor* actor, f32 fovRad, f32 maxViewDistance);
	~ConditionCanNotSeePlayer();

	u8 test() const override;
};


text:
Summarizes text using a naive summarization algorithm

## Installation

Add this line to your application's Gemfile:

    gem 'simple_summary'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install simple_summary

## Usage

    Summary.squash content

The greater the relevance of your content, the better is the summarization

Included is a 100 line review of the iPhone5S picked up online.

## Credits

[Python implementation](https://gist.github.com/shlomibabluki/5473521) by [shlomibabluki](http://www.github.com/shlomibabluki)

## Contributing

1. Fork it ( http://github.com/prashanthrajagopal/simple_summary/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
package fluentbit

import (
	"fmt"
	"sort"
	"strings"
)

type Component struct {
	// Kind is "INPUT", "FILTER", "PARSER", etc.
	Kind string
	// Config is a set of key-value configuration pairs
	Config map[string]string
	// OrderedConfig is used for configuration pairs where the
	// key can appear in the output fluent bit config multiple times
	// and/or the order of the configuration provided is important
	OrderedConfig [][2]string
}

func (c Component) generateSection() string {
	var lines []string
	var maxLen int
	for k := range c.Config {
		if len(k) > maxLen {
			maxLen = len(k)
		}
	}
	for _, line := range c.OrderedConfig {
		if len(line[0]) > maxLen {
			maxLen = len(line[0])
		}
	}

	addLine := func(k, v string) { lines = append(lines, fmt.Sprintf("    %-*s %s", maxLen, k, v)) }

	for k, v := range c.Config {
		addLine(k, v)
	}
	sort.Strings(lines)

	// Used for Multiline config where several "rule" lines
	// must be placed at the end of a parser config, and when multiple "Parser"
	// are provided to one parser filter
	for _, line := range c.OrderedConfig {
		addLine(line[0], line[1])
	}

	return fmt.Sprintf("[%s]\n%s\n", c.Kind, strings.Join(lines, "\n"))
}

type ModularConfig struct {
	Variables  map[string]string
	Components []Component
}

const (
	outputFileKind     = "OPSAGENTOUTPUTFILE"
	outputFileName     = "filename"
	outputFileContents = "contents"
)

const (
	MainConfigFileName   = "fluent_bit_main.conf"
	ParserConfigFileName = "fluent_bit_parser.conf"
)

func outputFileComponent(name, contents string) Component {
	return Component{
		Kind: outputFileKind,
		Config: map[string]string{
			outputFileName:     name,
			outputFileContents: contents,
		},
	}
}

func (c ModularConfig) Generate() (map[string]string, error) {
	files := make(map[string]string)

	var parts []string
	for k, v := range c.Variables {
		parts = append(parts, fmt.Sprintf("@SET %s=%s", k, v))
	}
	sort.Strings(parts)
	// Blank line
	parts = append(parts, "")

	// TODO: Consider removing this sorting and just outputting the components in native order.
	sectionsByKind := map[string][]string{}
	for _, c := range c.Components {
		if c.Kind == outputFileKind {
			files[c.Config[outputFileName]] = c.Config[outputFileContents]
			continue
		}
		out := c.generateSection()
		sectionsByKind[c.Kind] = append(sectionsByKind[c.Kind], out)
	}
	parserParts := append(sectionsByKind["PARSER"], sectionsByKind["MULTILINE_PARSER"]...)
	delete(sectionsByKind, "PARSER")
	delete(sectionsByKind, "MULTILINE_PARSER")
	for _, k := range []string{"SERVICE", "INPUT", "FILTER", "OUTPUT"} {
		parts = append(parts, sectionsByKind[k]...)
		delete(sectionsByKind, k)
	}
	if len(sectionsByKind) > 0 {
		return nil, fmt.Errorf("unknown fluentbit config sections %+v", sectionsByKind)
	}
	files[MainConfigFileName] = strings.Join(parts, "\n")
	files[ParserConfigFileName] = strings.Join(parserParts, "\n")
	return files, nil
}


text:
<!DOCTYPE html>
<link rel="stylesheet" href="/global.css">

← Examples index


text:
package ustc.etyy.wechat.bean;

public class CustomerMsg {

	private String touser;
	private String msgtype;
	private Text text;

	public String getTouser() {
		return touser;
	}

	public void setTouser(String touser) {
		this.touser = touser;
	}

	public String getMsgtype() {
		return msgtype;
	}

	public void setMsgtype(String msgtype) {
		this.msgtype = msgtype;
	}

	public Text getText() {
		return text;
	}

	public void setText(Text text) {
		this.text = text;
	}

}


text:
template<typename T> struct DefaultSingletonTraits;

namespace content {
class BrowserContext;
}

namespace app_list {

class History;

// Singleton that owns all History and associates them with profiles;
class HistoryFactory : public BrowserContextKeyedServiceFactory {
 public:
  // Returns singleton instance of HistoryFactory.
  static HistoryFactory* GetInstance();

  // Returns History associated with |context|.
  static History* GetForBrowserContext(content::BrowserContext* context);

 private:
  friend struct DefaultSingletonTraits<HistoryFactory>;

  HistoryFactory();
  virtual ~HistoryFactory();

  // BrowserContextKeyedServiceFactory overrides:
  virtual BrowserContextKeyedService* BuildServiceInstanceFor(
      content::BrowserContext* context) const OVERRIDE;

  DISALLOW_COPY_AND_ASSIGN(HistoryFactory);
};

}  // namespace app_list

#endif  // CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_FACTORY_H_


text:
<!DOCTYPE html>

		<meta charset="UTF-8">
		<meta name="description" content="Travis Vanos Professional Portfolio">
		<meta name="keywords" content="HTML,CSS,XML,JavaScript">
		<meta name="author" content="Travis Vanos">

    <title>Travis Vanos Resume</title>

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

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

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                        Home

                        Resume

                        Portfolio

                        Contact

                    Travis Vanos

                    Personal Profile

                    Work Experience

                    Key Skills

                    Education

                    .PDF

Travis Vanos

GIS/IT Technologist

e: Travis.Vanos@gmail.com

w: www.travisvanos.com

m: (647)-937-3746

Personal Profile

Dedicated and hardworking professional with over 4 years of expertise in IT administration, database technologies, software development environments and infrastructure technologies. Aspiring GIS professional, collaborating to solve issues and provide efficient solutions as a results-oriented team player.

-	 Highly skilled in current GIS\IT industry technologies.	&nbsp &nbsp  -  Excellent communication skills (verbal and written).

Work Experience

GIS Research Assistant (PT)- Niagara College Agriculture Innovation Centre

Febuary 2016 - Present

	Integrating Python for creating, and modifying custom tools and procedures in ESRI suite

	Performing literature reviews on new Precision Agriculture and landform classification techniques

IT Operations/Administrator - Warema, Australia

 December 2014 - June 2015

	Developed and maintained an optimized product/quoting database

	Upgraded to a new Content Management (CM) System for new website rollout (Joomla - PHP)

Security Analyst - KUBRA Data Transfer

January 2013 - September 2013

	Headlined new project to implement RADIUS authentication on all I.T assets for further PCI-DSS Audits

	Task automation (Python 2.7, 3.0)

	Executed internal security audits, penetration testing (PCI-DSS level '1' compliance)

	Contacted suppliers and reported to managment for procuring new vulnerability assesment and auditing software

Security Research Engineer - Tripwire Network Security

December 2011 - January 2013

	Development with Python Programming, Proprietary ASPL (Advanced Security Programming Language)

	Coordinated with a team to actively research and investigate disclosed vulnerabilities

	Assessed and identified risk classification based on Common Vulnerabilities & Exposure database

	Conducted security research (Remote Vulnerabilities, Reverse Engineering, Packet Analysis)

	Worked in monthly 'sprints' for development and Software Quality Assurance (QA) tasks

	Reviewed and oversaw specialized tier 2/3 remote support for client-submitted tickets

In-Home Technician/Sales - Staples Buisness Dept.

2010 - May 2011

	Coordinated troubleshooting and repairs in-store, by phone and in residences as a certified technician

Key Skills

SQL

Proficient

Python

Advanced

HTML/CSS

Proficient

ESRI Suite

Advanced

GrassGIS

Advanced

AutoCAD &nbsp

Proficient

Web Admin &nbsp

Advanced

System Admin &nbsp

SU

Education

Post Graduate – GIS - Geospatial Management

Niagara College – Niagara-On-The-Lake, ON

Relevant coursework: Programming ArcGIS Applications, CAD and GIS, -Foundations of Mapping and Cartography, Surveying and Geospatial Data Development, GIS Database Concepts, Introduction to Remote Sensing, Geospatial Models in Visualization, Geospatial Applications, Internet GIS Applications, Digital Image Processing

Computer Systems Technology

Fanshawe College – London, ON

President's Award (GPA > 4.0)

											Relevant coursework: Virtualization; Networking, Programming and Database Fundamentals; LAN, WAN; Computer Security Concepts; Advanced Linux and Windows Server; Mobile Technologies; Cloud Services; Data Management; Scripting for Systems Administration.

Certified PC Repair Technician

 Lambton College – Sarnia, ON

										CompTIA A+, Project+ Certifications.


text:
System.register(['angular2/core', 'angular2/http', 'rxjs/Observable'], function(exports_1, context_1) {
    "use strict";
    var __moduleName = context_1 && context_1.id;
    var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
        var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
        if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
        else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
        return c > 3 && r && Object.defineProperty(target, key, r), r;
    };
    var __metadata = (this && this.__metadata) || function (k, v) {
        if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
    };
    var core_1, http_1, Observable_1;
    var SkillService;
    return {
        setters:[
            function (core_1_1) {
                core_1 = core_1_1;
            },
            function (http_1_1) {
                http_1 = http_1_1;
            },
            function (Observable_1_1) {
                Observable_1 = Observable_1_1;
            }],
        execute: function() {
            SkillService = (function () {
                function SkillService(http) {
                    this.http = http;
                }
                ;
                SkillService.prototype.getSkillData = function () {
                    return this.http.get('/skills')
                        .map(this._extractData)
                        .catch(this._handleError);
                };
                SkillService.prototype.addSkill = function (skill) {
                    var body = JSON.stringify(skill);
                    var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
                    var options = new http_1.RequestOptions({ headers: headers });
                    return this.http.post('/skills', body, options)
                        .map(this._processData)
                        .catch(this._handleError);
                };
                SkillService.prototype.processSkill = function (skill) {
                    var body = JSON.stringify(skill);
                    var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
                    var options = new http_1.RequestOptions({ headers: headers });
                    return this.http.post('/skills/' + skill.id, body, options)
                        .map(this._extractData)
                        .catch(this._handleError);
                };
                SkillService.prototype._extractData = function (res) {
                    if (res.status < 200 || res.status >= 300) {
                        throw new Error('Bad response status: ' + res.status);
                    }
                    var body = res.json();
                    return body.data || {};
                };
                ;
                SkillService.prototype._handleError = function (error) {
                    var errMsg = [];
                    if (error.status == '422') {
                        var errors = error.json();
                        for (var err in errors) {
                            errMsg.push(errors[err]);
                        }
                        return Observable_1.Observable.throw(errMsg);
                    }
                    else {
                        errMsg.push('Server error');
                        console.error(errMsg); // log to console instead
                        return Observable_1.Observable.throw(errMsg);
                    }
                };
                ;
                SkillService.prototype._processData = function (res) {
                    if (res.status < 200 || res.status >= 300) {
                        throw new Error('Bad response status: ' + res.status);
                    }
                    return res.json();
                };
                ;
                SkillService = __decorate([
                    core_1.Injectable(),
                    __metadata('design:paramtypes', [http_1.Http])
                ], SkillService);
                return SkillService;
            }());
            exports_1("SkillService", SkillService);
        }
    }
});
//# sourceMappingURL=skill.service.js.map


text:
<?xml version="1.0"?>

<!DOCTYPE chapter SYSTEM "cruise_help.dtd">
<chapter title="Go unable to poll for changes">

        <item>Go server polls for changes to all materials of 'Auto Triggered' pipelines. By default, polling occurs every minute and ten materials at a time. The polling interval and the number of materials to be polled simultaneously are configurable.</item>
        <item>Go uses SCM commands to poll for changes. For example, to check for any new changes in SVN repository the following command is used: svn log --non-interactive --xml -v -r HEAD:'revision' 'repository-URL'</item>
        <item>The SCM command used by Go server can hang with no output. Invalid configuration, network issues, console input block are some of the causes for such a situation.
        Such scenarios cause pipeline scheduling delays and also lead to performance degradation</item>
       <item>Such a scenario is notified to the users by a warning in Server Health; when clicked shows a message similar to the one below.</item>

When you see warning messages like the one above

	<bullets>
	    <item>Identify the processes running as children of Go Server </item>
		<note>On Windows, you can use tools like Process Explorer. On linux you could run 'ps waux | grep 'material-type'' </note>
            <item>Determine the process that's hung. The extra information like URL: "https://test@bitbucket.org/test/git_repo.git" in the warning information should help you with this.  </item>
            <item>On linux system, you should see lines like these:</item>
	    go 31201 1  0 Feb07 ?  00:00:00 git clone https://test@bitbucket.org/test/git_repo.git /var/lib/cruise-server/pipelines/flyweight/b9ec0885-eb32-458c-bd6b-eeefe3ef9816
             <item>Kill the process and all its children (the whole process tree). </item>
	     <item>Ensure that the warning message goes away from Server Health.</item>
        <warning>
            Please note the folder name (of the form .../flyweight/b9ec0885-eb32-458c-bd6b-eeefe3ef9816) present in the OS process listing.
            This folder was being used by the polling command. Locate the folder in the Go installation and delete it if it exists.
            This ensures that the kill of the process tree has not left behind any inconsistent information.
        </warning>
	</bullets>

	<bullets>
        <item>Go server waits for 15 minutes (of no output) before it warns user about possible hung material update.
            User can modify this wait time using a System Property: 'material.update.inactive.timeout'.</item>
	<item>On linux installations of Go server, add the following line to /etc/default/go-server.
	    export GO_SERVER_SYSTEM_PROPERTIES='-Dmaterial.update.inactive.timeout=20'
	    The above configuration sets the time that Go server uses to determine if a material update is possibly hung, to 20 minutes.
        </item>
        <item>On Windows, add the following line in the <cref topic="installing_go_server">wrapper-properties.conf</cref> file in the config folder of the Go server installation where x is 1 more than the highest number in wrapper-server.conf and wrapper-properties.conf combined.
	    wrapper.java.additional.x='-Dmaterial.update.inactive.timeout=20'
	    The above configuration sets the time that Go server uses to determine if a material update is possibly hung, to 20 minutes.
        </item>
	</bullets>

</chapter>


text:
#if !defined(BOOST_SPIRIT_SUPPORT_DETAIL_IS_SPIRIT_TAG_MAR_28_2011_0341PM)
#define BOOST_SPIRIT_SUPPORT_DETAIL_IS_SPIRIT_TAG_MAR_28_2011_0341PM

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef BOOST_SPIRIT_USE_PHOENIX_V3
#define BOOST_SPIRIT_IS_TAG()
#else
#define BOOST_SPIRIT_IS_TAG() typedef void is_spirit_tag;
#endif

#endif


text:
Parsing and manipulation of IDC-10-CM code.

TSV of codes can be found [here](http://www.cms.gov/Medicare/Coding/ICD10/Downloads/2016-Code-Descriptions-in-Tabular-Order.zip).


text:
package maratonBook.string;

import java.io.*;
import java.util.Scanner;

/*Lenguaje:
 STATEMENT = ACTION | STATEMENT , ACTION
 ACTION = ACTIVE_LIST VERB ACTIVE_LIST
 ACTIVE_LIST = ACTOR | ACTIVE_LIST and ACTOR
 ACTOR = NOUN | ARTICLE NOUN
 ARTICLE = a | the
 NOUN = tom | jerry | goofy | mickey | jimmy | dog | cat | mouse
 VERB = hate | love | know | like | VERBs
 */
/*Pruebas:
 the dog and a cat know goofy
 jimmy kills tom
 goofy hate mouse jerry
 tom hates jerry , jimmy hates tom
 bla bla

 R/SI PERTENCE
 NO PERTENCE
 NO PERTENCE
 SI PERTENCE
 NO PERTENCE
 */
class ExpresionesRegulares {
	static final String VERB = "(hate|love|know|like)s?";// estaba * pero eso
															// podria tener s
															// infinitas
	static final String NOUN = "(tom|jerry|goofy|mickey|jimmy|dog|cat|mouse)";
	static final String ARTICLE = "(a|the)";
	static final String ACTOR = "(" + NOUN + "|" + ARTICLE + " " + NOUN + ")";
	static final String ACTIVE_LIST = "(" + ACTOR + " and )*" + ACTOR;
	static final String ACTION = ACTIVE_LIST + " " + VERB + " " + ACTIVE_LIST;
	static final String STATEMENT = ACTION + "( , " + ACTION + ")*";

	public static void main(String args[]) throws Exception {
		Scanner sc = new Scanner(System.in);
		String riddle;
		while ((riddle = sc.nextLine()) != null) {
			// There is always space before and after a comma (,). Therefore, it
			// is optional to clean up input with
			// replaceAll() and trim().
			System.out.println(riddle.replaceAll(" +", " ").trim()
					.matches(STATEMENT) ? "SI PERTENCE" : "NO PERTENCE");
		}
	}
}


text:
package org.neo4j.ogm.domain.election;

/**
 * @author vince
 */
public abstract class Entity {

    private Long id;
    private String name;

    public Entity() {
    }

    public Entity(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }
}


text:
<web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

	version="2.5">

	<!-- Default page to serve -->
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
	</welcome-file-list>
	<filter>
		<filter-name>ObjectifyFilter</filter-name>
		<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>ObjectifyFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter>
		<filter-name>characterEncodingFilter</filter-name>
		<filter-class>org.springframework.web.filter.CharacterEncodingFilter
		</filter-class>
		<init-param>
			<param-name>encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>forceEncoding</param-name>
			<param-value>true</param-value>
		</init-param>
	</filter>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
	</context-param>

	<!-- RequestFactory Servlet -->

	<servlet>
		<servlet-name>requestFactoryServlet</servlet-name>
		<servlet-class>
			pl.egalit.vocab.server.core.CustomRequestFactoryServlet
		</servlet-class>
		<init-param>
			<param-name>symbolMapsDirectory</param-name>
			<!-- You'll need to compile with -extras and move the symbolMaps directory
				to this location if you want stack trace deobfuscation to work -->
			<param-value>WEB-INF/classes/symbolMaps/</param-value>
		</init-param>
	</servlet>

	<servlet-mapping>
		<servlet-name>requestFactoryServlet</servlet-name>
		<url-pattern>/gwtRequest</url-pattern>
	</servlet-mapping>

	<!-- Other servlets -->
	<servlet>
		<servlet-name>mvc-dispatcher</servlet-name>
		<servlet-class>
			org.springframework.web.servlet.DispatcherServlet
		</servlet-class>
		<init-param>
			<param-name>contextConfigLocation</param-name>
			<param-value>/WEB-INF/classes/mvc-dispatcher-servlet.xml
			</param-value>
		</init-param>
		<load-on-startup>1</load-on-startup>

	</servlet>

	<servlet-mapping>
		<servlet-name>mvc-dispatcher</servlet-name>
		<url-pattern>/*</url-pattern>

	</servlet-mapping>

	<listener>

		<listener-class>org.springframework.web.context.ContextLoaderListener
		</listener-class>

	</listener>

	<!-- Security -->

	<filter>
		<filter-name>springSecurityFilterChain</filter-name>
		<filter-class>org.springframework.web.filter.DelegatingFilterProxy
		</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>springSecurityFilterChain</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

</web-app>


text:
from __future__ import print_function
import os, sys, re
import time, datetime
import numpy as np
import signal, atexit
from subprocess import Popen, PIPE, STDOUT
import subprocess

def ctrl_c_handler(signum, frame):
    print ("\rStopping...           Time Elapsed: %s" % time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time)))
    sys.exit(1)

def cleanup():
    global process_list
    try:
        for p in process_list:
            if not p.poll():
                p.terminate()
                p.wait()
        subprocess.Popen(['reset']).wait()
        process_list = []
    except:
        pass
    print("Stopped capturing...")

if __name__ == "__main__":
    signal.signal(signal.SIGINT, ctrl_c_handler)
    url = ["rtsp://admin:20160404@192.168.2.13/onvif2", \
            "rtsp://admin:20160404@192.168.2.5/onvif2"]
    time_last = 3600
    fps = 20
    outdir = "./st_dir"
    outdir_sub = ["/left","/right"]
    outdir_log = ["/left.log","/right.log"]

    ## Param for output directory
    argc = len(sys.argv)
    if argc > 1:
    	outdir = sys.argv[1]
    if not os.path.exists(outdir):
    	os.mkdir(outdir)
    outdir_sub = [outdir+x for x in outdir_sub]
    for x in outdir_sub:
        if not os.path.exists(x):
            os.mkdir(x)

    ## Param for fps
    if argc > 2:
    	fps = sys.argv[2]
    	if float(fps) <= 0.0:
    		print("Warning: FPS should be a rational number more than zero. Value set to 5")
    		exit(0)

    ## Param for total training time
    if argc > 3:
    	time_last = sys.argv[3]
    	if int(time_last) <= 0:
    		print("Warning: Total time should be an integer more than zero. Value set to 3600")
    		time_last = 3600

    ## Calculated number of zeros in filename counter
    num = int(np.log10(int(time_last) * float(fps))) + 1

    command_list = []
    # Save images to the folder
    for i in range(len(url)):
        command_str = "ffmpeg -i "+url[i]+" -vf fps="+str(fps)+" '"+outdir_sub[i]+"/IMG_%0"+str(num)+"d.bmp' &> " + outdir+outdir_log[i]
        command_list.append(command_str)

    process_list = []
    atexit.register(cleanup)
    process_list = [Popen(cmd, shell=True) for cmd in command_list]
    print("Initializing...")
    start_time = time.time()
    time.sleep(5)
    # if process_list[1].poll() or process_list[0].poll():
    #     print("Cameras Down")
    print("Subprocesses Created:")
    print("Capture Folder: %s" % outdir)
    while True:
        # if re.search(r".*timed out.*", process_list[1].stdout.readline()) or\
        #     re.search(r".*timed out.*", process_list[0].stdout.readline()):
        #     print("Cameras Down")
        #     exit(0)
        for p in process_list:
            if p.poll():
                exit(1)
        print("\rCapturing...          Time Elapsed: %s" % time.strftime("%H:%M:%S", time.gmtime(time.time() - start_time)),end='\r')
    print("Cameras Down")
    exit(0)