text:
/* See LICENSE in the root of the distribution for licensing details. */

// Unit Tests for mdbm_get_hash  mdbm_sethash
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <limits.h>

#include <iostream>
#include <vector>
#include <algorithm>

#include <cppunit/TestAssert.h>
#include <cppunit/TestCase.h>
#include <cppunit/TestFixture.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>

#include "mdbm_util.h"
#include "TestBase.hh"

#define main comp_main_wrapper
#include "../../tools/mdbm_compare.c"
#undef main

// include import so we can patch changes from cdb format
#define main imp_main_wrapper_c
#define usage imp_usage_wrapper_c
#include "../../tools/mdbm_import.cc"
#undef main
#undef usage

class CompareTestBase : public CppUnit::TestFixture, public TestBase
{

public:
    CompareTestBase(int vFlag) : TestBase(vFlag, "Compare Test Suite") {}
    void setUp();
    void tearDown() { }

    // unit tests in this suite
    void CompareSame();
    void CompareDifferent();
    void CheckDiffCount();
    void PatchMissing();
    void PatchCommon();

protected:
  string file1, file2, difname;
  void MakeTestMdbms(const string& fname1, const string& fname2);
};

void CompareTestBase::setUp()
{
    file1 = GetTmpName();
    file2 = GetTmpName();
    difname = GetTmpName(".diff");
    MakeTestMdbms(file1, file2);
}

void CompareTestBase::MakeTestMdbms(const string& fname1, const string& fname2) {
    int i;
    char key[4096];
    char val[4096];
    datum kdat, vdat;
    int flags = MDBM_O_RDWR | MDBM_O_CREAT | MDBM_O_TRUNC | versionFlag;
    MdbmHolder db1 = mdbm_open(fname1.c_str(), flags, 0644, 1024, 4096);
    MdbmHolder db2 = mdbm_open(fname2.c_str(), flags|MDBM_LARGE_OBJECTS, 0644, 1024, 8192);
    mdbm_setspillsize(db2, 50);

    kdat.dptr = key;
    vdat.dptr = val;
    // first db only
    for (i=0; i<5; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "key %04d -.val", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this is value %07d", i);
      mdbm_store(db1, kdat, vdat, MDBM_REPLACE);
    }
    // second db only
    for (i=5; i<10; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "key %04d .-val", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this is value %07d", i);
      mdbm_store(db2, kdat, vdat, MDBM_REPLACE);
    }
    // both dbs
    for (i=10; i<100; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "key %04d ==val", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this is value %07d", i);
      mdbm_store(db1, kdat, vdat, MDBM_REPLACE);
      mdbm_store(db2, kdat, vdat, MDBM_REPLACE);
    }

    // different values
    for (i=100; i<105; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "key %04d !=val", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this is value1 %07d", i);
      mdbm_store(db1, kdat, vdat, MDBM_REPLACE);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this is value2 %07d", i);
      mdbm_store(db2, kdat, vdat, MDBM_REPLACE);
    }

    // oversize in db1, same key/value
    for (i=105; i<110; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "large key %04d", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this oversized is value %07d", i);
      mdbm_store(db1, kdat, vdat, MDBM_REPLACE);
      mdbm_store(db2, kdat, vdat, MDBM_REPLACE);
    }

    // oversize in db1, different value
    for (i=110; i<115; ++i) {
      kdat.dsize = snprintf(key, sizeof(key), "key %04d !=val", i);
      vdat.dsize = snprintf(val, sizeof(val), "whereas this oversized is value1 %07d", i);
      mdbm_store(db1, kdat, vdat, MDBM_REPLACE);
      vdat.dsize = sprintf(val, "whereas this oversized is value2 %07d", i);
      mdbm_store(db2, kdat, vdat, MDBM_REPLACE);
    }
}

void CompareTestBase::CompareSame()
{ // compare MDBM against itself
    TRACE_TEST_CASE("CompareSame");
    const char* args[] = { "foo", file1.c_str(), file1.c_str(), NULL };
    reset_getopt();
    int ret = comp_main_wrapper(sizeof(args)/sizeof(args[0])-1, (char**)args);
    CPPUNIT_ASSERT(ret == 0);
}

void CompareTestBase::CompareDifferent()
{ // compare different MDBMs
    TRACE_TEST_CASE("CompareDifferent");
    const char* args[] = { "foo", file1.c_str(), file2.c_str(), NULL };
    reset_getopt();
    int ret = comp_main_wrapper(sizeof(args)/sizeof(args[0])-1, (char**)args);
    CPPUNIT_ASSERT(ret != 0);
}

void CompareTestBase::CheckDiffCount()
{ // compare different MDBMs
    TRACE_TEST_CASE("CheckDiffCount");
    MdbmHolder db1 = mdbm_open(file1.c_str(), MDBM_O_RDONLY, 0, 0, 0);
    MdbmHolder db2 = mdbm_open(file2.c_str(), MDBM_O_RDONLY, 0, 0, 0);

    uint64_t count1 = dump_different(db1, db2, 0, 0);
    uint64_t count2 = dump_different(db1, db2, 1, 0);
    uint64_t count3 = dump_different(db2, db1, 1, 0);

    CPPUNIT_ASSERT(count1 == 15);
    CPPUNIT_ASSERT(count2 ==  5);
    CPPUNIT_ASSERT(count3 ==  5);
}

void CompareTestBase::PatchMissing()
{ // patch missing entries from the first db to the second
    TRACE_TEST_CASE("PatchMissing");
    { // dump out keys only in the first db
      // NOTE: on FreeBSD, getopt works differently, so filenames *must* be last
      const char* args[] = { "foo", "-m", "-F", "cdb",
        "-f", difname.c_str(), file1.c_str(), file2.c_str(), NULL };
      reset_getopt();
      int ret = comp_main_wrapper(sizeof(args)/sizeof(args[0])-1, (char**)args);
      CPPUNIT_ASSERT(ret > 0);
    }

    { // import changes to the second db
      const char* args[] = { "foo", "-c", "-S", "1", "-i", difname.c_str(), file2.c_str(), NULL };
      reset_getopt();
      int ret = imp_main_wrapper_c(sizeof(args)/sizeof(args[0])-1, (char**)args);
      //fprintf(stderr, "import return code is %d\n", ret);
      CPPUNIT_ASSERT(ret == 0);
    }

    MdbmHolder db1 = mdbm_open(file1.c_str(), MDBM_O_RDONLY, 0, 0, 0);
    MdbmHolder db2 = mdbm_open(file2.c_str(), MDBM_O_RDONLY, 0, 0, 0);

    flags=0; // hacky, reset this so we don't trigger cdb output against null file
    uint64_t count1 = dump_different(db1, db2, 0, 0);
    uint64_t count2 = dump_different(db1, db2, 1, 0);
    uint64_t count3 = dump_different(db2, db1, 1, 0);

    CPPUNIT_ASSERT(count1 == 10);
    CPPUNIT_ASSERT(count2 ==  0);
    CPPUNIT_ASSERT(count3 ==  5);
}

void CompareTestBase::PatchCommon()
{ // patch common entries from the first db to the second
    TRACE_TEST_CASE("PatchCommon");
    { // dump out keys only in both dbs
      // NOTE: on FreeBSD, getopt works differently, so filenames *must* be last
      const char* args[] = { "foo", "-M", "-F", "cdb",
        "-f", difname.c_str(), file1.c_str(), file2.c_str(), NULL };
      reset_getopt();
      int ret = comp_main_wrapper(sizeof(args)/sizeof(args[0])-1, (char**)args);
      CPPUNIT_ASSERT(ret > 0);
    }

    { // import changes to the second db
      const char* args[] = { "foo", "-c", "-S", "1", "-i", difname.c_str(), file2.c_str(), NULL };
      reset_getopt();
      int ret = imp_main_wrapper_c(sizeof(args)/sizeof(args[0])-1, (char**)args);
      //fprintf(stderr, "import return code is %d\n", ret);
      CPPUNIT_ASSERT(ret == 0);
    }

    MdbmHolder db1 = mdbm_open(file1.c_str(), MDBM_O_RDONLY, 0, 0, 0);
    MdbmHolder db2 = mdbm_open(file2.c_str(), MDBM_O_RDONLY, 0, 0, 0);

    flags=0; // hacky, reset this so we don't trigger cdb output against null file
    uint64_t count1 = dump_different(db1, db2, 0, 0);
    uint64_t count2 = dump_different(db1, db2, 1, 0);
    uint64_t count3 = dump_different(db2, db1, 1, 0);

    CPPUNIT_ASSERT(count1 == 5);
    CPPUNIT_ASSERT(count2 == 5);
    CPPUNIT_ASSERT(count3 == 5);
}

class CompareTestV3 : public CompareTestBase
{
    CPPUNIT_TEST_SUITE(CompareTestV3);
    CPPUNIT_TEST(CompareSame);
    CPPUNIT_TEST(CompareDifferent);
    CPPUNIT_TEST(CheckDiffCount);
    CPPUNIT_TEST(PatchMissing);
    CPPUNIT_TEST(PatchCommon);
    CPPUNIT_TEST_SUITE_END();

public:
    CompareTestV3() : CompareTestBase(MDBM_CREATE_V3) {}
};

CPPUNIT_TEST_SUITE_REGISTRATION(CompareTestV3);


text:
package org.kohsuke.github;

import com.infradna.tool.bridge_method_injector.WithBridgeMethods;

import java.net.URL;
import java.util.Date;

/**
 * The model user for comparing 2 commits in the GitHub API.
 *
 * @author Michael Clarke
 */
public class GHCompare {

    private String url, html_url, permalink_url, diff_url, patch_url;
    public Status status;
    private int ahead_by, behind_by, total_commits;
    private Commit base_commit, merge_base_commit;
    private Commit[] commits;
    private GHCommit.File[] files;

    private GHRepository owner;

    public URL getUrl() {
        return GitHub.parseURL(url);
    }

    public URL getHtmlUrl() {
        return GitHub.parseURL(html_url);
    }

    public URL getPermalinkUrl() {
        return GitHub.parseURL(permalink_url);
    }

    public URL getDiffUrl() {
        return GitHub.parseURL(diff_url);
    }

    public URL getPatchUrl() {
        return GitHub.parseURL(patch_url);
    }

    public Status getStatus() {
        return status;
    }

    public int getAheadBy() {
        return ahead_by;
    }

    public int getBehindBy() {
        return behind_by;
    }

    public int getTotalCommits() {
        return total_commits;
    }

    public Commit getBaseCommit() {
        return base_commit;
    }

    public Commit getMergeBaseCommit() {
        return merge_base_commit;
    }

    public Commit[] getCommits() {
        return commits;
    }

    public GHCommit.File[] getFiles() {
        return files;
    }

    public GHCompare wrap(GHRepository owner) {
        this.owner = owner;
        for (Commit commit : commits) {
            commit.wrapUp(owner);
        }
        merge_base_commit.wrapUp(owner);
        base_commit.wrapUp(owner);
        return this;
    }

    /**
     * Compare commits had a child commit element with additional details we want to capture.
     * This extenstion of GHCommit provides that.
     */
    public static class Commit extends GHCommit {

        private InnerCommit commit;

        public InnerCommit getCommit() {
            return commit;
        }
    }

    public static class InnerCommit {
        private String url, sha, message;
        private User author, committer;
        private Tree tree;

        public String getUrl() {
            return url;
        }

        public String getSha() {
            return sha;
        }

        public String getMessage() {
            return message;
        }

        @WithBridgeMethods(value=User.class,castRequired=true)
        public GitUser getAuthor() {
            return author;
        }

        @WithBridgeMethods(value=User.class,castRequired=true)
        public GitUser getCommitter() {
            return committer;
        }

        public Tree getTree() {
            return tree;
        }
    }

    public static class Tree {
        private String url, sha;

        public String getUrl() {
            return url;
        }

        public String getSha() {
            return sha;
        }
    }

    /**
     * @deprecated use {@link GitUser} instead.
     */
    public static class User extends GitUser {
    }

    public static enum Status {
        behind, ahead, identical, diverged
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Pomelo Foundation. All rights reserved.
// Licensed under the MIT. See LICENSE in the project root for license information.

using System;
using JetBrains.Annotations;
using Pomelo.EntityFrameworkCore.MySql.Infrastructure;

// ReSharper disable once CheckNamespace
namespace Microsoft.EntityFrameworkCore
{
    /// <summary>
    /// Represents a <see cref="ServerVersion"/> for MariaDB database servers.
    /// For MySQL database servers, use <see cref="MySqlServerVersion"/> instead.
    /// </summary>
    public class MariaDbServerVersion : ServerVersion
    {
        public static readonly string MariaDbTypeIdentifier = nameof(ServerType.MariaDb).ToLowerInvariant();
        public static readonly ServerVersion LatestSupportedServerVersion = new MariaDbServerVersion(new Version(10, 5, 5));

        public override ServerVersionSupport Supports { get; }

        public MariaDbServerVersion(Version version)
            : base(version, ServerType.MariaDb)
        {
            Supports = new MariaDbServerVersionSupport(this);
        }

        public MariaDbServerVersion(string versionString)
            : this(Parse(versionString, ServerType.MariaDb))
        {
        }

        public MariaDbServerVersion(ServerVersion serverVersion)
            : base(serverVersion.Version, serverVersion.Type, serverVersion.TypeIdentifier)
        {
            if (Type != ServerType.MariaDb ||
                !string.Equals(TypeIdentifier, MariaDbTypeIdentifier))
            {
                throw new ArgumentException($"{nameof(MariaDbServerVersion)} is not compatible with the supplied server type.");
            }

            Supports = new MariaDbServerVersionSupport(this);
        }

        public class MariaDbServerVersionSupport : ServerVersionSupport
        {
            internal MariaDbServerVersionSupport([NotNull] ServerVersion serverVersion)
                : base(serverVersion)
            {
            }

            public override bool DateTimeCurrentTimestamp => ServerVersion.Version >= new Version(10, 0, 1);
            public override bool DateTime6 => ServerVersion.Version >= new Version(10, 1, 2);
            public override bool LargerKeyLength => ServerVersion.Version >= new Version(10, 2, 2);
            public override bool RenameIndex => false;
            public override bool RenameColumn => ServerVersion.Version >= new Version(10, 5, 2);
            public override bool WindowFunctions => ServerVersion.Version >= new Version(10, 2, 0);
            public override bool FloatCast => false; // The implemented support drops some decimal places and rounds.
            public override bool DoubleCast => ServerVersion.Version >= new Version(10, 4, 0);
            public override bool OuterApply => false; // MDEV-19078, MDEV-6373
            public override bool CrossApply => false; // MDEV-19078, MDEV-6373
            public override bool OuterReferenceInMultiLevelSubquery => false;
            public override bool Json => ServerVersion.Version >= new Version(10, 2, 4);
            public override bool GeneratedColumns => ServerVersion.Version >= new Version(10, 2, 0);
            public override bool NullableGeneratedColumns => false;
            public override bool ParenthesisEnclosedGeneratedColumnExpressions => false;
            public override bool DefaultCharSetUtf8Mb4 => false;
            public override bool DefaultExpression => false;
            public override bool AlternativeDefaultExpression => ServerVersion.Version >= new Version(10, 2, 7);
            public override bool SpatialIndexes => ServerVersion.Version >= new Version(10, 2, 2);
            public override bool SpatialReferenceSystemRestrictedColumns => false;
            public override bool SpatialFunctionAdditions => ServerVersion.Version >= new Version(10, 1, 2);
            public override bool SpatialSupportFunctionAdditions => false;
            public override bool SpatialSetSridFunction => false;
            public override bool SpatialDistanceFunctionImplementsAndoyer => false;
            public override bool SpatialGeographic => false;
            public override bool ExceptIntercept => ServerVersion.Version >= new Version(10, 3, 0);
            public override bool ExceptInterceptPrecedence => ServerVersion.Version >= new Version(10, 4, 0);
            public override bool JsonDataTypeEmulation => ServerVersion.Version >= new Version(10, 2, 4); // JSON_COMPACT was added in 10.2.4, though most other functions where added in 10.2.3
            public override bool ImplicitBoolCheckUsesIndex => ServerVersion.Version >= new Version(10, 0, 0); // Exact version has not been verified yet
            public override bool Sequences => ServerVersion.Version >= new Version(10, 3, 0);
            public override bool InformationSchemaCheckConstraintsTable => ServerVersion.Version >= new Version(10, 3, 10) ||
                                                                           ServerVersion.Version.Major == 10 && ServerVersion.Version.Minor == 2 && ServerVersion.Version.Build >= 22;  // MySQL is missing the explicit TABLE_NAME column that MariaDB supports, so always join the TABLE_CONSTRAINTS table when accessing CHECK_CONSTRAINTS for any database server that supports CHECK_CONSTRAINTS.
            public override bool IdentifyJsonColumsByCheckConstraints => true;
            public override bool Returning => ServerVersion.Version >= new Version(10, 5, 0);
            public override bool CommonTableExpressions => ServerVersion.Version >= new Version(10, 2, 1);
        }
    }
}


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

<title>org.springframework.scripting.support (Spring Framework 5.1.18.RELEASE API)</title>
<meta name="date" content="2020-09-15">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev Package

Next Package

Frames

No Frames

All Classes

@NonNullApi
 @NonNullFields

Package org.springframework.scripting.support

Support classes for Spring's scripting package.

See: Description

Class Summary

Class
Description

RefreshableScriptTargetSource

Subclass of BeanFactoryRefreshableTargetSource that determines whether
 a refresh is required through the given ScriptFactory.

ResourceScriptSource

ScriptSource implementation
 based on Spring's Resource
 abstraction.

ScriptFactoryPostProcessor

BeanPostProcessor that
 handles ScriptFactory definitions,
 replacing each factory with the actual scripted Java object generated by it.

StandardScriptEvaluator

javax.script (JSR-223) based implementation of Spring's ScriptEvaluator
 strategy interface.

StandardScriptFactory

ScriptFactory implementation based
 on the JSR-223 script engine abstraction (as included in Java 6+).

StandardScriptUtils

Common operations for dealing with a JSR-223 ScriptEngine.

StaticScriptSource

Static implementation of the
 ScriptSource interface,
 encapsulating a given String that contains the script source text.

Exception Summary

Exception
Description

StandardScriptEvalException

Exception decorating a ScriptException coming out of
 JSR-223 script evaluation, i.e.

Package org.springframework.scripting.support Description

Support classes for Spring's scripting package.
 Provides a ScriptFactoryPostProcessor for turning ScriptFactory
 definitions into scripted objects.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Spring Framework

Prev Package

Next Package

Frames

No Frames

All Classes


text:
import { jestConsoleContext, jestContext } from '@prisma/internals'
import fs from 'fs-jetpack'
import prompt from 'prompts'

import { DbPull } from '../commands/DbPull'
import { MigrateDeploy } from '../commands/MigrateDeploy'
import { MigrateDev } from '../commands/MigrateDev'
import { MigrateResolve } from '../commands/MigrateResolve'

const ctx = jestContext.new().add(jestConsoleContext()).assemble()

// Disable prompts
process.env.GITHUB_ACTIONS = '1'
// Disable generate
process.env.PRISMA_MIGRATE_SKIP_GENERATE = '1'

// Covered in docs: https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/add-prisma-migrate-to-a-project
// We have a dev and prod database
// And we want to baseline the production database with a baseline migration
// For that, we use `db pull`, `migrate dev`, `migrate resolve` and `migrate deploy` commands
describe('Baselining', () => {
  // Backup env vars
  const OLD_ENV = { ...process.env }

  afterEach(() => {
    // Restore env vars to backup state
    process.env = { ...OLD_ENV }
  })

  it('SQLite: should succeed', async () => {
    ctx.fixture('baseline-sqlite')
    fs.remove('prisma/migrations')
    fs.copy('prisma/dev.db', 'prisma/prod.db')

    // Start with the dev database
    process.env.DATABASE_URL = 'file:./dev.db'

    // db pull
    const dbPull = DbPull.new().parse([])
    await expect(dbPull).resolves.toMatchInlineSnapshot(``)
    expect(ctx.mocked['console.info'].mock.calls.join('\n')).toMatchInlineSnapshot(`
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "dev.db" at "file:./dev.db"
    `)
    ctx.mocked['console.info'].mockReset()

    // migrate dev --create-only
    prompt.inject(['y'])
    const migrateDevCreateOnly = MigrateDev.new().parse(['--create-only'])
    await expect(migrateDevCreateOnly).resolves.toMatchInlineSnapshot(`
      Prisma Migrate created the following migration without applying it 20201231000000_

      You can now edit it and apply it by running prisma migrate dev.
    `)
    expect(ctx.mocked['console.info'].mock.calls.join('\n')).toMatchInlineSnapshot(`
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "dev.db" at "file:./dev.db"

      Drift detected: Your database schema is not in sync with your migration history.

      The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.

      It should be understood as the set of changes to get from the expected schema to the actual schema.

      If you are running this the first time on an existing database, please make sure to read this documentation page:
      https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/troubleshooting-development

      [+] Added tables
        - Blog

    `)
    ctx.mocked['console.info'].mockReset()

    // migrate dev
    const migrateDev = MigrateDev.new().parse([])
    await expect(migrateDev).resolves.toMatchInlineSnapshot(``)
    expect(ctx.mocked['console.info'].mock.calls.join('\n')).toMatchInlineSnapshot(`
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "dev.db" at "file:./dev.db"

      Applying migration \`20201231000000_\`

      The following migration(s) have been applied:

      migrations/
        └─ 20201231000000_/
          └─ migration.sql

      Your database is now in sync with your schema.
    `)
    ctx.mocked['console.info'].mockReset()

    // Switch to PROD database
    process.env.DATABASE_URL = 'file:./prod.db'

    // migrate resolve --applied migration_name
    const migrationName = fs.list('prisma/migrations')![0]
    const migrateResolveProd = MigrateResolve.new().parse(['--applied', migrationName])
    await expect(migrateResolveProd).resolves.toMatchInlineSnapshot(`Migration 20201231000000_ marked as applied.`)

    expect(ctx.mocked['console.info'].mock.calls.join('\n')).toMatchInlineSnapshot(`
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "prod.db" at "file:./prod.db"
    `)
    ctx.mocked['console.info'].mockReset()

    // migrate deploy
    const migrateDeployProd = MigrateDeploy.new().parse([])
    await expect(migrateDeployProd).resolves.toMatchInlineSnapshot(`No pending migrations to apply.`)
    expect(ctx.mocked['console.info'].mock.calls.join('\n')).toMatchInlineSnapshot(`
      Prisma schema loaded from prisma/schema.prisma
      Datasource "my_db": SQLite database "prod.db" at "file:./prod.db"

      1 migration found in prisma/migrations

    `)

    expect(ctx.mocked['console.log'].mock.calls).toEqual([])
    expect(ctx.mocked['console.error'].mock.calls).toEqual([])
  })
})


text:
import os

import babel

from flask_babelplus import Domain, get_locale
from flask_plugins import get_enabled_plugins

class FlaskBBDomain(Domain):
    def __init__(self, app):
        self.app = app
        super(FlaskBBDomain, self).__init__()

        self.plugins_folder = os.path.join(
            os.path.join(self.app.root_path, "plugins")
        )

        # FlaskBB's translations
        self.flaskbb_translations = os.path.join(
            self.app.root_path, "translations"
        )

        # Plugin translations
        with self.app.app_context():
            self.plugin_translations = [
                os.path.join(plugin.path, "translations")
                for plugin in get_enabled_plugins()
            ]

    def get_translations(self):
        """Returns the correct gettext translations that should be used for
        this request.  This will never fail and return a dummy translation
        object if used outside of the request or if a translation cannot be
        found.
        """
        locale = get_locale()
        cache = self.get_translations_cache()

        translations = cache.get(str(locale))
        if translations is None:
            # load flaskbb translations
            translations = babel.support.Translations.load(
                dirname=self.flaskbb_translations,
                locales=locale,
                domain="messages"
            )

            # If no compiled translations are found, return the
            # NullTranslations object.
            if not isinstance(translations, babel.support.Translations):
                return translations

            # now load and add the plugin translations
            for plugin in self.plugin_translations:
                plugin_translation = babel.support.Translations.load(
                    dirname=plugin,
                    locales=locale,
                    domain="messages"
                )
                translations.add(plugin_translation)

            cache[str(locale)] = translations

        return translations


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.09.07 at 08:01:35 PM IST
//

package com.mozu.qbintegration.model.qbmodel.allgen;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

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

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{}Name" minOccurs="0"/>
 *         <element ref="{}IsActive" minOccurs="0"/>
 *         <group ref="{}PersonName"/>
 *         <element name="JobTitle" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="41"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element ref="{}SupervisorRef" minOccurs="0"/>
 *         <element name="Department" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="31"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Description" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="64"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element ref="{}TargetBonus" minOccurs="0"/>
 *         <element ref="{}EmployeeAddress" minOccurs="0"/>
 *         <element name="PrintAs" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="41"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Phone" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="21"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Mobile" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="21"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Pager" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="21"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="PagerPIN" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="10"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="AltPhone" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="21"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Fax" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="21"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="SSN" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="15"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Email" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="1023"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element ref="{}AdditionalContactRef" maxOccurs="8" minOccurs="0"/>
 *         <element ref="{}EmergencyContacts" minOccurs="0"/>
 *         <element ref="{}EmployeeType" minOccurs="0"/>
 *         <element ref="{}PartOrFullTime" minOccurs="0"/>
 *         <element ref="{}Exempt" minOccurs="0"/>
 *         <element ref="{}KeyEmployee" minOccurs="0"/>
 *         <element ref="{}Gender" minOccurs="0"/>
 *         <element ref="{}HiredDate" minOccurs="0"/>
 *         <element ref="{}OriginalHireDate" minOccurs="0"/>
 *         <element ref="{}AdjustedServiceDate" minOccurs="0"/>
 *         <element ref="{}ReleasedDate" minOccurs="0"/>
 *         <element ref="{}BirthDate" minOccurs="0"/>
 *         <element ref="{}USCitizen" minOccurs="0"/>
 *         <element ref="{}Ethnicity" minOccurs="0"/>
 *         <element ref="{}Disabled" minOccurs="0"/>
 *         <element name="DisabilityDesc" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="25"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element ref="{}OnFile" minOccurs="0"/>
 *         <element ref="{}WorkAuthExpireDate" minOccurs="0"/>
 *         <element ref="{}USVeteran" minOccurs="0"/>
 *         <element ref="{}MilitaryStatus" minOccurs="0"/>
 *         <element name="AccountNumber" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="99"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element name="Notes" minOccurs="0">
 *           <simpleType>
 *             <restriction base="{}STRTYPE">
 *               <maxLength value="4095"/>
 *             </restriction>
 *           </simpleType>
 *         </element>
 *         <element ref="{}AdditionalNotes" maxOccurs="unbounded" minOccurs="0"/>
 *         <element ref="{}BillingRateRef" minOccurs="0"/>
 *         <element ref="{}EmployeePayrollInfo" minOccurs="0"/>
 *         <element ref="{}ExternalGUID" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "name",
    "isActive",
    "salutation",
    "firstName",
    "middleName",
    "lastName",
    "suffix",
    "jobTitle",
    "supervisorRef",
    "department",
    "description",
    "targetBonus",
    "employeeAddress",
    "printAs",
    "phone",
    "mobile",
    "pager",
    "pagerPIN",
    "altPhone",
    "fax",
    "ssn",
    "email",
    "additionalContactRef",
    "emergencyContacts",
    "employeeType",
    "partOrFullTime",
    "exempt",
    "keyEmployee",
    "gender",
    "hiredDate",
    "originalHireDate",
    "adjustedServiceDate",
    "releasedDate",
    "birthDate",
    "usCitizen",
    "ethnicity",
    "disabled",
    "disabilityDesc",
    "onFile",
    "workAuthExpireDate",
    "usVeteran",
    "militaryStatus",
    "accountNumber",
    "notes",
    "additionalNotes",
    "billingRateRef",
    "employeePayrollInfo",
    "externalGUID"
})
@XmlRootElement(name = "EmployeeAdd")
public class EmployeeAdd {

    @XmlElement(name = "Name")
    protected String name;
    @XmlElement(name = "IsActive")
    protected String isActive;
    @XmlElement(name = "Salutation")
    protected String salutation;
    @XmlElement(name = "FirstName")
    protected String firstName;
    @XmlElement(name = "MiddleName")
    protected String middleName;
    @XmlElement(name = "LastName")
    protected String lastName;
    @XmlElement(name = "Suffix")
    protected String suffix;
    @XmlElement(name = "JobTitle")
    protected String jobTitle;
    @XmlElement(name = "SupervisorRef")
    protected SupervisorRef supervisorRef;
    @XmlElement(name = "Department")
    protected String department;
    @XmlElement(name = "Description")
    protected String description;
    @XmlElement(name = "TargetBonus")
    protected String targetBonus;
    @XmlElement(name = "EmployeeAddress")
    protected EmployeeAddress employeeAddress;
    @XmlElement(name = "PrintAs")
    protected String printAs;
    @XmlElement(name = "Phone")
    protected String phone;
    @XmlElement(name = "Mobile")
    protected String mobile;
    @XmlElement(name = "Pager")
    protected String pager;
    @XmlElement(name = "PagerPIN")
    protected String pagerPIN;
    @XmlElement(name = "AltPhone")
    protected String altPhone;
    @XmlElement(name = "Fax")
    protected String fax;
    @XmlElement(name = "SSN")
    protected String ssn;
    @XmlElement(name = "Email")
    protected String email;
    @XmlElement(name = "AdditionalContactRef")
    protected List<AdditionalContactRef> additionalContactRef;
    @XmlElement(name = "EmergencyContacts")
    protected EmergencyContacts emergencyContacts;
    @XmlElement(name = "EmployeeType", defaultValue = "Regular")
    protected String employeeType;
    @XmlElement(name = "PartOrFullTime")
    protected String partOrFullTime;
    @XmlElement(name = "Exempt")
    protected String exempt;
    @XmlElement(name = "KeyEmployee")
    protected String keyEmployee;
    @XmlElement(name = "Gender")
    protected String gender;
    @XmlElement(name = "HiredDate")
    protected String hiredDate;
    @XmlElement(name = "OriginalHireDate")
    protected String originalHireDate;
    @XmlElement(name = "AdjustedServiceDate")
    protected String adjustedServiceDate;
    @XmlElement(name = "ReleasedDate")
    protected String releasedDate;
    @XmlElement(name = "BirthDate")
    protected String birthDate;
    @XmlElement(name = "USCitizen")
    protected String usCitizen;
    @XmlElement(name = "Ethnicity")
    protected String ethnicity;
    @XmlElement(name = "Disabled")
    protected String disabled;
    @XmlElement(name = "DisabilityDesc")
    protected String disabilityDesc;
    @XmlElement(name = "OnFile")
    protected String onFile;
    @XmlElement(name = "WorkAuthExpireDate")
    protected String workAuthExpireDate;
    @XmlElement(name = "USVeteran")
    protected String usVeteran;
    @XmlElement(name = "MilitaryStatus")
    protected String militaryStatus;
    @XmlElement(name = "AccountNumber")
    protected String accountNumber;
    @XmlElement(name = "Notes")
    protected String notes;
    @XmlElement(name = "AdditionalNotes")
    protected List<AdditionalNotes> additionalNotes;
    @XmlElement(name = "BillingRateRef")
    protected BillingRateRef billingRateRef;
    @XmlElement(name = "EmployeePayrollInfo")
    protected EmployeePayrollInfo employeePayrollInfo;
    @XmlElement(name = "ExternalGUID")
    protected String externalGUID;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the isActive property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getIsActive() {
        return isActive;
    }

    /**
     * Sets the value of the isActive property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setIsActive(String value) {
        this.isActive = value;
    }

    /**
     * Gets the value of the salutation property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSalutation() {
        return salutation;
    }

    /**
     * Sets the value of the salutation property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSalutation(String value) {
        this.salutation = value;
    }

    /**
     * Gets the value of the firstName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * Sets the value of the firstName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFirstName(String value) {
        this.firstName = value;
    }

    /**
     * Gets the value of the middleName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMiddleName() {
        return middleName;
    }

    /**
     * Sets the value of the middleName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMiddleName(String value) {
        this.middleName = value;
    }

    /**
     * Gets the value of the lastName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * Sets the value of the lastName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setLastName(String value) {
        this.lastName = value;
    }

    /**
     * Gets the value of the suffix property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSuffix() {
        return suffix;
    }

    /**
     * Sets the value of the suffix property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSuffix(String value) {
        this.suffix = value;
    }

    /**
     * Gets the value of the jobTitle property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getJobTitle() {
        return jobTitle;
    }

    /**
     * Sets the value of the jobTitle property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setJobTitle(String value) {
        this.jobTitle = value;
    }

    /**
     * Gets the value of the supervisorRef property.
     *
     * @return
     *     possible object is
     *     {@link SupervisorRef }
     *
     */
    public SupervisorRef getSupervisorRef() {
        return supervisorRef;
    }

    /**
     * Sets the value of the supervisorRef property.
     *
     * @param value
     *     allowed object is
     *     {@link SupervisorRef }
     *
     */
    public void setSupervisorRef(SupervisorRef value) {
        this.supervisorRef = value;
    }

    /**
     * Gets the value of the department property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDepartment() {
        return department;
    }

    /**
     * Sets the value of the department property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDepartment(String value) {
        this.department = value;
    }

    /**
     * Gets the value of the description property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the value of the description property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDescription(String value) {
        this.description = value;
    }

    /**
     * Gets the value of the targetBonus property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getTargetBonus() {
        return targetBonus;
    }

    /**
     * Sets the value of the targetBonus property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setTargetBonus(String value) {
        this.targetBonus = value;
    }

    /**
     * Gets the value of the employeeAddress property.
     *
     * @return
     *     possible object is
     *     {@link EmployeeAddress }
     *
     */
    public EmployeeAddress getEmployeeAddress() {
        return employeeAddress;
    }

    /**
     * Sets the value of the employeeAddress property.
     *
     * @param value
     *     allowed object is
     *     {@link EmployeeAddress }
     *
     */
    public void setEmployeeAddress(EmployeeAddress value) {
        this.employeeAddress = value;
    }

    /**
     * Gets the value of the printAs property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPrintAs() {
        return printAs;
    }

    /**
     * Sets the value of the printAs property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPrintAs(String value) {
        this.printAs = value;
    }

    /**
     * Gets the value of the phone property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPhone() {
        return phone;
    }

    /**
     * Sets the value of the phone property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPhone(String value) {
        this.phone = value;
    }

    /**
     * Gets the value of the mobile property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMobile() {
        return mobile;
    }

    /**
     * Sets the value of the mobile property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMobile(String value) {
        this.mobile = value;
    }

    /**
     * Gets the value of the pager property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPager() {
        return pager;
    }

    /**
     * Sets the value of the pager property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPager(String value) {
        this.pager = value;
    }

    /**
     * Gets the value of the pagerPIN property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPagerPIN() {
        return pagerPIN;
    }

    /**
     * Sets the value of the pagerPIN property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPagerPIN(String value) {
        this.pagerPIN = value;
    }

    /**
     * Gets the value of the altPhone property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAltPhone() {
        return altPhone;
    }

    /**
     * Sets the value of the altPhone property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAltPhone(String value) {
        this.altPhone = value;
    }

    /**
     * Gets the value of the fax property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getFax() {
        return fax;
    }

    /**
     * Sets the value of the fax property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setFax(String value) {
        this.fax = value;
    }

    /**
     * Gets the value of the ssn property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getSSN() {
        return ssn;
    }

    /**
     * Sets the value of the ssn property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setSSN(String value) {
        this.ssn = value;
    }

    /**
     * Gets the value of the email property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEmail() {
        return email;
    }

    /**
     * Sets the value of the email property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEmail(String value) {
        this.email = value;
    }

    /**
     * Gets the value of the additionalContactRef property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the additionalContactRef property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAdditionalContactRef().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link AdditionalContactRef }
     *
     *
     */
    public List<AdditionalContactRef> getAdditionalContactRef() {
        if (additionalContactRef == null) {
            additionalContactRef = new ArrayList<AdditionalContactRef>();
        }
        return this.additionalContactRef;
    }

    /**
     * Gets the value of the emergencyContacts property.
     *
     * @return
     *     possible object is
     *     {@link EmergencyContacts }
     *
     */
    public EmergencyContacts getEmergencyContacts() {
        return emergencyContacts;
    }

    /**
     * Sets the value of the emergencyContacts property.
     *
     * @param value
     *     allowed object is
     *     {@link EmergencyContacts }
     *
     */
    public void setEmergencyContacts(EmergencyContacts value) {
        this.emergencyContacts = value;
    }

    /**
     * Gets the value of the employeeType property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEmployeeType() {
        return employeeType;
    }

    /**
     * Sets the value of the employeeType property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEmployeeType(String value) {
        this.employeeType = value;
    }

    /**
     * Gets the value of the partOrFullTime property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getPartOrFullTime() {
        return partOrFullTime;
    }

    /**
     * Sets the value of the partOrFullTime property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setPartOrFullTime(String value) {
        this.partOrFullTime = value;
    }

    /**
     * Gets the value of the exempt property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getExempt() {
        return exempt;
    }

    /**
     * Sets the value of the exempt property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setExempt(String value) {
        this.exempt = value;
    }

    /**
     * Gets the value of the keyEmployee property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getKeyEmployee() {
        return keyEmployee;
    }

    /**
     * Sets the value of the keyEmployee property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setKeyEmployee(String value) {
        this.keyEmployee = value;
    }

    /**
     * Gets the value of the gender property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getGender() {
        return gender;
    }

    /**
     * Sets the value of the gender property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setGender(String value) {
        this.gender = value;
    }

    /**
     * Gets the value of the hiredDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getHiredDate() {
        return hiredDate;
    }

    /**
     * Sets the value of the hiredDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setHiredDate(String value) {
        this.hiredDate = value;
    }

    /**
     * Gets the value of the originalHireDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOriginalHireDate() {
        return originalHireDate;
    }

    /**
     * Sets the value of the originalHireDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOriginalHireDate(String value) {
        this.originalHireDate = value;
    }

    /**
     * Gets the value of the adjustedServiceDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAdjustedServiceDate() {
        return adjustedServiceDate;
    }

    /**
     * Sets the value of the adjustedServiceDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAdjustedServiceDate(String value) {
        this.adjustedServiceDate = value;
    }

    /**
     * Gets the value of the releasedDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getReleasedDate() {
        return releasedDate;
    }

    /**
     * Sets the value of the releasedDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setReleasedDate(String value) {
        this.releasedDate = value;
    }

    /**
     * Gets the value of the birthDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getBirthDate() {
        return birthDate;
    }

    /**
     * Sets the value of the birthDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setBirthDate(String value) {
        this.birthDate = value;
    }

    /**
     * Gets the value of the usCitizen property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUSCitizen() {
        return usCitizen;
    }

    /**
     * Sets the value of the usCitizen property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUSCitizen(String value) {
        this.usCitizen = value;
    }

    /**
     * Gets the value of the ethnicity property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getEthnicity() {
        return ethnicity;
    }

    /**
     * Sets the value of the ethnicity property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setEthnicity(String value) {
        this.ethnicity = value;
    }

    /**
     * Gets the value of the disabled property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDisabled() {
        return disabled;
    }

    /**
     * Sets the value of the disabled property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDisabled(String value) {
        this.disabled = value;
    }

    /**
     * Gets the value of the disabilityDesc property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDisabilityDesc() {
        return disabilityDesc;
    }

    /**
     * Sets the value of the disabilityDesc property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDisabilityDesc(String value) {
        this.disabilityDesc = value;
    }

    /**
     * Gets the value of the onFile property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getOnFile() {
        return onFile;
    }

    /**
     * Sets the value of the onFile property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setOnFile(String value) {
        this.onFile = value;
    }

    /**
     * Gets the value of the workAuthExpireDate property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getWorkAuthExpireDate() {
        return workAuthExpireDate;
    }

    /**
     * Sets the value of the workAuthExpireDate property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setWorkAuthExpireDate(String value) {
        this.workAuthExpireDate = value;
    }

    /**
     * Gets the value of the usVeteran property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getUSVeteran() {
        return usVeteran;
    }

    /**
     * Sets the value of the usVeteran property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setUSVeteran(String value) {
        this.usVeteran = value;
    }

    /**
     * Gets the value of the militaryStatus property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getMilitaryStatus() {
        return militaryStatus;
    }

    /**
     * Sets the value of the militaryStatus property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setMilitaryStatus(String value) {
        this.militaryStatus = value;
    }

    /**
     * Gets the value of the accountNumber property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getAccountNumber() {
        return accountNumber;
    }

    /**
     * Sets the value of the accountNumber property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setAccountNumber(String value) {
        this.accountNumber = value;
    }

    /**
     * Gets the value of the notes property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getNotes() {
        return notes;
    }

    /**
     * Sets the value of the notes property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setNotes(String value) {
        this.notes = value;
    }

    /**
     * Gets the value of the additionalNotes property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the additionalNotes property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getAdditionalNotes().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link AdditionalNotes }
     *
     *
     */
    public List<AdditionalNotes> getAdditionalNotes() {
        if (additionalNotes == null) {
            additionalNotes = new ArrayList<AdditionalNotes>();
        }
        return this.additionalNotes;
    }

    /**
     * Gets the value of the billingRateRef property.
     *
     * @return
     *     possible object is
     *     {@link BillingRateRef }
     *
     */
    public BillingRateRef getBillingRateRef() {
        return billingRateRef;
    }

    /**
     * Sets the value of the billingRateRef property.
     *
     * @param value
     *     allowed object is
     *     {@link BillingRateRef }
     *
     */
    public void setBillingRateRef(BillingRateRef value) {
        this.billingRateRef = value;
    }

    /**
     * Gets the value of the employeePayrollInfo property.
     *
     * @return
     *     possible object is
     *     {@link EmployeePayrollInfo }
     *
     */
    public EmployeePayrollInfo getEmployeePayrollInfo() {
        return employeePayrollInfo;
    }

    /**
     * Sets the value of the employeePayrollInfo property.
     *
     * @param value
     *     allowed object is
     *     {@link EmployeePayrollInfo }
     *
     */
    public void setEmployeePayrollInfo(EmployeePayrollInfo value) {
        this.employeePayrollInfo = value;
    }

    /**
     * Gets the value of the externalGUID property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getExternalGUID() {
        return externalGUID;
    }

    /**
     * Sets the value of the externalGUID property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setExternalGUID(String value) {
        this.externalGUID = value;
    }

}


text:
All official protocol for squadbot, maintained and reviewed by the ABitOfSquad team.

## Issue Tracking
Issues are being tracked in [Squadbot's main repository](https://github.com/ABitOfSquad/squadbot), since protocol issues are mostly API issues.

## Contributing
If you would like to submit a protocol to squadbot, you can use the ``whatsapp`` protocol as your documentation. We aren't planning on writing an official documentation for Protocol Developers yet, our writers. The steps of submitting a protocol are quite simple.

To be a protocol, you create a directory with the name of your protocol. Only alphanumeric symbols! This folder should contain ``settings.json`` and ``protocol.js``. Dependencies can be added to a temporarily ``_protocol.json`` in the folder, so we can port this to our database on submission.

1. Fork this repository
2. Submit a pull request, and give it the ``WIP`` label.
2. Wait for either ``boltgolt`` or ``nick vernij`` to give an approval of being an official protocol, we do this because of legal issues.
3. Happy coding!
4. Remove the ``WIP`` tag, and add ``Beta testing``, so we can get into the process of debugging your protocol.


text:
import Register from './register';
import * as lattex from './lattex';

class Latte {
  constructor(latte) {
    if (!latte || !latte.el || !latte.data) {
      throw new Error('Latte need an object to observe.');
    }
    this.$data = latte.data;
    this.$register = new Register();
    this.$el = document.querySelector(latte.el);
    if (this.$el) {
      this.$eventList = latte.eventList || {};
      this.$frag = Latte.node2Fragment(this.$el);
      this.scan(this.$frag);
      this.$el.appendChild(this.$frag);
      this.$register.build();
    } else {
      throw new Error('DOM to be observe is not exist.');
    }
  }

  static node2Fragment(el) {
    const fragment = document.createDocumentFragment();
    let child = el.firstChild;
    while (child) {
      fragment.appendChild(child);
      child = el.firstChild;
    }
    return fragment;
  }

  static getNodeChildren(node) {
    if (!node.children) {
      node.children = [];
      [...node.childNodes].forEach((child) => {
        if (child.nodeType === 1) {
          node.children.push(child);
        }
      });
    }
    return [...node.children];
  }

  static beautyInputEvent(node, fn) {
    let cmp = false;
    node.addEventListener('compositionstart', () => {
      cmp = true;
    });
    node.addEventListener('compositionend', () => {
      cmp = false;
      node.dispatchEvent(new Event('input'));
    });
    node.addEventListener('input', function input() {
      if (!cmp) {
        const start = this.selectionStart;
        const end = this.selectionEnd;
        fn();
        this.setSelectionRange(start, end);
      }
    });
  }

  scan(node) {
    if (node === this.$frag || !node.getAttribute('lait-list')) {
      Latte.getNodeChildren(node).forEach((child) => {
        if (node.path) {
          child.path = node.path;
        }
        if (child.children.length) {
          this.scan(child);
        }
        this.events(child)
          .classes(child)
          .model(child);
      });
    } else {
      this.parseList(node);
    }
  }

  parseData(str, node) {
    const list = str.split(':');
    let data;
    let nowPath;
    let arrayCounter = 1;
    const path = [];
    list.forEach((key, index) => {
      if (index === 0) {
        data = this.$data[key];
      } else if (node.path) {
        nowPath = node.path[arrayCounter];
        arrayCounter += 1;
        if (nowPath === key) {
          data = data[key];
        } else {
          path.push(nowPath);
          data = data[nowPath][key];
          arrayCounter += 1;
        }
      } else {
        data = data[key];
      }
      path.push(key);
    });
    if (node.path && node.path.length > path.length) {
      const lastPath = node.path[node.path.length - 1];
      data = data[lastPath];
      path.push(lastPath);
    }
    node.path = path;
    return { path, data };
  }

  events(node) {
    if (node.getAttribute('lait-event')) {
      const eventName = node.getAttribute('lait-event');
      const e = this.$eventList[eventName];
      if (!e) {
        throw new Error('No such event in eventList.');
      }
      if (!e.type || !e.fn) {
        throw new Error('data in eventList have some error.');
      }
      const type = e.type;
      const fn = e.fn.bind(node);
      if (type === 'input') {
        Latte.beautyInputEvent(node, fn);
      } else {
        node.addEventListener(type, fn);
      }
    }
    return this;
  }

  classes(node) {
    if (node.getAttribute('lait-class')) {
      const className = node.getAttribute('lait-class');
      const dataObj = this.parseData(className, node);
      if (!node.classList.contains(dataObj.data)) {
        node.classList.add(dataObj.data);
      }
      this.$register.regist(this.$data, dataObj.path, (old, now) => {
        node.classList.remove(old);
        node.classList.add(now);
      });
    }
    return this;
  }

  model(node) {
    if (node.getAttribute('lait-model')) {
      const modelName = node.getAttribute('lait-model');
      const dataObj = this.parseData(modelName, node);
      if (node.tagName === 'INPUT') {
        node.value = dataObj.data;
      } else {
        node.innerText = dataObj.data;
      }
      this.$register.regist(this.$data, dataObj.path, (old, now) => {
        if (node.tagName === 'INPUT') {
          node.value = now;
        } else {
          node.innerText = now;
        }
      });
    }
    return this;
  }

  parseList(node) {
    const parsedItem = this.parseListItem(node);
    const itemEl = parsedItem.itemEl;
    const parentEl = parsedItem.parentEl;
    const list = node.getAttribute('lait-list');
    const listData = this.parseData(list, node);
    listData.data.forEach((_dataItem, index) => {
      const copyItem = itemEl.cloneNode(true);
      copyItem.$data = _dataItem;
      copyItem.path = node.path.slice();
      copyItem.path.push(index);
      this.events(copyItem)
        .classes(copyItem)
        .model(copyItem)
        .scan(copyItem);
      parentEl.insertBefore(copyItem, itemEl);
    });
    parentEl.removeChild(itemEl);
    this.$register.regist(this.$data, listData.path, () => {
      while (parentEl.firstChild) {
        parentEl.removeChild(parentEl.firstChild);
      }
      const thisListData = this.parseData(list, node);
      parentEl.appendChild(itemEl);
      thisListData.data.forEach((_dataItem, index) => {
        const copyItem = itemEl.cloneNode(true);
        copyItem.$data = _dataItem;
        copyItem.path = node.path.slice();
        copyItem.path.push(index);
        this.events(copyItem)
          .classes(copyItem)
          .model(copyItem)
          .scan(copyItem);
        parentEl.insertBefore(copyItem, itemEl);
      });
      parentEl.removeChild(itemEl);
    });
    return this;
  }

  parseListItem(node) {
    let target;
    const getItem = (nodeToScan) => {
      [...nodeToScan.children].forEach((thisNode) => {
        if (nodeToScan.path) {
          thisNode.path = nodeToScan.path.slice();
        }
        if (thisNode.getAttribute('lait-list-item')) {
          target = {
            itemEl: thisNode,
            parentEl: nodeToScan,
          };
        } else {
          this.events(thisNode)
            .classes(thisNode)
            .model(thisNode);
          getItem(thisNode);
        }
      });
    };
    getItem(node);
    return target;
  }
}

export { Latte, lattex };


text:
"""This code example deactivates a user.

Deactivated users can no longer make requests to the API. The user making the
request cannot deactivate itself. To determine which users exist, run
get_all_users.py.
"""

# Import appropriate modules from the client library.
from googleads import ad_manager

USER_ID = 'INSERT_USER_ID_TO_DEACTIVATE_HERE'

def main(client, user_id):
  # Initialize appropriate service.
  user_service = client.GetService('UserService', version='v202205')

  # Create query.
  statement = (ad_manager.StatementBuilder(version='v202205')
               .Where('id = :userId')
               .WithBindVariable('userId', int(user_id)))

  # Get users by statement.
  response = user_service.getUsersByStatement(statement.ToStatement())
  users = response['results'] if 'results' in response else []

  for user in users:
    print('User with id "%s", email "%s", and status "%s" will be '
          'deactivated.'
          % (user['id'], user['email'],
              {'true': 'ACTIVE', 'false': 'INACTIVE'}[user['isActive']]))
  print('Number of users to be deactivated: %s' % len(users))

  # Perform action.
  result = user_service.performUserAction({'xsi_type': 'DeactivateUsers'},
                                          statement.ToStatement())

  # Display results.
  if result and int(result['numChanges']) > 0:
    print('Number of users deactivated: %s' % result['numChanges'])
  else:
    print('No users were deactivated.')

if __name__ == '__main__':
  # Initialize client object.
  ad_manager_client = ad_manager.AdManagerClient.LoadFromStorage()
  main(ad_manager_client, USER_ID)


text:
studio-x-files
==============

Studio-X Files


text:
package com.ifeng.vdn.ip.repository.bean;

import java.io.Serializable;

/**
 * @version 0.1
 *
 * @author Hefei Li
 *
 * @since  Apr 25, 2015
 */
public class IPLocModel implements Serializable {

	private static final long serialVersionUID = 7481666725015542455L;

	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public String getLoc() {
		return loc;
	}
	public void setLoc(String loc) {
		this.loc = loc;
	}
	public int getTotal() {
		return total;
	}
	public void setTotal(int total) {
		this.total = total;
	}

	private Integer id;
	private String ip;
	private String loc;
	private int total;
}


text:
namespace OrchardCore.Sitemaps.Services
{
    public interface ISitemapIdGenerator
    {
        string GenerateUniqueId();
    }
}


text:
package edu.stanford.nlp.parser.lexparser;

/** Class for parse edges.
 *
 *  @author Dan Klein
 */
public class Edge extends Item {

  public Hook backHook;

  public Edge(boolean exhaustiveTest) {
  	super(exhaustiveTest);
  }

  public Edge(Edge e) {
  	super(e);
  	backHook = e.backHook;
  }

  @Override
  public boolean isEdge() {
    return true;
  }

  @Override
  public String toString() {
    // TODO: used to contain more useful information
    //return "Edge(" + Numberer.getGlobalNumberer("states").object(state) + ":" + start + "-" + end + "," + head + "/" + Numberer.getGlobalNumberer("tags").object(tag) + ")";
    return "Edge(" + state + ":" + start + "-" + end + "," + head + "/" + tag + ")";
  }

  @Override
  public int hashCode() {
    return (state << 1) ^ (head << 8) ^ (tag << 16) ^ (start << 4) ^ (end << 24);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    } else if (o instanceof Edge) {
      Edge e = (Edge) o;
      if (state == e.state && head == e.head && tag == e.tag && start == e.start && end == e.end) {
        return true;
      }
    }
    return false;
  }

}


text:
using System;
using System.IO;

using Microsoft.Protocols.TestTools.StackSdk.Messages;

namespace Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Cifs
{
    /// <summary>
    /// the basic packet of SMB
    /// defined common method of all SMB packets
    /// </summary>
    public abstract class SmbPacket : SmbFamilyPacket
    {
        #region fields

        /// <summary>
        /// Direct TCP Transport header
        /// </summary>
        protected TransportHeader transportHeader;

        /// <summary>
        /// the smb header
        /// </summary>
        protected SmbHeader smbHeader;

        /// <summary>
        /// the smb parameter
        /// </summary>
        protected SmbParameters smbParametersBlock;

        /// <summary>
        /// the smb data
        /// </summary>
        protected SmbData smbDataBlock;

        /// <summary>
        /// The result of signature verification
        /// </summary>
        private bool isSignatureCorrect;

        #endregion

        #region properties

        /// <summary>
        /// Get the type of the packet: Request or Response, and Single or Compounded.
        /// </summary>
        /// <returns>the type of the packet.</returns>
        public abstract SmbPacketType PacketType
        {
            get;
        }

        /// <summary>
        /// check if the packet is required to sign.
        /// </summary>
        public bool IsSignRequired
        {
            get
            {
                return (this.smbHeader.SecurityFeatures != 0);
            }
        }

        /// <summary>
        /// Direct TCP Transport Header
        /// Auto filled when ToBytes(), if not explicitly set.
        /// </summary>
        public TransportHeader TransportHeader
        {
            get
            {
                return this.transportHeader;
            }
            set
            {
                this.transportHeader = value;
            }
        }

        /// <summary>
        /// The SMB Header.
        /// </summary>
        public SmbHeader SmbHeader
        {
            get
            {
                return this.smbHeader;
            }
            set
            {
                this.smbHeader = value;
            }
        }

        /// <summary>
        /// The result of signature verification
        /// </summary>
        public bool IsSignatureCorrect
        {
            get
            {
                return this.isSignatureCorrect;
            }
            set
            {
                this.isSignatureCorrect = value;
            }
        }

        /// <summary>
        /// The SMB Parameters.
        /// </summary>
        protected internal SmbParameters SmbParametersBlock
        {
            get
            {
                return this.smbParametersBlock;
            }
            set
            {
                this.smbParametersBlock = value;
            }
        }

        /// <summary>
        /// The SMB Data.
        /// </summary>
        protected internal SmbData SmbDataBlock
        {
            get
            {
                return this.smbDataBlock;
            }
            set
            {
                this.smbDataBlock = value;
            }
        }

        /// <summary>
        /// get the size of Header. it is always 32.
        /// </summary>
        internal int HeaderSize
        {
            get
            {
                return 32;
            }
        }

        /// <summary>
        /// get the size of Parameters
        /// </summary>
        internal int ParametersSize
        {
            get
            {
                this.EncodeParameters();
                return 1 + this.smbParametersBlock.WordCount * 2;
            }
        }

        /// <summary>
        /// get the size of Data
        /// </summary>
        internal int DataSize
        {
            get
            {
                this.EncodeData();
                return 2 + this.smbDataBlock.ByteCount;
            }
        }

        #endregion

        #region constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        protected SmbPacket()
            : base()
        {
            this.smbParametersBlock.Words = new ushort[0];
            this.smbDataBlock.Bytes = new byte[0];
            this.isSignatureCorrect = true;
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        protected SmbPacket(byte[] data)
            : base(data)
        {
            this.smbParametersBlock.Words = new ushort[0];
            this.smbDataBlock.Bytes = new byte[0];
            this.isSignatureCorrect = true;
        }

        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">the smbPacket is null.</exception>
        protected SmbPacket(SmbPacket smbPacket)
            : base()
        {
            if (smbPacket == null)
            {
                throw new ArgumentNullException("smbPacket",
                    "the copy constructor of smbpacket can not accept null smbPacket.");
            }

            lock (smbPacket)
            {
                this.isSignatureCorrect = smbPacket.isSignatureCorrect;
                this.transportHeader = new TransportHeader();
                this.transportHeader.Zero = smbPacket.transportHeader.Zero;
                this.transportHeader.StreamProtocolLength = new byte[3];
                this.transportHeader.StreamProtocolLength = smbPacket.transportHeader.StreamProtocolLength;

                this.SmbHeader = new SmbHeader();
                this.smbHeader.Protocol = smbPacket.smbHeader.Protocol;
                this.smbHeader.Command = smbPacket.smbHeader.Command;
                this.smbHeader.Status = smbPacket.smbHeader.Status;
                this.smbHeader.Flags = smbPacket.smbHeader.Flags;
                this.smbHeader.Flags2 = smbPacket.smbHeader.Flags2;
                this.smbHeader.PidHigh = smbPacket.smbHeader.PidHigh;
                this.smbHeader.SecurityFeatures = smbPacket.smbHeader.SecurityFeatures;
                this.smbHeader.Reserved = smbPacket.smbHeader.Reserved;
                this.smbHeader.Tid = smbPacket.smbHeader.Tid;
                this.smbHeader.PidLow = smbPacket.smbHeader.PidLow;
                this.smbHeader.Uid = smbPacket.smbHeader.Uid;
                this.smbHeader.Mid = smbPacket.smbHeader.Mid;

                this.SmbParametersBlock = new SmbParameters();
                this.smbParametersBlock.WordCount = smbPacket.smbParametersBlock.WordCount;
                if (smbPacket.smbParametersBlock.Words != null)
                {
                    this.smbParametersBlock.Words = new ushort[smbPacket.smbParametersBlock.Words.Length];
                    Array.Copy(smbPacket.smbParametersBlock.Words,
                        this.smbParametersBlock.Words,
                        smbPacket.smbParametersBlock.Words.Length);
                }
                else
                {
                    this.smbParametersBlock.Words = new ushort[0];
                }

                this.SmbDataBlock = new SmbData();
                this.smbDataBlock.ByteCount = smbPacket.smbDataBlock.ByteCount;
                if (smbPacket.smbDataBlock.Bytes != null)
                {
                    this.smbDataBlock.Bytes = new byte[smbPacket.smbDataBlock.Bytes.Length];
                    Array.Copy(smbPacket.smbDataBlock.Bytes,
                        this.smbDataBlock.Bytes,
                        smbPacket.smbDataBlock.Bytes.Length);
                }
                else
                {
                    this.smbDataBlock.Bytes = new byte[0];
                }
            }
        }

        #endregion

        #region encoding

        /// <summary>
        /// to marshal the packet struct to bytes array.
        /// auto filled when ToBytes(), if not explicitly set.
        /// </summary>
        /// <returns>the bytes array of the packet.</returns>
        public override byte[] ToBytes()
        {
            // Convert the CIFS packet with out TransportHeader to byte array
            return ToBytes(true);
        }

        /// <summary>
        /// Convert the CIFS packet to byte array
        /// </summary>
        /// <param name="withoutTransportHeader">Indicates if CIFS packet have  TransportHeader.</param>
        /// <returns>byte array of CIFS packet</returns>
        protected byte[] ToBytes(bool withoutTransportHeader)
        {
            byte[] bytesWithoutHeader = this.GetBytesWithoutHeader();

            // get the total CIFS packet size:
            int size = this.HeaderSize + bytesWithoutHeader.Length;

            if (this.transportHeader.StreamProtocolLength == null)
            {
                // set transportHeader:
                this.transportHeader.StreamProtocolLength = new byte[3];
                this.transportHeader.StreamProtocolLength[0] = (byte)(size >> 16);
                this.transportHeader.StreamProtocolLength[1] = (byte)(size >> 8);
                this.transportHeader.StreamProtocolLength[2] = (byte)size;
            }

            if (!withoutTransportHeader)
            {
                // init packet bytes:
                byte[] packetBytes = new byte[size];
                using (MemoryStream memoryStream = new MemoryStream(packetBytes))
                {
                    using (Channel channel = new Channel(null, memoryStream))
                    {
                        channel.BeginWriteGroup();
                        channel.Write<TransportHeader>(this.transportHeader);
                        channel.Write<SmbHeader>(this.smbHeader);
                        channel.WriteBytes(bytesWithoutHeader);
                        channel.EndWriteGroup();
                    }
                }
                return packetBytes;
            }
            else
            {
                // init packet bytes:
                byte[] packetBytes = new byte[size];
                using (MemoryStream memoryStream = new MemoryStream(packetBytes))
                {
                    using (Channel channel = new Channel(null, memoryStream))
                    {
                        channel.BeginWriteGroup();
                        channel.Write<SmbHeader>(this.smbHeader);
                        channel.WriteBytes(bytesWithoutHeader);
                        channel.EndWriteGroup();
                    }
                }
                return packetBytes;
            }
        }

        /// <summary>
        /// encode the smb parameters: from the concrete Smb Parameters to the general SmbParameters.
        /// </summary>
        protected abstract void EncodeParameters();

        /// <summary>
        /// encode the smb data:: from the concrete Smb Dada to the general SmbDada.
        /// </summary>
        protected abstract void EncodeData();

        /// <summary>
        /// to encode the SmbParameters and SmbDada into bytes.
        /// </summary>
        /// <returns>the bytes array of SmbParameters, SmbDada, and AndX if existed.</returns>
        protected internal abstract byte[] GetBytesWithoutHeader();

        #endregion

        #region decoding

        /// <summary>
        /// to unmarshal the SmbParameters struct from a channel.
        /// </summary>
        /// <param name="channel">the channel started with SmbParameters.</param>
        /// <returns>the size in bytes of the SmbParameters.</returns>
        protected internal virtual int ReadParametersFromChannel(Channel channel)
        {
            this.smbParametersBlock = channel.Read<SmbParameters>();
            this.DecodeParameters();
            return 1 + this.smbParametersBlock.WordCount * 2;
        }

        /// <summary>
        /// to unmarshal the SmbDada struct from a channel.
        /// </summary>
        /// <param name="channel">the channel started with SmbDada.</param>
        /// <returns>the size in bytes of the SmbDada.</returns>
        protected internal virtual int ReadDataFromChannel(Channel channel)
        {
            this.smbDataBlock = channel.Read<SmbData>();
            this.DecodeData();
            return 2 + this.smbDataBlock.ByteCount;
        }

        /// <summary>
        /// to decode the smb parameters: from the general SmbParameters to the concrete Smb Parameters.
        /// </summary>
        protected abstract void DecodeParameters();

        /// <summary>
        /// to decode the smb data: from the general SmbDada to the concrete Smb Data.
        /// </summary>
        protected abstract void DecodeData();

        #endregion

        #region message signature mechenism
        /// <summary>
        /// Sign the packet: Compute the signature and put it in the Signature field of header.
        /// </summary>
        /// <param name="clientNextSendSequenceNumber">sequence number for the next signed
        /// request being sent.</param>
        /// <param name="sessionKey">the session key.</param>
        /// <exception cref="System.ArgumentException">
        /// the ClientNextSendSequenceNumber of Connection must be initialized to 2.</exception>
        public void Sign(ulong clientNextSendSequenceNumber, byte[] sessionKey)
        {
            this.Sign(clientNextSendSequenceNumber, sessionKey, new byte[0]);
        }

        /// <summary>
        /// Sign the packet: Compute the signature and put it in the Signature field of header.
        /// </summary>
        /// <param name="clientNextSendSequenceNumber">sequence number for the next signed
        /// request being sent.</param>
        /// <param name="sessionKey">the session key.</param>
        /// <param name="challengeResponse">the challenge response.</param>
        /// <exception cref="System.ArgumentException">
        /// the ClientNextSendSequenceNumber of Connection must be initialized to 2.</exception>
        public void Sign(ulong clientNextSendSequenceNumber, byte[] sessionKey, byte[] challengeResponse)
        {
            if (clientNextSendSequenceNumber < 2)
            {
                throw new ArgumentException(
                    "the ClientNextSendSequenceNumber of Connection must be initialized to 2.",
                    "clientNextSendSequenceNumber");
            }

            // update the signature flag
            this.smbHeader.Flags2 |= SmbFlags2.SMB_FLAGS2_SMB_SECURITY_SIGNATURE;

            // if the session key is null,
            // just set the security signature in flag2,
            // then, return.
            if (sessionKey == null)
            {
                return;
            }

            // the 32-bit sequence number is copied in little-endian order (least-significant byte first)
            // into the first 4 bytes of the SecuritySignature field.
            this.smbHeader.SecurityFeatures = clientNextSendSequenceNumber;

            // get md5 hascode of session key and message body
            byte[] securitySignature = CifsMessageUtils.CreateSignature(this.ToBytes(true), sessionKey, challengeResponse);

            // update to security signature.
            this.smbHeader.SecurityFeatures = BitConverter.ToUInt64(securitySignature, 0);
        }

        #endregion

        /// <summary>
        /// the version of SMB packet, always returns SMB.
        /// </summary>
        public override SmbVersion Version
        {
            get
            {
                return SmbVersion.SMB;
            }
        }

        /// <summary>
        /// to create an instance of the StackPacket class that is identical to the current StackPacket.
        /// </summary>
        /// <returns>The copy of this instance</returns>
        public override StackPacket Clone()
        {
            return ObjectUtility.DeepClone(this) as SmbPacket;
        }
    }
}


text:
from __future__ import unicode_literals

from mongoengine import *

class Flight(EmbeddedDocument):
    flight_number = IntField()
    start_time = DateTimeField()
    end_time = DateTimeField()
    in_flight_start_time = DateTimeField()
    launch_location = PointField()
    landing_location = PointField()

class MonitoredObject(Document):
    meta = {
        'allow_inheritance': True,
    }
    TYPES = {
        'rocket': "rocket",
    }
    uuid = UUIDField(required=True)
    name = StringField(required=True)
    description = StringField()
    identifier = StringField(required=True, unique=True)
    sensor_ids = ListField(UUIDField())

class Aircraft(MonitoredObject):
    meta = {
        'allow_inheritance': True,
    }
    flights = ListField(EmbeddedDocumentField(Flight))

class Rocket(Aircraft):
    target_altitude = FloatField()

class RocketEngine(MonitoredObject):
    pass

class SensorMeasurement(EmbeddedDocument):
    name = StringField(required=True)

class Sensor(Document):
    meta = {
        'allow_inheritance': True,
    }
    TYPES = {
        'barometer': "Barometer",
        'thermometer': "Thermometer",
        'altimeter': "altimeter",
        'gps': "gps",
        'other': "Other",
    }
    LOCATIONS = {
        'local': "local",
        'remote': "remote",
    }
    name = StringField(required=True)
    uuid = UUIDField(required=True)
    type = StringField(required=True)
    description = StringField()

    def is_local(self):
        raise NotImplementedError

class RemoteSensor(Sensor):
    measurements = ListField(EmbeddedDocumentField(SensorMeasurement))
    node = StringField(required=True)

    def is_local(self):
        return False

class LocalSensor(Sensor):
    measurements = ListField(EmbeddedDocumentField(SensorMeasurement))
    interface_id = UUIDField(required=True)

    def is_local(self):
        return True

class Transmitter(Document):
    type = "transmitter"
    name = StringField(required=True)
    uuid = UUIDField(required=True)
    description = StringField()
    interface_id = UUIDField(required=True)

class DeviceInterface(Document):
    meta = {
        'allow_inheritance': True,
    }
    TYPES = {
        'serial': "serial",
    }
    uuid = UUIDField(required=True)

class SerialDeviceInterface(DeviceInterface):
    BAUD_RATES = {
        '4800': "4800",
        '9600': "9600",
        '57600': "57600",
    }
    baud_rate = StringField(required=True)
    port = StringField(required=True)
    type = StringField(default="serial")


text:
package im.actor.server.util

import java.io.File
import java.nio.file.{ Files, Path }

import scala.concurrent.{ ExecutionContext, Future, blocking }

import akka.actor.ActorSystem
import akka.stream.Materializer
import akka.stream.io.SynchronousFileSink
import akka.stream.scaladsl.Source
import akka.util.ByteString

object FileUtils {

  // FIXME: #perf pinned dispatcher
  def getFileLength(file: File)(implicit ec: ExecutionContext): Future[Long] = {
    Future {
      blocking {
        file.length()
      }
    }
  }

  def createTempDir()(implicit ec: ExecutionContext): Future[File] = {
    Future {
      blocking {
        Files.createTempDirectory("file-utils").toFile
      }
    }
  }

  def createTempFile(implicit ec: ExecutionContext): Future[Path] = {
    Future {
      blocking {
        Files.createTempFile("file", "")
      }
    }
  }

  def deleteDir(dir: File)(implicit ec: ExecutionContext): Future[Unit] = {
    Future {
      blocking {
        org.apache.commons.io.FileUtils.deleteDirectory(dir)
      }
    }
  }

  def writeBytes(bytes: ByteString)(implicit system: ActorSystem, materializer: Materializer, ec: ExecutionContext): Future[(Path, Long)] = {
    for {
      file ← createTempFile
      size ← Source.single(bytes).runWith(SynchronousFileSink(file.toFile))
    } yield (file, size)
  }

  def s3Key(id: Long, name: String): String = {
    if (name.isEmpty) {
      s"file_${id}"
    } else {
      s"file_${id}/${name}"
    }
  }
}


text:
package org.eclipse.freemarker.internal.core.documentModel.provisional.contenttype;

import org.eclipse.freemarker.internal.core.FMCorePlugin;

public class ContentTypeIdForFM {
	/**
	 * The value of the contenttype id field must match what is specified in
	 * plugin.xml file. Note: this value is intentially set with default
	 * protected method so it will not be inlined.
	 */
	public final static String ContentTypeID_PHP = getConstantString();

	/**
	 * Don't allow instantiation.
	 */
	private ContentTypeIdForFM() {
		super();
	}

	static String getConstantString() {
		return FMCorePlugin.ID + ".fmsource"; //$NON-NLS-1$
	}
}


text:
layout: post
title:  "Buttons"
date:   2014-03-01 20:51:19
categories: 0.0.1
tags: modules
---

Button classes in Princess are stacked. The base class is `prncs-btn`. Once that has been applied, you can apply any other classes in whatever order you want.

<button class="prncs-btn">Default Button</button>

{% highlight html %}
<button class="prncs-btn">Default Button</button>
{% endhighlight %}

## Button options

Available options include:

* Size: micro, small, default, large
* Borders: rectangle, slightly rounded, very rounded
* Colors: *every* color available!
* Block buttons

### Button sizes

<button class="prncs-btn prncs-btn-micro">Micro Button</button>
<button class="prncs-btn prncs-btn-small">Small Button</button>
<button class="prncs-btn">Default Button</button>
<button class="prncs-btn prncs-btn-large">Large Button</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-micro">Micro Button</button>
<button class="prncs-btn prncs-btn-small">Small Button</button>
<button class="prncs-btn">Default Button</button>
<button class="prncs-btn prncs-btn-large">Large Button</button>
{% endhighlight %}

### Button borders

There are three types of buttons available in Princess:

* Rectangle (default)
* Rounded (slight curved edges)
* Round (emphasize curved edges)

<button class="prncs-btn prncs-btn-rounded">Rounded Button</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-rounded">Rounded Button</button>
{% endhighlight %}

<button class="prncs-btn prncs-btn-round">Round Button</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-round">Round Button</button>
{% endhighlight %}

### Button colors

The default button is `$textLightest`. Buttons are available in all colors.

<button class="prncs-btn prncs-btn-text">text</button> <button class="prncs-btn prncs-btn-textLight">textLight</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-text">text</button>
<button class="prncs-btn prncs-btn-textLight">textLight</button>
{% endhighlight %}

<!--  -->

<button class="prncs-btn prncs-btn-primary">primary</button> <button class="prncs-btn prncs-btn-primaryLight">primaryLight</button> <button class="prncs-btn prncs-btn-primaryLightest">primaryLightest</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-primary">primary</button>
<button class="prncs-btn prncs-btn-primaryLight">primaryLight</button>
<button class="prncs-btn prncs-btn-primaryLightest">primaryLightest</button>
{% endhighlight %}

<!--  -->

<button class="prncs-btn prncs-btn-accent">accent</button> <button class="prncs-btn prncs-btn-accentLight">accentLight</button> <button class="prncs-btn prncs-btn-accentLightest">accentLightest</button> <button class="prncs-btn prncs-btn-accentDark">accentDark</button> <button class="prncs-btn prncs-btn-accentDarkest">accentDarkest</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-accent">accent</button>
<button class="prncs-btn prncs-btn-accentLight">accentLight</button>
<button class="prncs-btn prncs-btn-accentLightest">accentLightest</button>
<button class="prncs-btn prncs-btn-accentDark">accentDark</button>
<button class="prncs-btn prncs-btn-accentDarkest">accentDarkest</button>
{% endhighlight %}

<!--  -->

<button class="prncs-btn prncs-btn-alert">alert</button> <button class="prncs-btn prncs-btn-alertLight">alertLight</button> <button class="prncs-btn prncs-btn-alertLightest">alertLightest</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-alert">alert</button>
<button class="prncs-btn prncs-btn-alertLight">alertLight</button>
<button class="prncs-btn prncs-btn-alertLightest">alertLightest</button>
{% endhighlight %}

<!--  -->

<button class="prncs-btn prncs-btn-gray">gray</button> <button class="prncs-btn prncs-btn-grayDark">grayDark</button> <button class="prncs-btn prncs-btn-grayDarkest">grayDarkest</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-gray">gray</button>
<button class="prncs-btn prncs-btn-grayDark">grayDark</button>
<button class="prncs-btn prncs-btn-grayDarkest">grayDarkest</button>
{% endhighlight %}

### Block buttons

The block button defaults to size Medium, but it can be used with other button sizes. You can also use other button colors or borders.

<button class="prncs-btn prncs-btn-block">Block Button</button>

{% highlight html %}
<button class="prncs-btn prncs-btn-block">Block Button</button>
{% endhighlight %}


text:
import PageNotFound from './PageNotFound'

export default PageNotFound


text:
require 'shoulda_ext/matchers/record_count_change'
require 'shoulda_ext/matchers/trigger_callback'
require 'shoulda_ext/matchers/respond_with_json'

module ShouldaExt # :nodoc:
  module Matchers # :nodoc:
  end
end


text:
class InfiniteTime < Time
  module TimeCompatability
    def self.define_method name, arity = 0, &block
      super name do |*args|
        unless arity === args.length
          raise ArgumentError, "wrong number of arguments (#{args.length} for #{arity})"
        end
        instance_exec(*args, &block)
      end
    end

    def self.nil_method name, arity = 0
      define_method(name, arity) { nil }
    end
    def self.nil_methods names
      names.each { |name| nil_method name }
    end

    def self.signed_method name, arity = 0
      define_method(name, arity) { to_f }
    end
    def self.signed_methods names
      names.each { |name| signed_method name }
    end

    def self.self_method name, arity = 0
      define_method(name, arity) { self }
    end
    def self.self_methods names
      names.each { |name| self_method name }
    end

    signed_methods %i[year month day yday wday hour minute second subsec nsec usec]
    nil_methods %i[monday? tuesday? wednesday? thursday? friday? saturday? sunday?]
    nil_methods %i[dst? isdst gmt? gmt_offset gmtoff utc? utc_offset zone]
    self_method :round, 0..1
    self_method :succ
    alias_method :mday, :day
    alias_method :mon, :month
    alias_method :sec, :second
    alias_method :tv_nsec, :nsec
    alias_method :tv_usec, :usec
  end
  private_constant :TimeCompatability
end


text:
import Ember from 'ember';
import MagicTableRoute from 'ember-imdt-magic-crud/mixins/magic-table-route';

export default Ember.Route.extend(MagicTableRoute, {});