text:
<scpd>
	<serviceStateTable>
		<stateVariable>
			<name>SearchCapabilities</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>SortCapabilities</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>SortExtensionCapabilities</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>SystemUpdateID</name>
			<sendEventsAttribute>yes</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>ContainerUpdateIDs</name>
			<sendEventsAttribute>yes</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>ServiceResetToken</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>LastChange</name>
			<sendEventsAttribute>yes</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>TransferIDs</name>
			<sendEventsAttribute>yes</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>FeatureList</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>PermissionsInfo</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>DeviceMode</name>
			<sendEventsAttribute>yes</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>DeviceModeStatus</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_ObjectID</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_Result</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_SearchCriteria</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_BrowseFlag</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
			<allowedValueList>
				<allowedValue>BrowseMetadata</allowedValue>
				<allowedValue>BrowseDirectChildren</allowedValue>
			</allowedValueList>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_Filter</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_SortCriteria</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_Index</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_Count</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<name>A_ARG_TYPE_UpdateID</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_TransferID</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_TransferStatus</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
			<allowedValueList>
				<allowedValue>COMPLETED</allowedValue>
				<allowedValue>ERROR</allowedValue>
				<allowedValue>IN_PROGRESS</allowedValue>
				<allowedValue>STOPPED</allowedValue>
			</allowedValueList>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_TransferLength</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_TransferTotal</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_TagValueList</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_URI</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>uri</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_CDSView</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>ui4</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_QueryRequest</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_QueryResult</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_FFQCapabilities</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_DeviceModeRequest</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_CPID</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>

		<stateVariable>
			<Optional/>
			<name>A_ARG_TYPE_DeviceModeID</name>
			<sendEventsAttribute>no</sendEventsAttribute>
			<dataType>string</dataType>
		</stateVariable>
	</serviceStateTable>

	<actionList>
		<action>
			<name>GetSearchCapabilities</name>
			<argumentList>
				<argument>
					<name>SearchCaps</name>
					<direction>out</direction>
					<relatedStateVariable>SearchCapabilities</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<name>GetSortCapabilities</name>
			<argumentList>
				<argument>
					<name>SortCaps</name>
					<direction>out</direction>
					<relatedStateVariable>SortCapabilities</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetSortExtensionCapabilities</name>
			<argumentList>
				<argument>
					<name>SortExtensionCaps</name>
					<direction>out</direction>
					<relatedStateVariable>SortExtensionCapabilities</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<name>GetFeatureList</name>
			<argumentList>
				<argument>
					<name>FeatureList</name>
					<direction>out</direction>
					<relatedStateVariable>FeatureList</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<name>GetSystemUpdateID</name>
			<argumentList>
				<argument>
					<name>Id</name>
					<direction>out</direction>
					<relatedStateVariable>SystemUpdateID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<name>GetServiceResetToken</name>
			<argumentList>
				<argument>
					<name>ResetToken</name>
					<direction>out</direction>
					<relatedStateVariable>ServiceResetToken</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<name>Browse</name>
			<argumentList>
				<argument>
					<name>ObjectID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>BrowseFlag</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_BrowseFlag</relatedStateVariable>
				</argument>
				<argument>
					<name>Filter</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>
				</argument>
				<argument>
					<name>StartingIndex</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>
				</argument>
				<argument>
					<name>RequestedCount</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>SortCriteria</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>
				</argument>
				<argument>
					<name>Result</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
				</argument>
				<argument>
					<name>NumberReturned</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>TotalMatches</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>UpdateID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>Search</name>
			<argumentList>
				<argument>
					<name>ContainerID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>SearchCriteria</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_SearchCriteria</relatedStateVariable>
				</argument>
				<argument>
					<name>Filter</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Filter</relatedStateVariable>
				</argument>
				<argument>
					<name>StartingIndex</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Index</relatedStateVariable>
				</argument>
				<argument>
					<name>RequestedCount</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>SortCriteria</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_SortCriteria</relatedStateVariable>
				</argument>
				<argument>
					<name>Result</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
				</argument>
				<argument>
					<name>NumberReturned</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>TotalMatches</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Count</relatedStateVariable>
				</argument>
				<argument>
					<name>UpdateID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>CreateObject</name>
			<argumentList>
				<argument>
					<name>ContainerID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>Elements</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
				</argument>
				<argument>
					<name>ObjectID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>Result</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_Result</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>DestroyObject</name>
			<argumentList>
				<argument>
					<name>ObjectID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>UpdateObject</name>
			<argumentList>
				<argument>
					<name>ObjectID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>CurrentTagValue</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_TagValueList</relatedStateVariable>
				</argument>
				<argument>
					<name>NewTagValue</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_TagValueList</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>MoveObject</name>
			<argumentList>
				<argument>
					<name>ObjectID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>NewParentID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>NewObjectID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>ImportResource</name>
			<argumentList>
				<argument>
					<name>SourceURI</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
				</argument>
				<argument>
					<name>DestinationURI</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
				</argument>
				<argument>
					<name>TransferID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>ExportResource</name>
			<argumentList>
				<argument>
					<name>SourceURI</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
				</argument>
				<argument>
					<name>DestinationURI</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
				</argument>
				<argument>
					<name>TransferID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>DeleteResource</name>
			<argumentList>
				<argument>
					<name>ResourceURI</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_URI</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>StopTransferResource</name>
			<argumentList>
				<argument>
					<name>TransferID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetTransferProgress</name>
			<argumentList>
				<argument>
					<name>TransferID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferID</relatedStateVariable>
				</argument>
				<argument>
					<name>TransferStatus</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferStatus</relatedStateVariable>
				</argument>
				<argument>
					<name>TransferLength</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferLength</relatedStateVariable>
				</argument>
				<argument>
					<name>TransferTotal</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_TransferTotal</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>CreateReference</name>
			<argumentList>
				<argument>
					<name>ContainerID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>ObjectID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>NewID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>FreeFormQuery</name>
			<argumentList>
				<argument>
					<name>ContainerID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_ObjectID</relatedStateVariable>
				</argument>
				<argument>
					<name>CDSView</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_CDSView</relatedStateVariable>
				</argument>
				<argument>
					<name>QueryRequest</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_QueryRequest</relatedStateVariable>
				</argument>
				<argument>
					<name>QueryResult</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_QueryResult</relatedStateVariable>
				</argument>
				<argument>
					<name>UpdateID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_UpdateID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetFreeFormQueryCapabilities</name>
			<argumentList>
				<argument>
					<name>FFQCapabilities</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_FFQCapabilities</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetPermissionsInfo</name>
			<argumentList>
				<argument>
					<name>PermissionsInfo</name>
					<direction>out</direction>
					<relatedStateVariable>PermissionsInfo</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>RequestDeviceMode</name>
			<argumentList>
				<argument>
					<name>CPID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_CPID</relatedStateVariable>
				</argument>
				<argument>
					<name>DeviceModeRequest</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_DeviceModeRequest</relatedStateVariable>
				</argument>
				<argument>
					<name>DeviceModeID</name>
					<direction>out</direction>
					<relatedStateVariable>A_ARG_TYPE_DeviceModeID</relatedStateVariable>
				</argument>
				<argument>
					<name>DeviceModeStatus</name>
					<direction>out</direction>
					<relatedStateVariable>DeviceModeStatus</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetDeviceMode</name>
			<argumentList>
				<argument>
					<name>DeviceMode</name>
					<direction>out</direction>
					<relatedStateVariable>DeviceMode</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>GetDeviceModeStatus</name>
			<argumentList>
				<argument>
					<name>DeviceModeStatus</name>
					<direction>out</direction>
					<relatedStateVariable>DeviceModeStatus</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>CancelDeviceMode</name>
			<argumentList>
				<argument>
					<name>DeviceModeID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_DeviceModeID</relatedStateVariable>
				</argument>
			</argumentList>
		</action>

		<action>
			<Optional/>
			<name>ExtendDeviceMode</name>
			<argumentList>
				<argument>
					<name>DeviceModeID</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_DeviceModeID</relatedStateVariable>
				</argument>
				<argument>
					<name>DeviceModeRequest</name>
					<direction>in</direction>
					<relatedStateVariable>A_ARG_TYPE_DeviceModeRequest</relatedStateVariable>
				</argument>
				<argument>
					<name>DeviceModeStatus</name>
					<direction>out</direction>
					<relatedStateVariable>DeviceModeStatus</relatedStateVariable>
				</argument>
			</argumentList>
		</action>
	</actionList>
</scpd>


text:
package com.shejiaomao.widget;

import android.R;
import android.app.Activity;
import android.content.Context;
import android.view.Display;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.view.GestureDetector.OnGestureListener;

import com.shejiaomao.common.CompatibilityUtil;

public class SlideFinishOnGestureListener implements OnGestureListener {
	//mdpi下的比例计算;
	private static final float FACTOR_PORTRAIT;
	private static final float FACTOR_LANDSCAPE;
	//手指在屏幕上移动距离小于此值不会被认为是手势
	private static int SLIDE_MIN_DISTANCE_X;
	private static int SLIDE_MAX_DISTANCE_Y;

	private static int DISPLAY_WINDOW_WIDTH;
	private static int DISPLAY_WINDOW_HEIGHT;
	static {
		FACTOR_PORTRAIT = 100f / 320;
		FACTOR_LANDSCAPE = FACTOR_PORTRAIT;
	}

	private Context context;
	private SlideDirection slideDirection;

	//划动方向
	public enum SlideDirection {
		NONE,
		LEFT,
		RIGHT,
		TOP,
		BOTTOM
	}

	public SlideFinishOnGestureListener(Context context, SlideDirection slideDirection) {
		this.context = context;
		this.slideDirection = slideDirection;
		initEnv(context);
	}

	private void initEnv(Context context) {
		// 获得屏幕大小
		WindowManager windowManager = ((Activity)context).getWindowManager();
		Display display = windowManager.getDefaultDisplay();
		DISPLAY_WINDOW_WIDTH = display.getWidth();
		DISPLAY_WINDOW_HEIGHT = display.getHeight();

		SLIDE_MIN_DISTANCE_X = (int)(DISPLAY_WINDOW_WIDTH * FACTOR_PORTRAIT);
		SLIDE_MAX_DISTANCE_Y = (int)(DISPLAY_WINDOW_HEIGHT * FACTOR_LANDSCAPE);
		//orientation = context.getResources().getConfiguration().orientation;
	}

	@Override
	public boolean onDown(MotionEvent e) {
		return false;
	}

	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
			float velocityY) {
		float x1 = (e1 != null ? e1.getX() : 0);
		float x2 = (e2 != null ? e2.getX() : 0);
		float y1 = (e1 != null ? e1.getY() : 0);
		float y2 = (e2 != null ? e2.getY() : 0);
		float distanceX = x1 - x2;
		float distanceY = y1 - y2;

		if (distanceX > 0
			&& Math.abs(distanceX) > SLIDE_MIN_DISTANCE_X
			&& Math.abs(distanceY) < SLIDE_MAX_DISTANCE_Y
			&& slideDirection == SlideDirection.LEFT) {
			//slide to left
			//if (context instanceof ImageViewer4GifActivity) {
			//	((ImageViewer4GifActivity)context).onBackPressed();
			//} else {
				((Activity)context).finish();
			//}
			CompatibilityUtil.overridePendingTransition(
				((Activity)context), R.anim.slide_out_right, android.R.anim.fade_out
			);
			return true;
		} else if (
			distanceX < 0
			&& Math.abs(distanceX) > SLIDE_MIN_DISTANCE_X
			&& Math.abs(distanceY) < SLIDE_MAX_DISTANCE_Y
			&& slideDirection == SlideDirection.RIGHT) {
			//slide to right
			//if (context instanceof ImageViewer4GifActivity) {
			//	((ImageViewer4GifActivity)context).onBackPressed();
			//} else {
				((Activity)context).finish();
			//}
			CompatibilityUtil.overridePendingTransition(
				((Activity)context), R.anim.slide_in_left, android.R.anim.fade_out
			);
			return true;
		}

		if (Math.abs(distanceX) > SLIDE_MIN_DISTANCE_X
			&& Math.abs(distanceY) < SLIDE_MAX_DISTANCE_Y) {
			if (slideDirection == SlideDirection.LEFT) {
				//Toast.makeText(context, context.getString(R.string.msg_gesture_left), Toast.LENGTH_SHORT).show();
			} else if (slideDirection == SlideDirection.RIGHT) {
				//Toast.makeText(context, context.getString(R.string.msg_gesture_right), Toast.LENGTH_SHORT).show();
			}
		}

		return false;
	}

	@Override
	public void onLongPress(MotionEvent e) {

	}

	@Override
	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
			float distanceY) {

		return false;
	}

	@Override
	public void onShowPress(MotionEvent e) {
	}

	@Override
	public boolean onSingleTapUp(MotionEvent e) {
		return false;
	}

	public SlideDirection getSlideDirection() {
		return slideDirection;
	}

	public void setSlideDirection(SlideDirection slideDirection) {
		this.slideDirection = slideDirection;
	}

}

redpajama_set_name: RedPajamaGithub


text:
//    Project:     IRC# Server
//    File:        IrcStream.cs
//    Copyright:   Copyright (C) 2014 Christian Wilson. All rights reserved.
//    Website:     https://github.com/seaboy1234/IRCSharp
//    Description: An Internet Relay Chat (IRC) Server written in C#.
//
//    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.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;

namespace IRCSharp
{
    public class IrcStream
    {
        private NetworkStream _stream;
        private StreamReader _reader;
        private StreamWriter _writer;

        /// <summary>
        /// Gets or sets whether to autoflush on write.
        /// </summary>
        public bool AutoFlush
        {
            get { return _writer.AutoFlush; }
            set { _writer.AutoFlush = value; }
        }

        public IrcStream(Socket socket)
        {
            _stream = new NetworkStream(socket);
            _reader = new StreamReader(_stream);
            _writer = new StreamWriter(_stream);
        }

        /// <summary>
        /// Writes an <see cref="IRCSharp.IrcMessage"/> to the stream.
        /// </summary>
        public void Write(IrcMessage message)
        {
            _writer.WriteLine(message);
        }

        /// <summary>
        /// Writes an <see cref="IRCSharp.IrcNumericResponce"/> to the stream.
        /// </summary>
        public void Write(IrcNumericResponce responce)
        {
            _writer.WriteLine(responce);
        }

        /// <summary>
        /// Reads an <see cref="IRCSharp.IrcMessage"/> from the stream.
        /// </summary>
        /// <returns></returns>
        public IrcMessage ReadMessage()
        {
            IrcMessage message = new IrcMessage();
            string line = _reader.ReadLine();
            message.Parse(line);
            return message;
        }

        /// <summary>
        /// Reads an IrcNumericResponce from the stream.
        /// </summary>
        /// <returns></returns>
        public IrcNumericResponce ReadResponce()
        {
            IrcNumericResponce responce = new IrcNumericResponce();
            string line = _reader.ReadLine();
            responce.Parse(line);
            return responce;
        }
    }
}


text:
namespace StackImplementationWithArray
{
	using System;

	public class Program
	{
		public static void Main()
		{
			Stack<int> stack = new Stack<int>();
			stack.Push(1);
			stack.Push(2);
			stack.Push(3);
			stack.Push(4);
			stack.Push(5);
			stack.Push(6);
			stack.Push(7);
			stack.Push(8);
			stack.Push(9);
			stack.Pop();
			stack.Push(10);

			foreach (var item in stack)
			{
				Console.Write("{0} ", item);
			}
			Console.WriteLine();
		}
	}
}


text:
package com.kissthinker.coder;

/**
 * @author David Ainslie
 *
 */
public interface Coder
{
    /**
     *
     * @param object Object to encode to an array of bytes
     * @param <O> Object type
     * @return Array of encoded bytes
     */
    <O> byte[] encode(O object);

    /**
     *
     * @param bytes Array of bytes to be decoded
     * @param <O> Object type
     * @return Object from decoded bytes
     */
    <O> O decode(byte[] bytes);
}


text:
//checkout : https://www.npmjs.com/package/pixelmatch
//http://zschuessler.github.io/DeltaE/
//https://github.com/antimatter15/rgb-lab/blob/master/color.js

var modifyPixel = function(pixel, data) {
    var R = 0,G = 1,B = 2,A = 3;

    if(pixel[A] > 0) {
      data.total += 1;
      var c = data.colorStats[pixel[0] + "-" + pixel[1] + "-" + pixel[2]];
      c = c || 0;
      c += 1;
      data.colorStats[pixel[0] + "-" + pixel[1] + "-" + pixel[2]] = c;
    }
    return pixel;//[0,0,0,0]//pixel;
  }

  /**
   * Setup landcover tile cache layer as a raster layer
   */
var landcover = new ol.source.Raster({
  sources: [
    new ol.source.XYZ({
      url: 'https://coast.noaa.gov/arcgis/rest/services/CCAP/CCAP_landcover_2010/MapServer/tile/{z}/{y}/{x}',
      crossOrigin: 'anonymous'
    })
  ],
  operation: function(pixels, data) {
    var pixel = pixels[0];
    return modifyPixel(pixel, data);
  },
  lib: {
    landcoverClasses: landcoverClasses,
    rgb2lab: rgb2lab,
    lab2rgb: lab2rgb,
    deltaE: deltaE,
    modifyPixel: modifyPixel
  }
});
landcover.set('lc_class', 0);

landcover.on('beforeoperations', function(event) {
  event.data.total = 0;
  event.data.colorStats = {};
  event.data.classes = landcoverClasses;
  event.data.classes.forEach(function (lcaClass) {
    lcaClass.count = 0;
  });
});

landcover.on('afteroperations', function(event) {
  Object.keys(event.data.colorStats).forEach(function(c){

    // if new pixels are found
    if(event.data.classes[matchMap[c]] === undefined) {
      var cArr = c.split("-");
      var pixel = [parseInt(cArr[0]),parseInt(cArr[1]),parseInt(cArr[2])];
      event.data.classes.forEach(function (lcaClass,i) {
        if(i > 0){
          var matchLab = lcaClass.colorLab;
          var pixelLab = rgb2lab(pixel);
          var deltaEDiff = deltaE(matchLab, pixelLab);
          if (deltaEDiff < 3.0) {
            //console.log(c + " ---------> " +  lcaClass.id);
            lcaClass.count = event.data.colorStats[c]
          }
          else{
            //console.log("no Match for: ", c)
          }
        }
      });
    }
    else{
      event.data.classes[matchMap[c]].count = event.data.colorStats[c];
    }

  });
  //console.log(matchMap);
  scheduleStats({
    total: event.data.total,
    classes: event.data.classes
  },event.resolution);
});

/**
 * Map Setup
 */

var attribution = new ol.Attribution({
  html: 'Tiles © ArcGIS'
});

var map = new ol.Map({
  target: 'map',
  layers: [
    new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [attribution],
        url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' + 'Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}'
      })
    }),/*
    new ol.layer.Tile({
      source: new ol.source.XYZ({
        attributions: [attribution],
        url: 'https://coast.noaa.gov/arcgis/rest/services/CCAP/CCAP_landcover_2010/MapServer/tile/{z}/{y}/{x}'
      })
    }),*/
    new ol.layer.Image({
      source: landcover
    })
  ],
  view: new ol.View({
    center: [-10812411.623547956, 5050417.912951814],
    zoom: 4
  })
});

/**
 * Generate controls
 */

$(function() {
  initializeChart();
  landcoverClasses.forEach(function(i) {
    $('#controls').append('
   ' + i.name + '
');
  });
  $('.legenditem').on('click', function(evt) {
    landcover.set('lc_class', $(this).data('color-id'));
    landcover.changed();

    scheduleStats({title: $(this).find('.legendname').text()});
  });
});

var timer = null;
function scheduleStats(stats,resolution) {
  if (timer) {
    clearTimeout(timer);
    timer = null;
  }
  timer = setTimeout(function(){ displayStats(stats,resolution) }, 1000);
}

function displayStats(stats,resolution){
  console.log("displaying stats");

  if(stats.total) $('#stats #total').text(area(resolution,stats.total) + " square miles");
  if(stats.classes){
    var chartData = [];
    var check = 0;
    stats.classes.forEach(function (lcaClass) {
      $('#class_'+lcaClass.id).find(".value").text(percent(lcaClass.count,stats.total)+ "%");
      check = check + percent(lcaClass.count,stats.total);
      chartData.push({
        name: lcaClass.name,
        y: percent(lcaClass.count,stats.total),
        color: rgbString(lcaClass.color)
      });
    });
    renderChart(chartData);
  }
//area(resolution,stats.class_total)
}

function percent(value,total){
  return Math.round((value * 100) / total);
}
function area(resolution, meterCounts){
  return ((resolution * resolution * meterCounts) * 3.8610216e-07).toFixed(2) ; //convert sq mt to sq mi
}

function rgbString(color) {
  return 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';
}

function rgbaString(color) {
  return 'rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',' + color[3] + ')';
}

function initializeChart(){
  return $('#pieChart').highcharts({
          chart: {
              plotBackgroundColor: null,
              plotBorderWidth: null,
              plotShadow: false,
              type: 'pie'
          },
          title: {
              text: null
          },
          tooltip: {
              pointFormat: '{series.name}: {point.percentage:.1f}%'
          },
          plotOptions: {
              pie: {
                  allowPointSelect: true,
                  cursor: 'pointer',
                  dataLabels: {
                      enabled: true
                  }
              }
          },
          series: [{
            name: 'Classes',
            colorByPoint: true,
            data: []
        }]
      });
}

function renderChart(data){
  var chart = $("#pieChart").highcharts();
  chart.series[0].setData(data, true);
}


text:
/**
 * A validation strategy for a street
 *
 * @package com.example.helper.validate
 *
 * @author Tafadzwa Gonera <tafadzwagonera@gmail.com>
 * @version 1.0v
 * @since 1.0v @filesource StreetValidator.java
 */
package com.example.helper.validate;

public class StreetValidator extends AbstractValidator {

    public StreetValidator() {
    }

    /**
     * validates a street
     *
     * @see Validator
     * @author Tafadzwa Gonera
     */
    @Override
    public boolean validate(final String subject) {
        return match(Validator.STREET_REGEX, subject);
    }
}


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CompositeExpirationPolicyFacts.cs" company="Catel development team">
//   Copyright (c) 2008 - 2015 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Catel.Test.Caching.Policies
{
    using System;
    using System.Threading;

    using Catel.Caching.Policies;

    using NUnit.Framework;

    public class CompositeExpirationPolicyFacts
    {
        #region Nested type: TheCanResetProperty

        /// <summary>
        /// The can reset property.
        /// </summary>
        [TestFixture]
        public class TheCanResetProperty
        {
            #region Methods

            /// <summary>
            /// Returns true if any policy can be reset.
            /// </summary>
            [TestCase]
            public void ReturnsTrueIfAnyPolicyCanBeReset()
            {
                Assert.IsTrue(new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true, () => ThreadHelper.Sleep(0))).Add(new CustomExpirationPolicy(() => true)).CanReset);
            }

            /// <summary>
            /// Returns false if all policy can not be reset.
            /// </summary>
            [TestCase]
            public void ReturnsFalseIfAllPolicyCanNotBeReset()
            {
                Assert.IsFalse(new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true)).CanReset);
            }

#if NET

            [TestCase]
            public void DoesNotCauseDeathLock()
            {
                CompositeExpirationPolicy policy = new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true));
                var events = new [] { new AutoResetEvent(false), new AutoResetEvent(false)};

                new Thread(() =>
                {
                    Assert.IsFalse(policy.CanReset);
                    events[0].Set();
                }).Start();

                new Thread(() =>
                {
                    Assert.IsFalse(policy.CanReset);
                    events[1].Set();
                }).Start();

                // How specify the apartment statte to with MSTest:
                // WaitHandle.WaitAll(events,TimeSpan.FromSeconds(10))
                events[0].WaitOne(TimeSpan.FromSeconds(10));
                events[1].WaitOne(TimeSpan.FromSeconds(10));
            }

#endif

            #endregion
        }
        #endregion

        #region Nested type: TheIsExpiredProperty

        /// <summary>
        /// The the is expired property.
        /// </summary>
        [TestFixture]
        public class TheIsExpiredProperty
        {
            #region Methods

            [TestCase]
            public void ReturnsTrueIfAnyPolicyExpires()
            {
                Assert.IsTrue(new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => false)).Add(new CustomExpirationPolicy(() => true)).IsExpired);
            }

            [TestCase]
            public void ReturnsFalseIfAnyPolicyExpiresButWasConfiguredToExpireOnlyIfAllPolicyExpires()
            {
                Assert.IsFalse(new CompositeExpirationPolicy(true).Add(new CustomExpirationPolicy(() => false)).Add(new CustomExpirationPolicy(() => true)).IsExpired);
            }

            [TestCase]
            public void ReturnsTrueIfAllPolicyExpiresButWasConfiguredToExpireOnlyIfAllPolicyExpires()
            {
                Assert.IsTrue(new CompositeExpirationPolicy(true).Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true)).IsExpired);
            }

            [TestCase]
            public void ReturnsFalseIfAllPolicyNonExpiresWasConfiguredToExpireOnlyIfAllPolicyExpires()
            {
                Assert.IsFalse(new CompositeExpirationPolicy(true).Add(new CustomExpirationPolicy(() => false)).Add(new CustomExpirationPolicy(() => false)).IsExpired);
            }

            [TestCase]
            public void ReturnsFalseIfAllPolicyNonExpires()
            {
                Assert.IsFalse(new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => false)).Add(new CustomExpirationPolicy(() => false)).IsExpired);
            }

            #endregion
        }
        #endregion

        #region Nested type: TheResetMethod

        /// <summary>
        /// The can reset property.
        /// </summary>
        [TestFixture]
        public class TheResetMethod
        {
            #region Methods

            /// <summary>
            /// Invokes the action.
            /// </summary>
            [TestCase]
            public void InvokesTheResetActions()
            {
                bool actionInvoked1 = false;
                bool actionInvoked2 = false;

                new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true, () => actionInvoked1 = true)).Add(new CustomExpirationPolicy(() => true, () => actionInvoked2 = true)).Reset();

                Assert.IsTrue(actionInvoked1);
                Assert.IsTrue(actionInvoked2);
            }

#if NET

            [TestCase]
            public void DoesNotCauseDeathLockIfPolicyCanNotBeResetAndThrowsInvalidOperationException()
            {
                var events = new[] { new AutoResetEvent(false), new AutoResetEvent(false) };
                CompositeExpirationPolicy policy = new CompositeExpirationPolicy().Add(new CustomExpirationPolicy(() => true)).Add(new CustomExpirationPolicy(() => true));

                new Thread(() =>
                    {
                        ExceptionTester.CallMethodAndExpectException<InvalidOperationException>(policy.Reset);
                        events[0].Set();
                    }).Start();

                new Thread(() =>
                    {
                        ExceptionTester.CallMethodAndExpectException<InvalidOperationException>(policy.Reset);
                        events[1].Set();
                    }).Start();

                // How specify the apartment statte to with MSTest:
                // WaitHandle.WaitAll(events,TimeSpan.FromSeconds(10))
                events[0].WaitOne(TimeSpan.FromSeconds(10));
                events[1].WaitOne(TimeSpan.FromSeconds(10));
            }

#endif

            #endregion
        }
        #endregion
    }
}


text:
package com.physicaloid.tutorial4;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;

import com.physicaloid.lib.Boards;
import com.physicaloid.lib.Physicaloid;
import com.physicaloid.lib.Physicaloid.UploadCallBack;
import com.physicaloid.lib.programmer.avr.UploadErrors;
import com.physicaloid.lib.usb.driver.uart.ReadLisener;
import com.physicaloid.lib.usb.driver.uart.UartConfig;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

public class Tutorial4Activity extends Activity {
    private static final String TAG = Tutorial4Activity.class.getSimpleName();
    /*
     * !!! You need to import PhysicaloidLibrary. !!!
     * If you have errors, check Project -> Properties -> Android -> Library.
     */

    /*
     * In this tutorial, You can learn
     *  - how to set UART configurations
     *
     *  You might check TODO tags.
     */

    Button btOpen, btClose, btWrite, btUpload;
    EditText etWrite;
    TextView tvRead;
    RadioGroup rgBaudrate;
    RadioButton rb0, rb1;

    Physicaloid mPhysicaloid;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tutorial4);

        btOpen = (Button) findViewById(R.id.btOpen);
        btClose = (Button) findViewById(R.id.btClose);
        btWrite = (Button) findViewById(R.id.btWrite);
        btUpload = (Button) findViewById(R.id.btUpload);
        etWrite = (EditText) findViewById(R.id.etWrite);
        tvRead = (TextView) findViewById(R.id.tvRead);
        rgBaudrate = (RadioGroup) findViewById(R.id.rgBaudrate);
        rb0 = (RadioButton) findViewById(R.id.rb0);
        rb1 = (RadioButton) findViewById(R.id.rb1);

        setEnabledUi(false);

        mPhysicaloid = new Physicaloid(this);

        rgBaudrate.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId) {
                    case R.id.rb0:
                        tvAppend(tvRead, "set 9600\n");
                        //****************************************************************
                        // TODO : set only baudrate
                        mPhysicaloid.setBaudrate(9600);
                        //****************************************************************
                        break;

                    case R.id.rb1:
                        tvAppend(tvRead, "set 115200\n");
                        //****************************************************************
                        // TODO : set uart configurations
                        UartConfig uartConfig = new UartConfig(115200, UartConfig.DATA_BITS8, UartConfig.STOP_BITS1, UartConfig.PARITY_NONE, false, false);
                        mPhysicaloid.setConfig(uartConfig);
                        //****************************************************************
                        break;

                    default:
                        tvAppend(tvRead, "no set");
                        break;
                }
            }
        });

    }

    public void onClickOpen(View v) {
        if (mPhysicaloid.open()) { // default 9600bps
            setEnabledUi(true);

            mPhysicaloid.addReadListener(new ReadLisener() {
                String readStr;

                // callback when reading one or more size buffer
                @Override
                public void onRead(int size) {
                    byte[] buf = new byte[size];

                    mPhysicaloid.read(buf, size);
                    try {
                        readStr = new String(buf, "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                        Log.e(TAG, e.toString());
                        return;
                    }

                    // UI thread
                    tvAppend(tvRead, readStr);
                }
            });

        }
    }

    public void onClickClose(View v) {
        if (mPhysicaloid.close()) {
            setEnabledUi(false);
            mPhysicaloid.clearReadListener();
        }
    }

    public void onClickWrite(View v) {
        String str = etWrite.getText().toString();
        if (str.length() > 0) {
            byte[] buf = str.getBytes();
            mPhysicaloid.write(buf, buf.length);
        }
    }

    private UploadCallBack mUploadCallback = new UploadCallBack() {
        @Override
        public void onPreUpload() {
            tvAppend(tvRead, "Upload : Start\n");
        }

        @Override
        public void onUploading(int value) {
            tvAppend(tvRead, "Upload : " + value + " %\n");
        }

        @Override
        public void onPostUpload(boolean success) {
            if (success) {
                tvAppend(tvRead, "Upload : Successful\n");
            } else {
                tvAppend(tvRead, "Upload fail\n");
            }
        }

        @Override
        public void onCancel() {
            tvAppend(tvRead, "Cancel uploading\n");
        }

        @Override
        public void onError(UploadErrors err) {
            tvAppend(tvRead, "Error  : " + err.toString() + "\n");
        }
    };

    public void onClickUpload(View v) {
        try {
            mPhysicaloid.upload(Boards.POCKETDUINO, getResources().getAssets().open("SerialEchoback.PocketDuino.hex"), mUploadCallback);
        } catch (RuntimeException e) {
            Log.e(TAG, e.toString());
        } catch (IOException e) {
            Log.e(TAG, e.toString());
        }

    }

    Handler mHandler = new Handler();

    private void tvAppend(TextView tv, CharSequence text) {
        final TextView ftv = tv;
        final CharSequence ftext = text;
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                ftv.append(ftext);
            }
        });
    }

    private void setEnabledUi(boolean on) {
        if (on) {
            btOpen.setEnabled(false);
            btClose.setEnabled(true);
            btWrite.setEnabled(true);
            btUpload.setEnabled(true);
            etWrite.setEnabled(true);
            tvRead.setEnabled(true);
            rb0.setEnabled(true);
            rb1.setEnabled(true);
        } else {
            btOpen.setEnabled(true);
            btClose.setEnabled(false);
            btWrite.setEnabled(false);
            btUpload.setEnabled(true);
            etWrite.setEnabled(false);
            tvRead.setEnabled(false);
            rb0.setEnabled(false);
            rb1.setEnabled(false);
        }
    }
}


text:
<?php
/**
 * Exception thrown by Services_OpenStreetMap
 *
 * PHP Version 5
 *
 * @category Services
 * @package  Services_OpenStreetMap
 * @author   Ken Guest <kguest@php.net>
 * @license  BSD http://www.opensource.org/licenses/bsd-license.php
 * @version  Release: @package_version@
 * @link     http://pear.php.net/package/Services_OpenStreetMap
 */

/**
 * Exception thrown by Services_OpenStreetMap
 *
 * @category  Services
 * @package   Services_OpenStreetMap
 * @author    Ken Guest <kguest@php.net>
 * @copyright 2010-2019 Ken Guest
 * @license   BSD http://www.opensource.org/licenses/bsd-license.php
 * @version   Release: @package_version@
 * @link      http://pear.php.net/package/Services_OpenStreetMap
 */
class Services_OpenStreetMap_Exception extends Exception
{
}
// vim:set et ts=4 sw=4:


text:
module Keisan
  module Parsing
    class Argument < Group
    end
  end
end


text:
FROM python:3.9-alpine

RUN pip install --upgrade pip

RUN adduser -D python
USER python
WORKDIR /home/python

ARG DEBUG=0
ENV FLASK_DEBUG $DEBUG
ENV FLASK_APP=src/app.py
CMD ["python", "-m", "flask", "run", "--host=0.0.0.0"]

COPY --chown=python:python requirements.txt .
ENV PATH="/home/python/.local/bin:${PATH}"
RUN pip install --user -r requirements.txt

COPY --chown=python:python src src


text:
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.UITest;
using Xamarin.Forms.Core.UITests;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 35736, "[iOS] Editor does not update Text value from autocorrect when losing focus", PlatformAffected.iOS)]
	public class Bugzilla35736 : TestContentPage
	{
		protected override void Init()
		{
			var editor = new Editor
			{
				AutomationId = "Bugzilla35736Editor"
			};
			var label = new Label
			{
				AutomationId = "Bugzilla35736Label",
				Text = ""
			};

			Content = new StackLayout
			{
				Children =
				{
					editor,
					label,
					new Button
					{
						AutomationId = "Bugzilla35736Button",
						Text = "Click to set label text",
						Command = new Command(() => { label.Text = editor.Text; })
					}
				}
			};
		}

#if UITEST && __IOS__
		[Test]
		[Category(UITestCategories.ManualReview)]
		[Ignore]
		public void Bugzilla35736Test()
		{
			RunningApp.WaitForElement(q => q.Marked("Bugzilla35736Editor"));
			RunningApp.EnterText(q => q.Marked("Bugzilla35736Editor"), "Testig");
			RunningApp.Tap(q => q.Marked("Bugzilla35736Button"));
			Assert.AreEqual("Testing", RunningApp.Query(q => q.Marked("Bugzilla35736Label"))[0].Text);
		}
#endif
	}
}


text:
layout: post
title: Mediator
date: 2014-08-31 18:03:00
homepage: https://github.com/dirkfabisch/mediator
download: https://github.com/dirkfabisch/mediator/archive/master.zip
demo: http://blog.base68.com
author: Dirk Fabisch
thumbnail: mediator.png
license: MIT License
license_link: https://github.com/dirkfabisch/mediator/blob/master/LICENCE
---

A medium inspired Jekyll blog theme.

* Fully Responsive layout
* Use header images in articles
* Minimal design
* Featured article support
* FontAwesome implemented for easy use of icons fonts
* Free & Open Source Font usage


text:
// Strings for calendar.js and calendar_param.js
var L_Today     = "Heute";
var L_January   = "Januar";
var L_February  = "Februar";
var L_March     = "M\u00e4rz";
var L_April     = "April";
var L_May       = "Mai";
var L_June      = "Juni";
var L_July      = "Juli";
var L_August    = "August";
var L_September = "September";
var L_October   = "Oktober";
var L_November  = "November";
var L_December  = "Dezember";
var L_Su        = "So";
var L_Mo        = "Mo";
var L_Tu        = "Di";
var L_We        = "Mi";
var L_Th        = "Do";
var L_Fr        = "Fr";
var L_Sa        = "Sa";

// strings for dt_param.js
var L_TIME_SEPARATOR = ":";
var L_AM_DESIGNATOR = "AM";
var L_PM_DESIGNATOR = "PM";

// strings for range parameter
var L_FROM = "Von {0}";
var L_TO = "Bis {0}";
var L_AFTER = "Nach {0}";
var L_BEFORE = "Vor {0}";
var L_FROM_TO = "Von {0} bis {1}";
var L_FROM_BEFORE = "Von {0} bis vor {1}";
var L_AFTER_TO = "Nach {0} bis {1}";
var L_AFTER_BEFORE = "Nach {0} bis vor {1}";

// Strings for prompts.js and prompts_param.js
var L_BadNumber		= "Dieser Parameter ist vom Typ \"Number\" und kann nur ein vorangestelltes Minuszeichen, Ziffern (\"0-9\"), Zifferngruppierungssymbole oder ein Dezimalsymbol enthalten. Korrigieren Sie den eingegebenen Parameterwert.";
var L_BadCurrency	= "Dieser Parameter ist vom Typ \"Currency\" und kann nur ein Minuszeichen, Ziffern (\"0-9\"), Zifferngruppierungssymbole oder ein Dezimalsymbol enthalten. Korrigieren Sie den eingegebenen Parameterwert.";
var L_BadDate		= "Dieser Parameter ist vom Typ \"Date\" und sollte im Format \"Date(jjjj,mm,tt)\" angegeben werden, wobei \"jjjj\" die vierstellige Jahreszahl, \"mm\" die Monatszahl (z. B. Januar = 1) und \"tt\" der Tag des angegebenen Monats ist.";
var L_BadDateTime   = "Dieser Parameter ist vom Typ \"DateTime\", und das korrekte Format lautet \"DateTime(jjjj,mm,tt,hh,mm,ss)\". \"jjjj\" ist die vierstellige Jahreszahl, \"mm\" ist die Monatszahl (z. B. Januar = 1), \"tt\" ist der Tag des Monats, \"hh\" die Stunden im 24-Stunden-Format, \"mm\" die Minuten und \"ss\" die Sekunden.";
var L_BadTime       = "Dieser Parameter ist vom Typ \"Time\" und sollte dem Format \"Time(hh,mm,ss)\" entsprechen, wobei \"hh\" die Stunden im 24-Stunden-Format, \"mm\" die Minuten einer Stunde und \"ss\" die Sekunden einer Minute sind.";
var L_NoValue       = "Kein Wert";
var L_BadValue      = "Um \"Kein Wert\" festzulegen, m\u00fcssen Sie f\u00fcr die Werte \"von\" und \"bis\" die Option \"Kein Wert\" festlegen.";
var L_BadBound      = "Sie k\u00f6nnen \"Keine Untergrenze\" nicht zusammen mit \"Keine Obergrenze\" festlegen.";
var L_NoValueAlready = "F\u00fcr diesen Parameter wurde bereits \"Kein Wert\" festgelegt. Entfernen Sie \"Kein Wert\", bevor Sie weitere Werte hinzuf\u00fcgen.";
var L_RangeError    = "Der Anfang des Bereichs darf nicht h\u00f6her als das Ende des Bereichs sein.";
var L_NoDateEntered = "Sie m\u00fcssen ein Datum eingeben.";

// Strings for ../html/crystalexportdialog.htm
var L_ExportOptions     = "Exportoptionen";
var L_PrintOptions      = "Druckoptionen";
var L_PrintPageTitle    = "Bericht drucken";
var L_ExportPageTitle   = "Bericht exportieren";
var L_OK                = "OK";
var L_PrintPageRange    = "Geben Sie den zu druckenden Seitenbereich ein.";
var L_ExportPageRange   = "Geben Sie den zu exportierenden Seitenbereich ein.";
var L_InvalidPageRange  = "Die Seitenbereichswerte sind ung\u00fcltig. Geben Sie g\u00fcltige Werte f\u00fcr den Seitenbereich ein.";
var L_ExportFormat      = "W\u00e4hlen Sie ein Exportformat aus der Liste.";
var L_Formats           = "Formate:";
var L_All               = "Alle";
var L_Pages             = "Seiten";
var L_From              = "von:";
var L_To                = "bis:";
var L_PrintStep0        = "Zu drucken:";
var L_PrintStep1        = "1.  W\u00e4hlen Sie im n\u00e4chsten Dialogfeld die Option \"Diese Datei \u00f6ffnen\" aus, und klicken Sie auf \"OK\".";
var L_PrintStep2        = "2.  Klicken Sie im Acrobat Reader-Fenster, das sich daraufhin \u00f6ffnet, auf das Druckersymbol.";
var L_RTFFormat         = "Rich Text Format";
var L_AcrobatFormat     = "Acrobat Format (PDF)";
var L_CrystalRptFormat  = "Crystal Reports (RPT)";
var L_WordFormat        = "MS Word";
var L_ExcelFormat       = "MS Excel 97-2000";
var L_ExcelRecordFormat = "MS Excel 97-2000 (nur Daten)";


text:
@interface LUExampleViewController ()

@end

@implementation LUExampleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    SHOW_PORGRESS(self.view);
    [self payWithLU];
}

-(void)payWithLU{
    LUProduct *product=[[LUProduct alloc] initLUProductWithName:@"test" code:@"123" price:[NSNumber numberWithInt:50] qty:10 vat:13 ];
    LUProduct *product2=[[LUProduct alloc] initLUProductWithName:@"test2" code:@"123" price:[NSNumber numberWithInt:100] qty:10 vat:10 ];
    LU *lu=[[LU alloc] initWithSecretKey:@"e5|S|X~0@l10_?R4b8|1" merchant:@"ipolhtst" orderRef:@"3886786" orderDate:@"2016-11-21 10:51:58"];

    [lu addProduct:product error:nil];
    [lu addProduct:product2 error:nil];

    lu.BILL_FNAME=@"Max";
    lu.BILL_LNAME=@"Mel";
    lu.BILL_EMAIL=@"ALoon12@gmail.com";
    lu.BILL_PHONE=@"+79261122334";
    lu.BILL_COUNTRYCODE=CountryCodeRU;
    lu.LANGUAGE=LanguageTypeRU;
    lu.DISCOUNT=[NSNumber numberWithFloat:200.1];
     lu.TESTORDER=NO;
    lu.Debug=YES;
    lu.PAY_METHOD=LUPayMethodTypeCCVISAMC;

     lu.ORDER_SHIPPING=[NSNumber numberWithInt:1200];
    lu.PRICES_CURRENCY=USD;

    NSError *error;
    [self.webView loadRequest: [lu getLURequstWitherror:&error]];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
    NSLog(@"%@",request.URL.absoluteString);

    NSString *string = request.URL.absoluteString;
    //отлавливаем переход на нашу ссылку
    if ([string rangeOfString:@"?result=0"].location != NSNotFound) {
        NSArray *array = [request.URL.absoluteString componentsSeparatedByString:@"&"];

        //сохраняем номер заказа, он нам понадобится для "отмены транзакции" и для "подтверждения транзакци"
        self.payrefno = [[array objectAtIndex:3] stringByReplacingOccurrencesOfString:@"payrefno=" withString:@""];

        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:[NSString stringWithFormat:@"Оплата прошла успешно payrefno=%@",self.payrefno] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];

    }

    return YES;
}
-(void)webViewDidFinishLoad:(UIWebView *)webView{
    HIDE_PORGRESS(self.view);

}

@end


text:
layout: page
title: Gallery
subtitle: From the pexels folder
permalink: /gallery/
gallery_path: "assets/img/pexels"
tags: [Gallery, Photo]
---

This is a photo gallery made from the static files in the `assets/img/pexels` folder.
I wanted to create automatically a simple gallery from a folder without having to create a markdown page as you would for the portfolio.

{% include gallery.html gallery_path=page.gallery_path %}


text:
// ***********************************************************************
// Copyright (c) 2015 Charlie Poole
//
// 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.
// ***********************************************************************

using System.Windows.Forms;

namespace TestCentric.Gui.Elements
{
    /// <summary>
    /// The IViewElement interface wraps an individual gui
    /// item like a control or toolstrip item. It is generally
    /// exposed by views and is the base of other interfaces
	/// in the TestCentric.Gui.Elements namespace.
    /// </summary>
    public interface IViewElement
    {
        /// <summary>
        /// Gets or sets the Enabled status of the element
        /// </summary>
        bool Enabled { get; set; }

        /// <summary>
        /// Gets or sets the Visible status of the element
        /// </summary>
        bool Visible { get; set; }

        /// <summary>
        /// Gets or sets the Text of an element
        /// </summary>
        string Text { get; set; }

        /// <summary>
        /// Invoke a delegate if necessary, otherwise just call it
        /// </summary>
        void InvokeIfRequired(MethodInvoker _delegate);
    }
}


text:
The cookbook is a continuously growing collection of recipes that explain how to correctly solve the most recurrent problems that developers face in their day to day work with the KunstmaanBundlesCMS.

* [Going single language](./05-01-going-single-language.md)
* [Managing translations](./05-02-manage-translations.md)
* [Google Analytics dashboard](./05-03-google-analytics-dashboard.md)
* [Administer robots.txt](./05-04-administer-robots-txt.md)
* [Building a custom admin list filter that works on multiple columns](./05-05-building-custom-filter-on-multiple-columns.md)
* [Using the LeadGenerationBundle](./05-06-using-the-leadgenerationbundle.md)
* [Using the MenuBundle](./05-06-using-the-menubundle.md)
* [Using the MultiDomainBundle](./05-08-using-the-multi-domain-bundle.md)

> Have some cool insight or thing you did with the CMS? Please share it with us and other developers by [sending a pull request](./07-00-contributing.md)!


text:
<!DOCTYPE html>
{% load staticfiles %}

        <title>Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS - {% block title %} {% endblock %}</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta charset="utf-8">
        <meta name="generator" content="VI/VIM" />
        <meta name="language" content="pt-br"/>
        <meta name="country" content="Brazil"/>
        <meta name="copyright" content="Copyright (c) 2015 Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS. This site's design and html code is licensed under the terms of the GPLv3 or (at your option) any later version."/>
        <meta name="organization name" content="Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS." />
        <meta name="author" content="maxigenios.com.br - Genialidade em Soluções Tecnológicas."/>
        <meta name="Description" content="{% block description %} Pagina inicial {% endblock %}" lang="pt-BR"/>
        <meta name="Keywords" content="{% block keywords %} Pagina inicial {% endblock %}" lang="pt-BR"/>
        <meta name="rating" content=""/>
        <meta name="robots" content="ALL"/>
        <meta name="googlebot" content="all" />
        <meta name="distribution" content="Global" />
        <meta name="revisit-after" content="1 day" />
        <link rel="alternate" type="application/rss+xml" title="Últimas notícias da Bambino Camponês - RSS" href="/rss" />

        <meta name="google-site-verification" content="4_aezKu-nJBhNjQuEwJczVKct2D97hZVEacKZxtdPLU" />
        <meta name="msvalidate.01" content="EAF3E41475E7C437B96E2013C6A9B043" />

        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="shortcut icon" href="{% static 'images/favicon.ico' %}" type="image/x-icon" />
        <link rel="canonical" href="http://www.bambinocampones.com.br" />
        <link rel="author" title="Maxigênios - Genialidade em Soluções Tecnológicas." href="/bio.html" />
        <link rel="copyright" title="Script license and terms of use" href="/jslibs/termsOfUse.html" />
        <link rel="home" title="Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS." href="/" />
        <link rel="search" title="Pesquisa no site da Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS." href="/search/" />
        <link rel="bookmark" href="#index" title="Escola de Educação Infantil Bambino Camponês - Creche, Maternal e Educação Pré em Canoas/RS." />

        <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">

        <link href="{% static 'css/styles.css' %}" rel="stylesheet">
        <link rel="stylesheet" type="text/css" media="screen" href="{% static 'css/widget_calendar.css' %}" />

                Bambino Camponês
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    Toggle navigation

                </button>

                            Escola

                                    Filosofia

                                    Nossa História

                                   Nossa Equipe

                                    Instalações

                                    Horários

                                    Depoimentos

                            Secretaria

                                    Matriculas

                                    Material Escolar

                                    Uniforme

                                    Determinações da Escola

                            Mural

                                    Cardápio

                                    Avisos Importantes

                                    Eventos

                                    Dicas

                                    Galeria de Fotos

                                    Galeria de Vídeos

                            Serviços

                                    Proposta Pedagógica

                                    Berçario

                                    Pré-Maternal

                                    Maternal 1

                                    Maternal 2

                                    Jardim A

                                    Jardim B

                                    Atividades Extras

                            Downloads

                                    Papeis de Parede

                                    Desenhos para Pintar

                            Contato

                                    Fale Conosco

                                    Localização

                    <form class="navbar-form" role="search">

                        <input type="text" class="form-control" placeholder="Pesquisar no site" name="srch-term" id="srch-term">

                            <button class="btn btn-default" type="submit"></button>

                    </form>

                {% block content %} {% endblock %}

Todos os direitos reservados à Escola de Educação Infantil - Bambino Camponês.

Endereço: Rua Irmão Florêncio, nº 151 - Bairro Harmonia - Canoas - RS - Brasil

CEP: 92310-490

Telefone: (51) 3031-3240

E-mail: bambinocampones@bol.com.br

Desenvolvido por: Maxigênios - Genialidade em Soluções Tecnológicas.


text:
module Mongorder

  def build_search_order_expression(s_field, s_order)
    base_fields = self.default_search_order
    return base_fields unless s_field
    s_order ||= "asc"
    search_dir = (s_order.downcase == "asc") ? 1 : -1
    fields = base_fields.reject { |bf| bf.first.downcase.to_s == s_field.downcase.to_s }
    fields.unshift([s_field.to_s, search_dir])
  end

  def search(search_string, s_field = nil, s_order = nil)
    search_order_expr = build_search_order_expression(s_field, s_order)
    search_scope = if search_string
                     self.where(
                       self.search_hash(search_string)
                     )
                   else
                     self
                   end
    search_scope.order_by(search_order_expr)
  end

end


text:
<?php

/**
 * YsTag todo description.
 *
 * @package    YepSua
 * @subpackage CommonUtil
 * @author     Omar Yepez <omar.yepez@yepsua.com>
 * @version    SVN: $Id$
 */
class YsTag {
  private static $TAG_INITIATOR = '<';
  private static $TAG_FINALIZER = '>';
  private static $TAG_CLOSER_AT_FIRST = '</';
  private static $TAG_CLOSER_AT_END = ' />';

  private $template;

  public function getTemplate(){
    return $this->template;
  }

  public function setTemplate($template){
    $this->template = $template;
  }

  public function addToTemplate($template){
    $this->template .= $template;
  }

  public static function getTagClosed($tag , $properties = null){
    return self::buildCloseTag($tag, $properties);
  }

  public static function getTag($tag , $properties = null, $content = null){
    $template = $tag;
    if ($content === null){
      $template = self::buildTag($tag , $properties);
    }else{
      $template = self::buildTag($tag , $properties) . $content . self::buildCloseTag($tag);
    }
    return $template;
  }

  protected static function buildTag($tag , $properties = null){
    $pattern = ($properties === null) ? '%s' : '%s %s';
    return sprintf(self::$TAG_INITIATOR . $pattern . self::$TAG_FINALIZER, $tag, $properties);
  }

  protected static function buildCloseTag($tag , $properties = null){
    $tagClosed = $tag;
    if($properties === null){
      $tagClosed = sprintf(self::$TAG_CLOSER_AT_FIRST . '%s' . self::$TAG_FINALIZER , $tag);
    }else{
      $tagClosed = sprintf(self::$TAG_INITIATOR . '%s %s' . self::$TAG_CLOSER_AT_END, $tag , $properties);
    }
    return $tagClosed;
  }

  public static function initWidget($widgetId, $htmlProperties = null, $htmlTag = YsHTML::INPUT, $content = null){
    return self::getTag($htmlTag, sprintf('%s ', $htmlProperties), $content);
  }

  public static function endWidget($htmlTag = YsHTML::INPUT){
    return self::getTagClosed($htmlTag);
  }

  public function __toString() {
    return $this->template;
  }
}


text:
package com.secucard.connect.product.smart.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ReceiptLine {

  private String type;

  private Value value;

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public Value getValue() {
    return value;
  }

  public void setValue(Value value) {
    this.value = value;
  }

  @JsonIgnore
  public Type getLineType() {
    return Type.fromCode(type);
  }

  @Override
  public String toString() {
    return "ReceiptLine{" + "type='" + type + '\'' + ", value='" + value + '\'' + '}';
  }

  /**
   * Enumeration of all possible text decorations.
   */
  public static enum Decoration {IMPORTANT("important", "Emphasize the text."), ALIGN_LEFT("align_left", "Left align the text."), ALIGN_RIGHT(
      "align_right", "right align the text.");

    private String code;
    private String description;

    Decoration(String code, String description) {
      this.code = code;
      this.description = description;
    }

    public String getDescription() {
      return description;
    }

    public static List<Decoration> fromCode(String[] code) {
      if (code == null) {
        return null;
      }
      ArrayList<Decoration> decorations = new ArrayList<>(code.length);
      for (String s : code) {
        for (Decoration value : values()) {
          if (value.code.equals(s)) {
            decorations.add(value);
          }
        }
      }
      return decorations;
    }

    @Override
    public String toString() {
      return "Decoration{" + "code='" + code + '\'' + ", description='" + description + '\'' + "} " + super.toString();
    }}

  /**
   * Enumeration of all possible line types.
   */
  public static enum Type {SEPARATOR("separator", "A horizontal separator like a line. May have caption."), SPACE("space",
                                                                                "Empty line. No text."), TEXT_LINE(
      "textline", "Normal line of text. "), NAME_VALUE("name-value", "A name:value pair, may displayed as 2 columns.");
    private String code;
    private String description;

    Type(String code, String description) {
      this.code = code;
      this.description = description;
    }

    public String getDescription() {
      return description;
    }

    public static Type fromCode(String code) {
      for (Type type : values()) {
        if (type.code.equals(code)) {
          return type;
        }
      }

      return null;
    }

    @Override
    public String toString() {
      return "Type{" + "code='" + code + '\'' + ", description='" + description + '\'' + "} " + super.toString();
    }}

  public static class Value {

    private String caption;
    private String text;
    private String name;
    private String value;
    private String[] decoration;

    public String getCaption() {
      return caption;
    }

    public void setCaption(String caption) {
      this.caption = caption;
    }

    public String getText() {
      return text;
    }

    public void setText(String text) {
      this.text = text;
    }

    public String getName() {
      return name;
    }

    public void setName(String name) {
      this.name = name;
    }

    public String getValue() {
      return value;
    }

    public void setValue(String value) {
      this.value = value;
    }

    public String[] getDecoration() {
      return decoration;
    }

    public void setDecoration(String[] decoration) {
      this.decoration = decoration;
    }

    @JsonIgnore
    public List<Decoration> getDecorations() {
      return Decoration.fromCode(getDecoration());
    }

    @Override
    public String toString() {
      return "Value{" + "caption='" + caption + '\'' + ", text='" + text + '\'' + ", name='" + name + '\'' + ", value='" + value + '\''
          + ", decoration=" + Arrays.toString(decoration) + '}';
    }
  }
}


text:
package hiveql

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.hive.HiveContext
import org.apache.spark.{SparkConf, SparkContext}

//
// Demonstrate a Hive user-defined aggregation function (UDAF). There are two ways to
// define these: simple and generic -- this is the simple kind.
// THe UDAF is defined in Java -- see src/main/java/hiveql/SumLargeSalesUDAF.java
//

object SimpleUDAF {

  def main (args: Array[String]) {
    val spark =
      SparkSession.builder()
        .appName("HiveQL-SimpleUDAF")
        .master("local[4]")
        .enableHiveSupport()
        .getOrCreate()

    import spark.implicits._

    // create an RDD of tuples with some data
    val custs = Seq(
      (1, "Widget Co", 120000.00, 0.00, "AZ"),
      (2, "Acme Widgets", 410500.00, 500.00, "CA"),
      (3, "Widgetry", 410500.00, 200.00, "CA"),
      (4, "Widgets R Us", 410500.00, 0.0, "CA"),
      (5, "Ye Olde Widgete", 500.00, 0.0, "MA")
    )
    val customerRows = spark.sparkContext.parallelize(custs, 4)
    val customerDF = customerRows.toDF("id", "name", "sales", "discount", "state")

    // register as a temporary table
    customerDF.printSchema()
    customerDF.createOrReplaceTempView("customers")

    // register the UDAF with the HiveContext, by referring to the class we defined above --
    // skip the 'TEMPORARY' if you want it to be persisted in the Hive metastore
    spark.sql("CREATE TEMPORARY FUNCTION mysum AS 'hiveql.SumLargeSalesUDAF'")

    // now use it in a query
    val data1 = spark.sql("SELECT state, mysum(sales) AS sales FROM customers GROUP BY state")
    data1.printSchema()
    data1.foreach(r => println(r))

    customerDF.map(row => (row(0).toString, row.toString()))

  }
}


text:
require 'rails_helper'

describe KMLManager::KMLParser do
  let(:multi_coord_valid_kml)   { Rails.root.join('spec', 'data', 'test_cta_rails.kml') }
  let(:valid_kml)               { Rails.root.join('spec', 'data', 'test_cta_stations.kml') }
  let(:invalid_kml)             { Rails.root.join('invalid.kml') }
  let(:empty_file)              { Rails.root.join('empty_file') }
  let(:non_existant_file)       { Rails.root.join('non_existant_file') }

  context 'KML file multiple coordinates per entry' do
    it 'returns an array of hash from a valid Kml file with array of hash' do
      results = KMLManager::KMLParser.parse(multi_coord_valid_kml)

      expect(results).to be_a(Array)
      expect(results[0]).to include(:name, :coordinates)
      expect(results[0][:coordinates][0]).to include(:latitude, :longitude, :elevation)
      expect(results.count).to be > 0
    end
  end

  context 'KML file with single coordinate per entry' do
    it 'returns an array of hash from a valid Kml file' do
      results = KMLManager::KMLParser.parse(valid_kml)

      expect(results).to be_a(Array)
      expect(results[0]).to include(:name, :latitude, :longitude, :elevation)
      expect(results.count).to be > 0
    end
  end

  context 'other file handling' do
    it 'returns an empty array from an invalid file' do
      results = KMLManager::KMLParser.parse(invalid_kml)

      expect(results).to be_a(Array)
      expect(results.count).to eq 0
    end

    it 'returns an empty array from an empty file' do
      results = KMLManager::KMLParser.parse(empty_file)

      expect(results).to be_a(Array)
      expect(results.count).to eq 0
    end

    it 'returns an empty array from a nonexistant file' do
      results = KMLManager::KMLParser.parse(non_existant_file)

      expect(results).to be_a(Array)
      expect(results.count).to eq 0
    end

    it 'raises error on string being passed in' do
      expect { KMLManager::KMLParser.parse('foo') }.to raise_error
    end
  end
end


text:
class CreateCircleSpeechBalloonSpeechBalloons < ActiveRecord::Migration
  def change
    create_table :circle_speech_balloon_speech_balloons do |t|

      t.timestamps
    end
  end
end


text:
package de.hub.emffrag.habse;

import de.hub.emffrag.datastore.IDataStore;
import de.hub.emffrag.fragmentation.IndexedReferenceValueSetTests;

public class HBaseIndexedReferencesValueSetTests extends IndexedReferenceValueSetTests {

	@Override
	protected IDataStore createTestDataStore() {
		return HBaseDataStoreFactory.createDataStore();
	}

}


text:
<!DOCTYPE html>

	<meta http-equiv="content-type" content="text/html; charset=UTF-8">

			#{userName} of #{enterpriseName} shared documents for you:

			#{linkUrl}

			#{message}

			For more OATOS cloud application information, please visit: http://www.oatos.net

			If you have any questions, please send Email to: support@oatos.net

			If you mistakenly received this email, please ignore it and delete.

	 		This is an automated message from the system, please don't respond directly!


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycoscience 36(3): 296 (1995)

#### Original name
Laboulbenia exigua var. melanolabiata Terada

### Remarks
null


text:
package org.datavec.local.transforms.functions;

import org.datavec.api.records.reader.RecordReader;
import org.datavec.api.writable.Writable;
import org.nd4j.linalg.function.Function;
import org.nd4j.linalg.primitives.Pair;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.List;

/**RecordReaderFunction: Given a RecordReader and a file (via InputStream), load and parse the
 * data into a Collection<Writable>.
 * NOTE: This is only useful for "one record per file" type situations (ImageRecordReader, etc)
 * @author Alex Black
 */
public class RecordReaderFunction implements Function<Pair<String, InputStream>, List<Writable>> {
    protected RecordReader recordReader;

    public RecordReaderFunction(RecordReader recordReader) {
        this.recordReader = recordReader;
    }

    @Override
    public List<Writable> apply(Pair<String, InputStream> value) {
        URI uri = URI.create(value.getFirst());
        InputStream ds = value.getRight();
        try (DataInputStream dis = (DataInputStream) ds) {
            return recordReader.record(uri, dis);
        } catch (IOException e) {
            throw new IllegalStateException("Something went wrong reading file");
        }

    }
}


text:
interface ApiRequestBase {
  customer_id: string,   // the customer id
  version: string  // the customer version field
}

export default ApiRequestBase


text:
package tiki.tests.arbitrary

import org.scalacheck.{Arbitrary, Gen}

/**
  * ArbitrarySet generator.
  */
trait ArbitrarySet {

  def setGen[A](implicit arbA: Arbitrary[A]): Gen[Set[A]] =
    Gen.containerOf[Set, A](arbA.arbitrary)(implicitly, s => s)

  implicit def setsArbitrary[A: Arbitrary]: Arbitrary[Set[A]] = Arbitrary(setGen)
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Rep. Tottori Mycol. Inst. 10: 21 (1973)

#### Original name
Uromyces itoanus Hirats. f.

### Remarks
null


text:
require 'test_helper'

class MeasureDescriptionTest < ActiveSupport::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
var data = require('../../data'),
    f = require('util').format;

module.exports = function(interview, input, number, strings) {
    var message = '';

    interview.enteredBarangay = input;
    interview.matchedBarangay = data.getClosestBarangay(interview.matchedProvince, interview.matchedCity, input);
    interview.retry = false;

    // Check for an exact match
    if (interview.enteredBarangay.toLowerCase() === interview.matchedBarangay.toLowerCase()) {
        interview.barangayFound = true;
        interview.step = 'start';

        // Find the closest clinic based on barangay
        var reportLat = data.provinces[interview.matchedProvince].munis[interview.matchedCity].barangays[interview.matchedBarangay].lat;
        var reportLng = data.provinces[interview.matchedProvince].munis[interview.matchedCity].barangays[interview.matchedBarangay].lng;
        var clinic = data.getClosestClinic(reportLat, reportLng);

        interview.lat = reportLat;
        interview.lng = reportLng;

        message = f(strings.barangayFound, clinic);
    } else {
        interview.step = 'barangay2';
        message = f(strings.matchConfirm, interview.matchedBarangay, strings.yes, strings.no);
    }

    return message;
};


text:
import React from 'react';

class InputRadio extends React.Component {
   constructor(props) {
      super(props);
      this.state = {inputs: this.props.inputs}
   }
   onClick(ev) {
      let e = ev.target;
        let $inputs = this.state.inputs;
        let $index = $(e).data("index");
        $inputs.map((input, i) => {
          if(i == $index) {
            input.isChecked = true;
          } else {
            input.isChecked = false;
          }
          return input;
        })
        this.setState({inputs: $inputs});
   }
   onChange() {
      //this.setState({isChecked: !this.state.isChecked});
   }
   render() {
      return

      {
        this.state.inputs.map((input, index) => {
          if(input.isChecked) {$("#"+this.props.ID).val(input.val)}
          return

            <input className="mdl-js-radio__button" data-index={index} type="radio" name={input.name} id={input.id} checked={input.isChecked} defaultValue={input.val} onChange={this.onChange.bind(this)} onClick={this.onClick.bind(this)} />
            {input.show}

        })
      }
      <input id={this.props.ID} name={this.props.ID} type="hidden" defaultValue={this.props.default} />

   }
}

export default InputRadio


text:
(function() {
  'use strict';
  var _containersControllers, _windowEventsHandlerBinded, _windowInViewItems, addWindowInViewItem, angularInviewModule, bindWindowEvents, checkInView, debounce, getBoundingClientRect, getOffsetFromPercentage, getViewportHeight, offsetIsPercentage, removeWindowInViewItem, trackInViewContainer, triggerInViewCallback, unbindWindowEvents, untrackInViewContainer, windowCheckInView, windowEventsHandler,
    slice = [].slice;

  angularInviewModule = angular.module('angular-inview', []).directive('inView', [
    '$parse', function($parse) {
      return {
        restrict: 'A',
        require: '?^inViewContainer',
        link: function(scope, element, attrs, containerController) {
          var inViewFunc, item, options, performCheck, ref, ref1;
          if (!attrs.inView) {
            return;
          }
          inViewFunc = $parse(attrs.inView);
          options = scope.$eval(attrs.inViewOptions);
          item = {
            element: element,
            wasInView: false,
            offset: 0,
            customDebouncedCheck: null,
            callback: function($event, $inview, $inviewpart) {
              if ($event == null) {
                $event = {};
              }
              return scope.$evalAsync((function(_this) {
                return function() {
                  $event.inViewTarget = element[0];
                  return inViewFunc(scope, {
                    '$event': $event,
                    '$inview': $inview,
                    '$inviewpart': $inviewpart
                  });
                };
              })(this));
            }
          };
          if ((attrs.inViewOptions != null) && options) {
            item.offset = options.offset || [options.offsetTop || 0, options.offsetBottom || 0];
            if (options.debounce) {
              item.customDebouncedCheck = debounce((function(event) {
                return checkInView([item], element[0], event);
              }), options.debounce);
            }
          }
          performCheck = (ref = (ref1 = item.customDebouncedCheck) != null ? ref1 : containerController != null ? containerController.checkInView : void 0) != null ? ref : windowCheckInView;
          if (containerController != null) {
            containerController.addItem(item);
          } else {
            addWindowInViewItem(item);
          }
          setTimeout(performCheck);
          return scope.$on('$destroy', function() {
            if (containerController != null) {
              containerController.removeItem(item);
            }
            return removeWindowInViewItem(item);
          });
        }
      };
    }
  ]).directive('inViewContainer', function() {
    return {
      restrict: 'AC',
      controller: [
        '$element', function($element) {
          this.items = [];
          this.addItem = function(item) {
            return this.items.push(item);
          };
          this.removeItem = function(item) {
            var i;
            return this.items = (function() {
              var j, len, ref, results;
              ref = this.items;
              results = [];
              for (j = 0, len = ref.length; j < len; j++) {
                i = ref[j];
                if (i !== item) {
                  results.push(i);
                }
              }
              return results;
            }).call(this);
          };
          this.checkInView = (function(_this) {
            return function(event) {
              var i, j, len, ref;
              ref = _this.items;
              for (j = 0, len = ref.length; j < len; j++) {
                i = ref[j];
                if (i.customDebouncedCheck != null) {
                  i.customDebouncedCheck();
                }
              }
              return checkInView((function() {
                var k, len1, ref1, results;
                ref1 = this.items;
                results = [];
                for (k = 0, len1 = ref1.length; k < len1; k++) {
                  i = ref1[k];
                  if (i.customDebouncedCheck == null) {
                    results.push(i);
                  }
                }
                return results;
              }).call(_this), $element[0], event);
            };
          })(this);
          this.element = $element;
          return this;
        }
      ],
      link: function(scope, element, attrs, controller) {
        element.bind('scroll', controller.checkInView);
        trackInViewContainer(controller);
        return scope.$on('$destroy', function() {
          element.unbind('scroll', controller.checkInView);
          return untrackInViewContainer(controller);
        });
      }
    };
  });

  _windowInViewItems = [];

  addWindowInViewItem = function(item) {
    _windowInViewItems.push(item);
    return bindWindowEvents();
  };

  removeWindowInViewItem = function(item) {
    var i;
    _windowInViewItems = (function() {
      var j, len, results;
      results = [];
      for (j = 0, len = _windowInViewItems.length; j < len; j++) {
        i = _windowInViewItems[j];
        if (i !== item) {
          results.push(i);
        }
      }
      return results;
    })();
    return unbindWindowEvents();
  };

  _containersControllers = [];

  trackInViewContainer = function(controller) {
    _containersControllers.push(controller);
    return bindWindowEvents();
  };

  untrackInViewContainer = function(container) {
    var c;
    _containersControllers = (function() {
      var j, len, results;
      results = [];
      for (j = 0, len = _containersControllers.length; j < len; j++) {
        c = _containersControllers[j];
        if (c !== container) {
          results.push(c);
        }
      }
      return results;
    })();
    return unbindWindowEvents();
  };

  _windowEventsHandlerBinded = false;

  windowEventsHandler = function(event) {
    var c, j, len;
    for (j = 0, len = _containersControllers.length; j < len; j++) {
      c = _containersControllers[j];
      c.checkInView(event);
    }
    if (_windowInViewItems.length) {
      return windowCheckInView(event);
    }
  };

  bindWindowEvents = function() {
    if (_windowEventsHandlerBinded) {
      return;
    }
    _windowEventsHandlerBinded = true;
    return angular.element(window).bind('checkInView click ready wheel mousewheel DomMouseScroll MozMousePixelScroll resize scroll touchmove mouseup', windowEventsHandler);
  };

  unbindWindowEvents = function() {
    if (!_windowEventsHandlerBinded) {
      return;
    }
    if (_windowInViewItems.length || _containersControllers.length) {
      return;
    }
    _windowEventsHandlerBinded = false;
    return angular.element(window).unbind('checkInView click ready wheel mousewheel DomMouseScroll MozMousePixelScroll resize scroll touchmove mouseup', windowEventsHandler);
  };

  triggerInViewCallback = function(event, item, inview, isTopVisible, isBottomVisible) {
    var elOffsetTop, inviewpart;
    if (inview) {
      elOffsetTop = getBoundingClientRect(item.element[0]).top + window.pageYOffset;
      inviewpart = (isTopVisible && isBottomVisible && 'neither') || (isTopVisible && 'top') || (isBottomVisible && 'bottom') || 'both';
      if (!(item.wasInView && item.wasInView === inviewpart && elOffsetTop === item.lastOffsetTop)) {
        item.lastOffsetTop = elOffsetTop;
        item.wasInView = inviewpart;
        return item.callback(event, true, inviewpart);
      }
    } else if (item.wasInView) {
      item.wasInView = false;
      return item.callback(event, false);
    }
  };

  checkInView = function(items, container, event) {
    var bounds, boundsBottom, boundsTop, element, item, j, k, len, len1, ref, ref1, ref2, ref3, results, viewport;
    viewport = {
      top: 0,
      bottom: getViewportHeight()
    };
    if (container && container !== window) {
      bounds = getBoundingClientRect(container);
      if (bounds.top >= viewport.bottom || bounds.bottom < viewport.top) {
        for (j = 0, len = items.length; j < len; j++) {
          item = items[j];
          triggerInViewCallback(event, item, false);
        }
        return;
      }
      if (bounds.top > viewport.top) {
        viewport.top = bounds.top;
      }
      if (bounds.bottom < viewport.bottom) {
        viewport.bottom = bounds.bottom;
      }
    }
    results = [];
    for (k = 0, len1 = items.length; k < len1; k++) {
      item = items[k];
      element = item.element[0];
      bounds = getBoundingClientRect(element);
      boundsTop = bounds.top + (offsetIsPercentage(item.offset) ? getOffsetFromPercentage(bounds, item.offset) : parseInt((ref = (ref1 = item.offset) != null ? ref1[0] : void 0) != null ? ref : item.offset));
      boundsBottom = bounds.bottom + (offsetIsPercentage(item.offset) ? getOffsetFromPercentage(bounds, item.offset) : parseInt((ref2 = (ref3 = item.offset) != null ? ref3[1] : void 0) != null ? ref2 : item.offset));
      if (boundsTop < viewport.bottom && boundsBottom >= viewport.top) {
        results.push(triggerInViewCallback(event, item, true, boundsBottom > viewport.bottom, boundsTop < viewport.top));
      } else {
        results.push(triggerInViewCallback(event, item, false));
      }
    }
    return results;
  };

  offsetIsPercentage = function(offset) {
    return typeof offset === 'string' && offset.slice(-1) === '%';
  };

  getOffsetFromPercentage = function(bounds, offsetPercentage) {
    var percentage;
    percentage = offsetPercentage.substring(0, offsetPercentage.length - 1);
    return (bounds.bottom - bounds.top) * (percentage / 100);
  };

  getViewportHeight = function() {
    var height, mode, ref;
    height = window.innerHeight;
    if (height) {
      return height;
    }
    mode = document.compatMode;
    if (mode || !(typeof $ !== "undefined" && $ !== null ? (ref = $.support) != null ? ref.boxModel : void 0 : void 0)) {
      height = mode === 'CSS1Compat' ? document.documentElement.clientHeight : document.body.clientHeight;
    }
    return height;
  };

  getBoundingClientRect = function(element) {
    var el, parent, top;
    if (element.getBoundingClientRect != null) {
      return element.getBoundingClientRect();
    }
    top = 0;
    el = element;
    while (el) {
      top += el.offsetTop;
      el = el.offsetParent;
    }
    parent = element.parentElement;
    while (parent) {
      if (parent.scrollTop != null) {
        top -= parent.scrollTop;
      }
      parent = parent.parentElement;
    }
    return {
      top: top,
      bottom: top + element.offsetHeight
    };
  };

  debounce = function(f, t) {
    var timer;
    timer = null;
    return function() {
      var args;
      args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
      if (timer != null) {
        clearTimeout(timer);
      }
      return timer = setTimeout((function() {
        return f.apply(null, args);
      }), t != null ? t : 100);
    };
  };

  windowCheckInView = function(event) {
    var i, j, len;
    for (j = 0, len = _windowInViewItems.length; j < len; j++) {
      i = _windowInViewItems[j];
      if (i.customDebouncedCheck != null) {
        i.customDebouncedCheck();
      }
    }
    return checkInView((function() {
      var k, len1, results;
      results = [];
      for (k = 0, len1 = _windowInViewItems.length; k < len1; k++) {
        i = _windowInViewItems[k];
        if (i.customDebouncedCheck == null) {
          results.push(i);
        }
      }
      return results;
    })(), null, event);
  };

  if (typeof define === 'function' && define.amd) {
    define(['angular'], angularInviewModule);
  } else if (typeof module !== 'undefined' && module && module.exports) {
    module.exports = angularInviewModule;
  }

}).call(this);


text:
namespace eos {

inline policy_map_mgr * policy_map_handler::get_policy_map_mgr() const {
   return mgr_;
}

} // namespace eos

#endif // EOS_INLINE_POLICY_H


text:
<?php

namespace App\Mailer;

use Mail;
use Naux\Mail\SendCloudTemplate;

/**
 * Class Mailer
 *
 * @package \App\Mailer
 */
class Mailer
{
    protected function sendTo($template,$email,array $data)
    {
        $content = new SendCloudTemplate($template,$data);

        Mail::raw($content,function ($message) use ($email) {
            $message->from('laraveek@laravel.com','Laraveek');
            $message->to($email);
        });
    }
}


text:
<?php

namespace Greymass\SteemPHP;

use Greymass\SteemPHP\RPC;

class RPCGetStateTest extends \PHPUnit_Framework_TestCase
{

    public function testGetStateTrending() {
        $rpc = new RPC();
        $state = $rpc->get_state('trending');
    }

}