text:
package com.gs.fw.common.mithra.test.domain.pure;

import java.util.Date;
import java.sql.Timestamp;

public abstract class PureType2TxnTypes extends PureType2TxnTypesAbstract
{

    public static final char TYPE_A = 'A';
    public static final char TYPE_B = 'B';

    private static PureType2TxnTypes createFromBuilder(Builder builder)
    {
        PureType2TxnTypes txnTypes;
        if (builder.type == 'A')
        {
            txnTypes = new PureType2TxnTypesA();
        }
        else if (builder.type == 'B')
        {
            txnTypes = new PureType2TxnTypesB();
        }
        else
        {
            throw new IllegalStateException("type must be 'A' or 'B'");
        }
        txnTypes.setPkCharAttribute(builder.type);
        txnTypes.setPkBooleanAttribute(builder.boolean0);
        txnTypes.setPkByteAttribute(builder.byte0);
        txnTypes.setPkDateAttribute(builder.date0);
        txnTypes.setPkDoubleAttribute(builder.double0);
        txnTypes.setPkFloatAttribute(builder.float0);
        txnTypes.setPkIntAttribute(builder.int0);
        txnTypes.setPkLongAttribute(builder.long0);
        txnTypes.setPkShortAttribute(builder.short0);
        txnTypes.setPkStringAttribute(builder.string0);
        txnTypes.setPkTimestampAttribute(builder.timestamp0);
        return txnTypes;
    }

    public static class Builder
    {
        private char type;
        private boolean boolean0;
        private byte byte0;
        private Date date0;
        private double double0;
        private float float0;
        private int int0;
        private long long0;
        private short short0;
        private String string0;
        private Timestamp timestamp0;

        public Builder(char type)
        {
            this.type = type;
        }

        public PureType2TxnTypes build()
        {
            return PureType2TxnTypes.createFromBuilder(this);
        }

        public Builder withBoolean(boolean boolean0)
        {
            this.boolean0 = boolean0;
            return this;
        }

        public Builder withByte(byte byte0)
        {
            this.byte0 = byte0;
            return this;
        }

        public Builder withDate(Date date0)
        {
            this.date0 = date0;
            return this;
        }

        public Builder withDouble(double double0)
        {
            this.double0 = double0;
            return this;
        }

        public Builder withFloat(float float0)
        {
            this.float0 = float0;
            return this;
        }

        public Builder withInt(int int0)
        {
            this.int0 = int0;
            return this;
        }

        public Builder withLong(long long0)
        {
            this.long0 = long0;
            return this;
        }

        public Builder withShort(short short0)
        {
            this.short0 = short0;
            return this;
        }

        public Builder withString(String string0)
        {
            this.string0 = string0;
            return this;
        }

        public Builder withTimestamp(Timestamp timestamp0)
        {
            this.timestamp0 = timestamp0;
            return this;
        }
    }
}


text:
package com.sequenceiq.freeipa.service.freeipa.config;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class FreeIpaBackupConfigView {

    private static final Logger LOGGER = LoggerFactory.getLogger(FreeIpaBackupConfigView.class);

    private static final String EMPTY_CONFIG_DEFAULT = "";

    private final boolean enabled;

    private final boolean monthlyFullEnabled;

    private final boolean hourlyEnabled;

    private final boolean initialFullEnabled;

    private final String platform;

    private final String location;

    private final String azureInstanceMsi;

    private final String proxyUrl;

    private final String awsRegion;

    private String gcpServiceAccount;

    @SuppressWarnings("ExecutableStatementCount")
    private FreeIpaBackupConfigView(FreeIpaBackupConfigView.Builder builder) {
        enabled = builder.enabled;
        monthlyFullEnabled = builder.monthlyFullEnabled;
        hourlyEnabled = builder.hourlyEnabled;
        initialFullEnabled = builder.initialFullEnabled;
        location = builder.location;
        platform = builder.platform;
        azureInstanceMsi = builder.azureInstanceMsi;
        proxyUrl = builder.proxyUrl;
        awsRegion = builder.awsRegion;
        gcpServiceAccount = builder.gcpServiceAccount;
    }

    public String getLocation() {
        return location;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public boolean isMonthlyFullEnabled() {
        return monthlyFullEnabled;
    }

    public boolean isHourlyEnabled() {
        return hourlyEnabled;
    }

    public boolean isInitialFullEnabled() {
        return initialFullEnabled;
    }

    public String getPlatform() {
        return platform;
    }

    public String getAzureInstanceMsi() {
        return azureInstanceMsi;
    }

    public String getProxyUrl() {
        return proxyUrl;
    }

    public String getAwsRegion() {
        return awsRegion;
    }

    public String getGcpServiceAccount() {
        return gcpServiceAccount;
    }

    public void setGcpServiceAccount(String gcpServiceAccount) {
        this.gcpServiceAccount = gcpServiceAccount;
    }

    @SuppressWarnings("ExecutableStatementCount")
    public Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("enabled", enabled);
        map.put("location", ObjectUtils.defaultIfNull(location, EMPTY_CONFIG_DEFAULT));
        map.put("monthly_full_enabled", monthlyFullEnabled);
        map.put("hourly_enabled", hourlyEnabled);
        map.put("initial_full_enabled", initialFullEnabled);
        map.put("platform", ObjectUtils.defaultIfNull(platform, EMPTY_CONFIG_DEFAULT));
        map.put("azure_instance_msi", ObjectUtils.defaultIfNull(azureInstanceMsi, EMPTY_CONFIG_DEFAULT));
        map.put("gcp_service_account", ObjectUtils.defaultIfNull(gcpServiceAccount, EMPTY_CONFIG_DEFAULT));
        map.put("http_proxy", ObjectUtils.defaultIfNull(proxyUrl, EMPTY_CONFIG_DEFAULT));
        map.put("aws_region", ObjectUtils.defaultIfNull(awsRegion, EMPTY_CONFIG_DEFAULT));
        return map;
    }

    public static final class Builder {

        private boolean enabled;

        private boolean monthlyFullEnabled;

        private boolean hourlyEnabled;

        private boolean initialFullEnabled;

        private String location;

        private String platform;

        private String azureInstanceMsi;

        private String gcpServiceAccount;

        private String proxyUrl;

        private String awsRegion;

        public FreeIpaBackupConfigView build() {
            return new FreeIpaBackupConfigView(this);
        }

        public Builder withEnabled(boolean enabled) {
            this.enabled = enabled;
            return this;
        }

        public Builder withMonthlyFullEnabled(boolean monthlyFullEnabled) {
            this.monthlyFullEnabled = monthlyFullEnabled;
            return this;
        }

        public Builder withHourlyEnabled(boolean hourlyEnabled) {
            this.hourlyEnabled = hourlyEnabled;
            return this;
        }

        public Builder withInitialFullEnabled(boolean initialFullEnabled) {
            this.initialFullEnabled = initialFullEnabled;
            return this;
        }

        public Builder withLocation(String location) {
            this.location = location;
            return this;
        }

        public Builder withPlatform(String platform) {
            this.platform = platform;
            return this;
        }

        public Builder withAzureInstanceMsi(String azureInstanceMsi) {
            this.azureInstanceMsi = azureInstanceMsi;
            return this;
        }

        public Builder withProxyUrl(String proxyUrl) {
            this.proxyUrl = proxyUrl;
            return this;
        }

        public Builder withAwsRegion(String awsRegion) {
            this.awsRegion = awsRegion;
            return this;
        }

        public Builder withGcpServiceAccount(String gcpServiceAccount) {
            this.gcpServiceAccount = gcpServiceAccount;
            return this;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
package mcross1882.debuggers;

public class WatchAndListenDemo {

    public static void main(String[] args) {
        User user = new User();

        user.setFirstName(args[0]);
        user.setLastName(args[1]);
        user.setAge(Integer.parseInt(args[2]));

        System.out.println(user);
    }
}


text:
require File.join( File.dirname(__FILE__), "..", "spec_helper" )

describe Site do

  before(:each) do
    Site.destroy_all
    Spot.destroy_all
    Campaign.destroy_all

    @example_site = Site.create(valid_site_params)
    spot = Spot.create(valid_spot_params(:campaign_limit => 4))
    @example_site.spots << spot
    spot.campaigns << Campaign.create(valid_campaign_params)
  end

  it "should count campaigns allowed" do
    @example_site.campaigns_allowed.should == 4
  end

  it "should count campaigns filled" do
    @example_site.campaigns_filled.should == 1
  end

  it "should calculate the saturation" do
    @example_site.saturation.should == 0.25
  end

end


text:
package com.awsmithson.tcx2nikeplus.servlet;

import com.awsmithson.tcx2nikeplus.util.Log;
import com.google.common.base.Preconditions;
import com.google.gson.JsonObject;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@MultipartConfig(
		location="/tmp",
		maxFileSize=1024*1024*8,		// 8MB
		maxRequestSize=1024*1024*20		// 20MB
)
public class ConvertServlet extends HttpServlet {

	private static final Log log = Log.getInstance();

	private static final String PARAMETER_NIKE_EMAIL = "nikeEmail";
	private static final String PARAMETER_NIKE_PASSWORD = "nikePassword";
	private static final String PARAMETER_GPX_FILE_CHECKBOX = "fsGpxFile-checkbox";
	private static final String PARAMETER_TCX_FILE_CHECKBOX = "fsTcxFile-checkbox";
	private static final String PARAMETER_GARMIN_ID_CHECKBOX = "fsGarminId-checkbox";

	/**
	 * Handles the HTTP POST method.
	 * @param request servlet request
	 * @param response servlet response
	 * @throws ServletException if a servlet-specific error occurs
	 * @throws IOException if an I/O error occurs
	 */
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Preconditions.checkNotNull(request, "request argument is null.");
		Preconditions.checkNotNull(response, "response argument is null.");

		response.setContentType("text/html;charset=UTF-8");

		try (PrintWriter out = response.getWriter()) {
			try {
				String nikeEmail = Servlets.getRequiredParameter(request, PARAMETER_NIKE_EMAIL);
				char[] nikePassword = Servlets.getRequiredParameter(request, PARAMETER_NIKE_PASSWORD).toCharArray();

				// This seems horrible (to look through checkbox paramter names rather than a group, but it's what
				// the client sends at the moment, so it'll do until we change that.
				if (Servlets.requestParameterEquals(request, PARAMETER_GPX_FILE_CHECKBOX, "on")) {
					ServletUploadDataType.GPX_FILE.process(request, out, nikeEmail, nikePassword);
				} else if (Servlets.requestParameterEquals(request, PARAMETER_TCX_FILE_CHECKBOX, "on")) {
					ServletUploadDataType.TCX_FILE.process(request, out, nikeEmail, nikePassword);
				} else if (Servlets.requestParameterEquals(request, PARAMETER_GARMIN_ID_CHECKBOX, "on")) {
					ServletUploadDataType.GARMIN_ACTIVITY_ID.process(request, out, nikeEmail, nikePassword);
				} else {
					throw new UnsupportedOperationException("You must provide GPX, TCX or a garmin activity-id.");
				}
			} catch (Throwable t) {
				String msg = (t.getMessage() != null) ? t.getMessage() : "Unknown error, please contact me and include details of tcx-file/garmin-activity-id.";
				fail(out, msg, t);
			}
		}
	}

	static void fail(@Nonnull PrintWriter out, @Nonnull String errorMessage) {
		Preconditions.checkNotNull(out, "out argument is null.");
		Preconditions.checkNotNull(errorMessage, "errorMessage argument is null.");
		fail(out, errorMessage, null);
	}

	private static void fail(@Nonnull PrintWriter out, @Nonnull String errorMessage, @Nullable Throwable throwable) {
		log.out("Failing... Error message: %s", errorMessage);

		//errorMessage = String.format("Nike+ are making ongoing changes to their site which may affect the converter.  Please try again later - I am modifying the converter to keep up with the changes

Error message: %s", errorMessage);
		//errorMessage = String.format("Nike+ have made changes which have broken the converter.  I need to make significant changes to the converter to make it work again and hope to fixed by Sunday 16th December.

Error message: %s", errorMessage);
		//errorMessage = String.format("Nike+ have made changes to their website and the converter no longer works.  I am on vacation just now but please check back in early June (2014), hopefully I'll have had a chance to fix it by then.  Check the 'news' tab for updates.

Error message: %s", errorMessage);
		//errorMessage = String.format("Error message: %s

Please check the FAQ, if you can't find an answer there and your problem persists please contact me.", errorMessage);
		errorMessage = String.format("Error message: %s", errorMessage);

		if (throwable != null) {
			if (throwable.getMessage() == null) {
				log.out(throwable);
			} else {
				log.out(Level.SEVERE, throwable, throwable.getMessage());
			}
		}

		JsonObject jsonOutput = new JsonObject();
		jsonOutput.addProperty("success", false);
		exit(out, jsonOutput, -1, errorMessage, null);
	}

	static void succeed(@Nonnull PrintWriter out, @Nonnull String message, @Nullable String nikeActivityId, long workoutDuration, double workoutDistance) {
		Preconditions.checkNotNull(out, "out argument is null.");
		Preconditions.checkNotNull(message, "message argument is null.");

		log.out("success duration: %d", workoutDuration);
		log.out("success distance: %d", Math.round(workoutDistance));
		JsonObject jsonOutput = new JsonObject();
		jsonOutput.addProperty("success", true);
		exit(out, jsonOutput, 0, message, nikeActivityId);
	}

	private static void exit(@Nonnull PrintWriter out, @Nonnull JsonObject jsonOutput, int errorCode, @Nonnull String message, @Nullable String nikeActivityId) {
		Preconditions.checkNotNull(out, "out argument is null.");
		Preconditions.checkNotNull(jsonOutput, "jsonOutput argument is null.");
		Preconditions.checkNotNull(message, "message argument is null.");

		JsonObject data = new JsonObject();
		data.addProperty("errorCode", errorCode);
		data.addProperty("errorMessage", message);
		data.addProperty("nikeActivityId", nikeActivityId);

		jsonOutput.add("data", data);
		log.out("Returning: %s", jsonOutput);
		out.println(jsonOutput);
	}

	/**
	 * Returns a short description of the servlet.
	 * @return a String containing servlet description
	 */
	@Override
	public String getServletInfo() {
		return "Converts & uploads data for a given garmin-id or tcx-file to a nike+ account with the supplied crednetials.";
	}
}


text:
class RdsCommandLineTools < Formula
  desc "Amazon RDS command-line toolkit"
  homepage "https://aws.amazon.com/developertools/2928"
  url "https://rds-downloads.s3.amazonaws.com/RDSCli-1.19.004.zip"
  sha256 "298c15ccd04bd91f1be457645d233455364992e7dd27e09c48230fbc20b5950c"

  bottle :unneeded

  depends_on :java

  def install
    env = Language::Java.java_home_env.merge(:AWS_RDS_HOME => libexec)
    rm Dir["bin/*.cmd"] # Remove Windows versions
    etc.install "credential-file-path.template"
    libexec.install Dir["*"]
    Pathname.glob("#{libexec}/bin/*") do |file|
      next if file.directory?

      basename = file.basename
      next if basename.to_s == "service"

      (bin/basename).write_env_script file, env
    end
  end

  def caveats
    <<~EOS
      Before you can use these tools you must export a variable to your $SHELL.
        export AWS_CREDENTIAL_FILE="<Path to the credentials file>"

      To check that your setup works properly, run the following command:
        rds-describe-db-instances --headers
      You should see a header line. If you have database instances already configured,
      you will see a description line for each database instance.
    EOS
  end

  test do
    assert_match version.to_s, shell_output("#{bin}/rds-version")
  end
end


text:
ARG PHP_VERSION=7.4

FROM php:${PHP_VERSION}-cli-alpine

ARG XDEBUG_VERSION=2.9.8

COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer --version

RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
    && apk add --no-cache --virtual .runtime-deps git libzip-dev \
    && docker-php-source extract \
    && docker-php-ext-configure zip \
    && docker-php-ext-install zip \
    && mkdir -p /usr/src/php/ext/xdebug \
    && curl -fsSL https://github.com/xdebug/xdebug/archive/$XDEBUG_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/xdebug --strip 1 \
    && docker-php-ext-install xdebug \
    && docker-php-ext-enable xdebug \
    && docker-php-source delete \
    && apk del .build-deps


text:
import mraa

TH02_ADDR = 0x40 # device address
TH02_REG_STATUS = 0x00
TH02_REG_DATA_H = 0x01
TH02_REG_DATA_L = 0x02
TH02_REG_CONFIG = 0x03
TH02_REG_ID     = 0x11

TH02_STATUS_RDY_MASK = 0x01

TH02_CMD_MEASURE_HUMI = 0x01
TH02_CMD_MEASURE_TEMP = 0x11

class TH02:
	def __init__(self, bus=0, addr=TH02_ADDR):
		"""
		Instantiates a TH02 object
		"""
		self._address = addr
		self._name = "TH02"

		self.i2c = mraa.I2c(bus)
		if self.i2c.address(self._address) != mraa.SUCCESS:
			raise ValueError("mraa_i2c_address() failed")

		#TODO: Check if its MRAA_SUCCESS
	def getTemperature(self):
		"""
		Gets the temperature value from the sensor
		"""
		if self.i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_TEMP):
			raise RuntimeError("I2C.WriteReg() failed")
			return 0.0
		while self.getStatus() == False:
			pass
		temperature = self.i2c.readReg(TH02_REG_DATA_H) << 8
		temperature = temperature | self.i2c.readReg(TH02_REG_DATA_L)
		temperature = temperature >> 2
		return (temperature / 32.0) - 50.0 #is conversion needed?
	def getHumidity(self):
		"""
		Gets the humidity value from the sensor
		"""
		if self.i2c.writeReg(TH02_REG_CONFIG, TH02_CMD_MEASURE_HUMI):
			raise RuntimeError("I2C.WriteReg() failed")
			return 0.0
		while self.getStatus() == False:
			pass
		humidity = self.i2c.readReg(TH02_REG_DATA_H) << 8
		humidity = humidity | self.i2c.readReg(TH02_REG_DATA_L)
		humidity = humidity >> 4
		return (humidity / 16.0) - 24.0 #is conversion needed?
	def getStatus(self):
		"""
		Gets the sensor status
		"""
		status = self.i2c.readReg(TH02_REG_STATUS)
		if status & TH02_STATUS_RDY_MASK:
			return False
		else:
			return True
	def name(self):
		"""
		Returns the name of the component
		"""
		return self._name #TH02


text:
package com.blackstone.goldenquran.Fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.blackstone.goldenquran.R;
import com.blackstone.goldenquran.adapters.Mo3jamWordsAdapter;
import com.blackstone.goldenquran.models.Mo3jamModel;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class Mo3JamFragment extends Fragment {

    @BindView(R.id.Mo3jamRecycler)
    RecyclerView mo3jamRecycler;
    Unbinder unbinder;
    @BindView(R.id.mo3jamIsEmptyText)
    TextView mo3jamIsEmptyText;

    public Mo3JamFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_mo3_jam, container, false);
        unbinder = ButterKnife.bind(this, view);
        mo3jamRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
        ArrayList<Mo3jamModel> mo3jamModels = getArguments().getParcelableArrayList("mo3jamWords");
        if (mo3jamModels != null && mo3jamModels.isEmpty()) {
            mo3jamIsEmptyText.setVisibility(View.VISIBLE);
        } else if (mo3jamModels != null) {
            for (int i = 0; i < mo3jamModels.size(); i++) {
                if (mo3jamModels.get(i).wordRoot.isEmpty()) {
                    mo3jamModels.remove(i);
                    i--;
                }
            }
            mo3jamRecycler.setAdapter(new Mo3jamWordsAdapter(getActivity(), mo3jamModels));
        }
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}


text:
package com.abforce.toop.entities;

import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.AlphaModifier;
import org.andengine.entity.modifier.ParallelEntityModifier;
import org.andengine.entity.modifier.ScaleModifier;

import com.abforce.toop.interfaces.OnHitListener;
import com.abforce.toop.managers.RM;
import com.abforce.toop.managers.SoundManager;
import com.abforce.toop.scenehandlers.MainSceneHandler;

public class SlowDown extends SSprite {
	float x;
	float fromY;
	float toY;
	int round = 0;
	boolean init = false;
	boolean upward;
	boolean gone = false;

	OnHitListener mHitListener;

	public SlowDown(OnHitListener listener) {
		super(-100 * RM.SX, -100 * RM.SY, RM.txSlow);
		mHitListener = listener;
		if (Math.random() >= 0.5f) {
			upward = true;
		} else {
			upward = false;
		}
		registerEntityModifier(new ScaleModifier(0.5f, 0, (RM.SX + RM.SY) / 2));
		SoundManager.onCoinAppear();
	}

	public void setXRanges(float from, float to) {
		x = (float) (Math.random() * (to - from) + from);
	}

	public void setYRanges(float from, float to) {
		fromY = from;
		toY = to;
	}

	@Override
	protected void onManagedUpdate(float pSecondsElapsed) {

		if (!init) {
			setX(x);
			setY((fromY + toY) / 2);
			init = true;
		}

		for(Ball ball : MainSceneHandler.STATE.ballPool.balls){
			if (collidesWith(ball) && !gone) {
				explode();
				return;
			}
		}

		if (getY() >= toY || getY() <= fromY) {
			round += 1;
			upward = !upward;
		}

		if (upward) {
			setY(getY() - pSecondsElapsed * 30);
		} else {
			setY(getY() + pSecondsElapsed * 30);
		}

		if (round == 3 && !gone) {
			hide();
			return;
		}

		super.onManagedUpdate(pSecondsElapsed);
	}

	private void hide() {
		gone = true;
		ScaleModifier modifier = new ScaleModifier(0.5f, 1, 0) {
			protected void onModifierFinished(org.andengine.entity.IEntity pItem) {
				RM.STATE.engine.runOnUpdateThread(new Runnable() {

					@Override
					public void run() {
						detachSelf();
						dispose();
					}
				});
			};
		};
		registerEntityModifier(modifier);
	}

	private void explode() {
		gone = true;
		ParallelEntityModifier modifier = new ParallelEntityModifier(
				new ScaleModifier(0.3f, 1, 1.5f), new AlphaModifier(0.3f, 1, 0)) {
			@Override
			protected void onModifierFinished(IEntity pItem) {
				RM.STATE.engine.runOnUpdateThread(new Runnable() {

					@Override
					public void run() {
						detachSelf();
						dispose();
					}
				});
			}
		};
		registerEntityModifier(modifier);
		mHitListener.onHit();
	}

}


text:
namespace Hxj.Tools.EntityDesign
{
    partial class ContentForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ContentForm));
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tp1 = new System.Windows.Forms.TabPage();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.btnRemovePrimarykey = new System.Windows.Forms.Button();
            this.btnAddPrimarykey = new System.Windows.Forms.Button();
            this.txtClassName = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txtnamespace = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.cbPrimarykey = new System.Windows.Forms.ComboBox();
            this.button1 = new System.Windows.Forms.Button();
            this.gridColumns = new System.Windows.Forms.DataGridView();
            this.tp2 = new System.Windows.Forms.TabPage();
            this.txtContent = new System.Windows.Forms.RichTextBox();
            this.contextMenuStripSave = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.保存ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.imageList1 = new System.Windows.Forms.ImageList(this.components);
            this.saveEntity = new System.Windows.Forms.SaveFileDialog();
            this.cbToupperFrstword = new System.Windows.Forms.CheckBox();
            this.tabControl1.SuspendLayout();
            this.tp1.SuspendLayout();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.gridColumns)).BeginInit();
            this.tp2.SuspendLayout();
            this.contextMenuStripSave.SuspendLayout();
            this.SuspendLayout();
            //
            // tabControl1
            //
            this.tabControl1.Alignment = System.Windows.Forms.TabAlignment.Bottom;
            this.tabControl1.Controls.Add(this.tp1);
            this.tabControl1.Controls.Add(this.tp2);
            this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.tabControl1.ImageList = this.imageList1;
            this.tabControl1.Location = new System.Drawing.Point(0, 0);
            this.tabControl1.Margin = new System.Windows.Forms.Padding(0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(646, 546);
            this.tabControl1.TabIndex = 0;
            //
            // tp1
            //
            this.tp1.Controls.Add(this.groupBox1);
            this.tp1.Controls.Add(this.button1);
            this.tp1.Controls.Add(this.gridColumns);
            this.tp1.ImageIndex = 0;
            this.tp1.Location = new System.Drawing.Point(4, 4);
            this.tp1.Name = "tp1";
            this.tp1.Padding = new System.Windows.Forms.Padding(3);
            this.tp1.Size = new System.Drawing.Size(638, 519);
            this.tp1.TabIndex = 0;
            this.tp1.Text = "生成设置";
            this.tp1.UseVisualStyleBackColor = true;
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.cbToupperFrstword);
            this.groupBox1.Controls.Add(this.btnRemovePrimarykey);
            this.groupBox1.Controls.Add(this.btnAddPrimarykey);
            this.groupBox1.Controls.Add(this.txtClassName);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.txtnamespace);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Controls.Add(this.cbPrimarykey);
            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
            this.groupBox1.Location = new System.Drawing.Point(3, 293);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(632, 139);
            this.groupBox1.TabIndex = 3;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "生成配置";
            //
            // btnRemovePrimarykey
            //
            this.btnRemovePrimarykey.Location = new System.Drawing.Point(417, 27);
            this.btnRemovePrimarykey.Name = "btnRemovePrimarykey";
            this.btnRemovePrimarykey.Size = new System.Drawing.Size(75, 23);
            this.btnRemovePrimarykey.TabIndex = 3;
            this.btnRemovePrimarykey.Text = "删除主键";
            this.btnRemovePrimarykey.UseVisualStyleBackColor = true;
            this.btnRemovePrimarykey.Click += new System.EventHandler(this.btnRemovePrimarykey_Click);
            //
            // btnAddPrimarykey
            //
            this.btnAddPrimarykey.Location = new System.Drawing.Point(322, 28);
            this.btnAddPrimarykey.Name = "btnAddPrimarykey";
            this.btnAddPrimarykey.Size = new System.Drawing.Size(75, 23);
            this.btnAddPrimarykey.TabIndex = 2;
            this.btnAddPrimarykey.Text = "添加主键";
            this.btnAddPrimarykey.UseVisualStyleBackColor = true;
            this.btnAddPrimarykey.Click += new System.EventHandler(this.btnAddPrimarykey_Click);
            //
            // txtClassName
            //
            this.txtClassName.Location = new System.Drawing.Point(322, 89);
            this.txtClassName.Name = "txtClassName";
            this.txtClassName.Size = new System.Drawing.Size(140, 21);
            this.txtClassName.TabIndex = 5;
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(272, 92);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(35, 12);
            this.label3.TabIndex = 5;
            this.label3.Text = "类名:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(16, 92);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(59, 12);
            this.label2.TabIndex = 4;
            this.label2.Text = "命名空间:";
            //
            // txtnamespace
            //
            this.txtnamespace.Location = new System.Drawing.Point(91, 89);
            this.txtnamespace.Name = "txtnamespace";
            this.txtnamespace.Size = new System.Drawing.Size(144, 21);
            this.txtnamespace.TabIndex = 4;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(40, 33);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(35, 12);
            this.label1.TabIndex = 2;
            this.label1.Text = "主键:";
            //
            // cbPrimarykey
            //
            this.cbPrimarykey.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbPrimarykey.FormattingEnabled = true;
            this.cbPrimarykey.Location = new System.Drawing.Point(91, 30);
            this.cbPrimarykey.Name = "cbPrimarykey";
            this.cbPrimarykey.Size = new System.Drawing.Size(144, 20);
            this.cbPrimarykey.TabIndex = 1;
            //
            // button1
            //
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.button1.Location = new System.Drawing.Point(535, 461);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 6;
            this.button1.Text = "生成";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            //
            // gridColumns
            //
            this.gridColumns.AllowUserToAddRows = false;
            this.gridColumns.AllowUserToDeleteRows = false;
            this.gridColumns.AllowUserToOrderColumns = true;
            this.gridColumns.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.gridColumns.Dock = System.Windows.Forms.DockStyle.Top;
            this.gridColumns.Location = new System.Drawing.Point(3, 3);
            this.gridColumns.Name = "gridColumns";
            this.gridColumns.ReadOnly = true;
            this.gridColumns.RowTemplate.Height = 23;
            this.gridColumns.Size = new System.Drawing.Size(632, 290);
            this.gridColumns.TabIndex = 0;
            //
            // tp2
            //
            this.tp2.Controls.Add(this.txtContent);
            this.tp2.ImageIndex = 1;
            this.tp2.Location = new System.Drawing.Point(4, 4);
            this.tp2.Name = "tp2";
            this.tp2.Padding = new System.Windows.Forms.Padding(3);
            this.tp2.Size = new System.Drawing.Size(638, 519);
            this.tp2.TabIndex = 1;
            this.tp2.Text = "代码查看";
            this.tp2.UseVisualStyleBackColor = true;
            //
            // txtContent
            //
            this.txtContent.ContextMenuStrip = this.contextMenuStripSave;
            this.txtContent.Dock = System.Windows.Forms.DockStyle.Fill;
            this.txtContent.Location = new System.Drawing.Point(3, 3);
            this.txtContent.Margin = new System.Windows.Forms.Padding(0);
            this.txtContent.Name = "txtContent";
            this.txtContent.ReadOnly = true;
            this.txtContent.Size = new System.Drawing.Size(632, 513);
            this.txtContent.TabIndex = 0;
            this.txtContent.Text = "";
            //
            // contextMenuStripSave
            //
            this.contextMenuStripSave.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.保存ToolStripMenuItem});
            this.contextMenuStripSave.Name = "contextMenuStripSave";
            this.contextMenuStripSave.Size = new System.Drawing.Size(139, 26);
            //
            // 保存ToolStripMenuItem
            //
            this.保存ToolStripMenuItem.Name = "保存ToolStripMenuItem";
            this.保存ToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
            this.保存ToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
            this.保存ToolStripMenuItem.Text = "保存";
            this.保存ToolStripMenuItem.Click += new System.EventHandler(this.保存ToolStripMenuItem_Click);
            //
            // imageList1
            //
            this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
            this.imageList1.Images.SetKeyName(0, "pz.ICO");
            this.imageList1.Images.SetKeyName(1, "cs.ICO");
            //
            // cbToupperFrstword
            //
            this.cbToupperFrstword.AutoSize = true;
            this.cbToupperFrstword.Location = new System.Drawing.Point(509, 91);
            this.cbToupperFrstword.Name = "cbToupperFrstword";
            this.cbToupperFrstword.Size = new System.Drawing.Size(84, 16);
            this.cbToupperFrstword.TabIndex = 6;
            this.cbToupperFrstword.Text = "首字母大写";
            this.cbToupperFrstword.UseVisualStyleBackColor = true;
            //
            // ContentForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(646, 546);
            this.Controls.Add(this.tabControl1);
            this.DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document;
            this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.MinimizeBox = false;
            this.Name = "ContentForm";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.Load += new System.EventHandler(this.ContentForm_Load);
            this.tabControl1.ResumeLayout(false);
            this.tp1.ResumeLayout(false);
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.gridColumns)).EndInit();
            this.tp2.ResumeLayout(false);
            this.contextMenuStripSave.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tp1;
        private System.Windows.Forms.TabPage tp2;
        private System.Windows.Forms.RichTextBox txtContent;
        private System.Windows.Forms.DataGridView gridColumns;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.ComboBox cbPrimarykey;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.TextBox txtClassName;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtnamespace;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button btnAddPrimarykey;
        private System.Windows.Forms.Button btnRemovePrimarykey;
        private System.Windows.Forms.ContextMenuStrip contextMenuStripSave;
        private System.Windows.Forms.ToolStripMenuItem 保存ToolStripMenuItem;
        private System.Windows.Forms.SaveFileDialog saveEntity;
        private System.Windows.Forms.ImageList imageList1;
        private System.Windows.Forms.CheckBox cbToupperFrstword;
    }
}


text:
//
//  PoyntPOSConnectionManager.h
//  sdk_example_swift
//
//  Created by Eric McConkie on 8/11/16.
//  Copyright © 2016 com.poynt. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PoyntTransaction.h"
@class PoyntTransactionObject;
@class PoyntTransactionAmounts;
@class PoyntPaymentObject;
@class PoyntTransactionResponseObject;
typedef enum {
    Undefined,
    AuthorizeCapture,
    AuthorizeCompletion,
    AuthorizePair,
    AuthorizePreSales,
    AuthorizePartialCompletion,
    AuthorizePartialRefund,
    AuthorizeRefund,
    AuthorizeSales,
    AuthorizeVoid,
    AuthorizeVoidPreSales,
    AuthorizeAdjustment
} PoyntActionType;

typedef enum{
    UnPaired,
    Pairing,
    Paired
} PoyntPOSPairingStatus;

typedef void(^OnTransactionResponse)(PoyntTransactionResponseObject *data, PoyntActionType type) ;
typedef void(^OnError)(NSError *error, PoyntActionType type) ;
/*!
 @header The connection manager is the gateway class to communicating with the Poynt terminal.
 @description This object handles all things from pairing to transaction / payment specific requests
*/

@interface PoyntPOSConnectionManager : NSObject
/*!
 @brief optional property for displaying/references a name for the device implementing the PoyntLib SDK

 @discussion When Poynt terminal pairs with an iOS client, it will display the name of the client and the pairingCode used to make the connection.

 @return string for a human readable client name on the Poynt terminal
 */
@property(nonatomic,strong) NSString *clientName;
/*!
 @brief required property for pairing an iOS client with the Poynt terminal

 @discussion Poynt terminal requires both a url and pairingCode to establish a connection for passing data.

 @return string an alpha numeric code for pairing.
 */
@property(nonatomic,strong) NSString *pairingCode;

/*!
 @brief required property for pairing an iOS client with the Poynt terminal

 @discussion Poynt terminal requires both a url and pairingCode to establish a connection for passing data. The url can be discovered by using the PoyntTerminalDiscover object for discovery over WiFi

 @return string for an ip address, including port if necessary.

 @code
    self.paymentManager.url = @"10.0.2.21:55555"
 @endcode

 @see PoyntTerminalDiscover.h
 */
@property(nonatomic,strong) NSString *url;

/*!
 @brief optional property for setting the timeout for PoyntPOSConnectionManager requests.

 @discussion Timout is understood in milliseconds by the Poynt terminal. The timeout can be set previous to making a request, depending on what suits best for the client application. Setting a new timeout value is persitant until reset to a new value. The default value is 60000 ( = one minute)

 @return NSInteger
 */
@property(nonatomic) NSInteger timeout;

/*!
 @brief readonly property for understanding the current pairing state of the PoyntPOSConnectionManager

 @return enum
 */
@property(nonatomic,readonly) PoyntPOSPairingStatus pairingStatus;

/*!
 @brief use the OnTransactionResponse block to capture the response from the Poynt terminal after a successful request completes

 @discussion the block will contain a PoyntTransactionResponseObject object and PoyntActionType enum to clarify from which method is being calledback

 @code
 [paymentManager setOnTransactionResponse:^void(PoyntTransactionResponseObject *data,PoyntActionType actionType){
    if(actionType == AuthorizePair){
        // ... handle this case
    }else{
        NSLog(@"success for %@",data);
    }
 }];
 [paymentManager authorizeCapture:transactionObject]
 @endcode
 */
@property (readwrite,copy) OnTransactionResponse onTransactionResponse;
/*!
 @brief use the OnError block to capture the fail state response from the Poynt terminal in the event of an error

 @discussion the block will contain an NSError object and PoyntActionType enum

 @code
 [paymentManager setOnError:^void(NSError *error, PoyntActionType actionType){

 }];
 [paymentManager authorizeCapture:transactionObject]
 @endcode
 */
@property (readwrite,copy) OnError onError;

/*!
 @brief sends a captured sale request to the Poynt terminal

 @discussion This expects a valid PoyntTransactionObject.
 Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  PoyntTransactionObject - transactionId is required

 */
-(void)authorizeCapture:(PoyntTransactionObject *)transaction;
/*!
 @brief attempts to pair the iOS client with the Poynt terminal

 @discussion An iOS client creates a pair after establishing a correct url and pairing code to make the request. The PoyntTerminalDiscover object can find terminals on the same network, revelaing their ip address, or you can manually address the ip if you already know it. The PoyntLib SDK will try to re-establish a connection with the last set credentials even after application termination. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @code
 self.paymentManager.url = @"10.0.1.23:55555";
 self.paymentManager.clientName = @"Happy iPad";
 [self.paymentManager authorizePairing:self.textFieldCode.text];
 @endcode

 @param  string representing the pairing code

 */
-(void)authorizePairing:(NSString *)code;
/*!
 @brief sends a captured sale request to the Poynt terminal

 @discussion This expects a valid PoyntPaymentObject. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  PoyntPaymentObject (where transactionId is required)

 */
-(void)authorizePartialCompletion:(PoyntPaymentObject *)payment;
/*!
 @brief sends a partial refund request to the Poynt terminal

 @discussion This expects a valid PoyntPaymentObject. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  PoyntPaymentObject (where transactionId is required)

 */
-(void)authorizePartialRefund:(PoyntPaymentObject *)payment;

/*!
 @brief sends an authOnly sale request to the Poynt terminal

 @discussion This expects a PoyntPaymentObject. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  PoyntPaymentObject

 */
-(void)authorizePreSales:(PoyntPaymentObject *)payment;
/*!
 @brief sends a refund request to the Poynt terminals

 @discussion This method expects a valid object subscribing to the PoyntTransaction protocol. The transactionId must be in reference of a valid transaction. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  an object that subscribes to the PoyntTransaction protocol  - transactionId is required
 */
-(void)authorizeRefund:(id <PoyntTransaction>)transaction ;
/*!
 @brief sends a sale request for capture to the Poynt terminal

 @discussion This expects a PoyntPaymentObject. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  PoyntPaymentObject

 */
-(void)authorizeSales:(PoyntPaymentObject *)payment ;

/*!
 @brief sends a void request to the Poynt terminals

 @discussion This method expects a valid object subscribing to the PoyntTransaction protocol. The transactionId must be in reference of a transaction. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  an object that subscribes to the PoyntTransaction protocol  - transactionId is required
 */
-(void)authorizeVoid:(id <PoyntTransaction>)transaction;

/*!
 @brief sends a void request to the Poynt terminals

 @discussion This method expects a valid object subscribing to the PoyntTransaction protocol. The transactionId must be in reference of an @cAUTHORIZED transaction. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler

 @param  an object that subscribes to the PoyntTransaction protocol  - transactionId is required
 */
-(void)authorizeVoidPreSales:(id <PoyntTransaction>)transaction ;

/*!
 @brief sends an adjustment request to the Poynt terminal

 @discussion This expects a PoyntPaymentObject. Upon terminal response the paymentManager will receive either the onTransactionResponse or onError handler. The payment object must have an amount associated, and optional tipAmount (if a tip is included)

 @param  PoyntPaymentObject
 */
-(void)authorizeAdjustment:(PoyntPaymentObject*)payment;
@end


text:
import React from 'react';
import { connect } from 'dva';
import { List, WhiteSpace, WingBlank } from 'antd-mobile'
import { formatPhone } from '../../services/ct'
import MissData from '../../components/Error/MissData.js'
import styles from './SafePage.css';
import routeLoading from '../../components/HighComponent/routeLoading'
import { afterLogin } from '../../services/bus'

const { Item } = List

function SafePage({ history, user, dispatch }) {
  function logout() {
    afterLogin.path = ''
    history.replace('/')
    dispatch({ type: 'user-info/logout' })
  }
  return (
    user.phone
      ? (

          <WhiteSpace size="lg" />
          <List>
            <Item arrow="horizontal" extra={formatPhone(user.phone)}>
              手机号
            </Item>
            <Item arrow="horizontal" onClick={() => { history.push('/user/modify') }}>修改登录密码</Item>
          </List>
          <WhiteSpace size="lg" />
          <WingBlank>
            退出登录
          </WingBlank>

      )
      : <MissData redirect={() => { history.replace('/user/login') }} />
  );
}

function mapStateToProps(state) {
  const user = state['user-info']
  return { user }
}

export default connect(mapStateToProps)(routeLoading(SafePage));


text:
/*
 * RGBConverter.h - Arduino library for converting between RGB, HSV and HSL
 *
 * Ported from the Javascript at http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
 * The hard work was Michael's, all the bugs are mine.
 *
 * Robert Atkins, December 2010 (ratkins_at_fastmail_dot_fm).
 *
 * https://github.com/ratkins/RGBConverter
 *
 */
#ifndef RGBConverter_h
#define RGBConverter_h

#include <Windows.h>
#define byte BYTE

class RGBConverter {

public:
    /**
     * Converts an RGB color value to HSL. Conversion formula
     * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
     * Assumes r, g, and b are contained in the set [0, 255] and
     * returns h, s, and l in the set [0, 1].
     *
     * @param   byte    r       The red color value
     * @param   byte    g       The green color value
     * @param   byte    b       The blue color value
     * @param   double  hsl[]   The HSL representation
     */
    static void rgbToHsl(byte r, byte g, byte b, double hsl[]);

    /**
     * Converts an HSL color value to RGB. Conversion formula
     * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
     * Assumes h, s, and l are contained in the set [0, 1] and
     * returns r, g, and b in the set [0, 255].
     *
     * @param   double  h       The hue
     * @param   double  s       The saturation
     * @param   double  l       The lightness
     * @return  byte    rgb[]   The RGB representation
     */
    static void hslToRgb(double h, double s, double l, byte rgb[]);

    /**
     * Converts an RGB color value to HSV. Conversion formula
     * adapted from http://en.wikipedia.org/wiki/HSV_color_space.
     * Assumes r, g, and b are contained in the set [0, 255] and
     * returns h, s, and v in the set [0, 1].
     *
     * @param   byte  r       The red color value
     * @param   byte  g       The green color value
     * @param   byte  b       The blue color value
     * @return  double hsv[]  The HSV representation
     */
    static void rgbToHsv(byte r, byte g, byte b, double hsv[]);

    /**
     * Converts an HSV color value to RGB. Conversion formula
     * adapted from http://en.wikipedia.org/wiki/HSV_color_space.
     * Assumes h, s, and v are contained in the set [0, 1] and
     * returns r, g, and b in the set [0, 255].
     *
     * @param   double  h       The hue
     * @param   double  s       The saturation
     * @param   double  v       The value
     * @return  byte    rgb[]   The RGB representation
     */
    static void hsvToRgb(double h, double s, double v, byte rgb[]);

private:
    static double threeway_max(double a, double b, double c);
    static double threeway_min(double a, double b, double c);
    static double hue2rgb(double p, double q, double t);
};

#endif


text:
package com.sequenceiq.cloudbreak.service.image.userdata;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@ConfigurationProperties("cb")
@Component
public class UserDataBuilderParams {

    private String customData = "touch /tmp/cb-custom-data-default.txt";

    public String getCustomData() {
        return customData;
    }

    public void setCustomData(String customData) {
        this.customData = customData;
    }

}


text:
using namespace tube;

int
main(int argc, char *argv[])
{
    ServerConfig& conf = ServerConfig::instance();
    conf.load_config_file("test/test-conf.yaml");
    assert(conf.address() == "127.0.0.1");
    assert(conf.port() == "80");

    return 0;
}


text:
@interface SQLiteCondition()
@property(nonatomic,strong)NSString *tabName;

@property(nonatomic,strong)NSString *where;
@property(nonatomic,strong)NSString *fields;
@property(nonatomic,strong)NSString *groupBy;
@property(nonatomic,strong)NSString *order;
@property(nonatomic,assign)NSInteger page;
@property(nonatomic,assign)NSInteger limit;

@end

@implementation SQLiteCondition

- (SQLiteCondition *)initWitTabName:(NSString *)name
{
    if(self=[super init]){
         self.tabName=name;
    }
    return self;
}

- (SQLiteCondition *)limit:(NSInteger)count
{
    self.limit=count;
    return self;
}

-(SQLiteCondition *)page:(NSInteger)page
{
    self.page=page;
    return self;
}

- (SQLiteCondition *)orderBy:(NSString *)order
{
    self.order=order;
    return self;
}

- (SQLiteCondition *)descOrderBy:(NSString *)order
{
    return [self orderBy:[order stringByAppendingString:@" DESC"]];;
}

- (SQLiteCondition *)ascOrderBy:(NSString *)order
{
    return [self orderBy:order];;
}

- (SQLiteCondition *)fields:(id)fields
{
    if (!fields) {
        self.fields=nil;
    }else if ([fields isKindOfClass:[NSArray class]]) {
        NSInteger count=[fields count];
        NSMutableString *fieldsStr=[[NSMutableString alloc] initWithCapacity:count];
        for (int i=0;i<count;i++) {
            if (i==count-1) {
                [fieldsStr appendFormat:@"%@",fields[i]];
            }else{
                [fieldsStr appendFormat:@"%@,",fields[i]];
            }
        }
        if (fieldsStr.length>0) {
            self.fields=fieldsStr;
        }
    }else if([fields isKindOfClass:[NSString class]]){
        self.fields=fields;
    }
    return self;
}

- (SQLiteCondition *)groupBy:(id)fields
{
    if (!fields) {
        self.groupBy=nil;
    }else if ([fields isKindOfClass:[NSArray class]]) {
        NSInteger count=[fields count];
        NSMutableString *fieldsStr=[[NSMutableString alloc] initWithCapacity:count];
        for (int i=0;i<count;i++) {
            if (i==count-1) {
                [fieldsStr appendFormat:@"%@",fields[i]];
            }else{
                [fieldsStr appendFormat:@"%@,",fields[i]];
            }
        }
        if (fieldsStr.length>0) {
            self.groupBy=fieldsStr;
        }
    }else if([fields isKindOfClass:[NSString class]]){
        self.groupBy=fields;
    }
    return self;
}

- (SQLiteCondition *)where:(id)condition
{
    if(!condition){
        self.where=nil;
    }else if ([condition isKindOfClass:[NSArray class]]) {

    }else if([condition isKindOfClass:[NSString class]]){
        self.where=condition;
    }
    return self;
}

- (NSString *)countSql
{
    NSMutableString *sql=[[NSMutableString alloc] initWithString:@"SELECT"];
    if ([_fields length]>0) {
        [sql appendFormat:@" %@,",self.fields];
    }

    [sql appendFormat:@" COUNT(*) FROM `%@`",self.tabName];
    if ([_where length]>0) {
        [sql appendFormat:@" WHERE %@",self.where];
    }

    if([_groupBy length]>0){
        [sql appendFormat:@" GROUP BY %@",self.groupBy];
    }

    if ([_order length]>0) {
        [sql appendFormat:@" ORDER BY %@",self.order];
    }

    if (_limit>0) {
        [sql appendFormat:@" LIMIT %zd,%zd",self.limit*self.page,self.limit*(self.page+1)];
    }
    return sql;
}

- (NSString *)selectSql
{
    NSMutableString *sql=[[NSMutableString alloc] initWithString:@"SELECT"];
    if ([_fields length]>0) {
        [sql appendFormat:@" %@",self.fields];
    }else{
        [sql appendString:@" *"];
    }

    [sql appendFormat:@" FROM `%@`",self.tabName];
    if ([_where length]>0) {
        [sql appendFormat:@" WHERE %@",self.where];
    }

    if([_groupBy length]>0){
        [sql appendFormat:@" GROUP BY %@",self.groupBy];
    }

    if ([_order length]>0) {
        [sql appendFormat:@" ORDER BY %@",self.order];
    }

    if (_limit>0) {
        [sql appendFormat:@" LIMIT %zd,%zd",self.limit*self.page,self.limit*(self.page+1)];
    }
    return sql;
}

- (NSString *)insertSql:(NSArray *)rows
{
    //NSERT INTO tbl_name (col1,col2) VALUES(col2*2,15);
    NSMutableString *sql=[[NSMutableString alloc] initWithFormat:@"INSERT INTO `%@`",self.tabName];

    if ([_fields length]>0) {
        [sql appendFormat:@"(%@)",self.fields];//keys and values
    }
    if ([rows isKindOfClass:[NSArray class]]&&[rows count]>0) {
        NSMutableString *valuesStr=[[NSMutableString alloc] init];

        if ([rows[0] isKindOfClass:[NSArray class]]) {
            NSInteger countj = [rows count];
            for (int i=0;i<countj;i++) {
                NSArray *vs=rows[i];
                [valuesStr appendString:@"("];
                NSInteger count = [vs count];
                for (int j=0;j<count;j++) {
                    if (count==j+1) {
                        [valuesStr appendString:[self getSqlValue:vs[j]]];
                    }else{
                        [valuesStr appendFormat:@"%@,",[self getSqlValue:vs[j]]];
                    }
                }
                if (i==countj-1) {
                    [valuesStr appendString:@")"];
                }else{
                    [valuesStr appendString:@"),"];
                }

            }
        }else{
            [valuesStr appendString:@"("];
            NSInteger count = [rows count];
            for (int i=0;i<count;i++) {
                if (count==i+1) {
                    [valuesStr appendString:[self getSqlValue:rows[i]]];
                }else{
                    [valuesStr appendFormat:@"%@,",[self getSqlValue:rows[i]]];
                }
            }
            [valuesStr appendString:@")"];
        }

        [sql appendFormat:@" values%@",valuesStr];//values
    }
    return sql;
}

- (NSString *)deleteSql
{
    NSMutableString *sql=[[NSMutableString alloc] initWithFormat:@"DELETE FROM `%@`",self.tabName];

    if ([_where length]>0) {
        [sql appendFormat:@" WHERE %@",self.where];
    }else{
        //为了防止误操作清空全表,加上如果没有条件就不执行的限制
        return @"";
    }

    if (_limit>0) {
        [sql appendFormat:@" LIMIT %zd,%zd",self.limit*self.page,self.limit*(self.page+1)];
    }

    return sql;
}

- (NSString *)updateSql:(NSArray *)values
{
    NSMutableString *sql=[[NSMutableString alloc] initWithFormat:@"UPDATE `%@` SET ",self.tabName];
    if (_fields) {
        NSArray *fiels=[self.fields componentsSeparatedByString:@","];
        NSInteger num = [fiels count]>[values count]?[values count]:[fiels count];
        for (int i=0;i<num;i++) {
            if (i==num-1) {
                [sql appendFormat:@"%@=%@",fiels[i],[self getSqlValue:values[i]]];
            }else{
                [sql appendFormat:@"%@=%@,",fiels[i],[self getSqlValue:values[i]]];
            }
        }
    }else{
        return @"";
    }

    if ([_where length]>0) {
        [sql appendFormat:@" WHERE %@",self.where];
    }else{
        //为了防止误操作修改全表,加上如果没有条件就不执行的限制
        return @"";
    }

    if (_limit>0) {
        [sql appendFormat:@" LIMIT %zd,%zd",self.limit*self.page,self.limit*(self.page+1)];
    }

    return sql;
}

- (NSString *)getSqlValue:(id)v
{
    if ([v isKindOfClass:[NSNumber class]]) {
        return [NSString stringWithFormat:@"%@",v];
    }else{
        return [[NSString stringWithFormat:@"'%@'",v] stringByReplacingOccurrencesOfString:@"'" withString:@"\'"];
    }
}

- (void)clean
{
    self.where=nil;
    self.fields=nil;
    self.groupBy=nil;
    self.order=nil;
    self.page=0;
    self.limit=0;
}

- (NSString *)debugDescription
{
    return [NSString stringWithFormat:@"|-%@ %p\n| where:%@\n| fields:%@\n| groupBy:%@\n| order:%@\n| page:%zd\n| limit:%zd",[self class],self,self.where,self.fields,self.groupBy,self.order,self.page,self.limit];
}

@end


text:
/**
 * This test is for the index page
 */
casper.test.begin('Index page', 17, function suite(test) {
    casper.start(baseUrl, function() {
		test.assertHttpStatus(200);
		casper.assertAtIndexView(); // 4 tests here
        test.assertTitle("GapVis: Visual Interface for Reading Ancient Texts",
            "Loaded application");

	}).then(function(){
        test.assertText("h2", "Overview", "Index page title is visible");
        test.assertEvalEquals(new Function("{ return $('div.book-list p').length;}"), 2, "Two books were found");
        test.assertText('div.book-list p span', 'The Works of Cornelius Tacitus: The History',
            "The first book has the right title");

    }).then(function(){
        casper.click('div.book-list p span');
	    casper.assertAtBookSummaryView();
	    casper.back();
	    casper.assertAtIndexView();
    });
    casper.run(function() {
        test.done();
    });
});


text:
package com.thoughtworks.go.server.perf.commands;

import com.thoughtworks.go.domain.AgentInstance;
import com.thoughtworks.go.server.domain.AgentInstances;
import com.thoughtworks.go.server.service.AgentService;
import com.thoughtworks.go.server.service.EnvironmentConfigService;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Optional;

import static com.thoughtworks.go.util.TriState.UNSET;
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static java.util.stream.StreamSupport.stream;

public class BulkUpdateAgentCommand extends AgentPerformanceCommand {
    private EnvironmentConfigService envConfigService;

    public BulkUpdateAgentCommand(AgentService agentService, EnvironmentConfigService envConfigService) {
        this.envConfigService = envConfigService;
        this.agentService = agentService;
    }

    @Override
    Optional<String> execute() {
        Optional<List<String>> anyRegisteredUUIDs = findAnyRegisteredUUIDs();
        anyRegisteredUUIDs.ifPresent(this::bulkUpdateAgent);
        return Optional.ofNullable(StringUtils.join(anyRegisteredUUIDs.get(), " | "));
    }

    private void bulkUpdateAgent(List<String> uuids) {
        agentService.bulkUpdateAgentAttributes(uuids, asList("r3", "r4"), null, asList("e3", "e4"), asList("e1", "e2"), UNSET, envConfigService);
    }

    private Optional<List<String>> findAnyRegisteredUUIDs() {
        AgentInstances registeredAgents = agentService.findRegisteredAgents();
        return Optional.of(stream(registeredAgents.spliterator(), false)
                .map(AgentInstance::getUuid)
                .limit(3)
                .collect(toList()));
    }
}


text: hello {{ $name }} of @{name}


text:
@implementation PXSourceListItem
{
    NSMutableArray *_children;
}

+ (instancetype) itemWithTitle:(NSString*) title identifier:(NSString*) identifier
{
    return [self itemWithTitle:title identifier:identifier icon:nil];
}

+ (instancetype) itemWithTitle:(NSString*) title identifier:(NSString*) identifier icon:(NSImage*) icon
{
    PXSourceListItem* item = [self new];

    item.title = title;
    item.identifier = identifier;
    item.icon = icon;

    return item;
}

+ (instancetype) itemWithRepresentedObject:(id) object icon:(NSImage*) icon
{
    PXSourceListItem *item = [[self alloc] init];

    item.representedObject = object;
    item.icon = icon;

    return item;
}

- (instancetype)init
{
    self = [super init];
    if( self )
    {
        _children = [NSMutableArray new];
    }

    return self;
}

#pragma mark - Custom Accessors

- (NSArray*) children
{
    return [_children copy];
}

- (void) setChildren:(NSArray*) children
{
    _children = [children mutableCopy];
}

#pragma mark - Child Convenience Methods

- (BOOL) hasChildren
{
    return _children.count > 0;
}

- (void) addChildItem:(PXSourceListItem*) childItem
{
    [_children addObject:childItem];
}

- (void) insertChildItem:(PXSourceListItem*) childItem atIndex:(NSUInteger) index
{
    [_children insertObject:childItem atIndex:index];
}

- (void) removeChildItem:(PXSourceListItem*) childItem
{
    [_children removeObject:childItem];
}

- (void) removeChildItemAtIndex:(NSUInteger) index
{
    [_children removeObjectAtIndex:index];
}

- (void) removeChildItems:(NSArray*) items
{
    [_children removeObjectsInArray:items];
}

- (void) insertChildItems:(NSArray*) items atIndexes:(NSIndexSet*) indexes
{
    [_children insertObjects:items atIndexes:indexes];
}

@end


text:
package com.hhh.mapreduce;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.ConnectionFactory;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;
import org.apache.hadoop.hbase.util.Bytes;

import java.io.FileWriter;
import java.util.*;

/**
 * Created by nicbh on 2017/5/9.
 */
public class scanHbase {
    public static String[] scan(Connection connection, TableName tableName) throws Exception {
        Table table = connection.getTable(tableName);
        Scan s = new Scan();
        ResultScanner rs = table.getScanner(s);
        ArrayList<String> result = new ArrayList<String>();

        for (Result r : rs) {
            String out = new String();
            NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> navigableMap = r.getMap();
            for (Map.Entry<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> entry : navigableMap.entrySet()) {
                out = Bytes.toString(r.getRow());
                //System.out.print(Bytes.toString(entry.getKey()) + "#");
                NavigableMap<byte[], NavigableMap<Long, byte[]>> map = entry.getValue();
                for (Map.Entry<byte[], NavigableMap<Long, byte[]>> en : map.entrySet()) {
                    //System.out.print(Bytes.toString(en.getKey()) + "##");
                    NavigableMap<Long, byte[]> ma = en.getValue();
                    for (Map.Entry<Long, byte[]> e : ma.entrySet()) {
                        //System.out.print(e.getKey() + "###");
                        //System.out.println(Bytes.toString(e.getValue()));
                        out += "\t" + Bytes.toString(e.getValue());
                    }
                }
            }
            result.add(out);
        }
        String[] re = new String[result.size()];
        result.toArray(re);
        return re;
    }

    public static void main(String[] args) throws Exception {
        if (args.length != 2) {
            System.err.println("Usage:scanHbase <tablename><output>");
            System.exit(2);
        }
        Configuration conf = HBaseConfiguration.create();
//        conf.set("hbase.zookeeper.property.clientPort", "2181");
//        conf.set("hbase.zookeeper.quorum", "10.37.129.3");
        conf.addResource("/home/hadoop/hadoop_installs/hbase-1.2.5/conf/hbase-site.xml");
        Connection connection = ConnectionFactory.createConnection(conf);

        String[] result = scan(connection, TableName.valueOf(args[0]));
        FileWriter f = new FileWriter(args[1]);
        for (String str : result) {
            f.write(str + "\n");
        }
        f.close();
    }
}


text:
namespace Twitter.MVC.Infrastructure
{
    public interface IMapFrom<T>
    {
    }
}


text:
package artifactrash

import (
	"github.com/goharbor/harbor/src/pkg/artifactrash/model"
	"github.com/stretchr/testify/mock"
)

// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// 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.

import (
	"context"
)

// FakeManager is a fake tag manager that implement the src/pkg/tag.Manager interface
type FakeManager struct {
	mock.Mock
}

// Create ...
func (f *FakeManager) Create(ctx context.Context, artifactrsh *model.ArtifactTrash) (id int64, err error) {
	args := f.Called()
	return int64(args.Int(0)), args.Error(1)
}

// Delete ...
func (f *FakeManager) Delete(ctx context.Context, id int64) error {
	args := f.Called()
	return args.Error(0)
}

// Filter ...
func (f *FakeManager) Filter(ctx context.Context, timeWindow int64) (arts []model.ArtifactTrash, err error) {
	args := f.Called()
	return args.Get(0).([]model.ArtifactTrash), args.Error(1)
}

// Flush ...
func (f *FakeManager) Flush(ctx context.Context, timeWindow int64) (err error) {
	args := f.Called()
	return args.Error(0)
}


text:
import os

from sigal import init_plugins
from sigal.gallery import Gallery

CURRENT_DIR = os.path.dirname(__file__)

def test_plugins(settings, tmpdir, disconnect_signals):

    settings['destination'] = str(tmpdir)
    if "sigal.plugins.nomedia" not in settings["plugins"]:
        settings['plugins'] += ["sigal.plugins.nomedia"]
    if "sigal.plugins.media_page" not in settings["plugins"]:
        settings['plugins'] += ["sigal.plugins.media_page"]

    init_plugins(settings)
    gal = Gallery(settings)
    gal.build()

    out_html = os.path.join(
        settings['destination'], 'dir2', 'KeckObservatory20071020.jpg.html'
    )
    assert os.path.isfile(out_html)

    for path, dirs, files in os.walk(os.path.join(str(tmpdir), "nomedia")):
        assert "ignore" not in path

        for file in files:
            assert "ignore" not in file

def test_nonmedia_files(settings, tmpdir, disconnect_signals):

    settings['destination'] = str(tmpdir)
    settings['plugins'] += ['sigal.plugins.nonmedia_files']

    init_plugins(settings)

    gal = Gallery(settings)
    gal.build()

    outfile = os.path.join(settings['destination'], 'nonmedia_files', 'dummy.pdf')
    assert os.path.isfile(outfile)

    outthumb = os.path.join(
        settings['destination'], 'nonmedia_files', 'thumbnails', 'dummy.tn.jpg'
    )
    assert os.path.isfile(outthumb)

def test_titleregexp(settings, tmpdir, disconnect_signals):

    if "sigal.plugins.titleregexp" not in settings["plugins"]:
        settings['plugins'] += ["sigal.plugins.titleregexp"]

    init_plugins(settings)
    gal = Gallery(settings)
    gal.build()

    assert gal.albums.get('dir1').albums[1].title == "titleregexp 02"


text:
package com.team3164.vision;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.HashMap;

import org.opencv.core.*;
import org.opencv.core.Core.*;
import org.opencv.features2d.FeatureDetector;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.*;
import org.opencv.objdetect.*;

/**
* GripPipeline class.
*
* <p>An OpenCV pipeline generated by GRIP.
*
* @author GRIP
*/
public class GripPipeline {

	//Outputs
	private Mat hsvThresholdOutput = new Mat();
	private Mat blurOutput = new Mat();
	private ArrayList<MatOfPoint> findContoursOutput = new ArrayList<MatOfPoint>();
	private ArrayList<MatOfPoint> filterContoursOutput = new ArrayList<MatOfPoint>();

	static {
		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
	}

	/**
	 * This is the primary method that runs the entire pipeline and updates the outputs.
	 */
	public void process(Mat source0) {
		// Step HSV_Threshold0:
		Mat hsvThresholdInput = source0;
		double[] hsvThresholdHue = {45.762711864406775, 180.0};
		double[] hsvThresholdSaturation = {88.84180790960451, 255.0};
		double[] hsvThresholdValue = {153.6723163841808, 255.0};
		hsvThreshold(hsvThresholdInput, hsvThresholdHue, hsvThresholdSaturation, hsvThresholdValue, hsvThresholdOutput);

		// Step Blur0:
		Mat blurInput = hsvThresholdOutput;
		BlurType blurType = BlurType.get("Box Blur");
		double blurRadius = 4.504504504504505;
		blur(blurInput, blurType, blurRadius, blurOutput);

		// Step Find_Contours0:
		Mat findContoursInput = blurOutput;
		boolean findContoursExternalOnly = false;
		findContours(findContoursInput, findContoursExternalOnly, findContoursOutput);

		// Step Filter_Contours0:
		ArrayList<MatOfPoint> filterContoursContours = findContoursOutput;
		double filterContoursMinArea = 49.0;
		double filterContoursMinPerimeter = 0.0;
		double filterContoursMinWidth = 20.0;
		double filterContoursMaxWidth = 1000.0;
		double filterContoursMinHeight = 0.0;
		double filterContoursMaxHeight = 1000.0;
		double[] filterContoursSolidity = {11.690647482014388, 100.0};
		double filterContoursMaxVertices = 1000000.0;
		double filterContoursMinVertices = 0.0;
		double filterContoursMinRatio = 0.0;
		double filterContoursMaxRatio = 1000.0;
		filterContours(filterContoursContours, filterContoursMinArea, filterContoursMinPerimeter, filterContoursMinWidth, filterContoursMaxWidth, filterContoursMinHeight, filterContoursMaxHeight, filterContoursSolidity, filterContoursMaxVertices, filterContoursMinVertices, filterContoursMinRatio, filterContoursMaxRatio, filterContoursOutput);

	}

	/**
	 * This method is a generated getter for the output of a HSV_Threshold.
	 * @return Mat output from HSV_Threshold.
	 */
	public Mat hsvThresholdOutput() {
		return hsvThresholdOutput;
	}

	/**
	 * This method is a generated getter for the output of a Blur.
	 * @return Mat output from Blur.
	 */
	public Mat blurOutput() {
		return blurOutput;
	}

	/**
	 * This method is a generated getter for the output of a Find_Contours.
	 * @return ArrayList<MatOfPoint> output from Find_Contours.
	 */
	public ArrayList<MatOfPoint> findContoursOutput() {
		return findContoursOutput;
	}

	/**
	 * This method is a generated getter for the output of a Filter_Contours.
	 * @return ArrayList<MatOfPoint> output from Filter_Contours.
	 */
	public ArrayList<MatOfPoint> filterContoursOutput() {
		return filterContoursOutput;
	}

	/**
	 * Segment an image based on hue, saturation, and value ranges.
	 *
	 * @param input The image on which to perform the HSL threshold.
	 * @param hue The min and max hue
	 * @param sat The min and max saturation
	 * @param val The min and max value
	 * @param output The image in which to store the output.
	 */
	private void hsvThreshold(Mat input, double[] hue, double[] sat, double[] val,
	    Mat out) {
		Imgproc.cvtColor(input, out, Imgproc.COLOR_BGR2HSV);
		Core.inRange(out, new Scalar(hue[0], sat[0], val[0]),
			new Scalar(hue[1], sat[1], val[1]), out);
	}

	/**
	 * An indication of which type of filter to use for a blur.
	 * Choices are BOX, GAUSSIAN, MEDIAN, and BILATERAL
	 */
	enum BlurType{
		BOX("Box Blur"), GAUSSIAN("Gaussian Blur"), MEDIAN("Median Filter"),
			BILATERAL("Bilateral Filter");

		private final String label;

		BlurType(String label) {
			this.label = label;
		}

		public static BlurType get(String type) {
			if (BILATERAL.label.equals(type)) {
				return BILATERAL;
			}
			else if (GAUSSIAN.label.equals(type)) {
			return GAUSSIAN;
			}
			else if (MEDIAN.label.equals(type)) {
				return MEDIAN;
			}
			else {
				return BOX;
			}
		}

		@Override
		public String toString() {
			return this.label;
		}
	}

	/**
	 * Softens an image using one of several filters.
	 * @param input The image on which to perform the blur.
	 * @param type The blurType to perform.
	 * @param doubleRadius The radius for the blur.
	 * @param output The image in which to store the output.
	 */
	private void blur(Mat input, BlurType type, double doubleRadius,
		Mat output) {
		int radius = (int)(doubleRadius + 0.5);
		int kernelSize;
		switch(type){
			case BOX:
				kernelSize = 2 * radius + 1;
				Imgproc.blur(input, output, new Size(kernelSize, kernelSize));
				break;
			case GAUSSIAN:
				kernelSize = 6 * radius + 1;
				Imgproc.GaussianBlur(input,output, new Size(kernelSize, kernelSize), radius);
				break;
			case MEDIAN:
				kernelSize = 2 * radius + 1;
				Imgproc.medianBlur(input, output, kernelSize);
				break;
			case BILATERAL:
				Imgproc.bilateralFilter(input, output, -1, radius, radius);
				break;
		}
	}

	/**
	 * Sets the values of pixels in a binary image to their distance to the nearest black pixel.
	 * @param input The image on which to perform the Distance Transform.
	 * @param type The Transform.
	 * @param maskSize the size of the mask.
	 * @param output The image in which to store the output.
	 */
	private void findContours(Mat input, boolean externalOnly,
		List<MatOfPoint> contours) {
		Mat hierarchy = new Mat();
		contours.clear();
		int mode;
		if (externalOnly) {
			mode = Imgproc.RETR_EXTERNAL;
		}
		else {
			mode = Imgproc.RETR_LIST;
		}
		int method = Imgproc.CHAIN_APPROX_SIMPLE;
		Imgproc.findContours(input, contours, hierarchy, mode, method);
	}

	/**
	 * Filters out contours that do not meet certain criteria.
	 * @param inputContours is the input list of contours
	 * @param output is the the output list of contours
	 * @param minArea is the minimum area of a contour that will be kept
	 * @param minPerimeter is the minimum perimeter of a contour that will be kept
	 * @param minWidth minimum width of a contour
	 * @param maxWidth maximum width
	 * @param minHeight minimum height
	 * @param maxHeight maximimum height
	 * @param Solidity the minimum and maximum solidity of a contour
	 * @param minVertexCount minimum vertex Count of the contours
	 * @param maxVertexCount maximum vertex Count
	 * @param minRatio minimum ratio of width to height
	 * @param maxRatio maximum ratio of width to height
	 */
	private void filterContours(List<MatOfPoint> inputContours, double minArea,
		double minPerimeter, double minWidth, double maxWidth, double minHeight, double
		maxHeight, double[] solidity, double maxVertexCount, double minVertexCount, double
		minRatio, double maxRatio, List<MatOfPoint> output) {
		final MatOfInt hull = new MatOfInt();
		output.clear();
		//operation
		for (int i = 0; i < inputContours.size(); i++) {
			final MatOfPoint contour = inputContours.get(i);
			final Rect bb = Imgproc.boundingRect(contour);
			if (bb.width < minWidth || bb.width > maxWidth) continue;
			if (bb.height < minHeight || bb.height > maxHeight) continue;
			final double area = Imgproc.contourArea(contour);
			if (area < minArea) continue;
			if (Imgproc.arcLength(new MatOfPoint2f(contour.toArray()), true) < minPerimeter) continue;
			Imgproc.convexHull(contour, hull);
			MatOfPoint mopHull = new MatOfPoint();
			mopHull.create((int) hull.size().height, 1, CvType.CV_32SC2);
			for (int j = 0; j < hull.size().height; j++) {
				int index = (int)hull.get(j, 0)[0];
				double[] point = new double[] { contour.get(index, 0)[0], contour.get(index, 0)[1]};
				mopHull.put(j, 0, point);
			}
			final double solid = 100 * area / Imgproc.contourArea(mopHull);
			if (solid < solidity[0] || solid > solidity[1]) continue;
			if (contour.rows() < minVertexCount || contour.rows() > maxVertexCount)	continue;
			final double ratio = bb.width / (double)bb.height;
			if (ratio < minRatio || ratio > maxRatio) continue;
			output.add(contour);
		}
	}

}


text:
using System;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using Plugin.BluetoothLE.Internals;
using Plugin.BluetoothLE.Server;
using Tizen.Network.Bluetooth;

namespace Plugin.BluetoothLE
{
    public class Adapter : AbstractAdapter
    {
        readonly DeviceManager deviceManager = new DeviceManager();

        public override AdapterStatus Status => BluetoothAdapter.IsBluetoothEnabled
            ? AdapterStatus.PoweredOn
            : AdapterStatus.PoweredOff;

        public override IGattServer CreateGattServer() => null;

        public override IObservable<IScanResult> Scan(ScanConfig config = null) => Observable.Create<IScanResult>(ob =>
        {
            this.deviceManager.Clear();
            var handler = new EventHandler<AdapterLeScanResultChangedEventArgs>((sender, args) =>
            {
                var device = this.deviceManager.GetDevice(args.DeviceData);
                ob.OnNext(new ScanResult(device, args.DeviceData.Rssi, new AdvertisementData(args.DeviceData)));
            });
            BluetoothAdapter.ScanResultChanged += handler;
            BluetoothAdapter.StartLeScan();

            return () =>
            {
                BluetoothAdapter.StopLeScan();
                BluetoothAdapter.ScanResultChanged -= handler;
            };
        });

        public override void StopScan() => BluetoothAdapter.StopLeScan();

        public override IObservable<AdapterStatus> WhenStatusChanged() => Observable.Create<AdapterStatus>(ob =>
        {
            var handler = new EventHandler<StateChangedEventArgs>((sender, args) => ob.OnNext(this.Status));
            BluetoothAdapter.StateChanged += handler;
            return () => BluetoothAdapter.StateChanged -= handler;
        });
    }
}


text:
int main(int argc, char** argv)
{
	int start = atoi(argv[1]);
	int i;
	for (i = 0; i < start; i++) {
		int child = fork();//only works for the initial fork and all child processes
		if (child == -1 ) return -1; //something went wrong
		else if (child > 0) { //parent process
			break;
		}
	}
	wait(NULL); //wait until all the child processes are done making forks
	printf("%d\n", i);
}


text:
package co.edu.udea.computacionmovil.parkingeasy;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.google.android.gms.maps.SupportMapFragment;

/**
 * Crear Mapa
 */
public class MapFragment extends SupportMapFragment {

    public MapFragment() {
    }

    public static MapFragment newInstance() {
        return new MapFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View root = super.onCreateView(inflater, container, savedInstanceState);

        return root;
    }

}


text:
var Template = function () {

};

Template.prototype = {
  init: function () {
    console.log('Template: init');
  },
  preload: function () {},
  create: function () {},
  render: function () {}
}

module.exports = Template;


text:
function  [files_in,files_out,opt] = niak_brick_merge_part(files_in,files_out,opt)

%
% _________________________________________________________________________
% SUMMARY NIAK_BRICK_MERGE_PART
%
% Merge multiple partitions into one. This brick is used by
% NIAK_PIPELINE_REGION_GROWING, and is not that usefull by itself.
%
% SYNTAX:
% [FILES_IN,FILES_OUT,OPT] = NIAK_BRICK_MERGE_PART(FILES_IN,FILES_OUT,OPT)
%
% _________________________________________________________________________
% INPUTS
%
% FILES_IN
%       (structure) with the following fields:
%
%       AREAS
%           (string) the name of a mask of brain areas.
%
%       PART
%           (cell of strings) PART{I} is the name of a .mat file which
%           contains one partion PART. PART defines a partition on the
%           region OPT.IND_ROIS(I) of AREAS.
%
%       TSERIES
%           (cell of strings) each entry TSERIES{J} is the name of a .mat
%           file with variables names TSERIES_<NUM_R> where NUM_R is the
%           number of a roi in AREAS.
%
% FILES_OUT
%
%       SPACE
%           (string) a 3D volume with Is in the Ith region. The regions
%           from all areas are merged.
%
%       TSERIES
%           (cell of strings, default same as FILES_IN.TSERIES with a
%           '_rois' suffix) a .mat file with a variable TSERIES.
%           TSERIES(:,I) is the time series associated with region I in the
%           dataset FILES_IN.TSERIES.
%
% OPT
%       (structure, optional) with the following fields:
%
%       IND_ROIS
%           (vector) the list of region numbers corresponding to the
%           entries of FILES_IN.PART.
%
%       CORRECTION
%           (structure, default CORRECTION.TYPE = 'mean') the temporal
%           normalization to apply on the individual time series before
%           averaging. See OPT in NIAK_NORMALIZE_TSERIES.
%
%       FOLDER_OUT
%           (string, default: path of FILES_IN.FMRI{1}) If present,
%           all default outputs will be created in the folder FOLDER_OUT.
%           The folder needs to be created beforehand.
%
%       FLAG_VERBOSE
%           (boolean, default 1) if FLAG_VERBOSE == 1, print some
%          information on the advance of computation
%
%       FLAG_TEST
%           (boolean, default 0) if FLAG_TEST equals 1, the
%           brick does not do anything but update the default
%           values in FILES_IN, FILES_OUT and OPT.
%
% _________________________________________________________________________
% OUTPUTS
%
% The structures FILES_IN, FILES_OUT and OPT are updated with default
% valued. If OPT.FLAG_TEST == 0, the specified outputs are written.
%
% _________________________________________________________________________
% SEE ALSO
%
% NIAK_PIPELINE_REGION_GROWING
%
% _________________________________________________________________________
% COMMENTS
%
% If the variables cannot be found, the partition will be created, but
% empty.
%
% Copyright (c) Pierre Bellec, McConnell Brain Imaging Center,Montreal
%               Neurological Institute, McGill University, 2008.
% Maintainer : pbellec@bic.mni.mcgill.ca
% See licensing information in the code.
% Keywords : spatial neighbour, adjacency matrix, connexity, graph

% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
% all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
% THE SOFTWARE.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Seting up default arguments %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% global NIAK variables
flag_gb_niak_fast_gb = true; % Only load the most important global variables for fast initialization
niak_gb_vars

%% Check syntax
if ~exist('files_in','var')|~exist('files_out','var')
    error('fnak:brick','syntax: [FILES_IN,FILES_OUT,OPT] = NIAK_BRICK_MERGE_PART(FILES_IN,FILES_OUT,OPT).\n Type ''help niak_brick_merge_part'' for more info.')
end

%% Inputs
gb_name_structure = 'files_in';
gb_list_fields = {'areas','part','tseries'};
gb_list_defaults = {NaN,NaN,'gb_niak_omitted'};
niak_set_defaults

%% Outputs
gb_name_structure = 'files_out';
gb_list_fields = {'space','tseries'};
gb_list_defaults = {NaN,'gb_niak_omitted'};
niak_set_defaults

%% Options
opt_norm.type = 'mean';
gb_name_structure = 'opt';
gb_list_fields = {'folder_out','correction','ind_rois','flag_verbose','flag_test'};
gb_list_defaults = {'',opt_norm,[],true,false};
niak_set_defaults

%% Building default output names
flag_out = isempty(opt.folder_out);
flag_init_tseries = isempty(files_out.tseries);

if flag_init_tseries

    for num_f = 1:length(files_in.tseries)

        [path_t,name_t,ext_t] = fileparts(files_in.tseries{num_f});

        if flag_out
            opt.folder_out = path_t;
        end

        if flag_init_tseries
            files_out.tseries{num_f} = cat(2,opt.folder_out,filesep,name_t,'_roi.mat');
        end

    end
end

if ~ischar(files_out.tseries)&&ischar(files_in.tseries)
    error('The time series need to be specified in a cell of string FILES_IN.TSERIES')
end

%% If the test flag is true, stop here !
if flag_test
    return
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The core of the brick starts here %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if flag_verbose
    msg = sprintf('Merging partitions');
    stars = repmat('*',[length(msg) 1]);
    fprintf('\n%s\n%s\n%s\n',stars,msg,stars);
end

%% Read the areas
if flag_verbose
    fprintf('Read the areas %s\n',files_in.areas);
end

[hdr,mask] = niak_read_vol(files_in.areas);
mask = round(mask);

%% Merge the masks
mask_merge = zeros(size(mask));

list_area = opt.ind_rois;
list_area = list_area(:)';
nb_areas = length(list_area);
part_merge = cell([nb_areas 1]);
list_num_roi = cell([nb_areas 1]);
nb_rois = 0;

for num_e = 1:nb_areas
    num_a = list_area(num_e);
    if flag_verbose
        fprintf('Merge regions from area %i\n',num_a);
    end

    load(files_in.part{num_e},'part');

    if ~isempty(part)
        nb_rois_area = max(part);
        part(part~=0) = part(part~=0) + nb_rois;
        mask_merge(mask == num_a) = part;
        part_merge{num_e} = part;
        list_num_roi{num_e} = nb_rois+1:nb_rois+nb_rois_area;
        nb_rois = nb_rois + nb_rois_area;
    else
        mask_merge(mask == num_a) = part;
        list_num_roi{num_e} = [];
    end
end

hdr.file_name = files_out.space;
niak_write_vol(hdr,mask_merge);

%% Build tseries
if ~ischar(files_out.tseries)
    nb_files = length(files_in.tseries);
    for num_f = 1:nb_files
        if flag_verbose
            fprintf('Building regional time series from %s to %s\n',files_in.tseries{num_f},files_out.tseries{num_f});
        end

        data = load(files_in.tseries{num_f});
        flag_init = true;
        for num_e = 1:nb_areas
            num_a = list_area(num_e);
            var_name = ['tseries_',num2str(num_a)];
            if flag_init&&~isempty(data.(var_name))
                nt = size(data.(var_name),1);
                tseries = zeros([nt,nb_rois]);
                flag_init = false;
            end
            for num_r = list_num_roi{num_e}
                tseries(:,num_r) = mean(niak_normalize_tseries(data.(var_name)(:,part_merge{num_e}==num_r),opt.correction),2);
            end
        end
        save(files_out.tseries{num_f},'tseries');
    end
end


text:
VPRJUFPS ;SLC/KCM -- Unit tests for index functions
 ;;1.0;JSON DATA STORE;;Sep 01, 2012
 ;
STARTUP  ; Run once before all tests
 Q
SHUTDOWN ; Run once after all tests
 Q
SETUP    ; Run before each test
 Q
TEARDOWN ; Run after each test
 Q
ASSERT(EXPECT,ACTUAL) ; convenience
 D EQ^VPRJT(EXPECT,ACTUAL)
 Q
 ;
CWAD ;; @TEST CWAD index
 N DOC
 S DOC("documentTypeCode")="D",DOC("status")="COMPLETED"
 D ASSERT(1,$$CWAD^VPRJFPS(.DOC))
 S DOC("documentTypeCode")="D",DOC("status")="RETRACTED"
 D ASSERT(0,$$CWAD^VPRJFPS(.DOC))
 S DOC("documentTypeCode")="",DOC("status")="COMPLETED"
 D ASSERT(0,$$CWAD^VPRJFPS(.DOC))
 Q


text:
require 'rails_helper'

RSpec.describe Group, type: :model do
  describe "associations" do
    let (:admin){User.create(name: "Admin", email: "admin@admin.com", password: "password")}
    let (:creator){User.create(name: "Creator", email: "creator@creator.com", password: "password")}
    let (:member){User.create(name: "Member", email: "member@member.com", password: "password")}
    let (:group){Group.new(name: "Test")}
    let (:hangout){Hangout.new()}

    before(:each) do
      admin.created_groups << group
      group.save
      group.members << admin
      group.members << creator
      group.members << member

      creator.created_hangouts << hangout
      group.hangouts << hangout
      hangout.save
    end

    context "Group" do
      it "has a name" do
        expect(group.name).to eq "Test"
      end

      it "has an admin" do
        expect(group.admin).to be_a User
      end

      it "has members" do
        expect(group.members).to all be_a User
      end

      it "has a hangout" do
        expect(group.hangouts).to all be_a Hangout
      end
    end
  end
end


text:
package org.apache.storm.topology;

import java.util.Map;

@SuppressWarnings("rawtypes")
public interface ComponentConfigurationDeclarer<T extends ComponentConfigurationDeclarer> {
  T addConfigurations(Map conf);

  T addConfiguration(String config, Object value);

  T setDebug(boolean debug);

  T setMaxTaskParallelism(Number val);

  T setMaxSpoutPending(Number val);

  T setNumTasks(Number val);
}