text:
using namespace BloombergLP;
using bsl::cout;
using bsl::cerr;
using bsl::endl;
using bsl::ends;

// ============================================================================
//                             TEST PLAN
// ----------------------------------------------------------------------------
//                             Overview
//                             --------
// ----------------------------------------------------------------------------
// CREATORS
// [ 2] SimpleBlobBufferFactory(int, Allocator *);
// [ 2] ~SimpleBlobBufferFactory();
// [ 3] SimpleBlobBufferFactory(int);
//
// MANIPULATORS
// [ 2] void allocate(BlobBuffer *);
// [ 2] void setBufferSize(int);
//
// ACCESSORS
// [ 2] int bufferSize() const;
// ----------------------------------------------------------------------------
// [ 1] BREATHING TEST
// [ 3] SimpleBlobBufferFactory with Blob
// [ 4] USAGE EXAMPLE
// ----------------------------------------------------------------------------

// ============================================================================
//                     STANDARD BDE ASSERT TEST FUNCTION
// ----------------------------------------------------------------------------

namespace {

int testStatus = 0;

void aSsErT(bool condition, const char *message, int line)
{
    if (condition) {
        cout << "Error " __FILE__ "(" << line << "): " << message
             << "    (failed)" << endl;

        if (0 <= testStatus && testStatus <= 100) {
            ++testStatus;
        }
    }
}

}  // close unnamed namespace

// ============================================================================
//               STANDARD BDE TEST DRIVER MACRO ABBREVIATIONS
// ----------------------------------------------------------------------------

#define ASSERT       BSLIM_TESTUTIL_ASSERT
#define ASSERTV      BSLIM_TESTUTIL_ASSERTV

#define LOOP_ASSERT  BSLIM_TESTUTIL_LOOP_ASSERT
#define LOOP0_ASSERT BSLIM_TESTUTIL_LOOP0_ASSERT
#define LOOP1_ASSERT BSLIM_TESTUTIL_LOOP1_ASSERT
#define LOOP2_ASSERT BSLIM_TESTUTIL_LOOP2_ASSERT
#define LOOP3_ASSERT BSLIM_TESTUTIL_LOOP3_ASSERT
#define LOOP4_ASSERT BSLIM_TESTUTIL_LOOP4_ASSERT
#define LOOP5_ASSERT BSLIM_TESTUTIL_LOOP5_ASSERT
#define LOOP6_ASSERT BSLIM_TESTUTIL_LOOP6_ASSERT

#define Q            BSLIM_TESTUTIL_Q   // Quote identifier literally.
#define P            BSLIM_TESTUTIL_P   // Print identifier and value.
#define P_           BSLIM_TESTUTIL_P_  // P(X) without '\n'.
#define T_           BSLIM_TESTUTIL_T_  // Print a tab (w/o newline).
#define L_           BSLIM_TESTUTIL_L_  // current Line number

// ============================================================================
//                  NEGATIVE-TEST MACRO ABBREVIATIONS
// ----------------------------------------------------------------------------

#define ASSERT_SAFE_PASS(EXPR) BSLS_ASSERTTEST_ASSERT_SAFE_PASS(EXPR)
#define ASSERT_SAFE_FAIL(EXPR) BSLS_ASSERTTEST_ASSERT_SAFE_FAIL(EXPR)

// ============================================================================
//                        GLOBAL TYPEDEFS FOR TESTING
// ----------------------------------------------------------------------------

typedef bdlbb::SimpleBlobBufferFactory Factory;
typedef bsls::Types::Int64             Int64;
using   bdlbb::BlobBuffer;
using   bdlbb::Blob;

// ============================================================================
//                                TYPE TRAITS
// ----------------------------------------------------------------------------

BSLMF_ASSERT(bslmf::IsBitwiseMoveable< Factory>::value);
BSLMF_ASSERT(bslma::UsesBslmaAllocator<Factory>::value);

// ============================================================================
//                             GLOBAL TEST FUNCTIONS
// ----------------------------------------------------------------------------

namespace {
namespace u {

char getAlphaData = 0;
char getAlpha()
    // Return a lowercase alphabetic character, incrementing one each time,
    // returning to 'a' after reaching 'z'.  If 'reset' is 'true', reset the
    // the counter so that the next call will return 'a'.
{
    return !getAlphaData || 'z' == getAlphaData ? (getAlphaData = 'a')
                                                : ++getAlphaData;
}

void fillAlpha(const BlobBuffer& blobBuffer)
    // Fill the memory at the specified 'blobBuffer' with the lower case
    // alphabet, repeating if necessary.
{
    char *dst    = &*blobBuffer.buffer();
    int   length = blobBuffer.size();

    getAlphaData = 0;
    for (const char * const end = dst + length; dst < end; ++dst) {
        *dst = getAlpha();
    }
}

bool checkAlpha(const BlobBuffer& blobBuffer)
    // Check that the memory of the specified 'blobBuffer' is filled with the
    // lower case alphabet, repeating if necessary.  Return 'true' if the
    // memory all matches and 'false' otherwise.
{
    const char *src    = &*blobBuffer.buffer();
    const int   length = blobBuffer.size();

    getAlphaData = 0;
    for (const char * const end = src + length; src < end; ++src) {
        if (getAlpha() != *src) {
            return false;                                             // RETURN
        }
    }

    return true;
}

bool fileExists(const char *fileName)
    // Return 'true' if the specified 'fileName' exists and 'false' otherwise.
    // Note that 'fileName' may specify a directory.
{
#if defined(BSLS_PLATFORM_OS_UNIX)
    struct stat s;
    return 0 == ::stat(fileName, &s);
#else
    return INVALID_FILE_ATTRIBUTES != GetFileAttributesA(fileName);
#endif
}

bool isAtTopLevelDir()
    // Return 'true' if the current working directory is at the top of the file
    // system and 'false' otherwise.
{
    char cwd[1024];
    getcwd(cwd, sizeof(cwd));

#if defined(BSLS_PLATFORM_OS_UNIX)
    return !bsl::strcmp("/", cwd);
#else
    const char *pc = bsl::strchr(cwd, ':');
    pc = pc ? pc + 1 : cwd;
    return !bsl::strcmp("\\", pc);
#endif
}

void moveUpOneDir()
    // Change the current working directory to the parent of the current one.
    // The behavior is undefined if we were already at the top level.
{
#if defined(BSLS_PLATFORM_OS_UNIX)
    ::chdir("..");
#else
    _chdir("..");
#endif
}

void fillSlashes(char *string)
    // Substitute all '+'s in the specified 'string' with a slash character
    // appropriate for the OS.
{
#if defined(BSLS_PLATFORM_OS_UNIX)
    const char slash = '/';
#else
    const char slash = '\\';
#endif

    for (; *string; ++string) {
        if ('+' == *string) {
            *string = slash;
        }
    }
}

}  // close namespace u
}  // close unnamed namespace

// ============================================================================
//                               MAIN PROGRAM
// ----------------------------------------------------------------------------

int main(int argc, char *argv[])
{
    int                 test = argc > 1 ? atoi(argv[1]) : 0;
    bool             verbose = argc > 2;    (void)             verbose;
    bool         veryVerbose = argc > 3;    (void)         veryVerbose;
    bool     veryVeryVerbose = argc > 4;    (void)     veryVeryVerbose;
    bool veryVeryVeryVerbose = argc > 5;    (void) veryVeryVeryVerbose;

    cout << "TEST " << __FILE__ << " CASE " << test << endl;

    // CONCERN: This test driver is reusable w/other, similar components.

    // CONCERN: 'BSLS_REVIEW' failures should lead to test failures.
    bsls::ReviewFailureHandlerGuard reviewGuard(&bsls::Review::failByAbort);

    // CONCERN: In no case does memory come from the global allocator.

    bslma::TestAllocator ta("ta",      veryVeryVeryVerbose);
    bslma::TestAllocator sa("sa",      veryVeryVeryVerbose);

    bslma::TestAllocator da("default", veryVeryVeryVerbose);
    bslma::DefaultAllocatorGuard defaultGuard(&da);

    bslma::TestAllocator globalAllocator("global", veryVeryVeryVerbose);
    bslma::Default::setGlobalAllocator(&globalAllocator);

    switch (test) { case 0:
      case 4: {
        // --------------------------------------------------------------------
        // USAGE EXAMPLE
        //
        // Concerns:
        //: 1 The usage example provided in the component header file compiles,
        //:   links, and runs as shown.
        //
        // Plan:
        //: 1 Incorporate usage example from header into test driver, remove
        //:   leading comment characters, and replace 'assert' with 'ASSERT'.
        //:   (C-1)
        //
        // Testing:
        //   USAGE EXAMPLE
        // --------------------------------------------------------------------

        if (verbose) cout << "USAGE EXAMPLE\n"
                             "=============\n";

//
///Usage
///-----
// In this section we show intended usage of this component.
//
///Example 1: Simple Blob Buffer Factory
///- - - - - - - - - - - - - - - - - - -
// Suppose we want to make a blob that can be grown via calls to 'setLength',
// meaning that it must have a factory, and suppose you want all the memory for
// the blob buffers created for the factory to be allocated directly from a
// certain test allocator for test purposes.  We use a
// 'SimpleBlobBufferFactory'.
//..
// First, we create our allocator:
//..
    bslma::TestAllocator testAllocator;
//..
// Then, we create our factor using that allocator:
//..
    enum { k_BUFFER_SIZE = 1024 };

    bdlbb::SimpleBlobBufferFactory factory(k_BUFFER_SIZE, &testAllocator);
    ASSERT(factory.bufferSize() == k_BUFFER_SIZE);
//..
// Next, we create our blob using that factory:
//..
    bdlbb::Blob blob(&factory);
//..
// Next, we set the length big enough to require 20 blob buffers:
//..
    blob.setLength(1024 * 20);
//..
// Then, we verify that the memory came from 'testAllocator'.  Note that since
// the blob buffers contain shared pointers, additional memory other than the
// writable areas of the blob buffers is allocated:
//..
    ASSERT(1024 * 20 < testAllocator.numBytesInUse());
//..
// Now, we examine the state of the blob:
//..
    ASSERT(20 == blob.numDataBuffers());
    ASSERT(20 == blob.numBuffers());
    ASSERT(1024 * 20 == blob.length());
//..
// Finally, we examine the blob buffers:
//..
    for (int ii = 0; ii < blob.numDataBuffers(); ++ii) {
        ASSERT(k_BUFFER_SIZE == blob.buffer(ii).size());
    }
//..
      } break;
      case 3: {
        // --------------------------------------------------------------------
        // CONCERN: INTER-OPERABILITY WITH BLOB
        //
        // Concerns:
        //: 1 That the 'SimpleBlobBufferFactory' can be used correctly with
        //:   a 'Blob'.
        //:
        //: 2 Test calling the constructor, both with and without an allocator
        //:   specified.
        //
        // Plan:
        //: 1 Create a 'Blob' with a 'SimpleBlobBufferFactory' and have it
        //:   create a lot of blobs, write data to them, and read it back
        //:   again.
        //:
        //: 2 Open the source for this test driver in this directory, read it
        //:   all into a blob, then read it again and verify the all the
        //:   characters in the file match the characters in the blob.
        //:
        //: 3 Use 'bsl_cstdio.h' for I/O, to avoid needing to depend on
        //:   'bdls_filesystemutil', since 'bdlbb' has no dependency on 'bdls'.
        //
        // Testing:
        //   SimpleBlobBufferFactory with Blob
        //   SimpleBlobBufferFactory(int);
        // --------------------------------------------------------------------

        if (verbose) cout << "CONCERN: INTER-OPERABILITY WITH BLOB\n"
                             "====================================\n";

        enum { bufferSize = 128 };

        // Move up to the directory containing the 'bde' directory, or fail if
        // we reach the top level first.

        while (!u::fileExists("bde")) {
            if (u::isAtTopLevelDir()) {
                ASSERT(0 && "reached top level without finding 'bde'");
                break;    // 'fopen' below will fail and test will abort
            }

            u::moveUpOneDir();
        }

        if (verbose) cout << "Open the test driver.\n";

        char filePath[] = {
                  "bde+groups+bdl+bdlbb+bdlbb_simpleblobbufferfactory.t.cpp" };
        u::fillSlashes(filePath);
        FILE *fp = bsl::fopen(filePath, "rb");
        if (!fp) {
            ASSERTV(filePath, 0 && "unable to fopen file");
            break;
        }

        if (verbose) cout <<
                       "Set 'fLen', the length in bytes of the test driver.\n";

        int rc = bsl::fseek(fp, 0, SEEK_END);
        BSLS_ASSERT(0 == rc);
        const int fLen = static_cast<int>(bsl::ftell(fp));
        ASSERTV(fLen, 5 * 1000 < fLen);

        if (verbose) P(fLen);

        for (int ti = 0; ti < 2; ++ti) {
            bool defaultMemory = ti & 1;

            if (veryVerbose) cout << (0 == ti ? "" : "\n") << "Pass: " << ti <<
                         (defaultMemory ? " using default memory\n"
                                        : " using memory supplied to c'tor\n");

            bsl::rewind(fp);

            if (veryVerbose) cout <<
                         "Create our factory and a blob using that factory.\n";

            Factory  daFactory(bufferSize);    // default allocator == 'da'
            Factory  taFactory(bufferSize, &ta);
            Factory& factory = defaultMemory ? daFactory : taFactory;
            ASSERT(factory.bufferSize() == bufferSize);
            Blob     blob(&factory, &sa);

            if (veryVerbose) cout <<
                "Traverse the file and load its contents into the blob,\n"
                "growing as needed.  Do a few sanity checks.\n";

            int c, blobLen = 0;
            while (EOF != (c = getc(fp))) {
                ASSERTV(c, blobLen, 0 < c && c < 128);    // ascii

                const int          iBuf  = blobLen / bufferSize;
                const int          iChar = blobLen % bufferSize;
                blob.setLength(++blobLen);
                const BlobBuffer&  bBuf  = blob.buffer(iBuf);
                ASSERTV(bBuf.size(), bufferSize == bBuf.size());
                ASSERTV(iChar, blob.lastDataBufferLength(),
                                     iChar + 1 == blob.lastDataBufferLength());
                ASSERTV(blob.numDataBuffers(), blob.numBuffers(),
                                   blob.numDataBuffers() == blob.numBuffers());
                char              *buf   = &*bBuf.buffer();

                buf[iChar] = static_cast<char>(c);
            }
            ASSERT(EOF == getc(fp));
            ASSERTV(fLen, blobLen, fLen == blobLen);
            ASSERTV(fLen, blob.length(), fLen == blob.length());

            if (veryVerbose) cout <<
                "Examing memory consumption.  Note that the blob itself\n"
                "allocates memory from 'sa', a different source.  Also note\n"
                "that since the blob buffers contain shared pointers, the\n"
                "total memory allocated by the factory's allocator will\n"
                "exceed 'fLen'.\n";

            if (defaultMemory) {
                ASSERT(da.numBytesInUse() > fLen);
                ASSERT(ta.numBytesInUse() == 0);
            }
            else {
                ASSERT(da.numBytesInUse() == 0);
                ASSERT(ta.numBytesInUse() > fLen);
            }

            if (veryVerbose) {
                cout << "Finished reading blob:\n";
                P_(blob.numBuffers());    P(blob.numDataBuffers());
                P_(blob.length());        P(blob.lastDataBufferLength());
            }

            if (veryVerbose) cout <<
                    "Traverse the file and the blob again, this time\n"
                    "comparing the file's contents with the contents of the\n"
                    "blob.\n";

            int numChars = 0;
            bsl::rewind(fp);
            for (int iBuf = 0; iBuf < blob.numBuffers(); ++iBuf) {
                const BlobBuffer&  bBuf   = blob.buffer(iBuf);
                const char        *buf    = bBuf.data();
                const int          bufLen = blob.numBuffers() - 1 == iBuf
                                          ? blob.lastDataBufferLength()
                                          : bBuf.size();
                for (int ii = 0; ii < bufLen; ++ii, ++numChars) {
                    const int c = bsl::getc(fp);
                    ASSERTV(c, iBuf, ii, 0 < c && c < 128);    // ascii
                    ASSERTV(iBuf, ii, c == buf[ii]);

                    if (veryVeryVerbose) cout << buf[ii];
                }
            }
            ASSERT(EOF == getc(fp))
            ASSERT(fLen == numChars);

            if (0 == ti) {
                ASSERT(!defaultMemory);
                ASSERT(0 == da.numAllocations());
            }
            else {
                ASSERT(0 <  da.numAllocations());
            }
        }

        bsl::fclose(fp);
      } break;
      case 2: {
        // --------------------------------------------------------------------
        // TESTING: BASIC FUNCTIONALITY OF CLASS
        //
        // Concerns:
        //: 1 Test the basic functionality of the class
        //:   o primary constructor
        //:   o manipulators
        //:   o accessor
        //:
        //: 2 The factory is capable of producing buffers of any desired size.
        //:
        //: 3 The factory can vary the buffer size and subsequent buffers will
        //:   be of that size.
        //:   o the first blob buffers created will be at the size specified
        //:     at construction
        //:   o if 'setBufferSize' is called, subsequent buffers are created
        //:     of that size
        //:
        //: 4 The blob buffers created are functional and can hold data, and
        //:   free up their memory when destroyed.
        //
        // Plan:
        //: 1 Iterate over a set of random blob sizes.  Use the 'setBufferSize'
        //:   function at the beginning of each iteration to set the blob
        //:   buffer size.
        //:
        //: 2 Create a function 'u::fileAlpha' which will populate the memory
        //:   of a blob buffer with the lower case alphabet, repeated if need
        //:   be.
        //:
        //: 3 Create a function 'u::checkAlpha' which will verify that a blob
        //:   has been entirely filled with the lower case alphabet, repeated
        //:   if need be.
        //:
        //: 4 In an inner loop, create 5 blob buffers of the given size:
        //:   o verify that their length is correct
        //:   o verify that the memory allocated grew by an amount greater than
        //:     the blob size (due to shared ptr overhead)
        //:   o fill the memory with data with 'fillAlpha'.
        //:   o verify the memory has been correctly set with 'checkAlpha'.
        //:   o store the blob into a 'deque'
        //:
        //: 5 Iterate through all the blob buffers in the 'deque'.
        //:   o verify that their size is correct
        //:   o verify that the data in them is correct with 'checkAlpha'.
        //:
        //: 6 Iterate, popping items from the back of the deque and observe the
        //:   memory in use decreasing as expected as the blob buffers free
        //:   their managed memory.
        //
        // Testing:
        //   SimpleBlobBufferFactory(int, Allocator *);
        //   ~SimpleBlobBufferFactory();
        //   void allocate(BlobBuffer *);
        //   void setBufferSize(int);
        //   int bufferSize() const;
        // --------------------------------------------------------------------

        if (verbose) cout << "TESTING: BASIC FUNCTIONALITY OF CLASS\n"
                             "=====================================\n";

        ASSERT(0 == ta.numAllocations());

        int sizes[] = { 8, 100, 30, 10 * 1000, 47, 200 };
        enum { k_NUM_SIZES = sizeof sizes / sizeof *sizes };

        Factory factory(sizes[0], &ta);
        bsl::deque<BlobBuffer> bBufs(&sa);
        bsl::deque<Int64>      allocs(&sa);

        Int64 alloced = ta.numBytesInUse();
        ASSERT(0 == alloced);

        if (verbose) cout << "Iterate, creating & populating blob buffers\n";

        int prevSize = sizes[0], size;
        for (int ii = 0; ii < k_NUM_SIZES; ++ii, prevSize = size) {
            size = sizes[ii];

            if (veryVerbose) { P_(ii);    P(size); }

            if (0 < ii) {
                ASSERT(factory.bufferSize() == prevSize);
                factory.setBufferSize(size);
            }

            for (int jj = 0; jj < 5; ++jj) {
                if (veryVeryVerbose) cout << '.';

                ASSERT(factory.bufferSize() == size);

                BlobBuffer bb;
                factory.allocate(&bb);
                ASSERT(bb.size() == size);

                Int64 memoryGrowth = ta.numBytesInUse() - alloced;
                ASSERT(memoryGrowth >= size);
                allocs.push_back(memoryGrowth);
                alloced = ta.numBytesInUse();

                u::fillAlpha(bb);
                ASSERT(u::checkAlpha(bb));

                bBufs.push_back(bb);
            }

            if (veryVeryVerbose) cout << endl;
        }

        if (verbose) cout <<
                 "Traverse the blob buffers and verify that the data is\n"
                 "    still there\n";

        for (unsigned uu = 0; uu < bBufs.size(); ++uu) {
            size = sizes[uu / 5];

            BlobBuffer bb = bBufs[uu];

            ASSERTV(uu, size, bb.size() == size);
            ASSERTV(uu, u::checkAlpha(bb));

            ASSERTV(uu, alloced, ta.numBytesInUse(),
                                                ta.numBytesInUse() == alloced);
        }

        if (verbose) cout <<
                 "Randomly destroy buffers and observe that, in each case,\n"
                 "    exactly the amount of memory that was consumed in\n"
                 "    their creation is freed up.\n";

        while (!bBufs.empty()) {
            const int ii = bsl::rand() % static_cast<int>(bBufs.size());
            const Int64 before    = ta.numBytesInUse();
            const Int64 memoryUse = allocs[ii];
            allocs.erase(allocs.begin() + ii);
            bBufs. erase(bBufs.begin()  + ii);
            ASSERT(ta.numBytesInUse() == before - memoryUse);
        }

        ASSERT(0 == ta.numBlocksInUse());
      } break;
      case 1: {
        // --------------------------------------------------------------------
        // BREATHING TEST
        //   This case exercises (but does not fully test) basic functionality.
        //
        // Concerns:
        //: 1 The class is sufficiently functional to enable comprehensive
        //:   testing in subsequent test cases.
        //
        // Plan:
        //: 1 Create a factory and use it to create many buffers, keeping them
        //:   in a vector.
        //
        // Testing:
        //   BREATHING TEST
        // --------------------------------------------------------------------

        if (verbose) cout << "BREATHING TEST\n"
                             "==============\n";

        const bsl::size_t bufferSize = 128;
        const int         numBuffers = 256;

        bsls::Types::Uint64 inUse, allocSize = 0;
        Factory factory(bufferSize, &ta);
        bsl::vector<BlobBuffer> buffers(&sa);
        buffers.reserve(numBuffers);
        for (int ii = 0; ii < numBuffers; ++ii) {
            BlobBuffer buf;
            factory.allocate(&buf);

            bsl::memset(&*buf.buffer(), 'a', bufferSize);
            const char *start = buf.data(), *end = start + bufferSize;
            for (const char *pc = start; pc < end; ++pc) {
                ASSERTV(*pc, 'a' == *pc);
            }

            buffers.push_back(buf);

            inUse = ta.numBytesInUse();
            if (!allocSize) {
                allocSize = inUse;
            }
            ASSERTV(inUse, buffers.size(), allocSize,
                                          inUse == allocSize * buffers.size());
        }

        inUse = ta.numBytesInUse();
        ASSERTV(inUse, buffers.size(), allocSize,
                                          inUse == allocSize * buffers.size());

        buffers.clear();
        ASSERT(0 == ta.numBytesInUse());
      } break;
      default: {
        cerr << "WARNING: CASE `" << test << "' NOT FOUND." << endl;
        testStatus = -1;
      }
    }

    // CONCERN: In no case does memory come from the global allocator.

    ASSERTV(globalAllocator.numBlocksTotal(),
            0 == globalAllocator.numBlocksTotal());

    if (testStatus > 0) {
        cerr << "Error, non-zero test status = " << testStatus << "." << endl;
    }

    return testStatus;
}

// ----------------------------------------------------------------------------
// Copyright 2019 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------


text:
var fs = require('fs');
var path = require('path');
var EventEmitter = require('events').EventEmitter;

var Bootstrapper = function(config) {
	config = config || {};

	this.path = config.path;
	this.state = config.state;

	this.tasks = [];
};

Bootstrapper.prototype = Object.create(EventEmitter.prototype);

Bootstrapper.prototype.addTask = function(task) {
	this.tasks.push(task);
};

Bootstrapper.prototype.run = function(finished) {
	var dirPath = this.path;
	var state = this.state;

	var that = this;

	if (this.path) {
		fs.readdir(dirPath, function(err, files) {

			processFiles(dirPath, files, [], function(taskModules) {

				// run taskModules
				taskModules.forEach(function(taskModule) {

					if (taskModule.task) {
						that.tasks.push(taskModule.task);
					}

					if (Array.isArray(taskModule.tasks)) {
						taskModule.tasks.forEach(function(task) {
							that.tasks.push(task);
						})
					}
				});

				runTasks(that.tasks, state, function() {
					if (finished) {
						finished(state);
					}

					that.emit('finished', state);
				});
			});
		});
	}
	else {
		runTasks(that.tasks, state, function() {
			if (finished) {
				finished(state);
			}

			that.emit('finished', state);
		});
	}
};

module.exports = Bootstrapper;

var runTasks = function(tasks, state, done) {
	if (tasks.length === 0) {
		return done();
	}

	var task = tasks.shift();

	task(state, function() {
		runTasks(tasks, state, done);
	});
};

var processFiles = function(dir, remainingFiles, taskModules, done) {
	taskModules = taskModules || [];

	if (remainingFiles.length === 0) {
		return done(taskModules);
	}

	var filename = remainingFiles.shift();

	var fullpath = path.join(dir, filename);

	fs.stat(fullpath, function(err, stats) {
		if (err) throw err;

		if (stats) {

			if (stats.isFile() && path.extname(filename) === '.js') {
				var taskModule = require(fullpath);

				if (taskModule) {
					taskModules.push(taskModule);
				}
			}
			else if (stats.isDirectory()) {

			}

			processFiles(dir, remainingFiles, taskModules, done);
		}
	});
};

redpajama_set_name: RedPajamaGithub


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

    var UPDATE_INTERVAL = 10000;
    var restApiUrl = '/mqtt_demo/restful/devicestatus';
    var restApiPushUrl = '/mqtt_demo/restful/command';
    var restApiUrlDummy = 'json/data1.json';
    var spinOpts = {
        lines: 13 // The number of lines to draw
        , length: 48 // The length of each line
        , width: 14 // The line thickness
        , radius: 48 // The radius of the inner circle
        , scale: 1 // Scales overall size of the spinner
        , corners: 1 // Corner roundness (0..1)
        , color: '#000' // #rgb or #rrggbb or array of colors
        , opacity: 0.35 // Opacity of the lines
        , rotate: 27 // The rotation offset
        , direction: 1 // 1: clockwise, -1: counterclockwise
        , speed: 1.2 // Rounds per second
        , trail: 55 // Afterglow percentage
        , fps: 20 // Frames per second when using setTimeout() as a fallback for CSS
        , zIndex: 2e9 // The z-index (defaults to 2000000000)
        , className: 'spinner' // The CSS class to assign to the spinner
        , top: '50%' // Top position relative to parent
        , left: '50%' // Left position relative to parent
        , shadow: false // Whether to render a shadow
        , hwaccel: false // Whether to use hardware acceleration
        , position: 'absolute' // Element positioning
    };

    var app = {
        init: function () {
            this.template = Handlebars.compile($('#info-template').html());
            this.logTemplate = Handlebars.compile($('#log-template').html());
            this.data = [];
            this.logData = [];
            this.selectedData = '';
            this.autoReload = true;
            this.autoReloadId = 0;
            this.bindEvents();
            this.start();
        },
        bindEvents: function () {
            $('#device-info')
                .on('click', 'tr', this.select.bind(this))
                .on('change', '.toggle', this.change.bind(this));
            $('#reload-ctrl-btn').on('click', 'label', this.toggleReload.bind(this));
            $('#submit-cmd').on('click', this.pushCmd.bind(this));
        },
        start: function () {
            this.update();
        },
        update: function () {
            var self = this;
            $('#loader').spin(spinOpts);
            $.getJSON(restApiUrlDummy).then(function (results) {
                self.updateData(results);
                self.render();
                $('#loader').spin(false);
                if (self.autoReload) {
                    self.autoReloadId = setTimeout(self.update.bind(self), UPDATE_INTERVAL);
                }
            });
        },
        updateData: function (datas) {
            var self = this;
            var guids = datas.guids;
            if (_.indexOf(guids, this.selectedData) === -1) {
                this.selectedData = '';
            }
            this.data = [];
            _.each(guids, function (guid) {
                self.data.push(_.extend({guid: guid}, datas[guid]));
            });
        },
        render: function () {
            $('#device-info')
                .html(this.template(this.data))
                .find('input[value="' + this.selectedData + '"]').click();
            $('#guid-text').val(this.selectedData);
        },
        select: function (e) {
            $(e.currentTarget).parent().find('.info').removeClass('info');
            $(e.currentTarget).addClass('info');
            $(e.currentTarget).find('input[type="radio"]').prop('checked', true).change();
        },
        change: function (e) {
            var $selected = $('#device-info').find('input[type="radio"]:checked');
            this.selectedData = $selected.val();
            $('#guid-text').val(this.selectedData);
        },
        toggleReload: function (e) {
            var $reloadCtrl = $(e.target).find('input[type="radio"]');
            this.autoReload = $reloadCtrl.val() === 'ON';
            $('#reload-ctrl-text').text($reloadCtrl.val());
            if (this.autoReload) {
                this.update();
            } else {
                clearTimeout(this.autoReloadId);
            }
        },
        pushCmd: function (e) {
            var self = this;
            e.preventDefault();
            $('#log-loader').spin(spinOpts);
            var data = {
                guid: this.selectedData,
                callback_name: $('#callback-text').val()
            };
            $.post(restApiPushUrl, data).then(function (results) {
                self.updateLog(results);
                self.renderLog();
                $('#log-loader').spin(false);
            });
        },
        updateLog: function (result) {
            var log = {log_at: '', log_comment: ''};
            log.log_at = moment().format('YYYY-MM-DD, h:mm:ss a');
            log.log_comment = result;
            this.logData.unshift(log);
        },
        renderLog: function () {
            $('#log-info').html(this.logTemplate(this.logData));
        }
    };

    app.init();
});


text:
<?php

include_once dirname(__FILE__) . '/../renderers/renderer.php';
include_once dirname(__FILE__) . '/abstract_choices_editor.php';

class ComboBox extends AbstractChoicesEditor
{
    /**
     * @var array
     */
    private $mfuChoices = array();

    /**
     * @var string
     */
    private $emptyDisplayValue;

    /**
     * @param string $name
     * @param string $emptyDisplayValue
     */
    public function __construct($name, $emptyDisplayValue = '')
    {
        parent::__construct($name);
        $this->emptyDisplayValue = $emptyDisplayValue;
        $this->addChoice('', $emptyDisplayValue);
    }

    /**
     * @return bool
     */
    public function hasEmptyChoice()
    {
        return array_key_exists('', $this->getChoices());
    }

    /**
     * @return string
     */
    public function getEmptyDisplayValue()
    {
        return $this->emptyDisplayValue;
    }

    /**
     * @return array
     */
    public function getMFUChoices()
    {
        return array_intersect_key(
            $this->getChoices(),
            array_flip($this->mfuChoices)
        );
    }

    /**
     * @param string $value
     *
     * @return $this
     */
    public function addMFUChoice($value)
    {
        $this->mfuChoices[] = $value;

        return $this;
    }

    /**
     * @return bool
     */
    public function hasMFUChoices()
    {
        return count($this->mfuChoices) > 0;
    }

    public function extractValueFromArray(
        ArrayWrapper $arrayWrapper,
        &$valueChanged)
    {
        if ($arrayWrapper->IsValueSet($this->GetName())) {
            $valueChanged = true;
            $value = $arrayWrapper->GetValue($this->GetName());
            if ($value == '')
                return null;
            else
                return $value;
        } else {
            $valueChanged = false;
            return null;
        }
    }

    public function CanSetupNullValues()
    {
        return false;
    }

    /**
     * @return string
     */
    public function getEditorName()
    {
        return 'combobox';
    }

    protected function DoSetAllowNullValue($allowNullValue)
    {
        if ($allowNullValue) {
            $this->addChoice('', $this->emptyDisplayValue);
        } elseif ($this->hasChoice('')) {
            $this->removeChoice('');
        }
    }
}


text:
title: Lesson 1 After Autumn Half Term (Feedback week)
layout: post
author: barney.mepham
permalink: /lesson-1-after-autumn-half-term-(feedback-week)/
source-id: 1ztR392ndW6SPmX-wOEyFa3hHOXxeSHY8QC5J3RkCxDo
published: true
---

    Title
    Lesson 1 After Autumn Half Term (Feedback week)
    Date
    10/11/16

    Starting point:
    There was not a starting point today as we had a talk about our websites instead

    Target for this lesson?
    To change my website from my feedback and what I thought should be changed

    Did I reach my target?
(add details to "Lesson Review")
    Yes I did i changed the image size, I made my tables wider and I made my titles appear back onto the left

    Lesson Review

    How did I learn? What strategies were effective?

    I learnt by looking at other people's blogs that I needed to make sure my colour scheme worked, that I put enough effort into my homework and to make sure that I have features such as a table. From my feedback and how I felt about my blog I have changed certain features of my blog which I was not fond of, such as the fact that my image was absolutely massive.It was the size of a tennis ball instead of a more sensible size like a penny. I also wanted to make all my titles onto the left side of my page as well as making my tables larger.

    What limited my learning? Which habits do I need to work on?

    I limited by learning by having errors in my code which I did not know how to fix such as the size of my image which was way bigger than it needed to be. I need to remember to check through my code when I write it so it does not cause problems later on such as my sccs file breaking completely which would my website look extremely boring it would have no colour at all which would make it look like wikipedia page.

    What will I change for next time? How will I improve my learning?

    Next time I will remember to check through my code also because my image caused a problem earlier which I managed to fix but the image was still big. I need to also make sure I don't add code that does not needed to be added such as code to align text to the middle as it just made my website look weird as it also affected my paragraphs and it made it look like I added an extra empty line between each line. I will improve my learning overall by reading through my code thinking if I need to add it or will my website look worse.


text:
package eu.cloudopting.web.rest;

import java.util.List;

import javax.inject.Inject;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import eu.cloudopting.domain.CustomizationStatus;
import eu.cloudopting.events.api.controller.AbstractController;
import eu.cloudopting.events.api.service.BaseService;
import eu.cloudopting.service.CustomizationStatusService;

@RestController
@RequestMapping("/api")
public class CustomizationStatusResource extends AbstractController<CustomizationStatus> {

	@Inject
	private CustomizationStatusService customizationStatusService;

	public CustomizationStatusResource() {
		super(CustomizationStatus.class);
	}

	@RequestMapping(value = "/customizationStatus", method = RequestMethod.GET,
			produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public final ResponseEntity<List<CustomizationStatus>> findAll() {
		List<CustomizationStatus> customizationStatusList = getService().findAll();
		return new ResponseEntity<>(customizationStatusList, HttpStatus.OK);
	}

	@Override
	protected BaseService<CustomizationStatus> getService() {
		return customizationStatusService;
	}
}


text:
package com.chinanetcenter.wcs.android.listener;

import org.json.JSONObject;

import java.util.HashSet;

public abstract class SliceUploaderListener {

    public abstract void onSliceUploadSucceed(JSONObject reponseJSON);

    public abstract void onSliceUploadFailured(HashSet<String> errorMessages);

    public void onProgress(long uploaded, long total) {

    }

}


text:
FROM alpine
MAINTAINER Fabrizio Pandini <fabrizio.pandini@gmail.com>

COPY pause /
CMD ["/pause"]


text:
using buzz::QName;
using buzz::XmlElement;

namespace remoting {

HostChangeNotificationListener::HostChangeNotificationListener(
    Listener* listener,
    const std::string& host_id,
    SignalStrategy* signal_strategy,
    const std::string& directory_bot_jid)
    : listener_(listener),
      host_id_(host_id),
      signal_strategy_(signal_strategy),
      directory_bot_jid_(directory_bot_jid),
      weak_factory_(this) {
  DCHECK(signal_strategy_);

  signal_strategy_->AddListener(this);
}

HostChangeNotificationListener::~HostChangeNotificationListener() {
  signal_strategy_->RemoveListener(this);
}

void HostChangeNotificationListener::OnSignalStrategyStateChange(
    SignalStrategy::State state) {
}

bool HostChangeNotificationListener::OnSignalStrategyIncomingStanza(
    const buzz::XmlElement* stanza) {
  if (stanza->Name() != buzz::QN_IQ || stanza->Attr(buzz::QN_TYPE) != "set")
    return false;

  const XmlElement* host_changed_element =
      stanza->FirstNamed(QName(kChromotingXmlNamespace, "host-changed"));
  if (!host_changed_element)
    return false;

  const std::string& host_id =
      host_changed_element->Attr(QName(kChromotingXmlNamespace, "hostid"));
  const std::string& from = stanza->Attr(buzz::QN_FROM);
  const std::string& to = stanza->Attr(buzz::QN_TO);
  if (host_id == host_id_ && from == directory_bot_jid_ &&
      to == signal_strategy_->GetLocalJid()) {
    const std::string& operation =
        host_changed_element->Attr(QName(kChromotingXmlNamespace, "operation"));
    if (operation == "delete") {
      // OnHostDeleted() may want delete |signal_strategy_|, but SignalStrategy
      // objects cannot be deleted from a Listener callback, so OnHostDeleted()
      // has to be invoked later.
      base::ThreadTaskRunnerHandle::Get()->PostTask(
          FROM_HERE, base::Bind(&HostChangeNotificationListener::OnHostDeleted,
              weak_factory_.GetWeakPtr()));
    }
  } else {
    LOG(ERROR) << "Invalid host-changed message received: " << stanza->Str();
  }
  return true;
}

void HostChangeNotificationListener::OnHostDeleted() {
  listener_->OnHostDeleted();
}

}  // namespace remoting


text:
The Tools solution purposes creation of usefull add-ins for Visual Studio aiming rapid development of LogoFX's based projects.
## How to add new Item Template to VSIX project
* Add new project of type "C# Item Template", which is located in the Extensibility section. The project contains Class1.cs and *.vstemaplte files
* Edit the template projects:
  * Remove or rename the "Class1.cs" file
  * Add another project items, if need. For example: we renamed Class1.cs to ViewModel.cs and added ViewModel.resources.cs, edited content of files, changed BuildAction attribute to None (with the Property Grid)
* Add new asset to VSIX project's assets
  * The type is Item Template
  * The Source is Project n Solution
  * The Project is the same project, which was created in previous step


text:
/* @import "nativescript-theme-core/css/core.light.css"; */
@import "nativescript-theme-core/css/sky.css";


text:
import os
import sys

import fixtures
import pkg_resources
import testtools

def _handle_skip_exception():
    try:
        stestr_version = pkg_resources.parse_version(
            pkg_resources.get_distribution("stestr").version)
        stestr_min = pkg_resources.parse_version('2.5.0')
        new_stestr = (stestr_version >= stestr_min)
        import unittest
        import unittest2
        if sys.version_info >= (3, 5) and new_stestr:
            testtools.TestCase.skipException = unittest.case.SkipTest
        else:
            testtools.TestCase.skipException = unittest2.case.SkipTest
    except Exception:
        pass

class BaseTestCase(testtools.testcase.WithAttributes, testtools.TestCase):
    setUpClassCalled = False

    # NOTE(sdague): log_format is defined inline here instead of using the oslo
    # default because going through the config path recouples config to the
    # stress tests too early, and depending on testr order will fail unit tests
    log_format = ('%(asctime)s %(process)d %(levelname)-8s '
                  '[%(name)s] %(message)s')

    @classmethod
    def setUpClass(cls):
        if hasattr(super(BaseTestCase, cls), 'setUpClass'):
            super(BaseTestCase, cls).setUpClass()
        cls.setUpClassCalled = True
        # TODO(gmann): cls.handle_skip_exception is really workaround for
        # testtools bug- https://github.com/testing-cabal/testtools/issues/272
        # stestr which is used by Tempest internally to run the test switch
        # the customize test runner(which use stdlib unittest) for >=py3.5
        # else testtools.run.- https://github.com/mtreinish/stestr/pull/265
        # These two test runner are not compatible due to skip exception
        # handling(due to unittest2). testtools.run treat unittestt.SkipTest
        # as error and stdlib unittest treat unittest2.case.SkipTest raised
        # by testtools.TestCase.skipException.
        # The below workaround can be removed once testtools fix issue# 272.
        cls.orig_skip_exception = testtools.TestCase.skipException
        _handle_skip_exception()

    @classmethod
    def tearDownClass(cls):
        if hasattr(super(BaseTestCase, cls), 'tearDownClass'):
            super(BaseTestCase, cls).tearDownClass()

    def setUp(self):
        testtools.TestCase.skipException = self.orig_skip_exception
        super(BaseTestCase, self).setUp()
        if not self.setUpClassCalled:
            raise RuntimeError("setUpClass does not calls the super's "
                               "setUpClass in {!r}".format(type(self)))
        test_timeout = os.environ.get('OS_TEST_TIMEOUT', 0)
        try:
            test_timeout = int(test_timeout)
        except ValueError:
            test_timeout = 0
        if test_timeout > 0:
            self.useFixture(fixtures.Timeout(test_timeout, gentle=True))

        if (os.environ.get('OS_STDOUT_CAPTURE') == 'True' or
                os.environ.get('OS_STDOUT_CAPTURE') == '1'):
            stdout = self.useFixture(fixtures.StringStream('stdout')).stream
            self.useFixture(fixtures.MonkeyPatch('sys.stdout', stdout))
        if (os.environ.get('OS_STDERR_CAPTURE') == 'True' or
                os.environ.get('OS_STDERR_CAPTURE') == '1'):
            stderr = self.useFixture(fixtures.StringStream('stderr')).stream
            self.useFixture(fixtures.MonkeyPatch('sys.stderr', stderr))
        if (os.environ.get('OS_LOG_CAPTURE') != 'False' and
                os.environ.get('OS_LOG_CAPTURE') != '0'):
            self.useFixture(fixtures.LoggerFixture(nuke_handlers=False,
                                                   format=self.log_format,
                                                   level=None))


text:
package net.ontopia.topicmaps.classify;

/**
 * INTERNAL: Interface that holds the identifier and the actual
 * content of a classifiable resource.
 */
public interface ClassifiableContentIF {

  /**
   * INTERNAL: Returns an identifier that identifies the classifiable
   * content. This could e.g. be the absolute filename or an URI of
   * the resource.
   */
  String getIdentifier();

  /**
   * INTERNAL: Returns the actual bytes in the content of the
   * classiable content.
   */
  byte[] getContent();

}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.antcloud.com.demo.MainActivity">

    <TextView
        android:id="@+id/snackbar_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />
</RelativeLayout>


text:
namespace cuboidslib {

rocket_collider::rocket_collider(game& g, rocket& r)
	: projectile_collider{ g, r }
{}

void rocket_collider::on_visit(bullet& b) {
	b.die();
	explode(colliding_rocket());
}

void rocket_collider::on_visit(cuboid& c) {
	c.die();
	explode(colliding_rocket());
}

void rocket_collider::on_visit(crate& c) {
	c.die();
	explode(colliding_rocket());
}

void rocket_collider::on_visit(explosion&) {
	explode(colliding_rocket());
}

rocket& rocket_collider::colliding_rocket() const {
	return dynamic_cast<rocket&>(colliding_projectile());
}

void rocket_collider::explode(rocket& r) const {
	current_game().explode(r.position(), r.size());
	r.die();
}

}


text:
<?php

namespace Surfnet\Conext\EntityVerificationFramework\Api;

interface VerificationContext
{
    /**
     * @return \Surfnet\Conext\EntityVerificationFramework\Value\Entity
     */
    public function getEntity();

    /**
     * @return bool
     */
    public function hasRemoteMetadata();

    /**
     * @return \Surfnet\Conext\EntityVerificationFramework\Metadata\PublishedMetadata
     */
    public function getRemoteMetadata();

    /**
     * @return \Surfnet\Conext\EntityVerificationFramework\Metadata\ConfiguredMetadata
     */
    public function getConfiguredMetadata();

    /**
     * @return \GuzzleHttp\ClientInterface
     */
    public function getHttpClient();

    /**
     * @return \Psr\Log\LoggerInterface
     */
    public function getLogger();
}


text:
Inject the extendable Cloneable class that provides recursive contracts for cloning objects (utilizes angular.copy under the covers)

# Compatability
AngularCloneable was only tested against 1.5.5


text:
import { Subject, Observable } from 'rxjs';

import { Injectable } from '@angular/core';
import { Events } from '@ionic/angular';
import { baseUrl, qiniuDomain } from '../config';

const subject: Subject<any> = new Subject<any>();
const tokenSubject: Subject<any> = new Subject<any>();
const settingSubject: Subject<any> = new Subject<any>();

@Injectable({
  providedIn: 'root',
})
export class GlobalService {
  public notificationSubject: Subject<any> = new Subject<any>();
  public serverAddress = baseUrl;
  public qiniuDomain = qiniuDomain;
  private _isActive = false;
  private _isFirstTimeOpen: boolean;
  private _token: string;
  private _userinfo: any;
  private _jpushAlias: any;
  private _countdown = 0;
  private _resttime = 0;
  private _isAlwaysLight;
  private _isAllowEditPicture;
  private _isAllowRememberLastbill;
  private _languageType;
  private _todoAutoAddTime: Date;

  constructor(public events: Events) { }

  public bioUpdate(bio: String) {
    this.events.publish('bio:update', bio);
  }

  public get projectChangeMonitor(): Observable<any> {
    return this.notificationSubject.asObservable();
  }
  /**
   * 配置改变
   */
  public get settingState(): Observable<any> {
    return settingSubject.asObservable();
  }

  get appIsActive() {
    return this._isActive;
  }

  set appIsActive(value) {
    this._isActive = value;
  }

  public get userinfostate(): Observable<any> {
    return subject.asObservable();
  }

  public get tokenState(): Observable<any> {
    return tokenSubject.asObservable();
  }

  /**
   * authorization token
   */
  get token() {
    if (this._token) {
      return this._token;
    } else {
      return localStorage.getItem('token');
    }
  }
  set token(value) {
    this._token = value;
    localStorage.setItem('token', value);
    tokenSubject.next(value);
  }

  get jpushAlias() {
    if (this._jpushAlias) {
      return this._jpushAlias;
    } else {
      const jpushaliasStr = localStorage.getItem('jpushalias');
      if (jpushaliasStr) {
        try {
          this._jpushAlias = JSON.parse(jpushaliasStr);
          return this._jpushAlias;
        } catch (error) {
          return null;
        }
      } else {
        return null;
      }
    }
  }

  set jpushAlias(value: any) {
    if (typeof value === 'string') {
      if (value === '') {
        this._jpushAlias = null;
        localStorage.removeItem('jpushalias');
      } else {
        this._jpushAlias = JSON.parse(value);
        localStorage.setItem('jpushalias', value);
      }
    } else if (typeof value === 'object') {
      this._jpushAlias = value;
      localStorage.setItem('jpushalias', JSON.stringify(value));
    }

    subject.next(value);
  }

  get userinfo() {
    if (this._userinfo) {
      return this._userinfo;
    } else {
      const userStr = localStorage.getItem('userinfo');
      if (userStr) {
        try {
          this._userinfo = JSON.parse(userStr);
          return this._userinfo;
        } catch (error) {
          return null;
        }
      } else {
        return null;
      }
    }
  }

  set userinfo(value: any) {
    if (typeof value === 'string') {
      if (value === '') {
        this._userinfo = null;
        localStorage.removeItem('userinfo');
      } else {
        this._userinfo = JSON.parse(value);
        localStorage.setItem('userinfo', value);
      }
    } else if (typeof value === 'object') {
      this._userinfo = value;
      localStorage.setItem('userinfo', JSON.stringify(value));
    }

    subject.next(value);
  }

  get isFirstTimeOpen() {
    if (this._isFirstTimeOpen) {
      return this._isFirstTimeOpen;
    } else {
      const isFirstTimeOpen = localStorage.getItem('isFirstTimeOpen');
      if (!isFirstTimeOpen || isFirstTimeOpen === 'true') {
        return true;
      } else {
        return false;
      }
    }
  }

  set todoAutoAddTime(value: Date) {
    this._todoAutoAddTime = value;
    localStorage.setItem('todoAutoAddTime', value.toLocaleDateString());
  }

  get todoAutoAddTime() {
    if (this._todoAutoAddTime) {
      return this._todoAutoAddTime;
    } else {
      const todoAutoAddTime = localStorage.getItem('todoAutoAddTime');
      if (todoAutoAddTime) {
        this._todoAutoAddTime = new Date(todoAutoAddTime);
        return this._todoAutoAddTime;
      } else {
        return null;
      }
    }
  }

  set isFirstTimeOpen(value) {
    this._isFirstTimeOpen = value;
    let str = '';
    if (value) {
      str = 'true';
    } else {
      str = 'false';
    }
    localStorage.setItem('isFirstTimeOpen', str);
  }

  get isAlwaysLight() {
    if (this._isAlwaysLight) {
      return this._isAlwaysLight;
    } else {
      const isAlwaysLight = localStorage.getItem('isAlwaysLight');
      if (isAlwaysLight === 'true') {
        this._isAlwaysLight = true;
      } else {
        this._isAlwaysLight = false;
      }
      return this._isAlwaysLight;
    }
  }

  set isAlwaysLight(value: boolean) {
    this._isAlwaysLight = value;
    let str = '';
    if (value) {
      str = 'true';
    } else {
      str = 'false';
    }
    localStorage.setItem('isAlwaysLight', str);
  }

  get isAllowEditPicture() {
    if (this._isAllowEditPicture) {
      return this._isAllowEditPicture;
    } else {
      const isAllowEditPicture = localStorage.getItem('isAllowEditPicture');
      if (isAllowEditPicture === 'false') {
        this._isAllowEditPicture = false;
      } else {
        this._isAllowEditPicture = true;
      }
      return this._isAllowEditPicture;
    }
  }

  set isAllowEditPicture(value: boolean) {
    this._isAllowEditPicture = value;
    let str = '';
    if (value) {
      str = 'true';
    } else {
      str = 'false';
    }
    localStorage.setItem('isAllowEditPicture', str);
  }

  get isAllowRememberLastbill() {
    if (this._isAllowRememberLastbill) {
      return this._isAllowRememberLastbill;
    } else {
      const isAllowRememberLastbill = localStorage.getItem('isAllowRememberLastbill');
      if (isAllowRememberLastbill === 'false') {
        this._isAllowRememberLastbill = false;
      } else {
        this._isAllowRememberLastbill = true;
      }
      return this._isAllowRememberLastbill;
    }
  }

  set isAllowRememberLastbill(value: boolean) {
    this._isAllowRememberLastbill = value;
    let str = '';
    if (value) {
      str = 'true';
    } else {
      str = 'false';
    }
    localStorage.setItem('isAllowRememberLastbill', str);
  }

  get languageType() {
    if (this._languageType) {
      return this._languageType;
    } else {
      const languageType = localStorage.getItem('languageType');
      this._languageType = languageType;
      return languageType;
    }
  }
  set languageType(value: string) {
    this._languageType = value;
    localStorage.setItem('languageType', value);
  }

  /**
   * 打开通知
   * @param data
   */
  openNotificationCallback(data) {
    this.notificationSubject.next({
      type: 'open',
      data: data,
    });
  }

  /**
   * 收到通知
   * @param data
   */
  receiveNotificationCallback(data) {
    this.notificationSubject.next({
      type: 'receive',
      data: data,
    });
  }

  /**
   * 设置别名
   * @param data
   */
  setTagsWithAliasCallback(data) {
    this.notificationSubject.next({
      type: 'setAlias',
      data: data,
    });
  }

  get countdown() {
    if (this._countdown !== 0) {
      return this._countdown;
    } else {
      const countdownStr = localStorage.getItem('_countdown');
      if (countdownStr) {
        return parseInt(countdownStr, 10);
      } else {
        return 25;
      }
    }
  }

  set countdown(value: number) {
    this._countdown = value;
    localStorage.setItem('_countdown', value + '');
    settingSubject.next({
      countdown: this._countdown,
      resttime: this._resttime,
    });
  }

  get resttime() {
    if (this._resttime !== 0) {
      return this._resttime;
    } else {
      const restStr = localStorage.getItem('_resttime');
      if (restStr) {
        return parseInt(restStr, 10);
      } else {
        return 5;
      }
    }
  }

  set resttime(value: number) {
    this._resttime = value;
    localStorage.setItem('_resttime', value + '');
    settingSubject.next({
      countdown: this._countdown,
      resttime: this._resttime,
    });
  }
}


text:
namespace Hqub.MusicBrainz.API.Test
{
    using Hqub.MusicBrainz.API.Entities;
    using NUnit.Framework;

    // Resource: releasegroup-get.json
    // ReleaseGroup.Get("fc325dd3-73ed-36aa-9c77-6b65a958e3cf", "artists", "releases", "ratings", "url-rels");
    //
    // https://musicbrainz.org/ws/2/release-group/fc325dd3-73ed-36aa-9c77-6b65a958e3cf?inc=artists+releases+ratings+url-rels&fmt=json

    public class ReleaseGroupTests
    {
        ReleaseGroup group;

        public ReleaseGroupTests()
        {
            this.group = TestHelper.GetJson<ReleaseGroup>("releasegroup-get.json");
        }

        [Test]
        public void TestReleaseGroupElements()
        {
            Assert.IsNotNull(group);

            Assert.AreEqual("fc325dd3-73ed-36aa-9c77-6b65a958e3cf", group.Id);
            Assert.AreEqual("Desire", group.Title);
            Assert.AreEqual("Album", group.PrimaryType);
            Assert.AreEqual("1976-01-05", group.FirstReleaseDate);
        }

        [Test]
        public void TestReleaseGroupCredits()
        {
            var credits = group.Credits;

            Assert.IsNotNull(credits);

            var artist = credits[0].Artist;

            Assert.IsNotNull(artist);
            Assert.AreEqual("72c536dc-7137-4477-a521-567eeb840fa8", artist.Id);
            Assert.AreEqual("Bob Dylan", artist.Name);
        }

        [Test]
        public void TestReleaseGroupReleases()
        {
            var releases = group.Releases;

            Assert.IsNotNull(releases);
            Assert.AreEqual(14, releases.Count);
        }

        [Test]
        public void TestReleaseGroupRating()
        {
            var rating = group.Rating;

            Assert.IsNotNull(rating);

            Assert.AreEqual(4.5, rating.Value);
            Assert.AreEqual(4, rating.VotesCount);
        }

        [Test]
        public void TestReleaseGroupRelations()
        {
            var list = group.Relations;

            Assert.IsNotNull(list);
            Assert.AreEqual(6, list.Count);
        }
    }
}


text:
QString Settings_interface::ELECTRONIC_VIEW_CSV_FILENAME = "config/electronicViews.csv";

Settings_interface::Settings_interface(QWidget *parent) :
    Settings_page(parent),
    ui(new Ui::Settings_interface)
{
    ui->setupUi(this);
    ui->expertView->setHidden(true);

}

// Salva le modifiche in QSettings
void Settings_interface::apply() {
    // do nothing.
}

Settings_interface::~Settings_interface()
{
    delete ui;
}

void Settings_interface::readFromSavedCsv() {
    ElectronicDataViewReader reader;
    QMap<QString, ElectronicDataView> views = reader.readElectronicDataViewFromCsv(ELECTRONIC_VIEW_CSV_FILENAME);

//    ui->electronicViewTableWidget->setColumnCount(6);
//    ui->electronicViewTableWidget->setEntryCount(views.count());

    int r,c;
    r = c = 0;
    for(QMap<QString, ElectronicDataView>::Iterator it = views.begin(); it != views.end(); it++) {
//        ui->electronicViewTableWidget->setItem(r, c++, it.key());
//        ElectronicDataView view = it.value();
//        ui->electronicViewTableWidget->setItem(r, c++, view.show);
//        ui->electronicViewTableWidget->setItem(r, c++, view.threshold);
//        ui->electronicViewTableWidget->setItem(r, c++, view.x);
//        ui->electronicViewTableWidget->setItem(r, c++, view.y);
//        r++;
    }
}

void Settings_interface::saveToCsv() {
}


text:
package com.siyeh.ig.resources;

import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiMethodCallExpression;
import com.intellij.psi.PsiReferenceExpression;
import com.siyeh.HardcodedMethodConstants;
import com.siyeh.ig.psiutils.TypeUtils;
import org.jetbrains.annotations.NotNull;

public class HibernateResourceInspection extends ResourceInspection {

  @Override
  @NotNull
  public String getID() {
    return "HibernateResourceOpenedButNotSafelyClosed";
  }

  @Override
  protected boolean isResourceCreation(PsiExpression expression) {
    if (!(expression instanceof PsiMethodCallExpression)) {
      return false;
    }
    final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression)expression;
    final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
    final String methodName = methodExpression.getReferenceName();
    if (!HardcodedMethodConstants.OPEN_SESSION.equals(methodName)) {
      return false;
    }
    final PsiExpression qualifier = methodExpression.getQualifierExpression();
    return qualifier != null && TypeUtils.expressionHasTypeOrSubtype(qualifier, "org.hibernate.SessionFactory");
  }
}


text:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title><%= htmlWebpackPlugin.options.title %></title>

  <!-- #temporary -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">

  <meta name="description" content="<%= htmlWebpackPlugin.options.title %>">

  <% if (webpackConfig.htmlElements.headTags) { %>
  <!-- Configured Head Tags  -->
  <%= webpackConfig.htmlElements.headTags %>
  <% } %>

  <!-- base url -->
  <base href="<%= htmlWebpackPlugin.options.metadata.baseUrl %>">

</head>

<body>

  <app>
    Loading...
  </app>

  <% if (htmlWebpackPlugin.options.metadata.isDevServer && htmlWebpackPlugin.options.metadata.HMR !== true) { %>
  <!-- Webpack Dev Server reload -->
  <script src="/webpack-dev-server.js"></script>
  <% } %>

</body>
</html>


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
	<class name="jef.database.jpa.PojoEntity" table="Jef_pojo_table">
		<id name="id">
			<column name="id" length="5">
				<generator strategy="IDENTITY" />
			</column>
		</id>
		<property name="name">
			<column name="name">
			</column>
		</property>
		<property name="comments">
			<column name="comments"></column>
		</property>
	</class>
</hibernate-mapping>


text:
package org.gradle.api.plugins.quality;

import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import org.gradle.api.Action;
import org.gradle.api.Incubating;
import org.gradle.api.InvalidUserDataException;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.FileTree;
import org.gradle.api.internal.project.IsolatedAntBuilder;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.plugins.quality.internal.PmdInvoker;
import org.gradle.api.plugins.quality.internal.PmdReportsImpl;
import org.gradle.api.provider.Property;
import org.gradle.api.reporting.Reporting;
import org.gradle.api.resources.TextResource;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.LocalState;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.SourceTask;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.VerificationTask;
import org.gradle.internal.nativeintegration.console.ConsoleDetector;
import org.gradle.internal.nativeintegration.console.ConsoleMetaData;
import org.gradle.internal.nativeintegration.services.NativeServices;
import org.gradle.util.internal.ClosureBackedAction;

import javax.annotation.Nullable;
import javax.inject.Inject;
import java.io.File;
import java.util.List;

/**
 * Runs a set of static code analysis rules on Java source code files and generates a report of problems found.
 *
 * @see PmdPlugin
 * @see PmdExtension
 */
@CacheableTask
public class Pmd extends SourceTask implements VerificationTask, Reporting<PmdReports> {

    private FileCollection pmdClasspath;
    private List<String> ruleSets;
    private TargetJdk targetJdk;
    private TextResource ruleSetConfig;
    private FileCollection ruleSetFiles;
    private final PmdReports reports;
    private boolean ignoreFailures;
    private boolean consoleOutput;
    private FileCollection classpath;
    private final Property<Integer> rulesMinimumPriority;
    private final Property<Integer> maxFailures;
    private final Property<Boolean> incrementalAnalysis;
    private final Property<Integer> threads;

    public Pmd() {
        ObjectFactory objects = getObjectFactory();
        reports = objects.newInstance(PmdReportsImpl.class, this);
        this.rulesMinimumPriority = objects.property(Integer.class);
        this.incrementalAnalysis = objects.property(Boolean.class);
        this.maxFailures = objects.property(Integer.class);
        this.threads = objects.property(Integer.class);
    }

    @Inject
    protected ObjectFactory getObjectFactory() {
        throw new UnsupportedOperationException();
    }

    @Inject
    public IsolatedAntBuilder getAntBuilder() {
        throw new UnsupportedOperationException();
    }

    @TaskAction
    public void run() {
        validate(rulesMinimumPriority.get());
        validateThreads(threads.get());
        PmdInvoker.invoke(this);
    }

    public boolean stdOutIsAttachedToTerminal() {
        try {
            ConsoleDetector consoleDetector = NativeServices.getInstance().get(ConsoleDetector.class);
            ConsoleMetaData consoleMetaData = consoleDetector.getConsole();
            return consoleMetaData != null && consoleMetaData.isStdOut();
        } catch (RuntimeException e) {
            return false;
        }
    }

    /**
     * Configures the reports to be generated by this task.
     */
    @Override
    @SuppressWarnings("rawtypes")
    public PmdReports reports(@DelegatesTo(value = PmdReports.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
        return reports(new ClosureBackedAction<>(closure));
    }

    /**
     * Configures the reports to be generated by this task.
     *
     * @since 3.0
     */
    @Override
    public PmdReports reports(Action<? super PmdReports> configureAction) {
        configureAction.execute(reports);
        return reports;
    }

    /**
     * Validates the value is a valid PMD rules minimum priority (1-5)
     *
     * @param value rules minimum priority threshold
     */
    public static void validate(int value) {
        if (value > 5 || value < 1) {
            throw new InvalidUserDataException(String.format("Invalid rulesMinimumPriority '%d'.  Valid range 1 (highest) to 5 (lowest).", value));
        }
    }

    /**
     * Validates the number of threads used by PMD.
     *
     * @param value the number of threads used by PMD
     */
    private void validateThreads(int value) {
        if (value < 0) {
            throw new InvalidUserDataException(String.format("Invalid number of threads '%d'.  Number should not be negative.", value));
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @PathSensitive(PathSensitivity.RELATIVE)
    public FileTree getSource() {
        return super.getSource();
    }

    /**
     * The class path containing the PMD library to be used.
     */
    @Classpath
    public FileCollection getPmdClasspath() {
        return pmdClasspath;
    }

    /**
     * The class path containing the PMD library to be used.
     */
    public void setPmdClasspath(FileCollection pmdClasspath) {
        this.pmdClasspath = pmdClasspath;
    }

    /**
     * The built-in rule sets to be used. See the official list of built-in rule sets.
     *
     *

     *     ruleSets = ["basic", "braces"]
     *

     */
    @Input
    public List<String> getRuleSets() {
        return ruleSets;
    }

    /**
     * The built-in rule sets to be used. See the official list of built-in rule sets.
     *
     *

     *     ruleSets = ["basic", "braces"]
     *

     */
    public void setRuleSets(List<String> ruleSets) {
        this.ruleSets = ruleSets;
    }

    /**
     * The target JDK to use with PMD.
     */
    @Input
    public TargetJdk getTargetJdk() {
        return targetJdk;
    }

    /**
     * The target JDK to use with PMD.
     */
    public void setTargetJdk(TargetJdk targetJdk) {
        this.targetJdk = targetJdk;
    }

    /**
     * The custom rule set to be used (if any). Replaces {@code ruleSetFiles}, except that it does not currently support multiple rule sets.
     *
     * See the official documentation for how to author a rule set.
     *
     *

     *     ruleSetConfig = resources.text.fromFile(resources.file("config/pmd/myRuleSets.xml"))
     *

     *
     * @since 2.2
     */
    @Nullable
    @Optional
    @Nested
    public TextResource getRuleSetConfig() {
        return ruleSetConfig;
    }

    /**
     * The custom rule set to be used (if any). Replaces {@code ruleSetFiles}, except that it does not currently support multiple rule sets.
     *
     * See the official documentation for how to author a rule set.
     *
     *

     *     ruleSetConfig = resources.text.fromFile(resources.file("config/pmd/myRuleSets.xml"))
     *

     *
     * @since 2.2
     */
    public void setRuleSetConfig(@Nullable TextResource ruleSetConfig) {
        this.ruleSetConfig = ruleSetConfig;
    }

    /**
     * The custom rule set files to be used. See the official documentation for how to author a rule set file.
     * If you want to only use custom rule sets, you must clear {@code ruleSets}.
     *
     *

     *     ruleSetFiles = files("config/pmd/myRuleSet.xml")
     *

     */
    @InputFiles
    @PathSensitive(PathSensitivity.NONE)
    public FileCollection getRuleSetFiles() {
        return ruleSetFiles;
    }

    /**
     * The custom rule set files to be used. See the official documentation for how to author a rule set file.
     * This adds to the default rule sets defined by {@link #getRuleSets()}.
     *
     *

     *     ruleSetFiles = files("config/pmd/myRuleSets.xml")
     *

     */
    public void setRuleSetFiles(FileCollection ruleSetFiles) {
        this.ruleSetFiles = ruleSetFiles;
    }

    /**
     * The reports to be generated by this task.
     */
    @Override
    @Nested
    public final PmdReports getReports() {
        return reports;
    }

    /**
     * Whether or not to allow the build to continue if there are warnings.
     *
     *

     *     ignoreFailures = true
     *

     */
    @Override
    public boolean getIgnoreFailures() {
        return ignoreFailures;
    }

    /**
     * Whether or not to allow the build to continue if there are warnings.
     *
     *

     *     ignoreFailures = true
     *

     */
    @Override
    public void setIgnoreFailures(boolean ignoreFailures) {
        this.ignoreFailures = ignoreFailures;
    }

    /**
     * The maximum number of failures to allow before stopping the build.
     *
     * Defaults to 0, which will stop the build on any failure.  Values 0 and
     * above are valid.  If
ignoreFailures
 is set, this is ignored
     * and the build will continue (infinite failures allowed).
     *
     * @since 6.4
     */
    @Input
    public Property<Integer> getMaxFailures() {
        return maxFailures;
    }

    /**
     * Specifies the rule priority threshold.
     *
     * @see PmdExtension#getRulesMinimumPriority()
     * @since 6.8
     */
    @Input
    public Property<Integer> getRulesMinimumPriority() {
        return rulesMinimumPriority;
    }

    /**
     * Whether or not to write PMD results to {@code System.out}.
     *
     * @since 2.1
     */
    @Input
    public boolean isConsoleOutput() {
        return consoleOutput;
    }

    /**
     * Whether or not to write PMD results to {@code System.out}.
     *
     * @since 2.1
     */
    public void setConsoleOutput(boolean consoleOutput) {
        this.consoleOutput = consoleOutput;
    }

    /**
     * Compile class path for the classes to be analyzed.
     *
     * The classes on this class path are used during analysis but aren't analyzed themselves.
     *
     * This is only well supported for PMD 5.2.1 or better.
     *
     * @since 2.8
     */
    @Nullable
    @Optional
    @Classpath
    public FileCollection getClasspath() {
        return classpath;
    }

    /**
     * Compile class path for the classes to be analyzed.
     *
     * The classes on this class path are used during analysis but aren't analyzed themselves.
     *
     * This is only well supported for PMD 5.2.1 or better.
     *
     * @since 2.8
     */
    public void setClasspath(@Nullable FileCollection classpath) {
        this.classpath = classpath;
    }

    /**
     * Controls whether to use incremental analysis or not.
     *
     * This is only supported for PMD 6.0.0 or better. See  for more details.
     *
     * @since 5.6
     */
    @Internal
    public Property<Boolean> getIncrementalAnalysis() {
        return incrementalAnalysis;
    }

    /**
     * Path to the incremental cache file, if incremental analysis is used.
     *
     * @since 5.6
     */
    @LocalState
    public File getIncrementalCacheFile() {
        return new File(getTemporaryDir(), "incremental.cache");
    }

    /**
     * Specifies the number of threads used by PMD.
     *
     * @see PmdExtension#getThreads()
     * @since 7.5
     */
    @Input
    @Incubating
    public Property<Integer> getThreads() {
        return threads;
    }
}


text:
package com.xhw.panda.app.box.fragment;

import java.util.List;

import android.view.View;

import com.xhw.panda.app.box.adapter.AppListAdapter;
import com.xhw.panda.app.box.application.BaseApplication;
import com.xhw.panda.app.box.domain.AppInfo;
import com.xhw.panda.app.box.net.AppNetOperation;
import com.xhw.panda.app.box.view.BaseListView;
import com.xhw.panda.app.box.view.BasePageView.RequestState;

/**
 * Ó¦ÓÃFragment
 * @author admin
 *
 */
public class AppFragment extends BaseFragment
{

	private List<AppInfo> appInfoList;
	private AppListAdapter adapter;

	@Override
	public RequestState requestServer()
	{
		AppNetOperation netOperation=new AppNetOperation();
		appInfoList = netOperation.requestData(0);
		return checkData(appInfoList);
	}

	@Override
	protected View createSuccessView()
	{
		BaseListView listView=new BaseListView(BaseApplication.getAppliction());
		adapter = new AppListAdapter(appInfoList,listView){

			@Override
			protected List<AppInfo> getMoreDataFromServer()
			{
				AppNetOperation netOperation=new AppNetOperation();
				return netOperation.requestData(appInfoList.size());
			}

		};
		listView.setAdapter(adapter);
		return listView;
	}

}


text:
            <a href="<?= base_url(); ?>">
                <img src='<?= base_url() ?>assets/logo-web.png' style="width:160px;display:inline" />

Olá, Solicitação de alteração de senha!

                Foi solicitado em nosso sistema uma alteração de senha!

                Se você não solicitou ignore este e-mail caso contrario siga as instruções abaixo!

                Copie este código e cole na tela de restauração de senha

                Código: <?= $codigo; ?>

                Insira sua nova senha, salve e realize seu login

            Com os melhores cumprimentos,

            Mentalidade Concurseira

Para quaisquer dúvidas ou sugestões entre em contato.

            <?php
            date_default_timezone_set("Brazil/East");
            ?>
            Mensagem enviada em  : <?php echo date('Y-m-d H:i:s') ?>


text:
package org.apache.pulsar.client.impl.auth;

import org.apache.pulsar.client.api.Authentication;
import org.apache.pulsar.client.api.AuthenticationDataProvider;
import org.apache.pulsar.client.api.PulsarClientException;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class MockAuthentication implements Authentication {
    public Map<String, String> authParamsMap = new HashMap<>();

    @Override
    public String getAuthMethodName() {
        return null;
    }

    @Override
    public AuthenticationDataProvider getAuthData() throws PulsarClientException {
        return null;
    }

    @Override
    public void configure(Map<String, String> authParams) {
        authParamsMap = authParams;
    }

    @Override
    public void start() throws PulsarClientException {

    }

    @Override
    public void close() throws IOException {

    }
}


text:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
	xmlns:g="urn:import:com.google.gwt.user.client.ui">
	<ui:style>

	</ui:style>
	<g:VerticalPanel>

	</g:VerticalPanel>
</ui:UiBinder>


text:
Info = """

version:0.1.0,
backend(support in this version):tensorflow(tf)
generation model(support in this version):WGAN,WGAN-GP

"""


text:
package golinters

import (
	"github.com/alingse/asasalint"
	"golang.org/x/tools/go/analysis"

	"github.com/golangci/golangci-lint/pkg/config"
	"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)

func NewAsasalint(setting *config.AsasalintSettings) *goanalysis.Linter {
	cfg := asasalint.LinterSetting{}
	if setting != nil {
		cfg.Exclude = setting.Exclude
		cfg.NoBuiltinExclusions = !setting.UseBuiltinExclusions
		cfg.IgnoreTest = setting.IgnoreTest
	}

	a, err := asasalint.NewAnalyzer(cfg)
	if err != nil {
		linterLogger.Fatalf("asasalint: create analyzer: %v", err)
	}

	return goanalysis.NewLinter(
		a.Name,
		a.Doc,
		[]*analysis.Analyzer{a},
		nil,
	).WithLoadMode(goanalysis.LoadModeTypesInfo)
}


text:
<?xml version="1.0"?>
<!--suppress MavenModelInspection -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <repositories>
        <repository>
            <id>Decipher</id>
            <url>http://decipher.chpc.utah.edu/nexus/content/groups/public/</url>
        </repository>
    </repositories>

    <modelVersion>4.0.0</modelVersion>
    <groupId>gov.va.vinci</groupId>
    <artifactId>leo</artifactId>
    <packaging>pom</packaging>
    <version>2018.01.0</version>
    <name>Leo Parent Project</name>
    <modules>
        <module>base</module>
        <module>core</module>
        <module>service</module>
        <module>client</module>
    </modules>

    <organization>
        <name>Department of Veterans Affairs</name>
    </organization>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <properties>
        <checkstyle.config.location>checkstyle_javadoc_only.xml</checkstyle.config.location>
        <uima-as-version>2.9.0</uima-as-version>
        <skipJavadoc>true</skipJavadoc>
        <github.global.server>github</github.global.server>
        <additionalparam>-Xdoclint:none</additionalparam>
    </properties>
    <url>http://github.com/department-of-veterans-affairs/Leo</url>
    <developers>
        <developer>
            <id>sduvall</id>
            <name>Scott Duvall</name>
            <email>scott.duvall@utah.edu</email>
            <roles>
                <role>Project Manager</role>
            </roles>
            <timezone>-8</timezone>
        </developer>
        <developer>
            <id>tginter</id>
            <name>Thomas Ginter</name>
            <email>thomas.ginter@utah.edu</email>
            <roles>
                <role>Architect</role>
                <role>Development</role>
            </roles>
            <timezone>-8</timezone>
        </developer>
        <developer>
            <id>rcornia</id>
            <name>Ryan Cornia</name>
            <email>ryan.cornia@utah.edu</email>
            <roles>
                <role>Architect</role>
                <role>Development</role>
            </roles>
            <timezone>-8</timezone>
        </developer>
    </developers>
    <dependencies>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <!--
      ==================================================================
      BUILD SPECIFIC CONFIGURATION
      ==================================================================
    -->
    <build>
        <resources>
            <resource>
                <directory>src/main/desc/</directory>
            </resource>
            <resource>
                <directory>src/main/resources/</directory>
            </resource>
        </resources>

        <plugins>
            <!--
                 This is the groovy plugin that is used for pre-processing of the
                site markdown files to update the build number, etc...
             -->
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>pre-site</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <properties>
                        <property>
                            <name>buildVersion</name>
                            <value>${project.version}</value>
                        </property>
                    </properties>
                    <scripts>
                        <script>file:///${session.executionRootDirectory}/src/site/groovyScripts/prepSite.groovy
                        </script>
                    </scripts>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <!-- any version of Groovy \>= 1.5.0 should work here -->
                        <version>2.4.4</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-javadoc-plugin</artifactId>
                            <version>2.9</version>
                            <reportSets>
                                <reportSet>
                                    <id>aggregate</id>
                                    <reports>
                                        <report>aggregate</report>
                                    </reports>
                                </reportSet>
                            </reportSets>
                            <configuration>
                                <!-- Here you can add special configurations for your javadoc, if needed -->
                            </configuration>
                        </plugin>
                        <!-- Here you can also configure more report plugins -->
                        <!-- for your site, such as maven-project-info-reports-plugin -->
                    </reportPlugins>
                </configuration>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.3</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>1.8</version>
                    <configuration>
                        <inceptionYear>2010</inceptionYear>
                        <licenseName>apache_v2</licenseName>
                        <verbose>true</verbose>
                    </configuration>
                    <executions>
                        <execution>
                            <id>license.package</id>
                            <phase>package</phase>
                            <goals>
                                <goal>update-file-header</goal>
                            </goals>
                            <configuration>
                                <roots>
                                    <root>src/main/java</root>
                                    <root>src/main/resources</root>
                                    <root>src/test/java</root>
                                    <root>src/test/resources</root>
                                </roots>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.4</version>
                    <dependencies>
                        <dependency>
                            <groupId>lt.velykis.maven.skins</groupId>
                            <artifactId>reflow-velocity-tools</artifactId>
                            <version>1.1.1</version>
                        </dependency>
                        <!-- Reflow skin requires Velocity >= 1.7  -->
                        <dependency>
                            <groupId>org.apache.velocity</groupId>
                            <artifactId>velocity</artifactId>
                            <version>1.7</version>
                        </dependency>
                        <dependency><!-- add support for ssh/scp -->
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-ssh</artifactId>
                            <version>2.9</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.10.3</version>
                    <configuration>
                        <doclet>org.jboss.apiviz.APIviz</doclet>
                        <docletArtifact>
                            <groupId>org.jboss.apiviz</groupId>
                            <artifactId>apiviz</artifactId>
                            <version>1.3.2.GA</version>
                        </docletArtifact>
                        <useStandardDocletOptions>true</useStandardDocletOptions>
                        <charset>UTF-8</charset>
                        <encoding>UTF-8</encoding>
                        <docencoding>UTF-8</docencoding>
                        <breakiterator>true</breakiterator>
                        <version>true</version>
                        <author>true</author>
                        <keywords>true</keywords>
                        <additionalparam>
                            -sourceclasspath ${project.build.outputDirectory}
                        </additionalparam>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!--
    -
    - Reporting
    -
    - -->
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.8.1</version>
                <configuration>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>dependencies</report>
                            <report>project-team</report>
                            <report>license</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <!-- Default configuration for all reports -->
                </configuration>
                <reportSets>
                    <reportSet>
                        <id>non-aggregate</id>
                        <configuration>
                            <!-- Specific configuration for the non aggregate report -->
                        </configuration>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <!--
       -
       - SCM and Distribution
       -
       -->
    <scm>
        <connection>scm:git:http://decipher.chpc.utah.edu/gitblit/git/bones/leo.git/</connection>
        <url>http://decipher.chpc.utah.edu/gitblit/git/bones/leo.git/</url>
        <tag>leo-2018.01.0</tag>
    </scm>
    <distributionManagement>
        <site>
            <id>decipher-site</id>
            <name>Deployment Server</name>
            <url>
                scp://decipher.chpc.utah.edu/var/www/html/sites/${project.groupId}/${project.artifactId}/${project.version}/
            </url>
        </site>
        <repository>
            <id>nexus</id>
            <name>Nexus Staging Repo</name>
            <url>http://decipher.chpc.utah.edu/nexus/content/repositories/releases</url>
        </repository>
    </distributionManagement>

</project>


text:
var ltx = require('ltx');
var events = require('events');
var util = require('util');
var DOMElement = require('./element');

exports.Parser = function(saxParser) {
    events.EventEmitter.call(this);
    var that = this;

    var parserMod = saxParser || ltx.bestSaxParser;
    if (!parserMod) throw new Error("No SAX parser available");
    this.parser = new parserMod();

    var el;
    this.parser.addListener('startElement', function(name, attrs) {
        var child = new DOMElement(name, attrs);
        if (!el) {
            el = child;
        } else {
            el = el.cnode(child);
        }
    });
    this.parser.addListener('endElement', function(name) {
        if (!el) {
            /* Err */
        } else if (el && name == el.name) {
            if (el.parent) {
                el = el.parent;
            } else if (!that.tree) {
                that.tree = el;
                el = undefined;
            }
        }
    });
    this.parser.addListener('text', function (str) {
        if (el) el.t(str);
    });
    this.parser.addListener('error', function (e) {
        that.error = e;
        that.emit('error', e);
    });
};
util.inherits(exports.Parser, events.EventEmitter);

exports.Parser.prototype.write = function(data) {
    this.parser.write(data);
};

exports.Parser.prototype.end = function(data) {
    this.parser.end(data);

    if (!this.error) {
        if (this.tree) {
            this.emit('tree', this.tree);
        }
    } else {
        this.emit('error', new Error('Incomplete document'));
    }
};

exports.parse = function(data, saxParser) {
    var p = new exports.Parser(saxParser);
    var result = null, error = null;

    p.on('tree', function(tree) {
        result = tree;
    });
    p.on('error', function(e) {
        error = e;
    });

    p.write(data);
    p.end();

    if (error) {
        throw error;
    } else {
        return result;
    }
};


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<artifactId>jabsaw-impl</artifactId>
	<name>JabSaw Implementation</name>
	<packaging>jar</packaging>
	<description>Shared implementation of the JabSaw module system</description>

	<parent>
		<groupId>org.jabsaw</groupId>
		<artifactId>jabsaw</artifactId>
		<version>1.3-SNAPSHOT</version>
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<dependencies>

		<dependency>
			<groupId>org.ow2.asm</groupId>
			<artifactId>asm</artifactId>
			<version>5.0.1</version>
		</dependency>

		<dependency>
			<groupId>org.jgrapht</groupId>
			<artifactId>jgrapht-core</artifactId>
			<version>0.9.0</version>
		</dependency>
		<dependency>
			<groupId>org.jabsaw</groupId>
			<artifactId>jabsaw-api</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>

	</dependencies>

</project>