text:
namespace gloperate
{

AbstractInputSlot::AbstractInputSlot(const std::string & name)
: m_owner(nullptr)
, m_name(name)
, m_hasChanged(true)
, m_isOptional(false)
, m_isFeedback(false)
{
}

AbstractInputSlot::~AbstractInputSlot()
{
}

const std::string & AbstractInputSlot::name() const
{
    return m_name;
}

void AbstractInputSlot::setName(const std::string & name)
{
    m_name = name;
}

bool AbstractInputSlot::hasName() const
{
    return !m_name.empty();
}

std::string AbstractInputSlot::asPrintable() const
{
    if (!hasName())
        return "<unnamed>";

    std::string n = name();
    std::replace(n.begin(), n.end(), ' ', '_');

    return n;
}

bool AbstractInputSlot::hasOwner() const
{
    return m_owner != nullptr;
}

const AbstractStage * AbstractInputSlot::owner() const
{
    return m_owner;
}

void AbstractInputSlot::setOwner(AbstractStage * owner)
{
    m_owner = owner;
}

std::string AbstractInputSlot::qualifiedName() const
{
    std::stringstream ss;

    if (hasOwner())
    {
        ss << m_owner->asPrintable() << "::";
    }

    ss << asPrintable();

    return ss.str();
}

bool AbstractInputSlot::isUsable() const
{
    return isOptional() || isConnected();
}

bool AbstractInputSlot::hasChanged() const
{
    return m_hasChanged;
}

void AbstractInputSlot::changed()
{
    m_hasChanged = true;
}

void AbstractInputSlot::processed()
{
    m_hasChanged = false;
}

bool AbstractInputSlot::isOptional() const
{
    return m_isOptional;
}

void AbstractInputSlot::setOptional(bool optional)
{
    m_isOptional = optional;
}

bool AbstractInputSlot::isFeedback() const
{
    return m_isFeedback;
}

void AbstractInputSlot::setFeedback(bool isFeedback)
{
    m_isFeedback = isFeedback;

    connectionChanged();
}

bool AbstractInputSlot::isConnected() const
{
    return connectedData() != nullptr;
}

} // namespace gloperate

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Pimcore\Log;

class Helper {

    const ERROR_LOG_TABLE_NAME = "application_logs";
    const ERROR_LOG_ARCHIVE_TABLE_NAME = "application_logs_archive";

    protected static $_pluginConfig;

    protected static $_logLevels = array(0 => 'Emergency: system is unusable',
                                        1 => 'Alert: action must be taken immediately',
                                        2 => 'Critical: critical conditions',
                                        3 => 'Error: error conditions',
                                        4 => 'Warning: warning conditions',
                                        5 => 'Notice: normal but significant condition',
                                        6 => 'Informational: informational messages',
                                        7 => 'Debug: debug messages',
                                );

    public static function getConfigFilePath()
    {
        return PIMCORE_WEBSITE_PATH . '/var/plugins/Elements_Logging/config.xml';
    }

    public static function getLogLevels(){
        return self::$_logLevels;
    }

    public static function getPluginConfig()
    {
        $pluginFile = self::getConfigFilePath();
        if (is_null(self::$_pluginConfig)) {
            self::$_pluginConfig = new \Zend_Config_Xml($pluginFile, 'configData');
        }
        return self::$_pluginConfig;
    }

}


text:
SiteConfig.database_config = {
	:adapter  => "mysql",
	:host 		=> "db-master",
	:username => "ads",
	:password => "dunno",
	:database => "ads"
}
SiteConfig.cache_ttl = 1.day
SiteConfig.cache_options.delete(:logger)


text:
var setup = require('./setup'),
    assert = require('assert');

setup(function(err, cb) {
    assert(!err, "setup failure");

    cb.on("error", function (message) {
        console.log("ERROR: [" + message + "]");
        process.exit(1);
    });

    var testkey = "05-replace.js"

    cb.remove(testkey, function(){
        // try to replace a missing key, should fail
        cb.replace(testkey, "bar", function(err, meta) {
            assert(err, "Can't replace object that is already removed");
            cb.set(testkey, "bar", function (err, meta) {
                assert(!err, "Failed to store object");
                cb.replace(testkey, "bazz", function (err, meta) {
                    assert(!err, "Failed to replace object");
                    cb.get(testkey, function (err, doc) {
                        assert(!err, "Failed to get object");
                        assert.equal("bazz", doc, "Replace didn't work")
                        process.exit(0);
                    })
                });
            });
        });
    });
})


text:
function loadText()
    {
    document.getElementById("txtLang").innerHTML = "Nimi";
    document.getElementById("btnCancel").value = "Peruuta";
    document.getElementById("btnInsert").value = "Liit\u00E4";
    document.getElementById("btnApply").value = "K\u00E4yt\u00E4";
    document.getElementById("btnOk").value = " OK ";
    }
function writeTitle()
    {
    document.write("<title>"+"Tiedostokentt\u00E4"+"</title>")
    }


text:
package com.github.otbproject.otbproject.fs;

public class PathBuildException extends RuntimeException {
    public PathBuildException() {
        super("Unable to build path: unspecified path parts");
    }

    public PathBuildException(String message) {
        super(message);
    }
}


text:
namespace Test.Integration.CRDT
{
    using System.Linq;
    using NUnit.Framework;
    using RiakClient;
    using RiakClient.Commands.KV;

    public class FetchPreflistTests : TestBase
    {
        protected override RiakString BucketType
        {
            get { return new RiakString("plain"); }
        }

        protected override RiakString Bucket
        {
            get { return new RiakString("fetch_preflists"); }
        }

        [Test]
        public void Can_Fetch_Preflist()
        {
            RiakMinVersion(2, 1, 0);

            var fetch = new FetchPreflist.Builder()
                    .WithBucketType(BucketType)
                    .WithBucket(Bucket)
                    .WithKey("key_1")
                    .Build();

            RiakResult rslt = client.Execute(fetch);
            if (rslt.IsSuccess)
            {
                PreflistResponse response = fetch.Response;
                Assert.IsNotNull(response);

                Assert.AreEqual(3, response.Value.Count());
            }
            else
            {
                // TODO: remove this else case when this fix is in Riak:
                // https://github.com/basho/riak_kv/pull/1116
                // https://github.com/basho/riak_core/issues/706
                bool foundMessage =
                    (rslt.ErrorMessage.IndexOf("Permission denied") >= 0 && rslt.ErrorMessage.IndexOf("riak_kv.get_preflist") >= 0) ||
                    (rslt.ErrorMessage.IndexOf("error:badarg") >= 0 && rslt.ErrorMessage.IndexOf("characters_to_binary") >= 0);
                Assert.True(foundMessage, rslt.ErrorMessage);
            }
        }
    }
}


text:
package com.jacket.webapp.user.entity;

import javax.persistence.Table;
import javax.persistence.Id;
/**
 * Created by jacket on 2016/5/2.
 */
@Table(name = "t_role_per")
public class RolePermission {
    @Id
    private String id;
    private String roleId;
    private String perId;

    public String getId() {
        return id;
    }

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

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getPerId() {
        return perId;
    }

    public void setPerId(String perId) {
        this.perId = perId;
    }
}


text:
namespace simpla {
namespace geometry {
struct Face;
struct Solid;
struct Edge;
struct Wire;
struct gCurve;

std::shared_ptr<GeoObject> MakeRevolution(std::shared_ptr<const GeoEntity> const& geo, Axis const& r_axis = Axis{},
                                          box_type const& range = box_type{{0, 0, 0}, {0, 0, TWOPI}},
                                          Axis const& g_axis = Axis{});
std::shared_ptr<GeoObject> MakeRevolution(std::shared_ptr<const GeoEntity> const& geo, Real angle0 = 0,
                                          Real angle1 = TWOPI, Real radius = 0,
                                          vector_type const& Nx = vector_type{1, 0, 0},
                                          vector_type const& Ny = vector_type{0, 0, 1}, Axis const& = Axis{});

std::shared_ptr<GeoObject> MakePrism(std::shared_ptr<const GeoEntity> const& geo, vector_type const& direction,
                                     Real u = 1, Axis const& = Axis{});

std::shared_ptr<GeoObject> MakePipe(std::shared_ptr<const GeoEntity> const& geo,
                                    std::shared_ptr<const gCurve> const& curve, Axis const& axis = {});
std::shared_ptr<GeoObject> MakeSweep(std::shared_ptr<const GeoEntity> const& face,
                                     std::shared_ptr<const gCurve> const& c, Axis const& axis = {});

std::shared_ptr<Face> MakeSweep(std::shared_ptr<const Edge> const& face, std::shared_ptr<const Edge> const& c,
                                Axis const& axis = {});
std::shared_ptr<Solid> MakeSweep(std::shared_ptr<const Face> const& face, std::shared_ptr<const Edge> const& c,
                                 Axis const& axis = {});

}  // namespace simpla
}  // namespace geometry
#endif  // SIMPLA_SWEPTBODY_H


text:
package io.github.mzmine.modules.io.import_features_mztabm;

import io.github.mzmine.datamodel.MZmineProject;
import io.github.mzmine.modules.MZmineModuleCategory;
import io.github.mzmine.modules.MZmineProcessingModule;
import io.github.mzmine.parameters.ParameterSet;
import io.github.mzmine.taskcontrol.Task;
import io.github.mzmine.util.ExitCode;

import io.github.mzmine.util.MemoryMapStorage;
import java.time.Instant;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.File;
import java.util.Collection;

public class MZTabmImportModule implements MZmineProcessingModule {

  private static final String MODULE_NAME = "Import mzTab-m file";
  private static final String MODULE_DESCRIPTION =
      "This method imports a feature list from a mzTab-m file.";

  @NotNull
  @Override
  public String getDescription() {
    return MODULE_DESCRIPTION;
  }

  @NotNull
  @Override
  public ExitCode runModule(@NotNull MZmineProject project, @NotNull ParameterSet parameters,
      @NotNull Collection<Task> tasks, @NotNull Instant moduleCallDate) {
    File inputFiles[] = parameters.getParameter(MzTabmImportParameters.file).getValue();
    final MemoryMapStorage storage = MemoryMapStorage.forFeatureList();
    for (File inputFile : inputFiles) {
      MzTabmImportTask task = new MzTabmImportTask(project, parameters, inputFile, storage, moduleCallDate);
      tasks.add(task);
    }
    return ExitCode.OK;
  }

  @NotNull
  @Override
  public MZmineModuleCategory getModuleCategory() {
    return MZmineModuleCategory.FEATURELISTIMPORT;
  }

  @NotNull
  @Override
  public String getName() {
    return MODULE_NAME;
  }

  @Nullable
  @Override
  public Class<? extends ParameterSet> getParameterSetClass() {
    return MzTabmImportParameters.class;
  }
}


text:
package org.apache.ignite.internal.processors.query.h2.database;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2IndexBase;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
import org.apache.ignite.internal.util.IgniteTree;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.spi.indexing.IndexingQueryFilter;
import org.h2.engine.Session;
import org.h2.index.Cursor;
import org.h2.index.IndexType;
import org.h2.message.DbException;
import org.h2.result.Row;
import org.h2.result.SearchRow;
import org.h2.result.SortOrder;
import org.h2.table.Column;
import org.h2.table.IndexColumn;
import org.h2.table.TableFilter;
import org.jetbrains.annotations.Nullable;

/**
 *
 */
public class H2PkHashIndex extends GridH2IndexBase {
    /** */
    private final GridH2Table tbl;

    /** */
    private final GridCacheContext cctx;

    /**
     * @param cctx Cache context.
     * @param tbl Table.
     * @param name Index name.
     * @param colsList Index columns.
     */
    public H2PkHashIndex(
        GridCacheContext<?, ?> cctx,
        GridH2Table tbl,
        String name,
        List<IndexColumn> colsList
    ) {

        IndexColumn[] cols = colsList.toArray(new IndexColumn[colsList.size()]);

        IndexColumn.mapColumns(cols, tbl);

        initBaseIndex(tbl, 0, name, cols, IndexType.createPrimaryKey(false, true));

        this.tbl = tbl;
        this.cctx = cctx;
    }

    /** {@inheritDoc} */
    @Override protected int segmentsCount() {
        return 1;
    }

    /** {@inheritDoc} */
    @Override public Cursor find(Session ses, final SearchRow lower, final SearchRow upper) {
        IndexingQueryFilter f = threadLocalFilter();
        IgniteBiPredicate<Object, Object> p = null;

        if (f != null) {
            String spaceName = getTable().cacheName();

            p = f.forSpace(spaceName);
        }

        KeyCacheObject lowerObj = null;
        KeyCacheObject upperObj = null;

        if (lower != null)
            lowerObj = cctx.toCacheKeyObject(lower.getValue(0).getObject());

        if (upper != null)
            upperObj = cctx.toCacheKeyObject(upper.getValue(0).getObject());

        try {
            List<GridCursor<? extends CacheDataRow>> cursors = new ArrayList<>();

            for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores())
                cursors.add(store.cursor(lowerObj, upperObj));

            return new H2Cursor(new CompositeGridCursor<>(cursors.iterator()), p);
        }
        catch (IgniteCheckedException e) {
            throw DbException.convert(e);
        }
    }

    /** {@inheritDoc} */
    @Override public boolean canScan() {
        return false;
    }

    /** {@inheritDoc} */
    @Override public GridH2Row findOne(GridH2Row row) {
        try {
            for (IgniteCacheOffheapManager.CacheDataStore store : cctx.offheap().cacheDataStores()) {
                CacheDataRow found = store.find(row.key);

                if (found != null)
                    tbl.rowDescriptor().createRow(row.key(), row.partition(), row.value(), row.version(), 0);
            }

            return null;
        }
        catch (IgniteCheckedException e) {
            throw DbException.convert(e);
        }
    }

    /** {@inheritDoc} */
    @SuppressWarnings("StatementWithEmptyBody")
    @Override public GridH2Row put(GridH2Row row) {
        // Should not be called directly. Rows are inserted into underlying cache data stores.

        assert false;

        throw DbException.getUnsupportedException("put");
    }

    /** {@inheritDoc} */
    @Override public GridH2Row remove(SearchRow row) {
        // Should not be called directly. Rows are removed from underlying cache data stores.

        assert false;

        throw DbException.getUnsupportedException("remove");
    }

    /** {@inheritDoc} */
    @Override public double getCost(Session ses, int[] masks, TableFilter[] filters, int filter, SortOrder sortOrder, HashSet<Column> allColumnsSet) {
        long rowCnt = getRowCountApproximation();

        double baseCost = getCostRangeIndex(masks, rowCnt, filters, filter, sortOrder, false, allColumnsSet);

        int mul = getDistributedMultiplier(ses, filters, filter);

        // TODO : How to calculate cost?

//        return mul * baseCost;
        return Double.MAX_VALUE;
    }

    /** {@inheritDoc} */
    @Override public long getRowCount(Session ses) {
        Cursor cursor = find(ses, null, null);

        long res = 0;

        while (cursor.next())
            res++;

        return res;
    }

    /** {@inheritDoc} */
    @Override public long getRowCountApproximation() {
        return 10_000; // TODO
    }

    /** {@inheritDoc} */
    @Override public boolean canGetFirstOrLast() {
        return false;
    }

    /** {@inheritDoc} */
    @Override public Cursor findFirstOrLast(Session ses, boolean b) {
        throw new UnsupportedOperationException();
    }

    /** {@inheritDoc} */
    @Nullable @Override protected IgniteTree doTakeSnapshot() {
        throw new AssertionError("This method must not be called for PK index");
    }

    /**
     * Cursor.
     */
    private class H2Cursor implements Cursor {
        /** */
        final GridCursor<? extends CacheDataRow> cursor;

        /** */
        final IgniteBiPredicate<Object, Object> filter;

        /**
         * @param cursor Cursor.
         * @param filter Filter.
         */
        private H2Cursor(GridCursor<? extends CacheDataRow> cursor, IgniteBiPredicate<Object, Object> filter) {
            assert cursor != null;

            this.cursor = cursor;
            this.filter = filter;
        }

        /** {@inheritDoc} */
        @Override public Row get() {
            try {
                CacheDataRow dataRow = cursor.get();

                GridH2Row row = tbl.rowDescriptor().createRow(dataRow.key(), dataRow.partition(), dataRow.value(), dataRow.version(), 0);

                row.link(dataRow.link());

                return row;
            }
            catch (IgniteCheckedException e) {
                throw DbException.convert(e);
            }
        }

        /** {@inheritDoc} */
        @Override public SearchRow getSearchRow() {
            return get();
        }

        /** {@inheritDoc} */
        @Override public boolean next() {
            try {
                while (cursor.next()) {
                    if (filter == null)
                        return true;

                    CacheDataRow dataRow = cursor.get();

                    GridH2Row row = tbl.rowDescriptor().createRow(dataRow.key(), dataRow.partition(), dataRow.value(), dataRow.version(), 0);

                    row.link(dataRow.link());

                    Object key = row.getValue(0).getObject();
                    Object val = row.getValue(1).getObject();

                    assert key != null;
                    assert val != null;

                    if (filter.apply(key, val))
                        return true;
                }

                return false;
            }
            catch (IgniteCheckedException e) {
                throw DbException.convert(e);
            }
        }

        /** {@inheritDoc} */
        @Override public boolean previous() {
            throw DbException.getUnsupportedException("previous");
        }
    }

    /**
     *
     */
    private static class CompositeGridCursor<T> implements GridCursor<T> {
        /** */
        private final Iterator<GridCursor<? extends T>> iter;

        /** */
        private GridCursor<? extends T> curr;

        /**
         *
         */
        public CompositeGridCursor(Iterator<GridCursor<? extends T>> iter) {
            this.iter = iter;

            if (iter.hasNext())
                curr = iter.next();
        }

        /** {@inheritDoc} */
        @Override public boolean next() throws IgniteCheckedException {
            if (curr.next())
                return true;

            while (iter.hasNext()) {
                curr = iter.next();

                if (curr.next())
                    return true;
            }

            return false;
        }

        /** {@inheritDoc} */
        @Override public T get() throws IgniteCheckedException {
            return curr.get();
        }
    }
}


text:
class Manifestation
  class Parse

    def initialize file
      @file = file
    end

    def is_manifest?
      @file.include? "manifest.json"
    end

    def compose
      if is_manifest?
        Manifestation.new(@file).compose
      else
        File.read @file
      end
    end

  end
end


text:
[![Build Status](https://travis-ci.org/ugjka/newyearsbot.svg?branch=master)](https://travis-ci.org/ugjka/newyearsbot)
[![Go Report Card](https://goreportcard.com/badge/github.com/ugjka/newyearsbot/nyb)](https://goreportcard.com/report/github.com/ugjka/newyearsbot/nyb)

New Year's Eve IRC party bot

Posts New Years for each timezone when they happen

```text
<hny2021> Happy New Year in American Samoa (Pago Pago), Niue (Alofi), United States of America (Midway Atoll)
<ugjka> !next
<hny2021> Next New Year in 25 minutes 9 seconds in Cambodia (Phnom Penh, Takeo), Christmas Island, Indonesia (Bandung, Bekasi, Depok, Jakarta, Medan, Palembang, Semarang, South Tangerang, Surabaya, Tangerang), Laos (Pakxe, Vientiane), Mongolia (Khovd), Russia (Krasnoyarsk, Novokuznetsk, Novosibirsk), Thailand (Bangkok, Chon Buri, Mueang Nonthaburi, Udon Thani), Vietnam
<ugjka> !last
<hny2021> Last NewYear 34 minutes 55 seconds ago in Australia (Mandurah, Perth, Western Australia), Brunei (Bandar Seri Begawan), China (Beijing, Chengdu, Chongqing, Dongguan, Guangzhou, Nanjing, Shanghai, Shenzhen, Tianjin, Wuhan), Hong Kong, Indonesia (Balikpapan, Banjarmasin, Makassar), Macau, Malaysia (Klang, Kota Bharu, Kuala Lumpur), Mongolia (Erdenet, Ulan Bator), Philippines (Manila), Russia (Irkutsk), Singapore, Taiwan
<ugjka> !hny Riga
<hny2021> New Year in Riga, Rīga, Vidzeme, LV-1050, Latvia will happen in 5 hours 25 minutes
<hny2021> Happy New Year in Nepal (Biratnagar, Kathmandu, Pokhara)
<hny2021> Next New Year in 14 minutes 57 seconds in India (Ahmedabad, Bangalore, Chennai, Hyderabad, Kanpur, Kolkata, Mumbai, New Delhi, Pune, Surat), Sri Lanka (Colombo)
```

## Bot's commands

- `!next` upcoming new year
- `!previous` previous new year
- `!remaining` number of remaining timezones
- `!hny <location>` get new year status for location
- `!time <location>` get current time in location
- `!time` UTC time
- `!help` show help

The command prefix `!` can be changed using the -prefix flag

## Pro-tip

- make sure your system's time is synchronized with NTP

## Installation

### 2021 versions

Arch linux PKGBUILD in archlinux folder

### Using make

You need make, go, go-tools

Build with `make`

Install with `make install`

Uninstall with `make uninstall`

Clean up with `make clean`


text:
        //~^ NOTE lint level defined here
        reason = "explicit anonymous lifetimes aid reasoning about ownership")]
#![warn(
    nonstandard_style,
    //~^ NOTE lint level defined here
    reason = r#"people shouldn't have to change their usual style habits
to contribute to our project"#
)]
#![allow(unused, reason = "unused code has never killed anypony")]

use std::fmt;

pub struct CheaterDetectionMechanism {}

impl fmt::Debug for CheaterDetectionMechanism {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        //~^ WARN hidden lifetime parameters in types are deprecated
        //~| NOTE explicit anonymous lifetimes aid
        //~| HELP indicate the anonymous lifetime
        fmt.debug_struct("CheaterDetectionMechanism").finish()
    }
}

fn main() {
    let Social_exchange_psychology = CheaterDetectionMechanism {};
    //~^ WARN should have a snake case name such as
    //~| NOTE people shouldn't have to change their usual style habits
}


text:
class Engine::Controller::ViewPaths < Array
  def self.default_view_paths=(view_paths)
    view_paths = [ view_paths ] unless view_paths.kind_of? Array
    default_view_paths = view_paths
  end

  def self.default_view_paths
    @default_view_paths ||= []
  end

  def self.load!
    # may use this to get away from instance-based view paths and use a single class-based set instead. Hope that made
    # sense, I'm tired.
  end

  def initialize(*a, &b)
    super
    concat self.class.default_view_paths
    uniq!
    #self << "app/views" unless self.include? "app/views"
  end

  # Returns a file path for the first matching view in this array.
  def find_view(engine, name)
    cache_key = "view-file:#{name}"
    c = Divinity.cache.read(cache_key)
    return c if c
    Divinity.cache.write(cache_key, r = engine.find_file(self.collect { |path| File.join(path, name) }))
    r
  rescue Errors::FileMissing
    raise Engine::View::MissingViewError, $!.message#"No view found for action: #{name} in view path #{self.inspect}"
  end
end


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Rhynchnostrigula Bat., J.L. Bezerra & Cavalc.

### Remarks
null


text:
<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>LFCS Database Project</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:700' rel='stylesheet' type='text/css'>
<link href="{{ url_for('static', filename='favicon.ico') }}" rel="icon" type="image">

<link href="https://cdn.datatables.net/1.10.12/css/dataTables.bootstrap.min.css" rel="stylesheet" />

<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" />

{% with messages = get_flashed_messages(with_categories=true) %}

{% endwith %}

{% include 'navbar.html' %}

Login

            <form role='form' action='{{url_for("login")}}' method="POST">

                    <input type="text" class="form-control" placeholder="username" name="username">
                    <input type="password" class="form-control" placeholder="password" name="password">

                    <button type="submit" class="btn btn-primary">Login</button>

            </form>

{% if current_user.authenticated %}

Create Backup

            <form role='form' action='{{url_for("create_backup")}}' method="POST">

                    <input type="text" class="form-control" placeholder="Backup name" name="backup_name">

                    <button type="submit" class="btn btn-primary">Create Backup</button>

            </form>

{% endif %}

    {% block content%}
    {% endblock %}

{% include 'navbottom.html' %}


text:
import bcrypt = require("bcrypt");
import jwt = require("jsonwebtoken");
import {Users} from "./user.model";
export function createUser(parentValue: any, args: any) {
    const newUser = new Users({
        email: args.email,
        password: bcrypt.hashSync(args.password, 10),
    });
    return newUser.save();
}

export function login(parentValue: any, {email, password}: {email: string, password: string}) {
    const result = Users.findOne({email}).exec()
        .then((user: any) => {
            // console.log(user);
            return bcrypt.compare(password, user.password).then(() => {
                const jwttoken = jwt.sign(
                    {email: user.email},
                    "secret",
                    {expiresIn: "7d"});
                return jwttoken;
            });
        });
    return result;
}


text:
namespace MiniAutoFac.UnitTest.TestClasses
{
    using MiniAutFac.Attributes;

    [ContainerType(typeof(ClassA))]
    class ClassA : IFoo
    {
    }

    class FooClass : IFoo
    {

    }
    interface IFoo
    {

    }
}


text:
package com.chatalytics.core.model.slack.json;

import com.chatalytics.core.model.data.Room;
import com.fasterxml.jackson.databind.ObjectMapper;

import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
 * Tests the {@link RoomDeserializer} for slack.
 *
 * @author giannis
 */
public class RoomDeserializerTest {

    private ObjectMapper objMapper;

    @Before
    public void setUp() throws Exception {
        objMapper = new ObjectMapper();
        objMapper.registerModule(new SlackJsonModule());
    }

    /**
     * Reads a JSON representation of a room and makes sure that all the fields are properly set.
     */
    @Test
    public void testDeserialize() throws Exception {
        Room r = objMapper.readValue(roomJsonStr, Room.class);
        assertEquals("C024BE91L", r.getRoomId());
        assertEquals(new DateTime(1360782804L * 1000), r.getCreationDate());
        assertEquals("fun", r.getName());
        assertEquals("U024BE7LH", r.getOwnerUserId());
        assertEquals("C024BE91L", r.getRoomId());
        assertEquals("Fun times", r.getTopic());
        assertTrue(r.isArchived());
        assertFalse(r.isPrivateRoom());
        assertNull(r.getXmppJid());
        assertNull(r.getGuestAccessURL());
        assertNull(r.getLastActiveDate());

        r = objMapper.readValue(privateRoomJsonStr, Room.class);
        assertEquals("G024BE91L", r.getRoomId());
        assertEquals(new DateTime(1360782804L * 1000), r.getCreationDate());
        assertEquals("fun", r.getName());
        assertEquals("U024BE7LH", r.getOwnerUserId());
        assertEquals("G024BE91L", r.getRoomId());
        assertEquals("Fun times", r.getTopic());
        assertTrue(r.isArchived());
        assertTrue(r.isPrivateRoom());
        assertNull(r.getXmppJid());
        assertNull(r.getGuestAccessURL());
        assertNull(r.getLastActiveDate());
    }

    private final String roomJsonStr = "{" +
                                           "\"id\": \"C024BE91L\"," +
                                           "\"name\": \"fun\"," +
                                           "\"created\": 1360782804," +
                                           "\"creator\": \"U024BE7LH\"," +
                                           "\"is_archived\": true," +
                                           "\"is_member\": false," +
                                           "\"num_members\": 6," +
                                           "\"topic\": {" +
                                               "\"value\": \"Fun times\"," +
                                               "\"creator\": \"U024BE7LV\"," +
                                               "\"last_set\": 1369677212" +
                                           "}," +
                                           "\"purpose\": {" +
                                               "\"value\": \"This channel is for fun\"," +
                                               "\"creator\": \"U024BE7LH\"," +
                                               "\"last_set\": 1360782804" +
                                           "}" +
                                       "}";

    private final String privateRoomJsonStr = "{" +
                                                  "\"id\": \"G024BE91L\"," +
                                                  "\"name\": \"fun\"," +
                                                  "\"created\": 1360782804," +
                                                  "\"creator\": \"U024BE7LH\"," +
                                                  "\"is_archived\": true," +
                                                  "\"is_member\": false," +
                                                  "\"num_members\": 6," +
                                                  "\"topic\": {" +
                                                      "\"value\": \"Fun times\"," +
                                                      "\"creator\": \"U024BE7LV\"," +
                                                      "\"last_set\": 1369677212" +
                                                  "}," +
                                                  "\"purpose\": {" +
                                                      "\"value\": \"This channel is for fun\"," +
                                                      "\"creator\": \"U024BE7LH\"," +
                                                      "\"last_set\": 1360782804" +
                                                  "}" +
                                              "}";

}


text:
'use strict';

module.exports = [
	'node_modules/angular/angular.js',
	'node_modules/angular-route/angular-route.js',
	'node_modules/angular-ui-router/release/angular-ui-router.js'
];


text:
require "spec_helper"

describe "Capybara Examples where Capybara is included last", :type => :feature, :sauce => true do
  context "When calling the #page method" do
    it "should get access to a Capybara Session object" do
      page.should be_a_kind_of Capybara::Session
    end

    it "should not output a deprecation message" do
      self.should_not_receive(:warn).with(page_deprecation_warning)
    end
  end

  it "should not create a new driver" do
    ::Sauce::Selenium2.should_not_receive(:new)
    visit "http://wwww.google.com"
  end
end


text:
package com.sleepycat.db;

import com.sleepycat.db.internal.DbConstants;

/**
A class that provides definitions for the types of network ack policyto use
when transmitting messages between replication sites using theReplication
Manager.
<p>
Set using the {@link com.sleepycat.db.EnvironmentConfig#setReplicationManagerAckPolicy EnvironmentConfig.setReplicationManagerAckPolicy} API.
*/
public final class ReplicationManagerAckPolicy {

    /**
    The master should wait until all replication clients have acknowledged
    each permanent replication message.
    */
    public static final ReplicationManagerAckPolicy ALL =
        new ReplicationManagerAckPolicy("ALL", DbConstants.DB_REPMGR_ACKS_ALL);

    /**
    The master should wait until all electable peers have acknowledged
    each permanent replication message (where "electable peer" means a
    client capable of being subsequently elected master of the
    replication group).
    */
    public static final ReplicationManagerAckPolicy ALL_PEERS =
        new ReplicationManagerAckPolicy(
        "ALL_PEERS", DbConstants.DB_REPMGR_ACKS_ALL_PEERS);

    /**
    The master should not wait for any client replication message
    acknowledgments.
    */
    public static final ReplicationManagerAckPolicy NONE =
        new ReplicationManagerAckPolicy(
        "NONE", DbConstants.DB_REPMGR_ACKS_NONE);

    /**
    The master should wait until at least one client site has acknowledged
    each permanent replication message.
    */
    public static final ReplicationManagerAckPolicy ONE =
        new ReplicationManagerAckPolicy("ONE", DbConstants.DB_REPMGR_ACKS_ONE);

    /**
    The master should wait until at least one electable peer has acknowledged
    each permanent replication message (where "electable peer" means a client
    capable of being subsequently elected master of the replication group).
    */
    public static final ReplicationManagerAckPolicy ONE_PEER =
        new ReplicationManagerAckPolicy(
            "ONE_PEER", DbConstants.DB_REPMGR_ACKS_ONE_PEER);

    /**
    The master should wait until it has received acknowledgements from the
    minimum number of electable peers sufficient to ensure that the effect
    of the permanent record remains durable if an election is held (where
    "electable peer" means a client capable of being subsequently elected
    master of the replication group). This is the default acknowledgement
    policy.
    */
    public static final ReplicationManagerAckPolicy QUORUM =
        new ReplicationManagerAckPolicy(
            "QUORUM", DbConstants.DB_REPMGR_ACKS_QUORUM);

    /* package */
    static ReplicationManagerAckPolicy fromInt(int type) {
        switch(type) {
        case DbConstants.DB_REPMGR_ACKS_ALL:
            return ALL;
        case DbConstants.DB_REPMGR_ACKS_ALL_PEERS:
            return ALL_PEERS;
        case DbConstants.DB_REPMGR_ACKS_NONE:
            return NONE;
        case DbConstants.DB_REPMGR_ACKS_ONE:
            return ONE;
        case DbConstants.DB_REPMGR_ACKS_ONE_PEER:
            return ONE_PEER;
        case DbConstants.DB_REPMGR_ACKS_QUORUM:
            return QUORUM;
        default:
            throw new IllegalArgumentException(
                "Unknown ACK policy: " + type);
        }
    }

    private String statusName;
    private int id;

    private ReplicationManagerAckPolicy(final String statusName, final int id) {
        this.statusName = statusName;
        this.id = id;
    }

    /* package */
    int getId() {
        return id;
    }

    /** {@inheritDoc} */
    public String toString() {
        return "ReplicationManagerAckPolicy." + statusName;
    }
}


text:
"use strict";

function lpad0(text, length) {
  // Take this, NPM.
  while (length > text.length) {
    text = '0'.concat(text);
  }

  return text;
}

function maybeCountryFlag(cc) {
  if (!/^[A-Z]{2}$/.test(cc)) return '';
  return String.fromCodePoint(0x1F1A5 + cc.charCodeAt(0)) +
    String.fromCodePoint(0x1F1A5 + cc.charCodeAt(1)) + ' ';
}

function onIDChange(e) {
  // Empty addresses don't deserve an error.
  if (!this.value.length) {
    document.getElementById('error').innerText = '';
    document.getElementById('results').style.display = 'none';
    return;
  }

  // We only work with valid 24-bit IDs.
  var addrValid = /^[0-9a-fA-F]{6}$/.test(this.value);

  if (!addrValid) {
    document.getElementById('error').innerText =
      'Address ' + this.value + ' is not a hex ICAO24 address.';
    document.getElementById('results').style.display = 'none';

    document.getElementById('id').innerText = '';
    document.getElementById('country').innerText = '';
    document.getElementById('tail_number').innerText = '';
    return;
  }

  var icao24 = Number.parseInt(this.value, 16);

  // Look up the address details if we think we have an ICAO24.
  var lookup = Address.Lookup(icao24);
  var addressHex = lpad0(icao24.toString(16), 6).toUpperCase();
  var addressBin = lpad0(icao24.toString(2), 24);

  // Make the results bookmarkable.
  window.location.hash = window.encodeURIComponent(addressHex);

  // If we know something about the aircraft..
  if (lookup) {
    document.getElementById('error').innerText = '';
    document.getElementById('results').style.display = null;

    document.getElementById('id').innerText =
      addressHex + ' (hex)\n' +
      addressBin.substr(0, lookup.prefix.length) + ' ' +
      addressBin.substr(lookup.prefix.length);

    document.getElementById('country').innerText =
      maybeCountryFlag(lookup.country_code) +
      lookup.location_name + ' (' + lookup.country_code + ')\n' +
      lookup.location_name + ' has been allocated ' +
      Math.pow(2, 24 - lookup.prefix.length) + ' aircraft addresses.';

    // Depending on the country, we may be able to decode a tail number.
    if (!lookup.tail_algorithm) {
      document.getElementById('tail_number').innerText =
        'No tail number mapping for ' + lookup.location_name + ' is known.';
    } else {
      // If the country has a mapping, give it a go.
      var tailno = lookup.tail_algorithm(icao24);

      if (tailno) {
        document.getElementById('tail_number').innerText = tailno;
      } else {
        // Not all values have a valid tail number, especially for the 32- and
        // 64-bit packings of tail ID.
        document.getElementById('tail_number').innerText =
          'Could not determine a tail number - is the address valid?';
      }
    }
  } else {
    // Clear everything on no results.
    document.getElementById('error').innerText =
      'We don\'t know anything about address ' + addressHex + '.';
    document.getElementById('results').style.display = 'none';

    document.getElementById('id').innerText = '';
    document.getElementById('country').innerText = '';
    document.getElementById('tail_number').innerText = '';
  }
}

function onHashChange(e) {
  // Handle URL editing, or bookmark clicks with the page open.
  var hash = window.location.hash ?
    window.decodeURIComponent(window.location.hash.substr(1)) : null;

  // But only try to decode real ICAO24s. Bad links don't get attention.
  if (/^[0-9A-Fa-f]{6}$/.test(hash)) {
    // Don't update the URL if only the case differs; this is to avoid
    // a lower-case UI entry causing us to uppercase the text box value and
    // reset the cursor position.
    if (hash.toLowerCase() !=
        document.getElementById('address').value.toLowerCase()) {
      document.getElementById('address').value = hash;
    }

    // Update the results text.
    onIDChange.bind(document.getElementById('address'))();
  }
}

window.addEventListener('load', function() {
  document.getElementById('address').addEventListener('change', onIDChange);
  document.getElementById('address').addEventListener('input', onIDChange);
  window.addEventListener('hashchange', onHashChange);

  onHashChange();
});


text:
namespace blink {
namespace {

DartGCContext* g_gc_context = nullptr;

DartWrappable* GetWrappable(intptr_t* fields) {
  return reinterpret_cast<DartWrappable*>(fields[DartWrappable::kPeerIndex]);
}

void Visit(void* isolate_callback_data,
           Dart_WeakPersistentHandle handle,
           intptr_t native_field_count,
           intptr_t* native_fields) {
  if (!native_field_count)
    return;
  DCHECK(native_field_count == DartWrappable::kNumberOfNativeFields);
  DartGCVisitor visitor(g_gc_context);
  GetWrappable(native_fields)->AcceptDartGCVisitor(visitor);
}

}  // namespace

void DartGCPrologue() {
  TRACE_EVENT_ASYNC_BEGIN0("sky", "DartGC", 0);

  Dart_EnterScope();
  DCHECK(!g_gc_context);
  g_gc_context = new DartGCContext();
  Dart_VisitPrologueWeakHandles(Visit);
}

void DartGCEpilogue() {
  delete g_gc_context;
  g_gc_context = nullptr;
  Dart_ExitScope();

  TRACE_EVENT_ASYNC_END0("sky", "DartGC", 0);
}

}  // namespace blink


text:
(function () {
  'use strict';

  if (typeof define === 'function' && define.amd) {
    define('Orbicular', ['angular'], angularOrbicular);
  } else {
    angularOrbicular(angular);
  }

  function angularOrbicular(angular) {
    return angular.module('Orbicular', []).

      // isolated circular progress bar
      directive('orbicular', ['$window', function (windowRef) {

        // Constants here reduce memory requirements of each circle
        var $window = angular.element(windowRef),

          // Cache event strings
          resizeEvents = 'orientationchange resize',

          // Set the rotation of the square
          updateProgress = function (circles, pos, modifiers) {
            var modifiedPos,
              circle,
              i;

            // If total is 0 or negative it can lead to Infinity or NaN values
            if (!isFinite(pos)) {
              pos = 0;
            }

            for (i = 0; i < circles.length; i += 1) {
              if (modifiers[i] === 0) {
                continue;
              }

              modifiedPos = pos * modifiers[i];
              circle = circles[i];

              circle.css({
                '-webkit-transform': 'rotate(' + modifiedPos + 'deg)',
                '-moz-transform': 'rotate(' + modifiedPos + 'deg)',
                '-ms-transform': 'rotate(' + modifiedPos + 'deg)',
                '-o-transform': 'rotate(' + modifiedPos + 'deg)',
                'transform': 'rotate(' + modifiedPos + 'deg)'
              });
            }
          };

        return {
          template:
              '
' +
                '

' +
              '
' +
              '
' +
                '

' +
                '

' +
              '
' +

              // optional shadow
              '

' +
              '
' +
                '
' +
                  '
' +
                    '

' +
                  '
' +
                '
' +
              '
',
          transclude: true,
          restrict: 'EA',
          scope: {
            current: '=progression',
            total: '='
          },
          link: function (scope, element, attrs) {
            var circles = [],
              modifiers = attrs.hasOwnProperty('counterclockwise') ? [-1,1,-2,1,2] : [1,1,0,1,2],

              // Width must be an even number of pixels for the effect to work.
              setWidth = function () {
                var width = element.prop('offsetWidth');
                element.css('font-size', width - (width % 2) + 'px');
              },

              update = function () {
                updateProgress(circles,
                  Math.min(1, scope.current / scope.total) * 180.0,
                  modifiers
                );
              };

            /**
             * circles are:
             * 0: .co-full
             * 1: .co-full > .co-fill
             * 2: .co-half
             * 3: .co-half > .co-fill
             * 4: .co-half > .co-fix
             **/
            circles.push(angular.element(element.children()[0]));

            circles.push(angular.element(
              angular.element(
                element.children()[0]
              ).children()[0]
            ));

            circles.push(angular.element(element.children()[1]));

            circles.push(angular.element(
              angular.element(
                element.children()[1]
              ).children()[0]
            ));

            circles.push(angular.element(
              angular.element(
                element.children()[1]
              ).children()[1]
            ));

            // we have to use em's for the clip function to work like a percentage
            // so we have to manually perform the resize based on width
            setWidth();
            scope.$on('orb width', setWidth); // for programmatic resizing

            // Optionally resize
            if (attrs.hasOwnProperty('resize')) {
              scope.$on('$destroy', function () {
                $window.off(resizeEvents, setWidth);
              });
              $window.on(resizeEvents, setWidth);
            }

            // we watch for changes to the progress indicator of the parent scope
            scope.$watch('current', update);
            scope.$watch('total', update);
          }
        };
      }]);
  }
}());


text:
package etree

import (
	"io"
	"testing"
)

func checkEq(t *testing.T, got, want string) {
	if got == want {
		return
	}
	t.Errorf(
		"etree: unexpected result.\nGot:\n%s\nWanted:\n%s\n",
		got, want)
}

func TestDocument(t *testing.T) {

	// Create a document
	doc := NewDocument()
	doc.CreateProcInst("xml", `version="1.0" encoding="UTF-8"`)
	doc.CreateProcInst("xml-stylesheet", `type="text/xsl" href="style.xsl"`)
	store := doc.CreateElement("store")
	store.CreateAttr("xmlns:t", "urn:books-com:titles")
	store.CreateDirective("Directive")
	store.CreateComment("This is a comment")
	book := store.CreateElement("book")
	book.CreateAttr("lang", "fr")
	book.CreateAttr("lang", "en")
	title := book.CreateElement("t:title")
	title.SetText("Nicholas Nickleby")
	title.SetText("Great Expectations")
	author := book.CreateElement("author")
	author.CreateCharData("Charles Dickens")
	doc.IndentTabs()

	// Serialize the document to a string
	s, err := doc.WriteToString()
	if err != nil {
		t.Error("etree: failed to serialize document")
	}

	// Make sure the serialized XML matches expectation.
	expected := `<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<store xmlns:t="urn:books-com:titles">
	<!Directive>
	<!--This is a comment-->
	<book lang="en">
		<t:title>Great Expectations</t:title>
		<author>Charles Dickens</author>
	</book>
</store>
`
	checkEq(t, s, expected)

	// Test the structure of the XML
	if doc.Root() != store {
		t.Error("etree: root mismatch")
	}
	if len(store.ChildElements()) != 1 || len(store.Child) != 7 {
		t.Error("etree: incorrect tree structure")
	}
	if len(book.ChildElements()) != 2 || len(book.Attr) != 1 || len(book.Child) != 5 {
		t.Error("etree: incorrect tree structure")
	}
	if len(title.ChildElements()) != 0 || len(title.Child) != 1 || len(title.Attr) != 0 {
		t.Error("etree: incorrect tree structure")
	}
	if len(author.ChildElements()) != 0 || len(author.Child) != 1 || len(author.Attr) != 0 {
		t.Error("etree: incorrect tree structure")
	}
	if book.parent != store || store.parent != &doc.Element || doc.parent != nil {
		t.Error("etree: incorrect tree structure")
	}
	if title.parent != book || author.parent != book {
		t.Error("etree: incorrect tree structure")
	}

	// Perform some basic queries on the document
	elements := doc.SelectElements("store")
	if len(elements) != 1 || elements[0] != store {
		t.Error("etree: incorrect SelectElements result")
	}
	element := doc.SelectElement("store")
	if element != store {
		t.Error("etree: incorrect SelectElement result")
	}
	elements = store.SelectElements("book")
	if len(elements) != 1 || elements[0] != book {
		t.Error("etree: incorrect SelectElements result")
	}
	element = store.SelectElement("book")
	if element != book {
		t.Error("etree: incorrect SelectElement result")
	}
	attr := book.SelectAttr("lang")
	if attr == nil || attr.Key != "lang" || attr.Value != "en" {
		t.Error("etree: incorrect SelectAttr result")
	}
	if book.SelectAttrValue("lang", "unknown") != "en" {
		t.Error("etree: incorrect SelectAttrValue result")
	}
	if book.SelectAttrValue("t:missing", "unknown") != "unknown" {
		t.Error("etree: incorrect SelectAttrValue result")
	}
	attr = book.RemoveAttr("lang")
	if attr.Value != "en" {
		t.Error("etree: incorrect RemoveAttr result")
	}
	book.CreateAttr("lang", "de")
	attr = book.RemoveAttr("lang")
	if attr.Value != "de" {
		t.Error("etree: incorrect RemoveAttr result")
	}
	element = book.SelectElement("t:title")
	if element != title || element.Text() != "Great Expectations" || len(element.Attr) != 0 {
		t.Error("etree: incorrect SelectElement result")
	}
	element = book.SelectElement("title")
	if element != title {
		t.Error("etree: incorrect SelectElement result")
	}
	element = book.SelectElement("p:title")
	if element != nil {
		t.Error("etree: incorrect SelectElement result")
	}
	element = book.RemoveChild(title).(*Element)
	if element != title {
		t.Error("etree: incorrect RemoveElement result")
	}
	element = book.SelectElement("title")
	if element != nil {
		t.Error("etree: incorrect SelectElement result")
	}
}

func TestDocumentRead_NonUTF8Encodings(t *testing.T) {
	s := `<?xml version="1.0" encoding="ISO-8859-1"?>
	<store>
	<book lang="en">
		<title>Great Expectations</title>
		<author>Charles Dickens</author>
	</book>
</store>`

	doc := NewDocument()
	doc.ReadSettings.CharsetReader = func(label string, input io.Reader) (io.Reader, error) {
		return input, nil
	}
	err := doc.ReadFromString(s)
	if err != nil {
		t.Fatal("etree: incorrect ReadFromString result")
	}
}

func TestDocumentRead_Permissive(t *testing.T) {
	s := "<select disabled></select>"

	doc := NewDocument()
	err := doc.ReadFromString(s)
	if err == nil {
		t.Fatal("etree: incorrect ReadFromString result")
	}

	doc.ReadSettings.Permissive = true
	err = doc.ReadFromString(s)
	if err != nil {
		t.Fatal("etree: incorrect ReadFromString result")
	}
}

func TestWriteSettings(t *testing.T) {
	BOM := "\xef\xbb\xbf"

	doc := NewDocument()
	doc.WriteSettings.CanonicalEndTags = true
	doc.WriteSettings.CanonicalText = true
	doc.WriteSettings.CanonicalAttrVal = true
	doc.CreateCharData(BOM)
	doc.CreateProcInst("xml-stylesheet", `type="text/xsl" href="style.xsl"`)

	people := doc.CreateElement("People")
	people.CreateComment("These are all known people")

	jon := people.CreateElement("Person")
	jon.CreateAttr("name", "Jon O'Reilly")
	jon.SetText("\r<'\">&")

	sally := people.CreateElement("Person")
	sally.CreateAttr("name", "Sally")
	sally.CreateAttr("escape", "\r\n\t<'\">&")

	doc.Indent(2)
	s, err := doc.WriteToString()
	if err != nil {
		t.Error("etree: WriteSettings WriteTo produced incorrect result.")
	}

	expected := BOM + `<?xml-stylesheet type="text/xsl" href="style.xsl"?>
<People>
  <!--These are all known people-->
  <Person name="Jon O'Reilly">
<'">&</Person>
  <Person name="Sally" escape="
	<'">&"></Person>
</People>
`
	checkEq(t, s, expected)
}

func TestCopy(t *testing.T) {
	s := `<store>
	<book lang="en">
		<title>Great Expectations</title>
		<author>Charles Dickens</author>
	</book>
</store>`

	doc := NewDocument()
	err := doc.ReadFromString(s)
	if err != nil {
		t.Fatal("etree: incorrect ReadFromString result")
	}

	s1, err := doc.WriteToString()
	if err != nil {
		t.Error("etree: incorrect WriteToString result")
	}

	doc2 := doc.Copy()
	s2, err := doc2.WriteToString()
	if err != nil {
		t.Error("etree: incorrect Copy result")
	}

	if s1 != s2 {
		t.Error("etree: mismatched Copy result")
		t.Error("wanted:\n" + s1)
		t.Error("got:\n" + s2)
	}

	e1 := doc.FindElement("./store/book/title")
	e2 := doc2.FindElement("./store/book/title")
	if e1 == nil || e2 == nil {
		t.Error("etree: incorrect FindElement result")
	}
	if e1 == e2 {
		t.Error("etree: incorrect FindElement result")
	}

	e1.parent.RemoveChild(e1)
	s1, _ = doc.WriteToString()
	s2, _ = doc2.WriteToString()
	if s1 == s2 {
		t.Error("etree: incorrect result after RemoveElement")
	}
}

func TestInsertChild(t *testing.T) {
	testdoc := `<book lang="en">
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
</book>
`

	doc := NewDocument()
	err := doc.ReadFromString(testdoc)
	if err != nil {
		t.Fatal("etree ReadFromString: " + err.Error())
	}

	year := NewElement("year")
	year.SetText("1861")

	book := doc.FindElement("//book")
	book.InsertChild(book.SelectElement("t:title"), year)

	expected1 := `<book lang="en">
  <year>1861</year>
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
</book>
`
	doc.Indent(2)
	s1, _ := doc.WriteToString()
	checkEq(t, s1, expected1)

	book.RemoveChild(year)
	book.InsertChild(book.SelectElement("author"), year)

	expected2 := `<book lang="en">
  <t:title>Great Expectations</t:title>
  <year>1861</year>
  <author>Charles Dickens</author>
</book>
`
	doc.Indent(2)
	s2, _ := doc.WriteToString()
	checkEq(t, s2, expected2)

	book.RemoveChild(year)
	book.InsertChild(book.SelectElement("UNKNOWN"), year)

	expected3 := `<book lang="en">
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
  <year>1861</year>
</book>
`
	doc.Indent(2)
	s3, _ := doc.WriteToString()
	checkEq(t, s3, expected3)

	book.RemoveChild(year)
	book.InsertChild(nil, year)

	expected4 := `<book lang="en">
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
  <year>1861</year>
</book>
`
	doc.Indent(2)
	s4, _ := doc.WriteToString()
	checkEq(t, s4, expected4)
}

func TestAddChild(t *testing.T) {
	testdoc := `<book lang="en">
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
</book>
`
	doc1 := NewDocument()
	err := doc1.ReadFromString(testdoc)
	if err != nil {
		t.Fatal("etree ReadFromString: " + err.Error())
	}

	doc2 := NewDocument()
	root := doc2.CreateElement("root")

	for _, e := range doc1.FindElements("//book/*") {
		root.AddChild(e)
	}

	expected1 := `<book lang="en"/>
`
	doc1.Indent(2)
	s1, _ := doc1.WriteToString()
	checkEq(t, s1, expected1)

	expected2 := `<root>
  <t:title>Great Expectations</t:title>
  <author>Charles Dickens</author>
</root>
`
	doc2.Indent(2)
	s2, _ := doc2.WriteToString()
	checkEq(t, s2, expected2)
}

func TestSetRoot(t *testing.T) {
	testdoc := `<?test a="wow"?>
<book>
  <title>Great Expectations</title>
  <author>Charles Dickens</author>
</book>
`
	doc := NewDocument()
	err := doc.ReadFromString(testdoc)
	if err != nil {
		t.Fatal("etree ReadFromString: " + err.Error())
	}

	origroot := doc.Root()
	if origroot.Parent() != &doc.Element {
		t.Error("Root incorrect")
	}

	newroot := NewElement("root")
	doc.SetRoot(newroot)

	if doc.Root() != newroot {
		t.Error("doc.Root() != newroot")
	}
	if origroot.Parent() != nil {
		t.Error("origroot.Parent() != nil")
	}

	expected1 := `<?test a="wow"?>
<root/>
`
	doc.Indent(2)
	s1, _ := doc.WriteToString()
	checkEq(t, s1, expected1)

	doc.SetRoot(origroot)
	doc.Indent(2)
	expected2 := testdoc
	s2, _ := doc.WriteToString()
	checkEq(t, s2, expected2)

	doc2 := NewDocument()
	doc2.CreateProcInst("test", `a="wow"`)
	doc2.SetRoot(NewElement("root"))
	doc2.Indent(2)
	expected3 := expected1
	s3, _ := doc2.WriteToString()
	checkEq(t, s3, expected3)

	doc2.SetRoot(doc.Root())
	doc2.Indent(2)
	expected4 := testdoc
	s4, _ := doc2.WriteToString()
	checkEq(t, s4, expected4)

	expected5 := `<?test a="wow"?>
`
	doc.Indent(2)
	s5, _ := doc.WriteToString()
	checkEq(t, s5, expected5)
}


text:
const environment = process.env.NODE_ENV || 'development';
const config = require('../knexfile.js')[environment];

module.exports = require('knex')(config);


text:
import React, { Component } from 'react';
import { BackAndroid, StyleSheet } from 'react-native';
import { connect } from 'react-redux';
import { TabViewAnimated, TabBar } from 'react-native-tab-view';
import Icon from 'react-native-vector-icons/MaterialIcons';

import RadarChart from './RadarChart';
import PieChart from './PieChart';
import StackedBarChart from './StackedBarChart';

import colors from '../../themes/Colors';

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  tabBar: {
    elevation: 5,
    backgroundColor: colors.main,
  },
  indicator: {
    // backgroundColor: 'white',
    height: 3
  },
  page: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  icon: {

  }
});

class DetailedMonthReportContainer extends Component {
  state = {
    index: 0,
    routes: [
      { key: '1', title: 'First' },
      { key: '2', title: 'Second' },
      { key: '3', title: 'Third' },
    ],
    visitedRoutes: [0]
  };

  componentDidMount() {
    BackAndroid.addEventListener('hardwareBackPress', this._handleBackAction);
  }

  componentWillUnmount() {
    BackAndroid.removeEventListener('hardwareBackPress', this._handleBackAction);
  }

  _handleBackAction = () => {
    const { visitedRoutes } = this.state;
    visitedRoutes.pop();

    if (visitedRoutes.length !== 0) {

      this.setState({
        index: visitedRoutes[visitedRoutes.length - 1],
        visitedRoutes
      });
      return true;
    }
  }

  _handleChangeTab = (index) => {
    const { visitedRoutes } = this.state;

    visitedRoutes.push(index);
    this.setState({
      visitedRoutes,
      index
    });
  };

  _renderHeader = (props) => {
    return <TabBar
      indicatorStyle={styles.indicator}
      renderIcon={this._renderIcon}
      renderLabel={() => { }}
      style={styles.tabBar}  {...props} />;
  };

  _renderIcon = ({ route }) => {
    let icon;

    switch (route.key) {
      case '1':
        icon = 'track-changes';
        break;
      case '2':
        icon = 'pie-chart';
        break;
      case '3':
        icon = 'trending-up';
        break;
    }
    return (
      <Icon
        color={colors.snow}
        name={icon}
        size={25}
        style={styles.icon}
      />
    );
  };

  _renderScene = ({ route }) => {
    switch (route.key) {
      case '1':
        return <RadarChart />;
      case '2':
        return <PieChart />;
      case '3':
        return <StackedBarChart />;
      default:
        return null;
    }
  };

  render() {
    return (
      <TabViewAnimated
        navigationState={this.state}
        onRequestChangeTab={this._handleChangeTab}
        renderHeader={this._renderHeader}
        renderLabel={this._renderLabel}
        renderScene={this._renderScene}
        style={styles.container}
      />
    );
  }
}

DetailedMonthReportContainer.propTypes = {

};

function mapStateToProps(state) {
  return {

  };
}

export default connect(
  mapStateToProps
)(DetailedMonthReportContainer);


text:
package com.tern.util;

import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.ParseException;

public final class DateTimeUtil
{
    private DateTimeUtil()
    {}

    public static String now()
    {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dt = sdf.format(new Date());
        return dt;
    }

    public static String getNowYMD(){
     String str = now();
     return str.substring(0,10);
    }

    public static String now(String pattern)
    {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        String dt = sdf.format(new Date());
        return dt;
    }

    public static String toString(Date date, String pattern)
    {
        if (date == null)
        {
            return "";
        }
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        return sdf.format(date);
    }

    public static Date toDate(String param)
    {
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try
        {
            date = sdf.parse(param);
        }
        catch (ParseException ex)
        {
        }
        return date;
    }

    public static Date toDate(String param, String pattern)
    {
    	if(param==null) return null;
        Date date = null;
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        try
        {
            date = sdf.parse(param);
        }
        catch (ParseException ex)
        {
        }
        return date;
    }

    public static Date getStartOfMonth(Date date)
    {
    	java.util.Calendar cal   =  java.util.Calendar.getInstance();
    	cal.setTime(date);
    	cal.set(java.util.Calendar.DATE,1);
    	return cal.getTime();
    }

    public static Date getEndOfMonth(Date date)
    {
    	java.util.Calendar cal   =  java.util.Calendar.getInstance();
    	cal.setTime(date);
    	cal.add(java.util.Calendar.MONTH,1);
    	cal.add(java.util.Calendar.DATE, -1);//����һ�²���ȥһ��
    	return cal.getTime();
    }

    public static int getMonthofNow()
    {

    	return java.util.Calendar.MONTH;
    }

    public static int getYearofNow()
    {

    	return java.util.Calendar.YEAR;
    }
}


text:
package org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types;

// CHECKSTYLE:OFF (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.AbstractOpenType;
import org.apache.olingo.ext.proxy.api.OperationType;
// CHECKSTYLE:ON (Maven checkstyle)
import org.apache.olingo.ext.proxy.api.annotations.Key;
import org.apache.olingo.ext.proxy.api.annotations.Parameter;

@org.apache.olingo.ext.proxy.api.annotations.Namespace("Microsoft.Test.OData.Services.ODataWCFService")
@org.apache.olingo.ext.proxy.api.annotations.EntityType(name = "Company",
    openType = true,
    hasStream = false,
    isAbstract = false)
public interface Company
    extends org.apache.olingo.ext.proxy.api.Annotatable,
    org.apache.olingo.ext.proxy.api.EntityType<Company>, org.apache.olingo.ext.proxy.api.StructuredQuery<Company>,
    AbstractOpenType {

  @Key
  @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyID",
      type = "Edm.Int32",
      nullable = false,
      defaultValue = "",
      maxLenght = Integer.MAX_VALUE,
      fixedLenght = false,
      precision = 0,
      scale = 0,
      unicode = true,
      collation = "",
      srid = "")
  java.lang.Integer getCompanyID();

  void setCompanyID(java.lang.Integer _companyID);

  @org.apache.olingo.ext.proxy.api.annotations.Property(name = "CompanyCategory",
      type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory",
      nullable = true,
      defaultValue = "",
      maxLenght = Integer.MAX_VALUE,
      fixedLenght = false,
      precision = 0,
      scale = 0,
      unicode = true,
      collation = "",
      srid = "")
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory
      getCompanyCategory();

      void
      setCompanyCategory(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.CompanyCategory _companyCategory);

  @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Revenue",
      type = "Edm.Int64",
      nullable = false,
      defaultValue = "",
      maxLenght = Integer.MAX_VALUE,
      fixedLenght = false,
      precision = 0,
      scale = 0,
      unicode = true,
      collation = "",
      srid = "")
  java.lang.Long getRevenue();

  void setRevenue(java.lang.Long _revenue);

  @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Name",
      type = "Edm.String",
      nullable = true,
      defaultValue = "",
      maxLenght = Integer.MAX_VALUE,
      fixedLenght = false,
      precision = 0,
      scale = 0,
      unicode = true,
      collation = "",
      srid = "")
  java.lang.String getName();

  void setName(java.lang.String _name);

  @org.apache.olingo.ext.proxy.api.annotations.Property(name = "Address",
      type = "Microsoft.Test.OData.Services.ODataWCFService.Address",
      nullable = true,
      defaultValue = "",
      maxLenght = Integer.MAX_VALUE,
      fixedLenght = false,
      precision = 0,
      scale = 0,
      unicode = true,
      collation = "",
      srid = "")
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address getAddress();

      void
      setAddress(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Address _address);

  @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Employees",
      type = "Microsoft.Test.OData.Services.ODataWCFService.Employee",
      targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
      targetContainer = "InMemoryEntities",
      targetEntitySet = "Employees",
      containsTarget = false)
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection
      getEmployees();

      void
      setEmployees(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.EmployeeCollection _employees);

  @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "VipCustomer",
      type = "Microsoft.Test.OData.Services.ODataWCFService.Customer",
      targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
      targetContainer = "InMemoryEntities",
      targetEntitySet = "VipCustomer",
      containsTarget = false)
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer
      getVipCustomer();

      void
      setVipCustomer(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer _vipCustomer);

  @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "Departments",
      type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
      targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
      targetContainer = "InMemoryEntities",
      targetEntitySet = "Departments",
      containsTarget = false)
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection
      getDepartments();

      void
      setDepartments(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.DepartmentCollection _departments);

  @org.apache.olingo.ext.proxy.api.annotations.NavigationProperty(name = "CoreDepartment",
      type = "Microsoft.Test.OData.Services.ODataWCFService.Department",
      targetSchema = "Microsoft.Test.OData.Services.ODataWCFService",
      targetContainer = "InMemoryEntities",
      targetEntitySet = "Departments",
      containsTarget = false)
  org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department
      getCoreDepartment();

      void
      setCoreDepartment(
          org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Department _coreDepartment);

  Operations operations();

  interface Operations extends org.apache.olingo.ext.proxy.api.Operations {

    @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "GetEmployeesCount",
        type = OperationType.FUNCTION,
        isComposable = false,
        referenceType = java.lang.Integer.class, returnType = "Edm.Int32")
    org.apache.olingo.ext.proxy.api.Invoker<java.lang.Integer> getEmployeesCount(
        );

    @org.apache.olingo.ext.proxy.api.annotations.Operation(name = "IncreaseRevenue",
        type = OperationType.ACTION,
        referenceType = java.lang.Long.class, returnType = "Edm.Int64")
    org.apache.olingo.ext.proxy.api.Invoker<java.lang.Long> increaseRevenue(
        @Parameter(name = "IncreaseValue", type = "Edm.Int64", nullable = true) java.lang.Long increaseValue
        );

  }

  Annotations annotations();

  interface Annotations {

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyID",
        type = "Edm.Int32")
    org.apache.olingo.ext.proxy.api.Annotatable getCompanyIDAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "CompanyCategory",
        type = "Microsoft.Test.OData.Services.ODataWCFService.CompanyCategory")
    org.apache.olingo.ext.proxy.api.Annotatable getCompanyCategoryAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Revenue",
        type = "Edm.Int64")
    org.apache.olingo.ext.proxy.api.Annotatable getRevenueAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Name",
        type = "Edm.String")
    org.apache.olingo.ext.proxy.api.Annotatable getNameAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForProperty(name = "Address",
        type = "Microsoft.Test.OData.Services.ODataWCFService.Address")
    org.apache.olingo.ext.proxy.api.Annotatable getAddressAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Employees",
        type = "Microsoft.Test.OData.Services.ODataWCFService.Employee")
    org.apache.olingo.ext.proxy.api.Annotatable getEmployeesAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "VipCustomer",
        type = "Microsoft.Test.OData.Services.ODataWCFService.Customer")
    org.apache.olingo.ext.proxy.api.Annotatable getVipCustomerAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "Departments",
        type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
    org.apache.olingo.ext.proxy.api.Annotatable getDepartmentsAnnotations();

    @org.apache.olingo.ext.proxy.api.annotations.AnnotationsForNavigationProperty(name = "CoreDepartment",
        type = "Microsoft.Test.OData.Services.ODataWCFService.Department")
    org.apache.olingo.ext.proxy.api.Annotatable getCoreDepartmentAnnotations();
  }

}


text:
/* DO NOT CHANGE ANYTHING IN THIS SECTION

   Styles below override defaults in carousel.css and govern fundamental layout
   and behavior.

------------------------------------------------------------------------------*/

.carousel-component {
    background: transparent;
    color: black;
    overflow: auto !important;
    padding: 0;
    -moz-border-radius: 0px;
}

.carousel-component ul.carousel-list {
    float: left;
}

.carousel-component ul.carousel-list li.columnav-menu {
    color: black;
    font-family: inherit;
    font-size: 1em;
    text-align: left;
}

.carousel-component ul.carousel-list li.columnav-menu div {
    overflow: auto;
    position: relative;
}

.carousel-component ul.carousel-list li.columnav-menu a {
    display: block;
    overflow-x: hidden;
    position: relative;
}

.carousel-component ul.carousel-list li.columnav-menu a span {
    display: block;
    position: relative;
}