text:
namespace Yt
{
	GlBufferHandle::GlBufferHandle(const GlApi& gl, GLenum target)
		: _gl{ gl }
		, _target{ target }
	{
		_gl.GenBuffers(1, &_handle);
		if (!_handle)
			throw std::runtime_error("glGenBuffers failed");
	}

	GlBufferHandle::GlBufferHandle(GlBufferHandle&& buffer) noexcept
		: _gl{ buffer._gl }
		, _target{ buffer._target }
		, _handle{ buffer._handle }
		, _size{ buffer._size }
	{
		buffer._handle = 0;
	}

	GlBufferHandle::~GlBufferHandle() noexcept
	{
		if (_handle)
			_gl.DeleteBuffers(1, &_handle);
	}

	void GlBufferHandle::bind() const noexcept
	{
		_gl.BindBuffer(_target, _handle);
	}

	void GlBufferHandle::initialize(GLenum usage, size_t size, const void* data) noexcept
	{
		_gl.NamedBufferDataEXT(_handle, static_cast<GLsizeiptr>(size), data, usage);
		_size = static_cast<GLuint>(size);
	}

	void GlBufferHandle::unbind() const noexcept
	{
		_gl.BindBuffer(_target, 0);
	}

	void GlBufferHandle::write(size_t offset, size_t size, const void* data) const noexcept
	{
		_gl.NamedBufferSubDataEXT(_handle, static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size), data);
	}

	GlProgramHandle::GlProgramHandle(const GlApi& gl)
		: _gl{ gl }
		, _handle{ _gl.CreateProgram() }
	{
		if (!_handle)
			throw std::runtime_error("glCreateProgram failed");
	}

	GlProgramHandle::GlProgramHandle(GlProgramHandle&& program) noexcept
		: _gl{ program._gl }
		, _handle{ program._handle }
	{
		program._handle = 0;
	}

	GlProgramHandle::~GlProgramHandle()
	{
		if (_handle)
			_gl.DeleteProgram(_handle);
	}

	void GlProgramHandle::attach(GLuint shader) const
	{
		_gl.AttachShader(_handle, shader);
	}

	std::string GlProgramHandle::info_log() const
	{
		GLint info_log_length = 0;
		_gl.GetProgramiv(_handle, GL_INFO_LOG_LENGTH, &info_log_length);
		if (info_log_length <= 1)
			return {};
		std::string result(static_cast<size_t>(info_log_length) - 1, ' ');
		GLsizei actual_length = 0;
		_gl.GetProgramInfoLog(_handle, info_log_length, &actual_length, &result[0]);
		assert(actual_length == info_log_length - 1);
		return result;
	}

	bool GlProgramHandle::link() const
	{
		_gl.LinkProgram(_handle);
		GLint link_status = GL_FALSE;
		_gl.GetProgramiv(_handle, GL_LINK_STATUS, &link_status);
		return GL_TRUE == link_status;
	}

	void GlProgramHandle::set_uniform(const char* name, const Matrix4& value) const
	{
		_gl.ProgramUniformMatrix4fvEXT(_handle, _gl.GetUniformLocation(_handle, name), 1, GL_FALSE, &value.x.x);
	}

	GlShaderHandle::GlShaderHandle(const GlApi& gl, GLenum type)
		: _gl{ gl }
		, _type{ type }
		, _handle{ _gl.CreateShader(_type) }
	{
		if (!_handle)
			throw std::runtime_error("glCreateShader failed");
	}

	GlShaderHandle::GlShaderHandle(GlShaderHandle&& shader) noexcept
		: _gl{ shader._gl }
		, _type{ shader._type }
		, _handle{ shader._handle }
	{
		shader._handle = 0;
	}

	GlShaderHandle::~GlShaderHandle()
	{
		if (_handle)
			_gl.DeleteShader(_handle);
	}

	bool GlShaderHandle::compile(std::string_view source) const
	{
		auto source_data = source.data();
		const auto source_size = static_cast<GLint>(source.size());
		_gl.ShaderSource(_handle, 1, &source_data, &source_size);
		_gl.CompileShader(_handle);
		GLint compile_status = GL_FALSE;
		_gl.GetShaderiv(_handle, GL_COMPILE_STATUS, &compile_status);
		return GL_TRUE == compile_status;
	}

	std::string GlShaderHandle::info_log() const
	{
		GLint info_log_length = 0;
		_gl.GetShaderiv(_handle, GL_INFO_LOG_LENGTH, &info_log_length);
		if (info_log_length <= 1)
			return {};
		std::string result(static_cast<size_t>(info_log_length) - 1, ' ');
		GLsizei actual_length = 0;
		_gl.GetShaderInfoLog(_handle, info_log_length, &actual_length, &result[0]);
		assert(actual_length == info_log_length - 1);
		return result;
	}

	GlTextureHandle::GlTextureHandle(const GlApi& gl, GLenum target)
		: _gl{ gl }
		, _target{ target }
	{
		_gl.GenTextures(1, &_handle);
		if (!_handle)
			throw std::runtime_error("glGenTextures failed");
	}

	GlTextureHandle::GlTextureHandle(GlTextureHandle&& texture) noexcept
		: _gl{ texture._gl }
		, _target{ texture._target }
		, _handle{ texture._handle }
	{
		texture._handle = 0;
	}

	GlTextureHandle::~GlTextureHandle()
	{
		if (_handle)
			_gl.DeleteTextures(1, &_handle);
	}

	void GlTextureHandle::bind() const
	{
		_gl.BindTexture(_target, _handle);
	}

	void GlTextureHandle::generate_mipmaps() const
	{
		_gl.GenerateTextureMipmapEXT(_handle, _target);
	}

	void GlTextureHandle::set_anisotropy_enabled(bool enabled) const
	{
		if (_gl.EXT_texture_filter_anisotropic)
			_gl.TextureParameterfEXT(_handle, _target, GL_TEXTURE_MAX_ANISOTROPY_EXT, enabled ? _gl.MAX_TEXTURE_MAX_ANISOTROPY_EXT : 1.f);
	}

	void GlTextureHandle::set_data(GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) const
	{
		_gl.TextureImage2DEXT(_handle, _target, level, static_cast<GLint>(internalformat), width, height, 0, format, type, pixels);
	}

	void GlTextureHandle::set_parameter(GLenum name, GLint value) const
	{
		_gl.TextureParameteriEXT(_handle, _target, name, value);
	}

	GlVertexArrayHandle::GlVertexArrayHandle(const GlApi& gl)
		: _gl{ gl }
	{
		_gl.GenVertexArrays(1, &_handle);
		if (!_handle)
			throw std::runtime_error("glGenVertexArrays failed");
	}

	GlVertexArrayHandle::GlVertexArrayHandle(GlVertexArrayHandle&& vertex_array) noexcept
		: _gl{ vertex_array._gl }
		, _handle{ vertex_array._handle }
		, _attributes{ vertex_array._attributes }
	{
		vertex_array._handle = 0;
	}

	GlVertexArrayHandle::~GlVertexArrayHandle() noexcept
	{
		if (_handle)
			_gl.DeleteVertexArrays(1, &_handle);
	}

	void GlVertexArrayHandle::bind() const noexcept
	{
		_gl.BindVertexArray(_handle);
		for (GLuint i = 0; i < 32; ++i)
			if (_attributes & (1u << i))
				_gl.EnableVertexAttribArray(i);
	}

	void GlVertexArrayHandle::bind_vertex_buffer(GLuint binding, GLuint buffer, size_t offset, size_t stride) noexcept
	{
		_gl.VertexArrayBindVertexBufferEXT(_handle, binding, buffer, static_cast<GLintptr>(offset), static_cast<GLsizei>(stride));
	}

	void GlVertexArrayHandle::unbind() const noexcept
	{
		for (GLuint i = 32; i > 0;)
			if (_attributes & (1u << --i))
				_gl.DisableVertexAttribArray(i);
		_gl.BindVertexArray(0);
	}

	void GlVertexArrayHandle::vertex_attrib_binding(GLuint attrib, GLuint binding) noexcept
	{
		_gl.VertexArrayVertexAttribBindingEXT(_handle, attrib, binding);
	}

	void GlVertexArrayHandle::vertex_attrib_format(GLuint attrib, GLint size, GLenum type, GLboolean normalized, size_t offset) noexcept
	{
		_gl.VertexArrayVertexAttribFormatEXT(_handle, attrib, size, type, normalized, static_cast<GLuint>(offset));
		assert(attrib < 32);
		_attributes |= 1u << attrib;
	}
}


text:
PollerQueue
===========

A queue that polls for stuff to process.

redpajama_set_name: RedPajamaGithub


text:
package org.esfinge.querybuilder.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.esfinge.querybuilder.methodparser.ComparisonType;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER,ElementType.FIELD,ElementType.METHOD})
@ComparisonOperator(ComparisonType.NOT_EQUALS)
public @interface NotEquals {

}


text:
package com.microsoft.azure.management.recoveryservices.backup.v2017_07_01;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The name of usage.
 */
public class NameInfo {
    /**
     * Value of usage.
     */
    @JsonProperty(value = "value")
    private String value;

    /**
     * Localized value of usage.
     */
    @JsonProperty(value = "localizedValue")
    private String localizedValue;

    /**
     * Get value of usage.
     *
     * @return the value value
     */
    public String value() {
        return this.value;
    }

    /**
     * Set value of usage.
     *
     * @param value the value value to set
     * @return the NameInfo object itself.
     */
    public NameInfo withValue(String value) {
        this.value = value;
        return this;
    }

    /**
     * Get localized value of usage.
     *
     * @return the localizedValue value
     */
    public String localizedValue() {
        return this.localizedValue;
    }

    /**
     * Set localized value of usage.
     *
     * @param localizedValue the localizedValue value to set
     * @return the NameInfo object itself.
     */
    public NameInfo withLocalizedValue(String localizedValue) {
        this.localizedValue = localizedValue;
        return this;
    }

}


text:
describe("when a documented var memeber is inside a named function", function() {
    var docSet = jasmine.getDocSetFromFile('test/fixtures/inner.js'),
        found1 = docSet.getByLongname('sendMessage~encoding'),
        found2 = docSet.getByLongname('sendMessage~encrypt');

    it("A Doclet with the correct longname should be found", function() {
        expect(found1.length).toEqual(1);
        expect(found2.length).toEqual(1);
    });

    it("The short name should be correct", function() {
        expect(found1[0].name).toEqual('encoding');
        expect(found2[0].name).toEqual('encrypt');
    });

    it("The member of should be correct", function() {
        expect(found1[0].memberof).toEqual('sendMessage');
        expect(found2[0].memberof).toEqual('sendMessage');
    });
    it("The scope should default to 'inner'", function() {
        expect(found1[0].scope).toEqual('inner');
        expect(found2[0].scope).toEqual('inner');
    });
});


text:
using System;
using System.Runtime.CompilerServices;

/* GenDebugConstr.cs
 * Simple test case for gmcs issue (should compile).
 * Bryan Silverthorn <bsilvert@cs.utexas.edu>
 */

public interface Indexed
{
	[IndexerName("Foo")]
	int this [int ix] {
		get;
	}
}

public class Foo<G>
	where G : Indexed
{
	public static void Bar()
	{
		int i = default(G) [0];
	}
}

class X
{
	public static void Main ()
	{ }
}


text:
package cn.fu.dragsortview.lib;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import cn.fu.dragsortview.R;
import cn.fu.dragsortview.R.dimen;
import cn.fu.dragsortview.R.id;
import android.app.Service;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Handler;
import android.os.Vibrator;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Scroller;

public class DragSortViewGroup extends ViewGroup
{
	// main Params
	private Context mContext;
	private ArrayList<ViewInfo> containerList = new ArrayList<ViewInfo>();
	private LinearLayout targetView;
	private ViewInfo targetViewContainer;
	private Scroller mScroller;
	private AccelerateInterpolator acInterpolator = new AccelerateInterpolator();
	private Handler mHanler = new Handler();
	private VelocityTracker mVelocityTracker; // scroll speed tracker

	private int startY = 0;

	// related with press or drag state
	private static final int IDLE = 0;
	private static final int DRAGING = 1;
	private static final int NOT_MEASURE = -3;
	private static int myMode = IDLE;

	// some final params
	private final int DIFF = 10;
	private final int LONGPRESS_DELAY = 10;
	private final int UP_SCROLL = -1;
	private final int STOP_SCROLL = 0;
	private final int DOWN_SCROLL = 1;
	private final int mAutoScrollInterval_time = 0;
	private final int DEFLAUT_VALUE = -1;

	// tmp params
	private int dragView_Padding;
	private int lastDownY = -1;
	private int targetOrder = -1;
	private int detalY = 0;
	private int lastTagetPosY = 0;
	private int targetViewPosY = 0;
	private int lastMotionY = 0;
	private int mCurScrollY = 0;
	private int dragRangeUpLine = 0;
	private int dragRangeBottomLine = 0;
	private int mAutoScrolDirection = 0;
	private int mAutoScrollInterval = 10;
	private int getEventY = 0;
	private int dragViewMarginSide = 4;
	private int totalMarginBottom;
	private int screenW;
	private int screenH;
	private int sumDragViewHeight = 0;
	private float scale = 1.0f;
	private int adjustAnimaCnt = 0; // equal to 0 means none of view is
									// animating

	public DragSortViewGroup(Context context, BaseView... bvs)
	{
		super(context);
		init(context, bvs);
	}

	private void init(Context context, BaseView... bvs)
	{
		this.setBackgroundColor(Color.DKGRAY);
		mScroller = new Scroller(context);
		mContext = context;
		screenW = getResources().getDisplayMetrics().widthPixels;
		screenH = getResources().getDisplayMetrics().heightPixels;

		scale = context.getResources().getDisplayMetrics().density;
		mAutoScrollInterval *= scale;
		dragView_Padding = context.getResources().getDimensionPixelOffset(R.dimen.drag_view_padding);

		dragViewMarginSide = context.getResources().getDimensionPixelOffset(R.dimen.drag_view_margin_side);

		// total bottom margin
		totalMarginBottom = mContext.getResources().getDimensionPixelSize(R.dimen.dragview_container_bottom_margin);

		// using nickname to help sort these views
		for (int i = 0; i < bvs.length; i++)
		{
			addWightViewItem(context, bvs[i], "view" + i);
		}

		sortWightView();
	}

	// just init view layoutparams here, not sort them, sort them later
	private void addWightViewItem(Context context, BaseView view, String nickName)
	{
		addView(view);
		ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(MarginLayoutParams.MATCH_PARENT, MarginLayoutParams.WRAP_CONTENT);

		// if need left or right margin , init them when setting layoutparams
		lp.leftMargin = dragViewMarginSide;
		lp.rightMargin = dragViewMarginSide;
		lp.topMargin = NOT_MEASURE; // just a flg

		// measure view params ,low efficiency needs to be improved
		view.measure(MeasureSpec.makeMeasureSpec(screenW - dragViewMarginSide * 2, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
		lp.width = screenW - dragViewMarginSide * 2;
		lp.height = view.getMeasuredHeight();
		view.setLayoutParams(lp);

		ViewInfo viewInfo = new ViewInfo();
		viewInfo.name = nickName;
		viewInfo.order = OrderSettingUtil.getIntPref(mContext, nickName, 0);
		viewInfo.view = view;
		viewInfo.height = view.getMeasuredHeight();
		viewInfo.topMargin = NOT_MEASURE;
		containerList.add(viewInfo);
	}

	public void updateChildView()
	{
		for (ViewInfo vi : containerList)
		{
			vi.view.updateDate();
		}
	}

	/**
	 * need to override onLayout method
	 * */
	@Override
	protected void onLayout(boolean changed, int l, int t, int r, int b)
	{
		int nextTopMargin = startY;
		sumDragViewHeight = 0;

		for (int i = 0; i < containerList.size(); i++)
		{
			ViewInfo container = containerList.get(i);
			View child = container.view;
			child.measure(MeasureSpec.makeMeasureSpec(screenW - dragViewMarginSide * 2, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
			MarginLayoutParams lP = (MarginLayoutParams) child.getLayoutParams();

			if (isDragAnimationFinished())
			{
				// force sort views by theirs view info
				nextTopMargin += dragView_Padding;
				lP.topMargin = nextTopMargin;
				container.topMargin = nextTopMargin;
				container.height = child.getMeasuredHeight();
				child.layout(lP.leftMargin, lP.topMargin, lP.leftMargin + child.getMeasuredWidth(), lP.topMargin + container.height);
			} else
			{
				child.layout(lP.leftMargin, lP.topMargin, lP.leftMargin + child.getMeasuredWidth(), lP.topMargin + child.getMeasuredHeight());
			}

			nextTopMargin += child.getMeasuredHeight();
			sumDragViewHeight += child.getMeasuredHeight() + dragView_Padding;

		}
		// bottom margin blank
		dragRangeBottomLine = sumDragViewHeight + totalMarginBottom;
	}

	@Override
	public boolean onTouchEvent(MotionEvent event)
	{
		handleMotionEventToDragView(event, getScrollY());
		return true;
	}

	// so boring here , needs to refactor
	public boolean handleMotionEventToDragView(MotionEvent event, int scrollY)
	{

		initVelocityTacker();
		mVelocityTracker.addMovement(event);

		mCurScrollY = scrollY;
		if (myMode == IDLE)
		{
			switch (event.getAction() & MotionEvent.ACTION_MASK)
			{
			case MotionEvent.ACTION_DOWN:
				lastDownY = -1;
				lastMotionY = (int) event.getY();
				int k = findHitItemOrder(event);
				if (k != -1)
				{
					lastDownY = (int) event.getY();
					targetViewContainer = containerList.get(k);
					targetView = targetViewContainer.view;
					bringChildToFront(targetView);
					mLongPressHandler.postDelayed(mLongPressRunnable, LONGPRESS_DELAY);
				}

			case MotionEvent.ACTION_MOVE:
				if (lastDownY > 0 && Math.abs(event.getY() - lastDownY) > 10)
				{
					mLongPressHandler.removeCallbacks(mLongPressRunnable);
				}
				int curY = (int) event.getY();
				int detalY = lastMotionY - curY;
				if (getScrollY() < 0 || getScrollY() > sumDragViewHeight - getHeight())
				{
					detalY /= 4;
				}
				scrollBy(0, detalY);
				lastMotionY = curY;
				return false;
			case MotionEvent.ACTION_UP:
			case MotionEvent.ACTION_CANCEL:
				mLongPressHandler.removeCallbacks(mLongPressRunnable);

				mVelocityTracker.computeCurrentVelocity(1000, 8000);
				int initialVelocity = (int) mVelocityTracker.getYVelocity(event.getPointerId(0));
				if ((Math.abs(initialVelocity) > 50))
				{
					fling(-initialVelocity);
				} else
				{
					// revertLayout();
				}

				if (getScrollY() < 0)
				{
					scrollTo(0, 0);
				}
				if (getScrollY() > sumDragViewHeight - getHeight())
				{
					scrollTo(0, sumDragViewHeight - getHeight());
				}
				recycleVelocityTracker();
				return false;
			}
		} else if (myMode == DRAGING)
		{
			switch (event.getAction())
			{
			case MotionEvent.ACTION_DOWN:
				break;

			case MotionEvent.ACTION_MOVE:
				if (targetView != null && targetOrder != -1)
				{
					lastTagetPosY = targetViewPosY;

					constraintLayoutParams(event);
					targetView.requestLayout();
					adjustScroll(event);
					adjustAllItems();
				}
				break;

			case MotionEvent.ACTION_UP:
			case MotionEvent.ACTION_CANCEL:
				myMode = IDLE;
				((BaseView) targetView).changeModeToIDLE();
				setSrollDirction(STOP_SCROLL);
				mHanler.removeCallbacks(mScrollRunable);
				mLongPressHandler.removeCallbacks(mLongPressRunnable);
				if (targetViewPosY < dragRangeUpLine)
				{
					targetViewPosY = dragRangeUpLine;
				}
				if (targetOrder != -1)
				{
					magneticTargetIem(targetOrder);
					targetOrder = -1;
				}
				recycleVelocityTracker();
				break;
			}

		}
		return true;
	}

	public void fling(int velocityY)
	{
		mScroller.fling(0, getScrollY(), 0, velocityY, 0, 0, 0, sumDragViewHeight - getHeight());
		invalidate();
	}

	/**
	 * compute scroll params. must override it ,otherwise, view can't fling
	 * */
	@Override
	public void computeScroll()
	{
		if (mScroller.computeScrollOffset())
		{
			scrollTo(mScroller.getCurrX(), mScroller.getCurrY());
			postInvalidate();
			awakenScrollBars();
		}
	}

	private void initVelocityTacker()
	{
		if (mVelocityTracker == null)
		{
			mVelocityTracker = VelocityTracker.obtain();
		}

	}

	private void recycleVelocityTracker()
	{
		if (mVelocityTracker != null)
		{
			mVelocityTracker.recycle();
			mVelocityTracker = null;
		}
	}

	private void adjustAllItems()
	{

		ViewInfo upViewContainer = null;
		ViewInfo downViewContainer = null;
		if (targetOrder != 0)
		{
			upViewContainer = containerList.get(targetOrder - 1);
		}
		if (targetOrder != containerList.size() - 1)
		{
			downViewContainer = containerList.get(targetOrder + 1);
		}
		boolean isCollideUp = checkIfCollideUp(copyViewInfo(targetViewContainer), copyViewInfo(upViewContainer));
		boolean isCollideDown = checkIfCollideDown(copyViewInfo(targetViewContainer), copyViewInfo(downViewContainer));

		// // 上移
		if (isCollideUp)
		{
			// 动画开始的标记
			adjustAnimaCnt++;

			// 跟上面的冲突了,上面的图往下移动
			final ViewInfo upInfo = copyViewInfo(upViewContainer);
			final ViewInfo targetInfo = copyViewInfo(targetViewContainer);
			TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, targetInfo.height + dragView_Padding);
			translateAnimation.setDuration((int) (targetInfo.height * 1.5 / scale));
			translateAnimation.setInterpolator(acInterpolator);
			final LinearLayout view = upInfo.view;
			MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
			lp.topMargin = upViewContainer.topMargin;
			view.setLayoutParams(lp);
			// final int startY = upViewContainer.topMargin;
			final int distanceY = targetInfo.height + upInfo.topMargin + dragView_Padding;
			final int scrollDownY = targetViewPosY - distanceY;
			final boolean isHelpScroll = false;
			view.startAnimation(translateAnimation);
			translateAnimation.setAnimationListener(new AnimationListener()
			{
				@Override
				public void onAnimationStart(Animation animation)
				{
				}

				@Override
				public void onAnimationRepeat(Animation animation)
				{
				}

				@Override
				public void onAnimationEnd(Animation animation)
				{
					// fix bug ,view twinkle when animation finished , so add an
					// empty animation for fixing bug
					view.clearAnimation();
					TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0);
					view.startAnimation(anim);
					MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
					lp.topMargin = distanceY;
					view.setLayoutParams(lp);
					view.requestLayout();
					// view.invalidate();
					// set flg when animation finished
					adjustAnimaCnt--;
				}
			});
			swapViewInfoContainerByOrder(targetOrder, upViewContainer.order);
		} else if (isCollideDown)
		{
			// set flg when animaiton start
			adjustAnimaCnt++;

			final ViewInfo downInfo = copyViewInfo(downViewContainer);
			final ViewInfo targetInfo = copyViewInfo(targetViewContainer);

			TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, -targetInfo.height - dragView_Padding);
			translateAnimation.setDuration((int) (targetInfo.height * 1.5 / scale));
			translateAnimation.setInterpolator(acInterpolator);
			final LinearLayout view = downInfo.view;
			MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
			lp.topMargin = downInfo.topMargin;
			view.setLayoutParams(lp);
			// final int startY = downViewContainer.topMargin;
			final int distanceY = targetInfo.topMargin;
			view.startAnimation(translateAnimation);
			final boolean isHelpScroll = false;
			translateAnimation.setAnimationListener(new AnimationListener()
			{
				@Override
				public void onAnimationStart(Animation animation)
				{
				}

				@Override
				public void onAnimationRepeat(Animation animation)
				{
				}

				@Override
				public void onAnimationEnd(Animation animation)
				{
					view.clearAnimation();
					TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0);
					view.startAnimation(anim);
					MarginLayoutParams lp = (MarginLayoutParams) view.getLayoutParams();
					lp.topMargin = distanceY;
					view.setLayoutParams(lp);
					view.requestLayout();

					adjustAnimaCnt--;
				}
			});
			swapViewInfoContainerByOrder(targetOrder, downViewContainer.order);
		}

	}

	private boolean checkIfCollideUp(final ViewInfo targetInfo, final ViewInfo upInfo)
	{
		if (targetInfo == null || upInfo == null)
			return false;
		int upLine = upInfo.topMargin + upInfo.height * 2 / 3;

		if (targetViewPosY < upLine && lastTagetPosY >= upLine)
			return true;

		if ((targetViewPosY + targetInfo.height / 3 < upInfo.topMargin + upInfo.height && lastTagetPosY + targetInfo.height / 3 >= upInfo.topMargin + upInfo.height))
			return true;

		if (targetViewPosY <= upInfo.topMargin + DIFF && lastTagetPosY > upInfo.topMargin + DIFF)
			return true;
		return false;
	}

	private boolean checkIfCollideDown(final ViewInfo targetInfo, final ViewInfo downInfo)
	{
		if (targetInfo == null || downInfo == null)
			return false;

		int downLine = downInfo.topMargin + downInfo.height / 3;

		if (targetViewPosY + targetInfo.height > downLine && lastTagetPosY + targetInfo.height <= downLine)
			return true;

		if (targetViewPosY + targetInfo.height * 2 / 3 > downInfo.topMargin && lastTagetPosY + targetInfo.height * 2 / 3 <= downInfo.topMargin)
			return true;

		if (targetViewPosY + targetInfo.height > downInfo.topMargin + downInfo.height - DIFF && lastTagetPosY + targetInfo.height <= downInfo.topMargin + downInfo.height - DIFF)
			return true;
		return false;
	}

	private int findHitItemOrder(MotionEvent event)
	{

		int len = containerList.size();
		for (int i = 0; i < len; i++)
		{
			ViewInfo container = containerList.get(i);
			RelativeLayout tv = (RelativeLayout) container.view.findViewById(R.id.drag_handle);
			tv.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
			if (container.topMargin <= (event.getY() + getScrollY() + DIFF / 10) && (container.topMargin + tv.getMeasuredHeight()) >= (event.getY() + getScrollY() - DIFF / 10))
			{
				targetOrder = i;
				detalY = (int) (event.getY() + getScrollY() - container.topMargin);
				lastTagetPosY = targetViewPosY;
				targetViewPosY = container.topMargin;
				getEventY = (int) event.getY() - detalY;
				return i;
			}
		}
		return -1;
	}

	private void swapViewInfoContainerByOrder(int targetFrom, int to)
	{
		BaseView tmp_View = containerList.get(targetFrom).view;
		containerList.get(targetFrom).view = containerList.get(to).view;
		containerList.get(to).view = tmp_View;

		String tmp_name = containerList.get(targetFrom).name;
		containerList.get(targetFrom).name = containerList.get(to).name;
		containerList.get(to).name = tmp_name;

		if (targetFrom < to)
		{
			containerList.get(to).topMargin = containerList.get(targetFrom).topMargin + containerList.get(to).height + dragView_Padding;

		} else
		{
			containerList.get(targetFrom).topMargin = containerList.get(to).topMargin + containerList.get(targetFrom).height + dragView_Padding;
		}

		int tmp_height = containerList.get(targetFrom).height;
		containerList.get(targetFrom).height = containerList.get(to).height;
		containerList.get(to).height = tmp_height;

		targetOrder = to;
		targetView = containerList.get(targetOrder).view;
		targetViewContainer = containerList.get(targetOrder);

		OrderSettingUtil.setIntPref(mContext, containerList.get(targetFrom).name, containerList.get(targetFrom).order);
		OrderSettingUtil.setIntPref(mContext, containerList.get(to).name, containerList.get(to).order);

	}

	/**
	 * magnetic Target view by its order when MotionEvent.ACTION_UP
	 *
	 * @see #targetOrder
	 */
	private void magneticTargetIem(int targetOrder)
	{
		// 动画开始的标记
		adjustAnimaCnt++;

		// 用final类型变量计算,因为动画结束时有延迟的
		final ViewInfo targetInfo = copyViewInfo(targetViewContainer);
		// AnimationSet animationSet = new AnimationSet(true);
		TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, -targetViewPosY + targetInfo.topMargin);
		translateAnimation.setDuration((int) (Math.abs(-targetViewPosY + targetInfo.topMargin) * 1.5 / scale));
		translateAnimation.setInterpolator(acInterpolator);
		// animationSet.addAnimation(translateAnimation);
		targetInfo.view.startAnimation(translateAnimation);
		translateAnimation.setAnimationListener(new AnimationListener()
		{

			@Override
			public void onAnimationStart(Animation animation)
			{
			}

			@Override
			public void onAnimationRepeat(Animation animation)
			{
			}

			@Override
			public void onAnimationEnd(Animation animation)
			{
				targetInfo.view.clearAnimation();// fix bug of view twinkle
				TranslateAnimation anim = new TranslateAnimation(0, 0, 0, 0);
				targetInfo.view.startAnimation(anim);
				MarginLayoutParams lp = (MarginLayoutParams) targetInfo.view.getLayoutParams();
				lp.topMargin = targetInfo.topMargin;
				lastTagetPosY = targetViewPosY;
				targetViewPosY = lp.topMargin;
				targetInfo.view.setLayoutParams(lp);
				targetInfo.view.requestLayout();

				// 动画结束的标记
				adjustAnimaCnt--;
			}
		});

	}

	/**
	 * 约束拖拽窗的位置,不要超过屏幕边界
	 *
	 * @param event
	 */
	private void constraintLayoutParams(MotionEvent event)
	{
		int py = targetViewContainer.height * 2 > screenH ? targetViewContainer.height - screenH / 2 : targetViewContainer.height / 2;
		MarginLayoutParams lp = (MarginLayoutParams) targetView.getLayoutParams();
		lp.topMargin = (int) event.getY() + mCurScrollY - detalY;
		targetViewPosY = (int) event.getY() + mCurScrollY - detalY;
		getEventY = (int) event.getY() - detalY;
		if (event.getY() - detalY <= 0)
		{
			lp.topMargin = mCurScrollY;
			targetViewPosY = mCurScrollY;
		} else if (event.getY() - detalY >= screenH - lp.height / 2 && targetViewContainer.height < screenH / 2)
		{
			lp.topMargin = screenH - lp.height / 2 + mCurScrollY;
			targetViewPosY = screenH - lp.height / 2 + mCurScrollY;
		} else if (targetViewContainer.height >= screenH / 2 && event.getY() - detalY >= screenH - 0.1 * screenH)
		{
			lp.topMargin = (int) (mCurScrollY + screenH * 0.9);
			targetViewPosY = (int) (mCurScrollY + screenH * 0.9);
		}

		if (lp.topMargin <= dragRangeUpLine)
		{
			lp.topMargin = dragRangeUpLine;
			targetViewPosY = dragRangeUpLine;
		} else if (lp.topMargin >= (dragRangeBottomLine - py))
		{
			lp.topMargin = dragRangeBottomLine - py;
			targetViewPosY = dragRangeBottomLine - py;
		}
		targetView.setLayoutParams(lp);
	}

	private Handler mLongPressHandler = new Handler();
	private Runnable mLongPressRunnable = new Runnable()
	{

		@Override
		public void run()
		{
			myMode = DRAGING;
			((BaseView) targetView).changeModeToDRAGING();
			vibrate();
		}
	};

	private void vibrate()
	{
		try
		{
			Vibrator vib = (Vibrator) mContext.getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE);
			vib.vibrate(100);
		} catch (Exception e)
		{
			// TODO: handle exception
		}

	}

	private boolean checkIsAllowUpScroll()
	{
		if (targetOrder != containerList.size() - 1)
			return true;

		if (mAutoScrolDirection != STOP_SCROLL)
			return true;

		if (targetOrder > 0 && targetViewPosY < containerList.get(targetOrder - 1).topMargin + containerList.get(targetOrder - 1).height * 2 / 3)
			return true;

		return false;
	}

	private boolean checkIsAllowDownScroll()
	{
		if (targetOrder != 0)
			return true;

		if (mAutoScrolDirection != STOP_SCROLL)
			return true;

		return false;
	}

	public void refreshAndSortDragView()
	{
		for (int i = 0; i < containerList.size(); i++)
		{
			ViewInfo viewInfo = containerList.get(i);
			viewInfo.order = OrderSettingUtil.getIntPref(mContext, viewInfo.name, 0);
		}
		sortWightView();
		for (int i = 0; i < containerList.size(); i++)
		{
			ViewInfo viewInfo = containerList.get(i);
			viewInfo.view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
			viewInfo.view.requestLayout();
			// viewInfo.view.invalidate();
		}
		// mWeatherView.requestLayout();
		// mWeatherView.invalidate();

	}

	private void adjustScroll(MotionEvent event)
	{

		// check if allow scroll
		boolean isAllowUpScroll = checkIsAllowUpScroll();
		boolean isAllowDownScroll = checkIsAllowDownScroll();

		// skip! skip ! skip this block, abnormal logic
		if (targetViewContainer.height > screenH / 2)
		{
			if (event.getY() - detalY < (screenH) * 0.1)
			{
				if (mAutoScrolDirection != DOWN_SCROLL)
				{
					mHanler.post(mScrollRunable);
				}
				setSrollDirction(DOWN_SCROLL);
			} else if (event.getY() - detalY > screenH * 0.8 && isAllowUpScroll)
			{
				if (mAutoScrolDirection != UP_SCROLL)
				{
					mHanler.post(mScrollRunable);
				}
				setSrollDirction(UP_SCROLL);
			} else
			{
				setSrollDirction(STOP_SCROLL);
				mHanler.removeCallbacks(mScrollRunable);
			}
			return;
		}

		// normal logic
		if (event.getY() - detalY < (screenH) * 0.1 && isAllowDownScroll)
		{
			if (mAutoScrolDirection != DOWN_SCROLL)
			{
				mHanler.post(mScrollRunable);
			}
			setSrollDirction(DOWN_SCROLL);
		} else if (event.getY() - detalY > screenH - targetViewContainer.height * 0.8 && getScrollY() < sumDragViewHeight - screenH && isAllowUpScroll)
		{
			if (mAutoScrolDirection != UP_SCROLL)
			{
				mHanler.post(mScrollRunable);
			}
			setSrollDirction(UP_SCROLL);
		} else
		{
			setSrollDirction(STOP_SCROLL);
			mHanler.removeCallbacks(mScrollRunable);
		}

	}

	public void setSrollDirction(int dir)
	{
		mAutoScrolDirection = dir;
	}

	private Runnable mScrollRunable = new Runnable()
	{
		@Override
		public void run()
		{
			if (targetView == null)
			{
				setSrollDirction(STOP_SCROLL);
				mHanler.removeCallbacks(mScrollRunable);
				return;
			}
			MarginLayoutParams lp = (MarginLayoutParams) targetView.getLayoutParams();
			switch (mAutoScrolDirection)
			{
			case UP_SCROLL:
				if (getScrollY() >= sumDragViewHeight - screenH && targetViewContainer.height < screenH / 2)
				{
					scrollTo(0, sumDragViewHeight - screenH);
					setSrollDirction(STOP_SCROLL);
					mHanler.removeCallbacks(mScrollRunable);
					return;
				}
				// if targetview's height is higher than half of screen then
				// enters first block , Otherwise enters second block
				int py = targetViewContainer.height * 2 > screenH ? targetViewContainer.height - screenH / 2 : lp.height / 2;
				if (lp.topMargin >= dragRangeBottomLine - py)
				{
					// skip this bock abnomal logic
					lp.topMargin = dragRangeBottomLine - py;
					lastTagetPosY = targetViewPosY;
					targetViewPosY = dragRangeBottomLine - py;
					targetView.setLayoutParams(lp);
					setSrollDirction(STOP_SCROLL);
				} else
				{
					// abnomal logic
					scrollBy(0, mAutoScrollInterval);
					lp.topMargin += mAutoScrollInterval;
					lastTagetPosY = targetViewPosY;
					targetViewPosY = lp.topMargin;
					targetView.setLayoutParams(lp);
					targetView.requestLayout();
					adjustAllItems();
				}
				break;
			case STOP_SCROLL:
				mHanler.removeCallbacks(mScrollRunable);
				break;
			case DOWN_SCROLL:
				if (lp.topMargin <= dragRangeUpLine)
				{
					lp.topMargin = dragRangeUpLine;
					lastTagetPosY = targetViewPosY;
					targetViewPosY = lp.topMargin;
					targetView.setLayoutParams(lp);
					setSrollDirction(STOP_SCROLL);
				} else
				{
					mScroller.startScroll(0, getScrollY(), 0, -mAutoScrollInterval, mAutoScrollInterval_time);
					scrollBy(0, -mAutoScrollInterval);
					lp.topMargin -= mAutoScrollInterval;
					lastTagetPosY = targetViewPosY;
					targetViewPosY = lp.topMargin;
					targetView.setLayoutParams(lp);
					targetView.requestLayout();
					adjustAllItems();
				}
				break;
			}
			mHanler.post(mScrollRunable);
		}
	};

	/**
	 * sort item views by their order {@link #ViewOrderComparator}
	 * */
	private void sortWightView()
	{

		Comparator<ViewInfo> comparator = new ViewOrderComparator();
		Collections.sort(containerList, comparator);
		for (int i = 0; i < containerList.size(); i++)
		{
			containerList.get(i).order = i;
			// reset not_measure flg
			containerList.get(i).topMargin = NOT_MEASURE;
			// bringChildToFront(containerList.get(i).view);
			OrderSettingUtil.setIntPref(mContext, containerList.get(i).name, containerList.get(i).order);
		}

	}

	private ViewInfo copyViewInfo(ViewInfo src)
	{
		if (src == null)
			return null;
		ViewInfo des = new ViewInfo();
		des.name = src.name;
		des.order = src.order;
		des.view = src.view;
		des.height = src.height;
		des.topMargin = src.topMargin;
		return des;
	}

	/**
	 * check drag animation is finished
	 *
	 * @see #adjustAnimaCnt
	 */
	private boolean isDragAnimationFinished()
	{
		if (myMode == IDLE && adjustAnimaCnt == 0)
		{
			return true;
		}

		return false;
	}

	/**
	 * clear up memory
	 * */
	public void release()
	{
		for (ViewInfo vi : containerList)
		{
			vi.view = null;
		}
		containerList.clear();
	}

	/**
	 * Static Inner Class
	 * */

	/**
	 * an comparator for sortting the index of dragview
	 * */
	private static class ViewOrderComparator implements Comparator<ViewInfo>
	{
		@Override
		public int compare(ViewInfo leftObj, ViewInfo rightObj)
		{
			int leftValue = leftObj.order;
			int rightValue = rightObj.order;

			if (leftValue < rightValue)
			{
				return -1;
			} else if (leftValue > rightValue)
			{
				return 1;
			} else
			{
				return 0;
			}
		}
	}

	/**
	 * A SharedPref Uitl Class for record index
	 * */
	public static class OrderSettingUtil
	{
		public static final String VIEW_ORDER_SETTING = "drag_view_order";

		public static int getIntPref(Context context, String name, int def)
		{
			SharedPreferences prefs = context.getSharedPreferences(VIEW_ORDER_SETTING, Context.MODE_PRIVATE);
			return prefs.getInt(name, def);
		}

		public static void setIntPref(Context context, String name, int value)
		{
			SharedPreferences.Editor editPrefs = context.getSharedPreferences(VIEW_ORDER_SETTING, Context.MODE_PRIVATE).edit();
			editPrefs.putInt(name, value);
			editPrefs.commit();
		}
	}

	/**
	 * Package Class
	 * */
	public static class ViewInfo
	{
		String name;
		int order;
		BaseView view;
		int height;
		int topMargin;
	}
}


text:
package pl.domzal.junit.docker.rule.examples;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;

import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.RuleChain;

import pl.domzal.junit.docker.rule.DockerRule;

/**
 * Dynamic container linking. "web" links to "db" without specifying db name and pings it.
 */
@Category(test.category.Stable.class)
public class ExampleLinkDynamicTest {

    private static DockerRule dbRule = DockerRule.builder()
            .imageName("alpine:3.4")
            .cmd("sh", "-c", "sleep 30")
            .build();

    private static DockerRule web = DockerRule.builder()
            .imageName("alpine:3.4")
            // dynamic link takes DockerRule instance link points to and link alias
            // (no need to define container name like in static linking)
            .link(dbRule, "db")
            .cmd("sh", "-c", "ping -w 1 db")
            .build();

    /**
     * Recommended method to make sure linked container are initialized in required order.
     */
    @ClassRule
    public static RuleChain containers = RuleChain.outerRule(dbRule).around(web);

    @Test
    public void shouldPingViaLink() throws Throwable {
        web.waitForExit();
        String output = web.getLog();
        assertThat(output, containsString("1 packets received"));
    }

}


text:
extern void foo (void);
extern void bar (void);

void
bar (void)
{
  foo ();
}


text:
package com.github.benmanes.caffeine.cache.node;

import static com.github.benmanes.caffeine.cache.Specifications.vRefQueueType;
import static com.github.benmanes.caffeine.cache.Specifications.vTypeVar;

import java.lang.ref.Reference;
import java.util.Objects;

import javax.lang.model.element.Modifier;

import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.MethodSpec;

/**
 * Adds the value to the node.
 *
 * @author ben.manes@gmail.com (Ben Manes)
 */
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public final class AddValue extends NodeRule {

  @Override
  protected boolean applies() {
    return isBaseClass();
  }

  @Override
  protected void execute() {
    context.nodeSubtype
        .addField(newValueField())
        .addMethod(makeGetValue())
        .addMethod(newGetRef("value"))
        .addMethod(makeSetValue())
        .addMethod(makeContainsValue());
    if (isStrongValues()) {
      addVarHandle("value", ClassName.get(Object.class));
    } else {
      addVarHandle("value", valueReferenceType().rawType);
      context.suppressedWarnings.add("NullAway");
    }
  }

  private FieldSpec newValueField() {
    var fieldSpec = isStrongValues()
        ? FieldSpec.builder(vTypeVar, "value", Modifier.VOLATILE)
        : FieldSpec.builder(valueReferenceType(), "value", Modifier.VOLATILE);
    return fieldSpec.build();
  }

  /** Creates the getValue method. */
  private MethodSpec makeGetValue() {
    var getter = MethodSpec.methodBuilder("getValue")
        .addModifiers(context.publicFinalModifiers())
        .returns(vTypeVar);
    String handle = varHandleName("value");
    if (valueStrength() == Strength.STRONG) {
      getter.addStatement("return ($T) $L.get(this)", vTypeVar, handle);
      return getter.build();
    }

    var code = CodeBlock.builder()
        .beginControlFlow("for (;;)")
            .addStatement("$1T<V> ref = ($1T<V>) $2L.getOpaque(this)", Reference.class, handle)
            .addStatement("V referent = ref.get()")
            .beginControlFlow("if ((referent != null) || (ref == $L.getAcquire(this)))", handle)
                .addStatement("return referent")
            .endControlFlow()
        .endControlFlow()
        .build();
    return getter.addCode(code).build();
  }

  /** Creates the setValue method. */
  private MethodSpec makeSetValue() {
    var setter = MethodSpec.methodBuilder("setValue")
        .addModifiers(context.publicFinalModifiers())
        .addParameter(vTypeVar, "value")
        .addParameter(vRefQueueType, "referenceQueue");

    if (isStrongValues()) {
      setter.addStatement("$L.setRelease(this, $N)", varHandleName("value"), "value");
    } else {
      setter.addStatement("$1T<V> ref = ($1T<V>) $2L.get(this)",
          Reference.class, varHandleName("value"));
      setter.addStatement("$L.setRelease(this, new $T($L, $N, referenceQueue))",
          varHandleName("value"), valueReferenceType(), "getKeyReference()", "value");
      setter.addStatement("ref.clear()");
    }

    return setter.build();
  }

  private MethodSpec makeContainsValue() {
    var containsValue = MethodSpec.methodBuilder("containsValue")
        .addModifiers(context.publicFinalModifiers())
        .addParameter(Object.class, "value")
        .returns(boolean.class);
    if (isStrongValues()) {
      containsValue.addStatement("return $T.equals(value, getValue())", Objects.class);
    } else {
      containsValue.addStatement("return getValue() == value");
    }
    return containsValue.build();
  }
}


text:
<?php

namespace app\models\forsearch;

use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use app\models\AdminUser;

/**
 * AdminUserSearch represents the model behind the search form about `app\models\AdminUser`.
 */
class AdminUserSearch extends AdminUser
{

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id'], 'integer'],
            [['username',  'userphoto','email'], 'safe'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function scenarios()
    {
        // bypass scenarios() implementation in the parent class
        return Model::scenarios();
    }

    /**
     * Creates data provider instance with search query applied
     * @param array $params
     * @return ActiveDataProvider
     */
    public function search($params)
    {
        $query = AdminUser::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
        ]);

        $query->andFilterWhere(['like', 'username', $this->username])
           // ->andFilterWhere(['like', 'password', $this->password])
            ->andFilterWhere(['like', 'eamil', $this->email])
            ->andFilterWhere(['like', 'userphoto', $this->userphoto]);

        return $dataProvider;
    }
}


text:
SettingsStore::SettingsStore(const QString &fileName) {
    // Set platform
#ifdef Q_OS_LINUX
    platform = "linux/";
#elif defined(Q_OS_WIN)
    platform = "windows/";
#elif defined(Q_OS_MAC)
    platform = "mac/";
#endif

    // Read settings file
    settings = new QSettings(QSettings::IniFormat,
                             QSettings::UserScope,
                             "visualino",
                             "visualino");

    // If IDE path is empty, copy original settings
    if (settings->value(platform + "arduino_ide_path", "").toString() == "") {
        copyDefaultSettings(fileName);
    }
}

SettingsStore::~SettingsStore() {
    delete settings;
}

QString SettingsStore::arduinoBoard() {
    return settings->value(platform + "arduino_board",
                           "arduino:avr:uno").toString();
}

QString SettingsStore::arduinoIdePath() {
    return relativePath("arduino_ide_path", "/usr/bin/arduino");
}

QString SettingsStore::defaultLanguage() {
    return settings->value(platform + "language", "en-GB").toString();
}

QString SettingsStore::examplesPath() {
    return settings->value(platform + "examples_path",
                           "/usr/share/visualino/examples/").toString();
}

QString SettingsStore::tmpDirName() {
    return relativePath("tmp_dir_name", "/tmp/visualino/");
}

QString SettingsStore::tmpFileName() {
    return relativePath("tmp_file_name", "/tmp/visualino/visualino.ino");
}

QString SettingsStore::htmlIndex() {
    return relativePath("html_index", "/usr/share/visualino/html/index.html");
}

bool SettingsStore::iconLabels() {
    return settings->value(platform + "icon_labels", true).toBool();
}

void SettingsStore::copyDefaultSettings(const QString &fileName,
                                        bool overwrite) {
    // Locate config.ini in standard locations
    QString settingsFile = QStandardPaths::locate(
                QStandardPaths::DataLocation,
                fileName,
                QStandardPaths::LocateFile);

    // If couldn't locate config.ini in DataLocation dirs,
    // search in the binary path.
    if (settingsFile.isEmpty()) {
        settingsFile = QDir(QCoreApplication::applicationDirPath())
                .filePath(fileName);
    }

    // Set final settings path
    QString localSettingsFile = settings->fileName();
    QString localSettingsDir = QFileInfo(localSettingsFile).absolutePath();

    // Free settings file
    delete settings;

    // Create directory if it doesn't exist
    QDir dir(localSettingsDir);
    if (!dir.exists()) {
        dir.mkpath(localSettingsDir);
    }

    // Copy settings
    if (overwrite == true) {
        // Remove if already exists
        QFile localSettings(localSettingsFile);
        if (localSettings.exists() == true) {
            localSettings.remove();
        }
    }
    QFile::copy(settingsFile, localSettingsFile);

    // Reload settings
    settings = new QSettings(QSettings::IniFormat,
                             QSettings::UserScope,
                             "visualino",
                             "visualino");
}

void SettingsStore::setArduinoBoard(const QString &value) {
    settings->setValue(platform + "arduino_board", value);
}

void SettingsStore::setArduinoIdePath(const QString &value) {
    settings->setValue(platform + "arduino_ide_path", value);
}

void SettingsStore::setTmpDirName(const QString &value) {
    settings->setValue(platform + "tmp_dir_name", value);
}

void SettingsStore::setTmpFileName(const QString &value) {
    settings->setValue(platform + "tmp_file_name", value);
}

void SettingsStore::setHtmlIndex(const QString &value) {
    settings->setValue(platform + "html_index", value);
}

void SettingsStore::setIconLabels(bool icon_labels) {
    settings->setValue(platform + "icon_labels", icon_labels);
}

void SettingsStore::setDefaultLanguage(const QString &value) {
    settings->setValue(platform + "language", value);
}

void SettingsStore::setExamplesPath(const QString &value) {
    settings->setValue(platform + "examples_path", value);
}

QString SettingsStore::relativePath(const QString &value,
                                    const QString &defaultValue) {

    QString settingsValue = settings->value(platform + value,
                                             defaultValue).toString();

    if (settingsValue.left(2) == "~/") {
        // Substitute with home dir
        return QDir::homePath() + settingsValue.remove(0,1);
    } else if (QDir::isRelativePath(settingsValue)) {
        // Append the binary path if relative
        return QDir(QCoreApplication::applicationDirPath()).
                filePath(settingsValue);
    }

    return settingsValue;
}


text:
package io.relayr.java.model.models.schema;

public class StringSchema extends ValueSchema {

    public StringSchema(ValueSchema schema) {
        super(schema);

        maxLength = schema.maxLength;
        minLength = schema.minLength;
        pattern = schema.pattern;
    }

    /** If defined this integer MUST be greater than, or equal to, 0. */
    public Integer getMaxLength() {
        return maxLength;
    }

    /** If defined this integer MUST be greater than, or equal to, 0. */
    public Integer getMinLength() {
        return minLength;
    }

    /** @return valid regular expression, according to the ECMA 262 regular expression dialect. */
    public String getPattern() {
        return pattern;
    }

    /** @return true if there are any possible values for the field. */
    public boolean hasValues() {
        return enums != null && !enums.isEmpty();
    }

    @Override public boolean validate(Object value) {
        if (value == null && hasValues() && !getEnums().contains(null)) return false;
        if (!validateNull(value)) return false;
        if (value instanceof String) {
            String stringValue = (String) value;

            if (minLength != null)
                if (stringValue.length() < minLength) return false;
            if (maxLength != null)
                if (stringValue.length() > maxLength) return false;

            if (pattern != null)
                if (!stringValue.matches(pattern)) return false;

            if (hasValues()) {
                boolean found = false;
                for (Object item : getEnums())
                    if (item instanceof String)
                        if (stringValue.equals(item)) {
                            found = true;
                            break;
                        }
                if (!found) return false;
            }

            return true;
        } else {
            if (hasValues()) return getEnums().contains(null);
            else return true;
        }
    }
}


text:
// ReSharper disable All

namespace OpenTl.Schema
{
	using System;
	using System.Collections;
	using System.Text;

	using OpenTl.Schema;
	using OpenTl.Schema.Serialization.Attributes;

	[Serialize(0x9880f658)]
	public sealed class TInputCheckPasswordEmpty : IInputCheckPasswordSRP, IEmpty
	{

	}
}


text:
nut.config = nut.config or {}
nut.config.stored = nut.config.stored or {}

function nut.config.add(key, value, desc, callback, data, noNetworking, schemaOnly)
	local oldConfig = nut.config.stored[key]

	nut.config.stored[key] = {data = data, value = oldConfig and oldConfig.value or value, default = value, desc = desc, noNetworking = noNetworking, global = !schemaOnly, callback = callback}
end

function nut.config.setDefault(key, value)
	local config = nut.config.stored[key]

	if (config) then
		config.default = value
	end
end

function nut.config.set(key, value)
	local config = nut.config.stored[key]

	if (config) then
		local oldValue = value
		config.value = value

		if (SERVER) then
			if (!config.noNetworking) then
				netstream.Start(nil, "cfgSet", key, value)
			end

			if (config.callback) then
				config.callback(oldValue, value)
			end

			nut.config.save()
		end
	end
end

function nut.config.get(key, default)
	local config = nut.config.stored[key]

	if (config) then
		if (config.value != nil) then
			return config.value
		elseif (config.default != nil) then
			return config.default
		end
	end

	return default
end

function nut.config.load()
	if (SERVER) then
		local globals = nut.data.get("config", nil, true, true)
		local data = nut.data.get("config", nil, false, true)

		if (globals) then
			for k, v in pairs(globals) do
				nut.config.stored[k] = nut.config.stored[k] or {}
				nut.config.stored[k].value = v
			end
		end

		if (data) then
			for k, v in pairs(data) do
				nut.config.stored[k] = nut.config.stored[k] or {}
				nut.config.stored[k].value = v
			end
		end
	end

	nut.util.include("nutscript/gamemode/config/sh_config.lua")
	hook.Run("InitializedConfig")
end

if (SERVER) then
	function nut.config.getChangedValues()
		local data = {}

		for k, v in pairs(nut.config.stored) do
			if (v.default != v.value) then
				data[k] = v.value
			end
		end

		return data
	end

	function nut.config.send(client)
		netstream.Start(client, "cfgList", nut.config.getChangedValues())
	end

	function nut.config.save()
		local globals = {}
		local data = {}

		for k, v in pairs(nut.config.getChangedValues()) do
			if (nut.config.stored[k].global) then
				globals[k] = v
			else
				data[k] = v
			end
		end

		-- Global and schema data set respectively.
		nut.data.set("config", globals, true, true)
		nut.data.set("config", data, false, true)
	end

	netstream.Hook("cfgSet", function(client, key, value)
		if (client:IsSuperAdmin() and type(nut.config.stored[key].default) == type(value)) then
			nut.config.set(key, value)

			if (type(value) == "table") then
				local value2 = "["
				local count = table.Count(value)
				local i = 1

				for k, v in SortedPairs(value) do
					value2 = value2..v..(i == count and "]" or ", ")
					i = i + 1
				end

				value = value2
			end

			nut.util.notifyLocalized("cfgSet", nil, client:Name(), key, tostring(value), v)
		end
	end)
else
	netstream.Hook("cfgList", function(data)
		for k, v in pairs(data) do
			if (nut.config.stored[k]) then
				nut.config.stored[k].value = v
			end
		end

		hook.Run("InitializedConfig", data)
	end)

	netstream.Hook("cfgSet", function(key, value)
		local config = nut.config.stored[key]

		if (config) then
			if (config.callback) then
				config.callback(config.value, value)
			end

			config.value = value

			local properties = nut.gui.properties

			if (IsValid(properties)) then
				local row = properties:GetCategory(L(config.data and config.data.category or "misc")):GetRow(key)

				if (IsValid(row)) then
					if (type(value) == "table" and value.r and value.g and value.b) then
						value = Vector(value.r / 255, value.g / 255, value.b / 255)
					end

					row:SetValue(value)
				end
			end
		end
	end)
end

if (CLIENT) then
	hook.Add("CreateMenuButtons", "nutConfig", function(tabs)
		if (LocalPlayer():IsSuperAdmin()) then
			tabs["config"] = function(panel)
				local scroll = panel:Add("DScrollPanel")
				scroll:Dock(FILL)

				local properties = scroll:Add("DProperties")
				properties:SetSize(panel:GetSize())

				nut.gui.properties = properties

				-- We're about to store the categories in this buffer.
				local buffer = {}

				for k, v in pairs(nut.config.stored) do
					-- Get the category name.
					local index = v.data and v.data.category or "misc"

					-- Insert the config into the category list.
					buffer[index] = buffer[index] or {}
					buffer[index][k] = v
				end

				-- Loop through the categories in alphabetical order.
				for category, configs in SortedPairs(buffer) do
					category = L(category)

					-- Ditto, except we're looping through configs.
					for k, v in SortedPairs(configs) do
						-- Determine which type of panel to create.
						local form = v.data and v.data.form
						local value = nut.config.stored[k].default

						if (!form) then
							local formType = type(value)

							if (formType == "number") then
								form = "Int"
								value = tonumber(nut.config.get(k)) or value
							elseif (formType == "boolean") then
								form = "Boolean"
								value = util.tobool(nut.config.get(k))
							else
								form = "Generic"
							end
						end

						-- VectorColor currently only exists for DProperties.
						if (form == "Generic" and type(value) == "table" and value.r and value.g and value.b) then
							-- Convert the color to a vector.
							value = Vector(value.r / 255, value.g / 255, value.b / 255)
							form = "VectorColor"
						end

						local delay = 1

						if (form == "Boolean") then
							delay = 0
						end

						-- Add a new row for the config to the properties.
						local row = properties:CreateRow(category, k)
						row:Setup(form, v.data and v.data.data or {})
						row:SetValue(value)
						row:SetToolTip(v.desc)
						row.DataChanged = function(this, value)
							timer.Create("nutCfgSend"..k, delay, 1, function()
								if (IsValid(row)) then
									if (form == "VectorColor") then
										local vector = Vector(value)

										value = Color(math.floor(vector.x * 255), math.floor(vector.y * 255), math.floor(vector.z * 255))
									elseif (form == "Int" or form == "Float") then
										value = tonumber(value)

										if (form == "Int") then
											value = math.Round(value)
										end
									elseif (form == "Boolean") then
										value = util.tobool(value)
									end

									netstream.Start("cfgSet", k, value)
								end
							end)
						end
					end
				end
			end
		end
	end)
end


text:
<title>HC SVNT Draconis Character Sheet</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">

<form id="generalForm">

Character Name: <input type="text" id="charid" class="form-control"></input>
Age: <input type="text" id="age" class="form-control"></input>
Height: <input type="text" id="height" class="form-control"></input>
Eyes: <input type="text" id="eyes" class="form-control"></input>
Family: <select class="form-control" onChange="onSelectFamily()" id="familySelect">
	<option value="0">Canidae</option>
	<option value="1">Felidae</option>
	<option value="2">Reptilia</option>
	<option value="3">Mustelidae</option>
	<option value="4">Avialae</option>
</select>
Species:<select class="form-control" id="speciesSelect">
	<option value="0">Dog</option>
	<option value="1">Fox</option>
	<option value="2">Wolf</option>
	<option value="3">Coyote</option>
	<option value="4">Jackal</option>
</select>
Morphism:<select class="form-control" id="morphismSelect">
	<option value="0">Plantigrade</option>
	<option value="1">Digitigrade</option>
	<option value="2">Atypical Patterning</option>
	<option value="3">Hemi</option>
	<option value="4">How did that get there!?</option>
	<option value="5">Hybrid</option>
	<option value="6">Lateralism</option>
	<option value="7">Microism</option>
	<option value="8">Taurism</option>
	<option value="9">Twin-Tailed</option>
</select>
</form>


text:
<?php

namespace Choi\Doctrine;

use Exception;

class InvalidMapperException extends Exception
{
    //
}


text:
import unittest

import numpy

from chainer import cuda
from chainer import functions
from chainer import testing
from chainer.testing import attr

if cuda.available:
    cuda.init()

class TestParameter(unittest.TestCase):

    def setUp(self):
        self.W = numpy.random.uniform(-1, 1, (4, 3)).astype(numpy.float32)
        self.gW = numpy.random.uniform(-1, 1,
                                       self.W.shape).astype(numpy.float32)
        self.func = functions.Parameter(self.W)

    def tearDown(self):
        del self.func

    def to_gpu(self):
        self.func.to_gpu()

    def check_forward(self):
        y = self.func()
        self.assertEqual(y.data.dtype, numpy.float32)
        self.assertTrue((self.W == cuda.to_cpu(y.data)).all())

    def test_forward_cpu(self):
        self.check_forward()

    @attr.gpu
    def test_forward_gpu(self):
        self.to_gpu()
        self.check_forward()

    def check_backward(self, y_grad):
        self.func.gW.fill(0)
        y = self.func()
        y.grad = y_grad
        y.backward()
        self.assertTrue(
            (cuda.to_cpu(y_grad) == cuda.to_cpu(self.func.gW)).all())

    def test_backward_cpu(self):
        self.check_backward(self.gW)

    @attr.gpu
    def test_backward_gpu(self):
        self.to_gpu()
        self.check_backward(cuda.to_gpu(self.gW))

testing.run_module(__name__, __file__)


text:
package cn.wizzer.common.processor;

import cn.wizzer.common.shiro.view.Permission;
import cn.wizzer.common.util.DateUtil;
import cn.wizzer.common.util.StringUtil;
import org.nutz.lang.Strings;
import org.nutz.mvc.ActionContext;
import org.nutz.mvc.Mvcs;
import org.nutz.mvc.impl.processor.AbstractProcessor;

import cn.wizzer.common.base.Globals;

/**
 * Created by wizzer on 2016/6/22.
 */
public class GlobalsSettingProcessor extends AbstractProcessor {

	@SuppressWarnings("rawtypes")
	public void process(ActionContext ac) throws Throwable {
		ac.getRequest().setAttribute("AppRoot", Globals.AppRoot);
		ac.getRequest().setAttribute("AppBase", Globals.AppBase);
		ac.getRequest().setAttribute("AppName", Globals.AppName);
		ac.getRequest().setAttribute("AppDomain", Globals.AppDomain);
		ac.getRequest().setAttribute("AppShrotName", Globals.AppShrotName);
		ac.getRequest().setAttribute("financialMng", Globals.MyConfig.get("financialMng"));
		ac.getRequest().setAttribute("shiro", Mvcs.ctx().getDefaultIoc().get(Permission.class));
		ac.getRequest().setAttribute("date", Mvcs.ctx().getDefaultIoc().get(DateUtil.class));
		ac.getRequest().setAttribute("string", Mvcs.ctx().getDefaultIoc().get(StringUtil.class));
		// 如果url中有语言属性则设置
		String lang=ac.getRequest().getParameter("lang");
		if (!Strings.isEmpty(lang)) {
			Mvcs.setLocalizationKey(lang);
		}else{
			// Mvcs.getLocalizationKey()  1.r.56 版本是null,所以要做两次判断, 1.r.57已修复为默认值 Nutz:Fix issue 1072
			lang=Strings.isBlank(Mvcs.getLocalizationKey())?Mvcs.getDefaultLocalizationKey():Mvcs.getLocalizationKey();
		}
		ac.getRequest().setAttribute("lang", lang);
		doNext(ac);
	}

}