text:
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//

// Preprocessed version of "boost/mpl/aux_/iter_fold_impl.hpp" header
// -- DO NOT modify by hand!

namespace boost { namespace mpl { namespace aux {

/// forward declaration

template<
      int N
    , typename First
    , typename Last
    , typename State
    , typename ForwardOp
    >
struct iter_fold_impl;

template< int N >
struct iter_fold_chunk;

template<> struct iter_fold_chunk<0>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State state0;
        typedef state0 state;
        typedef iter0 iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template<> struct iter_fold_chunk<1>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State state0;
        typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
        typedef typename mpl::next<iter0>::type iter1;

        typedef state1 state;
        typedef iter1 iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template<> struct iter_fold_chunk<2>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State state0;
        typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
        typedef typename mpl::next<iter0>::type iter1;
        typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
        typedef typename mpl::next<iter1>::type iter2;

        typedef state2 state;
        typedef iter2 iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template<> struct iter_fold_chunk<3>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State state0;
        typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
        typedef typename mpl::next<iter0>::type iter1;
        typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
        typedef typename mpl::next<iter1>::type iter2;
        typedef typename apply2< ForwardOp,state2,iter2 >::type state3;
        typedef typename mpl::next<iter2>::type iter3;

        typedef state3 state;
        typedef iter3 iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template<> struct iter_fold_chunk<4>
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef First iter0;
        typedef State state0;
        typedef typename apply2< ForwardOp,state0,iter0 >::type state1;
        typedef typename mpl::next<iter0>::type iter1;
        typedef typename apply2< ForwardOp,state1,iter1 >::type state2;
        typedef typename mpl::next<iter1>::type iter2;
        typedef typename apply2< ForwardOp,state2,iter2 >::type state3;
        typedef typename mpl::next<iter2>::type iter3;
        typedef typename apply2< ForwardOp,state3,iter3 >::type state4;
        typedef typename mpl::next<iter3>::type iter4;

        typedef state4 state;
        typedef iter4 iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template< int N >
struct iter_fold_chunk
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef iter_fold_impl<
              4
            , First
            , Last
            , State
            , ForwardOp
            > chunk_;

        typedef iter_fold_impl<
              ( (N - 4) < 0 ? 0 : N - 4 )
            , typename chunk_::iterator
            , Last
            , typename chunk_::state
            , ForwardOp
            > res_;

        typedef typename res_::state state;
        typedef typename res_::iterator iterator;
    };
};

template<
      typename First
    , typename Last
    , typename State
    , typename ForwardOp
    >
struct iter_fold_step;

template<
      typename Last
    , typename State
    >
struct iter_fold_null_step
{
    typedef Last iterator;
    typedef State state;
};

template<>
struct iter_fold_chunk< -1 >
{
    template<
          typename First
        , typename Last
        , typename State
        , typename ForwardOp
        >
    struct result_
    {
        typedef typename if_<
              typename is_same< First,Last >::type
            , iter_fold_null_step< Last,State >
            , iter_fold_step< First,Last,State,ForwardOp >
            >::type res_;

        typedef typename res_::state state;
        typedef typename res_::iterator iterator;
    };

    /// ETI workaround
    template<> struct result_< int,int,int,int >
    {
        typedef int state;
        typedef int iterator;
    };

};

template<
      typename First
    , typename Last
    , typename State
    , typename ForwardOp
    >
struct iter_fold_step
{
    typedef iter_fold_chunk< -1 >::template result_<
          typename mpl::next<First>::type
        , Last
        , typename apply2< ForwardOp,State,First >::type
        , ForwardOp
        > chunk_;

    typedef typename chunk_::state state;
    typedef typename chunk_::iterator iterator;
};

template<
      int N
    , typename First
    , typename Last
    , typename State
    , typename ForwardOp
    >
struct iter_fold_impl
    : iter_fold_chunk<N>
        ::template result_< First,Last,State,ForwardOp >
{
};

}}}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.0
// See https://javaee.github.io/jaxb-v2/
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2022.06.28 at 02:49:33 PM PDT
//

package com.intuit.ipp.data;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ItemTypeEnum.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="ItemTypeEnum">
 *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
 *     <enumeration value="Assembly"/>
 *     <enumeration value="Category"/>
 *     <enumeration value="Fixed Asset"/>
 *     <enumeration value="Group"/>
 *     <enumeration value="Inventory"/>
 *     <enumeration value="NonInventory"/>
 *     <enumeration value="Other Charge"/>
 *     <enumeration value="Payment"/>
 *     <enumeration value="Service"/>
 *     <enumeration value="Subtotal"/>
 *     <enumeration value="Discount"/>
 *     <enumeration value="Tax"/>
 *     <enumeration value="Tax Group"/>
 *     <enumeration value="Bundle"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "ItemTypeEnum")
@XmlEnum
public enum ItemTypeEnum {

    @XmlEnumValue("Assembly")
    ASSEMBLY("Assembly"),
    @XmlEnumValue("Category")
    CATEGORY("Category"),
    @XmlEnumValue("Fixed Asset")
    FIXED_ASSET("Fixed Asset"),
    @XmlEnumValue("Group")
    GROUP("Group"),
    @XmlEnumValue("Inventory")
    INVENTORY("Inventory"),
    @XmlEnumValue("NonInventory")
    NON_INVENTORY("NonInventory"),
    @XmlEnumValue("Other Charge")
    OTHER_CHARGE("Other Charge"),
    @XmlEnumValue("Payment")
    PAYMENT("Payment"),
    @XmlEnumValue("Service")
    SERVICE("Service"),
    @XmlEnumValue("Subtotal")
    SUBTOTAL("Subtotal"),
    @XmlEnumValue("Discount")
    DISCOUNT("Discount"),
    @XmlEnumValue("Tax")
    TAX("Tax"),
    @XmlEnumValue("Tax Group")
    TAX_GROUP("Tax Group"),
    @XmlEnumValue("Bundle")
    BUNDLE("Bundle");
    private final String value;

    ItemTypeEnum(String v) {
        value = v;
    }

    public String value() {
        return value;
    }

    public static ItemTypeEnum fromValue(String v) {
        for (ItemTypeEnum c: ItemTypeEnum.values()) {
            if (c.value.equals(v)) {
                return c;
            }
        }
        throw new IllegalArgumentException(v);
    }

}

redpajama_set_name: RedPajamaGithub


text:
package com.alorma.github.ui.fragment.content;

import com.alorma.github.Base64;
import java.io.UnsupportedEncodingException;
import rx.Observable;

public class GithubFileDecoder {
  private String encoded;

  public GithubFileDecoder(String encoded) {
    this.encoded = encoded;
  }

  public Observable<String> decode() {
    return Observable.defer(() -> {
      try {
        return Observable.just(Base64.decode(encoded));
      } catch (Exception e) {
        return Observable.error(e);
      }
    }).flatMap(bytes -> {
      try {
        return Observable.just(new String(bytes, "UTF-8"));
      } catch (UnsupportedEncodingException e) {
        return Observable.error(e);
      }
    });
  }
}


text:
"""Example of dynamic use of Google Visualization Python API."""

__author__ = "Misha Seltzer"

import gviz_api

description = {"name": ("string", "Name"),
               "salary": ("number", "Salary"),
               "full_time": ("boolean", "Full Time Employee")}
data = [{"name": "Mike", "salary": (10000, "$10,000"), "full_time": True},
        {"name": "Jim", "salary": (800, "$800"), "full_time": False},
        {"name": "Alice", "salary": (12500, "$12,500"), "full_time": True},
        {"name": "Bob", "salary": (7000, "$7,000"), "full_time": True}]

data_table = gviz_api.DataTable(description)
data_table.LoadData(data)
print("Content-type: text/plain")
print()
print(data_table.ToJSonResponse(columns_order=("name", "salary", "full_time"),
                                order_by="salary"))

# Put the url (http://google-visualization.appspot.com/python/dynamic_example)
# as your Google Visualization data source.


text:
#include "backup.h"
#include "carpetdb.h"

#include <sys/types.h>
#include <utime.h>

#include <QtCore/QCryptographicHash>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QMimeDatabase>
#include <QtCore/QMutexLocker>
#include <QtCore/QProcess>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>

#include <silkconfig.h>

#include "backupjob.h"
#include "updatestatisticsjob.h"
#include "addexcludepatternjob.h"
#include "removeexcludepatternjob.h"

class Backup::Private : public QObject
{
    Q_OBJECT
public:
    Private(Backup *parent);
    QVariantMap contents(const QString &path, const QString &backup) const;
    QVariantMap diff(const QString &path, const QString &backup) const;
    QVariantList tree(const QString &path = QString()) const;
    QVariantList excludePatterns() const;

    bool exec(const QString &sql) const;
    bool exec(QSqlQuery &query) const;

public slots:
    void backup(const QString &name);
    bool restore(int fileTreeId, const QString &to, const QString &path = QString());
    void addExcludePattern(const QString &pattern, bool entireDirectory);
    void removeExcludePattern(const QString &id, const QString &pattern);

signals:
    void done(bool ok, const QString &errorMessage);

private slots:
    void finished();
    void error(const QString &errorMessage);
    void slotDone(bool ok, const QString &errorMessage) {
        qDebug() << Q_FUNC_INFO << __LINE__ << ok << errorMessage;
    }

private:
    void setupDatabase();
    bool createTables();

    QString getFullPath(int fileId) const;
    QVariantMap fileInfo(int fileId) const;

private:
    Backup *q;
    QMimeDatabase mimeDatabase;
public:
    Status status;
    QList<AbstractCarpetJob *> jobQueue;
    QSqlDatabase db;
    QString from;
    QString to;
};

Backup::Private::Private(Backup *parent)
    : q(parent)
    , status(Backup::Waiting)
    , from(SilkConfig::value("carpet.from").toString())
    , to(SilkConfig::value("carpet.to").toString())
{
    connect(this, SIGNAL(done(bool,QString)), this, SLOT(slotDone(bool,QString)));
    setupDatabase();
}

void Backup::Private::setupDatabase()
{
    qDebug() << Q_FUNC_INFO << __LINE__;
    QMutexLocker locker(&CarpetDB::mutex());
    qDebug() << Q_FUNC_INFO << __LINE__;
    db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), QLatin1String("carpet"));
    db.setDatabaseName(QString("%1/carpet.sqlite").arg(to));
    if (db.open()) {
        if (db.transaction()) {
            if (createTables()) {
                if (!db.commit()) db.rollback();
            } else {
                db.rollback();
            }
        }
    } else {
        qWarning() << Q_FUNC_INFO << __LINE__ << db.lastError().text();
    }
}

bool Backup::Private::createTables()
{
    {
        QString sql = "CREATE TABLE IF NOT EXISTS Settings ("
                "key TEXT UNIQUE NOT NULL"
                ", value TEXT)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE TABLE IF NOT EXISTS Backup ("
                "backupID INTEGER PRIMARY KEY AUTOINCREMENT"
                ", backupDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP"
                ", seconds INTEGER DEFAULT -1"
                ", annotation TEXT)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE TABLE IF NOT EXISTS File ("
                "fileID INTEGER PRIMARY KEY AUTOINCREMENT"
                ", directoryID INTEGER"
                ", fileName TEXT NOT NULL"
                ")";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE INDEX IF NOT EXISTS File_directoryID ON File (directoryID)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE TABLE IF NOT EXISTS FileTree ("
                "fileTreeID INTEGER PRIMARY KEY AUTOINCREMENT"
                ", backupID INTEGER NOT NULL"
                ", fileID INTEGER NOT NULL)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE INDEX IF NOT EXISTS FileTree_backupID ON FileTree (backupID)";
        if (!exec(sql)) {
            return false;
        }
    }

    {
        QString sql = "CREATE INDEX IF NOT EXISTS FileTree_FileID ON FileTree (fileID)";
        if (!exec(sql)) {
            return false;
        }
    }

    {
        QString sql = "CREATE TABLE IF NOT EXISTS MimeType ("
                "mimeTypeID INTEGER PRIMARY KEY AUTOINCREMENT"
                ", mimeTypeName TEXT NOT NULL UNIQUE)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE TABLE IF NOT EXISTS BackupData ("
                "fileTreeID INTEGER NOT NULL UNIQUE"
                ", size INTEGER"
                ", mimeTypeID INTEGER NOT NULL"
                ", symlinkID INTEGER"
                ", hash TEXT"
                ", permissions INTEGER"
                ", uID INTEGER"
                ", gID INTEGER"
                ", cTime TIMESTAMP"
                ", mTime TIMESTAMP"
                ", aTime TIMESTAMP)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE INDEX IF NOT EXISTS BackupData_mimeTypeID ON BackupData (mimeTypeID)";
        if (!exec(sql)) return false;
    }

    {
        QString sql = "CREATE INDEX IF NOT EXISTS BackupData_fileTreeID ON BackupData (fileTreeID)";
        if (!exec(sql)) return false;
    }

    {
        QSqlQuery query(db);
        query.prepare("CREATE TABLE IF NOT EXISTS ExcludePatterns ("
                      "excludePatternID INTEGER PRIMARY KEY AUTOINCREMENT"
                      ", pattern TEXT NOT NULL UNIQUE"
                      ", entireDirectoryIfExists BOOLEAN NOT NULL DEFAULT 0"
                      ")");
        if (!exec(query)) return false;
    }

    {
        QSqlQuery query(db);
        query.prepare("CREATE TABLE IF NOT EXISTS RecentlyChanged ("
                      "sequence INTEGER NOT NULL UNIQUE"
                      ", fileID INTEGER NOT NULL UNIQUE"
                      ")");
        if (!exec(query)) return false;
    }

    {
        QSqlQuery query(db);
        query.prepare("CREATE TABLE IF NOT EXISTS FrequentlyChanged ("
                      "sequence INTEGER NOT NULL UNIQUE"
                      ", fileID INTEGER NOT NULL UNIQUE"
                      ")");
        if (!exec(query)) return false;
    }

    {
        QSqlQuery query(db);
        query.prepare("CREATE TABLE IF NOT EXISTS SizeConsumed ("
                      "sequence INTEGER NOT NULL UNIQUE"
                      ", fileID INTEGER NOT NULL UNIQUE"
                      ")");
        if (!exec(query)) return false;
    }
    return true;
}

void Backup::Private::backup(const QString &name)
{
    qDebug() << Q_FUNC_INFO << __LINE__;
    {
        BackupJob *job = new BackupJob(this);
        job->setName(name);
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
    {
        UpdateStatisticsJob *job = new UpdateStatisticsJob(this);
        job->setName(tr("Update statistics"));
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
}

void Backup::Private::finished()
{
    AbstractCarpetJob *job = jobQueue.takeFirst();
    qDebug() << Q_FUNC_INFO << __LINE__ << job->name();
    job->deleteLater();
    if (!jobQueue.isEmpty()) {
        qDebug() << Q_FUNC_INFO << __LINE__ << jobQueue.first()->name();
        jobQueue.first()->start();
    }
}

void Backup::Private::error(const QString &errorMessage)
{
    AbstractCarpetJob *job = qobject_cast<AbstractCarpetJob *>(sender());
    qDebug() << Q_FUNC_INFO << __LINE__ << job->name() << errorMessage;
    finished();
}

QString Backup::Private::getFullPath(int fileId) const
{
//    qDebug() << Q_FUNC_INFO << __LINE__ << fileId;
    QString ret;
    QSqlQuery query("SELECT directoryID, fileName FROM File WHERE fileID = ?", db);
    query.addBindValue(fileId);
    if (!exec(query)) return ret;
    if (!query.first()) return ret;
    if (query.value(0).isNull())
        ret = query.value(1).toString();
    else
        ret = getFullPath(query.value(0).toInt()) + "/" + query.value(1).toString();
//    qDebug() << Q_FUNC_INFO << __LINE__ << ret;
    return ret;
}

bool Backup::Private::restore(int fileTreeId, const QString &to, const QString &path)
{
//    qDebug() << Q_FUNC_INFO << __LINE__ << fileTreeId << to << path;
    int backupId = -1;
    int fileId = -1;
    QString fileName;
    QString fullPath;
    {
        QSqlQuery query("SELECT FileTree.backupID, FileTree.fileID, File.fileName FROM FileTree INNER JOIN File ON File.fileID = FileTree.fileID WHERE FileTree.fileTreeID = ?", db);
        query.addBindValue(fileTreeId);
        if (!exec(query)) return false;
        if (!query.first()) {
            qWarning() << Q_FUNC_INFO << __LINE__;
            return false;
        }
        backupId = query.value(0).toInt();
        fileId = query.value(1).toInt();
        fileName = query.value(2).toString();
        if (path.isNull()) {
            fullPath = to + "/" + getFullPath(fileId);
        } else {
            fullPath = to + path + fileName;
        }

//        qDebug() << Q_FUNC_INFO << __LINE__ << fullPath;
    }

    {
        QSqlQuery query("SELECT symlinkID, hash, permissions, uID, gID, cTime, mTime, aTime FROM BackupData WHERE fileTreeID = ?", db);
        query.addBindValue(fileTreeId);
        if (!exec(query)) return false;
        if (!query.first()) {
            qWarning() << Q_FUNC_INFO << __LINE__;
            return false;
        }
        int symlinkId = -1;
        if (!query.isNull(0))
            symlinkId = query.value(0).toInt();
        QString hash = query.value(1).toString();
        int permissions = query.value(2).toInt();
        uint ownerId = query.value(3).toUInt();
        uint groupId = query.value(4).toUInt();
        QDateTime ctime = query.value(5).toDateTime();
        QDateTime mtime = query.value(6).toDateTime();
        QDateTime atime = query.value(7).toDateTime();
//        qDebug() << Q_FUNC_INFO << __LINE__ << symlinkId << hash << permissions << ownerId << groupId;
        if (symlinkId > -1) {
            // Symlink
        } else if (hash.isEmpty()) {
            // Directory
            QDir dir(fullPath);
            if (!dir.exists()) {
                dir.mkpath(fullPath);
            }
            QFileInfo fileInfo(fullPath);
            if (fileInfo.permissions() != permissions) {
                QFile::setPermissions(fullPath, static_cast<QFile::Permissions>(permissions));
            }
            if (fileInfo.ownerId() != ownerId) {
                // TODO
            }
            if (fileInfo.groupId() != groupId) {
                // TODO
            }
            if (fileInfo.created() != ctime) {
                // TODO ?
            }
            if (fileInfo.lastModified() != mtime || fileInfo.lastRead() != atime) {
                utimbuf t;
                t.modtime = mtime.toTime_t();
                t.actime = atime.toTime_t();
                utime(fullPath.toUtf8().constData(), &t);
            }

            QStringList entryList = dir.entryList(QDir::AllEntries | QDir::Readable | QDir::NoDotAndDotDot | QDir::Hidden, QDir::Name);

            QSqlQuery query2("SELECT FileTree.fileTreeID, File.fileName FROM FileTree INNER JOIN File ON File.fileID = FileTree.fileID WHERE FileTree.backupID = ? AND File.directoryID = ?", db);
            query2.addBindValue(backupId);
            query2.addBindValue(fileId);
            if (!exec(query2)) return false;
            while (query2.next()) {
                entryList.removeAll(query2.value(1).toString());
                if (!restore(query2.value(0).toInt(), to, path + fileName + "/")) return false;
            }
            foreach (const QString &f, entryList) {
                QFileInfo fi(dir.absoluteFilePath(f));
                if (fi.isDir()) {
                    if (!dir.rmdir(f)) {
                        qWarning() << Q_FUNC_INFO << __LINE__ << dir.absoluteFilePath(f);
                    }
                } else if (fi.isFile()) {
                    if (!QFile::remove(dir.absoluteFilePath(f))) {
                        qWarning() << Q_FUNC_INFO << __LINE__ << dir.absoluteFilePath(f);
                    }
                } else {
                    qWarning() << Q_FUNC_INFO << __LINE__ << dir.absoluteFilePath(f);
                }
            }
        } else {
            QFileInfo fileInfo(fullPath);

            if (!fileInfo.exists() || fileInfo.lastModified() > mtime) {
                QFile in(this->to + "/" + hash.insert(2, "/"));
                if (!in.open(QFile::ReadOnly)) {
                    qWarning() << Q_FUNC_INFO << __LINE__ << in.fileName() << in.errorString();
                    return false;
                }

                QFile out(fullPath);
                out.setPermissions(static_cast<QFile::Permissions>(0x600));
                if (!out.open(QFile::WriteOnly)) {
                    qWarning() << Q_FUNC_INFO << __LINE__ << out.fileName() << out.errorString();
                    in.close();
                    return false;
                }

                out.write(qUncompress(in.readAll()));
                out.close();
                in.close();

                if (fileInfo.permissions() != permissions) {
                    QFile::setPermissions(fullPath, static_cast<QFile::Permissions>(permissions));
                }
                if (fileInfo.ownerId() != ownerId) {
                    // TODO
                }
                if (fileInfo.groupId() != groupId) {
                    // TODO
                }
                if (fileInfo.created() != ctime) {
                    // TODO ?
                }
                if (fileInfo.lastModified() != mtime || fileInfo.lastRead() != atime) {
                    utimbuf t;
                    t.modtime = mtime.toTime_t();
                    t.actime = atime.toTime_t();
                    utime(fullPath.toUtf8().constData(), &t);
                }
            }
        }
    }

    return true;
}

bool Backup::Private::exec(const QString &sql) const
{
    QSqlQuery query(db);
    query.prepare(sql);
    return exec(query);
}

bool Backup::Private::exec(QSqlQuery &query) const
{
//    QReadLocker locker(&lock);
    bool ret = query.exec();
    if (!ret) {
        qWarning() << Q_FUNC_INFO << __LINE__ << query.lastQuery() << query.boundValues() << query.lastError();
    }
    return ret;
}

QVariantMap Backup::Private::contents(const QString &path, const QString &backup) const
{
    qDebug() << Q_FUNC_INFO << __LINE__ << path << backup;
    QMutexLocker locker(&CarpetDB::mutex());
    qDebug() << Q_FUNC_INFO << __LINE__;
    QVariantMap ret;
    if (backup.isEmpty()) {
        QFile file(from + path);
        if (file.open(QFile::ReadOnly)) {
            ret.insert("data", file.readAll());
            file.close();
        }
    } else {
        int fileId = -1;
        {
            QSqlQuery query(db);
            query.prepare("SELECT fileId FROM File WHERE directoryID IS NULL");
            if (!exec(query)) return ret;
            if (!query.first()) return ret;
            fileId = query.value(0).toInt();
        }
        qDebug() << Q_FUNC_INFO << __LINE__ << fileId;
        foreach (const QString &item, path.split("/", QString::SkipEmptyParts)) {
            QSqlQuery query(db);
            query.prepare("SELECT fileId FROM File WHERE directoryID = ? AND fileName = ?");
            query.addBindValue(fileId);
            query.addBindValue(item);
            if (!exec(query)) return ret;
            if (!query.first()) return ret;
            fileId = query.value(0).toInt();
        }
        qDebug() << Q_FUNC_INFO << __LINE__ << fileId;

        {
            QSqlQuery query(db);
            query.prepare("SELECT BackupData.hash"
                          " FROM BackupData"
                          " INNER JOIN FileTree ON FileTree.fileTreeID = BackupData.fileTreeID"
                          " WHERE FileTree.backupID <= ?"
                          " AND FileTree.fileID = ?"
                          " ORDER BY FileTree.backupID DESC"
                          " LIMIT 1");
            query.addBindValue(backup.toInt());
            query.addBindValue(fileId);
            if (!exec(query)) return ret;
            if (!query.first()) return ret;
            QString hash = query.value(0).toString();
            qDebug() << Q_FUNC_INFO << __LINE__ << hash;
            QFile file(QString("%1/%2").arg(to).arg(hash.insert(2, "/")));
            if (file.open(QFile::ReadOnly)) {
                ret.insert("data", qUncompress(file.readAll()));
                file.close();
            } else {
                qDebug() << Q_FUNC_INFO << __LINE__ << to << hash;
            }
        }
    }
    qDebug() << Q_FUNC_INFO << __LINE__ << ret.keys();
    return ret;
}

QVariantMap Backup::Private::diff(const QString &path, const QString &backup) const
{
    qDebug() << Q_FUNC_INFO << __LINE__ << path << backup;
    QMutexLocker locker(&CarpetDB::mutex());
    qDebug() << Q_FUNC_INFO << __LINE__;
    QVariantMap ret;
    int fileId = -1;
    {
        QSqlQuery query(db);
        query.prepare("SELECT fileId FROM File WHERE directoryID IS NULL");
        if (!exec(query)) return ret;
        if (!query.first()) return ret;
        fileId = query.value(0).toInt();
    }
    foreach (const QString &item, path.split("/", QString::SkipEmptyParts)) {
        QSqlQuery query(db);
        query.prepare("SELECT fileId FROM File WHERE directoryID = ? AND fileName = ?");
        query.addBindValue(fileId);
        query.addBindValue(item);
        if (!exec(query)) return ret;
        if (!query.first()) return ret;
        fileId = query.value(0).toInt();
    }

    {
        QSqlQuery query(db);
        query.prepare("SELECT BackupData.hash"
                      " FROM BackupData"
                      " INNER JOIN FileTree ON FileTree.fileTreeID = BackupData.fileTreeID"
                      " WHERE FileTree.backupID = ?"
                      " AND FileTree.fileID = ?");
        query.addBindValue(backup.toInt());
        query.addBindValue(fileId);
        if (!exec(query)) return ret;
        if (!query.first()) return ret;
        QString hash = query.value(0).toString();
        QFile file(QString("%1/%2").arg(to).arg(hash.insert(2, "/")));
        if (file.open(QFile::ReadOnly)) {
            QByteArray old = qUncompress(file.readAll());
            file.close();
            if (QFile::exists(from + path)) {
                QProcess diff;
                QStringList args;
                args.append("-u");
                args.append("-d");
                args.append("-");
                args.append(from + path);
                diff.start("diff", args);
                diff.waitForStarted();
                diff.write(old);
                diff.closeWriteChannel();
                diff.waitForFinished();
                QByteArray data = diff.readAll();
                ret.insert("data", data);
            } else {
                ret.insert("data", old);
            }
        } else {
            qDebug() << Q_FUNC_INFO << __LINE__ << file.errorString();
        }
    }
    qDebug() << Q_FUNC_INFO << __LINE__ << ret.keys();
    return ret;
}

QVariantMap Backup::Private::fileInfo(int fileId) const
{
    QVariantMap ret;

    QSqlQuery query(db);
    query.prepare("SELECT MimeType.mimeTypeName"
                  ", BackupData.size"
                  ", BackupData.hash"
                  ", BackupData.permissions"
                  ", BackupData.cTime"
                  ", BackupData.mTime"
                  ", BackupData.aTime"
                  " FROM FileTree"
                  " INNER JOIN BackupData ON BackupData.fileTreeID = FileTree.fileTreeID"
                  " INNER JOIN MimeType ON MimeType.mimeTypeID = BackupData.mimeTypeID"
                  " WHERE FileTree.fileID = ?"
                  " ORDER BY FileTree.fileTreeID DESC"
                  " LIMIT 1");
    query.addBindValue(fileId);
    if (exec(query)) {
        if (query.first()) {
            ret.insert("mime", query.value(0).toString());
            ret.insert("size", query.value(1).toInt());
            ret.insert("hash", query.value(2).toString());
            ret.insert("permissions", query.value(3).toUInt());
            ret.insert("ctime", query.value(4).toDateTime());
            ret.insert("mtime", query.value(5).toDateTime());
            ret.insert("atime", query.value(6).toDateTime());
            ret.insert("fileId", fileId);

            int directoryId = fileId;
            QString fileName;
            QString path = "";
            forever {
                QSqlQuery query2("SELECT directoryID, fileName FROM File WHERE fileID = ?", db);
                query2.addBindValue(directoryId);
                if (exec(query2)) {
                    if (query2.first()) {
                        directoryId = query2.value(0).toInt();
                        if (fileName.isEmpty()) {
                            fileName = query2.value(1).toString();
                        } else {
                            path = query2.value(1).toString() + "/" + path;
                        }
                    } else {
                        break;
                    }
                }
            }
            ret.insert("name", fileName);
            ret.insert("dir", path);
        }
    }
    return ret;
}

QVariantList Backup::Private::tree(const QString &path) const
{
    qDebug() << Q_FUNC_INFO << __LINE__;
    QMutexLocker locker(&CarpetDB::mutex());
    qDebug() << Q_FUNC_INFO << __LINE__;
    QVariantList ret;

    QDir dir(path.isEmpty() ? from : path);
    foreach (const QString &item, dir.entryList(QDir::Dirs | QDir::Readable | QDir::NoDotAndDotDot | QDir::Hidden, QDir::Name)) {
        if (dir.absoluteFilePath(item) == to) continue;
        QVariantMap map;
        map.insert("name", item);
        map.insert("children", tree(dir.absoluteFilePath(item)));
        ret.append(map);
    }

    return ret;
}

QVariantList Backup::Private::excludePatterns() const
{
    qDebug() << Q_FUNC_INFO << __LINE__;
    QMutexLocker locker(&CarpetDB::mutex());
    qDebug() << Q_FUNC_INFO << __LINE__;
    QVariantList ret;

    QSqlQuery query("SELECT excludePatternID"
                    ", pattern"
                    ", entireDirectoryIfExists"
                    " FROM ExcludePatterns", db);
    if (exec(query)) {
        while (query.next()) {
            QVariantMap item;
            item.insert("id", query.value(0).toInt());
            item.insert("pattern", query.value(1).toString());
            item.insert("entireDirectoryIfExists", query.value(2).toBool());
            ret.append(item);
        }
    }
    return ret;
}

void Backup::Private::addExcludePattern(const QString &pattern, bool entireDirectory)
{
    {
        AddExcludePatternJob *job = new AddExcludePatternJob(pattern, entireDirectory, this);
        job->setName(tr("add exclude pattern(%1)").arg(pattern));
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
    {
        UpdateStatisticsJob *job = new UpdateStatisticsJob(this);
        job->setName(tr("Update statistics"));
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
}

void Backup::Private::removeExcludePattern(const QString &id, const QString &pattern)
{
    {
        RemoveExcludePatternJob *job = new RemoveExcludePatternJob(id.toInt(), this);
        job->setName(tr("remove exclude pattern (%1)").arg(pattern));
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
    {
        UpdateStatisticsJob *job = new UpdateStatisticsJob(this);
        job->setName(tr("Update statistics"));
        job->setMutex(&CarpetDB::mutex());
        connect(job, SIGNAL(finished()), this, SLOT(finished()));
        connect(job, SIGNAL(error(QString)), this, SLOT(error(QString)));
        if (jobQueue.isEmpty()) job->start();
        jobQueue.append(job);
    }
}

Backup::Backup(QObject *parent)
    : QObject(parent)
    , d(new Private(this))
{
    d->moveToThread(&thread);
    connect(d, SIGNAL(done(bool,QString)), this, SIGNAL(done(bool,QString)));
    thread.start(QThread::LowestPriority);
}

Backup::~Backup()
{
    thread.terminate();
    thread.wait();
    delete d;
}

bool Backup::enabled() const
{
    QSqlQuery query(d->db);
    query.prepare("SELECT value FROM Settings WHERE key = ?");
    query.addBindValue(QLatin1String("enabled"));
    if (d->exec(query)) {
        if (query.first()) {
            return query.value(0).toBool();
        } else {
            return false;
        }
    }
    return false;
}

void Backup::setEnabled(bool enabled)
{
    QSqlQuery query(d->db);
    query.prepare("SELECT value FROM Settings WHERE key = ?");
    query.addBindValue(QLatin1String("enabled"));
    if (d->exec(query)) {
        QSqlQuery query2(d->db);
        if (query.first()) {
            query2.prepare("UPDATE Settings SET value = ? WHERE key = ?");
        } else {
            query2.prepare("INSERT INTO Settings(value, key) VALUES(?, ?)");
        }
        query2.addBindValue(enabled);
        query2.addBindValue(QLatin1String("enabled"));
        if (d->exec(query2)) {
            emit enabledChanged(enabled);
        }
    }
}

Backup::Status Backup::status() const
{
    return d->status;
}

QVariantList Backup::jobList() const
{
    QVariantList ret;
    foreach (const AbstractCarpetJob *job, d->jobQueue) {
        QVariantMap m;
        m.insert("icon", job->icon());
        m.insert("name", job->name());
        ret.append(m);
    }
    return ret;
}

void Backup::backup(const QString &name)
{
    QMetaObject::invokeMethod(d, "backup", Qt::QueuedConnection, Q_ARG(QString, name));
}

void Backup::restore(int fileTreeId, const QString &to)
{
    d->restore(fileTreeId, to.isNull() ? d->from : to);
}

QVariantMap Backup::contents(const QString &path, const QString &backup) const
{
    return d->contents(path, backup);
}

QVariantMap Backup::diff(const QString &path, const QString &backup) const
{
    return d->diff(path, backup);
}

QVariantList Backup::tree() const
{
    return d->tree();
}

QVariantList Backup::excludePatterns() const
{
    return d->excludePatterns();
}

void Backup::addExcludePattern(const QString &pattern, bool entireDirectory)
{
    QMetaObject::invokeMethod(d, "addExcludePattern", Qt::QueuedConnection, Q_ARG(QString, pattern), Q_ARG(bool, entireDirectory));
}

void Backup::removeExcludePattern(const QString &id, const QString &pattern)
{
    QMetaObject::invokeMethod(d, "removeExcludePattern", Qt::QueuedConnection, Q_ARG(QString, id), Q_ARG(QString, pattern));
}

#include "backup.moc"


text:
//
//  RSSParser.h
//  RSSParser
//
//  Modified by Joshua Greene on 4/2/14.
//  Created by Thibaut LE LEVIER on 1/31/12.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.

#import <Foundation/Foundation.h>

@class AFHTTPSessionManager;
@class RSSChannel;

/**
 *  `RSSParser` is a wrapper around an `AFHTTPSessionManager` object, its `client` property, that handles the parsing of Media RSS feed data.
 */
@interface RSSParser : NSObject <NSXMLParserDelegate>

/**
 *  The date formatter used for formatting dates from the RSS feed. This object is created on `init` of the `RSSParser`. If your RSS feed uses an atypical date format, you can set the correct date format on this object. The default date format is `EEE, dd MMM yyyy HH:mm:ss Z`.
 */
@property (nonatomic, strong, readonly) NSDateFormatter *dateFormatter;

/**
 *  This will cancel all of the `NSURLSessionTask` objects of the `client`, call `abortParsing` on `xmlParser`, and set both the `success` and `failure` blocks to `nil` (see `RSSParser_Protected.h` for a description of these internal properties).
 *
 *  Neither the `success` or `failure` block will be called if `cancel` is called (unless, of course, either is called prior to `cancel`).
 */
- (void)cancel;

/**
 *  This is a convenience method for creating a new `RSSParser` object and calling the `parseRSSFeed:parameters:success:failure:` instance method on it.
 */

+ (RSSParser *)parseRSSFeed:(NSString *)urlString
                 parameters:(NSDictionary *)parameters
                    success:(void (^)(RSSChannel *channel))success
                    failure:(void (^)(NSError *error))failure;

/**
 *  This method will initiate a GET request of the given `urlString`, including passing the `parameters`,  using the `client`. Both the `success` and `failure` blocks will be copied as internal properties (see `RSSParser_Protected` for a description of these internal properties).
 *
 *  @param urlString  The URL in string format to GET
 *  @param parameters The parameters to be included in the GET request
 *  @param success    The success block to be called on parser successful completion
 *  @param failure    The failure block to be called on network or parser error

 *  @warning Both the `success` and `failure` blocks capture self (creates a strong references self). This creates a retain cycle until either success or failure results (both `success` and `failure` block are set to `nil` after either occurs).
 *
 */
- (void)parseRSSFeed:(NSString *)urlString
          parameters:(NSDictionary *)parameters
             success:(void (^)(RSSChannel *channel))success
             failure:(void (^)(NSError *error))failure;

@end


text:
package org.compass.core.engine;

import org.compass.core.CompassException;

/**
 * An exception happened when trying to parse a search engine query string.
 *
 * @author kimchy
 */
public class SearchEngineQueryParseException extends CompassException {

    private String queryString;

    public SearchEngineQueryParseException(String queryString, Throwable root) {
        super("Failed to parse query [" + queryString + "]", root);
        this.queryString = queryString;
    }

    public String getQueryString() {
        return this.queryString;
    }
}


text: create sequence seq_test maxvalue -100 minvalue -200;


text:
namespace MassTransit.AzureServiceBusTransport.Topology.Configuration.Configurators
{
    using System;

    public abstract class EntityConfigurator :
        IEntityConfigurator
    {
        protected EntityConfigurator()
        {
            DefaultMessageTimeToLive = Defaults.DefaultMessageTimeToLive;
        }

        public TimeSpan? AutoDeleteOnIdle { get; set; }

        public TimeSpan? DefaultMessageTimeToLive { get; set; }

        public bool? EnableBatchedOperations { get; set; }

        public string UserMetadata { get; set; }
    }
}


text:
package cn.luo.yuan.maze.service;

import cn.luo.yuan.maze.model.Hero;
import cn.luo.yuan.maze.model.Maze;
import cn.luo.yuan.maze.model.NPCLevelRecord;
import cn.luo.yuan.maze.model.Pet;
import cn.luo.yuan.maze.model.skill.SkillParameter;
import cn.luo.yuan.maze.persistence.DataManagerInterface;
import cn.luo.yuan.maze.utils.Random;
import org.jetbrains.annotations.NotNull;

import java.util.concurrent.ScheduledExecutorService;

/**
 * Created by gluo on 6/30/2017.
 */
public class MockGameContext implements InfoControlInterface {
    public Random random = new Random(System.currentTimeMillis());
    public Hero hero;
    public DataManagerInterface dataManager;
    public ScheduledExecutorService executor;
    public Maze maze;

    @Override
    public boolean isWeakling() {
        return false;
    }

    @Override
    public boolean isInvincible() {
        return false;
    }

    @Override
    public void startInvincible(long mill, long weakling) {

    }

    @Override
    public Hero getHero() {
        return hero;
    }

    @Override
    public Random getRandom() {
        return random;
    }

    @Override
    public Maze getMaze() {
        return maze;
    }

    @Override
    public void addMessage(String msg) {

    }

    @Override
    public void stopGame() {

    }

    @Override
    public DataManagerInterface getDataManager() {
        return dataManager;
    }

    public TaskManager getTaskManager() {
        return null;
    }

    @Override
    public PetMonsterHelperInterface getPetMonsterHelper() {
        return null;
    }

    @Override
    public ScheduledExecutorService getExecutor() {
        return executor;
    }

    @Override
    public long resetSkill(@NotNull SkillParameter sp) {
        return 0;
    }

    @Override
    public void showPopup(String msg) {

    }

    @Override
    public void postTaskInUIThread(Runnable task) {

    }

    @Override
    public void refreshHead() {

    }

    @Override
    public void showEmptyAccessoryDialog() {

    }

    @Override
    public void showInputPopup(InputListener listener, String hint) {

    }

    @Override
    public void setRandomNPC(NPCLevelRecord npc) {

    }

    @Override
    public void zoarium(@NotNull Pet pet) {

    }

    @Override
    public void diszoarium() {

    }
}


text:
@interface BNRCrashTestViewController ()

@property (nonatomic, strong) UIDynamicAnimator *animator;

@property (strong, nonatomic) UIDynamicItemBehavior *item1DIB;
@property (strong, nonatomic) UIDynamicItemBehavior *item2DIB;

@property (weak, nonatomic) IBOutlet UIView *item1;
@property (weak, nonatomic) IBOutlet UIView *item2;

@property (strong, nonatomic) IBOutlet UISlider *elasticity1Slider;
@property (strong, nonatomic) IBOutlet UISlider *friction1Slider;
@property (strong, nonatomic) IBOutlet UISlider *resistance1Slider;
@property (strong, nonatomic) IBOutlet UISlider *density1Slider;
@property (weak, nonatomic) IBOutlet UISwitch *rotation1Switch;

@property (weak, nonatomic) IBOutlet UISlider *elasticity2Slider;
@property (weak, nonatomic) IBOutlet UISlider *friction2Slider;
@property (weak, nonatomic) IBOutlet UISlider *resistance2Slider;
@property (weak, nonatomic) IBOutlet UISlider *density2Slider;
@property (weak, nonatomic) IBOutlet UISwitch *rotation2Switch;

@property (nonatomic, assign) CGRect startRect1;
@property (nonatomic, assign) CGRect startRect2;

@property (nonatomic, strong) NSMutableDictionary *panStartLocationForViews;

@end

@implementation BNRCrashTestViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];

    self.item1DIB = [[UIDynamicItemBehavior alloc] initWithItems:@[self.item1]];
    [self.animator addBehavior:self.item1DIB];
    self.item2DIB = [[UIDynamicItemBehavior alloc] initWithItems:@[self.item2]];
    [self.animator addBehavior:self.item2DIB];

    // Add collision behavior
    UICollisionBehavior *collider = [[UICollisionBehavior alloc] initWithItems:@[self.item1, self.item2]];
    collider.collisionMode = UICollisionBehaviorModeItems;
    [self.animator addBehavior:collider];

    self.startRect1 = self.item1.frame;
    self.startRect2 = self.item2.frame;

    self.panStartLocationForViews = [[NSMutableDictionary alloc] init];
}

- (void)viewDidAppear:(BOOL)animated
{
    UIPanGestureRecognizer *gr = [[UIPanGestureRecognizer alloc]
                                  initWithTarget:self
                                  action:@selector(pan:)];
    [self.item1 addGestureRecognizer:gr];

    UIPanGestureRecognizer *gr2 = [[UIPanGestureRecognizer alloc]
                                  initWithTarget:self
                                  action:@selector(pan:)];
    [self.item2 addGestureRecognizer:gr2];
}

- (void)pan:(UIGestureRecognizer *)gr
{
    UIPanGestureRecognizer *panGR = (UIPanGestureRecognizer *)gr;

    NSNumber *viewHash = [NSNumber numberWithUnsignedInteger:[gr.view hash]];
    if (gr.state == UIGestureRecognizerStateBegan) {
        self.panStartLocationForViews[viewHash] = [NSValue valueWithCGPoint:gr.view.center];
    } else if (gr.state == UIGestureRecognizerStateEnded) {
        [self.panStartLocationForViews removeObjectForKey:viewHash];
    } else {
        CGPoint delta = [panGR translationInView:self.view];

        CGPoint newPt = [self.panStartLocationForViews[viewHash] CGPointValue];
        newPt.x += delta.x;
        newPt.y += delta.y;
        gr.view.center = newPt;
        [self.animator updateItemUsingCurrentState:gr.view];
        NSLog(@"Panning %@ to %@", gr.view, NSStringFromCGPoint(delta));
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)startCrash:(id)sender
{
    // Add an quick push to the views
    UIPushBehavior *push1 = [[UIPushBehavior alloc] initWithItems:@[self.item1] mode:UIPushBehaviorModeInstantaneous];
    push1.angle = 0.0;
    push1.magnitude = 3.0;
    [self.animator addBehavior:push1];

    UIPushBehavior *push2 = [[UIPushBehavior alloc] initWithItems:@[self.item2] mode:UIPushBehaviorModeInstantaneous];
    push2.angle = M_PI;
    push2.magnitude = 3.0;
    [self.animator addBehavior:push2];
}

- (IBAction)updateDIBs:(id)sender {
    self.item1DIB.resistance = self.resistance1Slider.value;
    self.item1DIB.elasticity = self.elasticity1Slider.value;
    self.item1DIB.friction = self.friction1Slider.value;
    self.item1DIB.density = self.density1Slider.value;
    self.item1DIB.allowsRotation = self.rotation1Switch.isOn;

    self.item2DIB.resistance = self.resistance2Slider.value;
    self.item2DIB.elasticity = self.elasticity2Slider.value;
    self.item2DIB.friction = self.friction2Slider.value;
    self.item2DIB.density = self.density2Slider.value;
    self.item2DIB.allowsRotation = self.rotation2Switch.isOn;
}

- (IBAction)reset:(id)sender {

    self.item1.frame = self.startRect1;
    self.item1.transform = CGAffineTransformIdentity;
    CGPoint vel = [self.item1DIB linearVelocityForItem:self.item1];
    [self.item1DIB addLinearVelocity:CGPointMake(-vel.x, -vel.y) forItem:self.item1];

    [self.animator updateItemUsingCurrentState:self.item1];

    self.item2.frame = self.startRect2;
    self.item2.transform = CGAffineTransformIdentity;
    vel = [self.item2DIB linearVelocityForItem:self.item2];
    [self.item2DIB addLinearVelocity:CGPointMake(-vel.x, -vel.y) forItem:self.item2];
    [self.animator updateItemUsingCurrentState:self.item2];
}

@end


text:
package brokerintegration_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Shared instance unbinding", func() {

	validInputs := &HTTPExampleInputs{Method: "DELETE", URI: "http://localhost:3000/v2/service_instances/foo/service_bindings/bar?plan_id=my-plan&service_id=my-service-id"}
	invalidInputs := &HTTPExampleInputs{Method: "DELETE", URI: "http://localhost:3000/v2/service_instances/INVALID/service_bindings/bar?plan_id=my-plan&service_id=my-service-id"}

	BeforeEach(func() {
		code, _ := brokerClient.ProvisionInstance("foo", "shared")
		Ω(code).Should(Equal(201))
	})

	AfterEach(func() {
		brokerClient.DeprovisionInstance("foo", "shared")
	})

	Context("with valid instance", func() {
		HTTPResponseShouldContainExpectedHTTPStatusCode(validInputs, 200)
		HTTPResponseBodyShouldBeEmptyJSON(validInputs)
	})

	Context("with invalid instance", func() {
		HTTPResponseShouldContainExpectedHTTPStatusCode(invalidInputs, 410)
		HTTPResponseBodyShouldBeEmptyJSON(validInputs)
	})
})


text:
RPM Package Builder

Этот репозиторий содержит скрипты/шаблоны, упрощающие создание rpm для Django-based проекта.

## Как использовать

Внутри корневой директории проекта:

```bash
git submodule add https://github.com/mr-intdev/rpmtools.git
touch BUILD.json
```

Поменяйте содержимое файла BUILD.json на соответствующее вашему проекту, например:

```javascript
{
    "name": "corpse",
    "version": "2.1.33",
    "summary": "corp.mail.ru web site",
    "build_requires": "python rpm-build redhat-rpm-config mysql-devel libjpeg-devel",
    "requires": "python mysql mysql-server libjpeg syslog"
}
```

Обязательные параметры:

name - название проекта (будет использоваться буквально для всего - название директорий и т.д)
version - версия
summary - описание проекта
requires - секция спеки `Requires`
build_requires - секция спеки `BuildRequires`

Параметры по умолчанию лежат в файлике `defaults.json`

в `settings.py` нужно дописать:

```python
if 'collectstatic' in sys.argv:
    STATIC_ROOT = os.path.join(DISK_ROOT, '..' ,'collected_static')
```

где DISK_ROOT - корень вашего проекта (папка, которая содержит templates, application...)

Далее нужно в корневую директорию положить `default.conf` - файлик для ConfigParser с дефолтными настройками проекта

Если нужно можно в `settings.py` прописать определение текущей версии

```
import json
build_conf = json.load(open(os.path.join(DISK_ROOT, 'BUILD.json')))
VERSION = ('v' + build_conf['version']).strip()
```

И также нужно прописать в `settings.py`

```python
if 'test' in sys.argv or 'jenkins' in sys.argv:

    DATABASES['default'] = {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':memory:'
    }
    SOUTH_TESTS_MIGRATE = False
    CACHES = {
        'default': {
            'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
        }
    }
    LOGGING = {
        'version': 1,
        'disable_existing_loggers': True,
        'formatters': {
            'standard': {
                'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                'datefmt': "%d/%b/%Y %H:%M:%S"
            },
        },
    }
```

Также нужно настроить сборку проекта в jenkins:

* поставить галочку `Recursively update submodules`
* execute shell 1:

```bash
if [ ! -d env ]; then
    virtualenv --distribute --python=/usr/bin/python2.6 env
    env/bin/pip install distribute --upgrade
    env/bin/pip install -r requirements.txt --upgrade
    virtualenv --relocatable --python=/usr/bin/python2.6 env
else
    source env/bin/activate
    pip install distribute --upgrade
    pip install -r requirements.txt --upgrade
fi
find ./ -name "*.pyc" -delete
```

* execute shell 2

```bash
if $DEPLOY ; then
  source env/bin/activate
  ./rpmtools/release.py --build
  RESULT=$(ls -1t $(find ${HOME}/rpmbuild/RPMS/ -name "*.rpm") | head -n 1)
  rsync -P --password-file=/var/lib/jenkins/repo.key $RESULT sys.jenkins@pkg.corp.mail.ru::c6-intdev-x86_64
  echo "c6-intdev-x64" | nc pkg.corp.mail.ru 12222
fi
```


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>se.walkercrou</groupId>
    <artifactId>ghp-maven-archetype</artifactId>
    <version>1.0.1</version>
    <packaging>jar</packaging>

    <name>GitHub Pages Maven Archetype</name>
    <description>Quickstart for developers wanting to integrate the GHP Maven Plugin</description>
    <url>https://github.com/windy1/ghp-maven-archetype</url>
    <inceptionYear>2015</inceptionYear>

    <licenses>
        <license>
            <name>MIT</name>
            <url>https://github.com/windy1/ghp-maven-archetype/blob/master/LICENSE.md</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Walker Crouse</name>
            <email>walkercrouse@hotmail.com</email>
            <timezone>EST</timezone>
        </developer>
    </developers>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/windy1/ghp-maven-archetype/issues</url>
    </issueManagement>

    <scm>
        <connection>scm:git:git@github.com:windy1/ghp-maven-archetype.git</connection>
        <developerConnection>scm:git:git@github.com:windy1/ghp-maven-archetype.git</developerConnection>
        <url>git@github.com:windy1/ghp-maven-archetype.git</url>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <maven-plugins.groupId>org.apache.maven.plugins</maven-plugins.groupId>
        <source-plugin.version>2.4</source-plugin.version>
        <javadoc-plugin.version>2.10.1</javadoc-plugin.version>
        <gpg-plugin.version>1.6</gpg-plugin.version>
        <nexus-plugin.version>1.6.5</nexus-plugin.version>
    </properties>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>${maven-plugins.groupId}</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>${maven-plugins.groupId}</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>${maven-plugins.groupId}</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <defaultGoal>clean install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>${nexus-plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>