text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('listings', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='gatheringcenter',
            name='published',
            field=models.BooleanField(default=False),
        ),
        migrations.AddField(
            model_name='resource',
            name='published',
            field=models.BooleanField(default=False),
        ),
    ]


text:
describe("given a schema with an insert only relationship", function() {
   var q = require('q'),
      _ = require('lodash'),
      db = {},
      schemas = require('../lib/schemas'),
      core_ = require('../lib/coreworm'),
      wormmodel_ = require('../lib/model'),
      query,
      core,
      wormmodel;

  beforeEach(function() {
    // Set up the mocks
    query = jasmine.createSpyObj('query', ['insert', 'update', 'select', 'remove']),
    core = core_(query);
    wormmodel = wormmodel_(core);
  });

  // Insert only relationships dont delete all the child records on update.
  // (Useful for logging history records)
  var db = {};
  var data_schema = {table: 'data',
                     fields: {id: null, field1: '', history: []},
                     relationships: [{field: 'history', maps_to: 'history',
                                      with_field: 'data_id', insert_only: true}]
                    };
  var child_schema = {table: 'history',
                      one_to_many: {parent_field: 'data_id'},
                      fields: {id: null, data_id: null, data:''}};

  var data, db = {};

  describe("when updating a record", function() {
    beforeEach(function() {
      query.update.andReturn(q.resolve(3));
      query.remove.andReturn(q.resolve());
      query.insert.andReturn(q.resolve(2));
      schemas.registerSchema(data_schema);
      schemas.registerSchema(child_schema);
      data = {id: 1, field1: 'ook1',
              history: [{data_id: 1, data: 'stuff grooved'},
                        {data_id: 1, data: 'stuff rocked'}]};

      core.saveModel(db, 'data', data);
    });

    afterEach(function() {
      schemas.clearSchema();
    });

    it("updates the parent table", function(done) {
      process.nextTick(function() {
        expect(query.update).toHaveBeenCalledWith(db, 'data', {id: 1, field1: 'ook1'});
        done();
      });
    });

    it("does not remove the many to many row", function(done) {
      process.nextTick(function() {
        expect(query.remove).not.toHaveBeenCalled();
        done();
      });
    });
  });
});

redpajama_set_name: RedPajamaGithub


text:
import matplotlib.pyplot as plt
import seaborn as sns
import ggplot as gp

import numpy as np
import pandas as pd
# import tables as h5

import itertools as it
from collections import defaultdict

import numpy as np
import pandas as pd
import scipy
from scikits import bootstrap as bs
import statsmodels.api as sm
import statsmodels.stats.multitest as smm

import munch

import pymc as mc

import click

import ipdb

# import warnings

# warnings.filterwarnings('error')

# this is the command function

echo = click.echo

# @click.command(context_settings=CONTEXT_SETTINGS)
# @click.option('--ld-prog',
#     type=click.Choice(['plink','vcftools']),
#     help="Which program was used to generate the LD values?",
#     show_default=True,
#     default='vcftools')
# @click.option('--distance-bin',
#     default=50,
#     show_default=True,
#     help="How wide do you want the bin window?")
# @click.argument('ld_path',
#     type=click.Path(exists=True))
# @click.argument('out_path',
#     type=click.Path())
def run(ld_path, out_path, ld_prog, distance_bin):
    """
    ld_path = "Path to the table file created by the LD calculation program."
    out_path = "Path to where you want to save the results pickle."
    """

    if ld_prog == 'vcftools':
        ld = pd.read_table(ld_path, sep="\t", header=0, names=['CHR_A', 'BP_A', 'BP_B', 'N_INDV', 'R2'])
    else:
        ld = pd.read_table(ld_path, sep=" +", engine='python')

    echo("Calculating distance between snp-pairs.")
    ld['BP_DELTA'] = abs(ld.BP_A - ld.BP_B)

    echo("Establishing the distance_bin column.")
    update_distance_bin(ld, win=distance_bin)

    echo("Re-scaling the R^2 values to (0,1) instead of [0,1].")
    ld["R2_scaled_for_B"] = ld.R2.apply(lambda x: ((x-0.5)*0.999) + 0.5)

    echo("Setting up the models and doing the MAP calculations:")
    models = {}

    for model in yield_models(ld):
        # models[model.bin_id_tag] = model  # Save models in case we need to plot MCMC convergence plots
        record_parameters_and_probabilities(ld, model)

    echo("Saving results to CSV from pandas dataframe.")
    ld.to_csv(path_or_buf=out_path, sep=",", na_rep='nan', float_format=None,
              columns=None, header=True, index=True, index_label=None,
              mode='w', encoding=None, quoting=None,
              quotechar='"', line_terminator='\n', chunksize=None,
              tupleize_cols=False, date_format=None, doublequote=True,
              escapechar=None, decimal='.')

# #################### BELOW ARE HELPER FUNCTIONS #####################

def update_distance_bin(df, win=100):

    assert isinstance(df, pd.DataFrame)

    # add distance_bin column
    # df.loc[:,'distance_bin'] = df.BP_DELTA.apply(lambda x: x - (x % win))
    df['distance_bin'] = df.BP_DELTA.apply(lambda x: x - (x % win))

def yield_models(dataframe):

    bin_ids = dataframe.distance_bin.unique()
    with click.progressbar(bin_ids) as bin_ids:
        for bin_id in bin_ids:

            assert isinstance(bin_id, int)

            # get our distance binned r^2 d in a nice dataframe
            # then drop any rows with R2 == NANs
            data = dataframe.query("(distance_bin == {bin_id})".format(bin_id=bin_id))

            na_mask = data.R2.apply(lambda r2: not np.isnan(r2))
            data = data[na_mask]

            # generate names for stocastics
            alpha_name = "{bin_id}_alpha".format(bin_id=bin_id)
            beta_name = "{bin_id}_beta".format(bin_id=bin_id)
            r2_dist_name = "{bin_id}_r2_distribution_beta".format(bin_id=bin_id)

            # set priors for parameters
            alpha_of_beta = mc.Uniform(alpha_name, 0.01, 10)
            beta_of_beta = mc.Uniform(beta_name, 0.01, 10)

            # set the d
            try:
                r2_distribution_beta = mc.Beta(name=r2_dist_name,
                                               alpha=alpha_of_beta,
                                               beta=beta_of_beta,
                                               value=data.R2_scaled_for_B.dropna(),
                                               observed=True,
                                               verbose=0
                                               )

                # create and yield the model object tagged with its bin_id
                model = mc.Model([r2_distribution_beta, alpha_of_beta, beta_of_beta])
                model.bin_id_tag = bin_id
                model.MCMC_run = None  # allow us to know how many times we had to do the experiments rather than MAP

            except ValueError as exc:
                if "but got (0,)" in exc.message:
                    yield munch.Munch(bin_id_tag=bin_id)

            yield model

def record_parameters_and_probabilities(df, model):

    if not isinstance(model, mc.Model):
        return model

    # set up empty slots for our upcoming values
    # but only if we havent already
    try:
        df.alpha_param[0]
    except AttributeError:
        df['alpha_param'] = np.nan
        df['beta_param'] = np.nan
        df['cdf'] = np.nan
        df['one_minus_cdf'] = np.nan
        df['one_minus_cdf_BH'] = np.nan
        df['MAP_succeeded'] = False

    # set up a mask for this distance_bin
    bin_mask = df.distance_bin == model.bin_id_tag

    # perform Max A Posteriori
    model_runner = mc.MAP(model)

    # Parameter names for access through the model
    a_name = "{bin_id}_alpha".format(bin_id=model.bin_id_tag)
    b_name = "{bin_id}_beta".format(bin_id=model.bin_id_tag)

    try:
        # if we can take the short cut, great!
        model_runner.fit()
        model.MCMC_run = False
    except RuntimeError as exc:
        if "Posterior probability optimization converged to value with zero probability." in exc.message:
            # Otherwise lets run the MCMC experiment
            model_runner = mc.MCMC(model)
            model.MCMC_run = model_runner

            # re-initialize the alpha and beta starting values randomly
            # to avoid non-allowed values that seem to slip in from the MAP.fit()
            current_alpha,current_beta = model.get_node(a_name),model.get_node(b_name)
            current_alpha.random()
            current_beta.random()

            # do the learning
            model_runner.sample(iter=40000, burn=20000, thin=1)

    # get and store parameters
    alpha, beta = model.get_node(a_name),model.get_node(b_name)

    # df.loc[bin_mask,].alpha_param = alpha.value.item()
    # df.loc[bin_mask,].beta_param = beta.value.item()

    # get and store probabilities
    # Record the probabilities of obtaining each R2 value (or smaller) in the bin afer scaling
    df.loc[bin_mask, 'cdf'] = scipy.stats.beta.cdf(df[bin_mask].R2_scaled_for_B,
                                                   alpha.value.item(),
                                                   beta.value.item())
    df.loc[bin_mask, 'one_minus_cdf'] = 1 - df[bin_mask]['cdf']
    df.loc[bin_mask, 'one_minus_cdf_BH'] = smm.multipletests(df[bin_mask].one_minus_cdf,
                                                         method='fdr_bh')[1]

if __name__ == '__main__':
    run()


text:
'use strict';

// NOTE: We're explicitly not using JSX in this file. This is intended to test
// classic JS without JSX.

var React;
var ReactDOM;
var ReactTestUtils;

describe('ReactElement', function() {
  var ComponentClass;
  var originalSymbol;

  beforeEach(function() {
    require('mock-modules').dumpCache();

    // Delete the native Symbol if we have one to ensure we test the
    // unpolyfilled environment.
    originalSymbol = global.Symbol;
    global.Symbol = undefined;

    React = require('React');
    ReactDOM = require('ReactDOM');
    ReactTestUtils = require('ReactTestUtils');
    ComponentClass = React.createClass({
      render: function() {
        return React.createElement('div');
      },
    });
  });

  afterEach(function() {
    global.Symbol = originalSymbol;
  });

  it('uses the fallback value when in an environment without Symbol', function() {
    expect(
.$$typeof).toBe(0xeac7);
  });

  it('returns a complete element according to spec', function() {
    var element = React.createFactory(ComponentClass)();
    expect(element.type).toBe(ComponentClass);
    expect(element.key).toBe(null);
    expect(element.ref).toBe(null);
    var expectation = {};
    Object.freeze(expectation);
    expect(element.props).toEqual(expectation);
  });

  it('allows a string to be passed as the type', function() {
    var element = React.createFactory('div')();
    expect(element.type).toBe('div');
    expect(element.key).toBe(null);
    expect(element.ref).toBe(null);
    var expectation = {};
    Object.freeze(expectation);
    expect(element.props).toEqual(expectation);
  });

  it('returns an immutable element', function() {
    var element = React.createFactory(ComponentClass)();
    expect(() => element.type = 'div').toThrow();
  });

  it('does not reuse the original config object', function() {
    var config = {foo: 1};
    var element = React.createFactory(ComponentClass)(config);
    expect(element.props.foo).toBe(1);
    config.foo = 2;
    expect(element.props.foo).toBe(1);
  });

  it('extracts key and ref from the config', function() {
    var element = React.createFactory(ComponentClass)({
      key: '12',
      ref: '34',
      foo: '56',
    });
    expect(element.type).toBe(ComponentClass);
    expect(element.key).toBe('12');
    expect(element.ref).toBe('34');
    var expectation = {foo:'56'};
    Object.freeze(expectation);
    expect(element.props).toEqual(expectation);
  });

  it('coerces the key to a string', function() {
    var element = React.createFactory(ComponentClass)({
      key: 12,
      foo: '56',
    });
    expect(element.type).toBe(ComponentClass);
    expect(element.key).toBe('12');
    expect(element.ref).toBe(null);
    var expectation = {foo:'56'};
    Object.freeze(expectation);
    expect(element.props).toEqual(expectation);
  });

  it('preserves the owner on the element', function() {
    var Component = React.createFactory(ComponentClass);
    var element;

    var Wrapper = React.createClass({
      render: function() {
        element = Component();
        return element;
      },
    });

    var instance = ReactTestUtils.renderIntoDocument(
      React.createElement(Wrapper)
    );

    expect(element._owner.getPublicInstance()).toBe(instance);
  });

  it('merges an additional argument onto the children prop', function() {
    spyOn(console, 'error');
    var a = 1;
    var element = React.createFactory(ComponentClass)({
      children: 'text',
    }, a);
    expect(element.props.children).toBe(a);
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('does not override children if no rest args are provided', function() {
    spyOn(console, 'error');
    var element = React.createFactory(ComponentClass)({
      children: 'text',
    });
    expect(element.props.children).toBe('text');
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('overrides children if null is provided as an argument', function() {
    spyOn(console, 'error');
    var element = React.createFactory(ComponentClass)({
      children: 'text',
    }, null);
    expect(element.props.children).toBe(null);
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('merges rest arguments onto the children prop in an array', function() {
    spyOn(console, 'error');
    var a = 1;
    var b = 2;
    var c = 3;
    var element = React.createFactory(ComponentClass)(null, a, b, c);
    expect(element.props.children).toEqual([1, 2, 3]);
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('allows static methods to be called using the type property', function() {
    spyOn(console, 'error');

    var StaticMethodComponentClass = React.createClass({
      statics: {
        someStaticMethod: function() {
          return 'someReturnValue';
        },
      },
      getInitialState: function() {
        return {valueToReturn: 'hi'};
      },
      render: function() {
        return React.createElement('div');
      },
    });

    var element = React.createElement(StaticMethodComponentClass);
    expect(element.type.someStaticMethod()).toBe('someReturnValue');
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('identifies valid elements', function() {
    var Component = React.createClass({
      render: function() {
        return React.createElement('div');
      },
    });

    expect(React.isValidElement(React.createElement('div')))
      .toEqual(true);
    expect(React.isValidElement(React.createElement(Component)))
      .toEqual(true);

    expect(React.isValidElement(null)).toEqual(false);
    expect(React.isValidElement(true)).toEqual(false);
    expect(React.isValidElement({})).toEqual(false);
    expect(React.isValidElement('string')).toEqual(false);
    expect(React.isValidElement(React.DOM.div)).toEqual(false);
    expect(React.isValidElement(Component)).toEqual(false);
    expect(React.isValidElement({ type: 'div', props: {} })).toEqual(false);

    var jsonElement = JSON.stringify(React.createElement('div'));
    expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true);
  });

  it('allows the use of PropTypes validators in statics', function() {
    // TODO: This test was added to cover a special case where we proxied
    // methods. However, we don't do that any more so this test can probably
    // be removed. Leaving it in classic as a safety precausion.
    var Component = React.createClass({
      render: () => null,
      statics: {
        specialType: React.PropTypes.shape({monkey: React.PropTypes.any}),
      },
    });

    expect(typeof Component.specialType).toBe('function');
    expect(typeof Component.specialType.isRequired).toBe('function');
  });

  it('is indistinguishable from a plain object', function() {
    var element = React.createElement('div', {className: 'foo'});
    var object = {};
    expect(element.constructor).toBe(object.constructor);
  });

  it('should use default prop value when removing a prop', function() {
    var Component = React.createClass({
      getDefaultProps: function() {
        return {fruit: 'persimmon'};
      },
      render: function() {
        return React.createElement('span');
      },
    });

    var container = document.createElement('div');
    var instance = ReactDOM.render(
      React.createElement(Component, {fruit: 'mango'}),
      container
    );
    expect(instance.props.fruit).toBe('mango');

    ReactDOM.render(React.createElement(Component), container);
    expect(instance.props.fruit).toBe('persimmon');
  });

  it('should normalize props with default values', function() {
    var Component = React.createClass({
      getDefaultProps: function() {
        return {prop: 'testKey'};
      },
      render: function() {
        return React.createElement('span', null, this.props.prop);
      },
    });

    var instance = ReactTestUtils.renderIntoDocument(
      React.createElement(Component)
    );
    expect(instance.props.prop).toBe('testKey');

    var inst2 = ReactTestUtils.renderIntoDocument(
      React.createElement(Component, {prop: null})
    );
    expect(inst2.props.prop).toBe(null);
  });

  it('throws when changing a prop (in dev) after element creation', function() {
    var Outer = React.createClass({
      render: function() {
        var el =
;

        expect(function() {
          el.props.className = 'quack';
        }).toThrow();
        expect(el.props.className).toBe('moo');

        return el;
      },
    });
    var outer = ReactTestUtils.renderIntoDocument(<Outer color="orange" />);
    expect(ReactDOM.findDOMNode(outer).className).toBe('moo');
  });

  it('throws when adding a prop (in dev) after element creation', function() {
    var container = document.createElement('div');
    var Outer = React.createClass({
      getDefaultProps: () => ({sound: 'meow'}),
      render: function() {
        var el =
{this.props.sound}
;

        expect(function() {
          el.props.className = 'quack';
        }).toThrow();

        expect(el.props.className).toBe(undefined);

        return el;
      },
    });
    var outer = ReactDOM.render(<Outer />, container);
    expect(ReactDOM.findDOMNode(outer).textContent).toBe('meow');
    expect(ReactDOM.findDOMNode(outer).className).toBe('');
  });

  it('does not warn for NaN props', function() {
    spyOn(console, 'error');
    var Test = React.createClass({
      render: function() {
        return
;
      },
    });
    var test = ReactTestUtils.renderIntoDocument(<Test value={+undefined} />);
    expect(test.props.value).toBeNaN();
    expect(console.error.argsForCall.length).toBe(0);
  });

  it('identifies elements, but not JSON, if Symbols are supported', function() {
    // Rudimentary polyfill
    // Once all jest engines support Symbols natively we can swap this to test
    // WITH native Symbols by default.
    var REACT_ELEMENT_TYPE = function() {}; // fake Symbol
    var OTHER_SYMBOL = function() {}; // another fake Symbol
    global.Symbol = function(name) {
      return OTHER_SYMBOL;
    };
    global.Symbol.for = function(key) {
      if (key === 'react.element') {
        return REACT_ELEMENT_TYPE;
      }
      return OTHER_SYMBOL;
    };

    require('mock-modules').dumpCache();

    React = require('React');

    var Component = React.createClass({
      render: function() {
        return React.createElement('div');
      },
    });

    expect(React.isValidElement(React.createElement('div')))
      .toEqual(true);
    expect(React.isValidElement(React.createElement(Component)))
      .toEqual(true);

    expect(React.isValidElement(null)).toEqual(false);
    expect(React.isValidElement(true)).toEqual(false);
    expect(React.isValidElement({})).toEqual(false);
    expect(React.isValidElement('string')).toEqual(false);
    expect(React.isValidElement(React.DOM.div)).toEqual(false);
    expect(React.isValidElement(Component)).toEqual(false);
    expect(React.isValidElement({ type: 'div', props: {} })).toEqual(false);

    var jsonElement = JSON.stringify(React.createElement('div'));
    expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false);
  });

});

describe('comparing jsx vs .createFactory() vs .createElement()', function() {
  var Child, mocks;

  beforeEach(function() {
    require('mock-modules').dumpCache();
    mocks = require('mocks');
    React = require('React');
    ReactDOM = require('ReactDOM');
    ReactTestUtils = require('ReactTestUtils');

    var metaData = mocks.getMetadata(React.createClass({
      render: function() {
        return React.createElement('div');
      },
    }));

    Child = mocks.generateFromMetadata(metaData);

  });

  describe('when using jsx only', function() {
    var Parent, instance;
    beforeEach(function() {
      Parent = React.createClass({
        render: function() {
          return (

              <Child ref="child" foo="foo value">children value</Child>

          );
        },
      });
      instance = ReactTestUtils.renderIntoDocument(<Parent/>);
    });

    it('should scry children but cannot', function() {
      var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child);
      expect(children.length).toBe(1);
    });

    it('does not maintain refs', function() {
      expect(instance.refs.child).not.toBeUndefined();
    });

    it('can capture Child instantiation calls', function() {
      expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' });
    });
  });

  describe('when using parent that uses .createFactory()', function() {
    var factory, instance;
    beforeEach(function() {
      var childFactory = React.createFactory(Child);
      var Parent = React.createClass({
        render: function() {
          return React.DOM.div({}, childFactory({ ref: 'child', foo: 'foo value' }, 'children value'));
        },
      });
      factory = React.createFactory(Parent);
      instance = ReactTestUtils.renderIntoDocument(factory());
    });

    it('can properly scry children', function() {
      var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child);
      expect(children.length).toBe(1);
    });

    it('does not maintain refs', function() {
      expect(instance.refs.child).not.toBeUndefined();
    });

    it('can capture Child instantiation calls', function() {
      expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' });
    });
  });

  describe('when using parent that uses .createElement()', function() {
    var factory, instance;
    beforeEach(function() {
      var Parent = React.createClass({
        render: function() {
          return React.DOM.div({}, React.createElement(Child, { ref: 'child', foo: 'foo value' }, 'children value'));
        },
      });
      factory = React.createFactory(Parent);
      instance = ReactTestUtils.renderIntoDocument(factory());
    });

    it('should scry children but cannot', function() {
      var children = ReactTestUtils.scryRenderedComponentsWithType(instance, Child);
      expect(children.length).toBe(1);
    });

    it('does not maintain refs', function() {
      expect(instance.refs.child).not.toBeUndefined();
    });

    it('can capture Child instantiation calls', function() {
      expect(Child.mock.calls[0][0]).toEqual({ foo: 'foo value', children: 'children value' });
    });
  });
});


text:
package freemarker.template.utility;

/**
 * Thrown when FreeMarker runs into a {@link Number} subclass that it doesn't yet support.
 */
public class UnsupportedNumberClassException extends RuntimeException {

    private final Class fClass;

    public UnsupportedNumberClassException(Class pClass) {
        super("Unsupported number class: " + pClass.getName());
        fClass = pClass;
    }

    public Class getUnsupportedClass() {
        return fClass;
    }

}


text:
package uk.org.nbn.nbnv.jpa.nbncore;

import java.util.Date;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
import uk.org.nbn.nbnv.jpa.nbncore.AccessRequestResponseType;
import uk.org.nbn.nbnv.jpa.nbncore.AccessRequestRole;
import uk.org.nbn.nbnv.jpa.nbncore.AccessRequestType;
import uk.org.nbn.nbnv.jpa.nbncore.Organisation;
import uk.org.nbn.nbnv.jpa.nbncore.TaxonObservationFilter;

@Generated(value="EclipseLink-2.3.0.v20110604-r9504", date="2012-11-05T12:01:58")
@StaticMetamodel(OrganisationAccessRequest.class)
public class OrganisationAccessRequest_ {

    public static volatile SingularAttribute<OrganisationAccessRequest, String> requestReason;
    public static volatile SingularAttribute<OrganisationAccessRequest, Date> responseDate;
    public static volatile SingularAttribute<OrganisationAccessRequest, Integer> filterID;
    public static volatile SingularAttribute<OrganisationAccessRequest, Organisation> organisation;
    public static volatile SingularAttribute<OrganisationAccessRequest, String> responseReason;
    public static volatile SingularAttribute<OrganisationAccessRequest, Date> requestDate;
    public static volatile SingularAttribute<OrganisationAccessRequest, Date> accessExpires;
    public static volatile SingularAttribute<OrganisationAccessRequest, AccessRequestRole> accessRequestRole;
    public static volatile SingularAttribute<OrganisationAccessRequest, AccessRequestResponseType> accessRequestResponseType;
    public static volatile SingularAttribute<OrganisationAccessRequest, TaxonObservationFilter> taxonObservationFilter;
    public static volatile SingularAttribute<OrganisationAccessRequest, AccessRequestType> accessRequestType;

}


text:
package org.apache.ivyde.eclipse.cp;

/**
 * This class is just a simple bean defining the properties which configure an IvyDE classpath
 * container.
 */
public class RetrieveSetup {

    private String retrievePattern = "lib/[type]s/[artifact]-[revision].[ext]";

    private boolean retrieveSync = false;

    private String retrieveConfs = "*";

    private String retrieveTypes = "*";

    /**
     * Default constructor
     */
    public RetrieveSetup() {
        // default constructor
    }

    public void set(RetrieveSetup setup) {
        this.retrievePattern = setup.retrievePattern;
        this.retrieveConfs = setup.retrieveConfs;
        this.retrieveTypes = setup.retrieveTypes;
    }

    public String getRetrievePattern() {
        return retrievePattern;
    }

    public void setRetrievePattern(String retrievePattern) {
        this.retrievePattern = retrievePattern;
    }

    public boolean isRetrieveSync() {
        return retrieveSync;
    }

    public void setRetrieveSync(boolean retrieveSync) {
        this.retrieveSync = retrieveSync;
    }

    public String getRetrieveConfs() {
        return retrieveConfs;
    }

    public void setRetrieveConfs(String retrieveConfs) {
        this.retrieveConfs = retrieveConfs;
    }

    public String getRetrieveTypes() {
        return retrieveTypes;
    }

    public void setRetrieveTypes(String retrieveTypes) {
        this.retrieveTypes = retrieveTypes;
    }

}


text:
package graphene.analytics;

import org.testng.annotations.Test;
import org.testng.AssertJUnit;

/**
 * Unit test for simple App.
 */
public class AppTest {
	/**
	 * Create the test case
	 *
	 * @param testName
	 *            name of the test case
	 */
	public AppTest(String testName) {
	}

	/**
	 * Rigourous Test :-)
	 */
	@Test
	public void testApp() {
		AssertJUnit.assertTrue(true);
	}
}


text:
package org.apache.felix.hc.core.impl.commands;

import java.util.List;

import org.apache.felix.hc.api.FormattingResultLog;
import org.apache.felix.hc.api.execution.HealthCheckExecutionOptions;
import org.apache.felix.hc.api.execution.HealthCheckExecutionResult;
import org.apache.felix.hc.api.execution.HealthCheckExecutor;
import org.apache.felix.hc.api.execution.HealthCheckSelector;
import org.apache.felix.hc.core.impl.CompositeResult;
import org.apache.felix.hc.core.impl.servlet.ResultTxtVerboseSerializer;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;

@Component(
        service = HealthCheckExecCommand.class,
        property = {
                "osgi.command.scope=hc",
                "osgi.command.function=exec"
        }
        )
public class HealthCheckExecCommand {

    @Reference
    HealthCheckExecutor healthCheckExecutor;

    @Reference
    ResultTxtVerboseSerializer resultTxtVerboseSerializer;

    public String exec(String... params) {

        boolean isDebug = false;
        boolean combineWithOr = true;
        boolean isName = false;
        HealthCheckSelector selector = HealthCheckSelector.empty();
        for (String param : params) {
            if(param.startsWith("-")) {
                if("-v".equals(param)) {
                    isDebug = true;
                } else if("-a".equals(param)) {
                    combineWithOr = false;
                } else if("-n".equals(param)) {
                    isName = true;
                } else if("-h".equals(param)) {
                    return getHelpText();
                } else {
                    System.out.println("unrecognized option: "+param);
                }
            } else {
                if(isName) {
                    selector = selector.withNames(param.split(","));
                } else {
                    selector = selector.withTags(param.split(","));
                }
            }
        }

        boolean defaultTagUsed = selector.tags() == null && selector.names() == null;

        HealthCheckExecutionOptions options = new HealthCheckExecutionOptions();
        options.setCombineTagsWithOr(combineWithOr);
        List<HealthCheckExecutionResult> executionResult = healthCheckExecutor.execute(selector, options);
        String result = resultTxtVerboseSerializer.serialize(new CompositeResult(new FormattingResultLog(), executionResult), executionResult, isDebug);
        return (defaultTagUsed ? "Configured default tag used for execution\n" : "") + result;
    }

    private String getHelpText() {
        return "Usage:\n  hc:exec [-v] [-a] [tag1,tag2] [-n \"Name 1,Name 2\"]\n  -v verbose/debug\n  -a combine tags with 'and' logic\n  -n name(s) to be executed";
    }
}


text:
package me.simple.entity;

public class Column implements java.io.Serializable {

    /**
     *
     */
    private static final long serialVersionUID = -1119967119225693951L;
    private String col_name;
    private String col_type;
    private String col_java_type;
    public String getCol_name() {
        return col_name;
    }
    public void setCol_name(String col_name) {
        this.col_name = col_name;
    }
    public String getCol_type() {
        return col_type;
    }
    public void setCol_type(String col_type) {
        this.col_type = col_type;
    }
    public Column() {
	super();
    }
    public Column(String col_name, String col_type,String col_java_type) {
	super();
	this.col_name = col_name;
	this.col_type = col_type;
	this.col_java_type = col_java_type;
    }
    public String getCol_java_type() {
	return col_java_type;
    }
    public void setCol_java_type(String col_java_type) {
	this.col_java_type = col_java_type;
    }

}


text:
 #include "Arduino.h"
#else
 #include "WProgram.h"
#endif
#include "Wire.h"

#ifndef A1
#define A1  1
#else
#warning "A1 is already defined. Use TA1 to address the right pin on the ATtiny."
#endif
#ifndef A2
#define A2  2
#else
#warning "A2 is already defined. Use TA2 to address the right pin on the ATtiny."
#endif
#ifndef A3
#define A3  3
#else
#warning "A3 is already defined. Use TA3 to address the right pin on the ATtiny."
#endif
#ifndef A4
#define A4  4
#else
#warning "A4 is already defined. Use TA4 to address the right pin on the ATtiny."
#endif
#ifndef A5
#define A5  5
#else
#warning "A5 is already defined. Use TA5 to address the right pin on the ATtiny."
#endif

#define TINY24_ADDR 0x10

#define TA1  1
#define TA2  2
#define TA3  3
#define TA4  4
#define TA5  5

#define LED_BUILTIN 14

class ATtinyExtender {
	private:
		void write8(uint8_t, uint8_t);
		uint8_t read8(uint8_t);
		uint16_t read16(uint8_t);
	public:
		ATtinyExtender(void);
		void begin(void);
		void pinMode(uint8_t, uint8_t);
		boolean digitalRead(uint8_t);
		void digitalWrite(uint8_t, boolean);
		uint16_t analogRead(uint8_t);
		void analogWrite(uint8_t, uint8_t);
		void analogReference(uint8_t);
};
extern ATtinyExtender Tiny;
#endif //TINY_H


text:
package wclayer

import (
	"bufio"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"syscall"

	"github.com/Microsoft/go-winio"
	"github.com/Microsoft/hcsshim/internal/longpath"
	"github.com/Microsoft/hcsshim/internal/safefile"
	"github.com/Microsoft/hcsshim/internal/winapi"
)

var errorIterationCanceled = errors.New("")

var mutatedUtilityVMFiles = map[string]bool{
	`EFI\Microsoft\Boot\BCD`:      true,
	`EFI\Microsoft\Boot\BCD.LOG`:  true,
	`EFI\Microsoft\Boot\BCD.LOG1`: true,
	`EFI\Microsoft\Boot\BCD.LOG2`: true,
}

const (
	filesPath          = `Files`
	hivesPath          = `Hives`
	utilityVMPath      = `UtilityVM`
	utilityVMFilesPath = `UtilityVM\Files`
)

func openFileOrDir(path string, mode uint32, createDisposition uint32) (file *os.File, err error) {
	return winio.OpenForBackup(path, mode, syscall.FILE_SHARE_READ, createDisposition)
}

func hasPathPrefix(p, prefix string) bool {
	return strings.HasPrefix(p, prefix) && len(p) > len(prefix) && p[len(prefix)] == '\\'
}

type fileEntry struct {
	path string
	fi   os.FileInfo
	err  error
}

type legacyLayerReader struct {
	root         string
	result       chan *fileEntry
	proceed      chan bool
	currentFile  *os.File
	backupReader *winio.BackupFileReader
}

// newLegacyLayerReader returns a new LayerReader that can read the Windows
// container layer transport format from disk.
func newLegacyLayerReader(root string) *legacyLayerReader {
	r := &legacyLayerReader{
		root:    root,
		result:  make(chan *fileEntry),
		proceed: make(chan bool),
	}
	go r.walk()
	return r
}

func readTombstones(path string) (map[string]([]string), error) {
	tf, err := os.Open(filepath.Join(path, "tombstones.txt"))
	if err != nil {
		return nil, err
	}
	defer tf.Close()
	s := bufio.NewScanner(tf)
	if !s.Scan() || s.Text() != "\xef\xbb\xbfVersion 1.0" {
		return nil, errors.New("invalid tombstones file")
	}

	ts := make(map[string]([]string))
	for s.Scan() {
		t := filepath.Join(filesPath, s.Text()[1:]) // skip leading `\`
		dir := filepath.Dir(t)
		ts[dir] = append(ts[dir], t)
	}
	if err = s.Err(); err != nil {
		return nil, err
	}

	return ts, nil
}

func (r *legacyLayerReader) walkUntilCancelled() error {
	root, err := longpath.LongAbs(r.root)
	if err != nil {
		return err
	}

	r.root = root
	ts, err := readTombstones(r.root)
	if err != nil {
		return err
	}

	err = filepath.Walk(r.root, func(path string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}

		// Indirect fix for https://github.com/moby/moby/issues/32838#issuecomment-343610048.
		// Handle failure from what may be a golang bug in the conversion of
		// UTF16 to UTF8 in files which are left in the recycle bin. Os.Lstat
		// which is called by filepath.Walk will fail when a filename contains
		// unicode characters. Skip the recycle bin regardless which is goodness.
		if strings.EqualFold(path, filepath.Join(r.root, `Files\$Recycle.Bin`)) && info.IsDir() {
			return filepath.SkipDir
		}

		if path == r.root || path == filepath.Join(r.root, "tombstones.txt") || strings.HasSuffix(path, ".$wcidirs$") {
			return nil
		}

		r.result <- &fileEntry{path, info, nil}
		if !<-r.proceed {
			return errorIterationCanceled
		}

		// List all the tombstones.
		if info.IsDir() {
			relPath, err := filepath.Rel(r.root, path)
			if err != nil {
				return err
			}
			if dts, ok := ts[relPath]; ok {
				for _, t := range dts {
					r.result <- &fileEntry{filepath.Join(r.root, t), nil, nil}
					if !<-r.proceed {
						return errorIterationCanceled
					}
				}
			}
		}
		return nil
	})
	if err == errorIterationCanceled {
		return nil
	}
	if err == nil {
		return io.EOF
	}
	return err
}

func (r *legacyLayerReader) walk() {
	defer close(r.result)
	if !<-r.proceed {
		return
	}

	err := r.walkUntilCancelled()
	if err != nil {
		for {
			r.result <- &fileEntry{err: err}
			if !<-r.proceed {
				return
			}
		}
	}
}

func (r *legacyLayerReader) reset() {
	if r.backupReader != nil {
		r.backupReader.Close()
		r.backupReader = nil
	}
	if r.currentFile != nil {
		r.currentFile.Close()
		r.currentFile = nil
	}
}

func findBackupStreamSize(r io.Reader) (int64, error) {
	br := winio.NewBackupStreamReader(r)
	for {
		hdr, err := br.Next()
		if err != nil {
			if err == io.EOF {
				err = nil
			}
			return 0, err
		}
		if hdr.Id == winio.BackupData {
			return hdr.Size, nil
		}
	}
}

func (r *legacyLayerReader) Next() (path string, size int64, fileInfo *winio.FileBasicInfo, err error) {
	r.reset()
	r.proceed <- true
	fe := <-r.result
	if fe == nil {
		err = errors.New("LegacyLayerReader closed")
		return
	}
	if fe.err != nil {
		err = fe.err
		return
	}

	path, err = filepath.Rel(r.root, fe.path)
	if err != nil {
		return
	}

	if fe.fi == nil {
		// This is a tombstone. Return a nil fileInfo.
		return
	}

	if fe.fi.IsDir() && hasPathPrefix(path, filesPath) {
		fe.path += ".$wcidirs$"
	}

	f, err := openFileOrDir(fe.path, syscall.GENERIC_READ, syscall.OPEN_EXISTING)
	if err != nil {
		return
	}
	defer func() {
		if f != nil {
			f.Close()
		}
	}()

	fileInfo, err = winio.GetFileBasicInfo(f)
	if err != nil {
		return
	}

	if !hasPathPrefix(path, filesPath) {
		size = fe.fi.Size()
		r.backupReader = winio.NewBackupFileReader(f, false)
		if path == hivesPath || path == filesPath {
			// The Hives directory has a non-deterministic file time because of the
			// nature of the import process. Use the times from System_Delta.
			var g *os.File
			g, err = os.Open(filepath.Join(r.root, hivesPath, `System_Delta`))
			if err != nil {
				return
			}
			attr := fileInfo.FileAttributes
			fileInfo, err = winio.GetFileBasicInfo(g)
			g.Close()
			if err != nil {
				return
			}
			fileInfo.FileAttributes = attr
		}

		// The creation time and access time get reset for files outside of the Files path.
		fileInfo.CreationTime = fileInfo.LastWriteTime
		fileInfo.LastAccessTime = fileInfo.LastWriteTime

	} else {
		// The file attributes are written before the backup stream.
		var attr uint32
		err = binary.Read(f, binary.LittleEndian, &attr)
		if err != nil {
			return
		}
		fileInfo.FileAttributes = attr
		beginning := int64(4)

		// Find the accurate file size.
		if !fe.fi.IsDir() {
			size, err = findBackupStreamSize(f)
			if err != nil {
				err = &os.PathError{Op: "findBackupStreamSize", Path: fe.path, Err: err}
				return
			}
		}

		// Return back to the beginning of the backup stream.
		_, err = f.Seek(beginning, 0)
		if err != nil {
			return
		}
	}

	r.currentFile = f
	f = nil
	return
}

func (r *legacyLayerReader) Read(b []byte) (int, error) {
	if r.backupReader == nil {
		if r.currentFile == nil {
			return 0, io.EOF
		}
		return r.currentFile.Read(b)
	}
	return r.backupReader.Read(b)
}

func (r *legacyLayerReader) Seek(offset int64, whence int) (int64, error) {
	if r.backupReader == nil {
		if r.currentFile == nil {
			return 0, errors.New("no current file")
		}
		return r.currentFile.Seek(offset, whence)
	}
	return 0, errors.New("seek not supported on this stream")
}

func (r *legacyLayerReader) Close() error {
	r.proceed <- false
	<-r.result
	r.reset()
	return nil
}

type pendingLink struct {
	Path, Target string
	TargetRoot   *os.File
}

type pendingDir struct {
	Path string
	Root *os.File
}

type legacyLayerWriter struct {
	root            *os.File
	destRoot        *os.File
	parentRoots     []*os.File
	currentFile     *os.File
	bufWriter       *bufio.Writer
	currentFileName string
	currentFileRoot *os.File
	backupWriter    *winio.BackupFileWriter
	Tombstones      []string
	HasUtilityVM    bool
	changedDi       []dirInfo
	addedFiles      map[string]bool
	PendingLinks    []pendingLink
	pendingDirs     []pendingDir
	currentIsDir    bool
}

// newLegacyLayerWriter returns a LayerWriter that can write the contaler layer
// transport format to disk.
func newLegacyLayerWriter(root string, parentRoots []string, destRoot string) (w *legacyLayerWriter, err error) {
	w = &legacyLayerWriter{
		addedFiles: make(map[string]bool),
	}
	defer func() {
		if err != nil {
			w.CloseRoots()
			w = nil
		}
	}()
	w.root, err = safefile.OpenRoot(root)
	if err != nil {
		return
	}
	w.destRoot, err = safefile.OpenRoot(destRoot)
	if err != nil {
		return
	}
	for _, r := range parentRoots {
		f, err := safefile.OpenRoot(r)
		if err != nil {
			return w, err
		}
		w.parentRoots = append(w.parentRoots, f)
	}
	w.bufWriter = bufio.NewWriterSize(ioutil.Discard, 65536)
	return
}

func (w *legacyLayerWriter) CloseRoots() {
	if w.root != nil {
		w.root.Close()
		w.root = nil
	}
	if w.destRoot != nil {
		w.destRoot.Close()
		w.destRoot = nil
	}
	for i := range w.parentRoots {
		_ = w.parentRoots[i].Close()
	}
	w.parentRoots = nil
}

func (w *legacyLayerWriter) initUtilityVM() error {
	if !w.HasUtilityVM {
		err := safefile.MkdirRelative(utilityVMPath, w.destRoot)
		if err != nil {
			return err
		}
		// Server 2016 does not support multiple layers for the utility VM, so
		// clone the utility VM from the parent layer into this layer. Use hard
		// links to avoid unnecessary copying, since most of the files are
		// immutable.
		err = cloneTree(w.parentRoots[0], w.destRoot, utilityVMFilesPath, mutatedUtilityVMFiles)
		if err != nil {
			return fmt.Errorf("cloning the parent utility VM image failed: %s", err)
		}
		w.HasUtilityVM = true
	}
	return nil
}

func (w *legacyLayerWriter) reset() error {
	err := w.bufWriter.Flush()
	if err != nil {
		return err
	}
	w.bufWriter.Reset(ioutil.Discard)
	if w.currentIsDir {
		r := w.currentFile
		br := winio.NewBackupStreamReader(r)
		// Seek to the beginning of the backup stream, skipping the fileattrs
		if _, err := r.Seek(4, io.SeekStart); err != nil {
			return err
		}

		for {
			bhdr, err := br.Next()
			if err == io.EOF {
				// end of backupstream data
				break
			}
			if err != nil {
				return err
			}
			switch bhdr.Id {
			case winio.BackupReparseData:
				// The current file is a `.$wcidirs$` metadata file that
				// describes a directory reparse point. Delete the placeholder
				// directory to prevent future files being added into the
				// destination of the reparse point during the ImportLayer call
				if err := safefile.RemoveRelative(w.currentFileName, w.currentFileRoot); err != nil {
					return err
				}
				w.pendingDirs = append(w.pendingDirs, pendingDir{Path: w.currentFileName, Root: w.currentFileRoot})
			default:
				// ignore all other stream types, as we only care about directory reparse points
			}
		}
		w.currentIsDir = false
	}
	if w.backupWriter != nil {
		w.backupWriter.Close()
		w.backupWriter = nil
	}
	if w.currentFile != nil {
		w.currentFile.Close()
		w.currentFile = nil
		w.currentFileName = ""
		w.currentFileRoot = nil
	}
	return nil
}

// copyFileWithMetadata copies a file using the backup/restore APIs in order to preserve metadata
func copyFileWithMetadata(srcRoot, destRoot *os.File, subPath string, isDir bool) (fileInfo *winio.FileBasicInfo, err error) {
	src, err := safefile.OpenRelative(
		subPath,
		srcRoot,
		syscall.GENERIC_READ|winio.ACCESS_SYSTEM_SECURITY,
		syscall.FILE_SHARE_READ,
		winapi.FILE_OPEN,
		winapi.FILE_OPEN_REPARSE_POINT)
	if err != nil {
		return nil, err
	}
	defer src.Close()
	srcr := winio.NewBackupFileReader(src, true)
	defer srcr.Close()

	fileInfo, err = winio.GetFileBasicInfo(src)
	if err != nil {
		return nil, err
	}

	extraFlags := uint32(0)
	if isDir {
		extraFlags |= winapi.FILE_DIRECTORY_FILE
	}
	dest, err := safefile.OpenRelative(
		subPath,
		destRoot,
		syscall.GENERIC_READ|syscall.GENERIC_WRITE|winio.WRITE_DAC|winio.WRITE_OWNER|winio.ACCESS_SYSTEM_SECURITY,
		syscall.FILE_SHARE_READ,
		winapi.FILE_CREATE,
		extraFlags)
	if err != nil {
		return nil, err
	}
	defer dest.Close()

	err = winio.SetFileBasicInfo(dest, fileInfo)
	if err != nil {
		return nil, err
	}

	destw := winio.NewBackupFileWriter(dest, true)
	defer func() {
		cerr := destw.Close()
		if err == nil {
			err = cerr
		}
	}()

	_, err = io.Copy(destw, srcr)
	if err != nil {
		return nil, err
	}

	return fileInfo, nil
}

// cloneTree clones a directory tree using hard links. It skips hard links for
// the file names in the provided map and just copies those files.
func cloneTree(srcRoot *os.File, destRoot *os.File, subPath string, mutatedFiles map[string]bool) error {
	var di []dirInfo
	err := safefile.EnsureNotReparsePointRelative(subPath, srcRoot)
	if err != nil {
		return err
	}
	err = filepath.Walk(filepath.Join(srcRoot.Name(), subPath), func(srcFilePath string, info os.FileInfo, err error) error {
		if err != nil {
			return err
		}

		relPath, err := filepath.Rel(srcRoot.Name(), srcFilePath)
		if err != nil {
			return err
		}

		fileAttributes := info.Sys().(*syscall.Win32FileAttributeData).FileAttributes
		// Directories, reparse points, and files that will be mutated during
		// utility VM import must be copied. All other files can be hard linked.
		isReparsePoint := fileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0
		// In go1.9, FileInfo.IsDir() returns false if the directory is also a symlink.
		// See: https://github.com/golang/go/commit/1989921aef60c83e6f9127a8448fb5ede10e9acc
		// Fixes the problem by checking syscall.FILE_ATTRIBUTE_DIRECTORY directly
		isDir := fileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY != 0

		if isDir || isReparsePoint || mutatedFiles[relPath] {
			fi, err := copyFileWithMetadata(srcRoot, destRoot, relPath, isDir)
			if err != nil {
				return err
			}
			if isDir {
				di = append(di, dirInfo{path: relPath, fileInfo: *fi})
			}
		} else {
			err = safefile.LinkRelative(relPath, srcRoot, relPath, destRoot)
			if err != nil {
				return err
			}
		}

		return nil
	})
	if err != nil {
		return err
	}

	return reapplyDirectoryTimes(destRoot, di)
}

func (w *legacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) error {
	if err := w.reset(); err != nil {
		return err
	}

	if name == utilityVMPath {
		return w.initUtilityVM()
	}

	if (fileInfo.FileAttributes & syscall.FILE_ATTRIBUTE_DIRECTORY) != 0 {
		w.changedDi = append(w.changedDi, dirInfo{path: name, fileInfo: *fileInfo})
	}

	name = filepath.Clean(name)
	if hasPathPrefix(name, utilityVMPath) {
		if !w.HasUtilityVM {
			return errors.New("missing UtilityVM directory")
		}
		if !hasPathPrefix(name, utilityVMFilesPath) && name != utilityVMFilesPath {
			return errors.New("invalid UtilityVM layer")
		}
		createDisposition := uint32(winapi.FILE_OPEN)
		if (fileInfo.FileAttributes & syscall.FILE_ATTRIBUTE_DIRECTORY) != 0 {
			st, err := safefile.LstatRelative(name, w.destRoot)
			if err != nil && !os.IsNotExist(err) {
				return err
			}
			if st != nil {
				// Delete the existing file/directory if it is not the same type as this directory.
				existingAttr := st.Sys().(*syscall.Win32FileAttributeData).FileAttributes
				if (uint32(fileInfo.FileAttributes)^existingAttr)&(syscall.FILE_ATTRIBUTE_DIRECTORY|syscall.FILE_ATTRIBUTE_REPARSE_POINT) != 0 {
					if err = safefile.RemoveAllRelative(name, w.destRoot); err != nil {
						return err
					}
					st = nil
				}
			}
			if st == nil {
				if err = safefile.MkdirRelative(name, w.destRoot); err != nil {
					return err
				}
			}
		} else {
			// Overwrite any existing hard link.
			err := safefile.RemoveRelative(name, w.destRoot)
			if err != nil && !os.IsNotExist(err) {
				return err
			}
			createDisposition = winapi.FILE_CREATE
		}

		f, err := safefile.OpenRelative(
			name,
			w.destRoot,
			syscall.GENERIC_READ|syscall.GENERIC_WRITE|winio.WRITE_DAC|winio.WRITE_OWNER|winio.ACCESS_SYSTEM_SECURITY,
			syscall.FILE_SHARE_READ,
			createDisposition,
			winapi.FILE_OPEN_REPARSE_POINT,
		)
		if err != nil {
			return err
		}
		defer func() {
			if f != nil {
				f.Close()
				_ = safefile.RemoveRelative(name, w.destRoot)
			}
		}()

		err = winio.SetFileBasicInfo(f, fileInfo)
		if err != nil {
			return err
		}

		w.backupWriter = winio.NewBackupFileWriter(f, true)
		w.bufWriter.Reset(w.backupWriter)
		w.currentFile = f
		w.currentFileName = name
		w.currentFileRoot = w.destRoot
		w.addedFiles[name] = true
		f = nil
		return nil
	}

	fname := name
	if (fileInfo.FileAttributes & syscall.FILE_ATTRIBUTE_DIRECTORY) != 0 {
		err := safefile.MkdirRelative(name, w.root)
		if err != nil {
			return err
		}
		fname += ".$wcidirs$"
		w.currentIsDir = true
	}

	f, err := safefile.OpenRelative(fname, w.root, syscall.GENERIC_READ|syscall.GENERIC_WRITE, syscall.FILE_SHARE_READ, winapi.FILE_CREATE, 0)
	if err != nil {
		return err
	}
	defer func() {
		if f != nil {
			f.Close()
			_ = safefile.RemoveRelative(fname, w.root)
		}
	}()

	strippedFi := *fileInfo
	strippedFi.FileAttributes = 0
	err = winio.SetFileBasicInfo(f, &strippedFi)
	if err != nil {
		return err
	}

	if hasPathPrefix(name, hivesPath) {
		w.backupWriter = winio.NewBackupFileWriter(f, false)
		w.bufWriter.Reset(w.backupWriter)
	} else {
		w.bufWriter.Reset(f)
		// The file attributes are written before the stream.
		err = binary.Write(w.bufWriter, binary.LittleEndian, uint32(fileInfo.FileAttributes))
		if err != nil {
			w.bufWriter.Reset(ioutil.Discard)
			return err
		}
	}

	w.currentFile = f
	w.currentFileName = name
	w.currentFileRoot = w.root
	w.addedFiles[name] = true
	f = nil
	return nil
}

func (w *legacyLayerWriter) AddLink(name string, target string) error {
	if err := w.reset(); err != nil {
		return err
	}

	target = filepath.Clean(target)
	var roots []*os.File
	if hasPathPrefix(target, filesPath) {
		// Look for cross-layer hard link targets in the parent layers, since
		// nothing is in the destination path yet.
		roots = w.parentRoots
	} else if hasPathPrefix(target, utilityVMFilesPath) {
		// Since the utility VM is fully cloned into the destination path
		// already, look for cross-layer hard link targets directly in the
		// destination path.
		roots = []*os.File{w.destRoot}
	}

	if roots == nil || (!hasPathPrefix(name, filesPath) && !hasPathPrefix(name, utilityVMFilesPath)) {
		return errors.New("invalid hard link in layer")
	}

	// Find to try the target of the link in a previously added file. If that
	// fails, search in parent layers.
	var selectedRoot *os.File
	if _, ok := w.addedFiles[target]; ok {
		selectedRoot = w.destRoot
	} else {
		for _, r := range roots {
			if _, err := safefile.LstatRelative(target, r); err != nil {
				if !os.IsNotExist(err) {
					return err
				}
			} else {
				selectedRoot = r
				break
			}
		}
		if selectedRoot == nil {
			return fmt.Errorf("failed to find link target for '%s' -> '%s'", name, target)
		}
	}

	// The link can't be written until after the ImportLayer call.
	w.PendingLinks = append(w.PendingLinks, pendingLink{
		Path:       name,
		Target:     target,
		TargetRoot: selectedRoot,
	})
	w.addedFiles[name] = true
	return nil
}

func (w *legacyLayerWriter) Remove(name string) error {
	name = filepath.Clean(name)
	if hasPathPrefix(name, filesPath) {
		w.Tombstones = append(w.Tombstones, name)
	} else if hasPathPrefix(name, utilityVMFilesPath) {
		err := w.initUtilityVM()
		if err != nil {
			return err
		}
		// Make sure the path exists; os.RemoveAll will not fail if the file is
		// already gone, and this needs to be a fatal error for diagnostics
		// purposes.
		if _, err := safefile.LstatRelative(name, w.destRoot); err != nil {
			return err
		}
		err = safefile.RemoveAllRelative(name, w.destRoot)
		if err != nil {
			return err
		}
	} else {
		return fmt.Errorf("invalid tombstone %s", name)
	}

	return nil
}

func (w *legacyLayerWriter) Write(b []byte) (int, error) {
	if w.backupWriter == nil && w.currentFile == nil {
		return 0, errors.New("closed")
	}
	return w.bufWriter.Write(b)
}

func (w *legacyLayerWriter) Close() error {
	if err := w.reset(); err != nil {
		return err
	}
	if err := safefile.RemoveRelative("tombstones.txt", w.root); err != nil && !os.IsNotExist(err) {
		return err
	}
	for _, pd := range w.pendingDirs {
		err := safefile.MkdirRelative(pd.Path, pd.Root)
		if err != nil {
			return err
		}
	}
	return nil
}


text:
<?php

class Concept extends CI_Model {

    // concept data
    var $conceptID;
    var $GBID;
    var $GBLink;
    var $name;
    var $image;
    var $imageSmall;
    var $deck;

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

    // is concept in database?
    function isConceptInDB($GBID)
    {
        $query = $this->db->get_where('concepts', array('GBID' => $GBID));

        return $query->num_rows() > 0 ? true : false;
    }

    // get ConceptID from GBID
    function getConceptByGBID($GBID)
    {
        $query = $this->db->get_where('concepts', array('GBID' => $GBID));

        if($query->num_rows() == 1)
        {
            return $query->first_row();
        }

        return null;
    }

    // returns concept if in db, or adds and returns it if it isn't
    function getOrAddConcept($gbConcept)
    {
        // get concept from db
        $concept = $this->getConceptByGBID($gbConcept->id);

        // if concept isn't in db
        if($concept == null)
        {
            // concept was not found, get from Giant Bomb
            $this->load->model('GiantBomb');
            $result = $this->GiantBomb->getMeta($gbConcept->id, "concept");

            // if concept was returned
            if ($result != null && $result->error == "OK" && $result->number_of_total_results > 0) {
                // add cconcept to database
                $this->addConcept($result->results);

            } else {
                // concept was not found
                return false;
            }

            // get concept from db
            $concept = $this->getConceptByGBID($gbConcept->id);
        }

        return $concept;
    }

    // add concept to database
    function addConcept($concept)
    {
        $data = array(
           'GBID' => $concept->id,
           'Name' => $concept->name,
           'API_Detail' => $concept->api_detail_url,
            'GBLink' => $concept->site_detail_url,
           'Image' => is_object($concept->image) ? $concept->image->small_url : null,
           'ImageSmall' => is_object($concept->image) ? $concept->image->icon_url : null,
           'Deck' => $concept->deck
        );

        return $this->db->insert('concepts', $data);
    }

    // get concept by GBID
    public function getConcepts($GBID, $userID)
    {
        // check if concept is in database
        if ($this->isConceptInDB($GBID)) {
            // get concept from database
            if ($this->getConceptFromDatabase($GBID, $userID)) {
                // concept found
                return true;
            }
        }

        // concept was not found, get from Giant Bomb
        $this->load->model('GiantBomb');
        $result = $this->GiantBomb->getMeta($GBID, "concept");

        // if concept was returned
        if ($result != null && $result->error == "OK" && $result->number_of_total_results > 0) {
            // add concept to database
            $this->addConcept($result->results);

            // get concept from database
            return $this->getConceptFromDatabase($GBID, $userID);
        } else {
            // concept was not found
            return false;
        }
    }

    // get concept from database
    public function getConceptFromDatabase($GBID, $userID)
    {
        // get concept from db
        $this->db->select('concepts.ConceptID, concepts.GBID, concepts.GBLink, concepts.Name, concepts.Image, concepts.ImageSmall, concepts.Deck');
        $this->db->from('concepts');

        if ($userID == null) {
            $userID = 0; // prevents joining on UserID causing an error
        }

        // $this->db->join('collections', 'collections.ConceptID = concepts.ConceptID AND collections.UserID = ' . $userID, 'left');
        // $this->db->join('lists', 'collections.ListID = lists.ListID', 'left');

        $this->db->where('concepts.GBID', $GBID);
        $query = $this->db->get();

        // if concept returned
        if ($query->num_rows() == 1) {
            $result = $query->first_row();

            $this->conceptID = $result->ConceptID;
            $this->GBID = $result->GBID;
            $this->GBLink = $result->GBLink;
            $this->name = $result->Name;
            $this->image = $result->Image;
            $this->imageSmall = $result->ImageSmall;
            $this->deck = $result->Deck;

            return true;
        }

        return false;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" ?>
<dt-example table-type="html" order="5">

<css lib="datatables colreorder" />
<js lib="jquery datatables colreorder">
<![CDATA[

$(document).ready(function() {
	$('#example').dataTable( {
		colReorder: true,
		stateSave:  true
	} );
} );

]]>
</js>

<title lib="ColReorder">State saving</title>

<info><![CDATA[

A useful interaction pattern to use in DataTables is state saving, so when the end user reloads or revisits a page its previous state is retained. ColReorder works seamlessly with state saving in DataTables (`dt-init stateSave`), remembering and restoring the column positions, as well as everything else such as sorting and filtering.

]]></info>

</dt-example>


text:
global _start

; This binary is there to test
; emulate vs nearpc/u/pdisas commands
; The emulate should show just jump and one nop
; The rest should show jump and two nops
;
; Motivated by https://github.com/pwndbg/pwndbg/issues/315

_start:
jmp label
nop
label:
nop


text:
package ruolan.com.myhearts.ui.left;

import ruolan.com.myhearts.R;
import ruolan.com.myhearts.ui.base.BaseActivity;

public class FollowActivity extends BaseActivity {

    @Override
    protected int getResultId() {
        return R.layout.activity_follow;
    }

    @Override
    protected void initListener() {

    }

    @Override
    public void initView() {

    }
}


text:
#ifndef __SamplePlugin_H__
#define __SamplePlugin_H__

#include "OgrePlugin.h"
#include "Sample.h"

// Export macro to export the sample's main dll functions.
#if defined( OGRE_STATIC_LIB )
#  define _OgreSampleExport
#  define _OgreSampleClassExport
#else
#  if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(__MINGW32__)
#    define _OgreSampleExport __declspec(dllexport)
#    define _OgreSampleClassExport
#  elif defined ( OGRE_GCC_VISIBILITY )
#   define _OgreSampleExport  __attribute__ ((visibility("default")))
#   define _OgreSampleClassExport  __attribute__ ((visibility("default")))
#  else
#	define _OgreSampleExport
#	define _OgreSampleClassExport
#  endif
#endif

namespace OgreBites
{
	/*=============================================================================
	| Utility class used to hold a set of samples in an OGRE plugin.
	=============================================================================*/
	class _OgreSampleClassExport SamplePlugin : public Ogre::Plugin
    {
    public:

		SamplePlugin(const Ogre::String& name)
		: mName(name)
		{
		}

		const Ogre::String& getName() const
		{
			return mName;
		}

		void install() {}
		void uninstall() {}
		void initialise() {}
		void shutdown() {}

		/*-----------------------------------------------------------------------------
		| Adds a sample to the queue.
		-----------------------------------------------------------------------------*/
		void addSample(Sample* s)
		{
			mSamples.insert(s);
		}

		/*-----------------------------------------------------------------------------
		| Retrieves the queue of samples.
		-----------------------------------------------------------------------------*/
		const SampleSet& getSamples()
		{
			return mSamples;
		}

	protected:

		Ogre::String mName;
		SampleSet mSamples;
    };
}

#endif


text:
package com.mobilyzer.util;

import com.google.myjson.FieldNamingPolicy;
import com.google.myjson.Gson;
import com.google.myjson.GsonBuilder;
import com.google.myjson.JsonDeserializationContext;
import com.google.myjson.JsonDeserializer;
import com.google.myjson.JsonElement;
import com.google.myjson.JsonParseException;
import com.google.myjson.JsonPrimitive;
import com.google.myjson.JsonSerializationContext;
import com.google.myjson.JsonSerializer;

import com.mobilyzer.MeasurementDesc;
import com.mobilyzer.MeasurementTask;

import android.content.Context;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

/**
 * Utility class that use the gson library to provide bidirectional conversion
 * between measurement objects (descriptions, tasks, and results, etc.) and
 * JSON objects. New types of MeasurementDesc should be registered in the static
 * HashMap initialization section.
 */
@SuppressWarnings("rawtypes")
public class MeasurementJsonConvertor {
  /* 1. Automatically perform bidirectional translations for fields in java
   *  'lowerCaseCamel' style
   * to JSON 'lower_case_with_underscores' style.
   * 2. Serialize and de-serialize UTC format date string
   * 3. It also serializes all null fields to 'null'
   */
  public static Gson gson = new GsonBuilder().serializeNulls().
      registerTypeAdapter(Date.class, new DateTypeConverter()).
      setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
  private static final DateFormat dateFormat =
      new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");

  static {
    dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  }

  public static MeasurementTask makeMeasurementTaskFromJson(
      JSONObject json) throws IllegalArgumentException {
    try {
      String type = String.valueOf(json.getString("type"));
      Class taskClass = MeasurementTask.getTaskClassForMeasurement(type);
      Method getDescMethod = taskClass.getMethod("getDescClass");
      // The getDescClassForMeasurement() is static and takes no arguments
      Class descClass = (Class) getDescMethod.invoke(null, (Object[]) null);
      MeasurementDesc measurementDesc =
          (MeasurementDesc) gson.fromJson(json.toString(), descClass);

      Object cstParam = measurementDesc;
      Constructor<MeasurementTask> constructor =
          taskClass.getConstructor(MeasurementDesc.class);
      return constructor.newInstance(cstParam);
    } catch (JSONException e) {
      throw new IllegalArgumentException(e);
    } catch (SecurityException e) {
      Logger.w(e.getMessage());
      throw new IllegalArgumentException(e);
    } catch (NoSuchMethodException e) {
      Logger.w(e.getMessage());
      throw new IllegalArgumentException(e);
    } catch (IllegalArgumentException e) {
      Logger.w(e.getMessage());
      throw new IllegalArgumentException(e);
    } catch (InstantiationException e) {
      Logger.w(e.getMessage());
      throw new IllegalArgumentException(e);
    } catch (IllegalAccessException e) {
      Logger.w(e.getMessage());
      throw new IllegalArgumentException(e);
    } catch (InvocationTargetException e) {
      Logger.w(e.toString());
      throw new IllegalArgumentException(e);
    }
  }

  public static JSONObject encodeToJson(Object obj) throws JSONException {
    String str = gson.toJson(obj);
    return new JSONObject(str);
  }

  public static String toJsonString(Object obj) {
    return gson.toJson(obj);
  }

  public static Gson getGsonInstance() {
    return gson;
  }

  private static class DateTypeConverter
      implements JsonSerializer<Date>, JsonDeserializer<Date> {
    @Override
    public JsonElement serialize(Date src, Type srcType,
        JsonSerializationContext context) {
      return new JsonPrimitive(formatDate(src));
    }

    @Override
    public Date deserialize(JsonElement json, Type type,
        JsonDeserializationContext context) throws JsonParseException {
      try {
        return parseDate(json.getAsString());
      } catch (NumberFormatException e) {
        throw new JsonParseException("Cannot convert time string: " +
            json.toString());
      } catch (IllegalArgumentException e) {
        Logger.e("Cannot convert time string:" + json.toString());
        throw new JsonParseException("Cannot convert time string: " +
            json.toString());
      } catch (ParseException e) {
        throw new JsonParseException("Cannot convert UTC time string: "  +
            json.toString());
      }
    }
  }

  private static Date parseDate(String dateString) throws ParseException {
    return dateFormat.parse(dateString);
  }

  private static String formatDate(Date date) {
    return dateFormat.format(date);
  }
}


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

<TITLE>
NetmeraPrivacy
</TITLE>

<META NAME="date" CONTENT="2013-10-05">

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

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD

DETAIL: ENUM CONSTANTS | FIELD | METHOD

com.netmera.mobile.util

Enum NetmeraPrivacy

java.lang.Object
  java.lang.Enum<NetmeraPrivacy>
      com.netmera.mobile.util.NetmeraPrivacy

All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<NetmeraPrivacy>

public enum NetmeraPrivacy
extends java.lang.Enum<NetmeraPrivacy>

Netmera privacy variables for Netmera content.

Enum Constant Summary

PRIVATE

          Private privacy, just the owner of the content and application admin can
 get, delete, update content with private privacy.

PUBLIC

          Public privacy, everyone can get, delete, update content with public
 privacy.

Method Summary

static NetmeraPrivacy
valueOf(java.lang.String name)

          Returns the enum constant of this type with the specified name.

static NetmeraPrivacy[]
values()

          Returns an array containing the constants of this enum type, in
the order they are declared.

Methods inherited from class java.lang.Enum

compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Enum Constant Detail

PUBLIC

public static final NetmeraPrivacy PUBLIC

Public privacy, everyone can get, delete, update content with public
 privacy.

PRIVATE

public static final NetmeraPrivacy PRIVATE

Private privacy, just the owner of the content and application admin can
 get, delete, update content with private privacy.

Method Detail

values

public static NetmeraPrivacy[] values()

Returns an array containing the constants of this enum type, in
the order they are declared.  This method may be used to iterate
over the constants as follows:

for (NetmeraPrivacy c : NetmeraPrivacy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in
the order they are declared

valueOf

public static NetmeraPrivacy valueOf(java.lang.String name)

Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type.  (Extraneous whitespace characters are
not permitted.)

Parameters:
name - the name of the enum constant to be returned.

Returns:
the enum constant with the specified name

Throws:

java.lang.IllegalArgumentException - if this enum type has no constant
with the specified name

java.lang.NullPointerException - if the argument is null

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD

DETAIL: ENUM CONSTANTS | FIELD | METHOD


text:
package org.edx.mobile.util.images;

import android.content.Context;
import android.support.annotation.NonNull;

import org.edx.mobile.R;
import org.edx.mobile.http.HttpResponseStatusException;
import org.edx.mobile.http.HttpStatus;
import org.edx.mobile.logger.Logger;
import org.edx.mobile.util.NetworkUtil;

import java.io.IOException;

public enum ErrorUtils {
    ;

    protected static final Logger logger = new Logger(ErrorUtils.class.getName());

    @NonNull
    public static String getErrorMessage(@NonNull Throwable ex, @NonNull Context context) {
        String errorMessage = null;
        if (ex instanceof IOException) {
            if (NetworkUtil.isConnected(context)) {
                errorMessage = context.getString(R.string.network_connected_error);
            } else {
                errorMessage = context.getString(R.string.reset_no_network_message);
            }
        } else if (ex instanceof HttpResponseStatusException) {
            final int status = ((HttpResponseStatusException) ex).getStatusCode();
            switch (status) {
                case HttpStatus.SERVICE_UNAVAILABLE:
                    errorMessage = context.getString(R.string.network_service_unavailable);
                    break;
                case HttpStatus.NOT_FOUND:
                case HttpStatus.INTERNAL_SERVER_ERROR:
                    errorMessage = context.getString(R.string.action_not_completed);
                    break;
            }
        }
        if (null == errorMessage) {
            logger.error(ex, true /* Submit crash report since this is an unknown type of error */);
            errorMessage = context.getString(R.string.error_unknown);
        }
        return errorMessage;
    }
}


text:
<?php

namespace PHPExiftool\Driver\Tag\Vorbis;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class Organization extends AbstractTag
{

    protected $Id = 'ORGANIZATION';

    protected $Name = 'Organization';

    protected $FullName = 'Vorbis::Comments';

    protected $GroupName = 'Vorbis';

    protected $g0 = 'Vorbis';

    protected $g1 = 'Vorbis';

    protected $g2 = 'Audio';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'Organization';

    protected $local_g2 = 'Author';
}


text:
/// <reference path="../../../../../typings/_custom.d.ts" />

import {bind, Injectable, Http} from 'angular2/angular2'

import {ISearchable} from './searchable';

@Injectable()
export class Github implements ISearchable<any[]> {
  url: string = 'https://api.github.com/search/repositories?q=';

  constructor(public http: Http) {

  }

  /**
   * @returns an Observable of repository names
   */
  search(query: string): Rx.Observable<any[]> {
    return this.http.get(`${ this.url }${ query }`).
      toRx(). // convert it to pure Rx stream
      map(res => res.json()). // make json
      map(res => res.items). // extract "items" only
      filter(repos => repos); // only if there are results
  }

}

export var githubInjectables = [
  bind(Github).toClass(Github)
];


text:
#ifndef LWIP_HDR_RAW_H
#define LWIP_HDR_RAW_H

#include "lwip/opt.h"

#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */

#include "lwip/pbuf.h"
#include "lwip/def.h"
#include "lwip/lwip_ip.h"
#include "lwip/ip_addr.h"
#include "lwip/ip6_addr.h"

#ifdef __cplusplus
extern "C" {
#endif

struct raw_pcb;

/** Function prototype for raw pcb receive callback functions.
 * @param arg user supplied argument (raw_pcb.recv_arg)
 * @param pcb the raw_pcb which received data
 * @param p the packet buffer that was received
 * @param addr the remote IP address from which the packet was received
 * @return 1 if the packet was 'eaten' (aka. deleted),
 *         0 if the packet lives on
 * If returning 1, the callback is responsible for freeing the pbuf
 * if it's not used any more.
 */
typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
    ip_addr_t *addr);

#if LWIP_IPV6
/** Function prototype for raw pcb IPv6 receive callback functions.
 * @param arg user supplied argument (raw_pcb.recv_arg)
 * @param pcb the raw_pcb which received data
 * @param p the packet buffer that was received
 * @param addr the remote IPv6 address from which the packet was received
 * @return 1 if the packet was 'eaten' (aka. deleted),
 *         0 if the packet lives on
 * If returning 1, the callback is responsible for freeing the pbuf
 * if it's not used any more.
 */
typedef u8_t (*raw_recv_ip6_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p,
    ip6_addr_t *addr);
#endif /* LWIP_IPV6 */

#if LWIP_IPV6
#define RAW_PCB_RECV_IP6  raw_recv_ip6_fn ip6;
#else
#define RAW_PCB_RECV_IP6
#endif /* LWIP_IPV6 */

struct raw_pcb {
  /* Common members of all PCB types */
  IP_PCB;

  struct raw_pcb *next;

  u8_t protocol;

  /** receive callback function */
  union {
    raw_recv_fn ip4;
    RAW_PCB_RECV_IP6
  } recv;
  /* user-supplied argument for the recv callback */
  void *recv_arg;
#if LWIP_IPV6
  /* fields for handling checksum computations as per RFC3542. */
  u16_t chksum_offset;
  u8_t  chksum_reqd;
#endif
};

/* The following functions is the application layer interface to the
   RAW code. */
struct raw_pcb * raw_new        (u8_t proto);
void             raw_remove     (struct raw_pcb *pcb);
err_t            raw_bind       (struct raw_pcb *pcb, ip_addr_t *ipaddr);
err_t            raw_connect    (struct raw_pcb *pcb, ip_addr_t *ipaddr);

void             raw_recv       (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg);
err_t            raw_sendto     (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr);
err_t            raw_send       (struct raw_pcb *pcb, struct pbuf *p);

#if LWIP_IPV6
struct raw_pcb * raw_new_ip6   (u8_t proto);
#define          raw_bind_ip6(pcb, ip6addr) raw_bind(pcb, ip6_2_ip(ip6addr))
#define          raw_connect_ip6(pcb, ip6addr) raw_connect(pcb, ip6_2_ip(ip6addr))
#define          raw_recv_ip6(pcb, recv_ip6_fn, recv_arg) raw_recv(pcb, (raw_recv_fn)recv_ip6_fn, recv_arg)
#define          raw_sendto_ip6(pcb, pbuf, ip6addr) raw_sendto(pcb, pbuf, ip6_2_ip(ip6addr))
#endif /* LWIP_IPV6 */

/* The following functions are the lower layer interface to RAW. */
u8_t             raw_input      (struct pbuf *p, struct netif *inp);
#define raw_init() /* Compatibility define, no init needed. */

#ifdef __cplusplus
}
#endif

#endif /* LWIP_RAW */

#endif /* LWIP_HDR_RAW_H */


text:
<?php

use RTFLex\io\StreamReader;
use RTFLex\tokenizer\RTFTokenizer;
use RTFLex\tree\RTFDocument;

class RTFDocumentTest extends BaseTest {

    private function getDocument($path) {
        $reader = new StreamReader($path);
        $tokenizer = new RTFTokenizer($reader);
        $doc = new RTFDocument($tokenizer);
        $reader->close();
        return $doc;
    }

    public function testExtractMetadata() {
        $doc = $this->getDocument('tests/sample/hello-world.rtf');
        $this->assertEquals('有設計者嗎?', $doc->getMetadata('title'));
        $this->assertEquals('Sample Subject', $doc->getMetadata('subject'));
        $this->assertEquals('Craig Weber', $doc->getMetadata('author'));
        $this->assertEquals('silvermine', $doc->getMetadata('company'));

        // Careful editing this – non-breaking spaces are present.
        $this->assertEquals('2013 silvermine.', $doc->getMetadata('copyright'));
    }

    public function testExtractNullMetadata() {
        $doc = $this->getDocument('tests/sample/no-info.rtf');
        $this->assertNull($doc->getMetadata('title'));
        $this->assertNull($doc->getMetadata('subject'));
        $this->assertNull($doc->getMetadata('author'));
        $this->assertNull($doc->getMetadata('company'));
    }

    public function testExtractText() {
        $expected = file_get_contents('tests/sample/hello-world.txt');
        $doc = $this->getDocument('tests/sample/hello-world.rtf');
        $this->assertEquals($expected, $doc->extractText());
    }
}


text:
layout: post
microblog: true
audio:
photo:
date: 2009-09-29 18:00:00 -0600
guid: http://craigmcclellan.micro.blog/2009/09/30/t4488501368.html
---
My exciting evening with @XtineLamborn. Sorry you can't see much. It's dark inside a cop car.  [twitvid.com/588AB](http://twitvid.com/588AB)


text:
#pragma once

#if !defined(_INC_MSCLR_GCROOT)
#define _INC_MSCLR_GCROOT
#ifndef RC_INVOKED

#include <stddef.h>

#ifdef __cplusplus_cli
 #define __GCHANDLE_TO_VOIDPTR(x) ((GCHandle::operator System::IntPtr(x)).ToPointer())
 #define __VOIDPTR_TO_GCHANDLE(x) (GCHandle::operator GCHandle(System::IntPtr(x)))
 #define __NULLPTR nullptr
#else
 #define __GCHANDLE_TO_VOIDPTR(x) ((GCHandle::op_Explicit(x)).ToPointer())
 #define __VOIDPTR_TO_GCHANDLE(x) (GCHandle::op_Explicit(x))
 #define __NULLPTR 0
#endif

#ifndef __DEFINE_GCROOT_IN_GLOBAL_NAMESPACE
namespace msclr
{
#endif

template <class T> struct gcroot {

	typedef System::Runtime::InteropServices::GCHandle GCHandle;

	// always allocate a new handle during construction (see above)
	//
	[System::Diagnostics::DebuggerStepThroughAttribute]
	gcroot() {
		_handle = __GCHANDLE_TO_VOIDPTR(GCHandle::Alloc(__NULLPTR));
	}

	// this can't be T& here because & does not yet work on managed types
	// (T should be a pointer anyway).
	//
	gcroot(T t) {
		_handle = __GCHANDLE_TO_VOIDPTR(GCHandle::Alloc(t));
	}

	gcroot(const gcroot& r) {
		// don't copy a handle, copy what it points to (see above)
		_handle = __GCHANDLE_TO_VOIDPTR(
						GCHandle::Alloc(
							__VOIDPTR_TO_GCHANDLE(r._handle).Target ));
	}

	// Since C++ objects and handles are allocated 1-to-1, we can
	// free the handle when the object is destroyed
	//
	[System::Diagnostics::DebuggerStepThroughAttribute]
	~gcroot() {
		GCHandle g = __VOIDPTR_TO_GCHANDLE(_handle);
		g.Free();
		_handle = 0; // should fail if reconstituted
	}

	[System::Diagnostics::DebuggerStepThroughAttribute]
	gcroot& operator=(T t) {
		// no need to check for valid handle; was allocated in ctor
		__VOIDPTR_TO_GCHANDLE(_handle).Target = t;
		return *this;
	}

	gcroot& operator=(const gcroot &r) {
		// no need to check for valid handle; was allocated in ctor
		T t = (T)r;
		__VOIDPTR_TO_GCHANDLE(_handle).Target = t;
		return *this;
	}

	operator T () const {
		// gcroot is typesafe, so use static_cast
		return static_cast<T>( __VOIDPTR_TO_GCHANDLE(_handle).Target );
	}

	// don't return T& here because & to gc pointer not yet implemented
	// (T should be a pointer anyway).
	T operator->() const {
		// gcroot is typesafe, so use static_cast
		return static_cast<T>(__VOIDPTR_TO_GCHANDLE(_handle).Target);
	}

private:
	// Don't let anyone copy the handle value directly, or make a copy
	// by taking the address of this object and pointing to it from
	// somewhere else.  The root will be freed when the dtor of this
	// object gets called, and anyone pointing to it still will
	// cause serious harm to the Garbage Collector.
	//
	void* _handle;
	T* operator& ();
};

#ifndef __DEFINE_GCROOT_IN_GLOBAL_NAMESPACE
} // namespace msclr
#endif

#undef __GCHANDLE_TO_VOIDPTR
#undef __VOIDPTR_TO_GCHANDLE
#undef __NULLPTR

#endif /* RC_INVOKED */
#endif  // _INC_MSCLR_GCROOT


text:
Sequel.migration do
  up do
    alter_table :subscriptions do
      add_column :local_resident_sw, Integer
      add_column :non_local_resident_location, String
    end
  end

  down do
    alter_table :subscriptions do
      drop_column :local_resident_sw
      drop_column :non_local_resident_location
    end
  end
end


text:
package com.example.androidwork.foodsharing.Activities;

import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.widget.EditText;
import android.widget.ImageView;

import com.example.androidwork.foodsharing.Activities.BaseInterface.BaseInterfaceActivity;
import com.example.androidwork.foodsharing.Activities.DTO.Mail;
import com.example.androidwork.foodsharing.Activities.DTO.User;
import com.example.androidwork.foodsharing.Activities.MyUtility.AsyncTaskController;
import com.example.androidwork.foodsharing.Activities.MyUtility.DialogController;
import com.example.androidwork.foodsharing.Activities.MyUtility.LoginCannotFindUserException;
import com.example.androidwork.foodsharing.Activities.MyUtility.UserManager;
import com.example.androidwork.foodsharing.Activities.azure.Link_Azure;
import com.example.androidwork.foodsharing.R;
import com.facebook.AccessToken;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.FacebookSdk;
import com.facebook.login.LoginManager;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;

import java.net.MalformedURLException;
import java.util.List;
import java.util.concurrent.ExecutionException;

public class MainActivity extends AppCompatActivity {
    private EditText accountEd;
    private EditText passwordEd;
    private ObjectAnimator animTxtAlpha;
    private ImageView foodsharingImage;
    private LoginButton fbloginButton;
    private CallbackManager callbackManager;
    private AccessToken accessToken;

    public static final String SENDER_ID = "602485028743";  //Firebase Sender ID
    static final String KEY = "com.foodsharin.app";

    private void findViews(){
        accountEd = (EditText) findViewById(R.id.inputAccount_Main);
        passwordEd = (EditText) findViewById(R.id.inputPassword_Main);
        fbloginButton = (LoginButton)findViewById(R.id.login_button);
        foodsharingImage = (ImageView)findViewById(R.id.imageView);
        callbackManager = CallbackManager.Factory.create();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        FacebookSdk.sdkInitialize(getApplicationContext());
        setContentView(R.layout.activity_main);
        try {
            Link_Azure.initiate(this);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        findViews();
        animateLogoAlpha();
        accountFBOnClick();
    }

    private void animateLogoAlpha(){
        animTxtAlpha = ObjectAnimator.ofFloat(foodsharingImage , "alpha" , 0.3f , 2f);
        animTxtAlpha.setDuration(2000);
        animTxtAlpha.setRepeatCount(-1);
        animTxtAlpha.setRepeatMode(ObjectAnimator.REVERSE);
        animTxtAlpha.setInterpolator(new LinearInterpolator());
        animTxtAlpha.start();
    }

    public void registerOnClick(View view) {
        Intent intent = new Intent(this,Register_LogIn_Activity.class);
        startActivity(intent);
    }
    public void fblogin(View view){
        fbloginButton.performClick();
    }
    public void accountFBOnClick() {
        LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
            @Override
            public void onSuccess(LoginResult loginResult) {
                accessToken = loginResult.getAccessToken();
                final String account = accessToken.getUserId();
                DialogController.showLoadingDialog(MainActivity.this,"登入中....");
                Log.d("accesstoken" , account);
                final User user = UserManager.getUser();
                user.setAccount(account);
                Log.d("myLog","Hash password " + account.hashCode());
                final String password = String.valueOf(account.hashCode());
                user.setPassword(password);
                AsyncTask<Void,Void,Void> asyncTask = new AsyncTask<Void, Void, Void>() {
                    @Override
                    protected Void doInBackground(Void... voids) {
                        try {
                            List<User> fbAccountuSER = Link_Azure.mUserManager.where()
                                    .field("Account").eq(account).and().field("Password").
                                            eq(String.valueOf(account.hashCode()))
                                    .execute().get();
                            if (fbAccountuSER.size() == 0) {
                                UserManager.registerUserToTheDataBase(new MainActivity.SendMailToUserOnUserResultCallBack() );
                            }
                            else{
                            }
                            logInSuccessfully(user);
                        } catch (ExecutionException | InterruptedException e) {
                            e.printStackTrace();
                        }
                        return null;
                    }
                };
                loginCache(MainActivity.this,account,password);

                asyncTask.execute();

            }

            @Override
            public void onCancel() {
                Log.d("User","Cancel");
            }
            @Override
            public void onError(FacebookException error) {
                 Log.d("User","Error");
            }
        });
    }

    public void forgotOnClick(View view) {
        //todo: 忘記密碼
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        callbackManager.onActivityResult(requestCode, resultCode, data);
    }

    public void logInOnClickMain(View view) {
        logInSuccessfully(new User());
    }

    private void logInSuccessfully(User user){
        DialogController.dismissLoadingDialog(MainActivity.this);
        UserManager.setUser(user);
        Log.d("myLog",user.toString());
        System.gc();
        startActivity(new Intent(this, BaseInterfaceActivity.class));
    }

    private void loginCache(Context context, String account, String password){
        Log.d("Cache","儲存cache");
        SharedPreferences login = context.getSharedPreferences(KEY, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = login.edit();

        Log.e("Cache","帳號"+account+"密碼"+password);
        editor.clear();
        editor.putString("Account", account);
        editor.putString("Password",password);
        editor.commit();
    }
    public static void logoutCache(Context context){
        Log.d("Cache","登出cache");
        SharedPreferences login = context.getSharedPreferences(KEY, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = login.edit();
        LoginManager.getInstance().logOut();
        editor.clear();
        editor.commit();
    }
    private void checkCache(){
        SharedPreferences login = getSharedPreferences(KEY, Context.MODE_PRIVATE);
        final String account=login.getString("Account", null);
        final String password=login.getString("Password", null);
        if(account == null || password == null){
            Log.d("Cache","沒有cache");
            return;
        }
        else{
            Log.d("Cache","Account:"+account+"、Password:"+password);
            AsyncTask<Void,Void,Void> asyncTask = new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... voids) {
                    try{
                        List<User> temp;
                        DialogController.showLoadingDialog(MainActivity.this , "登入中");

                        temp = Link_Azure.mUserManager.where()
                                .field("Account").eq(account).and().field("Password").
                                        eq(password)
                                .execute().get();

                        if(temp.size() <= 0)
                            throw new LoginCannotFindUserException();

                        logInSuccessfully(temp.get(0));

                    }catch(InterruptedException | ExecutionException e){
                        e.printStackTrace();
                    }catch (final LoginCannotFindUserException e) {
                        DialogController.dismissLoadingDialog(MainActivity.this);
                        DialogController.createAndShowDialog(MainActivity.this, "找不到使用者", "請確認帳密無誤", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) { }
                        });
                    }
                    return null;
                }
            };
            AsyncTaskController.runAsyncTask(asyncTask);
        }

    }

    public static class SendMailToUserOnUserResultCallBack implements Link_Azure.OnAzureOperationResult<User>{

        @Override
        public void onSuccess(final User result) {
            Log.d("myLog","註冊完成新增信件中");
            Link_Azure.mMail.insert(new Mail("Welcome" , " 歡迎加入 Freeganism Hives :) \n 祝您使用愉快 !!" , 0,result.getId()));
            Link_Azure.mMail.insert(new Mail("成功購買!","點擊信件開啟置物櫃",0, UserManager.getUser().getId()));
        }

        @Override
        public void onFailed(Throwable err) {
            Log.d("myLog","註冊User失敗");
            err.printStackTrace();
        }

    }

}


text:
<?php

namespace Servinow\NavigationBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class ServinowNavigationBundle extends Bundle
{
}


text:
package com.linecorp.armeria.server;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.awaitility.Awaitility.await;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketException;

import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import com.linecorp.armeria.testing.junit5.server.ServerExtension;

class ConnectionLimitingHandlerIntegrationTest {

    private static final String LOOPBACK = null;

    @RegisterExtension
    static final ServerExtension server = new ServerExtension() {
        @Override
        protected void configure(ServerBuilder sb) throws Exception {
            sb.workerGroup(1);
            sb.maxNumConnections(2);
            sb.serviceUnder("/", new AbstractHttpService() {});
        }
    };

    @Test
    void testExceedMaxNumConnections() throws Exception {
        // Known to fail on WSL (Windows Subsystem for Linux)
        Assumptions.assumeTrue(System.getenv("WSLENV") == null);

        try (Socket s1 = newSocketAndTest()) {
            assertThat(server.server().numConnections()).isEqualTo(1);

            try (Socket s2 = newSocketAndTest()) {
                assertThat(server.server().numConnections()).isEqualTo(2);

                assertThatThrownBy(ConnectionLimitingHandlerIntegrationTest::newSocketAndTest)
                        .isInstanceOf(SocketException.class);

                assertThat(server.server().numConnections()).isEqualTo(2);
            }

            await().until(() -> server.server().numConnections() == 1);

            try (Socket s2 = newSocketAndTest()) {
                assertThat(server.server().numConnections()).isEqualTo(2);
            }
        }
    }

    private static Socket newSocketAndTest() throws IOException {
        final Socket socket = new Socket(LOOPBACK, server.httpPort());

        // Test this socket is opened or not.
        final OutputStream os = socket.getOutputStream();
        os.write("GET / HTTP/1.1\r\n\r\n".getBytes());
        os.flush();

        // Read the next byte and ignore it.
        socket.getInputStream().read();

        return socket;
    }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>W27263_text</title>
        <link rel="stylesheet" type="text/css" href="style.css" />

                «

    <p class="styleSans2.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans11.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">PHYSICAL ADDRESS REQUEST FORM
Please supply the following information for McKenzie County to provide a physical street address. This information will be used by McKenzie County for the purpose of subdivision planning, emergency management, E-911 service and county mapping. All physical addresses are required to have an approved approach permit before addresses are assigned.

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">* = Required

    <p class="styleSans14.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">*PLEASE PRINT LEGIBLY AND PLEASE INCLUDE A PLAT AND A VICINITY MAP* 1 2/01 /201 4 *
): Emerald Oil, Inc.
Date of Application:
Applicant Name (Oil/Gas Company Contact Person: Erm Ekblad
Email Address: % Area Code & Telephone #: (303) 595'5690
. . . Walter and Susan Link & Kenneth Hau en Trust Name of Property Owner 1f dlfferent from Applicant Name: 9
Oilpad Name: Talon Slugger Mid Pad
# 0f Wells on Pad 6 *
Slu er 346-21H, SI 4-16-21H, Slu 5-16-21 H, T I 3-9-4H, T | 4- -4H, T l -9-4H We" Names
Road Name Providing Property Access: 22 Street NW
Well Location on the Road: North XXX South East West N/A *

Approach Permit #

    <p class="styleSans18.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Section: 9
149N Range: 102w * N47.733558°
103.744072
Township:
Latitude: Longitude: (Decimal Degrees) *
As of April 15', 204, the County Board of Commissioners has directed the GIS Department to charge $100 per location/address for Oil and Gas Sites. Those funds will be used to cover extra costs that are incurred by the County for these requests. Please make checks payable to McKenzie County Treasurer and send payments to the address listed below. Credit cards are also accepted.

    <p class="styleSans8.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Return this form to:

    <p class="styleSans12000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">

    <p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Email: address@co.mckenzie.nd.us Or
Aaron Chisholm GIS Department 201 5'h Street NW, Suite 750


text:
package io.parsingdata.metal.expression.value;

import static io.parsingdata.metal.data.Selection.reverse;

import java.util.Objects;

import io.parsingdata.metal.Util;
import io.parsingdata.metal.data.ImmutableList;
import io.parsingdata.metal.data.ParseState;
import io.parsingdata.metal.encoding.Encoding;

/**
 * A {@link ValueExpression} that reverses the results of its operand.
 *

 * Reverse has a single operand values (a
 * {@link ValueExpression}). When evaluated, it evaluates values
 * and then reverses and returns the result.
 */
public class Reverse implements ValueExpression {

    public final ValueExpression values;

    public Reverse(final ValueExpression values) {
        this.values = values;
    }

    @Override
    public ImmutableList<Value> eval(final ParseState parseState, final Encoding encoding) {
        return reverse(values.eval(parseState, encoding));
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + "(" + values + ")";
    }

    @Override
    public boolean equals(final Object obj) {
        return Util.notNullAndSameClass(this, obj)
            && Objects.equals(values, ((Reverse)obj).values);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getClass(), values);
    }

}


text:
<?php

namespace FOS\OAuthServerBundle\Tests\Functional\TestBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * @ORM\Entity
 */
class User implements UserInterface
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string")
     */
    protected $password;

    public function getId()
    {
        return $this->id;
    }

    public function getRoles()
    {
        return array('ROLE_USER');
    }

    public function getPassword()
    {
        return $this->password;
    }

    public function setPassword($password)
    {
        $this->password = $password;
    }

    public function getSalt()
    {
        return null;
    }

    public function getUsername()
    {
        return $this->getId();
    }

    public function eraseCredentials()
    {

    }
}