text:
describe('util', function() {

  describe('with no overrides', function() {

    beforeEach(module('material.core'));

    var $rootScope, $timeout, $$mdAnimate;
    beforeEach(inject(function(_$animate_, _$rootScope_, _$timeout_) {
      $animate = _$animate_;
      $rootScope = _$rootScope_;
      $timeout = _$timeout_;
    }));

    describe('now', function() {

      it('returns proper time values', inject(function($mdUtil, $timeout) {
        var t1 = $mdUtil.now();
        expect(t1).toBeGreaterThan(0);
      }));

    });

    describe('disconnect', function() {
      var disconnectScope, reconnectScope;
      beforeEach(inject(function($mdUtil) {
        disconnectScope = $mdUtil.disconnectScope;
        reconnectScope = $mdUtil.reconnectScope;
      }));

      it('disconnectScope events', inject(function($rootScope) {
        var scope1 = $rootScope.$new();

        var spy = jasmine.createSpy('eventSpy');
        scope1.$on('event', spy);

        disconnectScope(scope1);

        $rootScope.$broadcast('event');
        expect(spy).not.toHaveBeenCalled();

        reconnectScope(scope1);

        $rootScope.$broadcast('event');
        expect(spy).toHaveBeenCalled();
      }));

    });

    describe('supplant', function() {

      it('should replace with HTML arguments', inject(function($mdUtil) {
        var param1 = "", param2 = '' +
              '<md-content>' +
              '   <md-option ng-repeat="value in values" value="{{value}}">' +
              '      {{value}}  ' +
              '   </md-option>  ' +
              '</md-content>    ';
        var template = '
<md-select-menu {0}>{1}</md-select-menu>
';
        var results = $mdUtil.supplant(template,[param1, param2]);
        var segment = '<md-select-menu >';  // After supplant() part of the result should be...

        expect( results.indexOf(segment) > -1 ).toBe(true);

      }));

    });

    describe('findFocusTarget', function() {

      it('should not find valid focus target', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<button></button>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget);

        expect(target).toBeFalsy();
      }));

      it('should find valid a valid focusTarget with "md-autofocus"', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<button md-autofocus></button>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget);

        expect(target[0].nodeName).toBe("BUTTON");
      }));

      it('should find valid a valid focusTarget with "md-auto-focus"', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<button md-auto-focus></button>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget);

        expect(target[0].nodeName).toBe("BUTTON");
      }));

      it('should find valid a valid focusTarget with "md-auto-focus" argument', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<button md-autofocus></button>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget,'[md-auto-focus]');

        expect(target[0].nodeName).toBe("BUTTON");
      }));

      it('should find valid a valid focusTarget with a deep "md-autofocus" argument', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<md-sidenav><button md-autofocus></button></md-sidenav>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget);

        expect(target[0].nodeName).toBe("BUTTON");
      }));

      it('should find valid a valid focusTarget with a deep "md-sidenav-focus" argument', inject(function($rootScope, $compile, $mdUtil) {
        var template = '' +
          '
' +
          '  <md-sidenav>' +
          '    <button md-sidenav-focus>' +
          '      ' +
          '    </button>' +
          '  </md-sidenav>' +
          '
';
        var widget = $compile(template)($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.findFocusTarget(widget,'[md-sidenav-focus]');

        expect(target[0].nodeName).toBe("BUTTON");
      }));
    });

    describe('extractElementByname', function() {

      it('should not find valid element', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<md-button1></md-button1>
')($rootScope);
            $rootScope.$apply();
        var target = $mdUtil.extractElementByName(widget, 'md-button');

        // Returns same element
        expect( target === widget ).toBe(true);
      }));

      it('should not find valid element for shallow scan', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<md-button></md-button>
')($rootScope);
        $rootScope.$apply();
        var target = $mdUtil.extractElementByName(widget, 'md-button');

        expect( target !== widget ).toBe(false);
      }));

      it('should find valid element for deep scan', inject(function($rootScope, $compile, $mdUtil) {
        var widget = $compile('
<md-button></md-button>
')($rootScope);
        $rootScope.$apply();
        var target = $mdUtil.extractElementByName(widget, 'md-button', true);

        expect( target !== widget ).toBe(true);
      }));
    });

    describe('throttle', function() {
      var delay = 500;
      var nowMockValue;
      var originalFn;
      var throttledFn;

      beforeEach(inject(function($mdUtil) {
        $mdUtil.now = function() {
          return nowMockValue;
        };
        originalFn = jasmine.createSpy('originalFn');
        throttledFn = $mdUtil.throttle(originalFn, delay);
        nowMockValue = 1;    // Not 0, to prevent `!recent` inside `throttle()` to
                             // evaluate to true even after `recent` has been set
      }));

      it('should immediately invoke the function on first call', function() {
        expect(originalFn).not.toHaveBeenCalled();
        throttledFn();
        expect(originalFn).toHaveBeenCalled();
      });

      it('should not invoke the function again before (delay + 1) milliseconds', function() {
        throttledFn();
        expect(originalFn.calls.count()).toBe(1);

        throttledFn();
        expect(originalFn.calls.count()).toBe(1);

        nowMockValue += delay;
        throttledFn();
        expect(originalFn.calls.count()).toBe(1);

        nowMockValue += 1;
        throttledFn();
        expect(originalFn.calls.count()).toBe(2);
      });

      it('should pass the context to the original function', inject(function($mdUtil) {
        var obj = {
          called: false,
          fn: function() {
            this.called = true;
          }
        };
        var throttled = $mdUtil.throttle(obj.fn, delay);

        expect(obj.called).toBeFalsy();
        throttled.call(obj);
        expect(obj.called).toBeTruthy();
      }));

      it('should pass the arguments to the original function', function() {
        throttledFn(1, 2, 3, 'test');
        expect(originalFn).toHaveBeenCalledWith(1, 2, 3, 'test');
      });
    });

    describe('nextTick', function() {
      it('should combine multiple calls into a single digest', inject(function($mdUtil, $rootScope, $timeout) {
        var digestWatchFn = jasmine.createSpy('watchFn');
        var callback = jasmine.createSpy('callback');
        var timeout;
        $rootScope.$watch(digestWatchFn);
        expect(digestWatchFn).not.toHaveBeenCalled();
        expect(callback).not.toHaveBeenCalled();
        //-- Add a bunch of calls to prove that they are batched
        for (var i = 0; i < 10; i++) {
          timeout = $mdUtil.nextTick(callback);
          expect(timeout.$$timeoutId).toBeOfType('number');
        }
        $timeout.flush();
        expect(digestWatchFn).toHaveBeenCalled();
        //-- $digest seems to be called one extra time here
        expect(digestWatchFn.calls.count()).toBe(2);
        //-- but callback is still called more
        expect(callback.calls.count()).toBe(10);
      }));
      it('should return a timeout', inject(function($mdUtil) {
        var timeout = $mdUtil.nextTick(angular.noop);
        expect(timeout.$$timeoutId).toBeOfType('number');
      }));
      it('should return the same timeout for multiple calls', inject(function($mdUtil) {
        var a = $mdUtil.nextTick(angular.noop),
          b = $mdUtil.nextTick(angular.noop);
        expect(a).toBe(b);
      }));
    });

    describe('processTemplate', function() {
      it('should return exact template when using the default start/end symbols',
        inject(function($mdUtil) {
          var output = $mdUtil.processTemplate('<some-tag>{{some-var}}</some-tag>');

          expect(output).toEqual('<some-tag>{{some-var}}</some-tag>');
        })
      );
    });
  });

  describe('with $interpolate.start/endSymbol override', function() {
    beforeEach(module(function($interpolateProvider) {
      $interpolateProvider.startSymbol('[[').endSymbol(']]');

      module('material.core');
    }));

    describe('processTemplate', function() {
      it('should replace the start/end symbols', inject(function($mdUtil) {
        var output = $mdUtil.processTemplate('<some-tag>{{some-var}}</some-tag>');

        expect(output).toEqual('<some-tag>[[some-var]]</some-tag>');
      }));
    });
  });

  function flush() {
    $rootScope.$digest();
    $animate.triggerCallbacks();
    $timeout.flush();
  }
});


text:
def init(job):
    from JumpScale.baselib.atyourservice81.AtYourServiceBuild import ensure_container
    ensure_container(job.service, root=True)

def install(job):
    from JumpScale.baselib.atyourservice81.AtYourServiceBuild import build

    def build_func(cuisine):
        cuisine.apps.nodejs.install()

    build(job.service, build_func)

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Alerts e.g. approaching your limit</title>
<link href="styles.css" media="all" rel="stylesheet" type="text/css" />

							Warning: You're approaching your limit. Please upgrade.

										You have 1 free report remaining.

										Add your credit card now to upgrade your account to a premium plan to ensure you don't miss out on any reports.

										Upgrade my account

										Thanks for choosing Acme Inc.

							Unsubscribe from these alerts.


text:
/**
 * Created by khjan on 2017-05-06.
 */
import { Component } from '@angular/core';
import { CarService } from './car.service';
import { FactoryProvider } from './car.service.provider';

@Component({
    selector: 'app-factory-provider',
    template: `

엔진이름 : {{carService.engine.name}}

현재속도 : {{carService.speedMeter.speed}} km/h

최대속도 : {{carService.speedMeter.maxSpeed}} km/h
`,
    providers: [FactoryProvider]
})
export class FactoryProviderComponent {
    constructor(public carService: CarService) {}
}


text:
package com.joptimizer.solvers;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cern.colt.matrix.DoubleFactory1D;
import cern.colt.matrix.DoubleFactory2D;
import cern.colt.matrix.DoubleMatrix1D;
import cern.colt.matrix.DoubleMatrix2D;
import cern.colt.matrix.impl.SparseDoubleMatrix2D;
import cern.colt.matrix.linalg.Algebra;
import cern.jet.math.Mult;

import com.joptimizer.util.ColtUtils;
import com.joptimizer.util.Utils;

/**
 * Solves the KKT system:
 *
 * H.v + [A]T.w = -g,

 * A.v = -h,

 *
 * (H is square and symmetric)
 *
 * @see "S.Boyd and L.Vandenberghe, Convex Optimization, p. 542"
 * @author alberto trivellato (alberto.trivellato@gmail.com)
 */
public abstract class KKTSolver {

	protected DoubleMatrix2D H;
	protected DoubleMatrix2D A;
	protected DoubleMatrix2D AT;
	protected DoubleMatrix1D g;
	protected DoubleMatrix1D h;
	protected double toleranceKKT = Utils.getDoubleMachineEpsilon();
	protected boolean checkKKTSolutionAccuracy;
	protected Algebra ALG = Algebra.DEFAULT;
	protected DoubleFactory2D F2 = DoubleFactory2D.dense;
	protected DoubleFactory1D F1 = DoubleFactory1D.dense;
	protected double defaultScalar = 1.e-6;
	private Log log = LogFactory.getLog(this.getClass().getName());

	/**
	 * Returns two vectors v and w solutions of the KKT system.
	 */
	public abstract DoubleMatrix1D[] solve() throws Exception;

	public void setHMatrix(DoubleMatrix2D HMatrix) {
		this.H = HMatrix;
	}

	public void setAMatrix(DoubleMatrix2D AMatrix) {
		this.A = AMatrix;
		this.AT = ALG.transpose(A);
	}

	public void setGVector(DoubleMatrix1D gVector) {
		this.g = gVector;
	}

	public void setHVector(DoubleMatrix1D hVector) {
		this.h = hVector;
	}

	/**
	 * Acceptable tolerance for system resolution.
	 */
	public void setToleranceKKT(double tolerance) {
		this.toleranceKKT = tolerance;
	}

	public void setCheckKKTSolutionAccuracy(boolean b) {
		this.checkKKTSolutionAccuracy = b;
	}

	protected DoubleMatrix1D[] solveAugmentedKKT() throws Exception{
		log.info("solveAugmentedKKT");
		if(A==null){
			throw new Exception("KKT solution failed");
		}
		KKTSolver kktSolver = new AugmentedKKTSolver();
		kktSolver.setCheckKKTSolutionAccuracy(false);//if the caller has true, then it will make the check, otherwise no check at all
		kktSolver.setHMatrix(H);
		kktSolver.setAMatrix(A);
		kktSolver.setGVector(g);
		kktSolver.setHVector(h);
		return kktSolver.solve();
	}

	protected DoubleMatrix1D[] solveFullKKT() throws Exception{
		log.info("solveFullKKT");
		KKTSolver kktSolver = new FullKKTSolver();
		kktSolver.setCheckKKTSolutionAccuracy(false);//if the caller has true, then it will make the check, otherwise no check at all
		kktSolver.setHMatrix(H);
		kktSolver.setAMatrix(A);
		kktSolver.setGVector(g);
		kktSolver.setHVector(h);
		return kktSolver.solve();
	}

	/**
	 * Check the solution of the system
	 *
	 * 	KKT.x = b
	 *
	 * against the scaled residual
	 *
	 * 	beta < gamma,
	 *
	 * where gamma is a parameter chosen by the user and beta is
	 * the scaled residual,
	 *
	 * 	beta = ||KKT.x-b||_oo/( ||KKT||_oo . ||x||_oo + ||b||_oo ),
	 * with ||x||_oo = max(||x[i]||)
	 */
	protected boolean checkKKTSolutionAccuracy(DoubleMatrix1D v, DoubleMatrix1D w) {
		DoubleMatrix2D KKT = null;
		DoubleMatrix1D x = null;
		DoubleMatrix1D b = null;

		if (this.A != null) {
			if(this.AT==null){
				this.AT = ALG.transpose(A);
			}
			if(h!=null){
				//H.v + [A]T.w = -g
				//A.v = -h
				DoubleMatrix2D[][] parts = {
						{ this.H, this.AT },
						{ this.A, null } };
				if(H instanceof SparseDoubleMatrix2D && A instanceof SparseDoubleMatrix2D){
					KKT = DoubleFactory2D.sparse.compose(parts);
				}else{
					KKT = DoubleFactory2D.dense.compose(parts);
				}
				x = F1.append(v, w);
				b = F1.append(g, h).assign(Mult.mult(-1));
			}else{
				//H.v + [A]T.w = -g
				DoubleMatrix2D[][] parts = {{ this.H, this.AT }};
				if(H instanceof SparseDoubleMatrix2D && A instanceof SparseDoubleMatrix2D){
					KKT = DoubleFactory2D.sparse.compose(parts);
				}else{
					KKT = DoubleFactory2D.dense.compose(parts);
				}
				x = F1.append(v, w);
				//b = g.copy().assign(Mult.mult(-1));
				b = ColtUtils.scalarMult(g, -1);
			}
		}else{
			//H.v = -g
			KKT = this.H;
			x = v;
			//b = g.copy().assign(Mult.mult(-1));
			b = ColtUtils.scalarMult(g, -1);
		}

		//checking residual
		double scaledResidual = Utils.calculateScaledResidual(KKT, x, b);
		log.debug("KKT inversion scaled residual: " + scaledResidual);
		return scaledResidual < toleranceKKT;
	}

	/**
	 * Create a full data matrix starting form a symmetric matrix filled only in its subdiagonal elements.
	 */
	protected DoubleMatrix2D createFullDataMatrix(DoubleMatrix2D SubDiagonalSymmMatrix){
		int c = SubDiagonalSymmMatrix.columns();
		DoubleMatrix2D ret = F2.make(c, c);
		for(int i=0; i<c; i++){
			for(int j=0; j<=i; j++){
				ret.setQuick(i, j, SubDiagonalSymmMatrix.getQuick(i, j));
				ret.setQuick(j, i, SubDiagonalSymmMatrix.getQuick(i, j));
			}
		}
		return ret;
	}
}


text:
If you would like to contribute please read OpenTelemetry Collector [contributing
guidelines](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md) before you begin your
work.

## Pull-request title

The title for your pull-request should contain the component type and name in brackets, plus a short statement for your
change. For instance:

    [processor/tailsampling] fix AND policy

## Changelog

Pull requests that contain user-facing changes will require a changelog entry. Keep in mind the following types of users:
1. Those who are consuming the telemetry exported from the collector
2. Those who are deploying or otherwise managing the collector or its configuration
3. Those who are depending on APIs exported from collector packages
4. Those who are contributing to the repository

The changelog is primarily directed at the first three groups but it is sometimes appropriate to include important updates relevant only to the forth group.

If a changelog entry is not required, a maintainer or approver will add the `Skip Changelog` label to the pull request.

**Examples**

Changelog entry required:
- Changes to the configuration of the collector or any component
- Changes to the telemetry emitted from and/or processed by the collector
- Changes to the prerequisites or assumptions for running a collector
- Changes to an API exported by a collector package
- Meaningful changes to the performance of the collector

Judgement call:
- Major changes to documentation
- Major changes to tests or test frameworks
- Changes to developer tooling in the repo

No changelog entry:
- Typical documentation updates
- Refactorings with no meaningful change in functionality
- Most changes to tests
- Chores, such as enabling linters, or minor changes to the CI process

### Adding a Changelog Entry

The [CHANGELOG.md](./CHANGELOG.md) file in this repo is autogenerated from `.yaml` files in the `./.chloggen` directory.

Your pull-request should add a new `.yaml` file to this directory. The name of your file must be unique since the last release.

During the collector release process, all `./.chloggen/*.yaml` files are transcribed into `CHANGELOG.md` and then deleted.

**Recommended Steps**
1. Create an entry file using `make chlog-new`. This generates a file based on your current branch (e.g. `./.chloggen/my-branch.yaml`)
2. Fill in all fields in the new file
3. Run `make chlog-validate` to ensure the new file is valid
4. Commit and push the file

Alternately, copy `./.chloggen/TEMPLATE.yaml`, or just create your file from scratch.

## Adding New Components

**Before** any code is written, [open an
issue](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/new?assignees=&labels=new+component&template=new_component.md&title=New%20component)
providing the following information:

* Who's the sponsor for your component. A sponsor is an approver who will be in charge of being the official reviewer of
  the code and become a code owner for the component. For vendor-specific components, it's good to have a volunteer
  sponsor. If you can't find one, we'll assign one in a round-robin fashion. A vendor-specific component directly interfaces
  with a vendor-specific API and is expected to be maintained by a representative of the same vendor. For non-vendor specific
  components, having a sponsor means that your use case has been validated.
* Some information about your component, such as the reasoning behind it, use-cases, telemetry data types supported, and
  anything else you think is relevant for us to make a decision about accepting the component.
* The configuration options your component will accept. This will help us understand what it does and have an idea of
  how the implementation might look like.

Components comprise of exporters, extensions, receivers, and processors. The key criteria to implementing a component is to:

* Implement the [component.Component](https://pkg.go.dev/go.opentelemetry.io/collector/component#Component) interface
* Provide a configuration structure which defines the configuration of the component
* Provide the implementation which performs the component operation

Familiarize yourself with the interface of the component that you want to write, and use existing implementations as reference.
[Building a Trace Receiver](https://opentelemetry.io/docs/collector/trace-receiver/) tutorial provides a detailed example of building a component.

*NOTICE:* The Collector is in Beta stage and as such the interfaces may undergo breaking changes. Component creators
must be available to update or review their components when such changes happen, otherwise the component will be
excluded from the default builds.

Generally, maintenance of components is the responsibility of contributors who authored them. If the original author or
some other contributor does not maintain the component it may be excluded from the default build. The component **will**
be excluded if it causes build problems, has failing tests or otherwise causes problems to the rest of the repository
and the rest of contributors.

- Create your component under the proper folder and use Go standard package naming recommendations.
- Use a boiler-plate Makefile that just references the one at top level, ie.: `include ../../Makefile.Common` - this
  allows you to build your component with required build configurations for the contrib repo while avoiding building the
  full repo during development.
- Each component has its own go.mod file. This allows custom builds of the collector to take a limited sets of
  dependencies - so run `go mod` commands as appropriate for your component.
- Implement the needed interface on your component by importing the appropriate component from the core repo. Follow the
  pattern of existing components regarding config and factory source files and tests.
- Implement your component as appropriate. Provide end-to-end tests (or mock backend/client as appropriate). Target is
  to get 80% or more of code coverage.
- Add a README.md on the root of your component describing its configuration and usage, likely referencing some of the
  yaml files used in the component tests. We also suggest that the yaml files used in tests have comments for all
  available configuration settings so users can copy and modify them as needed.
- Add a `replace` directive at the root `go.mod` file so your component is included in the build of the contrib
  executable.
- Add your component to `versions.yaml`.
- All components must be included in [`internal/components/`](./internal/components) and in the respective testing
  harnesses. To align with the test goal of the project, components must be testable within the framework defined within
  the folder. If a component can not be properly tested within the existing framework, it must increase the non testable
  components number with a comment within the PR explaining as to why it can not be tested.
- Add the sponsor for your component and yourself to a new line for your component in the
  [`.github/CODEOWNERS`](./.github/CODEOWNERS) file.
- Run `make generate-gh-issue-templates` to add your component to the dropdown list in the issue templates.

### Releasing New Components
After a component has been approved and merged, and has been enabled in `internal/components/`, it must be added to the
[OpenTelemetry Collector Contrib's release manifest.yaml](https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/distributions/otelcol-contrib/manifest.yaml)
to be included in the distributed otelcol-contrib binaries and docker images.

### Rotating sponsors

The following GitHub users are the currently available sponsors, either by being an approver or a maintainer of the contrib repository. The list is ordered based on a random sort of the list of sponsors done live at the Collector SIG meeting on 27-Apr-2022 and serves as the seed for the round-robin selection of sponsors, as described in the section above.

* [@bogdandrutu](https://github.com/bogdandrutu)
* [@dashpole](https://github.com/dashpole)
* [@TylerHelmuth](https://github.com/TylerHelmuth)
* [@djaglowski](https://github.com/djaglowski)
* [@codeboten](https://github.com/codeboten)
* [@Aneurysm9](https://github.com/Aneurysm9)
* [@mx-psi](https://github.com/mx-psi)
* [@jpkrohling](https://github.com/jpkrohling)
* [@dmitryax](https://github.com/dmitryax)
* [@evan-bradley](https://github.com/evan-bradley)
* [@MovieStoreGuy](https://github.com/MovieStoreGuy)

Whenever a sponsor is picked from the top of this list, please move them to the bottom.

## Adding metrics to existing receivers
Following these steps for contributing additional metrics to existing receivers.
 - Read instructions [here](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CONTRIBUTING.md#fork) on how to
   fork, build and create PRs. The only difference is to change repository name from `opentelemetry-collector` to `opentelemetry-collector-contrib`
 - Edit `metadata.yaml` of your metrics receiver to add new metrics, e.g.: `redisreceiver/metadata.yaml`
 - To generate new metrics on top of this updated YAML file.
   - Run `cd receiver/redisreceiver`
   - Run `go generate ./...`
- Review the changed files and merge the changes into your forked repo.
- Create PR from Github web console following the instructions above.

## General Recommendations
Below are some recommendations that apply to typical components. These are not rigid rules and there are exceptions but
in general try to follow them.

- Avoid introducing batching, retries or worker pools directly on receivers and exporters. Typically, these are general
  cases that can be better handled via processors (that also can be reused by other receivers and exporters).
- When implementing exporters try to leverage the exporter helpers from the core repo, see [exporterhelper
  package](https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter/exporterhelper). This will
  ensure that the exporter provides [zPages](https://opencensus.io/zpages/) and a standard set of metrics.
- `replace` statements in `go.mod` files can be automatically inserted by running `make crosslink`. For more information
  on the `crosslink` tool see the README [here](https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/crosslink).

## Adding Labels via Comments

In order to facilitate proper label usage and to empower Code Owners, you are able to add labels to issues via comments. To add a label through a comment, post a new comment on an issue starting with `/label`, followed by a space-separated list of your desired labels. Supported labels come from the table below, or correspond to a component defined in the [CODEOWNERS file](.github/CODEOWNERS).

The following general labels are supported:

| Label                | Label in Comment     |
|----------------------|----------------------|
| `good first issue`   | `good-first-issue`   |
| `help wanted`        | `help-wanted`        |
| `needs discussion`   | `needs-discussion`   |
| `needs triage`       | `needs-triage`       |
| `waiting for author` | `waiting-for-author` |

To delete a label, prepend the label with `-`. Note that you must make a new comment to modify labels; you cannot edit an existing comment.

Example label comment:

```
/label receiver/prometheus help-wanted -exporter/prometheus
```

## Becoming a Code Owner

A Code Owner is responsible for a component within Collector Contrib, as indicated by the [CODEOWNERS file](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/.github/CODEOWNERS). That responsibility includes maintaining the component, responding to issues, and reviewing pull requests.

Sometimes a component may be in need of a new or additional Code Owner. A few reasons this situation may arise would be:
- The component was never assigned a Code Owner.
- A previous Code Owner stepped down.
- An existing Code Owner has become unresponsive. See [unmaintained stability status](https://github.com/open-telemetry/opentelemetry-collector#unmaintained).
- The existing Code Owners are actively looking for new Code Owners to help.

If you would like to help and become a Code Owner you must meet the following requirements:

1. [Be a member of the OpenTelemetry organization.](https://github.com/open-telemetry/community/blob/main/community-membership.md#member)
2. (Code Owner Discretion) It is best to have resolved an issue related to the component, contributed directly to the component, and/or review component PRs. How much interaction with the component is required before becoming a Code Owner is up to any existing Code Owners.

Code Ownership is ultimately up to the judgement of the existing Code Owners and Collector Contrib Maintainers. Meeting the above requirements is not a guarantee to be granted Code Ownership.

To become a Code Owner, open a PR with the CODEOWNERS file modified, adding your GitHub username to the component's row. Be sure to tag the existing Code Owners, if any, within the PR to ensure they receive a notification.


text:
package com.example.contactmgr.shared.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.googlecode.objectify.Ref;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;

/**
 * Created by david on 2/26/15.
 */
@Entity
public class Contact implements Owned {

    @Id
    private Long id;
    @JsonIgnore
    @Index
    private Ref<User> ownerKey;
    private String firstName;
    private String lastName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    @Override
    public Ref<User> getOwnerKey() {
        return ownerKey;
    }

    @Override
    public void setOwnerKey(Ref<User> owner) {
        ownerKey = owner;
    }
}


text:
$(function(){

    $('#collapseBasic').collapse('show');
    $('#collapseDocs').collapse('show');
    $('#collapseContact1').collapse('show');

});


text:
Retrieve EC2 public-ipv4 from instance metadata.

Note: this assumes that a metadata service is available at http://169.254.169.254/. Thus it works on EC2 instances, behavior on other machines is undefined.

## Install

```bash
    npm install ec2-publicip
```

## Example

```javascript
    var ec2 = require("ec2-publicip");

    ec2.getPublicIP(function (error, ip) {
    	if (error) {
    		console.log(error);
    	}
        console.log("Instance Public IP: ", ip);
    });
```

## Details

Public IPV4 of Amazon EC2 instances can be retrieved via http GET calls to http://169.254.169.254/latest/meta-data
This module gets the public IPV4 from meta-data api.

## Change Log
- 1.0.4: Dependencies update.
- 1.0.3: Dependencies update.
- 1.0.2: Added [example](https://tonicdev.com/npm/ec2-publicip).
- 1.0.1: Added documentation.
- 1.0.0: Basic getPublicIP with timeout error.

## License

MIT


text:
package com.ibm.watson.discovery.v1.model;

import static org.testng.Assert.*;

import com.ibm.cloud.sdk.core.service.model.FileWithMetadata;
import com.ibm.watson.discovery.v1.utils.TestUtilities;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.testng.annotations.Test;

/** Unit test class for the MetricTokenAggregationResult model. */
public class MetricTokenAggregationResultTest {
  final HashMap<String, InputStream> mockStreamMap = TestUtilities.createMockStreamMap();
  final List<FileWithMetadata> mockListFileWithMetadata =
      TestUtilities.creatMockListFileWithMetadata();

  @Test
  public void testMetricTokenAggregationResult() throws Throwable {
    MetricTokenAggregationResult metricTokenAggregationResultModel =
        new MetricTokenAggregationResult();
    assertNull(metricTokenAggregationResultModel.getKey());
    assertNull(metricTokenAggregationResultModel.getMatchingResults());
    assertNull(metricTokenAggregationResultModel.getEventRate());
  }
}


text:
package io.github.winsontse.hearteyes.page.account.module;

import dagger.Module;
import dagger.Provides;
import io.github.winsontse.hearteyes.page.account.contract.AssociationContract;
import io.github.winsontse.hearteyes.util.scope.ActivityScope;
import io.github.winsontse.hearteyes.util.scope.FragmentScope;

@Module
public class AssociationModule {
    private AssociationContract.View view;

    public AssociationModule(AssociationContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    AssociationContract.View provideAssosiationView() {
        return view;
    }
}


text:
package com.google.javascript.jscomp;

import com.google.javascript.jscomp.CompilerOptions.Reach;

/**
 * A CompilationLevel represents the level of optimization that should be
 * applied when compiling JavaScript code.
 *
 * @author bolinfest@google.com (Michael Bolin)
 */
public enum CompilationLevel {

  /**
   * WHITESPACE_ONLY removes comments and extra whitespace in the input JS.
   */
  WHITESPACE_ONLY,

  /**
   * SIMPLE_OPTIMIZATIONS performs transformations to the input JS that do not
   * require any changes to JS that depend on the input JS. For example,
   * function arguments are renamed (which should not matter to code that
   * depends on the input JS), but functions themselves are not renamed (which
   * would otherwise require external code to change to use the renamed function
   * names).
   */
  SIMPLE_OPTIMIZATIONS,

  /**
   * ADVANCED_OPTIMIZATIONS aggressively reduces code size by renaming function
   * names and variables, removing code which is never called, etc.
   */
  ADVANCED_OPTIMIZATIONS,
  ;

  private CompilationLevel() {}

  public void setOptionsForCompilationLevel(CompilerOptions options) {
    switch (this) {
      case WHITESPACE_ONLY:
        applyBasicCompilationOptions(options);
        break;
      case SIMPLE_OPTIMIZATIONS:
        applySafeCompilationOptions(options);
        break;
      case ADVANCED_OPTIMIZATIONS:
        applyFullCompilationOptions(options);
        break;
      default:
        throw new RuntimeException("Unknown compilation level.");
    }
  }

  public void setDebugOptionsForCompilationLevel(CompilerOptions options) {
    options.anonymousFunctionNaming = AnonymousFunctionNamingPolicy.UNMAPPED;
    options.generatePseudoNames = true;
    options.removeClosureAsserts = false;
    // Don't shadow variables as it is too confusing.
    options.shadowVariables = false;
  }

  /**
   * Gets options that only strip whitespace and comments.
   * @param options The CompilerOptions object to set the options on.
   */
  private static void applyBasicCompilationOptions(CompilerOptions options) {
    options.skipAllCompilerPasses();
  }

  /**
   * Add options that are safe. Safe means options that won't break the
   * JavaScript code even if no symbols are exported and no coding convention
   * is used.
   * @param options The CompilerOptions object to set the options on.
   */
  private static void applySafeCompilationOptions(CompilerOptions options) {
    // ReplaceIdGenerators is on by default, but should run in simple mode.
    options.replaceIdGenerators = false;

    // Does not call applyBasicCompilationOptions(options) because the call to
    // skipAllCompilerPasses() cannot be easily undone.
    options.dependencyOptions.setDependencySorting(true);
    options.closurePass = true;
    options.setRenamingPolicy(
        VariableRenamingPolicy.LOCAL, PropertyRenamingPolicy.OFF);
    options.shadowVariables = true;
    options.setInlineVariables(Reach.LOCAL_ONLY);
    options.flowSensitiveInlineVariables = true;
    options.setInlineFunctions(Reach.LOCAL_ONLY);
    options.setAssumeClosuresOnlyCaptureReferences(false);
    options.checkGlobalThisLevel = CheckLevel.OFF;
    options.foldConstants = true;
    options.coalesceVariableNames = true;
    options.deadAssignmentElimination = true;
    options.collapseVariableDeclarations = true;
    options.convertToDottedProperties = true;
    options.labelRenaming = true;
    options.removeDeadCode = true;
    options.optimizeArgumentsArray = true;
    options.setRemoveUnusedVariables(Reach.LOCAL_ONLY);
    options.collapseObjectLiterals = true;
    options.protectHiddenSideEffects = true;
  }

  /**
   * Add the options that will work only if the user exported all the symbols
   * correctly.
   * @param options The CompilerOptions object to set the options on.
   */
  private static void applyFullCompilationOptions(CompilerOptions options) {
    // Do not call applySafeCompilationOptions(options) because the call can
    // create possible conflicts between multiple diagnostic groups.

    // All the safe optimizations.
    options.dependencyOptions.setDependencySorting(true);
    options.closurePass = true;
    options.foldConstants = true;
    options.coalesceVariableNames = true;
    options.deadAssignmentElimination = true;
    options.extractPrototypeMemberDeclarations = true;
    options.collapseVariableDeclarations = true;
    options.convertToDottedProperties = true;
    options.labelRenaming = true;
    options.removeDeadCode = true;
    options.optimizeArgumentsArray = true;
    options.collapseObjectLiterals = true;
    options.protectHiddenSideEffects = true;

    // All the advanced optimizations.
    options.removeClosureAsserts = true;
    options.reserveRawExports = true;
    options.setRenamingPolicy(
        VariableRenamingPolicy.ALL, PropertyRenamingPolicy.ALL_UNQUOTED);
    options.shadowVariables = true;
    options.removeUnusedPrototypeProperties = true;
    options.removeUnusedPrototypePropertiesInExterns = true;
    options.removeUnusedClassProperties = true;
    options.collapseAnonymousFunctions = true;
    options.collapseProperties = true;
    options.checkGlobalThisLevel = CheckLevel.WARNING;
    options.rewriteFunctionExpressions = false;
    options.smartNameRemoval = true;
    options.inlineConstantVars = true;
    options.setInlineFunctions(Reach.ALL);
    options.setAssumeClosuresOnlyCaptureReferences(false);
    options.inlineGetters = true;
    options.setInlineVariables(Reach.ALL);
    options.flowSensitiveInlineVariables = true;
    options.computeFunctionSideEffects = true;

    // Remove unused vars also removes unused functions.
    options.setRemoveUnusedVariables(Reach.ALL);

    // Move code around based on the defined modules.
    options.crossModuleCodeMotion = true;
    options.crossModuleMethodMotion = true;

    // Call optimizations
    options.devirtualizePrototypeMethods = true;
    options.optimizeParameters = true;
    options.optimizeReturns = true;
    options.optimizeCalls = true;
  }

  /**
   * Enable additional optimizations that use type information.
   * @param options The CompilerOptions object to set the options on.
   */
  public void setTypeBasedOptimizationOptions(CompilerOptions options) {
    switch (this) {
      case ADVANCED_OPTIMIZATIONS:
        options.inferTypes = true;
        options.disambiguateProperties = true;
        options.ambiguateProperties = true;
        options.inlineProperties = true;
        break;
      case SIMPLE_OPTIMIZATIONS:
        // TODO(johnlenz): enable peephole type based optimization.
        break;
      case WHITESPACE_ONLY:
        break;
    }
  }
}


text:
import {Vector} from './Vector';

export class Rectangle {

	public x: number;
	public y: number;
	public width: number;
	public height: number;

	protected constructor(x?: number, y?: number, width?: number, height?: number) {
		this.set(x, y, width, height);
	}

	public get top(): number {
		return this.y;
	}

	public set top(top: number) {
		this.height += this.y - top;
		this.y = top;
	}

	public get bottom(): number {
		return this.y + this.height;
	}

	public set bottom(bottom: number) {
		this.height = bottom - this.y;
	}

	public get left(): number {
		return this.x;
	}

	public set left(left: number) {
		this.width += this.x - left;
		this.x = left;
	}

	public get right(): number {
		return this.x + this.width;
	}

	public set right(right: number) {
		this.width = right - this.x;
	}

	public get topLeft(): Vector {
		return Vector.create(this.left, this.top);
	}

	public set topLeft(v: Vector) {
		this.top = v.y;
		this.left = v.x;
	}

	public get bottomRight(): Vector {
		return Vector.create(this.right, this.bottom);
	}

	public set bottomRight(v: Vector) {
		this.bottom = v.y;
		this.right = v.x;
	}

	public set(x: number, y: number, width: number, height: number): this {
		this.x = x || 0;
		this.y = y || 0;
		this.width = width || 0;
		this.height = height || 0;
		return this;
	}

	public contains(v: Vector): boolean;
	public contains(x: number, y: number): boolean;
	public contains(x: number | Vector, y?: number): boolean {
		if (x instanceof Vector) {
			return this.contains(x.x, x.y);
		}
		return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.height;
	}

	public equal(r: Rectangle): boolean {
		return r instanceof Rectangle &&
			r.x === this.x && r.y === this.y && r.width === this.width && r.height === this.height;
	}

	public release(): void {
		Rectangle.recycle(this);
	}

	protected static readonly $pool: Array<Rectangle> = [];

	public static create(x?: number, y?: number, width?: number, height?: number): Rectangle {
		let pool = this.$pool;
		if (pool.length > 0) {
			return pool.pop().set(x, y, width, height);
		} else {
			return new Rectangle(x, y, width, height);
		}
	}

	public static recycle(r: Rectangle) {
		this.$pool.push(r);
	}
}


text:
@implementation NSString (OKChinese)

- (BOOL)ok_isContainChinese {
    NSUInteger length = [self length];
    for (NSUInteger i = 0; i < length; i++) {
        NSRange range = NSMakeRange(i, 1);
        NSString *subString = [self substringWithRange:range];
        const char *cString = [subString UTF8String];
        if (strlen(cString) == 3) {
            return YES;
        }
    }
    return NO;
}

- (NSString *)ok_pinyinWithPhoneticSymbol {
    NSMutableString *pinyin = [NSMutableString stringWithString:self];
    CFStringTransform((__bridge CFMutableStringRef)(pinyin), NULL, kCFStringTransformMandarinLatin, NO);
    return pinyin;
}

- (NSString *)ok_pinyin {
    NSMutableString *pinyin = [NSMutableString stringWithString:[self ok_pinyinWithPhoneticSymbol]];
    CFStringTransform((__bridge CFMutableStringRef)(pinyin), NULL, kCFStringTransformStripCombiningMarks, NO);
    return pinyin;
}

- (NSArray *)ok_pinyinArray {
    NSArray *array = [[self ok_pinyin] componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    return array;
}

- (NSString *)ok_pinyinWithoutBlank {
    NSMutableString *string = [NSMutableString stringWithString:@""];
    for (NSString *str in [self ok_pinyinArray]) {
        [string appendString:str];
    }
    return string;
}

- (NSArray *)ok_pinyinInitialsArray {
    NSMutableArray *array = [NSMutableArray array];
    for (NSString *str in [self ok_pinyinArray]) {
        if ([str length] > 0) {
            [array addObject:[str substringToIndex:1]];
        }
    }
    return array;
}

- (NSString *)ok_pinyinInitialsString {
    NSMutableString *pinyin = [NSMutableString stringWithString:@""];
    for (NSString *str in [self ok_pinyinArray]) {
        if ([str length] > 0) {
            [pinyin appendString:[str substringToIndex:1]];
        }
    }
    return pinyin;
}

@end


text:
set OLD_PATH=%PATH%
IF NOT EXIST "%VS100COMNTOOLS%vsvars32.bat" GOTO NO_VS10
call "%VS100COMNTOOLS%vsvars32.bat"
nmake -f makefile.vc DEBUG=0 SHARE=0 clean
nmake -f makefile.vc DEBUG=1 SHARE=0 clean
nmake -f makefile.vc DEBUG=0 SHARE=1 clean
nmake -f makefile.vc DEBUG=1 SHARE=1 clean
:NO_VS10
set PATH="E:\Compilers\Embarcadero\RAD Studio\7.0\bin"
make -f makefile.bcc DEBUG=0 SHARE=0 clean
make -f makefile.bcc DEBUG=1 SHARE=0 clean
make -f makefile.bcc DEBUG=0 SHARE=1 clean
make -f makefile.bcc DEBUG=1 SHARE=1 clean
set PATH=E:\Compilers\MinGW\bin
mingw32-make -f makefile.mgw DEBUG=0 SHARE=0 clean
mingw32-make -f makefile.mgw DEBUG=1 SHARE=0 clean
mingw32-make -f makefile.mgw DEBUG=0 SHARE=1 clean
mingw32-make -f makefile.mgw DEBUG=1 SHARE=1 clean
IF NOT EXIST "%ICPP_COMPILER11%bin\iclvars.bat" GOTO NO_INTEL
call "%ICPP_COMPILER11%bin\iclvars.bat" ia32
nmake -f makefile.icw DEBUG=0 SHARE=0 clean
nmake -f makefile.icw DEBUG=1 SHARE=0 clean
nmake -f makefile.icw DEBUG=0 SHARE=1 clean
nmake -f makefile.icw DEBUG=1 SHARE=1 clean
:NO_INTEL
set PATH=%OLD_PATH%
pause


text:
// ---------------------------------------------------------------------
// pion:  a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2012 Cloudmeter, Inc.  (http://www.cloudmeter.com)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//

#ifndef __PION_TCP_STREAM_HEADER__
#define __PION_TCP_STREAM_HEADER__

#include <cstring>
#include <istream>
#include <streambuf>
#include <boost/bind.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <pion/config.hpp>
#include <pion/tcp/connection.hpp>

namespace pion {    // begin namespace pion
namespace tcp {     // begin namespace tcp

///
/// stream_buffer: std::basic_streambuf wrapper for TCP network connections.
///                  Based in part on section 13.13.3 of "The Standard C++ Library"
///                  by Nicolai M. Josuttis, published in 1999 by Addison-Wesley
///
class stream_buffer
    : public std::basic_streambuf<char, std::char_traits<char> >
{
public:

    // data type definitions required for iostream compatability
    typedef char                                char_type;
    typedef std::char_traits<char>::int_type    int_type;
    typedef std::char_traits<char>::off_type    off_type;
    typedef std::char_traits<char>::pos_type    pos_type;
    typedef std::char_traits<char>              traits_type;

    // some integer constants used within stream_buffer
    enum {
        PUT_BACK_MAX = 10,  //< number of bytes that can be put back into the read buffer
        WRITE_BUFFER_SIZE = 8192    //< size of the write buffer
    };

    /**
     * constructs a TCP stream buffer object for an existing TCP connection
     *
     * @param conn_ptr pointer to the TCP connection to use for reading & writing
     */
    explicit stream_buffer(tcp::connection_ptr& conn_ptr)
        : m_conn_ptr(conn_ptr), m_read_buf(m_conn_ptr->get_read_buffer().c_array())
    {
        setup_buffers();
    }

    /**
     * constructs a TCP stream buffer object for a new TCP connection
     *
     * @param io_service asio service associated with the connection
     * @param ssl_flag if true then the connection will be encrypted using SSL
     */
    explicit stream_buffer(boost::asio::io_service& io_service,
                             const bool ssl_flag = false)
        : m_conn_ptr(new connection(io_service, ssl_flag)),
        m_read_buf(m_conn_ptr->get_read_buffer().c_array())
    {
        setup_buffers();
    }

    /**
     * constructs a TCP stream buffer object for a new SSL/TCP connection
     *
     * @param io_service asio service associated with the connection
     * @param ssl_context asio ssl context associated with the connection
     */
    stream_buffer(boost::asio::io_service& io_service,
                    connection::ssl_context_type& ssl_context)
        : m_conn_ptr(new connection(io_service, ssl_context)),
        m_read_buf(m_conn_ptr->get_read_buffer().c_array())
    {
        setup_buffers();
    }

    /// virtual destructor flushes the write buffer
    virtual ~stream_buffer() { sync(); }

    /// returns a reference to the current TCP connection
    connection& get_connection(void) { return *m_conn_ptr; }

    /// returns a const reference to the current TCP connection
    const connection& get_connection(void) const { return *m_conn_ptr; }

protected:

    /// sets up the read and write buffers for input and output
    inline void setup_buffers(void) {
        // use the TCP connection's read buffer and allow for bytes to be put back
        setg(m_read_buf+PUT_BACK_MAX, m_read_buf+PUT_BACK_MAX, m_read_buf+PUT_BACK_MAX);
        // set write buffer size-1 so that we have an extra char avail for overflow
        setp(m_write_buf, m_write_buf+(WRITE_BUFFER_SIZE-1));
    }

    /**
     * writes data in the output buffer to the TCP connection
     *
     * @return int_type the number of bytes sent, or eof() if there was an error
     */
    inline int_type flush_output(void) {
        const std::streamsize bytes_to_send = std::streamsize(pptr() - pbase());
        int_type bytes_sent = 0;
        if (bytes_to_send > 0) {
            boost::mutex::scoped_lock async_lock(m_async_mutex);
            m_bytes_transferred = 0;
            m_conn_ptr->async_write(boost::asio::buffer(pbase(), bytes_to_send),
                                    boost::bind(&stream_buffer::operation_finished, this,
                                                boost::asio::placeholders::error,
                                                boost::asio::placeholders::bytes_transferred));
            m_async_done.wait(async_lock);
            bytes_sent = m_bytes_transferred;
            pbump(-bytes_sent);
            if (m_async_error)
                bytes_sent = traits_type::eof();
        }
        return bytes_sent;
    }

    /**
     * this function is called when the read buffer has no more characters available
     *
     * @return int_type the next character available for reading, or eof() if there was an error
     */
    virtual int_type underflow(void) {
        // first check if we still have bytes available in the read buffer
        if (gptr() < egptr())
            return traits_type::to_int_type(*gptr());

        // calculate the number of bytes we will allow to be put back
        std::streamsize put_back_num = std::streamsize(gptr() - eback());
        if (put_back_num > PUT_BACK_MAX)
            put_back_num = PUT_BACK_MAX;

        // copy the last bytes read to the beginning of the buffer (for put back)
        if (put_back_num > 0)
            memmove(m_read_buf+(PUT_BACK_MAX-put_back_num), gptr()-put_back_num, put_back_num);

        // read data from the TCP connection
        // note that this has to be an ansynchronous call; otherwise, it cannot
        // be cancelled by other threads and will block forever (such as during shutdown)
        boost::mutex::scoped_lock async_lock(m_async_mutex);
        m_bytes_transferred = 0;
        m_conn_ptr->async_read_some(boost::asio::buffer(m_read_buf+PUT_BACK_MAX,
                                                        connection::READ_BUFFER_SIZE-PUT_BACK_MAX),
                                    boost::bind(&stream_buffer::operation_finished, this,
                                                boost::asio::placeholders::error,
                                                boost::asio::placeholders::bytes_transferred));
        m_async_done.wait(async_lock);
        if (m_async_error)
            return traits_type::eof();

        // reset buffer pointers now that data is available
        setg(m_read_buf+(PUT_BACK_MAX-put_back_num),            //< beginning of putback bytes
             m_read_buf+PUT_BACK_MAX,                           //< read position
             m_read_buf+PUT_BACK_MAX+m_bytes_transferred);      //< end of buffer

        // return next character available
        return traits_type::to_int_type(*gptr());
    }

    /**
     * this function is called when the write buffer for the stream is full
     *
     * @param c character that has not been written yet, or eof() if we are flushing
     * @return int_type the last character written, or eof() if there was an error
     */
    virtual int_type overflow(int_type c) {
        if (! traits_type::eq_int_type(c, traits_type::eof())) {
            // character is not eof -> add it to the end of the write buffer
            // we can push this to the back of the write buffer because we set
            // the size of the write buffer to 1 less than the actual size using setp()
            *pptr() = c;
            pbump(1);
        }
        // flush data in the write buffer by sending it to the TCP connection
        return ((flush_output() == traits_type::eof())
                ? traits_type::eof() : traits_type::not_eof(c));
    }

    /**
     * writes a sequence of characters
     *
     * @param s pointer to a sequence of characters
     * @param n number of characters in the sequence to write
     *
     * @return std::streamsize number of character written
     */
    virtual std::streamsize xsputn(const char_type *s, std::streamsize n) {
        const std::streamsize bytes_available = std::streamsize(epptr() - pptr());
        std::streamsize bytes_sent = 0;
        if (bytes_available >= n) {
            // there is enough room in the buffer -> just put it in there
            memcpy(pptr(), s, n);
            pbump(n);
            bytes_sent = n;
        } else {
            // there is not enough room left in the buffer
            if (bytes_available > 0) {
                // fill up the buffer
                memcpy(pptr(), s, bytes_available);
                pbump(bytes_available);
            }
            // flush data in the write buffer by sending it to the TCP connection
            if (flush_output() == traits_type::eof())
                return 0;
            if ((n-bytes_available) >= (WRITE_BUFFER_SIZE-1)) {
                // the remaining data to send is larger than the buffer available
                // send it all now rather than buffering
                boost::mutex::scoped_lock async_lock(m_async_mutex);
                m_bytes_transferred = 0;
                m_conn_ptr->async_write(boost::asio::buffer(s+bytes_available,
                                                            n-bytes_available),
                                        boost::bind(&stream_buffer::operation_finished, this,
                                                    boost::asio::placeholders::error,
                                                    boost::asio::placeholders::bytes_transferred));
                m_async_done.wait(async_lock);
                bytes_sent = bytes_available + m_bytes_transferred;
            } else {
                // the buffer is larger than the remaining data
                // put remaining data to the beginning of the output buffer
                memcpy(pbase(), s+bytes_available, n-bytes_available);
                pbump(n-bytes_available);
                bytes_sent = n;
            }
        }
        return bytes_sent;
    }

    /**
     * reads a sequence of characters
     *
     * @param s pointer to where the sequence of characters will be stored
     * @param n number of characters in the sequence to read
     *
     * @return std::streamsize number of character read
     */
    virtual std::streamsize xsgetn(char_type *s, std::streamsize n) {
        std::streamsize bytes_remaining = n;
        while (bytes_remaining > 0) {
            const std::streamsize bytes_available = std::streamsize(egptr() - gptr());
            const std::streamsize bytes_next_read = ((bytes_available >= bytes_remaining)
                                                   ? bytes_remaining : bytes_available);
            // copy available input data from buffer
            if (bytes_next_read > 0) {
                memcpy(s, gptr(), bytes_next_read);
                gbump(bytes_next_read);
                bytes_remaining -= bytes_next_read;
                s += bytes_next_read;
            }
            if (bytes_remaining > 0) {
                // call underflow() to read more data
                if (traits_type::eq_int_type(underflow(), traits_type::eof()))
                    break;
            }
        }
        return(n-bytes_remaining);
    }

    /**
     * synchronize buffers with the TCP connection
     *
     * @return 0 if successful, -1 if there was an error
     */
    virtual int_type sync(void) {
        return ((flush_output() == traits_type::eof()) ? -1 : 0);
    }

private:

    /// function called after an asynchronous operation has completed
    inline void operation_finished(const boost::system::error_code& error_code,
                                  std::size_t bytes_transferred)
    {
        boost::mutex::scoped_lock async_lock(m_async_mutex);
        m_async_error = error_code;
        m_bytes_transferred = bytes_transferred;
        m_async_done.notify_one();
    }

    /// pointer to the underlying TCP connection used for reading & writing
    tcp::connection_ptr         m_conn_ptr;

    /// condition signaled whenever an asynchronous operation has completed
    boost::mutex                m_async_mutex;

    /// condition signaled whenever an asynchronous operation has completed
    boost::condition            m_async_done;

    /// used to keep track of the result from the last asynchronous operation
    boost::system::error_code   m_async_error;

    /// the number of bytes transferred by the last asynchronous operation
    std::size_t                 m_bytes_transferred;

    /// pointer to the start of the TCP connection's read buffer
    char_type *                 m_read_buf;

    /// buffer used to write output
    char_type                   m_write_buf[WRITE_BUFFER_SIZE];
};

///
/// stream: std::basic_iostream wrapper for TCP network connections
///
class stream
    : public std::basic_iostream<char, std::char_traits<char> >
{
public:

    // data type definitions required for iostream compatability
    typedef char                                char_type;
    typedef std::char_traits<char>::int_type    int_type;
    typedef std::char_traits<char>::off_type    off_type;
    typedef std::char_traits<char>::pos_type    pos_type;
    typedef std::char_traits<char>              traits_type;

    /**
     * constructs a TCP stream object for an existing TCP connection
     *
     * @param conn_ptr pointer to the TCP connection to use for reading & writing
     */
    explicit stream(tcp::connection_ptr& conn_ptr)
        : m_tcp_buf(conn_ptr)
#ifdef _MSC_VER
        , std::basic_iostream<char, std::char_traits<char> >(NULL)
#endif
    {
        // initialize basic_iostream with pointer to the stream buffer
        std::basic_ios<char,std::char_traits<char> >::init(&m_tcp_buf);
    }

    /**
     * constructs a TCP stream object for a new TCP connection
     *
     * @param io_service asio service associated with the connection
     * @param ssl_flag if true then the connection will be encrypted using SSL
     */
    explicit stream(boost::asio::io_service& io_service,
                       const bool ssl_flag = false)
        : m_tcp_buf(io_service, ssl_flag)
#ifdef _MSC_VER
        , std::basic_iostream<char, std::char_traits<char> >(NULL)
#endif
    {
        // initialize basic_iostream with pointer to the stream buffer
        std::basic_ios<char,std::char_traits<char> >::init(&m_tcp_buf);
    }

    /**
     * constructs a TCP stream object for a new SSL/TCP connection
     *
     * @param io_service asio service associated with the connection
     * @param ssl_context asio ssl context associated with the connection
     */
    stream(boost::asio::io_service& io_service,
              connection::ssl_context_type& ssl_context)
        : m_tcp_buf(io_service, ssl_context)
#ifdef _MSC_VER
        , std::basic_iostream<char, std::char_traits<char> >(NULL)
#endif
    {
        // initialize basic_iostream with pointer to the stream buffer
        std::basic_ios<char,std::char_traits<char> >::init(&m_tcp_buf);
    }

    /**
     * accepts a new tcp connection and performs SSL handshake if necessary
     *
     * @param tcp_acceptor object used to accept new connections
     * @return boost::system::error_code contains error code if the connection fails
     *
     * @see boost::asio::basic_socket_acceptor::accept()
     */
    inline boost::system::error_code accept(boost::asio::ip::tcp::acceptor& tcp_acceptor)
    {
        boost::system::error_code ec = m_tcp_buf.get_connection().accept(tcp_acceptor);
        if (! ec && get_ssl_flag()) ec = m_tcp_buf.get_connection().handshake_server();
        return ec;
    }

    /**
     * connects to a remote endpoint and performs SSL handshake if necessary
     *
     * @param tcp_endpoint remote endpoint to connect to
     * @return boost::system::error_code contains error code if the connection fails
     *
     * @see boost::asio::basic_socket_acceptor::connect()
     */
    inline boost::system::error_code connect(boost::asio::ip::tcp::endpoint& tcp_endpoint)
    {
        boost::system::error_code ec = m_tcp_buf.get_connection().connect(tcp_endpoint);
        if (! ec && get_ssl_flag()) ec = m_tcp_buf.get_connection().handshake_client();
        return ec;
    }

    /**
     * connects to a (IPv4) remote endpoint and performs SSL handshake if necessary
     *
     * @param remote_addr remote IP address (v4) to connect to
     * @param remote_port remote port number to connect to
     * @return boost::system::error_code contains error code if the connection fails
     *
     * @see boost::asio::basic_socket_acceptor::connect()
     */
    inline boost::system::error_code connect(const boost::asio::ip::address& remote_addr,
                                             const unsigned int remote_port)
    {
        boost::asio::ip::tcp::endpoint tcp_endpoint(remote_addr, remote_port);
        boost::system::error_code ec = m_tcp_buf.get_connection().connect(tcp_endpoint);
        if (! ec && get_ssl_flag()) ec = m_tcp_buf.get_connection().handshake_client();
        return ec;
    }

    /// closes the tcp connection
    inline void close(void) { m_tcp_buf.get_connection().close(); }

    /*
    Use close instead; basic_socket::cancel is deprecated for Windows XP.

    /// cancels any asynchronous operations pending on the tcp connection
    inline void cancel(void) { m_tcp_buf.get_connection().cancel(); }
    */

    /// returns true if the connection is currently open
    inline bool is_open(void) const { return m_tcp_buf.get_connection().is_open(); }

    /// returns true if the connection is encrypted using SSL
    inline bool get_ssl_flag(void) const { return m_tcp_buf.get_connection().get_ssl_flag(); }

    /// returns the client's IP address
    inline boost::asio::ip::address get_remote_ip(void) const {
        return m_tcp_buf.get_connection().get_remote_ip();
    }

    /// returns a pointer to the stream buffer in use
    stream_buffer *rdbuf(void) { return &m_tcp_buf; }

private:

    /// the underlying TCP stream buffer used for reading & writing
    stream_buffer     m_tcp_buf;
};

}   // end namespace tcp
}   // end namespace pion

#endif


text:
<!doctype html>

    <title>Ndebele</title>

AMALUNGELO OMUNTU WONKE EMHLABENI WONKE JIKELELE

Loba isimilo lenhlonipho lamalungelo agcweleyo oluntu kuyisisekelo senkululeko, lesokulunga lokuthula emhlabeni,

Loba ukunganaki lokungahloniphi amalungelo abantu kubangele izenzo zocuku oludabula inhliziyo lenembeza, kwadala umhlaba lapha abantu abangathola khona injabulo lenkululeko yokuthi bakhulume bekhululekile bengesabi njalo kungekho ubuyanga, konke lokhu kuphakanyiswa njengento eqakathekileyo ngabantu bonke,

Loba ukuze umuntu angavuki umphenyana ngenxa yokucindezelwa, kufanele ukuthi amalungelo abantu asekelwe ngumthetho,

Loba kufanele ukukhulisa ubudlelwano phakathi kwezizwe,

Loba abantu baMazwe aManyaneyo betshengise ukholo lwabo kumalungelo oluntu lokuhlonipha lokuqakathekisa umuntu emalungelweni alingeneyo lamalungelo alinganayo phakathi kwamadoda labafazi, lokuzimisela ukuthuthukisa ingqubelaphambili lokuhlala kuhle kwabantu,

Loba amazwe ami wodwa ezimisela uKumanyana laMazwe aManyaneyo ukuze aqakathekise ukuhlonitshwa kwamalungelo abantu,

Lobanje ulwazi lwamalungelo blwenkululeko kuyinto eqakathekileyo, ukuze amalungelo lenkululeko kwaziwe,

INKUNDLA YEZIZWE ITHI

Lesisivumelwano samalungelo oluntu silotshiwe ukuze umuntu lezigaba zabantu jikelele zigcine lesi sivumelwano engqondweni, yizizwe zonke lamazwe asabuswa ngamanye.

Isivumelwano

Abantu bonke bazalwa bekhululekile njalo belingana kumalungelo abo. Balesipho sikanembeza, ngakho bamele baphathane ngomoya otshengisa ubuhlobo lobunye.

Isivumelwano 2

Wonke umuntu ulelungelo lokuthola inkululeko lamalungelo alotshwe kulesi sivumelwano hngokupheleleyo kunganakwa ubuhlobo, umbala, ukuthi uyindoda kumbe ngumfazi, ulimi, ukholo, ezimayelana lombangazwe, lenotho kanye lasipi lasiphi isimo phakathi kwabantu.

Njalo kakusoze kube lomahluko ekuphathweni kwabantu emthethweni loba ngowaliphi ilizwe loba yisiphi lesimo selizwe lapho umuntu avela khona - lanxa lelolizwe lizibusa kumbe libuswa ngelinye.

Isivumelwano 3

Wonke umuntu ulelungelo lempilo, lelenkululeko lelenhlalakahle.

Isivumelwano 4

Kakho umuntu ozakwenziwa isigqili, kumbe isithunjwa; ubugqili lokuthengisa izichaka kuzanqatshelwa ngazo zonke indlela.

Isivumelwano 5

Akula muntu ozahlutshwa ahlukuluzwe loba aphathwe ngesihluku langendlela eyangisayo kumbe elocuku.

Isivumelwano 6

Wonke umuntu ulelungelo emthethweni lokuphathwa njengomuntu.

Isivumelwano 7

Bonke abantu bayalingana phambi komthetho, kungekho bandlululo. Abantu bonke bayavikelwa ekubandlululweni. Ubandlululo luvunyelwa yisivumelwano lesi njalo akuvunyelwa ukubasela ubandlululo.

Isivumelwano 8

Omunye lomunye umuntu ulelungelo lokuvikelwa ngababusi lomthethwandaba uma kulezenzo ezephula amalungelo akhe asemthethweni.

Isivumelwano 9

Akumelanga ukuthi umuntu abotshwe okungekho emthethweni, loba abotshwe mahlayana, loba axotshwe elizweni lakubo.

Isivumelwano 10

Omunye lomunye umuntu ulelungelo lokuthi athoniselwe icala phambi kwenkundla ezimeleyo kumbe agwetshwe yinkundla engabandlululiyo ekuthetheni amacala.

Isivumelwano 11

Omunye lomunye umuntu owetheswe icala ulelungelo lokuthi aphathwe njengomuntu ongela cala aze adliwe licala emthethwandaba. Kumele njalo aphiwe ithuba lokuthola umeli.

Kakho umuntu ongajeziswa emthethweni ngenxa yecala alenzayo uma icala leli lenziwa umthetho owenza lokho akwenzayo kube licala wawungekho ngaleso sikhathi. Isijeziso salelo cala akumelanga sedlule isijesiso esasifanele icala lelo umthetho omutsha ungakabekwa.

Isivumelwano 12

Omunye lomunye umuntu ulelungelo lokuhlonitshwa - ubuntu bakhe, imuli yakhe, umuzi wakhe lezincwadi zakhe. Omunye lomunye umuntu kumele avikelwe ngumthetho ezintweni ezinje.

Isivumelwano 13

Wonke umuntu ulelungelo lokuhamba lokuhlala kuwo wonke amazwe.

Wonke umuntu ulelungelo lokuthutha loba kuliphi ilizwe, ngitsho laselizweni lakhe, lelokubuyela elizweni lakhe.

Isivumelwano 14

Wonke umuntu ulelungelo lokubalekela kwelinye ilizwe ukuze abe yisiphepheli khona nxa ehlutshwa elizweni lakubo.

Leli lungelo alikhululi umuntu obotshiweyo ngaphandle kokuba ebotshelwe izindaba zombangazwe kumbe okungavunyelwa ngaMazwe aManyaneyo.

Isivumelwano 15

Wonke umuntu ulelungelo lokuba yisakhamuzi ezweni lakhe.

Kakho ongathathelwa ilungelo leli loba alelwe ukuba yisakhumuzi selinye ilizwe.

Isivumelwano 16

Amadoda labafazi asebekhulilwe, balelungelo lokuthatha lokuthathwa babe lemizi yabo, kungenani ukuthiukholo lomuntu yiluphi lokuthi ungumhlobo bani. Balamalungelo alinganayo ekuthathaneni kwabo lasekwehlukaneniekeni kwaho.

Umendo kumele ubotshwe ngukuvumelana kwabathathanayo.

Imuli yisisekelo sezizwe, ngakho kumele isekelwe yizakhamizi languHulumende.

Isivumelwano 17

Omunye lomunye ulelungelo lokuba lezimphala zakhe yedwa lokuba lezimpahla ndawonye labanye.

Kakho umuntu ongahluthunelwa indawo kanye lempahla engeyakhe.

Isivumelwano 18

Omunye lomunye ulelungelo lokucabanga njengokuthanda kwakhe, lelokukhonza ngentando yakhe, ekhokhelwa ngunembaza wakhe. Leli lungelo lipha umuntu imvumo yokutshintsha ukholo lwakhe, lemvumo yokuthi yena yedwa kumbe elabanye atshengise ukholo lwakhe kumphakathi ngezenzo, ngokukhonza, ngokufundisa kunye Tokuziphatha kwakhe kunye lokufundisa ukholo lwakhe.

Isivumelwano 19

Omunye lomunye ulelungelo lokukhuluma izifiso zakhe lokusengqondweni yakhe. Leli lungelo lipha umuntu inkululeko yokudinga lokwamukela lokwazisa akwaziyo lokusengqondweni yakhe ngayiphi layiphi indlela lakwamanye amazwe.

Isivumelwano 20

Wonke umuntu ulelungelo lokumanyana kanye lokuhlangana labanye.

Akula muntu ozabanjwa ngamandla ukuthi abelilunga lenhlanganiso iphi layiphi.

Isivumelwano 21

Omunye lomunye ulelungelo lokuphathisana lohulumende wakhe yena ngokwakhe kumbe amelwe ngabakhethiweyo.

Omunye lomunye ulelungelo loncedo lwelizwe lakhe.

Izifiso zabantu yizo okumele ziphe uhulumende amandla okubusa. Lezi zifiso zizatshengiswa lukhetho oluzakwenziwa ngezikhathi ezifaneleyo, oluzavumela njalo wonke umuntu ukukhetha ngendlela engasoze itshengise abanye ukuthi ukhethe bani.

Isivumelwano 22

Omunye lomunye umuntu, njengesakhamuzi, ulelungelo lokusekelwa yilizwe lakhe lelokusuthiseka. Lokhu kuzavela ezenzweni zesizwe sakhe lasencedweni oluvela kwamanye amazwe, ukuze kuthuthukiswe amalungelo akhe empilweni lasemasikweni akhe ukuze kumlethele inhonipho lentuthuko yobuntu bakhe.

Isivumelwano 23

Omunye lomunye ulelungelo lokusebenza lelokukhetha umsebenzi awufunayo, lelokuphathwa kuhle emsebenzini, lelokuncedwa nxa umsebenzi udingakala

Omunye lomunye ulelungelo lokwamukela imbandalo elingene lomsebenzi wakhe.

Wonke umuntu osebenzayo ulelungelo lokuthola imbadalo efaneleyo ezokwenza ukuthi yena labantwana bakhe bathole impilo lenhalakahle ehloniphekayo njengabantu, lelokusekelwa ngezinye izindlela.

Omunye lomunye ulelungelo lokuba lilunga lomhlangano wezisebenzi ukuze asekele izifiso zakhe.

Isivumelwano 24

Omunye lomunye ulelungelo lokuthatha ikhefu engephulelwa imbadalo yakhe, njalo ulelungelo lokusebenza amahora angamanengi kakhulukazi.

Isivumelwano 25

Omunye lomunye ulelungelo lempilo lenhlalakahle yakhe labantwana bakhe. Lokhu kuhlanganisa ukudla, izembatho, indawo yokuhlala kanye lempilo enhle, ukugcinwa kuhle uma engasebenzi. Lokhu kuhlanganisa abafelwaokazi, abadala, abalimeleyo labehlulekayo ukuzonga.

Ababelethileyo labantwana kumele bagcinwe njalo bancediswe. Abantwana bonke abazalelwe emendweni kumbe ngaphandle kwawo, kumele basekelwe ngokufanayo.

Isivumelwano 26

Omunye lomunye ulelungelo lemfundo. Imfundo ayizukuba lembadalo, kusukela phansi kuze kufike esigabeni esithe thuthu. Imfundo ephansi (elementary) ngeyomuntu wonke, ngakho omunye lomunye uzabanjwa ngamandla ukuthi ayithole. Imfundo ephezulu yezandla (technical) lenye njalo eyolwazi olwehlukeneyo olwezigaba ezehlukeneyo kumele ibe khona, lemfundo ephakemeyo kumele itholwe yilabo abayifaneleyo ngolwazi abalalo.

Imfundo kuzamela ithuthukise ubuntu lokuhlonipha amalungelo obuntu lenkululeko engcweleyo. Kufanele ikhulise ukuzwelana, ukuzwisisa lobudlelwano phakathi kwezizwe zonke, kwemihlobo yonke lakwabenkonzo ezehlukeneyo, isekele njalo imisebenzi yeZizwe eziManyeneyo (UN) yokuletha ukuthula emhlabeni.

Abazali balelungelo lokukhetha imfundo yabantwana babo.

Isivumelwano 27

Wonke umuntu ulelungelo lokumanyana labanye lokukhululeka ekuphathisaneni labanye kwezemvelo lakwezamasiko lelokuvuna kukho konke okuvezwa yizifundo zemvelo.

Omunye lomunye ulelungelo lokusekelwa empilweni yakhe lelokuqiniswa ebuntwini bakhe mayelana lokwemvelo lokwezombukiso.

Isivumelwano 28

Umuntu munye lamunye ulelungelo lokuthola indawo lapha okuhlonitshwa lokugcinwa khona izimiso zezivumelwano lezi.

Isivumelwano 29

Wonke umuntu ulemisebenzi okumele ayenze njengesakhamuzi okuyiyo ezagcwalisa ubuntu bakhe.

Kukho konke akwenzayo, uzakhokhelwa yikuhlonipha lokwethula ingowane yakhe kumalungelo abanye, ananzelele ukuqakatheka kombuso wabanengi (UN).

La amalungelo lenkululeko akumelanga kuphambane lezimiso zeZizwe eziManyaneyo.

Izivumelwano 30

Akukho kuleziZivumelwano okungavumela umuntu loba abantu ukubhidliza amalungelo lenkululeko ezilotshwe lapha.