text:
package org.kuali.kra.negotiations.web.struts.action;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.kuali.coeus.common.notification.impl.service.KcNotificationService;
import org.kuali.coeus.sys.framework.controller.KcTransactionalDocumentActionBase;
import org.kuali.coeus.sys.framework.service.KcServiceLocator;
import org.kuali.kra.infrastructure.Constants;
import org.kuali.kra.negotiations.bo.Negotiation;
import org.kuali.kra.negotiations.document.NegotiationDocument;
import org.kuali.kra.negotiations.printing.service.NegotiationPrintingService;
import org.kuali.kra.negotiations.service.NegotiationService;
import org.kuali.kra.negotiations.web.struts.form.NegotiationForm;
import org.kuali.rice.kew.api.exception.WorkflowException;
import org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase;
import org.kuali.rice.krad.rules.rule.event.DocumentEvent;
import org.kuali.rice.krad.service.KualiRuleService;
import org.kuali.rice.krad.service.SequenceAccessorService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;

public class NegotiationAction extends KcTransactionalDocumentActionBase {
    @SuppressWarnings("unused")
    private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(NegotiationAction.class);

    private NegotiationService negotiationService;
    private SequenceAccessorService sequenceAccessorService;
    private NegotiationPrintingService negotiationPrintingService;
    private KcNotificationService notificationService;
    private KualiRuleService kualiRuleService;

    @Override
    public ActionForward docHandler(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response) throws Exception {
        ActionForward forward = super.docHandler(mapping, form, request, response);
        NegotiationForm negotiationForm = (NegotiationForm) form;
//        negotiationForm.getCustomDataHelper().prepareCustomData();
//        Negotiation negotiation = negotiationForm.getNegotiationDocument().getNegotiation();
//        getNegotiationService().checkForPropLogPromotion(negotiation);
        prepareNegotiation(negotiationForm);
        return forward;
    }

    protected void prepareNegotiation(NegotiationForm negotiationForm) {
        negotiationForm.getCustomDataHelper().prepareCustomData();
        Negotiation negotiation = negotiationForm.getNegotiationDocument().getNegotiation();
        getNegotiationService().checkForPropLogPromotion(negotiation);
    }

    /**
     * Upon creating negotiation document default the negotiation status to in progress.
     * @see org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#createDocument(org.kuali.rice.kns.web.struts.form.KualiDocumentFormBase)
     */
    protected void createDocument(KualiDocumentFormBase kualiDocumentFormBase) throws WorkflowException {
        super.createDocument(kualiDocumentFormBase);
        NegotiationDocument negotiationDocument = (NegotiationDocument) kualiDocumentFormBase.getDocument();
        negotiationDocument.getNegotiation().setNegotiationId(getSequenceAccessorService().getNextAvailableSequenceNumber(Constants.NEGOTIATION_SEQUENCE_NAME, negotiationDocument.getNegotiation().getClass()));
        negotiationDocument.getNegotiation().setNegotiationStatus(
                getNegotiationService().getNegotiationStatus(getNegotiationService().getInProgressStatusCodes().get(0)));
        negotiationDocument.getNegotiation().setNegotiationStatusId(negotiationDocument.getNegotiation().getNegotiationStatus().getId());
    }

    @SuppressWarnings("unchecked")
    @Override
    public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        ActionForward actionForward = mapping.findForward(Constants.MAPPING_BASIC);
        NegotiationForm negotiationForm = (NegotiationForm) form;
        NegotiationDocument negotiationDocument = negotiationForm.getNegotiationDocument();
        if (negotiationDocument.getDocumentHeader().getWorkflowDocument().isInitiated()
                || negotiationDocument.getDocumentHeader().getWorkflowDocument().isSaved()) {
            getDocumentService().routeDocument(negotiationDocument, "Route To Final", new ArrayList());
        }

        actionForward = super.save(mapping, form, request, response);
        return actionForward;
    }

    protected final boolean applyRules(DocumentEvent event) {
        return getKualiRuleService().applyRules(event);
    }

    protected NegotiationService getNegotiationService() {
        if (negotiationService == null) {
            negotiationService = KcServiceLocator.getService(NegotiationService.class);
        }
        return negotiationService;
    }

    public void setNegotiationService(NegotiationService negotiationService) {
        this.negotiationService = negotiationService;
    }

    public SequenceAccessorService getSequenceAccessorService() {
        if (sequenceAccessorService == null) {
            sequenceAccessorService = KcServiceLocator.getService(SequenceAccessorService.class);
        }
        return sequenceAccessorService;
    }

    public void setSequenceAccessorService(SequenceAccessorService sequenceAccessorService) {
        this.sequenceAccessorService = sequenceAccessorService;
    }

    public NegotiationPrintingService getNegotiationPrintingService() {
        if (negotiationPrintingService == null) {
            negotiationPrintingService = KcServiceLocator.getService(NegotiationPrintingService.class);
        }
        return negotiationPrintingService;
    }

    public void setNegotiationPrintingService(NegotiationPrintingService negotiationPrintingService) {
        this.negotiationPrintingService = negotiationPrintingService;
    }

    protected KcNotificationService getNotificationService() {
        if (notificationService == null) {
            notificationService = KcServiceLocator.getService(KcNotificationService.class);
        }
        return notificationService;
    }

    public void setNotificationService(KcNotificationService notificationService) {
        this.notificationService = notificationService;
    }

    protected KualiRuleService getKualiRuleService() {
        if (kualiRuleService == null) {
            kualiRuleService = KcServiceLocator.getService(KualiRuleService.class);
        }
        return kualiRuleService;
    }

}


text:
Works both on server and in browser

### Basic example

```dart

  var connector = new MapdConnectorConsole()
    ..url = 'http://localhost:9090'
    ..dbName = 'mapd'
    ..user = 'mapd'
    ..password = 'HyperInteractive';

  if (!await connector.connect()) {
    throw new Exception('Error connecting to MapD');
  }
  var version = await connector.getVersion();
  print('Version: $version');

  var status = await connector.getServerStatus();
  print('Server status: $status');

////  Breaks with method not found
//  var memorySummary = await connector.getMemorySummary();
//  print('Memory summary: $memorySummary');

//  var memoryGPU = await connector.getMemoryGPU();
//  print('Memory GPU: $memoryGPU');

  var tables = await connector.getTables();
  print('Tables: $tables');

  var fields = await connector.getFields('flights_2008_10k');
  print('Fields for "tweets_nov_feb" table');
  for (var each in fields) {
    print('   col_name: ${each.col_name}, col_type: ${each.col_type}');
  }

  const query = "SELECT carrier_name as key0, AVG(airtime) AS val FROM flights_2008_10k WHERE airtime IS NOT NULL GROUP BY key0 ORDER BY val DESC LIMIT 100";

  var queryResult = await connector.query(query);
  print('Query: $query');
  print('Query result:');
  for (var each in queryResult) {
    print('    $each');
  }

  await connector.disconnect();

```

redpajama_set_name: RedPajamaGithub


text:
package ios.ac.cn;

import java.lang.Thread.State;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class BinaryTreePostorderTraversal {
	public List<Integer> postorderTraversal(TreeNode root) {
		List<Integer> list = new ArrayList<>();
		if (root == null) {
			return list;
		}

		List<Integer> left = postorderTraversal(root.left);
		List<Integer> right = postorderTraversal(root.right);
		list.addAll(left);
		list.addAll(right);
		list.add(root.val);
		return list;
	}

	public List<Integer> postorderTraversalIter(TreeNode root) {
		List<Integer> list = new ArrayList<>();
		if (root == null) {
			return list;
		}

		LinkedList<TreeNode> stack = new LinkedList<>();
		stack.add(root);
		while (stack.isEmpty() == false) {
			TreeNode top = stack.peek();
			if (top.left != null) {
				stack.push(top.left);
			} else if (top.right != null) {
				stack.push(top.right);
			} else {
				TreeNode preTop = stack.pop();
				list.add(preTop.val);

				while (stack.isEmpty() == false) {
					top = stack.peek();
					if (preTop == top.left && top.right != null) {
						stack.push(top.right);
						break;
					} else {
						preTop = stack.pop();
						list.add(preTop.val);
					}
				}
			}
		}
		return list;
	}
}


text:
<?php
/**
 * Load JS for the TXT conversion
 */
namespace MarkNotes\Plugins\Page\HTML;

defined('_MARKNOTES') or die('No direct access allowed');

class TXT extends \MarkNotes\Plugins\Page\HTML\Plugin
{
	protected static $me = __CLASS__;
	protected static $json_settings = 'plugins.page.html.txt';
	protected static $json_options = 'plugins.options.page.html.txt';

	/**
	 * Provide additionnal javascript
	 */
	public static function addJS(&$js = null) : bool
	{
		$aeFiles = \MarkNotes\Files::getInstance();
		$aeFunctions = \MarkNotes\Functions::getInstance();
		$aeSession = \MarkNotes\Session::getInstance();
		$aeSettings = \MarkNotes\Settings::getInstance();

		$url = rtrim($aeFunctions->getCurrentURL(), '/');
		$url .= '/marknotes/plugins/page/html/txt/';

		$script = "<script src=\"".$url."button.js\" ".
			"defer=\"defer\"></script>";

		$js .= $aeFunctions->addJavascriptInline($script);

		return true;
	}

	/**
	 * Provide additionnal stylesheets
	 */
	public static function addCSS(&$css = null) : bool
	{
		return true;
	}

	/**
	 * Add/modify the HTML content
	 */
	public static function doIt(&$html = null) : bool
	{
		return true;
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Proc. Amer. Acad. Arts & Sci. 36: 410 (1901)

#### Original name
Ceraiomyces dahlii Thaxt.

### Remarks
null


text:
<component name="libraryTable">
  <library name="exposed-instrumentation-api-publish-0.5">
    <CLASSES>
      <root url="jar://$USER_HOME$/.android/build-cache/5f6360fecaffcfbbf57f7cfebfff899b0b5a3cd7/output/jars/classes.jar!/" />
      <root url="file://$USER_HOME$/.android/build-cache/5f6360fecaffcfbbf57f7cfebfff899b0b5a3cd7/output/res" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/Library/Android/sdk/extras/android/m2repository/com/android/support/test/exposed-instrumentation-api-publish/0.5/exposed-instrumentation-api-publish-0.5-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
describe('repo service', function () {
  var $http, repo;
  beforeEach(module('test-app', function ($provide) {
    $http = {
      get: sinon.promise()
    };
    $provide.value('$http', $http);
  }));
  beforeEach(inject(function ($injector) {
    repo = $injector.get('repo');
  }));
  describe('#getCommits', function () {
    var success, fail, done, notify;
    beforeEach(function () {
      success = sinon.spy();
      fail = sinon.spy();
      done = sinon.spy();
      notify = sinon.spy();

      repo.getCommits().then(success).catch(fail).finally(done, notify);
    });
    it('gets the correct url', function () {
      expect($http.get)
        .toHaveBeenCalledWith('https://api.github.com/repos/JohanObrink/angular-test-promise/commits');
    });
    it('returns the data property of the response', function () {
      $http.get.resolve({data: {foo: 'bar'}});

      expect(success).toHaveBeenCalledWith({foo: 'bar'});
      expect(fail).not.toHaveBeenCalled();
      expect(done).toHaveBeenCalled();
    });
    it('propagates errors', function () {
      $http.get.reject('b0rk');

      expect(success).not.toHaveBeenCalled();
      expect(fail).toHaveBeenCalledWith('b0rk');
      expect(done).toHaveBeenCalled();
    });
    it('propagates notifications', function () {
      $http.get.notify('hello');

      expect(success).not.toHaveBeenCalled();
      expect(fail).not.toHaveBeenCalled();
      expect(notify).toHaveBeenCalledWith('hello');
      expect(done).not.toHaveBeenCalled();
    });
  });
});


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkStatisticsAlgorithmWrap.h"
#include "vtkExtractHistogram2DWrap.h"
#include "vtkObjectWrap.h"
#include "vtkImageDataWrap.h"
#include "vtkDataArrayWrap.h"
#include "vtkDataObjectCollectionWrap.h"
#include "vtkMultiBlockDataSetWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkExtractHistogram2DWrap::ptpl;

VtkExtractHistogram2DWrap::VtkExtractHistogram2DWrap()
{ }

VtkExtractHistogram2DWrap::VtkExtractHistogram2DWrap(vtkSmartPointer<vtkExtractHistogram2D> _native)
{ native = _native; }

VtkExtractHistogram2DWrap::~VtkExtractHistogram2DWrap()
{ }

void VtkExtractHistogram2DWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkExtractHistogram2D").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ExtractHistogram2D").ToLocalChecked(), ConstructorGetter);
}

void VtkExtractHistogram2DWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkExtractHistogram2DWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkStatisticsAlgorithmWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkStatisticsAlgorithmWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkExtractHistogram2DWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "Aggregate", Aggregate);
	Nan::SetPrototypeMethod(tpl, "aggregate", Aggregate);

	Nan::SetPrototypeMethod(tpl, "GetBinWidth", GetBinWidth);
	Nan::SetPrototypeMethod(tpl, "getBinWidth", GetBinWidth);

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetComponentsToProcess", GetComponentsToProcess);
	Nan::SetPrototypeMethod(tpl, "getComponentsToProcess", GetComponentsToProcess);

	Nan::SetPrototypeMethod(tpl, "GetCustomHistogramExtents", GetCustomHistogramExtents);
	Nan::SetPrototypeMethod(tpl, "getCustomHistogramExtents", GetCustomHistogramExtents);

	Nan::SetPrototypeMethod(tpl, "GetMaximumBinCount", GetMaximumBinCount);
	Nan::SetPrototypeMethod(tpl, "getMaximumBinCount", GetMaximumBinCount);

	Nan::SetPrototypeMethod(tpl, "GetNumberOfBins", GetNumberOfBins);
	Nan::SetPrototypeMethod(tpl, "getNumberOfBins", GetNumberOfBins);

	Nan::SetPrototypeMethod(tpl, "GetOutputHistogramImage", GetOutputHistogramImage);
	Nan::SetPrototypeMethod(tpl, "getOutputHistogramImage", GetOutputHistogramImage);

	Nan::SetPrototypeMethod(tpl, "GetRowMask", GetRowMask);
	Nan::SetPrototypeMethod(tpl, "getRowMask", GetRowMask);

	Nan::SetPrototypeMethod(tpl, "GetScalarType", GetScalarType);
	Nan::SetPrototypeMethod(tpl, "getScalarType", GetScalarType);

	Nan::SetPrototypeMethod(tpl, "GetSwapColumns", GetSwapColumns);
	Nan::SetPrototypeMethod(tpl, "getSwapColumns", GetSwapColumns);

	Nan::SetPrototypeMethod(tpl, "GetUseCustomHistogramExtents", GetUseCustomHistogramExtents);
	Nan::SetPrototypeMethod(tpl, "getUseCustomHistogramExtents", GetUseCustomHistogramExtents);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SetComponentsToProcess", SetComponentsToProcess);
	Nan::SetPrototypeMethod(tpl, "setComponentsToProcess", SetComponentsToProcess);

	Nan::SetPrototypeMethod(tpl, "SetCustomHistogramExtents", SetCustomHistogramExtents);
	Nan::SetPrototypeMethod(tpl, "setCustomHistogramExtents", SetCustomHistogramExtents);

	Nan::SetPrototypeMethod(tpl, "SetNumberOfBins", SetNumberOfBins);
	Nan::SetPrototypeMethod(tpl, "setNumberOfBins", SetNumberOfBins);

	Nan::SetPrototypeMethod(tpl, "SetRowMask", SetRowMask);
	Nan::SetPrototypeMethod(tpl, "setRowMask", SetRowMask);

	Nan::SetPrototypeMethod(tpl, "SetScalarType", SetScalarType);
	Nan::SetPrototypeMethod(tpl, "setScalarType", SetScalarType);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToDouble", SetScalarTypeToDouble);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToDouble", SetScalarTypeToDouble);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToFloat", SetScalarTypeToFloat);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToFloat", SetScalarTypeToFloat);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToUnsignedChar", SetScalarTypeToUnsignedChar);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToUnsignedChar", SetScalarTypeToUnsignedChar);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToUnsignedInt", SetScalarTypeToUnsignedInt);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToUnsignedInt", SetScalarTypeToUnsignedInt);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToUnsignedLong", SetScalarTypeToUnsignedLong);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToUnsignedLong", SetScalarTypeToUnsignedLong);

	Nan::SetPrototypeMethod(tpl, "SetScalarTypeToUnsignedShort", SetScalarTypeToUnsignedShort);
	Nan::SetPrototypeMethod(tpl, "setScalarTypeToUnsignedShort", SetScalarTypeToUnsignedShort);

	Nan::SetPrototypeMethod(tpl, "SetSwapColumns", SetSwapColumns);
	Nan::SetPrototypeMethod(tpl, "setSwapColumns", SetSwapColumns);

	Nan::SetPrototypeMethod(tpl, "SetUseCustomHistogramExtents", SetUseCustomHistogramExtents);
	Nan::SetPrototypeMethod(tpl, "setUseCustomHistogramExtents", SetUseCustomHistogramExtents);

	Nan::SetPrototypeMethod(tpl, "SwapColumnsOff", SwapColumnsOff);
	Nan::SetPrototypeMethod(tpl, "swapColumnsOff", SwapColumnsOff);

	Nan::SetPrototypeMethod(tpl, "SwapColumnsOn", SwapColumnsOn);
	Nan::SetPrototypeMethod(tpl, "swapColumnsOn", SwapColumnsOn);

	Nan::SetPrototypeMethod(tpl, "UseCustomHistogramExtentsOff", UseCustomHistogramExtentsOff);
	Nan::SetPrototypeMethod(tpl, "useCustomHistogramExtentsOff", UseCustomHistogramExtentsOff);

	Nan::SetPrototypeMethod(tpl, "UseCustomHistogramExtentsOn", UseCustomHistogramExtentsOn);
	Nan::SetPrototypeMethod(tpl, "useCustomHistogramExtentsOn", UseCustomHistogramExtentsOn);

#ifdef VTK_NODE_PLUS_VTKEXTRACTHISTOGRAM2DWRAP_INITPTPL
	VTK_NODE_PLUS_VTKEXTRACTHISTOGRAM2DWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkExtractHistogram2DWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkExtractHistogram2D> native = vtkSmartPointer<vtkExtractHistogram2D>::New();
		VtkExtractHistogram2DWrap* obj = new VtkExtractHistogram2DWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkExtractHistogram2DWrap::Aggregate(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkDataObjectCollectionWrap::ptpl))->HasInstance(info[0]))
	{
		VtkDataObjectCollectionWrap *a0 = ObjectWrap::Unwrap<VtkDataObjectCollectionWrap>(info[0]->ToObject());
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkMultiBlockDataSetWrap::ptpl))->HasInstance(info[1]))
		{
			VtkMultiBlockDataSetWrap *a1 = ObjectWrap::Unwrap<VtkMultiBlockDataSetWrap>(info[1]->ToObject());
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->Aggregate(
				(vtkDataObjectCollection *) a0->native.GetPointer(),
				(vtkMultiBlockDataSet *) a1->native.GetPointer()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::GetBinWidth(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->GetBinWidth(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[2];
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 2; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->GetBinWidth(
			b0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetClassName();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkExtractHistogram2DWrap::GetComponentsToProcess(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	int const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetComponentsToProcess();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 2 * sizeof(int));
	Local<v8::Int32Array> at = v8::Int32Array::New(ab, 0, 2);
	memcpy(ab->GetContents().Data(), r, 2 * sizeof(int));
	info.GetReturnValue().Set(at);
}

void VtkExtractHistogram2DWrap::GetCustomHistogramExtents(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCustomHistogramExtents();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 4 * sizeof(double));
	Local<v8::Float64Array> at = v8::Float64Array::New(ab, 0, 4);
	memcpy(ab->GetContents().Data(), r, 4 * sizeof(double));
	info.GetReturnValue().Set(at);
}

void VtkExtractHistogram2DWrap::GetMaximumBinCount(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	double r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetMaximumBinCount();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkExtractHistogram2DWrap::GetNumberOfBins(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	int const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetNumberOfBins();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 2 * sizeof(int));
	Local<v8::Int32Array> at = v8::Int32Array::New(ab, 0, 2);
	memcpy(ab->GetContents().Data(), r, 2 * sizeof(int));
	info.GetReturnValue().Set(at);
}

void VtkExtractHistogram2DWrap::GetOutputHistogramImage(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	vtkImageData * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOutputHistogramImage();
	VtkImageDataWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkImageDataWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkImageDataWrap *w = new VtkImageDataWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkExtractHistogram2DWrap::GetRowMask(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	vtkDataArray * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetRowMask();
	VtkDataArrayWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkDataArrayWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkDataArrayWrap *w = new VtkDataArrayWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkExtractHistogram2DWrap::GetScalarType(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetScalarType();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkExtractHistogram2DWrap::GetSwapColumns(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetSwapColumns();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkExtractHistogram2DWrap::GetUseCustomHistogramExtents(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetUseCustomHistogramExtents();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkExtractHistogram2DWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsA(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	vtkExtractHistogram2D * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkExtractHistogram2DWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkExtractHistogram2DWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkExtractHistogram2DWrap *w = new VtkExtractHistogram2DWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkExtractHistogram2DWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectWrap *a0 = ObjectWrap::Unwrap<VtkObjectWrap>(info[0]->ToObject());
		vtkExtractHistogram2D * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObject *) a0->native.GetPointer()
		);
		VtkExtractHistogram2DWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkExtractHistogram2DWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkExtractHistogram2DWrap *w = new VtkExtractHistogram2DWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetComponentsToProcess(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsInt32Array())
	{
		v8::Local<v8::Int32Array>a0(v8::Local<v8::Int32Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetComponentsToProcess(
			(int *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		int b0[2];
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 2; i++ )
		{
			if( !a0->Get(i)->IsInt32() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->Int32Value();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetComponentsToProcess(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsInt32())
		{
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->SetComponentsToProcess(
				info[0]->Int32Value(),
				info[1]->Int32Value()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetCustomHistogramExtents(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 4 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCustomHistogramExtents(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[4];
		if( a0->Length() < 4 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 4; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCustomHistogramExtents(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsNumber())
				{
										if(info.Length() != 4)
					{
						Nan::ThrowError("Too many parameters.");
						return;
					}
					native->SetCustomHistogramExtents(
						info[0]->NumberValue(),
						info[1]->NumberValue(),
						info[2]->NumberValue(),
						info[3]->NumberValue()
					);
					return;
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetNumberOfBins(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsInt32Array())
	{
		v8::Local<v8::Int32Array>a0(v8::Local<v8::Int32Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetNumberOfBins(
			(int *)(a0->Buffer()->GetContents().Data())
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		int b0[2];
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 2; i++ )
		{
			if( !a0->Get(i)->IsInt32() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->Int32Value();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetNumberOfBins(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsInt32())
		{
						if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			native->SetNumberOfBins(
				info[0]->Int32Value(),
				info[1]->Int32Value()
			);
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetRowMask(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkDataArrayWrap::ptpl))->HasInstance(info[0]))
	{
		VtkDataArrayWrap *a0 = ObjectWrap::Unwrap<VtkDataArrayWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetRowMask(
			(vtkDataArray *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetScalarType(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetScalarType(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetScalarTypeToDouble(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToDouble();
}

void VtkExtractHistogram2DWrap::SetScalarTypeToFloat(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToFloat();
}

void VtkExtractHistogram2DWrap::SetScalarTypeToUnsignedChar(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToUnsignedChar();
}

void VtkExtractHistogram2DWrap::SetScalarTypeToUnsignedInt(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToUnsignedInt();
}

void VtkExtractHistogram2DWrap::SetScalarTypeToUnsignedLong(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToUnsignedLong();
}

void VtkExtractHistogram2DWrap::SetScalarTypeToUnsignedShort(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SetScalarTypeToUnsignedShort();
}

void VtkExtractHistogram2DWrap::SetSwapColumns(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetSwapColumns(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SetUseCustomHistogramExtents(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetUseCustomHistogramExtents(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkExtractHistogram2DWrap::SwapColumnsOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SwapColumnsOff();
}

void VtkExtractHistogram2DWrap::SwapColumnsOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->SwapColumnsOn();
}

void VtkExtractHistogram2DWrap::UseCustomHistogramExtentsOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->UseCustomHistogramExtentsOff();
}

void VtkExtractHistogram2DWrap::UseCustomHistogramExtentsOn(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractHistogram2DWrap *wrapper = ObjectWrap::Unwrap<VtkExtractHistogram2DWrap>(info.Holder());
	vtkExtractHistogram2D *native = (vtkExtractHistogram2D *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->UseCustomHistogramExtentsOn();
}


text:
package views;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;

import javax.swing.JPanel;

import controllers.AutoMoveController;
import controllers.NPCMotionController;
import controllers.PlayerMotionController;
import controllers.ViewableMapController;
import models.BadDimensionException;
import models.Base;
import models.Direction;
import models.LoadedMap;
import models.Map;
import models.Player;
import models.Soldier;
import models.Tile;

public class Level extends JPanel {
	private static final long serialVersionUID = 1L;

	Map map;
	private Player player;
	ArrayList<Soldier> soldiers;
	ViewableMapController mapController;
	PlayerMotionController playerMotionController;
	NPCMotionController npcMotionController;
	public final Dimension tileSize = new Dimension(40,40);
	private Thread autoMove;

	public Level(File mapFile, Player player){
		super();

		this.player = player;
		try {
			long started = System.currentTimeMillis();
			mapController = new ViewableMapController(new LoadedMap(mapFile, tileSize), new Dimension(9,7), new Point(0,0));
			long done = System.currentTimeMillis();
			System.out.printf("Time to load map: %d millis\n\n", done-started);
		} catch (BadDimensionException e) {
			e.printStackTrace();
		}

		this.map = mapController.getViewableArea();

		playerMotionController = new PlayerMotionController(mapController, player);
		npcMotionController = new NPCMotionController(mapController.getMap());
		soldiers = new ArrayList<Soldier>();

		setPreferredSize(new Dimension(map.getCols() * map.getTileSize().width,map.getRows() * map.getTileSize().height));
		}

	@Override
	public void paintComponent(Graphics g) {
		super.paintComponent(g);
		for(int y = 0; y < map.getRows(); y++){
			for(int x = 0; x < map.getCols(); x++){
				Tile curTile = map.tileAt(y, x);
				try {
					g.drawImage(curTile.getImage(),x * (int)map.getTileSize().getWidth(),y * (int)map.getTileSize().getHeight(), null);
				} catch (IOException e) {
					e.printStackTrace();
				} catch(NullPointerException ne){
					map.dump();
					ne.printStackTrace();
				}
			}
		}
		int playerX = (player.position.x * map.tileSize.width);
		int playerY = (player.position.y * map.tileSize.height);
		g.drawImage(player.getCurrentImage(), playerX, playerY, null);

		for(Soldier s : soldiers){
			Point soldierViewableTile = getTileLocFromFullMapLoc(s.position);

			int soldierX = (soldierViewableTile.x * map.tileSize.width);
			int soldierY = (soldierViewableTile.y * map.tileSize.height);

			g.drawOval(soldierX, soldierY, map.tileSize.width, map.tileSize.height);
		}
	}

	public Point getTileLocInFullMap(Point tileLoc){
		return new Point(tileLoc.x + mapController.getPointInMapForTopLeftOfViewable().x, tileLoc.y + mapController.getPointInMapForTopLeftOfViewable().y);
	}

	public Point getTileLocFromFullMapLoc(Point fullMapLoc){
		return new Point(fullMapLoc.x - mapController.getPointInMapForTopLeftOfViewable().x, fullMapLoc.y - mapController.getPointInMapForTopLeftOfViewable().y);
	}

	public void movePlayerUp(){
		try{
			while(!Thread.currentThread().isInterrupted()){
				Point playerPos = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
				map = playerMotionController.movePlayerUp();
				Point playerPosAfterMove = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
				Thread.sleep(playerMotionController.nanosBetweenMoves() / 1000000);
			}
		}catch(Exception e){
			Thread.currentThread().interrupt();
		}
	}

	public void movePlayerLeft(){
		try{
			while(!Thread.currentThread().isInterrupted()){
				Point playerPos = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
				map = playerMotionController.movePlayerLeft();
				Point playerPosAfterMove = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
				Thread.sleep(playerMotionController.nanosBetweenMoves() / 1000000);
			}
		}catch(Exception e){
			Thread.currentThread().interrupt();
		}
	}

	public void movePlayerDown(){
		try{
			while(!Thread.currentThread().isInterrupted()){
				Point playerPos = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
				map = playerMotionController.movePlayerDown();
				Point playerPosAfterMove = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
				Thread.sleep(playerMotionController.nanosBetweenMoves() / 1000000);
			}
		}catch(Exception e){
			Thread.currentThread().interrupt();
		}
	}

	public void movePlayerRight(){
		try{
			while(!Thread.currentThread().isInterrupted()){
				Point playerPos = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
				map = playerMotionController.movePlayerRight();
				Point playerPosAfterMove = getTileLocInFullMap(player.position);
				mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
				Thread.sleep(playerMotionController.nanosBetweenMoves() / 1000000);
			}
		}catch(Exception e){
			Thread.currentThread().interrupt();
		}
	}

	public void moveMapUp(){
		Point playerPos = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
		map = playerMotionController.moveMapUp();
		Point playerPosAfterMove = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
	}

	public void moveMapLeft(){
		Point playerPos = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
		map = playerMotionController.moveMapLeft();
		Point playerPosAfterMove = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
	}

	public void moveMapDown(){
		Point playerPos = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
		map = playerMotionController.moveMapDown();
		Point playerPosAfterMove = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
	}

	public void moveMapRight(){
		Point playerPos = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
		map = playerMotionController.moveMapRight();
		Point playerPosAfterMove = getTileLocInFullMap(player.position);
		mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
	}

	public void interruptAllMovementThreads(){
		if(autoMove != null){
			autoMove.interrupt();
		}
	}

	public void updateModels(){
		for(int y = 0; y < mapController.getMap().getRows(); y++){
			for(int x = 0; x < mapController.getMap().getCols(); x++){
				Tile t = mapController.getMap().tileAt(y,x);
				if(!t.isVisible){
					unloadNPCAnchoredAt(t);
				}
				else{
					for(Base b : map.getBases()){
						if(b.isTileInBase(y, x)){
							if(!t.isNPCAnchor){
								loadNPCAnchoredAt(t);
							}
						}
					}
				}
			}
		}
		for(Soldier s : soldiers){
			if(npcMotionController.timeToMove(s)){
				mapController.getMap().tileAt(s.position.y, s.position.x).hasSprite = false;
				npcMotionController.moveSpriteDirection(s, s.getStep());
				mapController.getMap().tileAt(s.position.y, s.position.x).hasSprite = true;
			}

		}
	}

	public void render(){
		repaint();
	}

	public void attemptAutoMovePlayerToPoint(Point destTileLocRelativeToViewableScreen){
		AutoMoveController autoMover = new AutoMoveController(mapController.getMap());

		Point playerTile =  getTileLocInFullMap(player.position);
		Point destTile = getTileLocInFullMap(destTileLocRelativeToViewableScreen);

		LinkedList<Direction> path = autoMover.getSpritePathToTileLocation(playerTile,destTile);

		movePlayerAlongPath(path);
	}

	private void movePlayerAlongPath(final LinkedList<Direction> path){

		autoMove = new Thread(){
			@Override
			public void run(){
				try{
					while(!path.isEmpty()){
						Direction d = path.removeFirst();
						Point playerPos;
						Point playerPosAfterMove;
						switch(d){
						case Up:
							playerPos = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
							map = playerMotionController.movePlayerUp();
							playerPosAfterMove = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
							break;
						case Down:
							playerPos = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
							map = playerMotionController.movePlayerDown();
							playerPosAfterMove = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
							break;
						case Left:
							playerPos = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
							map = playerMotionController.movePlayerLeft();
							playerPosAfterMove = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
							break;
						case Right:
							playerPos = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPos.y, playerPos.x).hasSprite = false;
							map = playerMotionController.movePlayerRight();
							playerPosAfterMove = getTileLocInFullMap(player.position);
							mapController.getMap().tileAt(playerPosAfterMove.y, playerPosAfterMove.x).hasSprite = true;
							break;
						}

						Thread.sleep(playerMotionController.nanosBetweenMoves() / 1000000);
					}
				}catch(Exception e){
					Thread.currentThread().interrupt();
				}

			}
		};

		autoMove.start();
	}

	private void loadNPCAnchoredAt(Tile t){

		LinkedList<Direction> leftPath = new LinkedList<Direction>();
		leftPath.add(Direction.Left);
		leftPath.add(Direction.Left);
		leftPath.add(Direction.Right);
		leftPath.add(Direction.Right);

		LinkedList<Direction> rightPath = new LinkedList<Direction>();
		rightPath.add(Direction.Right);
		rightPath.add(Direction.Right);
		rightPath.add(Direction.Left);
		rightPath.add(Direction.Left);

		switch(t.getType()){
		case CastleTopLeft:
			System.out.printf("\nLoading sprite anchored at (%d,%d)\n",t.getColInMap(), t.getRowInMap());
			Soldier tls = new Soldier(1,1,1,1, new Point(t.getColInMap(), t.getRowInMap() - 1), leftPath, t);
			soldiers.add(tls);
			t.isNPCAnchor = true;
			break;
		case CastleTopRight:
			System.out.printf("\nLoading sprite anchored at (%d,%d)\n",t.getColInMap(), t.getRowInMap());
			Soldier trs = new Soldier(1,1,1,1, new Point(t.getColInMap(), t.getRowInMap() - 1), rightPath, t);
			soldiers.add(trs);
			t.isNPCAnchor = true;
			break;
		case CastleBottomLeft:
			System.out.printf("\nLoading sprite anchored at (%d,%d)\n",t.getColInMap(), t.getRowInMap());
			Soldier bls = new Soldier(1,1,1,1, new Point(t.getColInMap(), t.getRowInMap() + 1), leftPath, t);
			soldiers.add(bls);
			t.isNPCAnchor = true;
			break;
		case CastleBottomRight:
			System.out.printf("\nLoading sprite anchored at (%d,%d)\n",t.getColInMap(), t.getRowInMap());
			Soldier brs = new Soldier(1,1,1,1, new Point(t.getColInMap(), t.getRowInMap() + 1), rightPath, t);
			soldiers.add(brs);
			t.isNPCAnchor = true;
			break;
		default:
			break;
		}
	}

	private void unloadNPCAnchoredAt(Tile t){
		for (Iterator<Soldier> iterator = soldiers.iterator(); iterator.hasNext();) {
			Soldier s = iterator.next();
			Tile anchor = s.getAnchor();
			if(anchor.equals(t)){
				System.out.printf("\nUnloading sprite anchored at (%d,%d)\n",t.getColInMap(), t.getRowInMap());
				mapController.getMap().tileAt(s.position.y, s.position.x).hasSprite = false;
				iterator.remove();
				t.isNPCAnchor = false;
			}
		}
	}
}


text:
package org.apache.reef.runtime.local.driver;

/**
 * Generates unique IDs.
 */
public final class IDMaker {

  private final String prefix;
  private int counter = 0;

  /**
   * The ids generated by getNextID are of the form "prefixNUMBER", where
   * number is counted up.
   *
   * @param prefix a prefix to be used for the IDs generated.
   */
  public IDMaker(final String prefix) {
    this.prefix = prefix;
  }

  /**
   * @return the next ID
   */
  public String getNextID() {
    this.counter += 1;
    return this.prefix + this.counter;
  }
}


text:
var test    = require('tap').test;
var stubnet = require('../index');
var net     = require('net');

var sinon   = require('sinon');
var AssertionError = require('assert').AssertionError;
function failureHook (t) {
	return sinon.spy(function () {
		t.pass(this.name);
	});
}

test('unexpected connection and wrong data', function (t) {
	t.plan(8);

	var stub = failureHook(t);

	stubnet()
		.listenTo({port: 50000, pass: onReady, fail: stub, name: 'listenTo'})
		.expectData('testing', {pass: t.fail,  fail: stub, name: 'expectData'})
		.start({pass: t.pass,  done: onFinish,  name: 'server is finished'});

	function onReady() {
		t.pass.apply(this, arguments);

		var socket = new net.Socket();
		socket.connect(50000, 'localhost', function () {
			t.pass('net.connect');
			socket.write('hello', function () {
				t.pass('net.send "hello"');
				socket.end(function () {
					t.pass('net.end');
				});
			});
		});
	}

	function onFinish() {
		t.equal(stub.callCount, 1, 'only one failure detected');

		var failureValue = stub.getCall(0).args[0];
		t.ok(failureValue instanceof AssertionError, 'received an AssertionError');
		t.equal(failureValue.message, 'Unexpected connection received', 'assertion message matches');

		t.end();
	}

});


text:
var BitmapText = function (_xPos, _yPos, _anchorX, _anchorY, _font, _text, _size)
{
    // Call for a bitmap text.
    Phaser.BitmapText.call(this, game, _xPos, _yPos, _font, _text, _size);
    // Set the bitmap text's default anchors.
    this.anchor.setTo(_anchorX, _anchorY);

    // Update's the text to reflect what is typed in.
    this.UpdateText = function (_textToShow)
    {
        // Set the text of this object to the string passed in.
        this.text = _textToShow;
    };
}

// Extension of the paddle object to become a Phaser bitmap text.
BitmapText.prototype = Object.create(Phaser.BitmapText.prototype);
// Assign the paddle's constructor.
BitmapText.prototype.constructor = BitmapText;


text:
package org.apache.mesos.logstash.executor;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.api.command.InspectContainerCmd;
import com.github.dockerjava.api.command.InspectContainerResponse;
import com.github.dockerjava.api.command.ListContainersCmd;
import com.github.dockerjava.api.model.Container;
import com.github.dockerjava.api.model.ContainerConfig;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.*;

/**
 * Created by ero on 16/06/15.
 */
public class DockerInfoTest {

    private Container getContainer(final String id) {
        return new Container() {
            @Override
            public String getId() {
                return id;
            }
        };
    }

    private ContainerConfig getContainerConfig(final String logLocation, final String configFile) {
        return new ContainerConfig() {
            @Override
            public String[] getEnv() {
                if (logLocation != null && configFile != null) {
                    String[] envArray = {"LOG_LOCATION=" + logLocation, "CONFIG_FILE=" + configFile};
                    return envArray;
                }
                return new String[] {};
            }
        };
    }

    private InspectContainerResponse getContainerResponse(final String id, final String logLocation, final String configFile) {
        return new InspectContainerResponse() {
            @Override
            public ContainerConfig getConfig() {
                return getContainerConfig(logLocation, configFile);
            }

            @Override
            public String getId() {
                return id;
            }
        };
    }

    private DockerClient dockerClientStub;
    private ListContainersCmd listContainersCmd;

    private void mockListCommand(List<Container> containers) {
        when(listContainersCmd.exec()).thenReturn(containers);
    }

    private void mockInspectCommand(String containerId, InspectContainerResponse containerResponse) {
        InspectContainerCmd inspectContainerCmd = mock(InspectContainerCmd.class);

        when(dockerClientStub.inspectContainerCmd(containerId)).thenReturn(inspectContainerCmd);
        when(inspectContainerCmd.exec()).thenReturn(containerResponse);
    }

    @Before
    public void setup() {
        dockerClientStub = mock(DockerClient.class);
        listContainersCmd = mock(ListContainersCmd.class);
        when(dockerClientStub.listContainersCmd()).thenReturn(listContainersCmd);
    }

    @Test
    public void testGetContainersThatWantsLoggingExpectingSingleResult() {
        final String logLocation = "path/to/logs";
        final String configFile = "path/to/config";
        final String containerId = "TEST_CONTAINER_ID";
        final List<Container> containerIds = Collections.singletonList(getContainer(containerId));

        //
        // Arrange
        //
        this.mockListCommand(containerIds);
        this.mockInspectCommand(containerId, getContainerResponse(containerId, logLocation, configFile));

        //
        // Act
        //
        DockerInfo target = new DockerInfo(dockerClientStub);
        Map<String, LogstashInfo> result = target.getContainersThatWantsLogging();

        //
        // Assert
        //
        assertEquals(result.get(containerId).GetLoggingLocationPath(), logLocation);
        assertEquals(result.get(containerId).GetConfigurationPath(), configFile);
    }

    @Test
    public void testGetContainersThatWantsLoggingExpectingOnlyContainerThatSpecifiesLogstashEnvironment() {
        final String logLocation = "path/to/logs";
        final String configFile = "path/to/config";
        final String containerWithLoggingNeeds = "TEST_CONTAINER_ID";
        final String containerWithoutLoggingNeeds = "TEST_CONTAINER_ID_NO_LOGGING";
        final List<Container> containerIds = new ArrayList<Container>() {{
            add(getContainer(containerWithLoggingNeeds));
            add(getContainer(containerWithoutLoggingNeeds));
        }};

        //
        // Arrange
        //
        this.mockListCommand(containerIds);
        this.mockInspectCommand(containerWithLoggingNeeds, getContainerResponse(containerWithLoggingNeeds, logLocation, configFile));
        this.mockInspectCommand(containerWithoutLoggingNeeds, getContainerResponse(containerWithoutLoggingNeeds, null, null));

        //
        // Act
        //
        DockerInfo target = new DockerInfo(dockerClientStub);
        Map<String, LogstashInfo> result = target.getContainersThatWantsLogging();

        //
        // Assert
        //
        assertTrue(result.containsKey(containerWithLoggingNeeds));
        assertFalse(result.containsKey(containerWithoutLoggingNeeds));
    }
}


text:
<?php

namespace RM\FooBundle\Form\Type;

use \Symfony\Component\OptionsResolver\OptionsResolverInterface;

class BundleType extends \Symfony\Component\Form\AbstractType
{
  public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder, array $options)
  {
    $builder->add('bundle', 'choice', array('choices' => array('m' => 'Male', 'f' => 'Female')));
  }

  public function setDefaultOptions(OptionsResolverInterface $resolver) {

  }

  public function getName() {
    return 'rm_foo';
  }
}

?>


text:
import { isNumber, toNumber, isNaN } from 'lodash'
import { isEmpty } from '../../utils/helper'

export default {
  validate (val) {
    return !isEmpty(val)
      ? isNumber(val) || !isNaN(toNumber(val))
      : true
  },
  message: '值必须为数字',
  priority: 10
}


text:
The `libraw` crate provides a safe wrapper around the native `libraw` library.

* [Documentation](http://dcuddeback.github.io/libraw-rs/libraw/)

## Dependencies
In order to use the `libraw` crate, you must have the `libraw_r` library installed where it can be
found by `pkg-config`. `libraw_r` is the reentrant version of LibRaw. Linking against the non
reentrant `libraw` is not supported.

On Debian-based Linux distributions, install the `libraw-dev` package:

```
sudo apt-get install libraw-dev
```

On OS X, install `libraw` with Homebrew:

```
brew install libraw
```

On FreeBSD, install the `libraw` package:

```
sudo pkg install libraw
```

## Usage
Add `libraw` as a dependency in `Cargo.toml`:

```toml
[dependencies]
libraw = "0.1"
```

Import the `libraw` crate. Open an image with `Image::open()` and then use the methods on `Image` to
operate on and inspect the raw image data.

```rust
extern crate libraw;

use std::path::Path;

fn main() {
    let mut image = libraw::Image::open(Path::new("image.nef")).unwrap();

    image.unpack().unwrap();
    let raw = image.raw_pixmap().unwrap();

    let sum = raw.pixels().fold(0, |accum, pixel| {
        accum + pixel.value() as usize
    });

    println!("average pixel brightness = {:.3}", sum as f64 / raw.len() as f64);
}
```

## License
Copyright © 2015 David Cuddeback

Distributed under the [MIT License](LICENSE).

*Note:* By using this crate, your executable will link to the `libraw` C library, which is available
under the [LGPL version 2.1, CDDL version 1.0, or LibRaw Software
License](https://github.com/LibRaw/LibRaw/blob/master/COPYRIGHT).


text:
package ru.job4j.sortuser;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.TreeSet;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

/**
 * Created on 13.07.2017.
 */
public class SortUserTest {
    /**
     * Test sorting of Users.
     */
    @Test
    public void sort() {
        SortUser sortUser = new SortUser();

        List<User> users = Arrays.asList(
                new User("user0", 25),
                new User("user1", 31),
                new User("user2", 19),
                new User("user3", 42)
        );

        TreeSet<User> expectedSet = new TreeSet<>();
        expectedSet.add(new User("user2", 19));
        expectedSet.add(new User("user0", 25));
        expectedSet.add(new User("user1", 31));
        expectedSet.add(new User("user3", 42));

        assertEquals(expectedSet, sortUser.sort(users));
    }

    /**
     * Test sorting of Users by name length.
     */
    @Test
    public void sortNameLength() {
        SortUser sortUser = new SortUser();
        List<User> users = Arrays.asList(new User("Сергей", 25), new User("Иван", 30), new User("Николай", 20));
        String expected = "[Name: Иван Age 30, Name: Сергей Age 25, Name: Николай Age 20]";
        String result = sortUser.sortNameLength(users).toString();
        assertThat(result, is(expected));
    }

    /**
     * Test sorting of Users by name length and age.
     */
    @Test
    public void sortByAllFields() {
        SortUser sortUser = new SortUser();
        List<User> users = Arrays.asList(new User("Сергей", 25), new User("Иван", 30), new User("Сергей", 30), new User("Иван", 25));
        String expected = "[Name: Иван Age 25, Name: Иван Age 30, Name: Сергей Age 25, Name: Сергей Age 30]";
        String result = sortUser.sortByAllFields(users).toString();
        assertThat(result, is(expected));
    }
}


text:
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" user-scalable="no">
        <link rel="shortcut icon" type="image/x-icon" href="/assets/images/favicon.ico" />
        <title>Medium Advanced Editor</title>

        <link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
        <link type="text/css" rel="stylesheet" href="assets/css/design.css">

            Abder

                        <button class="btn " title="Read later"></button>
                <button id="enable-night-mode" class="btn" title="Night mode"></button>
                <button class="btn"></button>

            Egyptian Women: you owe it to your future daughters to speak up

        Egyptian Women: you owe it to your future daughters to speak up

        Egyptian women participate in protests in July 2013

See more here

Last September, Egypt was named the worst country out of 22 Arab countries in which to be a woman. During the Arab Spring and subsequently, many women were sexually assaulted or raped. However, some Egyptian women have claimed that this statement is unfair to women in Syria, whose sexual assault is an extension of the conflict that grips the country. It was also suggested that the finding overlooks women in Saudi Arabia that cannot leave their house without male permission. What is difficult is determining the grounds on which you determine the 'worst'.

Mariam Kirollos, co-founder of Operation Anti-Sexual Harassment/Assault, stated the following to The Huffington Post:

You can't compare rape in a public square to women being banned from driving a car.

Isn't it heartbreaking when a crucial discussion focuses on which is worse: not going anywhere without consent from a male relative or being raped amidst thousands of people?

As a journalist I'm always searching for objectivity. About half a year ago I started to do research on women in Islam and the Arab world. As a Western feminist and atheist, but chiefly an idealist, I was looking for truth in places where even the word 'truth' has different meanings. As a white female who grew up in the Netherlands, I could not say that I understand what it is like to be a woman in the Middle East. That does not mean I will keep silent about it their suffering. Egyptian women's advancement does not depend on contributions such as mine, since that would be denigrating towards the strength I believe so many Arab women have. This is simply a show of support.

Graffiti that not only portrays sexual violence, but the fear and intimidation that comes with it. Common excuses used by attackers are also depicted.

SEXUAL TERRORISM SILENCES WOMEN

When the Human Rights Watch identifies an 'epidemic of sexual violence', it is clear that these attacks go beyond discrete instances of assault. It is about a systemic social problem that implies a large-scale abandonment of adherence to what is right. So that I make myself entirely clear, when a group of men violently attack and rape a woman, that is fundamentally wrong. There is neither credible institution nor doctrine that sanctions such vile and predacious behaviour. What sickens me the most is a common response that the victim is responsible for an attack. Under no circumstances is it acceptable that a woman, victim to an attack, be held responsible for that assault.

Women need to take care of themselves. Unfortunately, that may entail avoiding democratic participation in demonstrations such as those in Tahrir Square. In July 2013, dozens of women were sexually assaulted at Tahrir Square during protesters against deposed President Mohammed Morsi. Similar incidents were witnessed during the January 25 revolution in 2011.

It is unacceptable that a woman should be forced to make the choice between expressing her views in a rally and her personal security. It is a fundamental precept of democracy that no such compromise need be made.

DIGGING UP ROOTS

The question is: how can we empower women when authorities act as if the woman is complicit in her attack? Last week a new anti-sexual-harassment-law was approved by the Cabinet, but the protection it affords is made almost unattainable, since a woman must provide two eyewitnesses to support her claim. A lot of the victims tell stories in the media about how witnesses look away or avoid the incident altogether. To add insult to injury, in some cases the victim must bring their harasser to the police station themselves.

That is the exact problem of the matter. Though this law is a first step in creating a society where a woman has security of person, it is not enough. There is a culture and mentality in Egypt that needs to be changed. I think women should be the ones to dig up those roots and hold them in the sunlight until everyone sees how rotten they are.

Many women – though there are many local initiatives to change this – do not speak up about their experiences. I do not wish to limit their right to privacy, but I worry about those women the way I think they no doubt worry about their daughters. Would you want your daughter to grow up looking over her shoulder because she has always felt unsafe or victimised by men and that the system of law that should protect her fails miserably? Silence will slow progress.

A PROCESS INSTEAD OF A REVOLUTION

This is not something that changes overnight with revolution. It is a gradual process. As a woman, start to be the protector of your own integrity. Start with the way you look at sexual violence. Instead of gossiping about what the woman next door was wearing last time she was abused on the streets, publicly criticise the perpetrator's crime.

If you want to teach your future daughter self-love and self-respect, start with yourself and the women around you. Unite and speak up for your rights.


text:
//==============================================================================
// Copyright 2016 Windy Darian (Ruoyu Fan)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//==============================================================================
//
// Created on Oct 5, 2016
// https://leetcode.com/problems/reverse-linked-list/

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */

class Solution {
public:
    ListNode* reverseList(ListNode* head)
    {
        ListNode* current_head = nullptr; // that's what is supposed to be at the end
        while(head)
        {
            // move head pointer every time to the front so it becomes the real head
            auto temp = head->next;
            head->next = current_head;
            current_head = head;
            head = temp;
        }
        return current_head;
    }
};


text:
gereji
======

A non-restrictive web application framework for creating multi-site web applications focused on security and performance.


text:
package main

import (
	"bufio"
	"flag"
	"fmt"
	"io"
	"log"
	"os"
	"path/filepath"
	"runtime"
	"runtime/pprof"
	"strconv"
	"strings"
	"time"

	"github.com/nitrogen-lang/nitrogen/src/ast"
	builtinOs "github.com/nitrogen-lang/nitrogen/src/builtins/os"
	"github.com/nitrogen-lang/nitrogen/src/compiler"
	"github.com/nitrogen-lang/nitrogen/src/compiler/marshal"
	"github.com/nitrogen-lang/nitrogen/src/lexer"
	"github.com/nitrogen-lang/nitrogen/src/moduleutils"
	"github.com/nitrogen-lang/nitrogen/src/object"
	"github.com/nitrogen-lang/nitrogen/src/parser"
	"github.com/nitrogen-lang/nitrogen/src/vm"

	_ "github.com/nitrogen-lang/nitrogen/src/builtins"
)

const (
	interactivePrompt = ">> "
)

type strSliceFlag []string

func (s *strSliceFlag) String() string {
	return strings.Join(*s, ":")
}

func (s *strSliceFlag) Set(st string) error {
	*s = append(*s, st)
	return nil
}

var (
	interactive  bool
	printAst     bool
	startSCGI    bool
	printVersion bool
	fullDebug    bool
	compileOnly  bool
	cpuprofile   string
	memprofile   string
	outputFile   string

	infoCmd bool

	modulePaths     strSliceFlag
	autoloadModules strSliceFlag

	version         = "Unknown"
	buildTime       = ""
	builder         = ""
	builtinModPaths = ""
)

func init() {
	pwd, _ := os.Getwd()
	modulePaths = append(modulePaths, pwd)

	envModPath := os.Getenv("NITROGEN_MODULES")
	if envModPath != "" {
		modulePaths = append(modulePaths, strings.Split(envModPath, ":")...)
	}

	flag.BoolVar(&interactive, "i", false, "Interactive mode")
	flag.BoolVar(&compileOnly, "c", false, "Compile code, print any errors, and exit")
	flag.BoolVar(&printAst, "ast", false, "Print AST and exit")
	flag.BoolVar(&startSCGI, "scgi", false, "Start as an SCGI server")
	flag.BoolVar(&printVersion, "version", false, "Print version information")
	flag.BoolVar(&fullDebug, "debug", false, "Enable debug mode")
	flag.StringVar(&cpuprofile, "cpuprofile", "", "File to write CPU profile data")
	flag.StringVar(&memprofile, "memprofile", "", "File to write memory profile data")
	flag.StringVar(&outputFile, "o", "", "Output file of compiled bytecode")

	flag.Var(&modulePaths, "M", "Module search paths")
	flag.Var(&autoloadModules, "al", "Autoload modules")

	flag.BoolVar(&infoCmd, "info", false, "Print information about a .nib file")
}

func main() {
	flag.Parse()

	if builtinModPaths != "" {
		modulePaths = append(modulePaths, strings.Split(builtinModPaths, ":")...)
	}

	if printVersion {
		versionInfo()
		return
	}

	if infoCmd {
		runInfoCmd()
		return
	}

	if len(autoloadModules) > 0 {
		if err := loadModules(modulePaths, autoloadModules); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}
	}

	if startSCGI {
		startSCGIServer()
		return
	}

	moduleutils.ParserSettings.Debug = fullDebug
	if interactive {
		fmt.Println("Nitrogen Programming Language")
		fmt.Println("Type in commands at the prompt")
		startRepl(os.Stdin, os.Stdout)
		return
	}

	if flag.NArg() == 0 {
		fmt.Println("No script given")
		os.Exit(1)
	}

	if cpuprofile != "" {
		f, err := os.Create(cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	sourceFile := flag.Arg(0)

	env := makeEnv(sourceFile)
	builtinOs.SetCmdArgs(getScriptArgs(sourceFile))

	var code *compiler.CodeBlock
	var program *ast.Program
	var err error
	if filepath.Ext(sourceFile) == ".nib" {
		code, _, err = marshal.ReadFile(sourceFile)
		if err != nil {
			fmt.Print("There were errors reading compiled program:\n\n")
			fmt.Println(err.Error())
			return
		}
	} else {
		program, err = moduleutils.ASTCache.GetTree(sourceFile)
		if err != nil {
			fmt.Print("There were errors compiling the program:\n\n")
			fmt.Println(err.Error())
			os.Exit(1)
			return
		}

		if printAst {
			fmt.Println(program.String())
			return
		}
	}

	var result object.Object
	var start time.Time

	if code == nil {
		code = compiler.Compile(program, "__main")
	}

	if outputFile != "" {
		marshal.WriteFile(outputFile, code, moduleutils.FileModTime(sourceFile))
		return
	}

	if compileOnly {
		return
	}

	start = time.Now()
	result = runCompiledCode(code, env)

	if fullDebug {
		fmt.Printf("Execution took %s\n", time.Now().Sub(start))
	}

	if result != nil && result != object.NullConst {
		if e, ok := result.(*object.Exception); ok {
			os.Stdout.WriteString(e.Message)
			os.Stdout.Write([]byte{'\n'})
			os.Exit(1)
		}
		os.Stdout.WriteString(result.Inspect())
		os.Stdout.Write([]byte{'\n'})
	}

	if memprofile != "" {
		f, err := os.Create(memprofile)
		if err != nil {
			log.Fatal("could not create memory profile: ", err)
		}
		if err := pprof.WriteHeapProfile(f); err != nil {
			log.Fatal("could not write memory profile: ", err)
		}
		f.Close()
	}
}

func runCompiledCode(code *compiler.CodeBlock, env *object.Environment) object.Object {
	if fullDebug {
		code.Print("")
	}

	env.CreateConst("_FILE", object.MakeStringObj(code.Filename))

	vmsettings := vm.NewSettings()
	vmsettings.Debug = fullDebug
	machine := vm.NewVM(vmsettings)
	machine.SetGlobalEnv(env)
	machine.SetInstanceVar("std.os.env", getExternalEnv())

	ret, err := machine.Execute(code, nil)
	if err != nil {
		if ex, ok := err.(vm.ErrExitCode); ok {
			os.Exit(ex.Code)
		}
	}
	return ret
}

func makeEnv(filepath string) *object.Environment {
	env := object.NewEnvironment()
	env.CreateConst("_SERVER", getServerEnv())
	env.Create("_SEARCH_PATHS", object.MakeStringArray(modulePaths))
	return env
}

var cgiHeaderNames = []string{
	"AUTH_TYPE",
	"DOCUMENT_ROOT",
	"DOCUMENT_URI",
	"GATEWAY_INTERFACE",
	"HTTP_ACCEPT_CHARSET",
	"HTTP_ACCEPT_ENCODING",
	"HTTP_ACCEPT_LANGUAGE",
	"HTTP_ACCEPT",
	"HTTP_CONNECTION",
	"HTTP_HOST",
	"HTTP_REFERER",
	"HTTP_USER_AGENT",
	"HTTPS",
	"QUERY_STRING",
	"REDIRECT_REMOTE_USER",
	"REMOTE_ADDR",
	"REMOTE_HOST",
	"REMOTE_PORT",
	"REMOTE_USER",
	"REQUEST_METHOD",
	"REQUEST_TIME",
	"REQUEST_URI",
	"SCRIPT_FILENAME",
	"SCRIPT_NAME",
	"SERVER_ADDR",
	"SERVER_ADMIN",
	"SERVER_NAME",
	"SERVER_PORT",
	"SERVER_PROTOCOL",
	"SERVER_SIGNATURE",
	"SERVER_SOFTWARE",
}

func getServerEnv() object.Object {
	if os.Getenv("GATEWAY_INTERFACE") != "CGI/1.1" {
		return object.MakeEmptyHash()
	}

	headers := make(map[string]string, len(cgiHeaderNames))
	for _, header := range cgiHeaderNames {
		headers[header] = os.Getenv(header)
	}

	return object.StringMapToHash(headers)
}

func getExternalEnv() *object.Hash {
	return object.StringMapToHash(getExtEnvMap())
}

func getExtEnvMap() map[string]string {
	env := os.Environ()
	m := make(map[string]string, len(env))
	for _, v := range env {
		val := strings.SplitN(v, "=", 2)
		m[val[0]] = val[1]
	}
	return m
}

func getScriptArgs(filepath string) *object.Array {
	var s []string
	if flag.NArg() > 1 {
		s = flag.Args()[1:]
	}
	length := len(s) + 1
	newElements := make([]object.Object, length, length)
	newElements[0] = object.MakeStringObj(filepath)
	for i, v := range s {
		newElements[i+1] = object.MakeStringObj(v)
	}
	return &object.Array{Elements: newElements}
}

func startRepl(in io.Reader, out io.Writer) {
	scanner := bufio.NewScanner(in)
	env := makeEnv("")

	var code *compiler.CodeBlock
	for {
		fmt.Fprint(out, interactivePrompt)
		scanned := scanner.Scan()
		if !scanned {
			return
		}

		line := strings.TrimSpace(scanner.Text())
		if line == "" {
			continue
		}
		if line == ".quit" || line == ".exit" {
			return
		}

		l := lexer.NewString(line)
		p := parser.New(l, moduleutils.ParserSettings)

		program := p.ParseProgram()
		if len(p.Errors()) != 0 {
			printParserErrors(out, p.Errors())
			continue
		}

		code = compiler.Compile(program, "__main")

		result := runCompiledCode(code, env)
		if result != nil && result != object.NullConst {
			io.WriteString(out, result.Inspect())
		}
		io.WriteString(out, "\n")
	}
}

func printParserErrors(out io.Writer, errors []string) {
	for _, msg := range errors {
		fmt.Fprintf(out, "ERROR: %s\n", msg)
	}
}

func versionInfo() {
	fmt.Printf(`Nitrogen - (C) 2018 Lee Keitel
Version:           %s
Built:             %s
Compiled by:       %s
Go version:        %s %s/%s
Modules Supported: %t
Builtin Mod Path:  %s
`, version, buildTime, builder, runtime.Version(), runtime.GOOS, runtime.GOARCH, modulesSupported, builtinModPaths)
}

func runInfoCmd() {
	sourceFile := flag.Arg(0)
	if sourceFile == "" {
		return
	}

	code, fileinfo, err := marshal.ReadFile(sourceFile)
	if err != nil {
		fmt.Println(err.Error())
		return
	}

	fmt.Printf("Filename: %s\n", fileinfo.Filename)
	fmt.Printf("Version:  %s\n", bytesToVersionNumber(fileinfo.Version))
	fmt.Printf("ModTime:  %s\n", fileinfo.ModTime)
	code.Print("")
}

func bytesToVersionNumber(b []byte) string {
	ver := ""
	for _, v := range b {
		ver += strconv.Itoa(int(v)) + "."
	}
	return strings.TrimRight(ver, ".")
}


text:
namespace single {

class single {

private:
  size_t N;
  std::vector<double> &A;
  std::vector<double> &B;
  bool transposed;

  uint64_t block_result;
  uint64_t block_input;
  uint64_t repetitions;
  uint64_t verbose;

public:
  single(size_t N, std::vector<double> &A, std::vector<double> &B,
         bool transposed, uint64_t block_result, uint64_t block_input,
         uint64_t repetitions, uint64_t verbose);

  std::vector<double> matrix_multiply();
};
}


text:
class UsersController < ApplicationController
  respond_to :xlsx, :html

  # GET /users
  # GET /users.json
  def index
    @users = User.all

    respond_to do |format|
      format.html # index.html.erb
      format.xlsx
    end
  end

  def show
    @user = User.find(params[:id])
    respond_with(@user) do |format|
      format.xlsx { render "respond_with.xlsx.axlsx" }
    end
  end

  def send_instructions
    @user = User.find(params[:user_id])
    @user.send_instructions
    render text: "Email sent"
  end
end


text:
'use strict';

// -----------------------------------------------------------------
// Main application routine
// -----------------------------------------------------------------
angular.module('myApp', ['ngRoute', 'myApp.filters', 'myApp.services',
			    'myApp.directives', 'myApp.controllers',
			    'ui.bootstrap', 'angularFileUpload'])
    .config(['$routeProvider', function($routeProvider) {

// Login
	$routeProvider.when('/login', {
	    templateUrl : 'section/login.html',
	    controller : 'LoginCtrl'
	});

// Customer login
	$routeProvider.when('/table', {
		templateUrl : 'section/table.html',
		controller : 'TableLoginCtrl'
	});

// Customer section
	$routeProvider.when('/customer', {
		templateUrl : 'section/customer.html',
	});

// Manager section
	$routeProvider.when('/manager', {
	    templateUrl : 'section/manager.html',
	    controller : 'ManagerCtrl'
	});

// Kitchen section
	$routeProvider.when('/kitchen', {
	    templateUrl : 'section/kitchen.html',
	    controller : 'KitchenCtrl'
	});

// Waiter section
	$routeProvider.when('/waiter', {
	    templateUrl : 'section/waiter.html',
	    controller : 'WaiterCtrl'
	});

// All other requests
	$routeProvider.otherwise({
	    redirectTo : '/login'
	});
}]);


text:
/* NOTE: Version 1.2 did things differently and didn't rely on luck to
   avoid collisions.  Unfortunately, it didn't have the property that
   the same directory would have the same name between runs of Executor */

#if !defined (OMIT_RCSID_STRINGS)
char ROMlib_rcsid_win_stat[] = "$Id: win_stat.c 63 2004-12-24 18:19:43Z ctm $";
#endif

#define USE_WINDOWS_NOT_MAC_TYPEDEFS_AND_DEFINES

#include "rsys/common.h"

#include <windows.h>

#include <ctype.h>
#include <string.h>

#include "rsys/error.h"

#include "win_stat_private.h"
#include "win_stat.h"

/*
 * fold lower to uppper and fold slash to back-slash
 */

PRIVATE uint32
char_val (int c)
{
  uint32 retval;

  retval = toupper (c);
  if (c == '/')
    retval = '\\';
  return retval;
}

/*
 * The original hash function was found to generate a unique value for each
 * of the 14,619 different filenames on uni:/win95 and uni:/d, but then,
 * without thinking it through, I added code to knock the top bit off so
 * that the value would always be positive.  This caused trouble, so I
 * added u to the mix so that a single bit difference will affect more
 * than a single bit.  I also changed the code that zaps the high bit to
 * do a mod of the largest lesser of two primes below 2^31.  The result
 * is what you see now, and it's been tested on 27,483 different files.
 */

PRIVATE uint32
hash_func (const char *p)
{
  uint32 retval, u;
  int c;
  const char *orig_p;

  orig_p = p;
  retval = 0;
  u = 0;
  while ((c = *p++))
    {
      int cv;
      int rotate;

      cv = char_val (c);

      retval = ((retval<<5)|(retval >> 27)) ^ cv;
      rotate = cv % 31;
      u = u ^ ((retval << rotate)|(retval >> (32 - rotate)));
    }

  retval ^= u;
  retval %= 2147482949; /* strip the top bit w/o ignoring it */

#if 0
  warning_trace_info ("p = '%s', retval = 0x%08x", orig_p, retval);
#endif

  return retval;
}

PUBLIC uint32
ino_from_name (const char *name)
{
  char fullname[2048];
  char *filenamep;
  uint32 len;
  char *p;
  uint32 retval;

  len = GetFullPathName (name, sizeof fullname, fullname, &filenamep);
  if (len <= sizeof fullname - 1)
    p = fullname;
  else
    {
      uint32 len2;

      ++len;
      p = alloca (len);
      len2 = GetFullPathName (name, len, p, &filenamep);
      if (len2 >= len)
	p = (char *) name;
    }

  if (p[1] == ':' && p[2] == '\\' && !p[3])
    retval = 2;
  else
    retval = hash_func (p);
  return retval;
}


text:
using System;
using System.Linq;

class AppearanceCount
{
    static int CountAppearance(int[] numbers, int searchingNumber)
    {
        int counter = 0;
        foreach (var number in numbers)
        {
            if (number == searchingNumber)
            {
                counter++;
            }
        }
        return counter;
    }

    static void Main()
    {
        Console.ReadLine();
        int[] numbers = Console.ReadLine()
        .Split(' ')
        .Select(int.Parse)
        .ToArray();

        int searchingNumber = int.Parse(Console.ReadLine());

        Console.WriteLine(CountAppearance(numbers, searchingNumber));
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Using the old Servlet API 2.5 for demonstration purposes. -->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">
  <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>example.HelloWorld</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/hello</url-pattern>
  </servlet-mapping>
</web-app>


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

namespace TradeAndTravel
{
    public class InteractionManager
    {
        const int InitialPersonMoney = 100;

        protected Dictionary<Person, int> moneyByPerson = new Dictionary<Person, int>();
        protected Dictionary<Item, Person> ownerByItem = new Dictionary<Item, Person>();
        protected Dictionary<Location, List<Item>> strayItemsByLocation = new Dictionary<Location, List<Item>>();

        protected HashSet<Location> locations = new HashSet<Location>();
        protected HashSet<Person> people = new HashSet<Person>();

        protected Dictionary<string, Person> personByName = new Dictionary<string, Person>();
        protected Dictionary<string, Location> locationByName = new Dictionary<string, Location>();
        protected Dictionary<Location, List<Person>> peopleByLocation = new Dictionary<Location, List<Person>>();

        public void HandleInteraction(string[] commandWords)
        {
            if (commandWords[0] == "create")
            {
                this.HandleCreationCommand(commandWords);
            }
            else
            {
                var actor = this.personByName[commandWords[0]];

                this.HandlePersonCommand(commandWords, actor);
            }
        }

        protected virtual void HandlePersonCommand(string[] commandWords, Person actor)
        {
            switch (commandWords[1])
            {
                case "drop":
                    HandleDropInteraction(actor);
                    break;
                case "pickup":
                    HandlePickUpInteraction(actor);
                    break;
                case "sell":
                    this.HandleSellInteraction(commandWords, actor);
                    break;
                case "buy":
                    HandleBuyInteraction(commandWords, actor);
                    break;
                case "inventory":
                    HandleListInventoryInteraction(actor);
                    break;
                case "money":
                    Console.WriteLine(moneyByPerson[actor]);
                    break;
                case "travel":
                    HandleTravelInteraction(commandWords, actor);
                    break;
                default:
                    break;
            }
        }

        private void HandleTravelInteraction(string[] commandWords, Person actor)
        {
            var traveller = actor as ITraveller;
            if (traveller != null)
            {
                var targetLocation = this.locationByName[commandWords[2]];
                peopleByLocation[traveller.Location].Remove(actor);
                traveller.TravelTo(targetLocation);
                peopleByLocation[traveller.Location].Add(actor);

                foreach (var item in actor.ListInventory())
                {
                    item.UpdateWithInteraction("travel");
                }
            }
        }

        private void HandleListInventoryInteraction(Person actor)
        {
            var inventory = actor.ListInventory();
            foreach (var item in inventory)
            {
                if (ownerByItem[item] == actor)
                {
                    Console.WriteLine(item.Name);
                    item.UpdateWithInteraction("inventory");
                }
            }

            if (inventory.Count == 0)
            {
                Console.WriteLine("empty");
            }
        }

        private void HandlePickUpInteraction(Person actor)
        {
            foreach (var item in strayItemsByLocation[actor.Location])
            {
                this.AddToPerson(actor, item);
                item.UpdateWithInteraction("pickup");
            }
            strayItemsByLocation[actor.Location].Clear();
        }

        private void HandleDropInteraction(Person actor)
        {
            foreach (var item in actor.ListInventory())
            {
                if (ownerByItem[item] == actor)
                {
                    strayItemsByLocation[actor.Location].Add(item);
                    this.RemoveFromPerson(actor, item);

                    item.UpdateWithInteraction("drop");
                }
            }
        }

        private void HandleBuyInteraction(string[] commandWords, Person actor)
        {
            Item saleItem = null;
            string saleItemName = commandWords[2];
            var buyer = personByName[commandWords[3]] as Shopkeeper;

            if (buyer != null &&
                peopleByLocation[actor.Location].Contains(buyer))
            {
                foreach (var item in buyer.ListInventory())
                {
                    if (ownerByItem[item] == buyer && saleItemName == item.Name)
                    {
                        saleItem = item;
                    }
                }

                var price = buyer.CalculateSellingPrice(saleItem);
                moneyByPerson[buyer] += price;
                moneyByPerson[actor] -= price;
                this.RemoveFromPerson(buyer, saleItem);
                this.AddToPerson(actor, saleItem);

                saleItem.UpdateWithInteraction("buy");
            }
        }

        private void HandleSellInteraction(string[] commandWords, Person actor)
        {
            Item saleItem = null;
            string saleItemName = commandWords[2];
            foreach (var item in actor.ListInventory())
            {
                if (ownerByItem[item] == actor && saleItemName == item.Name)
                {
                    saleItem = item;
                }
            }

            var buyer = personByName[commandWords[3]] as Shopkeeper;
            if (buyer != null &&
                peopleByLocation[actor.Location].Contains(buyer))
            {
                var price = buyer.CalculateBuyingPrice(saleItem);
                moneyByPerson[buyer] -= price;
                moneyByPerson[actor] += price;
                this.RemoveFromPerson(actor, saleItem);
                this.AddToPerson(buyer, saleItem);

                saleItem.UpdateWithInteraction("sell");
            }
        }

        protected void AddToPerson(Person actor, Item item)
        {
            actor.AddToInventory(item);
            ownerByItem[item] = actor;
        }

        protected void RemoveFromPerson(Person actor, Item item)
        {
            actor.RemoveFromInventory(item);
            ownerByItem[item] = null;
        }

        protected void HandleCreationCommand(string[] commandWords)
        {
            if (commandWords[1] == "item")
            {
                string itemTypeString = commandWords[2];
                string itemNameString = commandWords[3];
                string itemLocationString = commandWords[4];
                this.HandleItemCreation(itemTypeString, itemNameString, itemLocationString);
            }
            else if (commandWords[1] == "location")
            {
                string locationTypeString = commandWords[2];
                string locationNameString = commandWords[3];
                this.HandleLocationCreation(locationTypeString, locationNameString);
            }
            else
            {
                string personTypeString = commandWords[1];
                string personNameString = commandWords[2];
                string personLocationString = commandWords[3];
                this.HandlePersonCreation(personTypeString, personNameString, personLocationString);
            }
        }

        protected virtual void HandleLocationCreation(string locationTypeString, string locationName)
        {
            Location location = CreateLocation(locationTypeString, locationName);

            locations.Add(location);
            strayItemsByLocation[location] = new List<Item>();
            peopleByLocation[location] = new List<Person>();
            locationByName[locationName] = location;
        }

        protected virtual void HandlePersonCreation(string personTypeString, string personNameString, string personLocationString)
        {
            var personLocation = locationByName[personLocationString];

            Person person = CreatePerson(personTypeString, personNameString, personLocation);

            personByName[personNameString] = person;
            peopleByLocation[personLocation].Add(person);
            moneyByPerson[person] = InteractionManager.InitialPersonMoney;
        }

        protected virtual void HandleItemCreation(string itemTypeString, string itemNameString, string itemLocationString)
        {
            var itemLocation = locationByName[itemLocationString];

            Item item = null;
            item = CreateItem(itemTypeString, itemNameString, itemLocation, item);

            ownerByItem[item] = null;
            strayItemsByLocation[itemLocation].Add(item);
        }

        protected virtual Item CreateItem(string itemTypeString, string itemNameString, Location itemLocation, Item item)
        {
            switch (itemTypeString)
            {
                case "armor":
                    item = new Armor(itemNameString, itemLocation);
                    break;
				case "weapon":
					item = new Weapon(itemNameString, itemLocation);
					break;
				case "wood":
					item = new Wood(itemNameString, itemLocation);
					break;
				case "iron":
					item = new Iron(itemNameString, itemLocation);
					break;
                default:
                    break;
            }
            return item;
        }

        protected virtual Person CreatePerson(string personTypeString, string personNameString, Location personLocation)
        {
            Person person = null;
            switch (personTypeString)
            {
                case "shopkeeper":
                    person = new Shopkeeper(personNameString, personLocation);
                    break;
                case "traveller":
                    person = new Traveller(personNameString, personLocation);
                    break;
                default:
                    break;
            }
            return person;
        }

        protected virtual Location CreateLocation(string locationTypeString, string locationName)
        {
            Location location = null;
            switch (locationTypeString)
            {
                case "town":
                    location = new Town(locationName);
                    break;
                default:
                    break;
            }
            return location;
        }
    }
}