text:
/**
 * BabyHint.js is a part of the Khan Academy Live Editor
 * released under the MIT License
 *
 * https://raw.githubusercontent.com/Khan/live-editor/master/LICENSE
 */

/*
 * BabyHint does a line-by-line check for common beginner programming mistakes,
 * such as misspelling, missing spaces, missing commas, etc.  It is used in
 * conjunction with JSHINT to report errors to the user.
 *
 * Each error returned contains the members:
 * {
 *      row         :   the row at which the error was found
 *      column      :   the column at which the error was found
 *      text        :   the error messaage
 *      breaksCode  :   true if we actually want to prevent them from
 *                      doing this
 *                      (if false, will only display if JSHINT broke on
 *                      the same line)
 * }
 */

var BabyHint = {

    EDIT_DISTANCE_THRESHOLD: 2,

    // We'll get function names from the global context
    // non-function keywords go here
    keywords: [
    /* RESERVED WORDS */
        "break",
        "case",
        "catch",
        "continue",
        "default",
        "do",
        "else",
        "finally",
        "for",
        "function",
        "if",
        "in",
        "instanceof",
        "new",
        "return",
        "switch",
        "this",
        "throw",
        "try",
        "typeof",
        "var",
        "while",
    /* JAVASCRIPT OBJECT PROPERTIES AND FUNCTIONS */
    /* Omit those included in the global context */
        "charAt",
        "charCodeAt",
        "fromCharCode",
        "indexOf",
        "lastIndexOf",
        "length",
        "pop",
        "prototype",
        "push",
        "replace",
        "search",
        "shift",
        "slice",
        "substring",
        "toLowerCase",
        "toUpperCase",
        "unshift"
    ],

    // Expected number of parameters for known functions.
    // (Some functions can take multiple signatures)
    // We'll get most of these from the global context,
    // so these are just the overrides.
    functionParamCount: {
        "acos": 1,
        "asin": 1,
        "atan": 1,
        "atan2": 2,
        "background": [1, 3, 4],
        "beginShape": [0, 1],
        "bezier": 8,
        "bezierVertex": [6],
        "box": [1, 2, 3],
        "color": [1, 2, 3, 4],
        "colorMode": [1, 2, 4, 5],
        "createFont": [1, 2],
        "cos": 1,
        "curve": 8,
        "cursor": [0, 1, 2, 3],
        "endShape": [0, 1],
        "dist": 4,
        "fill": [1, 3, 4],
        "filter": [1, 2],
        "get": [2, 3, 4, 5],
        "image": [3, 5],
        "line": 4,
        "loadImage": [1, 3],
        "mag": [2, 3],
        "max": 2,
        "min": 2,
        "noise": [1, 2, 3],
        "PVector": [0, 2, 3],
        "random": [0, 1, 2],
        "RegExp": [1, 2],
        "rect": [4, 5],
        "scale": [1, 2],
        "set": [3, 4],
        "sin": 1,
        "stroke": [1, 3, 4],
        "tan": 1,
        "text": [3, 5],
        "textAlign": [1, 2],
        "textFont": [1, 2],
        "translate": [2, 3],
        "vertex": [2, 4]
    },

    // A mapping from function name to an example usage of the function
    // the titles of documentation programs
    functionFormSuggestion: {
        // forms that don't have documentation scratchpads
        // or weird formatting
        "function" : "var drawWinston = function() { ... };",
        "while" : "while (x < 20) { ... };"
    },

    // functions in the global context that we want
    // blacklisted because it's complicated...
    functionParamBlacklist: [
        "debug",
        "max",
        "min"
    ],

    // These properties can be used for malicious purposes
    // It's just a stop-gap measure, making it much harder
    bannedProperties: {
        location: true,
        document: true,
        ownerDocument: true,
        createElement: true
    },

    variables: [],
    errors: [],
    inComment: false,
    spellChecked: false,

    init: function(options) {
        // grab globals from Processing object
        for (var f in options.context) {
            if (typeof options.context[f] === "function") {
                BabyHint.keywords.push(f);
                if (!(f in BabyHint.functionParamCount) &&
                    !_.include(BabyHint.functionParamBlacklist, f)) {
                    BabyHint.functionParamCount[f] = options.context[f].length;
                }
            }
        }
    },

    initDocumentation: function(docTitles) {
        for (var i = 0; i < docTitles.length; i++) {
            var usage = docTitles[i];

            // kind of hacky, but many documentation titles don't take the form name(...) ...
            // so we grab which ones we can. and rely on the intial value of
            // the functionFormSuggestion map for any others we want to
            // support rest of them
            var firstParen = usage.indexOf("(");

            var name = usage;
            if (firstParen >= 0) {
                name = name.substring(0, firstParen).trim();
                BabyHint.functionFormSuggestion[name] = usage;
            }
        }
    },

    babyErrors: function(source, hintErrors) {
        var errorLines = {};
        var lines = (source || "").split("\n");
        BabyHint.errors = [];
        BabyHint.variables = [];
        BabyHint.inComment = false;
        BabyHint.spellChecked = false;

        // Build a map of the lines on which JSHint produced an error
        _.each(hintErrors, function(error) {
            // Get correct index number from the reported line number
            if (error) {
                errorLines[error.line - 2] = true;
            }
        });

        _.each(lines, function(line, index) {
            // Check the line for errors
            BabyHint.errors = BabyHint.errors.concat(
                BabyHint.parseLine(line, index, errorLines[index]));
        });

        return BabyHint.errors;
    },

    // Checks a single line for errors
    parseLine: function(line, lineNumber, hasError) {
        var errors = [];

        if (BabyHint.inComment) {
            // We are in a multi-line comment.
            // Look for the end of the comments.
            line = BabyHint.removeEndOfMultilineComment(line);
        }
        if (!BabyHint.inComment) {
            line = BabyHint.removeComments(line);
            line = BabyHint.removeStrings(line);

            // Checks could detect new errors, thus must run on every line
            errors = errors
                // check for incorrect function declarations
                .concat(BabyHint.checkFunctionDecl(line, lineNumber))
                // we don't allow ending lines with "="
                .concat(BabyHint.checkTrailingEquals(line, lineNumber))
                // check for correct number of parameters
                .concat(BabyHint.checkFunctionParams(line, lineNumber))
                // check for banned property names
                .concat(BabyHint.checkBannedProperties(line, lineNumber));

            // Checks only run on lines with existing errors
            if (hasError) {
                errors = errors
                    // check for missing space after var
                    .concat(BabyHint.checkSpaceAfterVar(line, lineNumber));

                    // only check spelling for the first error shown
                    if (!BabyHint.spellChecked) {
                        errors = errors.concat(BabyHint.checkSpelling(line, lineNumber));
                        BabyHint.spellChecked = true;
                    }
            }

            // add new variables for future spellchecking
            BabyHint.variables = BabyHint.variables.concat(
                BabyHint.getVariables(line));
        }

        return errors;
    },

    removeComments: function(line) {
        // replace commented out code with whitespaces
        // first check for "//"
        var index = line.indexOf("//");
        if (index !== -1) {
            line = line.slice(0, index);
        }

        // now check for "/*"
        while (line.indexOf("/*") !== -1) {
            index = line.indexOf("/*");
            var closeIndex = line.indexOf("*/");
            while (closeIndex !== -1 && closeIndex <= index + 1) {
                // unopened comments - let JSHINT catch these
                // we'll just remove the extra */ for now
                line = line.slice(0, closeIndex) +
                        "  " + line.slice(closeIndex + 2);
                closeIndex = line.indexOf("*/");
            }
            if (closeIndex > index + 1) {
                // found /* */ on the same line
                var comment = line.slice(index, closeIndex + 2);
                line = line.slice(0, index) +
                        comment.replace(/./g, " ") +
                        line.slice(closeIndex + 2);
            } else if (closeIndex === -1) {
                // beginning of a multi-line comment
                // inComment won't take effect until the next line
                BabyHint.inComment = true;
                line = line.slice(0, index);
            }
        }
        return line;
    },

    removeEndOfMultilineComment: function(line) {
        var index = line.indexOf("*/");
        if (index !== -1) {
            BabyHint.inComment = false;
            line = line.slice(0, index + 2).replace(/./g, " ") +
                    line.slice(index + 2);
        }
        return line;
    },

    removeStrings: function(line) {
        // currently JSHINT doesn't allow multi-line strings, so
        // all string quotes should be closed on the same line
        var openIndex = -1;
        var quoteType = null;
        for (var i = 0; i < line.length; i++) {
            var letter = line[i];
            if (openIndex === -1) {
                // look for any type of quotes
                if (letter === "\"") {
                    openIndex = i;
                    quoteType = "\"";
                } else if (letter === "\'") {
                    openIndex = i;
                    quoteType = "\'";
                }
            } else if (letter === quoteType) {
                // replace string contents with whitespace
                var string = line.slice(openIndex + 1, i);
                line = line.slice(0, openIndex + 1) +
                        string.replace(/./g, " ") +
                        line.slice(i);
                openIndex = -1;
            }
        }
        return line;
    },

    checkFunctionDecl: function(line, lineNumber) {
        var errors = [];
        var functions = line.match(/function\s+\w+/g);
        _.each(functions, function(fun) {
            var name = fun.split(/\s+/g)[1];
            // I18N: Don't translate the '\" var %(name)s = function() {}; \"' part
            var error = {
                row: lineNumber,
                column: line.indexOf(fun),
                text: $._("If you want to define a function, you should use \"var %(name)s = function() {}; \" instead!", {name: name}),
                breaksCode: true,
                source: "funcdeclaration"
            };
            errors.push(error);
        });
        return errors;
    },

    checkBannedProperties: function(line, lineNumber) {
        var errors = [];
        var words = line.split(/[^~`@#\$\^\w]/g);
        _.each(words, function(word) {
            if (BabyHint.bannedProperties.hasOwnProperty(word)) {
                var error = {
                    row: lineNumber,
                    column: line.indexOf(word),
                    text: $._("%(word)s is a reserved word.", {word: word}),
                    breaksCode: true,
                    source: "bannedwords"
                };

                errors.push(error);
            }
        });
        return errors;
    },

    checkSpelling: function(line, lineNumber) {
        var errors = [];
        var words = line.split(/[^~`@#\$\^\w]/g);
        var skipNext = false;
        _.each(words, function(word) {
            if (word.length > 0 && !skipNext) {
                var editDist = BabyHint.editDistance(word);
                var dist = editDist.editDistance;
                var keyword = editDist.keyword;
                if (dist > 0 &&
                    dist <= BabyHint.EDIT_DISTANCE_THRESHOLD &&
                    dist < keyword.length - 1 &&
                    BabyHint.keywords.indexOf(word) === -1) {
                    var error = {
                        row: lineNumber,
                        column: line.indexOf(word),
                        text: $._("Did you mean to type \"%(keyword)s\" instead of \"%(word)s\"?", {keyword: keyword, word: word}),
                        breaksCode: false,
                        source: "spellcheck"
                    };

                    // if we have usage forms, display them as well.
                    if (BabyHint.functionFormSuggestion[keyword]) {
                        error.text += " " + $._("In case you forgot, you can use it like \"%(usage)s\"", {usage: BabyHint.functionFormSuggestion[keyword]});
                    }

                    errors.push(error);
                }
            }
            // Don't spell check variable declarations or function arguments
            skipNext = (word === "var") || (word === "function");
        });
        return errors;
    },

    editDistance: function(word) {
        var wordOrig = word;
        word = word.toLowerCase();

        // Dynamic programming implementation of Levenshtein Distance.
        // The rows are the letters of the keyword.
        // The cols are the letters of the word.
        var make2DArray = function(rows, cols, initialVal) {
            initialVal = (typeof initialVal === "undefined") ? 0 : initialVal;
            var array2D = [];
            for (var i = 0; i < rows; i++) {
                array2D[i] = [];
                for (var j = 0; j < cols; j++) {
                    array2D[i][j] = initialVal;
                }
            }
            return array2D;
        };

        var minDist = Infinity;
        var minWord = "";
        _.each(BabyHint.keywords.concat(BabyHint.variables), function(keyword) {

            // Take care of words being precisely the same
            if (keyword === wordOrig) {
                minDist = 0;
                minWord = keyword;
                return;
            }

            // Take care of simple case of capitalization as only difference
            if (keyword.toLowerCase() === word && keyword !== wordOrig) {
                minDist = 1;
                minWord = keyword;
                return;
            }

            // skip words with lengths that are too different
            if (Math.abs(keyword.length - word.length) > BabyHint.EDIT_DISTANCE_THRESHOLD) {
                return;
            }
            var rows = keyword.length;
            var cols = word.length;
            var table = make2DArray(rows, cols, 1);
            // initialize first cell
            if (keyword[0] === word[0]) {
                table[0][0] = 0;
            }
            // initialize first row
            for (var c = 1; c < cols; c++) {
                var diff = keyword[0] === word[c] ? 0 : 1;
                table[0][c] = table[0][c - 1] + diff;
            }
            // initialize first col
            for (var r = 1; r < rows; r++) {
                var diff = keyword[r] === word[0] ? 0 : 1;
                table[r][0] = table[r - 1][0] + diff;
            }
            // compute table
            for (var i = 1; i < rows; i++) {
                var minInRow = Number.MAX_VALUE;
                for (var j = 1; j < cols; j++) {
                    var diff = keyword[i] === word[j] ? 0 : 1;
                    var dist = _.min([table[i - 1][j] + 1,
                                        table[i][j - 1] + 1,
                                        table[i - 1][j - 1] + diff]);
                    minInRow = Math.min(minInRow, dist);
                    table[i][j] = dist;
                }
                // break out if entire row exceeds threshold
                if (minInRow > BabyHint.EDIT_DISTANCE_THRESHOLD) {
                    return;
                }
            }
            if (table[rows - 1][cols - 1] < minDist) {
                minDist = table[rows - 1][cols - 1];
                minWord = keyword;
            }
        });
        return {editDistance: minDist, keyword: minWord};
    },

    checkSpaceAfterVar: function(line, lineNumber) {
        // Sometimes students forget the space between "var" and the
        // variable name. This only finds the first occurence of this
        // missing space
        var errors = [];
        var regex = /var\w+/g;
        var matches = line.match(regex);
        if (matches) {
            var variableName = matches[0].slice(3);
            var error = {
                row: lineNumber,
                column: line.search(regex) + 3,
                text: $._("Did you forget a space between \"var\" and \"%(variable)s\"?", {variable: variableName}),
                breaksCode: false
            };
            errors.push(error);
        }
        return errors;
    },

    checkTrailingEquals: function(line, lineNumber) {
        var errors = [];
        var i = line.length - 1;
        // find the last character in the line
        while (line[i] === " ") {
            i--;
        }
        if (line[i] === "=") {
            var error = {
                row: lineNumber,
                column: i,
                text: $._("You can't end a line with \"=\""),
                breaksCode: true
            };
            errors.push(error);
        }
        return errors;
    },

    getVariables: function(line) {
        // Add any new variables for future spellchecking.
        // This misses variables that are not the first variable to be
        // declared on a line (e.g. var draw = function() {var x = 3;};)
        var variables = [];
        var regex = /\s*var\s*([A-z]\w*)\s*(;|=)/;
        if (regex.exec(line)) {
            var variable = regex.exec(line)[1];
            variables.push(variable);
        }

        // Add any variables declared as function parameters
        // Also only checks first function declaration on the line
        var functionRegex = /function\s*\(([\w\s,]*)\)/;
        if (functionRegex.exec(line)) {
            var fun = RegExp.$1;
            var params = fun.split(/\s*,\s*/);
            _.each(params, function(param) {
                if (param) {
                    variables.push(param);
                }
            });
        }
        return variables;
    },

    checkFunctionParams: function(line, lineNumber) {
        // Many Processing functions don't break if passed the wrong
        // number of parameters, but they also don't work.
        // We want to display errors for these specific cases.

        var errors = [];
        // first match up pairs of parentheses
        var parenPairs = {};
        var stack = [];
        for (var i = 0; i < line.length; i++) {
            if (line[i] === "(") {
                stack.push(i);
            } else if (line[i] === ")") {
                if (stack.length === 0) {
                    var error = {
                        row: lineNumber,
                        column: i,
                        text: $._("It looks like you have an extra \")\""),
                        breaksCode: false,
                        source: "paramschecker"
                    };
                    errors.push(error);
                    // if we messed up the parens matching,
                    // parameter counts will be off
                    return errors;
                } else {
                    parenPairs[stack.pop()] = i;
                }
            }
        }
        if (stack.length > 0) {
            // check if there's anything left in the stack
            var error = {
                row: lineNumber,
                column: stack.pop(),
                text: $._("It looks like you are missing a \")\" - does every \"(\" have a corresponding closing \")\"?"),
                breaksCode: false,
                source: "paramschecker"
            };
            errors.push(error);
            // if we messed up the parens matching,
            // parameter counts will be off
            return errors;
        }

        // find all function calls
        var functions = line.match(/\w+\s*\(/g) || [];
        // find all functions calls on an object
        var objectFunctions = line.match(/\.\s*\w+\s*\(/g) || [];
        objectFunctions = _.map(objectFunctions, function(fun) {
            // remove the leading '.'
            var functionStart = fun.indexOf(fun.match(/\w/g)[0]);
            return fun.slice(functionStart);
        });

        // go through functions from right to left
        for (var i = functions.length - 1; i >= 0; i--) {
            var index = line.lastIndexOf(functions[i]);

            var functionName = functions[i].split(/\(\s*/g)[0];

            // extract the stuff inside the parens
            index += functionName.length;
            var params = line.slice(index, parenPairs[index] + 1);

            // check for missing commas
            var spacesBetween = params.match(/[A-z0-9]+\s+[A-z0-9]+/g);
            if (spacesBetween) {
                var col = line.indexOf(spacesBetween[0]);
                while (line[col] !== " ") {
                    col++;
                }
                var error = {
                    row: lineNumber,
                    column: col,
                    text: $._("Did you forget to add a comma between two parameters?"),
                    breaksCode: false, // JSHINT should break on these lines,
                    source: "paramschecker"
                };
                errors.push(error);
                // this might confuse the parameter count, so move on for now
                break;
            }

            // count the parameters passed
            var numParams;
            var numCommas = params.match(/,/g);
            if (numCommas) {
                numParams = numCommas.length + 1;
            } else {
                numParams = params.match(/[^\s()]/g) ? 1 : 0;
            }

            // ignore functions of objects
            if (!_.include(objectFunctions, functions[i])) {
                // check if parameters passed matches the expected number
                functionName = functionName.replace(/\s/g, "");

                var expectedParams = BabyHint.functionParamCount[functionName];
                var text;
                var functionCall;

                if (typeof expectedParams !== "undefined") {
                    functionCall = "\"" + functionName + "()\"";

                    if (typeof expectedParams === "number" &&
                        numParams !== expectedParams) {

                        text = $.ngettext("%(name)s takes 1 parameter, not %(given)s!", "%(name)s takes %(num)s parameters, not %(given)s!", expectedParams, {name: functionCall, given: numParams});

                    } else if (typeof expectedParams !== "number" &&
                                !_.include(expectedParams, numParams)) {

                        var listOfParams = "" + expectedParams[0];

                        for (var j = 1; j < expectedParams.length - 1; j++) {
                            listOfParams += ", " + expectedParams[j];
                        }

                        listOfParams += " " + $._("or") + " " +
                                        expectedParams[expectedParams.length - 1];

                        text = $._("%(name)s takes %(list)s parameters, not %(given)s!", {name: functionCall, list: listOfParams, given: numParams});
                    }
                }

                if (text) {
                    var functionForm = BabyHint.functionFormSuggestion[functionName];
                    if (functionForm) {
                        text = $._("It looks like you're trying to use %(name)s. In case you forgot, you can use it like: %(usage)s", {name: functionCall, usage: "\"" + functionForm + "\""});
                    }
                }

                if (text) {
                    var error = {
                        row: lineNumber,
                        column: index,
                        text: text,
                        breaksCode: true,
                        source: "paramschecker"
                    };
                    errors.push(error);
                }
            }
            // remove this function call so we don't mess up future comma counts
            line = line.slice(0, index) + params.replace(/./g, "0") +
                    line.slice(parenPairs[index] + 1);
        }
        return errors;
    }
};
// TODO(jlfwong): Stop globalizing BabyHint
window.BabyHint = BabyHint;


text:
using AutoFixture;
using Elmah.Io.Client;
using NSubstitute;
using NUnit.Framework;
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Web;

namespace Elmah.Io.Tests
{
    public class ErrorLogDataItemsTest
    {
        private Fixture _fixture;
        private ErrorLog _errorLog;
        private IMessagesClient _messagesMock;
        private Guid _logId;

        [SetUp]
        public void SetUp()
        {
            _fixture = new Fixture();
            _logId = _fixture.Create<Guid>();
            ErrorLog.Api = null;
            var clientMock = Substitute.For<IElmahioAPI>();
            _messagesMock = Substitute.For<IMessagesClient>();
            clientMock.Messages.Returns(_messagesMock);
            _errorLog = new ErrorLog(clientMock, _logId);
        }

        [Test]
        public void CanLogData()
        {
            // Arrange
            var id = _fixture.Create<string>();
            CreateMessage actualMessage = null;
            Guid? actualLogId = null;

            _messagesMock
                .CreateAndNotifyAsync(Arg.Any<Guid>(), Arg.Any<CreateMessage>())
                .Returns(Task.FromResult(new Message { Id = id }))
                .AndDoes(x =>
                {
                    actualLogId = x.Arg<Guid>();
                    actualMessage = x.Arg<CreateMessage>();
                });

            var exception = new HttpParseException("message", new Exception(), "virtualPath", "sourceCode", 42);

            // Act
            var result = _errorLog.Log(new Error(exception));

            // Assert
            Assert.That(actualMessage, Is.Not.Null);
            Assert.That(actualMessage.Data, Is.Not.Null);
            Assert.That(actualMessage.Data.Any(d => d.Key == "HttpParseException.VirtualPath" && d.Value == "virtualPath"));
            Assert.That(actualMessage.Data.Any(d => d.Key == "HttpParseException.Line" && d.Value == "42"));
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package basic

/**
* Binding class showing the gslbservice that can be bound to server.
*/
type Servergslbservicebinding struct {
	/**
	* The services attatched to the server.
	*/
	Servicename string `json:"servicename,omitempty"`
	/**
	* The type of bound service
	*/
	Svctype string `json:"svctype,omitempty"`
	/**
	* The IP address of the bound service
	*/
	Serviceipaddress string `json:"serviceipaddress,omitempty"`
	/**
	* The port number to be used for the bound service.
	*/
	Port int `json:"port,omitempty"`
	/**
	* The state of the bound service
	*/
	Svrstate string `json:"svrstate,omitempty"`
	/**
	* This field has been intorduced to show the dbs services ip
	*/
	Serviceipstr string `json:"serviceipstr,omitempty"`
	/**
	* Name of the server for which to display parameters.
	*/
	Name string `json:"name,omitempty"`

}


text:
static const base::FilePath::CharType kReferenceFile[] =
#if defined (OS_WIN)
    FILE_PATH_LITERAL("pyauto_private/webrtc/human-voice-win.wav");
#else
    FILE_PATH_LITERAL("pyauto_private/webrtc/human-voice-linux.wav");
#endif

// The javascript will load the reference file relative to its location,
// which is in /webrtc on the web server. Therefore, prepend a '..' traversal.
static const char kReferenceFileRelativeUrl[] =
#if defined (OS_WIN)
    "../pyauto_private/webrtc/human-voice-win.wav";
#else
    "../pyauto_private/webrtc/human-voice-linux.wav";
#endif

static const char kMainWebrtcTestHtmlPage[] =
    "files/webrtc/webrtc_audio_quality_test.html";

static base::FilePath GetTestDataDir() {
  base::FilePath source_dir;
  PathService::Get(chrome::DIR_TEST_DATA, &source_dir);
  return source_dir;
}

// Test that the typing detection feature works.
// You must have the src-internal solution in your .gclient to put the required
// pyauto_private directory into chrome/test/data/.
class WebrtcTypingDetectionBrowserTest : public WebRtcTestBase {
 public:
  // TODO(phoglund): clean up duplication from audio quality browser test when
  // this test is complete and is proven to work.
  virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
    PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem();
  }

  bool HasAllRequiredResources() {
    base::FilePath reference_file =
        GetTestDataDir().Append(kReferenceFile);
    if (!base::PathExists(reference_file)) {
      LOG(ERROR) << "Cannot find the reference file to be used for audio "
                 << "quality comparison: " << reference_file.value();
      return false;
    }
    return true;
  }

  void AddAudioFile(const std::string& input_file_relative_url,
                    content::WebContents* tab_contents) {
    EXPECT_EQ("ok-added", ExecuteJavascript(
        "addAudioFile('" + input_file_relative_url + "')", tab_contents));
  }

  void PlayAudioFile(content::WebContents* tab_contents) {
    EXPECT_EQ("ok-playing", ExecuteJavascript("playAudioFile()", tab_contents));
  }

  void MixLocalStreamWithPreviouslyLoadedAudioFile(
      content::WebContents* tab_contents) {
    EXPECT_EQ("ok-mixed-in", ExecuteJavascript(
        "mixLocalStreamWithPreviouslyLoadedAudioFile()", tab_contents));
  }

  // Ensures we didn't get any errors asynchronously (e.g. while no javascript
  // call from this test was outstanding).
  void AssertNoAsynchronousErrors(content::WebContents* tab_contents) {
    EXPECT_EQ("ok-no-errors",
              ExecuteJavascript("getAnyTestFailures()", tab_contents));
  }

  void EstablishCall(content::WebContents* from_tab,
                     content::WebContents* to_tab) {
    EXPECT_EQ("ok-negotiating",
              ExecuteJavascript("negotiateCall()", from_tab));

    // Ensure the call gets up on both sides.
    EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()",
                                 "active", from_tab));
    EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()",
                                 "active", to_tab));
  }

  void HangUp(content::WebContents* from_tab) {
    EXPECT_EQ("ok-call-hung-up", ExecuteJavascript("hangUp()", from_tab));
  }

  void WaitUntilHangupVerified(content::WebContents* tab_contents) {
    EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()",
                                 "no-peer-connection", tab_contents));
  }

  PeerConnectionServerRunner peerconnection_server_;
};

// TODO(phoglund): enable when fully implemented.
IN_PROC_BROWSER_TEST_F(WebrtcTypingDetectionBrowserTest,
                       DISABLED_MANUAL_TestTypingDetection) {
  // TODO(phoglund): make this use embedded_test_server when that test server
  // can handle files > ~400Kb.
  ASSERT_TRUE(test_server()->Start());
  ASSERT_TRUE(peerconnection_server_.Start());

  ui_test_utils::NavigateToURL(
      browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage));
  content::WebContents* left_tab =
      browser()->tab_strip_model()->GetActiveWebContents();

  chrome::AddBlankTabAt(browser(), -1, true);
  content::WebContents* right_tab =
      browser()->tab_strip_model()->GetActiveWebContents();
  ui_test_utils::NavigateToURL(
      browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage));

  ConnectToPeerConnectionServer("peer 1", left_tab);
  ConnectToPeerConnectionServer("peer 2", right_tab);

  GetUserMediaWithSpecificConstraintsAndAccept(left_tab,
                                               kAudioOnlyCallConstraints);
  EXPECT_EQ("ok-peerconnection-created",
            ExecuteJavascript("preparePeerConnection()", left_tab));

  AddAudioFile(kReferenceFileRelativeUrl, left_tab);
  MixLocalStreamWithPreviouslyLoadedAudioFile(left_tab);

  EstablishCall(left_tab, right_tab);

  // Note: the media flow isn't necessarily established on the connection just
  // because the ready state is ok on both sides. We sleep a bit between call
  // establishment and playing to avoid cutting of the beginning of the audio
  // file.
  SleepInJavascript(left_tab, 2000);

  PlayAudioFile(left_tab);

  // TODO(phoglund): simulate key presses, look for changes in typing detection
  // state.
  SleepInJavascript(left_tab, 10000);

  AssertNoAsynchronousErrors(left_tab);
  AssertNoAsynchronousErrors(right_tab);

  HangUp(left_tab);
  WaitUntilHangupVerified(left_tab);
  WaitUntilHangupVerified(right_tab);

  AssertNoAsynchronousErrors(left_tab);
  AssertNoAsynchronousErrors(right_tab);

  ASSERT_TRUE(peerconnection_server_.Stop());
}


text:
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/pagemap.h>
#include <linux/highmem.h>
#include <linux/crc32.h>
#include <linux/jffs2.h>
#include "nodelist.h"

static int jffs2_write_end(struct file *filp, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned copied,
			struct page *pg, void *fsdata);
static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned flags,
			struct page **pagep, void **fsdata);
static int jffs2_readpage (struct file *filp, struct page *pg);

int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
{
	struct inode *inode = filp->f_mapping->host;
	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
	int ret;

	ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
	if (ret)
		return ret;

	mutex_lock(&inode->i_mutex);
	/* Trigger GC to flush any pending writes for this inode */
	jffs2_flush_wbuf_gc(c, inode->i_ino);
	mutex_unlock(&inode->i_mutex);

	return 0;
}

const struct file_operations jffs2_file_operations =
{
	.llseek =	generic_file_llseek,
	.open =		generic_file_open,
 	.read =		do_sync_read,
 	.aio_read =	generic_file_aio_read,
 	.write =	do_sync_write,
 	.aio_write =	generic_file_aio_write,
	.unlocked_ioctl=jffs2_ioctl,
	.mmap =		generic_file_readonly_mmap,
	.fsync =	jffs2_fsync,
	.splice_read =	generic_file_splice_read,
};

/* jffs2_file_inode_operations */

const struct inode_operations jffs2_file_inode_operations =
{
	.get_acl =	jffs2_get_acl,
	.set_acl =	jffs2_set_acl,
	.setattr =	jffs2_setattr,
	.setxattr =	jffs2_setxattr,
	.getxattr =	jffs2_getxattr,
	.listxattr =	jffs2_listxattr,
	.removexattr =	jffs2_removexattr
};

const struct address_space_operations jffs2_file_address_operations =
{
	.readpage =	jffs2_readpage,
	.write_begin =	jffs2_write_begin,
	.write_end =	jffs2_write_end,
};

static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)
{
	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
	unsigned char *pg_buf;
	int ret;

	jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
		  __func__, inode->i_ino, pg->index << PAGE_CACHE_SHIFT);

	BUG_ON(!PageLocked(pg));

	pg_buf = kmap(pg);
	/* FIXME: Can kmap fail? */

	ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE);

	if (ret) {
		ClearPageUptodate(pg);
		SetPageError(pg);
	} else {
		SetPageUptodate(pg);
		ClearPageError(pg);
	}

	flush_dcache_page(pg);
	kunmap(pg);

	jffs2_dbg(2, "readpage finished\n");
	return ret;
}

int jffs2_do_readpage_unlock(struct inode *inode, struct page *pg)
{
	int ret = jffs2_do_readpage_nolock(inode, pg);
	unlock_page(pg);
	return ret;
}

static int jffs2_readpage (struct file *filp, struct page *pg)
{
	struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
	int ret;

	mutex_lock(&f->sem);
	ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
	mutex_unlock(&f->sem);
	return ret;
}

static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned flags,
			struct page **pagep, void **fsdata)
{
	struct page *pg;
	struct inode *inode = mapping->host;
	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
	struct jffs2_raw_inode ri;
	uint32_t alloc_len = 0;
	pgoff_t index = pos >> PAGE_CACHE_SHIFT;
	uint32_t pageofs = index << PAGE_CACHE_SHIFT;
	int ret = 0;

	jffs2_dbg(1, "%s()\n", __func__);

	if (pageofs > inode->i_size) {
		ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
					  ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
		if (ret)
			return ret;
	}

	mutex_lock(&f->sem);
	pg = grab_cache_page_write_begin(mapping, index, flags);
	if (!pg) {
		if (alloc_len)
			jffs2_complete_reservation(c);
		mutex_unlock(&f->sem);
		return -ENOMEM;
	}
	*pagep = pg;

	if (alloc_len) {
		/* Make new hole frag from old EOF to new page */
		struct jffs2_full_dnode *fn;

		jffs2_dbg(1, "Writing new hole frag 0x%x-0x%x between current EOF and new page\n",
			  (unsigned int)inode->i_size, pageofs);

		memset(&ri, 0, sizeof(ri));

		ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
		ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE);
		ri.totlen = cpu_to_je32(sizeof(ri));
		ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4));

		ri.ino = cpu_to_je32(f->inocache->ino);
		ri.version = cpu_to_je32(++f->highest_version);
		ri.mode = cpu_to_jemode(inode->i_mode);
		ri.uid = cpu_to_je16(i_uid_read(inode));
		ri.gid = cpu_to_je16(i_gid_read(inode));
		ri.isize = cpu_to_je32(max((uint32_t)inode->i_size, pageofs));
		ri.atime = ri.ctime = ri.mtime = cpu_to_je32(get_seconds());
		ri.offset = cpu_to_je32(inode->i_size);
		ri.dsize = cpu_to_je32(pageofs - inode->i_size);
		ri.csize = cpu_to_je32(0);
		ri.compr = JFFS2_COMPR_ZERO;
		ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8));
		ri.data_crc = cpu_to_je32(0);

		fn = jffs2_write_dnode(c, f, &ri, NULL, 0, ALLOC_NORMAL);

		if (IS_ERR(fn)) {
			ret = PTR_ERR(fn);
			jffs2_complete_reservation(c);
			goto out_page;
		}
		ret = jffs2_add_full_dnode_to_inode(c, f, fn);
		if (f->metadata) {
			jffs2_mark_node_obsolete(c, f->metadata->raw);
			jffs2_free_full_dnode(f->metadata);
			f->metadata = NULL;
		}
		if (ret) {
			jffs2_dbg(1, "Eep. add_full_dnode_to_inode() failed in write_begin, returned %d\n",
				  ret);
			jffs2_mark_node_obsolete(c, fn->raw);
			jffs2_free_full_dnode(fn);
			jffs2_complete_reservation(c);
			goto out_page;
		}
		jffs2_complete_reservation(c);
		inode->i_size = pageofs;
	}

	/*
	 * Read in the page if it wasn't already present. Cannot optimize away
	 * the whole page write case until jffs2_write_end can handle the
	 * case of a short-copy.
	 */
	if (!PageUptodate(pg)) {
		ret = jffs2_do_readpage_nolock(inode, pg);
		if (ret)
			goto out_page;
	}
	mutex_unlock(&f->sem);
	jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
	return ret;

out_page:
	unlock_page(pg);
	page_cache_release(pg);
	mutex_unlock(&f->sem);
	return ret;
}

static int jffs2_write_end(struct file *filp, struct address_space *mapping,
			loff_t pos, unsigned len, unsigned copied,
			struct page *pg, void *fsdata)
{
	/* Actually commit the write from the page cache page we're looking at.
	 * For now, we write the full page out each time. It sucks, but it's simple
	 */
	struct inode *inode = mapping->host;
	struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
	struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
	struct jffs2_raw_inode *ri;
	unsigned start = pos & (PAGE_CACHE_SIZE - 1);
	unsigned end = start + copied;
	unsigned aligned_start = start & ~3;
	int ret = 0;
	uint32_t writtenlen = 0;

	jffs2_dbg(1, "%s(): ino #%lu, page at 0x%lx, range %d-%d, flags %lx\n",
		  __func__, inode->i_ino, pg->index << PAGE_CACHE_SHIFT,
		  start, end, pg->flags);

	/* We need to avoid deadlock with page_cache_read() in
	   jffs2_garbage_collect_pass(). So the page must be
	   up to date to prevent page_cache_read() from trying
	   to re-lock it. */
	BUG_ON(!PageUptodate(pg));

	if (end == PAGE_CACHE_SIZE) {
		/* When writing out the end of a page, write out the
		   _whole_ page. This helps to reduce the number of
		   nodes in files which have many short writes, like
		   syslog files. */
		aligned_start = 0;
	}

	ri = jffs2_alloc_raw_inode();

	if (!ri) {
		jffs2_dbg(1, "%s(): Allocation of raw inode failed\n",
			  __func__);
		unlock_page(pg);
		page_cache_release(pg);
		return -ENOMEM;
	}

	/* Set the fields that the generic jffs2_write_inode_range() code can't find */
	ri->ino = cpu_to_je32(inode->i_ino);
	ri->mode = cpu_to_jemode(inode->i_mode);
	ri->uid = cpu_to_je16(i_uid_read(inode));
	ri->gid = cpu_to_je16(i_gid_read(inode));
	ri->isize = cpu_to_je32((uint32_t)inode->i_size);
	ri->atime = ri->ctime = ri->mtime = cpu_to_je32(get_seconds());

	/* In 2.4, it was already kmapped by generic_file_write(). Doesn't
	   hurt to do it again. The alternative is ifdefs, which are ugly. */
	kmap(pg);

	ret = jffs2_write_inode_range(c, f, ri, page_address(pg) + aligned_start,
				      (pg->index << PAGE_CACHE_SHIFT) + aligned_start,
				      end - aligned_start, &writtenlen);

	kunmap(pg);

	if (ret) {
		/* There was an error writing. */
		SetPageError(pg);
	}

	/* Adjust writtenlen for the padding we did, so we don't confuse our caller */
	writtenlen -= min(writtenlen, (start - aligned_start));

	if (writtenlen) {
		if (inode->i_size < pos + writtenlen) {
			inode->i_size = pos + writtenlen;
			inode->i_blocks = (inode->i_size + 511) >> 9;

			inode->i_ctime = inode->i_mtime = ITIME(je32_to_cpu(ri->ctime));
		}
	}

	jffs2_free_raw_inode(ri);

	if (start+writtenlen < end) {
		/* generic_file_write has written more to the page cache than we've
		   actually written to the medium. Mark the page !Uptodate so that
		   it gets reread */
		jffs2_dbg(1, "%s(): Not all bytes written. Marking page !uptodate\n",
			__func__);
		SetPageError(pg);
		ClearPageUptodate(pg);
	}

	jffs2_dbg(1, "%s() returning %d\n",
		  __func__, writtenlen > 0 ? writtenlen : ret);
	unlock_page(pg);
	page_cache_release(pg);
	return writtenlen > 0 ? writtenlen : ret;
}


text:
/******************************************************************************************************/
/*                                                                                */
/*    Infinidat Ltd.  -  Proprietary and Confidential Material                                        */
/*                                                                                */
/*    Copyright (C) 2013, Infinidat Ltd. - All Rights Reserved                                        */
/*                                                                                */
/*    NOTICE: All information contained herein is, and remains the property of Infinidat Ltd.         */
/*    All information contained herein is protected by trade secret or copyright law.                 */
/*    The intellectual and technical concepts contained herein are proprietary to Infinidat Ltd.,     */
/*    and may be protected by U.S. and Foreign Patents, or patents in progress.                       */
/*                                                                                */
/*    Redistribution or use, in source or binary forms, with or without modification,                 */
/*    are strictly forbidden unless prior written permission is obtained from Infinidat Ltd.          */
/*                                                                                */
/*                                                                                */
/******************************************************************************************************/

package org.mestor.reflection;

import java.lang.reflect.Method;

public class ClassAccessor {

	public static <T> Class<T> forName(String className) {
		try {
			return forNameThrowsChecked(className);
		} catch (ClassNotFoundException e) {
			throw new IllegalArgumentException(className, e);
		}
	}

	@SuppressWarnings("unchecked")
	public static <T> Class<T> forNameThrowsChecked(String className) throws ClassNotFoundException{
		return (Class<T>)Class.forName(className);
	}

	public static <T> T newInstance(Class<T> clazz) {
		try {
			return clazz.newInstance();
		} catch (ReflectiveOperationException e) {
			throw new IllegalArgumentException(clazz.getName(), e);
		}
	}

	@SuppressWarnings("unchecked")
	public static <T> T newInstance(String className) {
		try {
			return (T)forName(className).newInstance();
		} catch (ReflectiveOperationException e) {
			throw new IllegalArgumentException(className, e);
		}
	}

	public static <T, R> R invoke(Class<? extends T> clazz, String methodName, Class<?>[] paramTypes, Class<R> returnType, T obj, Object[] args) {
		//TODO search for non-public method and for methods with not exact match of parameters, i.e. those that assignable from parameters
		Method method;
		try {
			method = clazz.getMethod(methodName, paramTypes);
			method.setAccessible(true);
			@SuppressWarnings("unchecked")
			R returnValue = (R)method.invoke(obj, args);
			return returnValue;
		} catch (ReflectiveOperationException e) {
			throw new IllegalArgumentException(e);
		}
	}
}


text:
package errdefs

import (
	"testing"

	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"

	"github.com/pkg/errors"
)

func TestGRPCRoundTrip(t *testing.T) {
	errShouldLeaveAlone := errors.New("unknown to package")

	for _, testcase := range []struct {
		input error
		cause error
		str   string
	}{
		{
			input: ErrAlreadyExists,
			cause: ErrAlreadyExists,
		},
		{
			input: ErrNotFound,
			cause: ErrNotFound,
		},
		{
			input: errors.Wrapf(ErrFailedPrecondition, "test test test"),
			cause: ErrFailedPrecondition,
			str:   "test test test: failed precondition",
		},
		{
			input: grpc.Errorf(codes.Unavailable, "should be not available"),
			cause: ErrUnavailable,
			str:   "should be not available: unavailable",
		},
		{
			input: errShouldLeaveAlone,
			cause: ErrUnknown,
			str:   errShouldLeaveAlone.Error() + ": " + ErrUnknown.Error(),
		},
	} {
		t.Run(testcase.input.Error(), func(t *testing.T) {
			t.Logf("input: %v", testcase.input)
			gerr := ToGRPC(testcase.input)
			t.Logf("grpc: %v", gerr)
			ferr := FromGRPC(gerr)
			t.Logf("recovered: %v", ferr)

			if errors.Cause(ferr) != testcase.cause {
				t.Fatalf("unexpected cause: %v != %v", errors.Cause(ferr), testcase.cause)
			}

			expected := testcase.str
			if expected == "" {
				expected = testcase.cause.Error()
			}
			if ferr.Error() != expected {
				t.Fatalf("unexpected string: %q != %q", ferr.Error(), expected)
			}
		})
	}

}


text:
Latviešu radio staciju spēlētājs izmantojot html5 audio un Polymer tehnoloģijas. Atbalsta viedtālruņus (testēts uz Chrome android pārlūka)

Stacijas var rediģēt un mainīt index.php dokumentā

Jaunas stacijas tiek definētās izmantojot `<radio-lv></radio-lv>` tagus

Atribūti:

* name - Stacijas nosaukums
* img - Stacijas logo
* stream - Stacijas audio straumes adrese
* aac - iestatīt uz true ja straumes avots ir aac formātā (firefox nevar atskaņot aac)

# Radio station page/player

Player for many radio stations. Uses html5 audio and Polymer technologies. works on smartphones (tested on Chrome android browser)

Station are defined with `<radio-lv></radio-lv>` tags

Atributes:

* name - name of the station
* img - logo of the station
* stream - source of the live stream
* aac - set to true if the stream is in aac format (to hide from firefox)


text:
package iptables

import (
	"errors"
	"os/exec"
	"regexp"
	"strconv"
	"strings"

	"github.com/influxdata/telegraf"
	"github.com/influxdata/telegraf/plugins/inputs"
)

// Iptables is a telegraf plugin to gather packets and bytes throughput from Linux's iptables packet filter.
type Iptables struct {
	UseSudo bool
	UseLock bool
	Binary  string
	Table   string
	Chains  []string
	lister  chainLister
}

// Description returns a short description of the plugin.
func (ipt *Iptables) Description() string {
	return "Gather packets and bytes throughput from iptables"
}

// SampleConfig returns sample configuration options.
func (ipt *Iptables) SampleConfig() string {
	return `
  ## iptables require root access on most systems.
  ## Setting 'use_sudo' to true will make use of sudo to run iptables.
  ## Users must configure sudo to allow telegraf user to run iptables with no password.
  ## iptables can be restricted to only list command "iptables -nvL".
  use_sudo = false
  ## Setting 'use_lock' to true runs iptables with the "-w" option.
  ## Adjust your sudo settings appropriately if using this option ("iptables -wnvl")
  use_lock = false
  ## Define an alternate executable, such as "ip6tables". Default is "iptables".
  # binary = "ip6tables"
  ## defines the table to monitor:
  table = "filter"
  ## defines the chains to monitor.
  ## NOTE: iptables rules without a comment will not be monitored.
  ## Read the plugin documentation for more information.
  chains = [ "INPUT" ]
`
}

// Gather gathers iptables packets and bytes throughput from the configured tables and chains.
func (ipt *Iptables) Gather(acc telegraf.Accumulator) error {
	if ipt.Table == "" || len(ipt.Chains) == 0 {
		return nil
	}
	// best effort : we continue through the chains even if an error is encountered,
	// but we keep track of the last error.
	for _, chain := range ipt.Chains {
		data, e := ipt.lister(ipt.Table, chain)
		if e != nil {
			acc.AddError(e)
			continue
		}
		e = ipt.parseAndGather(data, acc)
		if e != nil {
			acc.AddError(e)
			continue
		}
	}
	return nil
}

func (ipt *Iptables) chainList(table, chain string) (string, error) {
	var binary string
	if ipt.Binary != "" {
		binary = ipt.Binary
	} else {
		binary = "iptables"
	}
	iptablePath, err := exec.LookPath(binary)
	if err != nil {
		return "", err
	}
	var args []string
	name := iptablePath
	if ipt.UseSudo {
		name = "sudo"
		args = append(args, iptablePath)
	}
	iptablesBaseArgs := "-nvL"
	if ipt.UseLock {
		iptablesBaseArgs = "-wnvL"
	}
	args = append(args, iptablesBaseArgs, chain, "-t", table, "-x")
	c := exec.Command(name, args...)
	out, err := c.Output()
	return string(out), err
}

const measurement = "iptables"

var errParse = errors.New("Cannot parse iptables list information")
var chainNameRe = regexp.MustCompile(`^Chain\s+(\S+)`)
var fieldsHeaderRe = regexp.MustCompile(`^\s*pkts\s+bytes\s+`)
var valuesRe = regexp.MustCompile(`^\s*(\d+)\s+(\d+)\s+.*?/\*\s*(.+?)\s*\*/\s*`)

func (ipt *Iptables) parseAndGather(data string, acc telegraf.Accumulator) error {
	lines := strings.Split(data, "\n")
	if len(lines) < 3 {
		return nil
	}
	mchain := chainNameRe.FindStringSubmatch(lines[0])
	if mchain == nil {
		return errParse
	}
	if !fieldsHeaderRe.MatchString(lines[1]) {
		return errParse
	}
	for _, line := range lines[2:] {
		matches := valuesRe.FindStringSubmatch(line)
		if len(matches) != 4 {
			continue
		}

		pkts := matches[1]
		bytes := matches[2]
		comment := matches[3]

		tags := map[string]string{"table": ipt.Table, "chain": mchain[1], "ruleid": comment}
		fields := make(map[string]interface{})

		var err error
		fields["pkts"], err = strconv.ParseUint(pkts, 10, 64)
		if err != nil {
			continue
		}
		fields["bytes"], err = strconv.ParseUint(bytes, 10, 64)
		if err != nil {
			continue
		}
		acc.AddFields(measurement, fields, tags)
	}
	return nil
}

type chainLister func(table, chain string) (string, error)

func init() {
	inputs.Add("iptables", func() telegraf.Input {
		ipt := new(Iptables)
		ipt.lister = ipt.chainList
		return ipt
	})
}


text:
using System;
using System.Diagnostics;
using Microsoft.Extensions.PlatformAbstractions;
using System.Reflection;

namespace Bjd.Console.Controls
{
    public class MenuControl : Control
    {
        private int maxMenu = 6;
        public MenuControl(ControlContext cc) : base(cc)
        {
            Row = 3;
        }

        public int ActiveMenu { get; set; } = 1;

        public override bool Input(ConsoleKeyInfo key)
        {
            var result = false;
            if (key.Key == ConsoleKey.LeftArrow && ActiveMenu > 1)
            {
                ActiveMenu -= 1;
                result = true;
            }
            if (key.Key == ConsoleKey.RightArrow && ActiveMenu < maxMenu)
            {
                ActiveMenu += 1;
                result = true;
            }
            cContext.Server.Visible = (ActiveMenu == 1);
            cContext.Buffer.Visible = (ActiveMenu == 2);
            cContext.Logs.Visible = (ActiveMenu == 3);
            cContext.Option.Visible = (ActiveMenu == 4);
            cContext.Info.Visible = (ActiveMenu == 5);
            cContext.Service.Visible = (ActiveMenu == 6);

            return result;

        }

        public override void Output(int row, ConsoleContext context)
        {
            switch(row)
            {
                case 0:
                    context.Write(new string('-', Column));
                    break;
                case 1:
                    context.Write("|");
                    context.Write(" Servers ", (ActiveMenu == 1 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 1 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.Write(" Buffers ", (ActiveMenu == 2 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 2 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.Write(" Logs    ", (ActiveMenu == 3 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 3 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.Write(" Option  ", (ActiveMenu == 4 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 4 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.Write(" Info    ", (ActiveMenu == 5 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 5 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.Write(" Service ", (ActiveMenu == 6 ? ConsoleColor.White : ConsoleColor.Gray), (ActiveMenu == 6 ? ConsoleColor.DarkBlue : ConsoleColor.Black));
                    context.Write("|");
                    context.WriteBlank();
                    break;
                case 2:
                    context.Write(new string('-', Column));
                    break;
            }
        }

    }

}


text:
import abc

import cotyledon
from oslo_log import log
import six

from ceilometer.i18n import _LE
from ceilometer import pipeline
from ceilometer import utils

LOG = log.getLogger(__name__)

@six.add_metaclass(abc.ABCMeta)
class PipelineBasedService(cotyledon.Service):
    def __init__(self, worker_id, conf):
        super(PipelineBasedService, self).__init__(worker_id)
        self.conf = conf

    def clear_pipeline_validation_status(self):
        """Clears pipeline validation status flags."""
        self.pipeline_validated = False
        self.event_pipeline_validated = False

    def init_pipeline_refresh(self):
        """Initializes pipeline refresh state."""
        self.clear_pipeline_validation_status()

        self.refresh_pipeline_periodic = None
        if (self.conf.refresh_pipeline_cfg or
                self.conf.refresh_event_pipeline_cfg):
            self.refresh_pipeline_periodic = utils.create_periodic(
                target=self.refresh_pipeline,
                spacing=self.conf.pipeline_polling_interval)
            utils.spawn_thread(self.refresh_pipeline_periodic.start)

    def terminate(self):
        if self.refresh_pipeline_periodic:
            self.refresh_pipeline_periodic.stop()
            self.refresh_pipeline_periodic.wait()

    @abc.abstractmethod
    def reload_pipeline(self):
        """Reload pipeline in the agents."""

    def refresh_pipeline(self):
        """Refreshes appropriate pipeline, then delegates to agent."""

        if self.conf.refresh_pipeline_cfg:
            manager = None
            if hasattr(self, 'pipeline_manager'):
                manager = self.pipeline_manager
            elif hasattr(self, 'polling_manager'):
                manager = self.polling_manager
            pipeline_hash = manager.cfg_changed() if manager else None
            if pipeline_hash:
                try:
                    LOG.debug("Pipeline has been refreshed. "
                              "old hash: %(old)s, new hash: %(new)s",
                              {'old': manager.cfg_hash,
                               'new': pipeline_hash})
                    # Pipeline in the notification agent.
                    if hasattr(self, 'pipeline_manager'):
                        self.pipeline_manager = pipeline.setup_pipeline(
                            self.conf)
                    # Polling in the polling agent.
                    elif hasattr(self, 'polling_manager'):
                        self.polling_manager = pipeline.setup_polling(
                            self.conf)
                    self.pipeline_validated = True
                except Exception as err:
                    LOG.exception(_LE('Unable to load changed pipeline: %s')
                                  % err)

        if self.conf.refresh_event_pipeline_cfg:
            # Pipeline in the notification agent.
            manager = (self.event_pipeline_manager
                       if hasattr(self, 'event_pipeline_manager') else None)
            ev_pipeline_hash = manager.cfg_changed()
            if ev_pipeline_hash:
                try:
                    LOG.debug("Event Pipeline has been refreshed. "
                              "old hash: %(old)s, new hash: %(new)s",
                              {'old': manager.cfg_hash,
                               'new': ev_pipeline_hash})
                    self.event_pipeline_manager = (
                        pipeline. setup_event_pipeline(self.conf))
                    self.event_pipeline_validated = True
                except Exception as err:
                    LOG.exception(_LE('Unable to load changed event pipeline:'
                                      ' %s') % err)

        if self.pipeline_validated or self.event_pipeline_validated:
            self.reload_pipeline()
            self.clear_pipeline_validation_status()


text:
/*
 * Startup module of coordinator. For a storage cluster,
 * it's the coordinator that starts up first, load configs
 * from the config file,
 */

#include "coordinator.h"

using namespace nvds;

/*
static void Usage(int argc, const char* argv[]) {
  std::cout << "Usage:" << std::endl
            << "    " << argv[0] << " <config_file>" << std::endl;
}
*/

static std::string GetLocalAddr() {
  using boost::asio::ip::tcp;
  boost::asio::io_service io_service;
  tcp::resolver resolver(io_service);
  tcp::resolver::query query(boost::asio::ip::host_name(), "");
  auto iter = resolver.resolve(query);
  decltype(iter) end;
  while (iter != end) {
    tcp::endpoint ep = *iter++;
    return ep.address().to_string();
  }
  assert(false);
  return "";
}

int main(int argc, const char* argv[]) {
  // -1. Argument parsing
  //if (argc < 2) {
  //  Usage(argc, argv);
  //  return -1;
  //}

  // 1. Self initialization
  Coordinator coordinator;

  // 2. Listening for joining request from nodes and request from clients
  NVDS_LOG("Coordinator at: %s", GetLocalAddr().c_str());
  NVDS_LOG("Listening at: %u", kCoordPort);
  NVDS_LOG("......");

  coordinator.Run();

  return 0;
}


text:
<?php

namespace Sellsy\Models\CustomFields;

/**
 * Class CustomField
 *
 * @package Sellsy\Models\CustomFields
 */
class CustomField implements CustomFieldInterface
{
    /**
     * @var int
     */
    protected $id;

    /**
     * @var int
     */
    protected $fieldId;

    /**
     * @var string
     */
    protected $type;

    /**
     * @var string
     */
    protected $textValue;

    /**
     * @var bool
     */
    protected $boolValue;

    /**
     * @var int
     */
    protected $timestampValue;

    /**
     * @var float
     */
    protected $decimalValue;

    /**
     * @var int
     */
    protected $numericValue;

    /**
     * @var string
     */
    protected $stringValue;

    /**
     * @var string
     */
    protected $formattedValue;

    /**
     * @inheritdoc
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @inheritdoc
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @inheritdoc
     */
    public function getFieldId()
    {
        return $this->fieldId;
    }

    /**
     * @inheritdoc
     */
    public function setFieldId($fieldId)
    {
        $this->fieldId = $fieldId;
    }

    /**
     * @inheritdoc
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @inheritdoc
     */
    public function setType($type)
    {
        $this->type = $type;
    }

    /**
     * @inheritdoc
     */
    public function getTextValue()
    {
        return $this->textValue;
    }

    /**
     * @inheritdoc
     */
    public function setTextValue($textValue)
    {
        $this->textValue = $textValue;
    }

    /**
     * @inheritdoc
     */
    public function isBoolValue()
    {
        return $this->boolValue;
    }

    /**
     * @inheritdoc
     */
    public function setBoolValue($boolValue)
    {
        $this->boolValue = $boolValue;
    }

    /**
     * @inheritdoc
     */
    public function getTimestampValue()
    {
        return $this->timestampValue;
    }

    /**
     * @inheritdoc
     */
    public function setTimestampValue($timestampValue)
    {
        $this->timestampValue = $timestampValue;
    }

    /**
     * @return float
     */
    public function getDecimalValue()
    {
        return $this->decimalValue;
    }

    /**
     * @inheritdoc
     */
    public function setDecimalValue($decimalValue)
    {
        $this->decimalValue = $decimalValue;
    }

    /**
     * @inheritdoc
     */
    public function getNumericValue()
    {
        return $this->numericValue;
    }

    /**
     * @inheritdoc
     */
    public function setNumericValue($numericValue)
    {
        $this->numericValue = $numericValue;
    }

    /**
     * @inheritdoc
     */
    public function getStringValue()
    {
        return $this->stringValue;
    }

    /**
     * @inheritdoc
     */
    public function setStringValue($stringValue)
    {
        $this->stringValue = $stringValue;
    }

    /**
     * @inheritdoc
     */
    public function getFormattedValue()
    {
        return $this->formattedValue;
    }

    /**
     * @inheritdoc
     */
    public function setFormattedValue($formattedValue)
    {
        $this->formattedValue = $formattedValue;
    }
}


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

<TITLE>
com.kirkk.analyzer.framework.bcelbundle (JarAnalyzer API)
</TITLE>

<META NAME="keywords" CONTENT="com.kirkk.analyzer.framework.bcelbundle package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

com.kirkk.analyzer.framework.bcelbundle

Classes

JarBuilderImpl

JarCollectionImpl

JarImpl

JarMetricsImpl

JarPackageImpl

JarRelationshipDecorator


text:
// <copyright file="IDieRollTracker.cs" company="DarthPedro">
// Copyright (c) 2017 DarthPedro. All rights reserved.
// </copyright>

//-----------------------------------------------------------------------
// Assembly         : OnePlat.DiceNotation
// Author           : DarthPedro
// Created          : 8/30/2017
//
// Last Modified By : DarthPedro
// Last Modified On : 9/3/2017
//-----------------------------------------------------------------------
// <summary>
//       This project is licensed under the MIT license.
//
//       OnePlat.DiceNotation is an open source project that parses,
//  evalutes, and rolls dice that conform to the defined Dice notiation.
//  This notation is usable in any form of random dice games and role-playing
//  games like D&D and d20.
// </summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace OnePlat.DiceNotation.DieRoller
{
    /// <summary>
    /// Interface to define in-memory statistical tracking service for die rolls.
    /// </summary>
    public interface IDieRollTracker
    {
        /// <summary>
        /// Gets the limit of roll data kept in the tracker.
        /// </summary>
        int TrackerDataLimit { get; set; }

        /// <summary>
        /// Adds the current roll to the tracking service.
        /// </summary>
        /// <param name="dieSides">Die being rolled</param>
        /// <param name="result">Result of the die roll</param>
        /// <param name="dieRoller">Type of die roller used</param>
        void AddDieRoll(int dieSides, int result, Type dieRoller);

        /// <summary>
        /// Gets the roll tracking data based on specified filters. Not specifying a filter
        /// means that filter is not applied to the results.
        /// </summary>
        /// <param name="dieType">Filter results by die type</param>
        /// <param name="dieSides">Filter results by die sides</param>
        /// <returns>List of roll tracking data.</returns>
        Task<IList<DieTrackingData>> GetTrackingDataAsync(string dieType = null, string dieSides = null);

        /// <summary>
        /// Gets a frequency view of the tracking data in memory for reporting
        /// purposes.
        /// </summary>
        /// <returns>Frequency of rolls per roller type, sides, and results.</returns>
        Task<IList<AggregateDieTrackingData>> GetFrequencyDataViewAsync();

        /// <summary>
        /// Clears the current set of die tracking data.
        /// </summary>
        void Clear();

        /// <summary>
        /// Converts this set of tracker data to a json string representation.
        /// </summary>
        /// <returns>Json text representation.</returns>
        Task<string> ToJsonAsync();

        /// <summary>
        /// Loads this object data from a json string.
        /// </summary>
        /// <param name="jsonText">text to load</param>
        /// <returns>Task</returns>
        Task LoadFromJsonAsync(string jsonText);
    }
}


text:
package com.droid.db;

import android.content.Context;
import android.os.Environment;
import android.util.Log;
import com.droid.R;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class DBManager {
	private final int BUFFER_SIZE = 400000;
	public static final String PACKAGE_NAME = "com.cqsmiletv";
	public static final String DB_NAME = "myapp.db";
	public static final String DB_PATH = "/data"
			+ Environment.getDataDirectory().getAbsolutePath() + "/"
			+ PACKAGE_NAME + "/databases";

	private Context context;

	private static final String TAG ="DBManager";
	private final boolean d = true;

	public DBManager(Context context) {
		this.context = context;
	}

	/** copy the database under raw */
	public void copyDatabase() {

    }

	private void readDB(FileOutputStream fos, byte[] buffer, int db_id)
			throws IOException {
		int count;
		InputStream is;
		is = this.context.getResources().openRawResource(db_id);
		while ((count = is.read(buffer)) > 0) {
			fos.write(buffer, 0, count);
		}
		is.close();
	}
}


text:
package org.uberfire.ext.widgets.common.client.common;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import org.gwtbootstrap3.client.ui.FormGroup;
import org.gwtbootstrap3.client.ui.FormLabel;

public class FormStyleItem extends Composite {

    @UiField
    FormGroup formGroup;

    @UiField
    FlowPanel group;

    @UiField
    FormLabel label;

    int index = -1;

    interface FormStyleLayoutBinder
            extends
            UiBinder<Widget, FormStyleItem> {

    }

    private static FormStyleLayoutBinder uiBinder = GWT.create( FormStyleLayoutBinder.class );

    public FormStyleItem() {
        initWidget( uiBinder.createAndBindUi( this ) );
    }

    public void setup( final String labelText,
                       final IsWidget field,
                       final int index ) {
        label.setText( labelText );
        group.add( field );
        this.index = index;
    }

    public FormGroup getFormGroup() {
        return this.formGroup;
    }

    public FlowPanel getGroup() {
        return this.group;
    }

    public int getIndex() {
        return this.index;
    }
}


text:
#!/usr/bin/env node
/**
 * Created by ElyDeLaCruz on 11/18/2014.
 * @todo allow all gulpw-config.yaml and bundle config options to be passed and merged via the command line
 */

require('sjljs');

var Liftoff =   require('liftoff'),
    argv =      require('yargs')
        .default('skip-artifacts',  false)
        .default('browser',         false)
        .default('bundle',          null)
        .default('async',           false)
        .default('force',           false)
        .default('out',           null)
        .alias('o',     'out')
        .alias('b',     'browser')
        .alias('a',     'async')
        .alias('d',     'dev')
        .alias('f',     'force')
        .alias('g',     'topLevelConfig')
        .alias('v',     'verbose')
        .alias('skip-css-hint',     'skip-css-linting')
        .alias('skip-css-lint',     'skip-css-linting')
        .alias('skip-css-hinting',  'skip-css-linting')
        .alias('skip-js-hint',      'skip-js-linting')
        .alias('skip-js-lint',      'skip-js-linting')
        .alias('skip-js-hinting',   'skip-js-linting')
        .alias('skip-hinting',  'skip-linting')
        .alias('skip-hint',     'skip-linting')
        .alias('skip-lint',     'skip-linting')
        .alias('skip-jasmine',          'skip-jasmine-tests')
        .alias('skip-jasmine-testing',  'skip-jasmine-tests')
        .alias('skip-mocha',            'skip-mocha-tests')
        .alias('skip-mocha-testing',    'skip-mocha-tests')
        .alias('skip-testing',  'skip-tests')
        .alias('skip-hashing',  'skip-hashes')
        .alias('no-hashes',     'skip-hashes')
        .alias('skip-related',  'skip-related-bundles')
        .alias('show-files',    'show-file-sizes')
        .alias('no-tests',      'skip-tests')
        .alias('filetypes',     'file-types')
        .alias('filetype',     'file-types')
        .alias('t',     'file-types')
        .alias('x',     'file-types')
        .alias('ext',   'file-types')
        .argv,
    gulp =  require('gulp'),
    path =  require('path'),
    fs =    require('fs'),
    chalk = require('chalk'),
    cli = new Liftoff({
        name: 'gulpw',
        processTitle: 'gulpw',
        moduleName: 'gulpw',
        configName: 'gulpw-config',
        extensions: {
            '.js': null,
            '.json': null,
            '.yaml': 'js-yaml'
        }
    }),
    Wrangler = require('./src/Wrangler'),
    userConfig,
    wrangler;

function init(env) {

    // Dump pertinent environment variables
    if (argv.dumpEnv) {
        console.log('process.argv:',                process.argv);
        console.log('LIFTOFF SETTINGS:',             this);
        console.log('CLI OPTIONS:',                  argv);
        console.log('CWD:',                          env.cwd);
        console.log('LOCAL MODULES PRELOADED:',      env.require);
        console.log('SEARCHING FOR:',                env.configNameRegex);
        console.log('FOUND CONFIG AT:',              env.configPath);
        console.log('CONFIG BASE DIR:',              env.configBase);
        console.log('YOUR LOCAL MODULE IS LOCATED:', env.modulePath);
    }

    // Dumps your local package and gulpw's package files
    if (argv.dumpPackage) {
        console.log('LOCAL PACKAGE.JSON:',           env.modulePackage);
        console.log('CLI PACKAGE.JSON',              require('./package'));
    }

    // Set process' working directory
    env.pwd = __dirname;

    // If the config path is empty
    if ((
            sjl.empty(env.configPath) &&
                (process.argv[1].indexOf('gulpw') === -1 && process.argv[1].indexOf('gulp') === -1)
        )
        || argv._.length === 0) {

        // Write message to user
        console.log(chalk.yellow('\nNo \'gulpw-config.*\' file found.'));
    }
    else if (!sjl.empty(env.configPath)) {

        // Change to config's path
        process.chdir(env.configBase);

        // Load config file
        userConfig = Wrangler.prototype.loadConfigFile(env.configPath);
    }

    // Instantiate wrangler
    try { wrangler = new Wrangler(gulp, argv, env, userConfig) } catch (e) {
        console.log('Uncaught Error: \n',
            e.message + ' \n',
            'Line number: ' + e.lineNumber + ' \n',
            e.stack);
    }
}

cli.launch({
    cwd: argv.cwd,
    configPath: argv.configFile,
    require: argv.require,
    completion: argv.completion,
    verbose: argv.verbose
}, init);

module.exports = gulp;


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Agaricus myochrous-stilbopus Pers.

### Remarks
null


text:
<!DOCTYPE html>
<?php include 'customerheader.php'; ?>

<meta charset="UTF-8">
<title>Sign Up</title>
<link rel="stylesheet" type="text/css href="style.css">

Sign Up for an account below:

<form action="signupconfirm.php" method="POST" style="width:60%; padding-left:200px">

    First Name:
    <input class="form-control" type="text" name="firstname" placeholder="First Name" required>

    Last Name:
    <input class="form-control" type="text" name="lastname" placeholder="Last Name" required>

    Phone Number:
    <input class="form-control" type="number" name="phoneNum" placeholder="(555)-555-5555" required>

    Username:
    <input class="form-control" type="text" name="username" placeholder="Username" required>

    Password:
    <input class="form-control" name="pass" required="required" type="Password" id="password">

    Confirm Password:
    <input class="form-control" name="password_confirm" required="required" type="password" id="password_confirm" oninput="check(this)">

     <button type="submit" class="btn btn-primary"/>Sign Up</button>
 </form>
<?php include 'footer.php'; ?>


text:
module RuboCop
  module Cop
    module RSpec
      module Capybara
        # Checks if there is a more specific finder offered by Capybara.
        #
        # @example
        #   # bad
        #   find('#some-id')
        #   find('[visible][id=some-id]')
        #
        #   # good
        #   find_by_id('some-id')
        #   find_by_id('some-id', visible: true)
        #
        class SpecificFinders < Base
          extend AutoCorrector

          include RangeHelp

          MSG = 'Prefer `find_by` over `find`.'
          RESTRICT_ON_SEND = %i[find].freeze

          # @!method find_argument(node)
          def_node_matcher :find_argument, <<~PATTERN
            (send _ :find (str $_) ...)
          PATTERN

          def on_send(node)
            find_argument(node) do |arg|
              next if CssSelector.multiple_selectors?(arg)

              on_attr(node, arg) if attribute?(arg)
              on_id(node, arg) if CssSelector.id?(arg)
            end
          end

          private

          def on_attr(node, arg)
            return unless (id = CssSelector.attributes(arg)['id'])

            register_offense(node, replaced_arguments(arg, id))
          end

          def on_id(node, arg)
            register_offense(node, "'#{arg.to_s.delete('#')}'")
          end

          def attribute?(arg)
            CssSelector.attribute?(arg) &&
              CssSelector.common_attributes?(arg)
          end

          def register_offense(node, arg_replacement)
            add_offense(offense_range(node)) do |corrector|
              corrector.replace(node.loc.selector, 'find_by_id')
              corrector.replace(node.first_argument.loc.expression,
                                arg_replacement)
            end
          end

          def replaced_arguments(arg, id)
            options = to_options(CssSelector.attributes(arg))
            options.empty? ? id : "#{id}, #{options}"
          end

          def to_options(attrs)
            attrs.each.map do |key, value|
              next if key == 'id'

              "#{key}: #{value}"
            end.compact.join(', ')
          end

          def offense_range(node)
            range_between(node.loc.selector.begin_pos, end_pos(node))
          end

          def end_pos(node)
            if node.loc.end
              node.loc.end.end_pos
            else
              node.loc.expression.end_pos
            end
          end
        end
      end
    end
  end
end


text:
package com.example;

import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.system.OutputCaptureRule;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;

import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@RunWith(SpringRunner.class)
@SpringBootTest(classes = EventHubKafkaBinderApplication.class)
@AutoConfigureMockMvc
@TestPropertySource(locations = "classpath:application-test.properties")
public class EventHubKafkaBinderApplicationIT {

    @Rule
    public OutputCaptureRule capture = new OutputCaptureRule();
    @Autowired
    private MockMvc mvc;

    @Test
    public void testSendAndReceiveMessage() throws Exception {
        String message = UUID.randomUUID().toString();

        mvc.perform(post("/messages?message=" + message)).andExpect(status().isOk())
            .andExpect(content().string(message));

        String messageReceivedLog = String.format("New message received: '%s'", message);

        boolean messageReceived = false;
        for (int i = 0; i < 100; i++) {
            String output = capture.toString();
            if (output.contains(messageReceivedLog)) {
                messageReceived = true;
                break;
            }

            Thread.sleep(1000);
        }
        assertThat(messageReceived).isTrue();
    }
}


text:
	"use strict";

	console.log( "testcopter. Ooosssh!" );


text:
[Redux](http://redux.js.org/) with typed actions.

[![npm version](https://img.shields.io/npm/v/typed-redux.svg?style=flat-square)](https://www.npmjs.com/package/typed-redux)

## Why?
- Action type namespacing (Redux issue [#786](https://github.com/reactjs/redux/issues/786))
- Get rid of [action types string constants](https://github.com/reactjs/redux/blob/master/examples/todomvc/src/constants/ActionTypes.js)
- Get rid of reserved `type` properties of actions
- TypeScript support for actions (Redux issue [#992](https://github.com/reactjs/redux/issues/992) [#355](https://github.com/reactjs/redux/issues/355))

## Installation
```
npm install --save typed-redux
```

## Usage
See [examples](https://github.com/jas-chen/typed-redux/tree/master/examples) for usage.

## APIs
APIs are the same as original [Redux](http://redux.js.org/), excepting that:
- You can dispatch class instances actions
- Actions don't have to have a `type` property

## FAQ
#### Do I need to use TypeScript to use Typed Redux?
No. And you can still get benefits from typed actions.

#### Is typed Action serializable?
[Yes](https://github.com/jas-chen/typed-redux/tree/master/examples/serialize-action).

## Versioning
Typed Redux will follow the version of Redux, but it may have it's own beta or rc versions.