text:
using namespace std;

class BigInteger
{
private:

    static const int base = 1000000000;
    static const int base_digits = 9;

    vector<int> a;
    int sign;

    ///Auxiliary functions
    vector<int> convertBase(const vector<int> &, int, int) const;

    vector<long long> karatsubaMultiplication(const vector<long long> &, const vector<long long> &) const;
    pair<BigInteger, BigInteger> division(const BigInteger &, const BigInteger &) const;

    BigInteger binary_gcd(const BigInteger &, const BigInteger &) const;
    void extented_euclid(BigInteger, BigInteger, BigInteger &, BigInteger &) const;

    bool witness(const BigInteger &, const BigInteger &) const;
    BigInteger pollards_rho(const BigInteger &) const;
    vector<BigInteger> factorization(const BigInteger &, const size_t) const;

    int reverse_bits(const int, const int) const;
    void fft(vector<complex<double>> &, int, int) const;
    vector<complex<double>> convolution(vector<complex<double>> &, vector<complex<double>> &) const;

    BigInteger bruteForceMultiplication(const BigInteger &, const BigInteger &, const int, const int) const;
    BigInteger karatsubaMultiplication(const BigInteger &, const BigInteger &, const int, const int) const;
    BigInteger fftMultiplication(const BigInteger &, const BigInteger &, const int, const int) const;
    BigInteger hybridMultiplication(const BigInteger &, const BigInteger &) const;

public:

    BigInteger();
    BigInteger(long long);
    BigInteger(const BigInteger &);
    BigInteger(const string &);

    BigInteger& operator =  (const BigInteger &);
    BigInteger& operator =  (long long);
    BigInteger& operator =  (const string &);

    BigInteger  operator +  (const BigInteger &) const;
    BigInteger& operator += (const BigInteger &);

    BigInteger  operator -  (const BigInteger &) const;
    BigInteger& operator -= (const BigInteger &);

    BigInteger  operator *  (int) const;
    BigInteger& operator *= (int);

    BigInteger  operator *  (const BigInteger &) const;
    BigInteger& operator *= (const BigInteger &);

    BigInteger  operator /  (int) const;
    BigInteger& operator /= (int);

    BigInteger  operator /  (const BigInteger &) const;
    BigInteger& operator /= (const BigInteger &);

    int         operator %  (int) const;
    BigInteger& operator %= (int);

    BigInteger  operator %  (const BigInteger &) const;
    BigInteger& operator %= (const BigInteger &);

    BigInteger& operator ++ ();
    BigInteger  operator ++ (int);

    BigInteger& operator -- ();
    BigInteger  operator -- (int);

    BigInteger  operator -  () const;

    void trim();
    size_t numberOfDigits() const;

    BigInteger abs() const;

    BigInteger pow(int) const;
    BigInteger pow(const BigInteger &) const;
    BigInteger modPow(int, int) const;
    BigInteger modPow(int, const BigInteger &) const;
    BigInteger modPow(const BigInteger &, const BigInteger &) const;

    BigInteger sqrt(int) const;

    BigInteger gcd(const BigInteger &) const;
    BigInteger lcm(const BigInteger &) const;
    BigInteger modInverse(const BigInteger &) const;
    bool isProbablePrime(const int) const;
    BigInteger nextProbablePrime(const size_t) const;
    BigInteger getProperDivisor() const;
    vector<BigInteger> factorize(const size_t) const;

    bool operator <  (const BigInteger &) const;
    bool operator >  (const BigInteger &) const;
    bool operator <= (const BigInteger &) const;
    bool operator >= (const BigInteger &) const;
    bool operator == (const BigInteger &) const;
    bool operator != (const BigInteger &) const;

    ///Java-like functions
    BigInteger add(const BigInteger &) const;
    BigInteger subtract(const BigInteger &) const;

    int compareTo(const BigInteger &) const;
    bool equals(const BigInteger &) const;

    BigInteger multiply(int) const;
    BigInteger multiply(const BigInteger &) const;

    BigInteger divide(int) const;
    BigInteger divide(const BigInteger &) const;
    pair<BigInteger, BigInteger> divideAndRemainder(const BigInteger &) const;
    int mod(int) const;
    BigInteger mod(const BigInteger &) const;

    bool isZero() const;
    int signum() const;
    unsigned int hashCode() const;

    static BigInteger randomBigInteger(const size_t);
    static BigInteger valueOf(long long);
    static BigInteger ONE();
    static BigInteger TEN();
    static BigInteger ZERO();

    string toString() const;
    long long toLongLong() const;

    ///Input/Output operators ---------------------------------------------------------
    friend istream& operator >> (istream &stream, BigInteger &B)
    {
        string s;
        stream >> s;

        B = BigInteger(s);

        return stream;
    }

    friend ostream& operator << (ostream &stream, const BigInteger &B)
    {
        if (B.sign == -1)
            stream << '-';

        stream << (B.a.empty() ? 0 : B.a.back());

        for (int i = (int)B.a.size() - 2; i >= 0; i--)
            stream << setw(base_digits) << setfill('0') << B.a[i];

        return stream;
    }
    ///----------------------------------------------------------------------------------
};

///Constructors --------------------------------------------------------------------------------

BigInteger::BigInteger() : a(), sign()
{
    this->sign = 1;
    this->a.clear();
}

BigInteger::BigInteger(long long value) : a(), sign()
{
    *this = value;

    this->trim();
}

BigInteger::BigInteger(const BigInteger &BI): a(), sign()
{
    this->sign = BI.sign;
    this->a = BI.a;

    this->trim();
}

BigInteger::BigInteger(const string &s) : a(), sign()
{
    this->sign = 1;
    this->a.clear();

    int cursor = 0;

    while (cursor < (int)s.size() && (s[cursor] == '-' || s[cursor] == '+'))
    {
        if (s[cursor] == '-')
            this->sign = -1;

        cursor++;
    }

    for (int i = (int)s.size() - 1; i >= cursor; i -= base_digits)
    {
        int x = 0;

        for (int j = max(cursor, i - base_digits + 1); j <= i; ++j)
            x = x * 10 + (s[j] - '0');

        this->a.push_back(x);
    }

    this->trim();
}

///Constructors --------------------------------------------------------------------------------

BigInteger& BigInteger::operator = (const BigInteger &BI)
{
    this->sign = BI.sign;
    this->a = BI.a;

    this->trim();

    return *this;
}

BigInteger& BigInteger::operator = (long long value)
{
    this->sign = 1;
    this->a.clear();

    if (value < 0)
    {
        this->sign = -1;
        value = -value;
    }

    do
    {
        this->a.push_back(value % base);
        value /= base;

    } while (value > 0);

    this->trim();

    return *this;
}

BigInteger& BigInteger::operator = (const string &s)
{
    *this = BigInteger(s);

    return *this;
}

BigInteger BigInteger::operator + (const BigInteger &B) const
{
    if (this->sign == B.sign)
    {
        BigInteger solution = B;

        int maximLg = (int)max(this->a.size(), B.a.size());

        for (int i = 0, carry = 0; i < maximLg || carry; ++i)
        {
            if (i == (int)solution.a.size())
                solution.a.push_back(0);

            long long current = solution.a[i];

            current += carry;

            if (i < (int)this->a.size())
                current += this->a[i];

            carry = (current >= base);

            if (carry)
                current -= base;

            solution.a[i] = current;
        }

        return solution;
    }
    else
    {
        return *this - (-B);
    }
}

BigInteger& BigInteger::operator += (const BigInteger &B)
{
    *this = *this + B;

    return *this;
}

BigInteger BigInteger::operator - (const BigInteger &B) const
{
    if (this->sign == B.sign)
    {
        if (this->abs() >= B.abs())
        {
            BigInteger solution = *this;

            for (int i = 0, carry = 0; i < (int)B.a.size() || carry; ++i)
            {
                long long current = solution.a[i];

                current -= carry;

                if (i < (int)B.a.size())
                    current -= B.a[i];

                carry = (current < 0);

                if (carry)
                    current += base;

                solution.a[i] = current;
            }

            solution.trim();

            return solution;
        }
        else
        {
            return -(B - *this);
        }
    }
    else
    {
        return *this + (-B);
    }
}

BigInteger& BigInteger::operator -= (const BigInteger &B)
{
    *this = *this - B;

    return *this;
}

BigInteger BigInteger::operator * (int value) const
{
    BigInteger solution = *this;

    if (value < 0)
    {
        solution.sign = -solution.sign;
        value = -value;
    }

    for (int i = 0, carry = 0; i < (int)solution.a.size() || carry; ++i)
    {
        if (i == (int)solution.a.size())
            solution.a.push_back(0);

        long long current = (1LL * solution.a[i] * value) + 1LL * carry;
        carry = current / base;
        solution.a[i] = current % base;
    }

    solution.trim();

    return solution;
}

BigInteger& BigInteger::operator *= (int value)
{
    *this = *this * value;

    return *this;
}

BigInteger BigInteger::operator * (const BigInteger &B) const
{
    return hybridMultiplication(*this, B);
}

BigInteger& BigInteger::operator *= (const BigInteger &B)
{
    *this = *this * B;

    return *this;
}

BigInteger BigInteger::operator / (int value) const
{
    BigInteger solution = *this;

    if (value < 0)
    {
        solution.sign = -solution.sign;
        value = -value;
    }

    for (int i = (int)solution.a.size() - 1, rem = 0; i >= 0; i--)
    {
        long long current = 1LL * rem * base + 1LL * solution.a[i];
        solution.a[i] = (current / value);
        rem = (current % value);
    }

    solution.trim();

    return solution;
}

BigInteger& BigInteger::operator /= (int value)
{
    *this = *this / value;

    return *this;
}

BigInteger BigInteger::operator / (const BigInteger &B) const
{
    return division(*this, B).first;
}

BigInteger& BigInteger::operator /= (const BigInteger &B)
{
    *this = *this / B;

    return *this;
}

int BigInteger::operator % (int value) const
{
    if (value < 0)
        value = -value;

    int rem = 0;

    for (int i = (int)this->a.size() - 1; i >= 0; i--)
        rem = (1LL * rem * base + 1LL * this->a[i]) % value;

    return rem * this->sign;
}

BigInteger& BigInteger::operator %= (int value)
{
    *this = *this % value;

    return *this;
}

BigInteger BigInteger::operator % (const BigInteger &B) const
{
    return division(*this, B).second;
}

BigInteger& BigInteger::operator %= (const BigInteger &B)
{
    *this = *this % B;

    return *this;
}

BigInteger& BigInteger::operator ++ () ///prefix
{
    *this = *this + 1;

    return *this;
}

BigInteger BigInteger::operator ++ (int) ///postfix
{
    BigInteger solution = *this;
    ++(*this);

    return solution;
}

BigInteger& BigInteger::operator -- () ///prefix
{
    *this = *this - 1;

    return *this;
}

BigInteger BigInteger::operator -- (int) ///postfix
{
    BigInteger solution = *this;
    --(*this);

    return solution;
}

BigInteger BigInteger::operator - () const
{
    BigInteger solution = *this;
    solution.sign = -solution.sign;

    return solution;
}

void BigInteger::trim()
{
    while (this->a.size() && this->a.back() == 0)
        this->a.pop_back();

    if (this->a.empty())
      this->sign = 1;
}

size_t BigInteger::numberOfDigits() const
{
    if (this->a.empty() == true)
        return 1; ///*this = 0

    size_t number = base_digits * (this->a.size() - 1);

    int tmp = this->a.back();

    while (tmp)
    {
        number++;
        tmp /= 10;
    }

    return number;
}

BigInteger BigInteger::abs() const
{
    BigInteger solution = *this;
    solution.sign = 1;

    return solution;
}

BigInteger BigInteger::pow(int exponent) const
{
    BigInteger solution = 1;
    BigInteger A = *this;

    while (exponent > 0)
    {
        if (exponent & 1)
            solution *= A;

        A *= A;
        exponent >>= 1;
    }

    return solution;
}

BigInteger BigInteger::pow(const BigInteger &exponent) const
{
    BigInteger solution = 1;
    BigInteger A = *this;
    BigInteger p = exponent;

    while (p.isZero() == false)
    {
        if (p % 2 == 1)
            solution *= A;

        A *= A;
        p /= 2;
    }

    return solution;
}

BigInteger BigInteger::modPow(int exponent, int MOD) const
{
    BigInteger solution = 1;
    BigInteger A = *this;

    while (exponent > 0)
    {
        if (exponent & 1)
            solution = (solution * A) % MOD;

        A = (A * A) % MOD;
        exponent >>= 1;
    }

    return solution;
}

BigInteger BigInteger::modPow(int exponent, const BigInteger &MOD) const
{
    BigInteger solution = 1;
    BigInteger A = *this;

    while (exponent > 0)
    {
        if (exponent & 1)
            solution = (solution * A) % MOD;

        A = (A * A) % MOD;
        exponent >>= 1;
    }

    return solution;
}

BigInteger BigInteger::modPow(const BigInteger &exponent, const BigInteger &MOD) const
{
    BigInteger solution = 1;
    BigInteger A = *this;
    BigInteger p = exponent;

    while (p.isZero() == false)
    {
        if (p % 2 == 1)
            solution = (solution * A) % MOD;

        A = (A * A) % MOD;
        p /= 2;
    }

    return solution;
}

BigInteger BigInteger::sqrt(int order) const
{
    assert(order >= 1);

    BigInteger T = 10;
    BigInteger l = T.pow(max(0, (int)this->numberOfDigits() / order - 1));
    BigInteger r = T.pow((int)this->numberOfDigits() / order + 1);
    BigInteger m, tmp, solution;

    while (l <= r)
    {
        m = (l + r) / 2;
        tmp = m.pow(order);

        if (tmp <= *this)
        {
            solution = m;
            l = m + 1;
        }
        else
        {
            r = m - 1;
        }
    }

    return solution;
}

BigInteger BigInteger::gcd(const BigInteger &_B) const
{
    BigInteger A = *this;
    BigInteger B = _B;

    return binary_gcd(A, B);
}

BigInteger BigInteger::lcm(const BigInteger &B) const
{
    return *this * B / this->gcd(B);
}

BigInteger BigInteger::modInverse(const BigInteger &N) const
{
    assert(this->gcd(N) == BigInteger(1));

    BigInteger x, y;
    extented_euclid(*this, N, x, y);

    if (x <= BigInteger(0))
    {
        x = N - (x.abs() % N);
    }

    return x;
}

bool BigInteger::isProbablePrime(const int numberOfBases) const
{
    int primes[] = { 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,
                     61,67,71,73,79,83,89,97,101,103,107,109,113,127,
                     131,137,139,149,151,157,163,167,173,179,181,191,
                     193,197,199,211,223,227,229,233,239,241,251,257,
                     263,269,271
                    }; ///58 prime numbers

    if (*this == 1)
        return false;

    if (*this != 2 && *this % 2 == 0)
        return false;

    for (int i = 0; i < min(58, numberOfBases); ++i)
    {
        if (*this == primes[i])
            return true;
    }

    for (int i = 0; i < min(58, numberOfBases); ++i)
    {
        if (witness(primes[i], *this))
            return false;
    }

    return true;
}

BigInteger BigInteger::nextProbablePrime(const size_t numberOfBases) const
{
    BigInteger solution = *this + 1;

    while (solution.isProbablePrime(numberOfBases) == false)
        solution++;

    return solution;
}

BigInteger BigInteger::getProperDivisor() const
{
    BigInteger divisor;

    do
    {
        divisor = pollards_rho(*this);

    } while (divisor == *this);

    return divisor;
}

vector<BigInteger> BigInteger::factorize(const size_t numberOfBases) const
{
    vector<BigInteger> V = factorization(*this, numberOfBases);
    std::sort(V.begin(), V.end());

    return V;
}

///Auxilary functions--------------------------------------------------

vector<int> BigInteger::convertBase(const vector<int> &A, int oldBase, int newBase) const ///conversion from 10^oldBase to 10^newBase
{
    vector<long long> powers(max(oldBase, newBase) + 1, 0);

    powers[0] = 1;

    for (int i = 1; i < (int)powers.size(); ++i)
        powers[i] = powers[i - 1] * 10LL;

    vector<int> solution;

    long long current = 0;
    int current_size = 0;

    for (int i = 0; i < (int)A.size(); ++i)
    {
        current += A[i] * powers[current_size];
        current_size += oldBase;

        while (current_size >= newBase)
        {
            solution.push_back((int)(current % powers[newBase]));
            current /= powers[newBase];
            current_size -= newBase;
        }
    }

    solution.push_back((int)current);

    while (solution.empty() == false && solution.back() == 0)
        solution.pop_back();

    return solution;
}

vector<long long> BigInteger::karatsubaMultiplication(const vector<long long> &A, const vector<long long> &B) const
{
    const size_t N = A.size();
    vector<long long> solution(2 * N, 0);

    if (N <= 32)
    {
        for (size_t i = 0; i < N; ++i)
            for (size_t j = 0; j < N; ++j)
                solution[i + j] += A[i] * B[j];

        return solution;
    }

    size_t p = N / 2;

    vector<long long> a1(A.begin(), A.begin() + p);
    vector<long long> a2(A.begin() + p, A.end());
    vector<long long> b1(B.begin(), B.begin() + p);
    vector<long long> b2(B.begin() + p, B.end());

    vector<long long> a1b1 = karatsubaMultiplication(a1, b1);
    vector<long long> a2b2 = karatsubaMultiplication(a2, b2);

    for (size_t i = 0; i < p; ++i)
    {
        a2[i] += a1[i];
        b2[i] += b1[i];
    }

    vector<long long> tmp = karatsubaMultiplication(a2, b2);

    for (size_t i = 0; i < N; ++i)
    {
        tmp[i] -= a1b1[i];
        tmp[i] -= a2b2[i];

        solution[i + p] += tmp[i];
        solution[i] += a1b1[i];
        solution[i + N] += a2b2[i];
    }

    return solution;
}

pair<BigInteger, BigInteger> BigInteger::division(const BigInteger &X, const BigInteger &Y) const
{
    if (X < Y)
    {
        return make_pair(0, X);
    }

    if (X == Y)
    {
        return make_pair(1, 0);
    }

    int norm = base / (Y.a.back() + 1);

    BigInteger A = X.abs() * norm;
    BigInteger B = Y.abs() * norm;

    BigInteger q, r;
    q.a.resize(A.a.size());

    for (int i = (int)A.a.size() - 1; i >= 0; i--)
    {
        r = r * base + A.a[i];

        int s1, s2;

        if (r.a.size() <= B.a.size())
            s1 = 0;
        else
            s1 = r.a[B.a.size()];

        if (r.a.size() <= B.a.size() - 1)
            s2 = 0;
        else
            s2 = r.a[B.a.size() - 1];

        int digit = (1LL * base * s1 + 1LL * s2) / B.a.back();

        r -= B * digit;

        while (r < 0)
        {
            r += B;
            digit--;
        }

        q.a[i] = digit;
    }

    q.sign = X.sign * Y.sign;
    r.sign = X.sign;

    q.trim();
    r.trim();

    return make_pair(q, r / norm);
}

BigInteger BigInteger::binary_gcd(const BigInteger &A, const BigInteger &B) const
{
    if (A.isZero())
        return B;

    if (B.isZero())
        return A;

    if (A == B)
        return A;

    if (A % 2 == 0)
    {
        if (B % 2 == 1)
        {
            return binary_gcd(A / 2, B);
        }
        else
        {
            return binary_gcd(A / 2, B / 2) * 2;
        }
    }
    else
    {
        if (B % 2 == 0)
        {
            return binary_gcd(A, B / 2);
        }
    }

    if (A > B)
    {
        return binary_gcd((A - B) / 2, B);
    }
    else
    {
        return binary_gcd((B - A) / 2, A);
    }
}

void BigInteger::extented_euclid(BigInteger A, BigInteger B, BigInteger &x, BigInteger &y) const
{
    if (B.isZero())
    {
        x = 1;
        y = 0;
    }
    else
    {
        BigInteger x0, y0;

        extented_euclid(B, A % B, x0, y0);

        x = y0;
        y = x0 - (A / B) * y0;
    }
}

bool BigInteger::witness(const BigInteger &primeBase, const BigInteger &N) const
{
    BigInteger tmp = N - 1;
    int t = 0;

    while (tmp % 2 == 0)
    {
        t++;
        tmp /= 2;
    }

    BigInteger x = primeBase.modPow(tmp, N);

    if (x == 1 || x == N - 1)
        return false;

    t--;

    while (t > 0)
    {
        x = (x * x) % N;

        if (x == N - 1)
            return false;

        t--;
    }

    return true;
}

BigInteger BigInteger::pollards_rho(const BigInteger &N) const ///returns a proper divisor of N or N (if it fails!)
{
    if (N % 2 == 0)
        return 2;

    BigInteger A = 1 + rand() % 1000000000000000000LL;
    BigInteger C = 1 + rand() % 1000000000000000000LL;

    BigInteger X = A;
    BigInteger Y = A;
    BigInteger divisor;

    do
    {
        X = (X * X + C) % N;

        Y = (Y * Y + C) % N;
        Y = (Y * Y + C) % N;

        divisor = X.subtract(Y).abs().gcd(N); /// gcd(abs(x - y), n);

    } while (divisor == 1);

    return divisor;
}

vector<BigInteger> BigInteger::factorization(const BigInteger &N, const size_t numberOfBases) const
{
    if (N == 1)
        return vector<BigInteger>();

    if (N.isProbablePrime(numberOfBases))
    {
        vector<BigInteger> V = {N};
        return V;
    }

    BigInteger divisor = N.getProperDivisor();

    vector<BigInteger> A = factorization(divisor, numberOfBases);
    vector<BigInteger> B = factorization(N / divisor, numberOfBases);

    for (size_t i = 0; i < B.size(); ++i)
        A.push_back(B[i]);

    return A;
}

int BigInteger::reverse_bits(const int x, const int EXP) const
{
    int rev_x = 0;

    for (int i = 0; i < EXP; ++i)
    {
        bool bit = x & (1 << i);

        rev_x <<= 1;
        rev_x |= bit;
    }

    return rev_x;
}

void BigInteger::fft(vector<complex<double>> &A, int EXP, int inverse) const
{
    const int N = A.size();

    for (int i = 0; i < N; ++i)
    {
        int j = reverse_bits(i, EXP);

        if (i < j)
            swap(A[i], A[j]);
    }

    for (int length = 2; length <= N; length *= 2)
    {
        complex<double> root = polar(1.0, inverse * 2.0 * M_PI / length);

        for (int start = 0; start < N; start += length)
        {
            complex<double> wk = 1.0;

            for (int i = 0; i < length / 2; ++i)
            {
                complex<double> u = A[start + i];
                complex<double> v = A[start + i + length / 2] * wk;

                A[start + i] = u + v;
                A[start + i + length / 2] = u - v;

                wk *= root;
            }
        }
    }

    if (inverse == -1)
    {
        for (int i = 0; i < N; ++i)
            A[i] /= N;
    }
}

vector<complex<double>> BigInteger::convolution(vector<complex<double>> &A, vector<complex<double>> &B) const
{
    int N = A.size();
    int M = B.size();

    int EXP = 0;

    while ((1 << EXP) < 2 * max(N, M))
        EXP++;

    int length = 1 << EXP;

    ///padding
    for (int i = N; i < length; ++i)
        A.push_back(0);

    for (int i = M; i < length; ++i)
        B.push_back(0);

    fft(A, EXP, 1);
    fft(B, EXP, 1);

    vector<complex<double>> C(length);

    for (int i = 0; i < length; ++i)
        C[i] = A[i] * B[i];

    fft(C, EXP, -1);

    return C;
}

BigInteger BigInteger::bruteForceMultiplication(const BigInteger &A, const BigInteger &B, const int newBase, const int newBaseDigits) const
{
    vector<int> a5 = convertBase(A.a, base_digits, newBaseDigits);
    vector<int> b5 = convertBase(B.a, base_digits, newBaseDigits);

    vector<unsigned long long> x(a5.begin(), a5.end());
    vector<unsigned long long> y(b5.begin(), b5.end());

    vector<unsigned long long> c(x.size() + y.size(), 0);

    for (size_t i = 0; i < x.size(); ++i)
        for (size_t j = 0; j < y.size(); ++j)
            c[i + j] += x[i] * y[j];

    BigInteger solution;
    solution.a.clear();
    solution.sign = A.sign * B.sign;

    unsigned long long carry = 0;

    for (int i = 0; i < (int)c.size(); ++i)
    {
        unsigned long long current = c[i] + carry;
        solution.a.push_back(current % newBase);
        carry = (current / newBase);
    }

    solution.a = convertBase(solution.a, newBaseDigits, base_digits);
    solution.trim();

    return solution;
}

BigInteger BigInteger::karatsubaMultiplication(const BigInteger &A, const BigInteger &B, const int newBase, const int newBaseDigits) const
{
    vector<int> a5 = convertBase(A.a, base_digits, newBaseDigits);
    vector<int> b5 = convertBase(B.a, base_digits, newBaseDigits);

    vector<long long> x(a5.begin(), a5.end());
    vector<long long> y(b5.begin(), b5.end());

    while (x.size() < y.size()) x.push_back(0);
    while (y.size() < x.size()) y.push_back(0);

    while (x.size() & (x.size() - 1))
    {
        x.push_back(0);
        y.push_back(0);
    }

    vector<long long> c = karatsubaMultiplication(x, y);

    BigInteger solution;
    solution.a.clear();
    solution.sign = A.sign * B.sign;

    for (int i = 0, carry = 0; i < (int)c.size(); ++i)
    {
        long long current = c[i] + carry;
        solution.a.push_back(current % newBase);
        carry = (current / newBase);
    }

    solution.a = convertBase(solution.a, newBaseDigits, base_digits);
    solution.trim();

    return solution;
}

BigInteger BigInteger::fftMultiplication(const BigInteger &X, const BigInteger &Y, const int newBase, const int newBaseDigits) const
{
    vector<int> Xtr = convertBase(X.a, base_digits, newBaseDigits);
    vector<int> Ytr = convertBase(Y.a, base_digits, newBaseDigits);

    int N = Xtr.size();
    int M = Ytr.size();

    vector<complex<double>> A(N);
    vector<complex<double>> B(M);

    for (int i = 0; i < N; ++i)
        A[i] = Xtr[i];

    for (int i = 0; i < M; ++i)
        B[i] = Ytr[i];

    vector<complex<double>> C = convolution(A, B);
    vector<int> result;

    int carry = 0;

    for (size_t i = 0; i < C.size(); ++i)
    {
        int c = (int)(C[i].real() + 0.5);

        c += carry;
        carry = c / newBase;
        c %= newBase;

        result.push_back(c);
    }

    BigInteger solution;
    solution.sign = X.sign * Y.sign;
    solution.a = convertBase(result, newBaseDigits, base_digits);

    return solution;
}

BigInteger BigInteger::hybridMultiplication(const BigInteger &A, const BigInteger &B) const
{
    const int CUT_OFF_KARATSUBA = 19000 * 19000;
    const int CUT_OFF_FFT       = 81900;
    ///----------------------------------------------------------------------

    int nrA = this->numberOfDigits();
    int nrB = B.numberOfDigits();

    if (1LL * nrA * nrB <= 1LL * CUT_OFF_KARATSUBA)
        return bruteForceMultiplication(A, B, 100000000, 8);

    if (max(nrA, nrB) <= CUT_OFF_FFT)
    {
        if (max(nrA, nrB) <= 48000)
            return karatsubaMultiplication(A, B, 1000000, 6);
        else
            return karatsubaMultiplication(A, B, 100000, 5);
    }
    else
    {
        if (max(nrA, nrB) <= 1700000)
            return fftMultiplication(A, B, 100, 2);
        else
            return fftMultiplication(A, B, 10, 1);
    }
}

///Comparision operators --------------------------------------------------------------------------

bool BigInteger::operator < (const BigInteger &B) const
{
    if (this->sign != B.sign)
        return this->sign < B.sign;

    if (this->a.size() != B.a.size())
        return this->a.size() * this->sign < B.a.size() * B.sign;

    for (int i = (int)this->a.size() - 1; i >= 0; i--)
        if (this->a[i] != B.a[i])
            return this->a[i] * this->sign < B.a[i] * B.sign;

    return false;
}

bool BigInteger::operator > (const BigInteger &B) const
{
    return B < *this;
}

bool BigInteger::operator <= (const BigInteger &B) const
{
    return !(B < *this);
}

bool BigInteger::operator >= (const BigInteger &B) const
{
    return !(*this < B);
}

bool BigInteger::operator == (const BigInteger &B) const
{
    return !(*this < B) && !(B < *this);
}

bool BigInteger::operator != (const BigInteger &B) const
{
    return (*this < B) || (B < *this);
}

///Comparision operators --------------------------------------------------------------------------

///Java-like functions--------------------------------------------------------------------------------------

/// 1 ----------------------------------------------------------------------------------
BigInteger BigInteger::add(const BigInteger &B) const
{
    return *this + B;
}

BigInteger BigInteger::subtract(const BigInteger &B) const
{
    return *this - B;
}
///------------------------------------------------------------------------------------

/// 2 ---------------------------------------------------------------------------------
int BigInteger::compareTo(const BigInteger &B) const
{
    if (*this < B)
        return -1;

    if (*this > B)
        return +1;

    return 0;
}

bool BigInteger::equals(const BigInteger &B) const
{
    return *this == B;
}
///------------------------------------------------------------------------------------

/// 3 ---------------------------------------------------------------------------------
BigInteger BigInteger::multiply(int value) const
{
    return *this * value;
}

BigInteger BigInteger::multiply(const BigInteger &B) const
{
    return *this * B;
}
///------------------------------------------------------------------------------------

/// 4 ---------------------------------------------------------------------------------
BigInteger BigInteger::divide(int value) const
{
    return *this / value;
}

BigInteger BigInteger::divide(const BigInteger &B) const
{
    return *this / B;
}

pair<BigInteger, BigInteger> BigInteger::divideAndRemainder(const BigInteger &B) const
{
    return division(*this, B);
}

int BigInteger::mod(int value) const
{
    return *this % value;
}

BigInteger BigInteger::mod(const BigInteger &B) const
{
    return *this % B;
}
/// -----------------------------------------------------------------------------------

/// 5 ---------------------------------------------------------------------------------
bool BigInteger::isZero() const
{
    if (this->a.empty() == true)
        return true;

    if ((int)this->a.size() == 1 && this->a.back() == 0)
        return true;
    else
        return false;
}

int BigInteger::signum() const
{
    if (*this < 0)
        return -1;

    if (*this > 0)
        return +1;

    return 0;
}

unsigned int BigInteger::hashCode() const
{
    unsigned int hashC = 5381;

    for (int i = (int)this->a.size() - 1; i >= 0; --i)
    {
        hashC = ((hashC << 5) + hashC) + this->a[i];
    }

    if (this->sign == -1)
        hashC *= 2654435761U;

    return hashC;
}

BigInteger BigInteger::randomBigInteger(const size_t numDigits)
{
    string s;
    s.push_back(char('1' + rand() % 9));

    for (size_t i = 1; i < numDigits; ++i)
        s.push_back(char('0' + rand() % 10));

    return BigInteger(s);
}

BigInteger BigInteger::valueOf(long long value)
{
    return BigInteger(value);
}

BigInteger ONE()
{
    return BigInteger(1);
}

BigInteger TEN()
{
    return BigInteger(10);
}

BigInteger ZERO()
{
    return BigInteger(0);
}

///------------------------------------------------------------------------------------

/// 6 ---------------------------------------------------------------------------------
string BigInteger::toString() const
{
    string solution;

    if (this->sign == -1)
        solution.push_back('-');

    if (this->a.empty() == true)
    {
        solution.push_back('0');
    }
    else
    {
        string res;
        int tmp = this->a.back();

        while (tmp)
        {
            res.push_back(char('0' + tmp % 10));
            tmp /= 10;
        }

        reverse(res.begin(), res.end());
        solution += res;

        for (int i = (int)this->a.size() - 2; i >= 0; i--)
        {
            res.clear();
            tmp = this->a[i];

            while (tmp)
            {
                res.push_back(char('0' + tmp % 10));
                tmp /= 10;
            }

            reverse(res.begin(), res.end());

            for (int j = 0; j < base_digits - (int)res.size(); j++)
                solution.push_back('0');

            solution += res;
        }
    }

    return solution;
}

long long BigInteger::toLongLong() const
{
    long long solution = 0;

    for (int i = (int)this->a.size() - 1; i >= 0; i--)
        solution = solution * base + this->a[i];

    return solution * this->sign;
}
///------------------------------------------------------------------------------------

///Java-like functions--------------------------------------------------------------------------------------

int main()
{
  BigInteger a("6851638611761610609716681156512900987231016964631270566860079529345701");
  BigInteger b("41109831670569663658300086939077404909608122265524774868353822811305361");
  BigInteger c("67585198634817523235520443624317923");

  cout << b / c << endl;

  // cout << b / a.gcd(b) << endl;
  // cout << a.gcd(b) << endl;
  // cout << b % a.gcd(b) << endl;

  return 0;
}


text:
namespace spiceSimulator {

	class Capacitor :
		public Component
	{
	public:
		Capacitor(void);
		~Capacitor(void);
		Capacitor(Node *, Node *, double, unsigned long newKey);

		ComponentType getComponentType();
		void getFrequencyStamp(std::vector<std::vector<std::complex<double>>>*, double);

	private:
		Node *node1, *node2;

	};

}

redpajama_set_name: RedPajamaGithub


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

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>twitter4j.examples.list (twitter4j-examples 3.0.3 API)</title>
<meta name="date" content="2012-12-23">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

twitter4j.examples.list

Classes

AddUserListMember

AddUserListMembers

CreateUserList

CreateUserListSubscription

DeleteUserListMember

DestroyUserList

DestroyUserListSubscription

GetUserListMembers

GetUserListMemberships

GetUserLists

GetUserListStatuses

GetUserListSubscribers

GetUserListSubscriptions

ShowUserList

ShowUserListMembership

ShowUserListSubscription

UpdateUserList


text:
<?xml version="1.0" encoding="utf-8"?>
<window type="dialog">
	<allowoverlay>no</allowoverlay>
	<defaultcontrol always="false">4000</defaultcontrol>
	<coordinates>
		<system>1</system>
		<posx>0</posx>
		<posy>0</posy>
	</coordinates>

    <controls>

        <control type="image">
            <posx>0</posx>
            <posy>150</posy>
            <width>100%</width>
            <height>100%</height>
            <texture>tvguide-background-default.jpg</texture>
        </control>
        <control type="image">
            <posx>0</posx>
            <posy>150</posy>
            <width>100%</width>
            <height>100%</height>
            <texture>tvguide-background-default.jpg</texture>
        </control>
		<control type="image">
            <posx>156</posx>
            <posy>207</posy>
            <width>637</width>
            <height>400</height>
            <texture>desc-bg.png</texture>
        </control>

		<control type="label">
            <description>Help and Tips</description>
            <posx>156</posx>
            <posy>180</posy>
            <width>180</width>
            <height>50</height>
            <textcolor>ff363636</textcolor>
            Font-WidgetCategory
			<align>left</align>
            <aligny>top</aligny>
			Help and Tips
        </control>

		<control type="label">
            <description>Options</description>
            <posx>800</posx>
            <posy>180</posy>
            <width>180</width>
            <height>50</height>
            <textcolor>ff363636</textcolor>
            Font-WidgetCategory
			<align>left</align>
            <aligny>top</aligny>
			Options
        </control>

		<control type="label">
            <description>Help and Tips</description>
            <posx>165</posx>
            <posy>215</posy>
            <width>615</width>
            <height>400</height>
            <textcolor>ffb8b8b8</textcolor>
            Font-ListInfo-Small
			<align>justify</align>
            <aligny>top</aligny>
			<wrapmultiline>true</wrapmultiline>
			<autoscroll time="3600" delay="6000" repeat="6000">true</autoscroll>
			Supported Plugins
The following Kodi plugins are currently supported by FTV Guide: F.T.V., TVCatchup, USTVNow (Lunatixz 9.9.9), Irish TV, SkyGo Launcher (V2), MX NCAA, MX BBC Player, MX RTE Player.

Channel Hiding & Moving
While in this menu, if you choose 'Channels' to the left, you will be presented with a list of all the channels in your source XMLTV. Clicking on one with toggle it on or off. Pressing left, however, will slot the channel out of its place and you can then move it up or down your list. This is an easy way to get your guide just how you want it. Be warned, though, changing to another source in the main settings will force you to lose any channel settings you may have made.

For any more help please visit TVAddons.ag
        </control>

        <control type="image" id="4100">
            <posx>885</posx>
            <posy>537</posy>
            <width>332</width>
            <height>40</height>
			<align>right</align>
            <aspectratio>keep</aspectratio>
			<visible>true</visible>
        </control>
        <control type="label" id="4101">
            <posx>160</posx>
            <posy>100</posy>
            <width>240</width>
            <height>50</height>
            <align>center</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
        </control>

        <control type="button" id="4000">
            <posx>800</posx>
            <posy>207</posy>
            <width>332</width>
            <height>67</height>
            <texturefocus>tvguide-program-grey-focus.png</texturefocus>
            <texturenofocus>desc-bg.png</texturenofocus>
            <ondown>4001</ondown>
            <align>right</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
        </control>

        <control type="button" id="4001">
            <posx>800</posx>
            <posy>282</posy>
            <width>332</width>
            <height>67</height>
            <texturefocus>tvguide-program-grey-focus.png</texturefocus>
            <texturenofocus>desc-bg.png</texturenofocus>
            <onup>4000</onup>
            <ondown>4002</ondown>
            <align>right</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
            $ADDON[script.ftvguide 30304]
        </control>
        <control type="label">
            <posx>20</posx>
            <posy>260</posy>
            <width>240</width>
            <height>200</height>
            Font-Button
            <textcolor>ffffffff</textcolor>
            $ADDON[script.ftvguide 30305]
            <wrapmultiline>true</wrapmultiline>
			<visible>false</visible>
        </control>

        <control type="label" id="4102">
            <posx>1121</posx>
            <posy>565</posy>
            <width>330</width>
            <height>50</height>
            <align>right</align>
            <aligny>center</aligny>
            Font-WidgetCategory
            <textcolor>ffb8b8b8</textcolor>
			<visible>true</visible>
        </control>
		<control type="button">
            <posx>800</posx>
            <posy>355</posy>
            <width>332</width>
            <height>67</height>
			<texturefocus>tvguide-program-grey-focus.png</texturefocus>
            <texturenofocus>desc-bg.png</texturenofocus>
            <align>right</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ff616161</textcolor>
			Remind
        </control>
        <control type="button" id="4002">
            <posx>800</posx>
            <posy>355</posy>
            <width>332</width>
            <height>67</height>
            <onup>4001</onup>
            <ondown>4003</ondown>
            <align>right</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
        </control>

        <control type="button" id="4003">
            <posx>800</posx>
            <posy>429</posy>
            <width>332</width>
            <height>67</height>
            <texturefocus>tvguide-program-grey-focus.png</texturefocus>
            <texturenofocus>desc-bg.png</texturenofocus>
            <onup>4002</onup>
            <align>right</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
            $ADDON[script.ftvguide 30307]
        </control>
        <control type="button" id="4004">
            <posx>20</posx>
            <posy>650</posy>
            <width>240</width>
            <height>50</height>
            <texturefocus>menu-grey-focus.png</texturefocus>
            <texturenofocus>menu-grey.png</texturenofocus>
            <onup>4003</onup>
            <ondown>4000</ondown>
            <align>center</align>
            <aligny>center</aligny>
            Font-Button
            <textcolor>ffffffff</textcolor>
            $ADDON[script.ftvguide 30308]
			<visible>false</visible>
        </control>

			<control type="image">
                <posx>800</posx>
                <posy>202</posy>
                <width>75</width>
                <height>75</height>
                <texture>eye.png</texture>
                <colordiffuse>PanelFG</colordiffuse>
            </control>
			<control type="image">
                <posx>800</posx>
                <posy>275</posy>
                <width>75</width>
                <height>75</height>
                <texture>stream-video.png</texture>
                <colordiffuse>PanelFG</colordiffuse>
            </control>
			<control type="image">
                <posx>800</posx>
                <posy>350</posy>
                <width>75</width>
                <height>75</height>
                <texture>bookmark-star.png</texture>
                <colordiffuse>PanelFG</colordiffuse>
            </control>
			<control type="image">
                <posx>800</posx>
                <posy>424</posy>
                <width>75</width>
                <height>75</height>
                <texture>livetv.png</texture>
                <colordiffuse>PanelFG</colordiffuse>
            </control>

    </controls>
</window>


text:
package com.tle.core.externaltools.serializer;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
import com.google.inject.Singleton;
import com.tle.beans.item.attachments.Attachment;
import com.tle.beans.item.attachments.CustomAttachment;
import com.tle.common.NameValue;
import com.tle.common.externaltools.constants.ExternalToolConstants;
import com.tle.core.externaltools.beans.ExternalToolAttachmentBean;
import com.tle.core.externaltools.service.ExternalToolsService;
import com.tle.core.guice.Bind;
import com.tle.core.item.edit.ItemEditor;
import com.tle.core.item.serializer.AbstractAttachmentSerializer;
import com.tle.web.api.item.equella.interfaces.beans.EquellaAttachmentBean;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;

@Bind
@Singleton
@SuppressWarnings("nls")
public class ExternalToolAttachmentSerializer extends AbstractAttachmentSerializer {
  @Inject private ExternalToolsService externalToolsService;

  @Override
  public EquellaAttachmentBean serialize(Attachment attachment) {
    final CustomAttachment cattach = (CustomAttachment) attachment;
    final ExternalToolAttachmentBean bean = new ExternalToolAttachmentBean();
    bean.setExternalToolProviderUuid(
        getData(cattach, ExternalToolConstants.EXTERNAL_TOOL_PROVIDER_UUID));
    bean.setLaunchUrl(getData(cattach, ExternalToolConstants.LAUNCH_URL));
    bean.setConsumerKey(getData(cattach, ExternalToolConstants.CONSUMER_KEY));
    bean.setConsumerSecret(getData(cattach, ExternalToolConstants.SHARED_SECRET));
    bean.setCustomParameters(
        externalToolsService.customParamListToString(
            (List<NameValue>) cattach.getData(ExternalToolConstants.CUSTOM_PARAMS)));
    bean.setIconUrl(getData(cattach, ExternalToolConstants.ICON_URL));
    bean.setShareUserNameDetails(getBooleanData(cattach, ExternalToolConstants.SHARE_NAME));
    bean.setShareUserEmailDetails(getBooleanData(cattach, ExternalToolConstants.SHARE_EMAIL));
    return bean;
  }

  private String getData(CustomAttachment cattach, String key) {
    return (String) cattach.getData(key);
  }

  private boolean getBooleanData(CustomAttachment cattach, String key) {
    final Boolean val = (Boolean) cattach.getData(key);
    return val == null ? false : val;
  }

  @Override
  public String deserialize(EquellaAttachmentBean bean, ItemEditor itemEditor) {
    final String uuid = bean.getUuid();
    final ExternalToolAttachmentEditor editor =
        itemEditor.getAttachmentEditor(uuid, ExternalToolAttachmentEditor.class);
    final ExternalToolAttachmentBean qbean = (ExternalToolAttachmentBean) bean;
    editStandard(editor, qbean);
    editor.editExternalToolProviderUuid(qbean.getExternalToolProviderUuid());
    editor.editLaunchUrl(qbean.getLaunchUrl());
    editor.editConsumerKey(qbean.getConsumerKey());
    editor.editConsumerSecret(qbean.getConsumerSecret());
    editor.editCustomParameters(
        externalToolsService.parseCustomParamsString(qbean.getCustomParameters()));
    editor.editIconUrl(qbean.getIconUrl());
    editor.editShareUserNameDetails(qbean.isShareUserNameDetails());
    editor.editShareUserEmailDetails(qbean.isShareUserEmailDetails());

    return uuid;
  }

  @Override
  public Map<String, Class<? extends EquellaAttachmentBean>> getAttachmentBeanTypes() {
    final Builder<String, Class<? extends EquellaAttachmentBean>> builder = ImmutableMap.builder();
    builder.put("lti", ExternalToolAttachmentBean.class);
    return builder.build();
  }

  @Override
  public boolean exportable(EquellaAttachmentBean bean) {
    return true;
  }
}


text:
<!DOCTYPE frameset SYSTEM "frameset.dtd">
<frameset>
    <note/>
    <predicate lemma="definition">
        <note/>
        <roleset framnet="" id="definition.01" name="Assigning of label or attribute" vncls="">
            <roles>
                <role descr="Definer" f="" n="0"/>
                <note/>
                <role descr="Thing Defined" f="" n="1"/>
                <role descr="Secondary attribute, described as" f="" n="2"/>
            </roles>
            <note>Corresponds with define.01. Framed by anwen april 2011</note>
            <example name="All args" src="" type="">
                <inflection aspect="ns" form="ns" person="ns" tense="ns" voice="ns"/>
                <text>Jack's definition of rockabilly as a type of country music angered Gretchen.</text>
                <note/>
                <arg f="" n="0">Jack's</arg>
                <rel f="">definition</rel>
                <arg f="" n="1">of rockabilly</arg>
                <arg f="" n="2">as a type of country music</arg>
            </example>
        </roleset>
    </predicate>
</frameset>


text:
module ZooniverseData
  module Helpers
    extend ActiveSupport::Concern

    included do
      include Base
      include Transport
      include Images
    end

    require 'zooniverse_data/helpers/base'
    require 'zooniverse_data/helpers/transport'
    require 'zooniverse_data/helpers/images'
  end
end


text:
camel-log: Demonstrates how to use logging with Camel
======================================================
Author: Fuse Team
Level: Beginner
Technologies: Camel
Summary: This quickstart shows a simple Apache Camel application that logs a message to the server log every 5th second.
Target Product: Fuse
Source: <https://github.com/jboss-fuse/quickstarts>

This example is implemented using solely the XML DSL (there is no Java code). The source code is provided in the following XML file `src/main/resources/OSGI-INF/blueprint/camel-log.xml`, which can be viewed from [github](https://github.com/fabric8io/fabric8/blob/master/quickstarts/beginner/camel-log/src/main/resources/OSGI-INF/blueprint/camel-log.xml).

This example uses a timer to trigger every 5th second, and then writes a message to the server log, as shown in the figure below:

![Camel Log diagram](https://raw.githubusercontent.com/fabric8io/fabric8/master/docs/images/camel-log-diagram.jpg)

### Building this example

The example comes as source code and pre-built binaries with the fabric8 distribution.

To try the example you do not need to build from source first. Although building from source allows you to modify the source code, and re-deploy the changes to fabric. See more details on the fabric8 website about the [developer workflow](http://fabric8.io/gitbook/developer.html).

To build from the source code:

1. Change your working directory to `quickstarts/beginner/camel-log` directory.
1. Run `mvn clean install` to build the quickstart.

After building from the source code, you can upload the changes to the fabric container:

1. It is assumed that you have already created a fabric and are logged into a container called `root`.
1. Change your working directory to `quickstarts/beginner/camel-log` directory.
1. Run `mvn fabric8:deploy` to upload the quickstart to the fabric container.

If you run the `fabric:deploy` command for the first then, it will ask you for the username and password to login the fabric container.
And then store this information in the local Maven settings file. You can find more details about this on the fabric8 website about the [Maven Plugin](http://fabric8.io/gitbook/mavenPlugin.html).

## How to run this example

The following information is divded into two sections, whether you are using the command line shell in fabric, or using the web console

### Using the command line shell

You can deploy and run this example at the console command line, as follows:

1. It is assumed that you have already created a fabric and are logged into a container called `root`.
1. Create a new child container and deploy the `quickstarts-beginner
quickstarts/beginner/-camel.log` profile in a single step, by entering the
 following command at the console:

        fabric:container-create-child --profile quickstarts-beginner
quickstarts/beginner/-camel.log root mychild

1. Wait for the new child container, `mychild`, to start up. Use the `fabric:container-list` command to check the status of the `mychild` container and wait until the `[provision status]` is shown as `success`.

### Using the web console

You can deploy and run this example from the web console, as follows

1. It is assumed that you have already created a fabric and are logged into a container called `root`.
1. Login the web console
1. Click the Wiki button in the navigation bar
1. Select `quickstarts` --> `beginner` --> `camel.log`
1. Click the `New` button in the top right corner
1. In the Create New Container page, enter `mychild` in the Container Name field, and click the *Create and start container* button

## How to try this example

The following information is divded into two sections, whether you are using the command line shell in fabric, or using the web console

### Using the command line shell

To use the application be sure to have deployed the quickstart in fabric8 as described above.

1. Log into the `mychild` container using the `fabric:container-connect` command, as follows:

        fabric:container-connect mychild

1. View the container log using the `log:tail` command as follows:

        log:tail

To exit the tail logger, press Ctrl-D. And to logout from the `mychild` container, then use the `exit` command, which returns back to the `root` container.

### Using the web console

This example comes with sample data which you can use to try this example

1. Login the web console
1. Click the Runtime button in the navigation bar
1. Select the `mychild` container in the containers list, and click the *open* button right next to the container name.
1. A new window opens and connects to the container. Click the *Log* button in the navigation bar.
1. You can also click the *Camel* button in the top navigation bar, to see information about the Camel application. For example in the Camel tree, select the Camel route `log-example-context`, and click the *Diagram* button in the sub navigation bar, to see a visual representation of the Camel route.

## Undeploy this example

The following information is divded into two sections, whether you are using the command line shell in fabric, or using the web console

### Using the command line shell

To stop and undeploy the example in fabric8:

1. Disconnect from the child container by typing Ctrl-D at the console prompt.
1. Stop and delete the child container by entering the following command at the console:

        fabric:container-stop mychild
        fabric:container-delete mychild

### Using the web console

To stop and undeploy the example in fabric8:

1. In the web console, click the *Runtime* button in the navigation bar.
1. Select the `mychild` container in the *Containers* list, and click the *Stop* button in the top right corner


text:
namespace v8 {
namespace internal {

CAST_ACCESSOR(Module)
ACCESSORS(Module, code, Object, kCodeOffset)
ACCESSORS(Module, exports, ObjectHashTable, kExportsOffset)
ACCESSORS(Module, regular_exports, FixedArray, kRegularExportsOffset)
ACCESSORS(Module, regular_imports, FixedArray, kRegularImportsOffset)
ACCESSORS(Module, module_namespace, HeapObject, kModuleNamespaceOffset)
ACCESSORS(Module, requested_modules, FixedArray, kRequestedModulesOffset)
ACCESSORS(Module, script, Script, kScriptOffset)
ACCESSORS(Module, exception, Object, kExceptionOffset)
ACCESSORS(Module, import_meta, Object, kImportMetaOffset)
SMI_ACCESSORS(Module, status, kStatusOffset)
SMI_ACCESSORS(Module, dfs_index, kDfsIndexOffset)
SMI_ACCESSORS(Module, dfs_ancestor_index, kDfsAncestorIndexOffset)
SMI_ACCESSORS(Module, hash, kHashOffset)

ModuleInfo* Module::info() const {
  if (status() >= kEvaluating) {
    return ModuleInfo::cast(code());
  }
  ScopeInfo* scope_info =
      status() == kInstantiated
          ? JSGeneratorObject::cast(code())->function()->shared()->scope_info()
          : status() == kInstantiating
                ? JSFunction::cast(code())->shared()->scope_info()
                : SharedFunctionInfo::cast(code())->scope_info();
  return scope_info->ModuleDescriptorInfo();
}

TYPE_CHECKER(JSModuleNamespace, JS_MODULE_NAMESPACE_TYPE)
CAST_ACCESSOR(JSModuleNamespace)
ACCESSORS(JSModuleNamespace, module, Module, kModuleOffset)

CAST_ACCESSOR(ModuleInfoEntry)
ACCESSORS(ModuleInfoEntry, export_name, Object, kExportNameOffset)
ACCESSORS(ModuleInfoEntry, local_name, Object, kLocalNameOffset)
ACCESSORS(ModuleInfoEntry, import_name, Object, kImportNameOffset)
SMI_ACCESSORS(ModuleInfoEntry, module_request, kModuleRequestOffset)
SMI_ACCESSORS(ModuleInfoEntry, cell_index, kCellIndexOffset)
SMI_ACCESSORS(ModuleInfoEntry, beg_pos, kBegPosOffset)
SMI_ACCESSORS(ModuleInfoEntry, end_pos, kEndPosOffset)

CAST_ACCESSOR(ModuleInfo)

bool HeapObject::IsModuleInfo() const {
  return map() == GetHeap()->module_info_map();
}

}  // namespace internal
}  // namespace v8

#include "src/objects/object-macros-undef.h"

#endif  // V8_OBJECTS_MODULE_INL_H_


text:
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

module.exports = function array_merge_recursive(arr1, arr2) {
  // eslint-disable-line camelcase
  //  discuss at: http://locutus.io/php/array_merge_recursive/
  // original by: Subhasis Deb
  //    input by: Brett Zamir (http://brett-zamir.me)
  // bugfixed by: Kevin van Zonneveld (http://kvz.io)
  //   example 1: var $arr1 = {'color': {'favorite': 'red'}, 0: 5}
  //   example 1: var $arr2 = {0: 10, 'color': {'favorite': 'green', 0: 'blue'}}
  //   example 1: array_merge_recursive($arr1, $arr2)
  //   returns 1: {'color': {'favorite': {0: 'red', 1: 'green'}, 0: 'blue'}, 1: 5, 1: 10}
  //        test: skip-1

  var arrayMerge = require('../array/array_merge');
  var idx = '';

  if (arr1 && Object.prototype.toString.call(arr1) === '[object Array]' && arr2 && Object.prototype.toString.call(arr2) === '[object Array]') {
    for (idx in arr2) {
      arr1.push(arr2[idx]);
    }
  } else if (arr1 && arr1 instanceof Object && arr2 && arr2 instanceof Object) {
    for (idx in arr2) {
      if (idx in arr1) {
        if (_typeof(arr1[idx]) === 'object' && (typeof arr2 === 'undefined' ? 'undefined' : _typeof(arr2)) === 'object') {
          arr1[idx] = arrayMerge(arr1[idx], arr2[idx]);
        } else {
          arr1[idx] = arr2[idx];
        }
      } else {
        arr1[idx] = arr2[idx];
      }
    }
  }

  return arr1;
};
//# sourceMappingURL=array_merge_recursive.js.map


text:
package ctw

import (
	"log"
	"math"
)

var nodeCount uint // ??

type symbol bool

type updateType bool

const update = updateType(true)
const revert = updateType(false)

type node struct {
	Count           uint
	LogProbWeighted float64
	logProbKT       float64
	symCount        [2]uint
	totalSymCount   uint
	parent          *node
	children        [2]*node
}

func bool2int(sym symbol) int {
	if sym {
		return 1
	}
	return 0
}

func newNode(parent *node) *node {
	return &node{
		Count:           0,
		LogProbWeighted: 0.,
		logProbKT:       0.,
		symCount:        [2]uint{0, 0},
		parent:          parent,
		children:        [2]*node{nil, nil},
	}
}

func (n *node) addChild(sym symbol) {
	n.children[bool2int(sym)] = newNode(n)
}

func (n *node) size() uint {
	var size uint
	for _, child := range n.children {
		if child == nil {
			continue
		}
		size += child.size()
	}

	return size
}

func (n *node) logKTMul(sym symbol) float64 {
	return math.Log(float64(n.symCount[bool2int(sym)])+0.5) - math.Log2(float64(n.totalSymCount)+1.0)
}

func (n *node) updateKT(sym symbol, action updateType) {
	if action == update {
		n.logProbKT += n.logKTMul(sym)
		n.symCount[bool2int(sym)]++
		n.totalSymCount++
	} else { // revert
		if n.symCount[bool2int(sym)] == 0 {
			log.Fatal("Bad news!")
		}
		n.symCount[bool2int(sym)]--
		n.logProbKT -= n.logKTMul(sym)
	}
}

func (n *node) update(sym symbol, action updateType) {
	n.updateKT(sym, action)
	logProbW0, logProbW1 := 0., 0.
	if n.children[0] != nil {
		logProbW0 = n.children[0].LogProbWeighted
	}

	if n.children[1] != nil {
		logProbW0 = n.children[1].LogProbWeighted
	}

	KTRatio := math.Exp(logProbW0 + logProbW1 - n.logProbKT)
	if KTRatio > 1.0 {
		KTRatio = math.Exp(n.logProbKT - logProbW0 - logProbW1)
		n.LogProbWeighted = logProbW0 + logProbW1
	} else {
		n.LogProbWeighted = n.logProbKT
	}

	if math.IsNaN(KTRatio) {
		KTRatio = 0.
	}
	n.LogProbWeighted += math.Log1p(KTRatio) - math.Log(2)
}

func (n *node) updateLeaf(sym symbol, action updateType) {
	n.updateKT(sym, action)
	n.LogProbWeighted = n.logProbKT
}


text:
//========================================================================
//$Id: JBossWebAppContextMBean.java 2548 2008-03-28 09:00:37Z gregw $
//Copyright 2006 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//http://www.apache.org/licenses/LICENSE-2.0
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//========================================================================

package org.jboss.jetty.management;

import javax.management.ObjectName;

import org.jboss.jetty.JBossWebAppContext;
import org.mortbay.jetty.webapp.management.WebAppContextMBean;
import org.mortbay.log.Log;

/**
 * JBossWebApplicationContextMBean
 *
 * Provides special object name for itself so that
 * we can integrate with jboss jsr77 management system.
 */
public class JBossWebAppContextMBean extends WebAppContextMBean
{
    private JBossWebAppContext _webAppContext;

    public JBossWebAppContextMBean(Object managedObject)
    {
        super(managedObject);
        _webAppContext = (JBossWebAppContext)managedObject;
    }

    public ObjectName getObjectName()
    {

        ObjectName oname = null;
        try
        {
            oname = new ObjectName(getMBeanContainer().getDomain()+":J2EEServer=none,J2EEApplication=none,J2EEWebModule="+_webAppContext.getUniqueName());
        }
        catch (Exception e)
        {
            Log.warn(e);
        }
        return oname;
    }

}


text:
#ifndef REF_H
#define REF_H

#ifndef __cplusplus
#error This is a C++ include file
#endif

/* ============================================================ include files */

#include "Exception.h"

/* ================================================================ constants */

/* =================================================================== macros */

/* =============================================================== data types */

/**
 *  Java-like object reference class.
 *  Objects used with this reference class have to be descandents
 *  of class Referable.
 *
 *  sample usage:
 *
 *  <pre>
 *  #include "Ref.h"
 *  #include "Referable.h"
 *
 *  class  A : public virtual Referable;
 *
 *  ...
 *
 *  A        * a = new A();
 *  Ref<A>     ref1 = a;       // 1 reference to a
 *  Ref<A>     ref2 = ref1;    // 2 references to a
 *
 *  ref1 = 0;      // 1 reference to a
 *  ref2 = 0;      // at this point object a is destroyed
 *  </pre>
 *
 *  Based on Tima Saarinen's work,
 *  http://gamma.nic.fi/~timosa/comp/refcount.html
 *
 *  @ref Referable
 *
 *  @author  $Author: rafael@riseup.net $
 *  @version $Revision: 553 $
 */
template <class T>
class Ref
{
    private:

        /**
         *  The object referenced by this Ref.
         *  Must be a descandant of Referable.
         */
        T* object;

    protected:

    public:

        /**
         *  Default constructor.
         */
        inline
        Ref ( void )                            throw ()
        {
            object = NULL;
        }

        /**
         *  Copy constructor.
         *
         *  @param other the Ref to copy.
         *  @exception Exception
         */
        inline
        Ref ( const Ref<T> &    other )         throw ( Exception )
        {
            object = NULL;
            set( other.object);
        }

        /**
         *  Constructor based on an object to reference.
         *
         *  @param obj the object to reference.
         *  @exception Exception
         */
        inline
        Ref ( T   * obj )                       throw ( Exception )
        {
            object = obj;
            obj->increaseReferenceCount();
        }

        /**
         *  Destructor.
         *
         *  @exception Exception
         */
        inline virtual
        ~Ref ( void )                           throw ( Exception )
        {
            set( 0 );
        }

        /**
         *  Operator overload to make the reference seem like a pointer.
         *
         *  @return the pointer to the object referenced.
         */
        inline T*
        operator->() const                      throw ( Exception )
        {
            if ( !object ) {
                throw Exception( __FILE__, __LINE__,
                                 "reference to NULL object");
            }
            return object;
        }

        /**
         *  Assignment operator.
         *
         *  @param other the Ref to assign to this one.
         *  @return a reference to this Ref.
         *  @exception Exception
         */
        inline Ref<T> &
        operator= ( Ref<T>  other )             throw ( Exception )
        {
            set( other.object);
            return *this;
        }

        /**
         *  Assignment operator.
         *
         *  @param obj pointer to the object to assign to this Ref.
         *  @return a reference to this Ref.
         *  @exception Exception
         */
        inline Ref<T> &
        operator= ( T*  obj )                   throw ( Exception )
        {
            set( obj);
            return *this;
        }

        /**
         *  Set the object referenced.
         *  Deletes the old referenced object is this was it's last reference.
         *
         *  @param newobj pointer to the object to reference by this Ref.
         *  @exception Exception
         */
        inline void
        set ( T   * newobj )                    throw ( Exception )
        {
            // If equal do nothing
            if ( newobj == object ) {
                return;
            }

            // Increase reference count
            if ( newobj ) {
                newobj->increaseReferenceCount();
            }

            // Decrease the reference count of the old referable
            if ( object ) {
                if ( object->decreaseReferenceCount() == 0 ) {
                    delete object;
                }
            }

            // Assign
            object = newobj;
        }

        /**
         *  Return object pointer. This method should be used with
         *  care because it breaks the encapsulation.
         *  Typically this method is needed for the method calls
         *  which require literal object pointer.
         *
         *  It may not be bad idea to pass the Ref
         *  objects as method arguments.
         *
         *  @return Object pointer or NULL.
         */
        inline T*
        get ( void ) const                      throw ()
        {
            return object;
        }

        /**
         *  Equality operator.
         *
         *  @param other the pointer to compare this with.
         *  @return true is this Ref refers to the same object as other,
         *          false otherwise.
         */
        inline bool
        operator== ( const T        * other ) const     throw ()
        {
            return object == other;
        }

        /**
         *  Equality operator.
         *
         *  @param other the Ref to compare this with.
         *  @return true is the two Refs refer to the same object,
         *          false otherwise.
         */
        inline bool
        operator== ( const Ref<T> &   other ) const     throw ()
        {
            return object == other.object;
        }

        /**
         *  Unequality operator.
         *
         *  @param other the pointer to compare this with.
         *  @return false is this Ref refers to a different object then other,
         *          true otherwise.
         */
        inline bool
        operator!= ( const T        * other ) const     throw ()
        {
            return object != other;
        }

        /**
         *  Unequality operator.
         *
         *  @param other the Ref to compare this with.
         *  @return false is the two Refs refer to the same object,
         *          true otherwise.
         */
        inline bool
        operator!= ( const Ref<T> &   other ) const     throw ()
        {
            return object != other.object;
        }
};

/* ================================================= external data structures */

/* ====================================================== function prototypes */

#endif  /* REF_H */


text:
#import "EC2DeleteKeyPairRequest.h"

@implementation EC2DeleteKeyPairRequest

@synthesize keyName;

-(id)init
{
    if (self = [super init]) {
        keyName = nil;
    }

    return self;
}

-(id)initWithKeyName:(NSString *)theKeyName
{
    if (self = [self init]) {
        self.keyName = theKeyName;
    }

    return self;
}

-(NSString *)description
{
    NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:256];

    [buffer appendString:@"{"];
    [buffer appendString:[[[NSString alloc] initWithFormat:@"KeyName: %@,", keyName] autorelease]];
    [buffer appendString:[super description]];
    [buffer appendString:@"}"];

    return [buffer autorelease];
}

-(void)dealloc
{
    [keyName release];

    [super dealloc];
}

@end


text:
import { RawServerBase, RawServerDefault, RawReplyDefaultExpression, RawRequestDefaultExpression } from './utils'
import * as http from 'http'
import * as https from 'https'
import * as http2 from 'http2'

export interface FastifyServerFactory<
  RawServer extends RawServerBase = RawServerDefault
> {
  (handler: FastifyServerFactoryHandler<RawServer>, opts: object): RawServer;
}

export type FastifyServerFactoryHandler<
  RawServer extends RawServerBase = RawServerDefault,
  RawRequest extends RawRequestDefaultExpression<RawServer> = RawRequestDefaultExpression<RawServer>,
  RawReply extends RawReplyDefaultExpression<RawServer> = RawReplyDefaultExpression<RawServer>
> =
  RawServer extends http.Server | https.Server ?
    (request: http.IncomingMessage & RawRequest, response: http.ServerResponse & RawReply) => void :
    (request: http2.Http2ServerRequest & RawRequest, response: http2.Http2ServerResponse & RawReply) => void


text:
# ==========================================
#   Unity Project - A Test Framework for C
#   Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
#   [Released under MIT License. Please refer to license.txt for details]
# ==========================================

$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))

class UnityTestRunnerGenerator

  def initialize(options = nil)
    @options = UnityTestRunnerGenerator.default_options
    case(options)
      when NilClass then @options
      when String   then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
      when Hash     then @options.merge!(options)
      else          raise "If you specify arguments, it should be a filename or a hash of options"
    end
    require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
  end

  def self.default_options
    {
      :includes         => [],
      :defines          => [],
      :plugins          => [],
      :framework        => :unity,
      :test_prefix      => "test|spec|should",
      :setup_name       => "setUp",
      :teardown_name    => "tearDown",
      :main_name        => "main", #set to :auto to automatically generate each time
      :main_export_decl => "",
      :cmdline_args     => false,
      :use_param_tests  => false,
    }
  end

  def self.grab_config(config_file)
    options = self.default_options
    unless (config_file.nil? or config_file.empty?)
      require 'yaml'
      yaml_guts = YAML.load_file(config_file)
      options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
      raise "No :unity or :cmock section found in #{config_file}" unless options
    end
    return(options)
  end

  def run(input_file, output_file, options=nil)
    tests = []
    testfile_includes = []
    used_mocks = []

    @options.merge!(options) unless options.nil?
    module_name = File.basename(input_file)

    #pull required data from source file
    source = File.read(input_file)
    source = source.force_encoding("ISO-8859-1").encode("utf-8", :replace => nil) if ($QUICK_RUBY_VERSION > 10900)
    tests               = find_tests(source)
    headers             = find_includes(source)
    testfile_includes   = (headers[:local] + headers[:system])
    used_mocks          = find_mocks(testfile_includes)
    testfile_includes   = (testfile_includes - used_mocks)
    testfile_includes.delete_if{|inc| inc =~ /(unity|cmock)/}

    #build runner file
    generate(input_file, output_file, tests, used_mocks, testfile_includes)

    #determine which files were used to return them
    all_files_used = [input_file, output_file]
    all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
    all_files_used += @options[:includes] unless @options[:includes].empty?
    return all_files_used.uniq
  end

  def generate(input_file, output_file, tests, used_mocks, testfile_includes)
    File.open(output_file, 'w') do |output|
      create_header(output, used_mocks, testfile_includes)
      create_externs(output, tests, used_mocks)
      create_mock_management(output, used_mocks)
      create_suite_setup_and_teardown(output)
      create_reset(output, used_mocks)
      create_main(output, input_file, tests, used_mocks)
    end

    if (@options[:header_file] && !@options[:header_file].empty?)
      File.open(@options[:header_file], 'w') do |output|
        create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)
      end
    end
  end

  def find_tests(source)
    tests_and_line_numbers = []

    source_scrubbed = source.clone
    source_scrubbed = source_scrubbed.gsub(/"[^"\n]*"/, '')      # remove things in strings
    source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '')      # remove line comments
    source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
    lines = source_scrubbed.split(/(^\s*\#.*$)                 # Treat preprocessor directives as a logical line
                              | (;|\{|\}) /x)                  # Match ;, {, and } as end of lines

    lines.each_with_index do |line, index|
      #find tests
      if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/
        arguments = $1
        name = $2
        call = $3
        params = $4
        args = nil
        if (@options[:use_param_tests] and !arguments.empty?)
          args = []
          arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]}
        end
        tests_and_line_numbers << { :test => name, :args => args, :call => call, :params => params, :line_number => 0 }
      end
    end
    tests_and_line_numbers.uniq! {|v| v[:test] }

    #determine line numbers and create tests to run
    source_lines = source.split("\n")
    source_index = 0;
    tests_and_line_numbers.size.times do |i|
      source_lines[source_index..-1].each_with_index do |line, index|
        if (line =~ /#{tests_and_line_numbers[i][:test]}/)
          source_index += index
          tests_and_line_numbers[i][:line_number] = source_index + 1
          break
        end
      end
    end

    return tests_and_line_numbers
  end

  def find_includes(source)

    #remove comments (block and line, in three steps to ensure correct precedence)
    source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '')  # remove line comments that comment out the start of blocks
    source.gsub!(/\/\*.*?\*\//m, '')                     # remove block comments
    source.gsub!(/\/\/.*$/, '')                          # remove line comments (all that remain)

    #parse out includes
    includes = {
      :local => source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten,
      :system => source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" }
    }
    return includes
  end

  def find_mocks(includes)
    mock_headers = []
    includes.each do |include_path|
      include_file = File.basename(include_path)
      mock_headers << include_path if (include_file =~ /^mock/i)
    end
    return mock_headers
  end

  def create_header(output, mocks, testfile_includes=[])
    output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
    create_runtest(output, mocks)
    output.puts("\n/*=======Automagically Detected Files To Include=====*/")
    output.puts("#include \"#{@options[:framework].to_s}.h\"")
    output.puts('#include "cmock.h"') unless (mocks.empty?)
    output.puts('#include <setjmp.h>')
    output.puts('#include <stdio.h>')
    output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
    if (@options[:defines] && !@options[:defines].empty?)
      @options[:defines].each {|d| output.puts("#define #{d}")}
    end
    if (@options[:header_file] && !@options[:header_file].empty?)
      output.puts("#include \"#{File.basename(@options[:header_file])}\"")
    else
      @options[:includes].flatten.uniq.compact.each do |inc|
        output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
      end
      testfile_includes.each do |inc|
        output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
      end
    end
    mocks.each do |mock|
      output.puts("#include \"#{mock.gsub('.h','')}.h\"")
    end
    if @options[:enforce_strict_ordering]
      output.puts('')
      output.puts('int GlobalExpectCount;')
      output.puts('int GlobalVerifyOrder;')
      output.puts('char* GlobalOrderError;')
    end
  end

  def create_externs(output, tests, mocks)
    output.puts("\n/*=======External Functions This Runner Calls=====*/")
    output.puts("extern void #{@options[:setup_name]}(void);")
    output.puts("extern void #{@options[:teardown_name]}(void);")
    tests.each do |test|
      output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
    end
    output.puts('')
  end

  def create_mock_management(output, mock_headers)
    unless (mock_headers.empty?)
      output.puts("\n/*=======Mock Management=====*/")
      output.puts("static void CMock_Init(void)")
      output.puts("{")
      if @options[:enforce_strict_ordering]
        output.puts("  GlobalExpectCount = 0;")
        output.puts("  GlobalVerifyOrder = 0;")
        output.puts("  GlobalOrderError = NULL;")
      end
      mocks = mock_headers.map {|mock| File.basename(mock)}
      mocks.each do |mock|
        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
        output.puts("  #{mock_clean}_Init();")
      end
      output.puts("}\n")

      output.puts("static void CMock_Verify(void)")
      output.puts("{")
      mocks.each do |mock|
        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
        output.puts("  #{mock_clean}_Verify();")
      end
      output.puts("}\n")

      output.puts("static void CMock_Destroy(void)")
      output.puts("{")
      mocks.each do |mock|
        mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
        output.puts("  #{mock_clean}_Destroy();")
      end
      output.puts("}\n")
    end
  end

  def create_suite_setup_and_teardown(output)
    unless (@options[:suite_setup].nil?)
      output.puts("\n/*=======Suite Setup=====*/")
      output.puts("static void suite_setup(void)")
      output.puts("{")
      output.puts(@options[:suite_setup])
      output.puts("}")
    end
    unless (@options[:suite_teardown].nil?)
      output.puts("\n/*=======Suite Teardown=====*/")
      output.puts("static int suite_teardown(int num_failures)")
      output.puts("{")
      output.puts(@options[:suite_teardown])
      output.puts("}")
    end
  end

  def create_runtest(output, used_mocks)
    cexception = @options[:plugins].include? :cexception
    va_args1   = @options[:use_param_tests] ? ', ...' : ''
    va_args2   = @options[:use_param_tests] ? '__VA_ARGS__' : ''
    output.puts("\n/*=======Test Runner Used To Run Each Test Below=====*/")
    output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
    output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
    output.puts("{ \\")
    output.puts("  Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
    output.puts("  Unity.CurrentTestLineNumber = TestLineNum; \\")
    output.puts("  if (UnityTestMatches()) { \\") if (@options[:cmdline_args])
    output.puts("  Unity.NumberOfTests++; \\")
    output.puts("  CMock_Init(); \\") unless (used_mocks.empty?)
    output.puts("  UNITY_CLR_DETAILS(); \\") unless (used_mocks.empty?)
    output.puts("  if (TEST_PROTECT()) \\")
    output.puts("  { \\")
    output.puts("    CEXCEPTION_T e; \\") if cexception
    output.puts("    Try { \\") if cexception
    output.puts("      #{@options[:setup_name]}(); \\")
    output.puts("      TestFunc(#{va_args2}); \\")
    output.puts("    } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
    output.puts("  } \\")
    output.puts("  if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
    output.puts("  { \\")
    output.puts("    #{@options[:teardown_name]}(); \\")
    output.puts("    CMock_Verify(); \\") unless (used_mocks.empty?)
    output.puts("  } \\")
    output.puts("  CMock_Destroy(); \\") unless (used_mocks.empty?)
    output.puts("  UnityConcludeTest(); \\")
    output.puts("  } \\")  if (@options[:cmdline_args])
    output.puts("}\n")
  end

  def create_reset(output, used_mocks)
    output.puts("\n/*=======Test Reset Option=====*/")
    output.puts("void resetTest(void);")
    output.puts("void resetTest(void)")
    output.puts("{")
    output.puts("  CMock_Verify();") unless (used_mocks.empty?)
    output.puts("  CMock_Destroy();") unless (used_mocks.empty?)
    output.puts("  #{@options[:teardown_name]}();")
    output.puts("  CMock_Init();") unless (used_mocks.empty?)
    output.puts("  #{@options[:setup_name]}();")
    output.puts("}")
  end

  def create_main(output, filename, tests, used_mocks)
    output.puts("\n\n/*=======MAIN=====*/")
    main_name = (@options[:main_name].to_sym == :auto) ? "main_#{filename.gsub('.c','')}" : "#{@options[:main_name]}"
    if (@options[:cmdline_args])
      if (main_name != "main")
        output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);")
      end
      output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)")
      output.puts("{")
      output.puts("  int parse_status = UnityParseOptions(argc, argv);")
      output.puts("  if (parse_status != 0)")
      output.puts("  {")
      output.puts("    if (parse_status < 0)")
      output.puts("    {")
      output.puts("      UnityPrint(\"#{filename.gsub('.c','')}.\");")
      output.puts("      UNITY_PRINT_EOL();")
      if (@options[:use_param_tests])
        tests.each do |test|
          if ((test[:args].nil?) or (test[:args].empty?))
            output.puts("      UnityPrint(\"  #{test[:test]}(RUN_TEST_NO_ARGS)\");")
            output.puts("      UNITY_PRINT_EOL();")
          else
            test[:args].each do |args|
              output.puts("      UnityPrint(\"  #{test[:test]}(#{args})\");")
              output.puts("      UNITY_PRINT_EOL();")
            end
          end
        end
      else
        tests.each { |test| output.puts("      UnityPrint(\"  #{test[:test]}\");\n    UNITY_PRINT_EOL();")}
      end
      output.puts("    return 0;")
      output.puts("    }")
      output.puts("  return parse_status;")
      output.puts("  }")
    else
      if (main_name != "main")
        output.puts("#{@options[:main_export_decl]} int #{main_name}(void);")
      end
      output.puts("int #{main_name}(void)")
      output.puts("{")
    end
    output.puts("  suite_setup();") unless @options[:suite_setup].nil?
    output.puts("  UnityBegin(\"#{filename.gsub(/\\/,'\\\\\\')}\");")
    if (@options[:use_param_tests])
      tests.each do |test|
        if ((test[:args].nil?) or (test[:args].empty?))
          output.puts("  RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
        else
          test[:args].each {|args| output.puts("  RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")}
        end
      end
    else
        tests.each { |test| output.puts("  RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
    end
    output.puts()
    output.puts("  CMock_Guts_MemFreeFinal();") unless used_mocks.empty?
    output.puts("  return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());")
    output.puts("}")
  end

  def create_h_file(output, filename, tests, testfile_includes, used_mocks)
    filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/, "_").upcase
    output.puts("/* AUTOGENERATED FILE. DO NOT EDIT. */")
    output.puts("#ifndef _#{filename}")
    output.puts("#define _#{filename}\n\n")
    output.puts("#include \"#{@options[:framework].to_s}.h\"")
    output.puts('#include "cmock.h"') unless (used_mocks.empty?)
    @options[:includes].flatten.uniq.compact.each do |inc|
      output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
    end
    testfile_includes.each do |inc|
      output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
    end
    output.puts "\n"
    tests.each do |test|
      if ((test[:params].nil?) or (test[:params].empty?))
        output.puts("void #{test[:test]}(void);")
      else
        output.puts("void #{test[:test]}(#{test[:params]});")
      end
    end
    output.puts("#endif\n\n")
  end
end

if ($0 == __FILE__)
  options = { :includes => [] }
  yaml_file = nil

  #parse out all the options first (these will all be removed as we go)
  ARGV.reject! do |arg|
    case(arg)
      when '-cexception'
        options[:plugins] = [:cexception]; true
      when /\.*\.ya?ml/
        options = UnityTestRunnerGenerator.grab_config(arg); true
      when /--(\w+)=\"?(.*)\"?/
        options[$1.to_sym] = $2; true
      when /\.*\.h/
        options[:includes] << arg; true
      else false
    end
  end

  #make sure there is at least one parameter left (the input file)
  if !ARGV[0]
    puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)",
           "\n  input_test_file         - this is the C file you want to create a runner for",
           "  output                  - this is the name of the runner file to generate",
           "                            defaults to (input_test_file)_Runner",
           "  files:",
           "    *.yml / *.yaml        - loads configuration from here in :unity or :cmock",
           "    *.h                   - header files are added as #includes in runner",
           "  options:",
           "    -cexception           - include cexception support",
           "    --setup_name=\"\"       - redefine setUp func name to something else",
           "    --teardown_name=\"\"    - redefine tearDown func name to something else",
           "    --main_name=\"\"        - redefine main func name to something else",
           "    --test_prefix=\"\"      - redefine test prefix from default test|spec|should",
           "    --suite_setup=\"\"      - code to execute for setup of entire suite",
           "    --suite_teardown=\"\"   - code to execute for teardown of entire suite",
           "    --use_param_tests=1   - enable parameterized tests (disabled by default)",
           "    --header_file=\"\"      - path/name of test header file to generate too"
          ].join("\n")
    exit 1
  end

  #create the default test runner name if not specified
  ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1])

  UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
end


text:
package com.stickycoding.rokon.device;

import com.stickycoding.rokon.Rokon;

import android.content.Context;

/**
 * Vibrate.java
 * A helper class for vibrating the device
 *
 * REMEMBER TO ADD THE RIGHT PERMISSIONS TO AndroidManifest.xml *
 * <uses-permission android:name="android.permission.VIBRATE" ></uses-permission>
 *
 * Take care when using import, the name clashes with android.os.Vibrator (yeah, I know.)
 *
 * @author Richard
 */

public class Vibrator {

	protected static android.os.Vibrator vibrator;
	protected static boolean enabled = true;

	/**
	 * Enables the Vibrator to work (this is on by default)
	 */
	public static void enable() {
		enabled = true;
	}

	/**
	 * Prevents the Vibrator from vibrating
	 */
	public static void disable() {
		enabled = false;
	}

	private static void prepareVibrator() {
		if(vibrator != null) return;
		vibrator = (android.os.Vibrator) Rokon.getActivity().getSystemService(Context.VIBRATOR_SERVICE);

	}

	/**
	 * Vibrates the phone for a given time
	 *
	 * @param time in milliseconds
	 */
	public static void vibrate(long time) {
		if(!enabled) return;
		prepareVibrator();
		vibrator.vibrate(time);
	}

	/**
	 * Vibrates the phone with a given pattern
	 * Pass in an array of ints that are the times at which to turn on or off the vibrator. The first one is how long to wait before turning it on, and then after that it alternates. If you want to repeat, pass the index into the pattern at which to start the repeat.
	 *
	 * @param pattern an array of longs of times to turn the vibrator on or off
	 * @param repeat the index into pattern at which to repeat, or -1 if you don't want to repeat
	 */
	public static void vibrate(long[] pattern, int repeat) {
		if(!enabled) return;
		prepareVibrator();
		vibrator.vibrate(pattern, repeat);
	}

}


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>

    <groupId>WindowSnap</groupId>
    <artifactId>com.snap4j</artifactId>
    <version>1.2-SNAPSHOT</version>

    <properties>
        <jdk.version>1.7</jdk.version>
    </properties>

    <scm>
        <developerConnection>scm:git:https://github.com/topalavlad/Snap4J.git</developerConnection>
        <tag>v1.0</tag>
    </scm>

    <build>
        <finalName>Snap4J</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.snap4j.demo.Snap4JDemo</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>