text:
export LM_LICENSE_FILE = 27000@bbfs-00.calit2.net
export SYNOPSYS_DIR=/gro/cad/synopsys
export ICC_RELEASE=icc/K-2015.06-SP5-2
export VCS_RELEASE=vcs/K-2015.09-SP2-2
export VCS_HOME = $(SYNOPSYS_DIR)/$(VCS_RELEASE)
export VCS_BIN = $(VCS_HOME)/bin
export DVE_BIN = $(VCS_HOME)/bin
export DC_RELEASE    = syn/G-2012.06-SP5-4

# Example parameter scan makefile
#
# This makefile is a skeleton that simulates a module many times
# trying out variations of a product of different command line parameters.
#
# MBT 5/12/2015

HARDEN = 0

TOP = ../../..

########################### SIMULATION PARAMETERS ###########################
# place the parameters you want to scan here.
BSG_TESTME_FILES    =
BSG_TESTME_DIR      =
BSG_MISC_FILES      =  bsg_defines.v bsg_strobe.v
BSG_ASYNC_FILES     =
BSG_COMM_LINK_FILES =
BSG_DATAFLOW_FILES  =
BSG_FSB_FILES       =
BSG_TAG_FILES       =
BSG_GUTS_FILES      =
BSG_TEST_FILES      = bsg_nonsynth_clock_gen.v

BSG_CLK_GEN_FILES   =
ifeq ($(HARDEN),0)
BSG_CLK_GEN_DIR     = $(TOP)/bsg_clk_gen
BSG_HARD_LIB        =
else
BSG_CLK_GEN_DIR     = $(TOP)/hard/bsg_clk_gen
BSG_HARD_LIB        = -v /gro/cad/mosis/pdk/tsmc/cl025g/std_cells/Rev_2004q2v1/aci/sc/verilog/tsmc25.v
endif

TEST_MAIN   = test_bsg.v
TEST_MODULE = test_bsg

# this is a list of all variables you want to vary for the simulation
scan_params = WIDTH_P

# this is a list of all values for each variable in the scan_params list
# note; if you leave out values for a variable, then the product of the
# sets is null, and nothing will run.
WIDTH_P    = 8
############################################################################

############################# SIMULATOR COMMANDS ###########################

VCS_FLAGS  = -PP -notice -full64 +lint=all,noVCDE,noNS +v2k -sverilog -timescale=100ps/10ps  +vcs+loopreport +notimingchecks
VCS_FLAGS += +incdir+$(TOP)/bsg_tag/

############################################################################

ALL_FILES = $(foreach x,$(BSG_MISC_FILES),$(TOP)/bsg_misc/$(x)) \
            $(foreach x,$(BSG_TESTME_FILES),$(BSG_TESTME_DIR)/$(x)) \
              $(foreach x,$(BSG_ASYNC_FILES),$(TOP)/bsg_async/$(x)) \
              $(foreach x,$(BSG_COMM_LINK_FILES),$(TOP)/bsg_comm_link/$(x)) \
              $(foreach x,$(BSG_DATAFLOW_FILES),$(TOP)/bsg_dataflow/$(x)) \
              $(foreach x,$(BSG_FSB_FILES),$(TOP)/bsg_fsb/$(x)) \
              $(foreach x,$(BSG_TAG_FILES),$(TOP)/bsg_tag/$(x)) \
              $(foreach x,$(BSG_GUTS_FILES),$(TOP)/bsg_guts/$(x)) \
              $(foreach x,$(BSG_TEST_FILES),$(TOP)/bsg_test/$(x)) \
              $(SYNOPSYS_DIR)/$(ICC_RELEASE)/packages/gtech/src_ver/GTECH_NAND2.v \
              $(TEST_MAIN)

# function that generates a string for each combination of the parameters;
# spaces separated by "@" signs.
bsg_param_scan = $(if $(1),$(foreach v__,$($(firstword $(1))),\
                    $(call bsg_param_scan,$(filter-out $(firstword $(1)),\
                    $(1)),$(2),$(3),$(4)@$(2)$(firstword $(1))$(3)$(v__))),\
                    $(4))

# this takes the parameters and creates a set of make targets, one for every
# combination of the parameters
commands = $(call bsg_param_scan,$(scan_params),+define+,=)

$(warning bsg_param_scan: $(commands))

# default rule: run all of the targets.
all: $(foreach x,$(commands),run.$(x))

# this runs an individual target
# we replace the @ with a space so that the parameters are used as
# command line options

run.%: $(ALL_FILES)
	-rm -rf simv csrc simv.daidir
	$(VCS_BIN)/vcs $(VCS_FLAGS) $(filter-out small-clean,$^) $(subst @, ,$*) -o simv $(BSG_HARD_LIB)
	./simv $(subst @, ,$*) | tee $@.log

dve:
	$(DVE_BIN)/dve -full64 -vpd vcdplus.vpd &
%.echo:
	@echo $($*)

clean:
	- rm -rf simv csrc simv.daidir DVEfiles vcdplus.vpd ucli.key simv.log run.*.log


text:
/**
 * error_handling_test
 *
 * @author Kevan Dunsmore
 * @created 2012/08/28
 */
var Future = require('futures').future;
var expect = require('chai').expect;
var assert = require('chai').assert;

var eh = require('../index.js');

describe('ErrorHandlingTest', function ()
{
    beforeEach(function (done)
               {
                   done();
               });

    describe('createWrapper', function ()
    {
        it('should succeed and marshal no parameters', function (done)
        {
            // Create an error-handling wrapper.
            var wrap = eh.createWrapper();

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(0);
                                   done();
                               },
                               function ()
                               {
                                   assert.fail('Error handler should never be called');
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful.
            wrapped(undefined);
        });

        it('should succeed and marshal all parameters except the err parameter', function (done)
        {
            // Create an error-handling wrapper.
            var wrap = eh.createWrapper();

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function (param1, param2, param3)
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(3);

                                   // Make sure the argument values are as expected.
                                   expect(param1).to.equal("value1");
                                   expect(param2).to.equal("value2");
                                   expect(param3).to.equal("value3");

                                   done();
                               },
                               function ()
                               {
                                   assert.fail('Error handler should never be called');
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful.
            wrapped(undefined, "value1", "value2", "value3");
        });

        it('should call the failure callback with just the err parameter', function (done)
        {
            // Create an error-handling wrapper.
            var wrap = eh.createWrapper();

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   assert.fail('Target function should never be called.');
                               },
                               function (err)
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(1);

                                   expect(err.message).to.equal('Expected error');
                                   done();
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful.
            wrapped(new Error('Expected error'));
        });

        it('should call the failure callback with all of the parameters', function (done)
        {
            // Create an error-handling wrapper.
            var wrap = eh.createWrapper();

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   assert.fail('Target function should never be called.');
                               },
                               function (err, param1, param2, param3)
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(4);

                                   // Make sure the argument values are as expected.
                                   expect(err.message).to.equal('Expected error');
                                   expect(param1).to.equal("value1");
                                   expect(param2).to.equal("value2");
                                   expect(param3).to.equal("value3");

                                   done();
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful.
            wrapped(new Error('Expected error'), 'value1', 'value2', 'value3');
        });
    });

    describe('createWrapperFromFuture', function ()
    {
        it('should succeed and marshal no parameters', function (done)
        {
            // Create a future object and an error-handling wrapper from it.
            var future = new Future();
            var wrap = eh.createWrapperFromFuture(future);

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(0);

                                   // Tell the future object we were successful.
                                   future.fulfill(undefined, "success");
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful.
            wrapped(undefined);

            // Wait for the future to tell us that the wrapped function was called.
            future.when(function (err, value)
                        {
                            expect(err).to.equal(undefined);
                            expect(value).to.equal("success");
                            done();
                        });
        });

        it('should succeed and marshal all parameters except the err parameter', function (done)
        {
            // Create a future object and an error-handling wrapper from it.
            var future = new Future();
            var wrap = eh.createWrapperFromFuture(future);

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function (param1, param2, param3)
                               {
                                   // Make sure the correct number of arguments have been passed.
                                   expect(arguments.length).to.equal(3);

                                   // Make sure the argument values are as expected.
                                   expect(param1).to.equal("value1");
                                   expect(param2).to.equal("value2");
                                   expect(param3).to.equal("value3");

                                   // Tell the future object we were successful.
                                   future.fulfill(undefined, "success");
                               });

            // Call the wrapped function, supplying an undefined error object to signify that we were successful and
            // with some parameters.
            wrapped(undefined, "value1", "value2", "value3");

            // Wait for the future to tell us that the wrapped function was called.
            future.when(function (err, value)
                        {
                            expect(err).to.equal(undefined);
                            expect(value).to.equal("success");
                            done();
                        });
        });

        it('should fulfill the future with an error', function (done)
        {
            // Create a future object and an error-handling wrapper from it.
            var future = new Future();
            var wrap = eh.createWrapperFromFuture(future);

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   assert.fail('Target function should never be called.');
                               });

            // Call the wrapped function, supplying an error object to simulate, well, an error.
            wrapped(new Error("This is an expected error"));

            // Wait for the future to tell us that the wrapped function was called.
            future.when(function (err)
                        {
                            expect(arguments.length).to.equal(1);

                            expect(err).to.not.equal(undefined);
                            expect(err.message).to.equal('This is an expected error');

                            done();
                        });
        });

        it('should fulfill the future with an error and other specified parameters', function (done)
        {
            // Create a future object and an error-handling wrapper from it.
            var future = new Future();
            var wrap = eh.createWrapperFromFuture(future);

            // Now wrap a function.  It should now get error-handling capabilities.
            var wrapped = wrap(function ()
                               {
                                   assert.fail('Target function should never be called.');
                               });

            // Call the wrapped function, supplying an error object to simulate, well, an error.
            wrapped(new Error("This is an expected error"), 'value1', 'value2', 'value3');

            // Wait for the future to tell us that the wrapped function was called.
            future.when(function (err, param1, param2, param3)
                        {
                            // Make sure the correct number of arguments have been passed.
                            expect(arguments.length).to.equal(4);

                            // Make sure the argument values are as expected.
                            expect(err.message).to.equal('This is an expected error');
                            expect(param1).to.equal("value1");
                            expect(param2).to.equal("value2");
                            expect(param3).to.equal("value3");

                            done();
                        });
        });
    });
});

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>artTemplate语法</title>


text:
# karma-jspm  [![Build Status](https://travis-ci.org/Workiva/karma-jspm.svg?branch=master)](https://travis-ci.org/Workiva/karma-jspm)

karma-jspm includes the jspm module loader for karma runs. This allows dynamic loading of src/test files and modules. No longer do you need to worry about browserifying your src or tests before every test run!

##Installation##

Available in npm: `npm install karma-jspm`

**This plugin assumes you are using jspm in your project.** You will need to have a `config.js` in the root of your project (though this is configurable) as well as a `jspm_packages` directory containing systemjs and the es6-module-loader.

##Configuration##

*karma.conf.js*

Include this plugin in your frameworks:

```js
frameworks: ['jspm', 'jasmine'],
```

The `loadFiles` configuration tells karma-jspm which files should be dynamically loaded via systemjs *before* the tests run. Globs or regular file paths are acceptable.

**You should not include these in the regular karma files array.** karma-jspm takes care of this for you.

```js
jspm: {
    // Edit this to your needs
    loadFiles: ['src/**/*.js', 'test/**/*.js']
}
```

That's it!

###Optional Configuration###

You may have named your jspm `config.js` file or `jspm_packages` directory something else. In this case simply add that to the jspm configuration in *karma.conf.js*:

```js
jspm: {
    config: "myJspmConfig.js",
    packages: "my_jspm_modules/"
}
```

You may want to make additional files/a file pattern available for jspm to load, but not load it right away. Simply add that to `serveFiles`.
One use case for this is to only put test specs in `loadFiles`, and jspm will only load the src files when and if the test files require them. Such a config would look like this:

```js
jspm: {
    loadFiles: ['test/**/*.js'],
    serveFiles: ['src/**/*.js']
}
```

By default karma-jspm ignores jspm's bundles configuration. To re-enable it, specify the `useBundles` option.

```js
jspm: {
    useBundles: true
}
```

Depending on your framework and project structure it might be necessary to override jspm paths for the testing scenario.
In order to do so just add the `paths` property to the jspm config object in your karma-configuration file, along with the overrides:

```js
jspm: {
    paths: {
        '*': 'yourpath/*.js',
        ...
    }
}
```


text:
ClusterPostProcessing::ClusterPostProcessing(const std::vector<std::string> contigs_, const std::map<std::string, unsigned> contigSizes_) : contigs(contigs_), contigSizes(contigSizes_)
{
}

ClusterPostProcessing::~ClusterPostProcessing()
{
}

void ClusterPostProcessing::run(ClusteringResult & cr)
{
    unsigned n = cr.labels.size();

    if (n != contigs.size())
    {
        throw std::runtime_error("Number of labels must match number of contigs.");
    }

    // first, assign points in contigs which occur in distinct clusters, assign the cluster with the most points

    auto uniqueContigs = contigs;
    std::sort(uniqueContigs.begin(), uniqueContigs.end());
    auto it = std::unique(uniqueContigs.begin(), uniqueContigs.end());
    uniqueContigs.resize(std::distance(uniqueContigs.begin(), it));

    for (auto contig : uniqueContigs)
    {
        std::map<unsigned, unsigned> labelSizes;
        for (unsigned i = 0; i < n; i++)
        {
            if (contigs.at(i) != contig)
            {
                continue;
            }
            unsigned lbl = cr.labels.at(i);
            if(labelSizes.count(lbl) == 0)
            {
                labelSizes[lbl] = 0;
            }
            labelSizes[lbl]++;
        }

        if (labelSizes.size() > 1) // multiple clusters for one contig, re-assign label
        {
            unsigned newLbl = 0;
            unsigned maxClustSize = 0;
            for (const auto it : labelSizes)
            {
                if (it.second > maxClustSize)
                {
                    newLbl = it.first;
                    maxClustSize = it.second;
                }
            }
            for (unsigned i = 0; i < n; i++)
            {
                if (contigs.at(i) == contig)
                {
                    cr.labels[i] = newLbl;
                }
            }
        }

    }

    // count clusters because they might have changed
    auto uniqueLabels = cr.labels;
    std::sort(uniqueLabels.begin(), uniqueLabels.end());
    auto it2 = std::unique(uniqueLabels.begin(), uniqueLabels.end());
    uniqueLabels.resize(std::distance(uniqueLabels.begin(), it2));
    cr.numClusters = uniqueLabels.size();

    // second, throw out outlier clusters if aggressive mode is on

    if (Opts::aggressiveThreshold() > 0)
    {
        // for each label, add up sizes of contained contigs and see if they are below threshold
        std::map<unsigned, unsigned> clusterSizes; // cluster label => num nucleotides in there

        for (auto contig : uniqueContigs)
        {
            for (unsigned i = 0; i < n; i++)
            {
                if (contigs.at(i) == contig)
                {
                    clusterSizes[cr.labels.at(i)] += contigSizes.at(contig);
                    break;
                }
            }
        }

        // mark outlier clusters if the cluster size is below threshold
        for (auto & it : clusterSizes)
        {
            unsigned lbl = it.first;
            unsigned clusterSize = it.second;

            if (clusterSize < Opts::aggressiveThreshold())
            {
                cr.outlierClusters.push_back(lbl);
                cr.numClusters--;
            }
        }
    }

}


text:
namespace base {
class DictionaryValue;
class ListValue;
}

namespace cloud_devices {

// Provides parsing, serialization and validation Cloud Device Description or
// Cloud Job Ticket.
// https://developers.google.com/cloud-print/docs/cdd
class CloudDeviceDescription {
 public:
  CloudDeviceDescription();
  ~CloudDeviceDescription();

  void Reset();

  bool InitFromDictionary(scoped_ptr<base::DictionaryValue> root);
  bool InitFromString(const std::string& json);

  std::string ToString() const;

  const base::DictionaryValue& root() const { return *root_; }

  // Returns dictionary with capability/option.
  // Returns NULL if missing.
  const base::DictionaryValue* GetItem(const std::string& path) const;

  // Create dictionary for capability/option.
  // Never returns NULL.
  base::DictionaryValue* CreateItem(const std::string& path);

  // Returns list with capability/option.
  // Returns NULL if missing.
  const base::ListValue* GetListItem(const std::string& path) const;

  // Create list for capability/option.
  // Never returns NULL.
  base::ListValue* CreateListItem(const std::string& path);

 private:
  scoped_ptr<base::DictionaryValue> root_;

  DISALLOW_COPY_AND_ASSIGN(CloudDeviceDescription);
};

}  // namespace cloud_devices

#endif  // COMPONENTS_CLOUD_DEVICES_COMMON_CLOUD_DEVICE_DESCRIPTION_H_


text:
package com.google.ads.googleads.v12.resources;

public final class AdGroupAudienceViewProto {
  private AdGroupAudienceViewProto() {}
  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistryLite registry) {
  }

  public static void registerAllExtensions(
      com.google.protobuf.ExtensionRegistry registry) {
    registerAllExtensions(
        (com.google.protobuf.ExtensionRegistryLite) registry);
  }
  static final com.google.protobuf.Descriptors.Descriptor
    internal_static_google_ads_googleads_v12_resources_AdGroupAudienceView_descriptor;
  static final
    com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internal_static_google_ads_googleads_v12_resources_AdGroupAudienceView_fieldAccessorTable;

  public static com.google.protobuf.Descriptors.FileDescriptor
      getDescriptor() {
    return descriptor;
  }
  private static  com.google.protobuf.Descriptors.FileDescriptor
      descriptor;
  static {
    java.lang.String[] descriptorData = {
      "\n?google/ads/googleads/v12/resources/ad_" +
      "group_audience_view.proto\022\"google.ads.go" +
      "ogleads.v12.resources\032\037google/api/field_" +
      "behavior.proto\032\031google/api/resource.prot" +
      "o\"\340\001\n\023AdGroupAudienceView\022K\n\rresource_na" +
      "me\030\001 \001(\tB4\340A\003\372A.\n,googleads.googleapis.c" +
      "om/AdGroupAudienceView:|\352Ay\n,googleads.g" +
      "oogleapis.com/AdGroupAudienceView\022Icusto" +
      "mers/{customer_id}/adGroupAudienceViews/" +
      "{ad_group_id}~{criterion_id}B\212\002\n&com.goo" +
      "gle.ads.googleads.v12.resourcesB\030AdGroup" +
      "AudienceViewProtoP\001ZKgoogle.golang.org/g" +
      "enproto/googleapis/ads/googleads/v12/res" +
      "ources;resources\242\002\003GAA\252\002\"Google.Ads.Goog" +
      "leAds.V12.Resources\312\002\"Google\\Ads\\GoogleA" +
      "ds\\V12\\Resources\352\002&Google::Ads::GoogleAd" +
      "s::V12::Resourcesb\006proto3"
    };
    descriptor = com.google.protobuf.Descriptors.FileDescriptor
      .internalBuildGeneratedFileFrom(descriptorData,
        new com.google.protobuf.Descriptors.FileDescriptor[] {
          com.google.api.FieldBehaviorProto.getDescriptor(),
          com.google.api.ResourceProto.getDescriptor(),
        });
    internal_static_google_ads_googleads_v12_resources_AdGroupAudienceView_descriptor =
      getDescriptor().getMessageTypes().get(0);
    internal_static_google_ads_googleads_v12_resources_AdGroupAudienceView_fieldAccessorTable = new
      com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
        internal_static_google_ads_googleads_v12_resources_AdGroupAudienceView_descriptor,
        new java.lang.String[] { "ResourceName", });
    com.google.protobuf.ExtensionRegistry registry =
        com.google.protobuf.ExtensionRegistry.newInstance();
    registry.add(com.google.api.FieldBehaviorProto.fieldBehavior);
    registry.add(com.google.api.ResourceProto.resource);
    registry.add(com.google.api.ResourceProto.resourceReference);
    com.google.protobuf.Descriptors.FileDescriptor
        .internalUpdateFileDescriptor(descriptor, registry);
    com.google.api.FieldBehaviorProto.getDescriptor();
    com.google.api.ResourceProto.getDescriptor();
  }

  // @@protoc_insertion_point(outer_class_scope)
}


text:
package org.apache.storm.kafka;

import java.io.Serializable;

import org.apache.storm.spout.MultiScheme;
import org.apache.storm.spout.RawMultiScheme;

import kafka.api.FetchRequest;

public class KafkaConfig implements Serializable {
  private static final long serialVersionUID = 5276718734571623855L;

  public final BrokerHosts hosts;
  public final String topic;
  public final String clientId;

  public int fetchSizeBytes = 1024 * 1024;
  public int socketTimeoutMs = 10000;
  public int fetchMaxWait = 100;
  public int bufferSizeBytes = 1024 * 1024;
  public MultiScheme scheme = new RawMultiScheme();
  public boolean ignoreZkOffsets = false;
  public long startOffsetTime = kafka.api.OffsetRequest.EarliestTime();
  public long maxOffsetBehind = Long.MAX_VALUE;
  public boolean useStartOffsetTimeIfOffsetOutOfRange = true;
  public int metricsTimeBucketSizeInSecs = 60;
  public int minFetchByte = FetchRequest.DefaultMinBytes();

  public KafkaConfig(BrokerHosts hosts, String topic) {
    this(hosts, topic, kafka.api.OffsetRequest.DefaultClientId());
  }

  public KafkaConfig(BrokerHosts hosts, String topic, String clientId) {
    this.hosts = hosts;
    this.topic = topic;
    this.clientId = clientId;
  }

}


text:
package org.eclairjs.nashorn;

import javax.script.ScriptEngine;

/**
 * Created by bburns on 10/21/15.
 */
public interface Bootstrap {
    public void load(ScriptEngine engine);
}


text:
'use strict';

var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

var _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }

var extend = function extend(obj, src) {
  if (!obj) return src;
  Object.keys(src).forEach(function (key) {
    obj[key] = src[key];
  });
  return obj;
};

module.exports = function connectVia(stores, fn) {
  return function (Component) {
    if (!Array.isArray(stores)) stores = [stores];
    function getStateFromStores(self) {
      var values = stores.map(function (store) {
        return store();
      });
      var func = typeof fn === 'function' ? fn : self[fn];
      return func.apply(self, values);
    }
    function update() {
      this.setState(getStateFromStores(this));
    }
    return (function (_Component) {
      _inherits(ConnectedComponent, _Component);

      function ConnectedComponent() {
        _classCallCheck(this, ConnectedComponent);

        _get(Object.getPrototypeOf(ConnectedComponent.prototype), 'constructor', this).apply(this, arguments);
      }

      _createClass(ConnectedComponent, [{
        key: 'getInitialState',
        value: function getInitialState() {
          for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }

          var state = _get(Object.getPrototypeOf(ConnectedComponent.prototype), 'getInitialState', this).apply(this, args);
          return extend(state, getStateFromStores(this));
        }
      }, {
        key: 'componentDidMount',
        value: function componentDidMount() {
          var _this = this;

          for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
            args[_key2] = arguments[_key2];
          }

          _get(Object.getPrototypeOf(ConnectedComponent.prototype), 'componentDidMount', this).apply(this, args);
          stores.map(function (store) {
            return store.listen(update, _this);
          });
        }
      }, {
        key: 'componentWillUnmount',
        value: function componentWillUnmount() {
          var _this2 = this;

          for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
            args[_key3] = arguments[_key3];
          }

          _get(Object.getPrototypeOf(ConnectedComponent.prototype), 'componentWillUnmount', this).apply(this, args);
          stores.map(function (store) {
            return store.unlisten(update, _this2);
          });
        }
      }]);

      return ConnectedComponent;
    })(Component);
  };
};


text:
namespace tes_api_3 {

    using namespace collections;

    class tes_db : public class_meta<tes_db> {
    public:

        REGISTER_TES_NAME("JDB");

        void additionalSetup() {
            metaInfo.comment =
"Global entry point to store mod information. Main intent - replace global variables\n\
Manages keys and values associations (like JMap)";
        }

        template<class T>
        static T solveGetter(tes_context& ctx, const char* path, T t= default_value<T>()) {
            return tes_object::resolveGetter<T>(ctx, &ctx.root(), path, t);
        }
        REGISTERF(solveGetter<Float32>, "solveFlt", "path default=0.0",
"Attempts to retrieve the value associated with the @path.\n\
For ex. the following information associated with 'frosfall' key:\n\
\n\
\"frostfall\" : {\n\
    \"exposureRate\" : 0.5,\n\
    \"arrayC\" : [\"stringValue\", 1.5, 10, 1.14]\n\
}\n\
\n\
then JDB.solveFlt(\".frostfall.exposureRate\") will return 0.5 and\n\
JDB.solveObj(\".frostfall.arrayC\") will return the array containing [\"stringValue\", 1.5, 10, 1.14] values");

        REGISTERF(solveGetter<SInt32>, "solveInt", "path default=0", nullptr);
        REGISTERF(solveGetter<skse::string_ref>, "solveStr", "path default=\"\"", nullptr);
        REGISTERF(solveGetter<object_base*>, "solveObj", "path default=0", nullptr);
        REGISTERF(solveGetter<form_ref>, "solveForm", "path default=None", nullptr);

        template<class T>
        static bool solveSetter(tes_context& ctx, const char* path, T value, bool createMissingKeys = false) {
            return tes_object::solveSetter(ctx, &ctx.root(), path, value, createMissingKeys);
        }
        REGISTERF(solveSetter<Float32>, "solveFltSetter", "path value createMissingKeys=false",
            "Attempts to assign the @value. Returns false if no such path.\n"
            "If 'createMissingKeys=true' it creates any missing path elements: JDB.solveIntSetter(\".frostfall.keyB\", 10, true) creates {frostfall: {keyB: 10}} structure");
        REGISTERF(solveSetter<SInt32>, "solveIntSetter", "path value createMissingKeys=false", nullptr);
        REGISTERF(solveSetter<const char*>, "solveStrSetter", "path value createMissingKeys=false", nullptr);
        REGISTERF(solveSetter<object_base*>, "solveObjSetter", "path value createMissingKeys=false", nullptr);
        REGISTERF(solveSetter<form_ref>, "solveFormSetter", "path value createMissingKeys=false", nullptr);

        static void setObj(tes_context& ctx, const char *path, object_stack_ref& obj) {
            map& dbMap = ctx.root();

            if (obj) {
                tes_map::setItem(ctx, &dbMap, path, obj);
            } else {
                tes_map::removeKey(ctx, &dbMap, path);
            }
        }
        REGISTERF(setObj, "setObj", "key object",
"Associates(and replaces previous association) container object with a string key.\n\
destroys association if object is zero\n\
for ex. JDB.setObj(\"frostfall\", frostFallInformation) will associate 'frostall' key and frostFallInformation so you can access it later"
);

        static bool hasPath(tes_context& ctx, const char* path) {
            return tes_object::hasPath(ctx, &ctx.root(), path);
        }
        REGISTERF2(hasPath, "path", "Returns true, if JDB capable resolve given @path, i.e. if it able to execute solve* or solver*Setter functions successfully");

        static object_base* allKeys(tes_context& ctx) {
            return tes_map::allKeys(ctx, &ctx.root());
        }
        REGISTERF2(allKeys, "*", "returns new array containing all JDB keys");

        static object_base* allValues(tes_context& ctx) {
            return tes_map::allValues(ctx, &ctx.root());
        }
        REGISTERF2(allValues, "*", "returns new array containing all containers associated with JDB");

        static void writeToFile(tes_context& ctx, const char * path) {
            tes_object::writeToFile(ctx, &ctx.root(), path);
        }
        REGISTERF2(writeToFile, "path", "writes storage data into JSON file at given path");

        static void readFromFile(tes_context& ctx, const char *path) {
        }
        REGISTERF2(readFromFile, "path",
"DEPRECATED. Reads information from a JSON file at given path and replaces JDB content with the file content");

        static object_base* root(tes_context& ctx) {
            return &ctx.root();
        }
        REGISTERF2(root, "", "Returns underlying JDB's container - an instance of JMap.\nThe object being owned (retained) internally, so you don't have to (but can) retain or release it.")
    };

    TES_META_INFO(tes_db);
}


text:
using WPCordovaClassLib.Cordova.Commands;
using Windows.Devices.Geolocation;
using Microsoft.Phone.Shell;
using System;
using WPCordovaClassLib.Cordova;

namespace Cordova.Extension.Commands
{
    /// </summary>
    /// Ermöglicht, dass eine Anwendung im Hintergrund läuft ohne pausiert zu werden
    /// </summary>
    public class BackgroundMode : BaseCommand
    {
        /// </summary>
        /// Event types for callbacks
        /// </summary>
        enum Event {
            ACTIVATE, DEACTIVATE, FAILURE
        }

        #region Instance variables

        /// </summary>
        /// Flag indicates if the plugin is enabled or disabled
        /// </summary>
        private bool IsDisabled = true;

        /// </summary>
        /// Geolocator to monitor location changes
        /// </summary>
        private static Geolocator Geolocator { get; set; }

        #endregion

        #region Interface methods

        /// </summary>
        /// Enable the mode to stay awake when switching
        /// to background for the next time.
        /// </summary>
        public void enable (string args)
        {
            IsDisabled = false;
        }

        /// </summary>
        /// Disable the background mode and stop
        /// being active in background.
        /// </summary>
        public void disable (string args)
        {
            IsDisabled = true;

            Deactivate();
        }

        #endregion

        #region Core methods

        /// </summary>
        /// Keep the app awake by tracking
        /// for position changes.
        /// </summary>
        private void Activate()
        {
            if (IsDisabled || Geolocator != null)
                return;

            if (!IsServiceAvailable())
            {
                FireEvent(Event.FAILURE, null);
                return;
            }

            Geolocator = new Geolocator();

            Geolocator.DesiredAccuracy   = PositionAccuracy.Default;
            Geolocator.MovementThreshold = 100000;
            Geolocator.PositionChanged  += geolocator_PositionChanged;

            FireEvent(Event.ACTIVATE, null);
        }

        /// </summary>
        /// Let the app going to sleep.
        /// </summary>
        private void Deactivate ()
        {
            if (Geolocator == null)
                return;

            FireEvent(Event.DEACTIVATE, null);

            Geolocator.PositionChanged -= geolocator_PositionChanged;
            Geolocator = null;
        }

        #endregion

        #region Helper methods

        /// </summary>
        /// Determine if location service is available and enabled.
        /// </summary>
        private bool IsServiceAvailable()
        {
            Geolocator geolocator = (Geolocator == null) ? new Geolocator() : Geolocator;

            PositionStatus status = geolocator.LocationStatus;

            if (status == PositionStatus.Disabled)
                return false;

            if (status == PositionStatus.NotAvailable)
                return false;

            return true;
        }

        /// <summary>
        /// Fires the given event.
        /// </summary>
        private void FireEvent(Event Event, string Param)
        {
            string EventName;

            switch (Event) {
                case Event.ACTIVATE:
                    EventName = "activate"; break;
                case Event.DEACTIVATE:
                    EventName = "deactivate"; break;
                default:
                    EventName = "failure"; break;
            }

            string js = String.Format("cordova.plugins.backgroundMode.on{0}({1})", EventName, Param);

            PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, js);

            pluginResult.KeepCallback = true;

            DispatchCommandResult(pluginResult);
        }

        #endregion

        #region Delegate methods

        private void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
        {
            // Nothing to do here
        }

        #endregion

        #region Lifecycle methods

        /// <summary>
        /// Occurs when the application is being deactivated.
        /// </summary>
        public override void OnPause(object sender, DeactivatedEventArgs e)
        {
            Activate();
        }

        /// <summary>
        /// Occurs when the application is being made active after previously being put
        /// into a dormant state or tombstoned.
        /// </summary>
        public override void OnResume(object sender, ActivatedEventArgs e)
        {
            Deactivate();
        }

        #endregion
    }
}


text:
using System;
using FluentAssertions;
using Xunit;

namespace ArgData.Tests
{
    public class TeamHorsepowerFacts
    {
        [Theory]
        [InlineData(GpExeVersionInfo.European105)]
        [InlineData(GpExeVersionInfo.European105Decompressed)]
        [InlineData(GpExeVersionInfo.Us105)]
        [InlineData(GpExeVersionInfo.Us105Decompressed)]
        public void ReadTeamHorsepower_OriginalValues_ReturnsExpectedValues(GpExeVersionInfo exeVersionInfo)
        {
            var expectedValues = new[] { 716, 676, 716, 650, 620, 625, 620, 665, 610, 680,
                655, 665, 640, 700, 630, 610, 680, 615 };
            string exampleDataPath = ExampleDataHelper.GpExePath(exeVersionInfo);
            var horsepowerReader = TeamHorsepowerReader.For(GpExeFile.At(exampleDataPath));

            for (int i = 0; i < expectedValues.Length; i++)
            {
                var fileHorsepower = horsepowerReader.ReadTeamHorsepower(i);
                var expectedHorsepower = expectedValues[i];

                fileHorsepower.Should().Be(expectedHorsepower);
            }
        }

        [Theory]
        [InlineData(GpExeVersionInfo.European105)]
        [InlineData(GpExeVersionInfo.European105Decompressed)]
        [InlineData(GpExeVersionInfo.Us105)]
        [InlineData(GpExeVersionInfo.Us105Decompressed)]
        public void WriteTeamHorsepower_KnownValues_StoresCorrectValues(GpExeVersionInfo exeVersionInfo)
        {
            using (var context = ExampleDataContext.ExeCopy(exeVersionInfo))
            {
                var horsepowerWriter = TeamHorsepowerWriter.For(context.ExeFile);

                int startValue = 700;

                for (int i = 0; i < Constants.NumberOfSupportedTeams; i++)
                {
                    horsepowerWriter.WriteTeamHorsepower(i, startValue);
                    startValue++;
                }

                var horsepowerReader = TeamHorsepowerReader.For(context.ExeFile);

                for (int i = 0; i < Constants.NumberOfSupportedTeams; i++)
                {
                    var value = horsepowerReader.ReadTeamHorsepower(i);

                    value.Should().Be(700 + i);
                }
            }
        }

        [Fact]
        public void CreateReaderFor_NullGpExe_ThrowsArgumentNullException()
        {
            Action action = () => TeamHorsepowerReader.For(null);

            action.Should().Throw<ArgumentNullException>();
        }

        [Fact]
        public void CreateReader_NullGpExe_ThrowsArgumentNullException()
        {
            Action action = () => new TeamHorsepowerReader(null);

            action.Should().Throw<ArgumentNullException>();
        }

        [Fact]
        public void CreateWriterFor_NullGpExe_ThrowsArgumentNullException()
        {
            Action action = () => TeamHorsepowerWriter.For(null);

            action.Should().Throw<ArgumentNullException>();
        }

        [Fact]
        public void CreateWriter_NullGpExe_ThrowsArgumentNullException()
        {
            Action action = () => new TeamHorsepowerWriter(null);

            action.Should().Throw<ArgumentNullException>();
        }

        [Theory]
        [InlineData(0)]
        [InlineData(17)]
        public void ReadTeamHorsepower_InsideRange_DoesNotThrowArgumentOutOfRangeException(int teamIndex)
        {
            using (var context = ExampleDataContext.ExeCopy(GpExeVersionInfo.European105))
            {
                var horsepowerWriter = TeamHorsepowerReader.For(context.ExeFile);

                Action action = () => horsepowerWriter.ReadTeamHorsepower(teamIndex);

                action.Should().NotThrow<ArgumentOutOfRangeException>();
            }

        }

        [Theory]
        [InlineData(-1)]
        [InlineData(18)]
        public void ReadTeamHorsepower_OutsideRange_DoesNotThrowArgumentOutOfRangeException(int teamIndex)
        {
            using (var context = ExampleDataContext.ExeCopy(GpExeVersionInfo.European105))
            {
                var horsepowerWriter = TeamHorsepowerReader.For(context.ExeFile);

                Action action = () => horsepowerWriter.ReadTeamHorsepower(teamIndex);

                action.Should().Throw<ArgumentOutOfRangeException>();
            }

        }

        [Theory]
        [InlineData(0)]
        [InlineData(17)]
        public void WriteTeamHorsepower_InsideRange_DoesNotThrowArgumentOutOfRangeException(int teamIndex)
        {
            using (var context = ExampleDataContext.ExeCopy(GpExeVersionInfo.European105))
            {
                var horsepowerWriter = TeamHorsepowerWriter.For(context.ExeFile);

                Action action = () => horsepowerWriter.WriteTeamHorsepower(teamIndex, 700);

                action.Should().NotThrow<ArgumentOutOfRangeException>();
            }
        }

        [Theory]
        [InlineData(-1)]
        [InlineData(18)]
        public void WriteTeamHorsepower_OutsideRange_ThrowsArgumentOutOfRangeException(int teamIndex)
        {
            using (var context = ExampleDataContext.ExeCopy(GpExeVersionInfo.European105))
            {
                var horsepowerWriter = TeamHorsepowerWriter.For(context.ExeFile);

                Action action = () => horsepowerWriter.WriteTeamHorsepower(teamIndex, 700);

                action.Should().Throw<ArgumentOutOfRangeException>();
            }
        }
    }
}


text:
This plugin receives traces, metrics and logs from
[OpenTelemetry](https://opentelemetry.io) clients and agents via gRPC.

## Configuration

```toml @sample.conf
# Receive OpenTelemetry traces, metrics, and logs over gRPC
[[inputs.opentelemetry]]
  ## Override the default (0.0.0.0:4317) destination OpenTelemetry gRPC service
  ## address:port
  # service_address = "0.0.0.0:4317"

  ## Override the default (5s) new connection timeout
  # timeout = "5s"

  ## Override the default (prometheus-v1) metrics schema.
  ## Supports: "prometheus-v1", "prometheus-v2"
  ## For more information about the alternatives, read the Prometheus input
  ## plugin notes.
  # metrics_schema = "prometheus-v1"

  ## Optional TLS Config.
  ## For advanced options: https://github.com/influxdata/telegraf/blob/v1.18.3/docs/TLS.md
  ##
  ## Set one or more allowed client CA certificate file names to
  ## enable mutually authenticated TLS connections.
  # tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
  ## Add service certificate and key.
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"
```

### Schema

The OpenTelemetry->InfluxDB conversion [schema][1] and [implementation][2] are
hosted at <https://github.com/influxdata/influxdb-observability> .

Spans are stored in measurement `spans`.
Logs are stored in measurement `logs`.

For metrics, two output schemata exist.  Metrics received with
`metrics_schema=prometheus-v1` are assigned measurement from the OTel field
`Metric.name`.  Metrics received with `metrics_schema=prometheus-v2` are stored
in measurement `prometheus`.

Also see the OpenTelemetry output plugin for Telegraf.

[1]: https://github.com/influxdata/influxdb-observability/blob/main/docs/index.md

[2]: https://github.com/influxdata/influxdb-observability/tree/main/otel2influx

## Example Output

### Tracing Spans

```text
spans end_time_unix_nano="2021-02-19 20:50:25.6893952 +0000 UTC",instrumentation_library_name="tracegen",kind="SPAN_KIND_INTERNAL",name="okey-dokey",net.peer.ip="1.2.3.4",parent_span_id="d5270e78d85f570f",peer.service="tracegen-client",service.name="tracegen",span.kind="server",span_id="4c28227be6a010e1",status_code="STATUS_CODE_OK",trace_id="7d4854815225332c9834e6dbf85b9380" 1613767825689169000
spans end_time_unix_nano="2021-02-19 20:50:25.6893952 +0000 UTC",instrumentation_library_name="tracegen",kind="SPAN_KIND_INTERNAL",name="lets-go",net.peer.ip="1.2.3.4",peer.service="tracegen-server",service.name="tracegen",span.kind="client",span_id="d5270e78d85f570f",status_code="STATUS_CODE_OK",trace_id="7d4854815225332c9834e6dbf85b9380" 1613767825689135000
spans end_time_unix_nano="2021-02-19 20:50:25.6895667 +0000 UTC",instrumentation_library_name="tracegen",kind="SPAN_KIND_INTERNAL",name="okey-dokey",net.peer.ip="1.2.3.4",parent_span_id="b57e98af78c3399b",peer.service="tracegen-client",service.name="tracegen",span.kind="server",span_id="a0643a156d7f9f7f",status_code="STATUS_CODE_OK",trace_id="fd6b8bb5965e726c94978c644962cdc8" 1613767825689388000
spans end_time_unix_nano="2021-02-19 20:50:25.6895667 +0000 UTC",instrumentation_library_name="tracegen",kind="SPAN_KIND_INTERNAL",name="lets-go",net.peer.ip="1.2.3.4",peer.service="tracegen-server",service.name="tracegen",span.kind="client",span_id="b57e98af78c3399b",status_code="STATUS_CODE_OK",trace_id="fd6b8bb5965e726c94978c644962cdc8" 1613767825689303300
spans end_time_unix_nano="2021-02-19 20:50:25.6896741 +0000 UTC",instrumentation_library_name="tracegen",kind="SPAN_KIND_INTERNAL",name="okey-dokey",net.peer.ip="1.2.3.4",parent_span_id="6a8e6a0edcc1c966",peer.service="tracegen-client",service.name="tracegen",span.kind="server",span_id="d68f7f3b41eb8075",status_code="STATUS_CODE_OK",trace_id="651dadde186b7834c52b13a28fc27bea" 1613767825689480300
```

## Metrics

### `prometheus-v1`

```shell
cpu_temp,foo=bar gauge=87.332
http_requests_total,method=post,code=200 counter=1027
http_requests_total,method=post,code=400 counter=3
http_request_duration_seconds 0.05=24054,0.1=33444,0.2=100392,0.5=129389,1=133988,sum=53423,count=144320
rpc_duration_seconds 0.01=3102,0.05=3272,0.5=4773,0.9=9001,0.99=76656,sum=1.7560473e+07,count=2693
```

### `prometheus-v2`

```shell
prometheus,foo=bar cpu_temp=87.332
prometheus,method=post,code=200 http_requests_total=1027
prometheus,method=post,code=400 http_requests_total=3
prometheus,le=0.05 http_request_duration_seconds_bucket=24054
prometheus,le=0.1  http_request_duration_seconds_bucket=33444
prometheus,le=0.2  http_request_duration_seconds_bucket=100392
prometheus,le=0.5  http_request_duration_seconds_bucket=129389
prometheus,le=1    http_request_duration_seconds_bucket=133988
prometheus         http_request_duration_seconds_count=144320,http_request_duration_seconds_sum=53423
prometheus,quantile=0.01 rpc_duration_seconds=3102
prometheus,quantile=0.05 rpc_duration_seconds=3272
prometheus,quantile=0.5  rpc_duration_seconds=4773
prometheus,quantile=0.9  rpc_duration_seconds=9001
prometheus,quantile=0.99 rpc_duration_seconds=76656
prometheus               rpc_duration_seconds_count=1.7560473e+07,rpc_duration_seconds_sum=2693
```

### Logs

```text
logs fluent.tag="fluent.info",pid=18i,ppid=9i,worker=0i 1613769568895331700
logs fluent.tag="fluent.debug",instance=1720i,queue_size=0i,stage_size=0i 1613769568895697200
logs fluent.tag="fluent.info",worker=0i 1613769568896515100
```


text:
class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|
      t.string :user_name, null: false
      t.string :email, null: false
      t.string :password_hash

      t.timestamps
    end
  end
end


text:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
using System.Windows;

namespace Gherkin.Util
{

    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public struct FilePathStruct
    {
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
        public string FilePath;
    }

    [StructLayout(LayoutKind.Sequential)]
    public struct CopyDataStruct
    {
        public IntPtr dwData;       // Specifies data to be passed
        public int cbData;          // Specifies the data size in bytes
        public IntPtr lpData;       // Pointer to data to be passed
    }

    [SuppressUnmanagedCodeSecurity]
    public class NativeMethod
    {
        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern IntPtr SendMessage(IntPtr hWnd, int Msg,
            IntPtr wParam, ref CopyDataStruct lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
    }

    public class ProcessInterop
    {
        public const int WM_COPYDATA = 0x004A;
        public const string GherkinInteropMessageReceiver = "GherkinInteropMessageReceiver";  // It should be used as Window Title that will receive message

        public static bool SendFilePathToApp(string filePath)
        {
            IntPtr hTargetWnd = NativeMethod.FindWindow(null, GherkinInteropMessageReceiver);
            if (hTargetWnd == IntPtr.Zero)
            {
                //MessageBox.Show("Failed - NativeMethod.FindWindow(null, \"GherkinInteropMessageReceiver\")");
                return false;
            }
            FilePathStruct filePathStruct;
            filePathStruct.FilePath = filePath;
            int size_of_struct = Marshal.SizeOf(filePathStruct);
            IntPtr pStruct = Marshal.AllocHGlobal(size_of_struct);
            try
            {
                Marshal.StructureToPtr(filePathStruct, pStruct, true);

                CopyDataStruct cds = new CopyDataStruct();
                cds.cbData = size_of_struct;
                cds.lpData = pStruct;
                NativeMethod.SendMessage(hTargetWnd, ProcessInterop.WM_COPYDATA, new IntPtr(), ref cds);

                Marshal.GetLastWin32Error();
            }
            finally
            {
                Marshal.FreeHGlobal(pStruct);
            }
            return true;
        }
    }
}


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

package org.projectbuendia.client.ui.login;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import org.projectbuendia.client.R;
import org.projectbuendia.client.json.JsonUser;
import org.projectbuendia.client.utils.Colorizer;

import butterknife.ButterKnife;
import butterknife.InjectView;

/** {@link ArrayAdapter} for a grid of users. */
final class UserListAdapter extends ArrayAdapter<JsonUser> {

    private final Colorizer mColorizer;

    public UserListAdapter(Context context, Colorizer colorizer) {
        super(context, R.layout.login_grid_user_item);
        mColorizer = colorizer;
    }

    @Override public View getView(int position, View view, ViewGroup parent) {
        ItemViewHolder holder;
        if (view != null) {
            holder = (ItemViewHolder) view.getTag();
        } else {
            view = LayoutInflater.from(getContext())
                .inflate(R.layout.login_grid_user_item, parent, false);
            holder = new ItemViewHolder(view);
            view.setTag(holder);
        }

        JsonUser user = getItem(position);
        holder.initials.setBackgroundColor(mColorizer.getColorArgb(user.id));
        holder.initials.setText(user.getInitials());
        holder.fullName.setText(user.fullName);

        return view;
    }

    static final class ItemViewHolder {
        @InjectView(R.id.user_initials) public TextView initials;
        @InjectView(R.id.user_name) public TextView fullName;

        public ItemViewHolder(View view) {
            ButterKnife.inject(this, view);
        }
    }
}


text:
#ifndef SkScalarContext_win_dw_DEFINED
#define SkScalarContext_win_dw_DEFINED

#include "SkScalar.h"
#include "SkScalerContext.h"
#include "SkTypeface_win_dw.h"
#include "SkTypes.h"

#include <dwrite.h>

struct SkGlyph;
class SkDescriptor;

class SkScalerContext_DW : public SkScalerContext {
public:
    SkScalerContext_DW(DWriteFontTypeface*, const SkDescriptor* desc);
    virtual ~SkScalerContext_DW();

protected:
    virtual unsigned generateGlyphCount() SK_OVERRIDE;
    virtual uint16_t generateCharToGlyph(SkUnichar uni) SK_OVERRIDE;
    virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE;
    virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE;
    virtual void generateImage(const SkGlyph& glyph) SK_OVERRIDE;
    virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE;
    virtual void generateFontMetrics(SkPaint::FontMetrics*) SK_OVERRIDE;

private:
    const void* drawDWMask(const SkGlyph& glyph,
                           DWRITE_RENDERING_MODE renderingMode,
                           DWRITE_TEXTURE_TYPE textureType);

    void getBoundingBox(SkGlyph* glyph,
                        DWRITE_RENDERING_MODE renderingMode,
                        DWRITE_TEXTURE_TYPE textureType,
                        RECT* bbox);

    SkTDArray<uint8_t> fBits;
    /** The total matrix without the text height scale. */
    SkMatrix fSkXform;
    /** The total matrix without the text height scale. */
    DWRITE_MATRIX fXform;
    /** The non-rotational part of total matrix without the text height scale.
     *  This is used to find the magnitude of gdi compatible advances.
     */
    DWRITE_MATRIX fGsA;
    /** The inverse of the rotational part of the total matrix.
     *  This is used to find the direction of gdi compatible advances.
     */
    SkMatrix fG_inv;
    /** The text size to render with. */
    SkScalar fTextSizeRender;
    /** The text size to measure with. */
    SkScalar fTextSizeMeasure;
    SkAutoTUnref<DWriteFontTypeface> fTypeface;
    int fGlyphCount;
    DWRITE_RENDERING_MODE fRenderingMode;
    DWRITE_TEXTURE_TYPE fTextureType;
    DWRITE_MEASURING_MODE fMeasuringMode;
};

#endif


text:
angular.module('app', ['ionic','ngCordova','app.controllers', 'app.routes', 'app.directives','app.services'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

.config(function($stateProvider,$urlRouterProvider){
	$stateProvider

	.state('login', {
		url: "/login",
		templateUrl: "templates/searchApp.html",
		controller: 'searchAppCtrl'
	})

    .state('register', {
		url: "/register",
		templateUrl: "templates/register.html",
		controller: 'registerCtrl'
	})

     .state('home', {
    url: "/home",
    templateUrl: "templates/home.html",
    controller:"homeCtrl"
  });

$urlRouterProvider

    .otherwise('/login');

});


text:
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
 * AttributesDefinition
 *
 * @ORM\Table(name="attributes_definition")
 * @ORM\Entity(repositoryClass="AppBundle\Repository\AttributesDefinitionRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class AttributesDefinition
{
    const IS_TEXT = 'TextValues';
    const IS_BOOL = 'BooleanValues';
    const IS_IMAGE = 'Image';
    const IS_FILE = 'File';
    const IS_LIST = 'ListValues';
    const IS_DATE = 'DateValues';
    const IS_COLLECTION = 'CollectionValues';

    const IS_CAMPAIGN = 'Campaign';
    const IS_PROJECT = 'Project';
    const IS_PAGE = 'Page';
    const IS_LIST_OBJECT = 'ListValues';

    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @Gedmo\Slug(fields={"attrName"})
     * @ORM\Column(name="slug", type="string", length=255, unique=true)
     */
    private $slug;

    /**
     * @var string
     *
     * @ORM\Column(name="attr_name", type="string", length=255)
     */
    private $attrName;

    /**
     * @var string
     *
     * @ORM\Column(name="attr_class", type="string", length=255)
     */
    private $attrClass;

    /**
     * @var bool
     *
     * @ORM\Column(name="is_required", type="boolean")
     */
    private $isRequired;

    /**
     * @var bool
     *
     * @ORM\Column(name="is_public", type="boolean")
     */
    private $isPublic;

    /**
     * @var
     * @ORM\Column(name="status", type="boolean")
     */
    private $status;

    public function __clone()
    {
        $this->id = null;
    }

    public function __toString()
    {
        return $this->id ? $this->attrName : 'new Attr Def';
        // TODO: Implement __toString() method.
    }

    public function __construct()
    {
//        $this->isPublic = true;
        $this->isRequired= false;
        $this->status= false;
    }

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

    /**
     * Set attrName
     *
     * @param string $attrName
     *
     * @return AttributesDefinition
     */
    public function setAttrName($attrName)
    {
        $this->attrName = $attrName;

        return $this;
    }

    /**
     * Get attrName
     *
     * @return string
     */
    public function getAttrName()
    {
        return $this->attrName;
    }

    /**
     * Set attrClass
     *
     * @param string $attrClass
     *
     * @return AttributesDefinition
     */
    public function setAttrClass($attrClass)
    {
        $this->attrClass = $attrClass;

        return $this;
    }

    /**
     * Get attrClass
     *
     * @return string
     */
    public function getAttrClass()
    {
        return $this->attrClass;
    }

    /**
     * Set isRequired
     *
     * @param boolean $isRequired
     *
     * @return AttributesDefinition
     */
    public function setIsRequired($isRequired)
    {
        $this->isRequired = $isRequired;

        return $this;
    }

    /**
     * Get isRequired
     *
     * @return bool
     */
    public function getIsRequired()
    {
        return $this->isRequired;
    }

    /**
     * @return bool
     */
    public function getIsPublic()
    {
        return $this->isPublic;
    }

    /**
     * @param bool $isPublic
     */
    public function setIsPublic($isPublic)
    {
        $this->isPublic = $isPublic;
    }

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

    /**
     * @param string $slug
     */
    public function setSlug($slug)
    {
        $this->slug = $slug;
    }

    /**
     * @return mixed
     */
    public function getStatus()
    {
        return $this->status;
    }

    /**
     * @param mixed $status
     */
    public function setStatus($status)
    {
        $this->status = $status;
    }
}


text:
// Qt includes
#include <QApplication>
#include <QTimer>
#include <QGroupBox>
#include <QDebug>

// VTK includes
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>
#if CTK_USE_QVTKOPENGLWIDGET
#include <QVTKOpenGLWidget.h>
#endif

// CTK includes
#include "ctkVTKRenderView.h"
#include "ctkCommandLineParser.h"

// STD includes
#include <iostream>

//-----------------------------------------------------------------------------
int ctkVTKRenderViewTest2(int argc, char * argv [] )
{
#if CTK_USE_QVTKOPENGLWIDGET
    QSurfaceFormat format = QVTKOpenGLWidget::defaultFormat();
    format.setSamples(0);
    QSurfaceFormat::setDefaultFormat(format);
#endif

  QApplication app(argc, argv);

  // Command line parser
  ctkCommandLineParser parser;
  parser.addArgument("", "-I", QVariant::Bool);
  parser.addArgument("", "-D", QVariant::String);
  bool ok = false;
  QHash<QString, QVariant> parsedArgs = parser.parseArguments(app.arguments(), &ok);
  if (!ok)
    {
    std::cerr << qPrintable(parser.errorString()) << std::endl;
    return EXIT_FAILURE;
    }

  bool interactive = parsedArgs["-I"].toBool();
  QString data_directory = parsedArgs["-D"].toString();
  Q_UNUSED(data_directory);

  // Instanciate widget
  ctkVTKRenderView renderView;
  renderView.resize(300, 300);
  renderView.setBackgroundColor(QColor(Qt::red));
  renderView.setCornerAnnotationText("CTK Rocks !");
  renderView.show();

  // Instanciate VTK objects
  vtkNew<vtkSphereSource> sphere;
  vtkNew<vtkPolyDataMapper> sphereMapper;
  vtkNew<vtkActor> sphereActor;

  // Configure actor
  sphere->SetRadius(0.25);
  sphereMapper->SetInputConnection(sphere->GetOutputPort());
  sphereActor->SetMapper(sphereMapper.GetPointer());

  // Add actor
  renderView.renderer()->AddActor(sphereActor.GetPointer());

  renderView.lookFromAxis(ctkAxesWidget::Right);
  renderView.lookFromAxis(ctkAxesWidget::Left, 10);
  renderView.lookFromAxis(ctkAxesWidget::Anterior, 1.);
  renderView.lookFromAxis(ctkAxesWidget::Posterior, 1.);
  renderView.lookFromAxis(ctkAxesWidget::Superior, 0.333333);
  renderView.lookFromAxis(ctkAxesWidget::Inferior, 0.333333);
  renderView.lookFromAxis(ctkAxesWidget::None, 100.);

  if (!interactive)
    {
    QTimer::singleShot(1000, &app, SLOT(quit()));
    }
  return app.exec();
}


text:
<template name="Login">

  {{#if currentUser}}

  {{else}}

      <button class="ui green button cas-login">Login with UH Credentials</button>

    Login with Preset Account

  {{/if}}

</template>


text:
package it.unitn.ing.rista.awt;

import java.awt.*;
import java.awt.print.PrinterJob;
import java.awt.print.PageFormat;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.Properties;
import javax.swing.*;

import it.unitn.ing.rista.util.*;
import it.unitn.ing.rista.io.COD.CODCIFsubmitter;

/**
 * The TextViewer is a class
 *
 * @version $Revision: 1.5 $, $Date: 2006/01/19 14:45:53 $
 * @author Luca Lutterotti
 * @since JDK1.1
 */

public class TextViewer extends myJFrame {

  JTextArea textArea = null;
  JScrollPane scrollarea = null;

  public TextViewer(Frame parent) {

    this(parent, false);
  }

  public TextViewer(Frame parent, boolean editable) {

    super(parent);

    frameWLabel = "helpFrame.frameWidth";
    frameHLabel = "helpFrame.frameHeight";
    defaultFrameW = 600;
    defaultFrameH = 400;
    setOwnSize = true;
    framePositionX = "helpFrame.framePositionX";
    framePositionY = "helpFrame.framePositionY";
    defaultFramePositionX = 10;
    defaultFramePositionY = 20;
    setOwnPosition = true;

    createDefaultMenuBar(editable);

    scrollarea = new JScrollPane(textArea = new JTextArea());
    if (editable) {
      getContentPane().setLayout(new BorderLayout(3, 3));
      getContentPane().add(BorderLayout.CENTER, scrollarea);
    } else
      getContentPane().add(scrollarea);

    textArea.setEditable(editable);

    setTitle("");

//    setComponentToPrint(textArea);
  }

  public TextViewer() {
    this(null);
  }

  public TextViewer(Frame parent, boolean editable, boolean forCOD) {
    this(parent, editable);
    if (forCOD) {
      setTitle("CIF submission to COD");
      JPanel jp1 = new JPanel(new FlowLayout(FlowLayout.RIGHT, 6, 6));
      getContentPane().add(BorderLayout.NORTH, jp1);
      jp1.add(new JLabel("Revise and edit the CIF before submitting to Crystallographic Open Database"));
      jp1 = new JPanel(new FlowLayout(FlowLayout.RIGHT, 6, 6));
      getContentPane().add(BorderLayout.SOUTH, jp1);
      JButton abutton = new JButton("Cancel");
      abutton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          setVisible(false);
          dispose();
        }
      });
      jp1.add(abutton);
      abutton = new JButton("Submit to COD");
      abutton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          saveFile();
          if (getHelpFilename() != null) {
            System.out.println("Submitting file: " + getHelpFilename() + " to COD.....");
            CODCIFsubmitter.submit(getHelpFilename());
          }
          setVisible(false);
          dispose();
        }
      });
      jp1.add(abutton);
    }
  }

  public void DisplayText(URL filename) {
//    setTitle("Help");
    BufferedReader data;
    String Line; // file data
    StringBuffer Buf = new StringBuffer();

    try {
      data = new BufferedReader(new InputStreamReader(filename.openStream()));

      while ((Line = data.readLine()) != null)
        Buf.append(Line + "\n");
      data.close();

      textArea.setText(Buf.toString());
      JScrollBar scrollBar = scrollarea.getVerticalScrollBar();
      if (scrollBar != null)
        scrollBar.setValue(0);
    } catch (IOException e) {
      setVisible(false);
    }
  }

  public void DisplayText(String filename) {
//    setTitle("Help");
    BufferedReader data;
    String Line; // file data
    StringBuffer Buf = new StringBuffer();

    try {
      data = Misc.getReader(filename);
      setHelpFilename(filename);

      while ((Line = data.readLine()) != null)
        Buf.append(Line + "\n");
      data.close();

      textArea.setText(Buf.toString());
	    if (scrollarea.getVerticalScrollBar() != null)
		    javax.swing.SwingUtilities.invokeLater(new Runnable() {
			    public void run() {
				    scrollarea.getVerticalScrollBar().setValue(0);
			    }
		    });
    } catch (IOException e) {
      setVisible(false);
    }
  }

  public void DisplayText(URL acodeBase, String filename) {
    setTitle(filename);
    BufferedReader data;
    String Line; // file data
    StringBuffer Buf = new StringBuffer();

    try {
      URL url = new URL(acodeBase, filename);
      data = new BufferedReader(new InputStreamReader(url.openStream()));

      while ((Line = data.readLine()) != null)
        Buf.append(Line + "\n");
      data.close();

      textArea.setText(Buf.toString());
      JScrollBar scrollBar = scrollarea.getVerticalScrollBar();
      if (scrollBar != null)
        scrollBar.setValue(0);
    } catch (IOException e) {
      setVisible(false);
    }
  }

  public void saveFile() {
    if (getHelpFilename() == null)
      return;

    BufferedWriter data;

    try {
      data = Misc.getWriter(getHelpFilename());

      data.write(textArea.getText());

      data.close();

    } catch (IOException e) {
      setVisible(false);
    }
  }

  public void letsTryToPrint() {
    PrintJob pjob = getToolkit().getPrintJob(this, "Printing text", new Properties());
//    PrinterJob pjob = PrinterJob.getPrinterJob();
    if (pjob != null) {
//      PageFormat graphicsPageFormat = new PageFormat();
//      graphicsPageFormat = pjob.pageDialog(graphicsPageFormat);
//      if (pjob.printDialog()) {
//        graphicsPageFormat = pjob.validatePage(graphicsPageFormat);
//        pjob.setPrintable(this, graphicsPageFormat);
        try {
          Graphics pg = pjob.getGraphics();
          if (pg != null) {
            String s = textArea.getText();
            printLongString (pjob, pg, s);
            pg.dispose();
          }
          pjob.end();
        } catch (Exception PrintException) {
          PrintException.printStackTrace();
        }
 //     }
    }
  }

  // I'm assuming a one-inch margin on all
  // four sides. This could be done better.
  private int margin = 72;

  // Print string to graphics via printjob
  // Does not deal with word wrap or tabs
  private void printLongString (PrintJob pjob, Graphics pg, String s) {

    int pageNum = 1;
    int linesForThisPage = 0;
    int linesForThisJob = 0;
    // Note: String is immutable so won't change while printing.
    if (!(pg instanceof PrintGraphics)) {
      throw new IllegalArgumentException ("Graphics context not PrintGraphics");
    }
    StringReader sr = new StringReader (s);
    LineNumberReader lnr = new LineNumberReader (sr);
    String nextLine;
    int pageHeight = pjob.getPageDimension().height - margin;
    Font helv = new Font("Helvetica", Font.PLAIN, 12);
    //have to set the font to get any output
    pg.setFont (helv);
    FontMetrics fm = pg.getFontMetrics(helv);
    int fontHeight = fm.getHeight();
    int fontDescent = fm.getDescent();
    int curHeight = margin;
    try {
      do {
        nextLine = lnr.readLine();
        if (nextLine != null) {
          if ((curHeight + fontHeight) > pageHeight) {
            // New Page
            System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
            if (linesForThisPage == 0) {
               System.out.println ("Font is too big for pages of this size; aborting...");
               break;
            }
            pageNum++;
            linesForThisPage = 0;
            pg.dispose();
            pg = pjob.getGraphics();
            if (pg != null) {
              pg.setFont (helv);
            }
            curHeight = 0;
          }
          curHeight += fontHeight;
          if (pg != null) {
            pg.drawString (nextLine, margin, curHeight - fontDescent);
            linesForThisPage++;

            linesForThisJob++;
          } else {
            System.out.println ("pg null");
          }
        }
      } while (nextLine != null);
    } catch (EOFException eof) {
      // Fine, ignore
    } catch (Throwable t) { // Anything else
      t.printStackTrace();
    }
    System.out.println ("" + linesForThisPage + " lines printed for page " + pageNum);
    System.out.println ("pages printed: " + pageNum);
    System.out.println ("total lines printed: " + linesForThisJob);
  }

}


text:
package ui.adpter;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.admin.erp.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import Tool.ACache;
import Tool.ToolUtils;
import Tool.statistics.AchacheConstant;
import Tool.statistics.Statics;
import http.ExpressBillingManagementHttpPost;
import http.HttpBasePost;
import http.HttpTypeConstants;
import model.javabean.ExpressManagement;
import model.javabean.ProjectAllPageData;
import ui.activity.ExpressBillingManagementActivity;
import ui.activity.ProjectManagementActivity;

/**
 * Created by admin on 2017/2/23.
 */

public class ProjectManagementAdapter extends BaseAdapter {
    private Activity activity;
    private android.support.v7.app.AlertDialog dlg,dlgMenu;
    private String id;
    private ExpressBillingManagementHttpPost httpPost;
    private int positions;
    private ViewHolder vh;
    private List<ViewHolder> holders = new ArrayList<ViewHolder>();
    private HashMap<String,String> param ;
    private static TimeBackAdpter timeBackAdpter;
    private static ListView lvs;
    private static ListView lv;
    private static MemberDetailsAdpter memberDetailsAdpter;
    private long exitTime = 0;
    ACache aCache ;
    ArrayList<ExpressManagement> tempList;
    public ProjectManagementAdapter(Activity activity) {
        this.activity = activity;
        aCache = ACache.get(activity);
        tempList = (ArrayList<ExpressManagement>) aCache.getAsObject(AchacheConstant.EXPRESS_MANAGEMENT_LIST);
    }

    @Override
    public int getCount() {
        if (Statics.projectAllPageDataArrayList.size()!=0) {
            return Statics.projectAllPageDataArrayList.get(0).getRows().size();
        } else {
            return 0;
        }
    }

    @Override
    public Object getItem(int position) {
        return position;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {

        positions = position;
        if (convertView == null) {
            vh = new ViewHolder();
            convertView = LayoutInflater.from(activity).inflate(R.layout.projectmanagerlist, null);
            //找控件
            vh.number = (TextView) convertView.findViewById(R.id.number);
            vh.projectName = (TextView) convertView.findViewById(R.id.project_name);
            vh.projectManager = (TextView) convertView.findViewById(R.id.project_manager);
            vh.startTime = (TextView) convertView.findViewById(R.id.start_time);
            vh.states = (TextView) convertView.findViewById(R.id.states);
            //vh.del = (TextView) convertView.findViewById(R.id.del);
            vh.details = (TextView) convertView.findViewById(R.id.details);
            convertView.setTag(vh);
            holders.add(vh);
        } else {
            vh = (ViewHolder) convertView.getTag();
        }

        //获取数据和显示数据
        String number = Integer.toString((ProjectManagementActivity.page-1)*50 + position+1);
        ProjectAllPageData.RowsBean projectAllPageData = Statics.projectAllPageDataArrayList.get(0).getRows().get(position);
        vh.number.setText(number);
        vh.number.setGravity(Gravity.CENTER);
        vh.projectName.setText(projectAllPageData.getProjectName());
        vh.projectName.setGravity(Gravity.CENTER);
        vh.projectManager.setText(projectAllPageData.getProjectManager());
        vh.projectManager.setGravity(Gravity.CENTER);
        vh.startTime.setText(ToolUtils.getYearMonthDate(projectAllPageData.getStartTime()));
        vh.startTime.setGravity(Gravity.CENTER);
        String state = "";
        if(projectAllPageData.getStu().equals("017001")){
            state = "项目进行中";
        }else if(projectAllPageData.getStu().equals("017002")){
            state = "项目已结束";
        }
        vh.states.setText(state);
        vh.states.setGravity(Gravity.CENTER);
        //vh.del.setOnClickListener(new Click(positions));//解决光标获取不对的问题
        vh.details.setOnClickListener(new Click(positions));
        return convertView;
    }
    private void showNormalDelDialog(final int item) {
            /* @setIcon 设置对话框图标
         * @setTitle 设置对话框标题
         * @setMessage 设置对话框消息提示
         * setXXX方法返回Dialog对象,因此可以链式设置属性
         */
        id = tempList.get(0).getData().get(0).getRows().get(item).getId();
        AlertDialog.Builder normalDialog =
                new AlertDialog.Builder(activity);
        normalDialog.setIcon(R.drawable.delete);
        normalDialog.setTitle("删除记录");
        normalDialog.setMessage("是否删除该记录?");
        normalDialog.setPositiveButton("确定",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //...To-do
                        ExpressBillingManagementActivity.deleteSuccess = true;
                        ExpressManagement.DataBean.RowsBean edrb=tempList.get(0).getData().get(0).getRows().get(item);
                        String sum = edrb.getSum().toString();
                        String classify = edrb.getClassify();
                        String paymentMethod = edrb.getPaymentMethod();
                        Log.d("ExpressManagementAdapte", "jin" + sum + "*" + classify + "*" + paymentMethod);
                        if (!"进账".equals(edrb.getClassify())){
                             sum = edrb.getSum().abs().toString();
                             classify = edrb.getClassify().split("")[1].split("")[0];
                             paymentMethod = edrb.getPaymentMethod().split("")[1].split("")[0];
                            Log.d("ExpressManagementAdapte", "chuzhag"+sum+";"+classify+";"+paymentMethod);
                        }
                        Statics.isDelete = true;

                        if ("success".equals(httpPost.delAccountManagerHttp(aCache.getAsString(AchacheConstant.FINANCIAL_BILLINGMANAGEMENT_SEARCH_URL), id, sum
                                ,classify,paymentMethod,activity))) {
                            ExpressBillingManagementActivity.progressDialog = ProgressDialog.show(activity, "请稍等...", "获取数据中...", true);//显示进度条
                        } else {
                            Toast.makeText(activity, "删除失败", Toast.LENGTH_SHORT).show();
                        }
                    }
                });
        normalDialog.setNegativeButton("取消",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //...To-do

                    }
                });
        // 显示
        normalDialog.show();

    }

    public class Click implements View.OnClickListener {
        int item= 0;

        public Click(int position) {
            item= position;
        }

        @Override
        public void onClick(View v) {
            httpPost = new ExpressBillingManagementHttpPost();
           /* if(v.getId() == R.id.del){
                showNormalDelDialog(item);//删除对话框
            }else*/ if(v.getId() == R.id.details){
                exitTime = ToolUtils.muchClick(exitTime);
                if(exitTime!=0) {
                    exitTime = System.currentTimeMillis();
                    android.support.v7.app.AlertDialog.Builder builder = new android.support.v7.app.AlertDialog.Builder(activity);
                    LayoutInflater inflater = ProjectManagementActivity.activity.getLayoutInflater();
                    final View layout = inflater.inflate(R.layout.projectmanager_dialog_detailed_item, null);//获取自定义布局
                    lvs = (ListView) layout.findViewById(R.id.lvs);
                    lv = (ListView) layout.findViewById(R.id.lv);
                    ProjectAllPageData.RowsBean projectAllPageDate = Statics.projectAllPageDataArrayList.get(0).getRows().get(item);
                    //查询项目周期情况
                    param = new HashMap<>();
                    param.put("id", projectAllPageDate.getId());//projectid
                    HttpBasePost.postHttp(aCache.getAsString(AchacheConstant.PROJECT_GETWXPROJECT_CYCLE_URL), param, HttpTypeConstants.ProjectGetWXProjectCycleUrlType);
                    timeBackAdpter = new TimeBackAdpter(ProjectManagementActivity.activity, Statics.projectCycleDataList);//回款时间
                    lvs.setAdapter(timeBackAdpter);
                    //成员情况
                    param = new HashMap<>();
                    param.put("projectId", projectAllPageDate.getId());
                    HttpBasePost.postHttp(aCache.getAsString(AchacheConstant.PROJECT_GETWXLOAD_PROJECT_PEOPLE_PAGE_DATA_URL), param, HttpTypeConstants.ProjectGetWXLoadProjectPeoplePageDataType);
                    memberDetailsAdpter = new MemberDetailsAdpter(ProjectManagementActivity.activity, Statics.projectPeoplePageDataList);
                    lv.setAdapter(memberDetailsAdpter);
                    TextView projectName = (TextView) layout.findViewById(R.id.project_name);//项目名称
                    TextView projectManager = (TextView) layout.findViewById(R.id.project_manager);//项目经理
                    TextView yjStartTime = (TextView) layout.findViewById(R.id.yjstart_time);//预计开始时间
                    TextView sjStarttime = (TextView) layout.findViewById(R.id.sjstart_time);//实际开始时间
                    TextView jEndTime = (TextView) layout.findViewById(R.id.jend_time);//结束时间
                    TextView period = (TextView) layout.findViewById(R.id.period);//收款周期
                    TextView money = (TextView) layout.findViewById(R.id.money);//金额
                    TextView states = (TextView) layout.findViewById(R.id.states);//合同状态
                    TextView description = (TextView) layout.findViewById(R.id.project_description);//项目描述
                    projectName.setText(projectAllPageDate.getProjectName());
                    projectManager.setText(projectAllPageDate.getProjectManager());
                    yjStartTime.setText(ToolUtils.getYearMonthDate(projectAllPageDate.getYjstartTime()));
                    sjStarttime.setText(ToolUtils.getYearMonthDate(projectAllPageDate.getStartTime()));
                    jEndTime.setText(ToolUtils.getYearMonthDate(projectAllPageDate.getEndTime()));
                    if (projectAllPageDate.getSum() > 0) {
                        money.setText(Double.toString(projectAllPageDate.getSum()));
                    } else {
                        money.setText("");
                    }
                    period.setText(projectAllPageDate.getProjectCycle());
                    description.setText(projectAllPageDate.getMome());
                    String state = "";
                    if (projectAllPageDate.getStu().equals("017001")) {
                        state = "项目进行中";
                    } else if (projectAllPageDate.getStu().equals("017002")) {
                        state = "项目已结束";
                    }
                    states.setText(state);
                    //创建人就是用户名
                    builder.setView(layout);
                    dlg = builder.create();
                    dlg.show();
                    //dlg.getWindow().setLayout(1500, 1500);
                    WindowManager windowManager = ProjectManagementActivity.activity.getWindowManager();
                    Display display = windowManager.getDefaultDisplay();
                    WindowManager.LayoutParams lp = dlg.getWindow().getAttributes();
                    lp.width = (int) (display.getWidth()); //设置宽度
                    dlg.getWindow().setAttributes(lp);
                }
            }
        }
    }
    class ViewHolder {
        TextView number, projectName, projectManager,  startTime, states, details, del;
    }

    public static void AdapterRefresh(String type) {//刷新adapter
        switch (type) {
            case "projectTimeBackAdapter":
                timeBackAdpter.notifyDataSetChanged();
                ToolUtils.setListViewHeightBasedOnChildren(lvs,10);
                break;
            case "projectPeopleAdapter":
                memberDetailsAdpter.notifyDataSetChanged();
                ToolUtils.setListViewHeightBasedOnChildren(lv,11);
                break;
        }
    }
}


text:
package com.basrikahveci
package cardgame.messaging.response

import cardgame.messaging.{Success, Response}
import cardgame.domain.NexTurn

class GamePlayNotification(val nextTurn: NexTurn, val success: Boolean = true, val reason: Int = Success.ordinal) extends Response


text:
An introduction to git, and a place to practice pushing code!

## Contents

The tutorials are split into three pages:
- [An overview of git](overview.md): What is it? Why use it?
- [Getting started](setup.md): Initial steps before you start.
- [Working with git](working.md): How to push code!

(These instructions often asssume you're on a Mac, or using a [unix shell](http://en.wikipedia.org/wiki/Unix_shell))

## Resources

Some of these instructions get pretty technical, but I tried to limit the tutorial to what you need to get started on projects here at Urban. There are some other fantastic, more broad git tutorials and resources out there:
- [Git immersion](http://gitimmersion.com/) is a longer tutorial, with tons of information.
- Once you're in the swing of things with git, you might want to print out [this git cheat sheet](https://services.github.com/on-demand/downloads/github-git-cheat-sheet.pdf) and put it on your wall. Way helpful.
- Many more great tutorials (including those listed above) can be found in [this article](https://help.github.com/articles/git-and-github-learning-resources/) from the folks at github.com

### FIRST UP: [An overview of git](overview.md)


text:
package edu.mit.fss.examples.gui;

import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.text.NumberFormat;
import java.util.Date;

import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.apache.log4j.Logger;
import org.orekit.errors.OrekitException;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.TimeScale;
import org.orekit.time.TimeScalesFactory;

import edu.mit.fss.event.SimulationTimeEvent;
import edu.mit.fss.event.SimulationTimeListener;

/**
 * A graphical user interface component to display dates. Includes separate
 * text fields for year, month, day, hour, minute, and second fields with
 * a time scale drop-down combo box (currently only one value: UTC).
 *
 * @author Paul T. Grogan, ptgrogan@mit.edu
 * @version 0.2.0
 * @since 0.1.0
 */
public class DatePanel extends JPanel implements SimulationTimeListener {
	private static Logger logger = Logger.getLogger(DatePanel.class);
	private static final long serialVersionUID = -8399088532123474707L;

	private static final NumberFormat yearFormat =
			NumberFormat.getIntegerInstance();
	{
		yearFormat.setGroupingUsed(false);
		yearFormat.setMinimumIntegerDigits(4);
		yearFormat.setMaximumIntegerDigits(4);
	}
	private static final NumberFormat twoDigitNumberFormat =
			NumberFormat.getIntegerInstance();
	{
		twoDigitNumberFormat.setGroupingUsed(false);
		twoDigitNumberFormat.setMinimumIntegerDigits(1);
		twoDigitNumberFormat.setMaximumIntegerDigits(2);
	}

	private final JFormattedTextField yearField, monthField, dayField,
			hourField, minuteField, secondField;
	private final JComboBox<TimeScale> timeScaleCombo;

	/**
	 * Instantiates a new date panel.
	 */
	public DatePanel() {
		setLayout(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();
		c.insets = new Insets(2,2,2,2);
		c.gridx = 0;
		c.gridy = 0;
		c.fill = GridBagConstraints.HORIZONTAL;
		add(new JLabel("Absolute Date: "), c);
		c.gridx++;
		c.gridwidth = 2;
		yearField = new JFormattedTextField(yearFormat);
		yearField.setColumns(4);
		yearField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		monthField = new JFormattedTextField(twoDigitNumberFormat);
		monthField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		monthField.setColumns(2);
		dayField = new JFormattedTextField(twoDigitNumberFormat);
		dayField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		dayField.setColumns(2);
		hourField = new JFormattedTextField(twoDigitNumberFormat);
		hourField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		hourField.setColumns(2);
		minuteField = new JFormattedTextField(twoDigitNumberFormat);
		minuteField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		minuteField.setColumns(2);
		secondField = new JFormattedTextField(NumberFormat.getNumberInstance());
		secondField.setHorizontalAlignment(JFormattedTextField.RIGHT);
		secondField.setColumns(4);
		TimeScale[] timeScales = null;
		try {
			timeScales = new TimeScale[]{TimeScalesFactory.getUTC()};
		} catch (OrekitException e) {
			logger.error(e);
		}
		timeScaleCombo = new JComboBox<TimeScale>(timeScales);
		JPanel datePanel = new JPanel();
		datePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
		datePanel.add(yearField);
		datePanel.add(new JLabel("-"));
		datePanel.add(monthField);
		datePanel.add(new JLabel("-"));
		datePanel.add(dayField);
		datePanel.add(new JLabel("T"));
		datePanel.add(hourField);
		datePanel.add(new JLabel(":"));
		datePanel.add(minuteField);
		datePanel.add(new JLabel(":"));
		datePanel.add(secondField);
		datePanel.add(new JLabel(" "));
		datePanel.add(timeScaleCombo);
		add(datePanel, c);
		c.gridy++;
		c.weightx = 0;
		c.gridx = 0;

		// disable all fields
		timeScaleCombo.setEnabled(false);
		yearField.setEditable(false);
		monthField.setEditable(false);
		dayField.setEditable(false);
		hourField.setEditable(false);
		minuteField.setEditable(false);
		secondField.setEditable(false);
	}

	/* (non-Javadoc)
	 * @see edu.mit.fss.event.SimulationTimeListener#timeAdvanced(edu.mit.fss.event.SimulationTimeEvent)
	 */
	@Override
	public void timeAdvanced(SimulationTimeEvent event) {
		final AbsoluteDate date;
		try {
			// parse the new date in UTC
			date = new AbsoluteDate(
					new Date(event.getTime()), TimeScalesFactory.getUTC());
		} catch (OrekitException e) {
			logger.error(e);
			return;
		}

		// run update in the event dispatch thread for thread safety
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				yearField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getDate().getYear());
				monthField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getDate().getMonth());
				dayField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getDate().getDay());
				hourField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getTime().getHour());
				minuteField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getTime().getMinute());
				secondField.setValue(date.getComponents(
						(TimeScale)timeScaleCombo.getSelectedItem())
						.getTime().getSecond());
			}
		});
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Registration.ReadModel
{
    public interface IGameDao
    {
    }
}


text:
package net.rlviana.pricegrabber.ws.service.siteItemDatum;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import net.rlviana.pricegrabber.domain.entity.core.SiteItemDatum;

/**
 *
Clase Java para updateSiteItemDatum complex type.
 *
 *
El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
 *
 *

 * <complexType name="updateSiteItemDatum">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="siteItemDatum" type="{http://pricegrabber.rlviana.net/domain/entity/core}site-item-datum" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "updateSiteItemDatum", propOrder = {
    "siteItemDatum"
})
@XmlRootElement(name = "updateSiteItemDatum")
public class UpdateSiteItemDatum
    implements Serializable
{

    private final static long serialVersionUID = 1L;
    protected SiteItemDatum siteItemDatum;

    /**
     * Obtiene el valor de la propiedad siteItemDatum.
     *
     * @return
     *     possible object is
     *     {@link SiteItemDatum }
     *
     */
    public SiteItemDatum getSiteItemDatum() {
        return siteItemDatum;
    }

    /**
     * Define el valor de la propiedad siteItemDatum.
     *
     * @param value
     *     allowed object is
     *     {@link SiteItemDatum }
     *
     */
    public void setSiteItemDatum(SiteItemDatum value) {
        this.siteItemDatum = value;
    }

}


text:
import os.path

from pex.build_system.pep_517 import build_sdist
from pex.build_system.testing import assert_build_sdist
from pex.common import touch
from pex.pip.version import PipVersion
from pex.resolve.configured_resolver import ConfiguredResolver
from pex.result import Error
from pex.testing import make_project
from pex.typing import TYPE_CHECKING
from pex.version import __version__

if TYPE_CHECKING:
    from typing import Any

def test_build_sdist_project_directory_dne(tmpdir):
    # type: (Any) -> None

    project_dir = os.path.join(str(tmpdir), "project_dir")
    dist_dir = os.path.join(str(tmpdir), "dists")
    result = build_sdist(project_dir, dist_dir, PipVersion.VENDORED, ConfiguredResolver.default())
    assert isinstance(result, Error)
    assert str(result).startswith(
        "Project directory {project_dir} does not exist.".format(project_dir=project_dir)
    )

def test_build_sdist_project_directory_is_file(tmpdir):
    # type: (Any) -> None

    project_dir = os.path.join(str(tmpdir), "project_dir")
    touch(project_dir)
    dist_dir = os.path.join(str(tmpdir), "dists")
    result = build_sdist(project_dir, dist_dir, PipVersion.VENDORED, ConfiguredResolver.default())
    assert isinstance(result, Error)
    assert str(result).startswith(
        "Project directory {project_dir} is not a directory.".format(project_dir=project_dir)
    )

def test_build_sdist_setup_py(tmpdir):
    # type: (Any) -> None

    with make_project(name="foo", version="42") as project_dir:
        assert_build_sdist(project_dir, "foo", "42", tmpdir)

def test_build_sdist_pyproject_toml(
    tmpdir,  # type: Any
    pex_project_dir,  # type: str
):
    # type: (...) -> None

    assert_build_sdist(pex_project_dir, "pex", __version__, tmpdir)


text:
@implementation UITextField (LimitLength)

- (void)yyz_setMaxLengthOfInputLimit:(NSUInteger)maxLength
{
    if (maxLength == 0) {
        objc_setAssociatedObject(self,
                                 @selector(yyz_maxLengthOfInputLimit),
                                 nil,
                                 OBJC_ASSOCIATION_ASSIGN);
    } else {
        NSNumber *maxLengthNumber = [NSNumber numberWithUnsignedInteger:maxLength];
        objc_setAssociatedObject(self,
                                 @selector(yyz_maxLengthOfInputLimit),
                                 maxLengthNumber,
                                 OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
}

- (NSUInteger)yyz_maxLengthOfInputLimit
{
    NSNumber *maxLengthNumber = objc_getAssociatedObject(self, _cmd);
    if (maxLengthNumber) {
        return [maxLengthNumber unsignedIntegerValue];
    } else {
        return 0;
    }
}

- (void)yyz_removeMaxLengthOfInputLimit
{
    [self yyz_setMaxLengthOfInputLimit:0];
}

- (BOOL)yyz_filterCharactersBeyondLimit
{
    BOOL beyondLimits = NO;
    NSUInteger maxLengthOfInputLimit =  [self yyz_maxLengthOfInputLimit];
    if (self && maxLengthOfInputLimit) {
        NSString *toBeString = self.text;

        // 获取高亮部分
        UITextRange *selectedRange = [self markedTextRange];
        UITextPosition *position = [self positionFromPosition:selectedRange.start offset:0];

        // 没有高亮选择的字,则对已输入的文字进行字数统计和限制
        if (!position) {
            if (toBeString.length > maxLengthOfInputLimit) {
                beyondLimits = YES;
                NSRange rangeIndex = [toBeString rangeOfComposedCharacterSequenceAtIndex:maxLengthOfInputLimit];
                if (rangeIndex.length == 1) {
                    self.text = [toBeString substringToIndex:maxLengthOfInputLimit];
                } else {
                    self.text = [toBeString substringToIndex:rangeIndex.location];
                }
            }
        }
    }

    return beyondLimits;
}

@end