text:
package com.accent_systems.remottebootloader;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.Dialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.BluetoothGattService;
import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity implements OnMenuItemClickListener{

	private ProgressBar progress;
	private Button conn, reb, bootL, calib, sensors;
	private TextView connection;
	private ImageView pMenu;

	public static BluetoothAdapter mBluetoothAdapter;
	public static BluetoothManager mBluetoothManager;
	public static BluetoothGatt mBluetoothGatt;
	public static List<BluetoothGattCharacteristic> chars = null;
	private BluetoothGattCharacteristic mChar = null;

	private static final int REQUEST_ENABLE_BT = 1;

	private boolean scanning = false;
	private boolean connected = false;

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

		progress = (ProgressBar) findViewById(R.id.progress);
		progress.setVisibility(View.INVISIBLE);

		conn = (Button) findViewById(R.id.connectButt);
		reb = (Button) findViewById(R.id.rebootButt);
		bootL = (Button) findViewById(R.id.bootloaderButt);
		calib = (Button) findViewById(R.id.calibrateButt);
		sensors = (Button) findViewById(R.id.sensorsButt);

		pMenu = (ImageView) findViewById(R.id.menu_button);

		connection = (TextView) findViewById(R.id.connection_label);

		final PopupMenu popupMenu = new PopupMenu(MainActivity.this, pMenu);
		popupMenu.setOnMenuItemClickListener(MainActivity.this);
		popupMenu.inflate(R.menu.main_menu);

		pMenu.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				popupMenu.show();
			}
		});

		//CONNECT OR DISCONNECT FROM REMOTTE - BUTTON
		conn.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				if(connected){
					disconnect();
					scanning = false;
				}else{
					if(scanning){
						mBluetoothAdapter.stopLeScan(mLeScanCallback);
						scanning = false;
						connection.setText("DISCONNECTED");
					    connection.setTextColor(Color.parseColor("#FF0000"));
					    conn.setText(getString(R.string.connect));
					    progress.setVisibility(View.INVISIBLE);
					    disconnect();
					}else{
						mBluetoothAdapter.startLeScan(mLeScanCallback);
						scanning = true;
						connection.setText("SCANNING...");
					    connection.setTextColor(Color.parseColor("#FFB700"));
					    conn.setText("CANCEL CONNECTION");
					    progress.setVisibility(View.VISIBLE);

					}
				}
			}
		});

	}

	//DEFINES ALL BUTTONS ONCE CONNECTED TO THE REMOTTE DEVICE
	private void setClickListeners(){

		reb.setBackground(getResources().getDrawable(R.drawable.custom_btn_blue));
		bootL.setBackground(getResources().getDrawable(R.drawable.custom_btn_blue));
		calib.setBackground(getResources().getDrawable(R.drawable.custom_btn_blue));
		sensors.setBackground(getResources().getDrawable(R.drawable.custom_btn_blue));

		//REBOOT DEVICE BUTTON AND DIALOG CALL
		reb.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mChar.setValue(hexStringToByteArray("01"));
				writeCharacteristic(mChar);
				throwDialog("reboot it!");
			}
		});

		//BOOTLOADER MODE BUTTON AND DIALOG CALL
		bootL.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mChar.setValue(hexStringToByteArray("02"));
				writeCharacteristic(mChar);
				throwDialog("launch it in BootLoader mode!");
			}
		});

		//CALIBRATE DEVICE BUTTON AND DIALOG CALL
		calib.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				mChar.setValue(hexStringToByteArray("03"));
				writeCharacteristic(mChar);
				throwDialog("calibrate it!");
			}
		});

		//SENSORS ACTIVITY BUTTON
		sensors.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent sensorsIntent = new Intent(MainActivity.this, SensorsActivity.class);
				startActivity(sensorsIntent);
			}
		});
	}

	//INDICATIONS DYNAMIC DIALOG
	private void throwDialog(String s){
		final Dialog myDialog = new Dialog(this);
		myDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        myDialog.setContentView(R.layout.customdialog);
        TextView txtv=(TextView)myDialog.findViewById(R.id.dialog_body);
		txtv.setText("Please press the ENTER button on the remotte to "+s);
        Button finishbtn=(Button)myDialog.findViewById(R.id.acceptButt);
        finishbtn.setOnClickListener(new OnClickListener() {
             @Override
              public void onClick(View v) {
                    myDialog.cancel();
              }
        });
        myDialog.show();
	}

	//DISABLE BUTTONS FUNCTION ON DISCONNECTION FROM REMOTTE
	private void setClickListenersNull(){
		reb.setOnClickListener(null);
		bootL.setOnClickListener(null);
		calib.setOnClickListener(null);
		sensors.setOnClickListener(null);
		reb.setBackground(getResources().getDrawable(R.drawable.custom_btn_disable));
		bootL.setBackground(getResources().getDrawable(R.drawable.custom_btn_disable));
		calib.setBackground(getResources().getDrawable(R.drawable.custom_btn_disable));
		sensors.setBackground(getResources().getDrawable(R.drawable.custom_btn_disable));
	}

	//BLUETOOTH CHECKER FUNCTION. DETECTS WHETER THE DEVICE IS BLE READY AND IF TRUE, IT ASKS USER TO ENABLE IT
	private void checkForBluetooth(){
		if (!getBaseContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
            Toast.makeText(getBaseContext(), R.string.ble_not_supported, Toast.LENGTH_SHORT).show();
            finish();
        }

        final BluetoothManager bluetoothManager =(BluetoothManager) getBaseContext().getSystemService(Context.BLUETOOTH_SERVICE);
        mBluetoothAdapter = bluetoothManager.getAdapter();

        if (mBluetoothAdapter == null) {
            Toast.makeText(getBaseContext(), R.string.error_bluetooth_not_supported, Toast.LENGTH_SHORT).show();
            finish();
        }

        if (!mBluetoothAdapter.isEnabled()) {
            if (!mBluetoothAdapter.isEnabled()) {
                Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
                startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
            }
        }
	}

	@Override
	public void onActivityResult(int requestCode, int resultCode, Intent data) {
        // User chose not to enable Bluetooth.
        if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
            finish();
            return;
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

	//BLUETOOTH SCANNING ADAPTER. CALLED WHEN SCANNING HAS STARTED. IT SCAN FOR ALL BLE DEVICES AND WHEN REMOTTE DETECTED
	//IT STOPS THE SCAN AND PROCEEDS TO CONNECTION WITH THE DEVICE
	private BluetoothAdapter.LeScanCallback mLeScanCallback =
            new BluetoothAdapter.LeScanCallback() {

        @Override
        public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                	String name = device.getName();
                	if(name != null){
                		if(name.equalsIgnoreCase("HID Remotte")){ 												//IF REMOTTE FOUND...
                        	Toast.makeText(getBaseContext(), "Remotte found!", Toast.LENGTH_SHORT).show();
                        	mBluetoothAdapter.stopLeScan(mLeScanCallback); 										//STOP SCAN
                        	runOnUiThread(new Runnable() {
								@Override
								public void run() {
									connection.setText("CONNECTING...");
								    connection.setTextColor(Color.parseColor("#FFFF00"));
								}
							});
                        	scanning = false;
                        	initialize();																		//INICIALIZE BLUETOOTH ADAPTER
                        	connect(device.getAddress());														//START CONNECTION WITH REMOTTE DEVICE
                        }
                	}
                }
            });
        }
    };

    //BLUETOOTH INICIALIZATION FUNCTION
    public boolean initialize() {
        // For API level 18 and above, get a reference to BluetoothAdapter through
        // BluetoothManager.
        if (mBluetoothManager == null) {
            mBluetoothManager = (BluetoothManager) getBaseContext().getSystemService(Context.BLUETOOTH_SERVICE);
            if (mBluetoothManager == null) {
                return false;
            }
        }
        mBluetoothAdapter = mBluetoothManager.getAdapter();
        if (mBluetoothAdapter == null) {
            return false;
        }

        return true;
    }

    //CONNECTION MANAGER WITH THE DETECTED REMOTTE DEVICE
    public boolean connect(final String address) {
        if (mBluetoothAdapter == null || address == null) {
            return false;
        }

        final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(address);
        if (device == null) {
            return false;
        }
        // We want to directly connect to the device, so we are setting the autoConnect
        // parameter to false.
        runOnUiThread(new Runnable(){
            public void run(){
            	mBluetoothGatt = device.connectGatt(getBaseContext(), false, mGattCallback);  		//CONNECTING TO THE DEVICE GATT
            }
        });

        return true;
    }

    //DISCONNECT FUNCTION CALLED WHEN APP IS DESTROYED
    public void disconnect() {
        if (mBluetoothAdapter == null || mBluetoothGatt == null) {
            return;
        }
        runOnUiThread(new Runnable(){
            public void run(){
            	mBluetoothGatt.disconnect();  	//DISCONNECTS FROM GATT
            }
        });

    }

    //AFTER CONNECTED TO GATT, THIS FUNCTION IS CALLED TO SCAN FOR SERVICES AND CHARACTERISTICS
    private void displayGattServices(List<BluetoothGattService> gattServices) {
        if (gattServices == null) return;
        chars = new ArrayList<BluetoothGattCharacteristic>();
        for (BluetoothGattService gattService : gattServices) {
        	List<BluetoothGattCharacteristic> gattCharacteristics =
        			gattService.getCharacteristics();
        	for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
        		chars.add(gattCharacteristic);
        		if(gattCharacteristic.getUuid().toString().contains("aa62")){	//SEARCH AND STORE FOR THE CONFIGURATION CHARACTERISTIC
        			mChar = gattCharacteristic;
        		}
        	}
        }

    }

    //BLUETOOTH GATT CALLBACK - MANAGES CONNECTION, DISCONNECTION AND STATE CHANGES WITH THE DEVICE.
    private final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
        	if (newState == BluetoothProfile.STATE_CONNECTED) { 	//WHEN STATE CONNECTED IT CALLS THE FUNCTION TO DISCOVER SERVICES AND CHARACTERISTICS
        		mBluetoothGatt.discoverServices();
        	} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {  	//DISCONNECTED STATE
        		connected = false;
        		runOnUiThread(new Runnable() {
    				@Override
    				public void run() {
    					connection.setText("DISCONNECTED");
    		        	connection.setTextColor(Color.parseColor("#ff0000"));
    		        	connected = false;
    		        	conn.setText(getString(R.string.connect));
    		        	setClickListenersNull();
    				}
    			});
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.REMOTTE_DISCONNECTED");	//ON DISCONNECTION STATE ALSO THROWS BROADCAST INTENT TO SENSORS ACTIVITY TO CLOSE IT
        		sendBroadcast(intent);
        	}

        }

        //FUNCTION CALLED WHEN SERVICES FOUND
        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
        	displayGattServices(getSupportedGattServices());
        	runOnUiThread(new Runnable() {
				@Override
				public void run() {
					connection.setText("CONNECTED");
		        	connection.setTextColor(Color.parseColor("#00ff00"));
		        	connected = true;
		        	conn.setText(getString(R.string.disconnect));
		        	progress.setVisibility(View.INVISIBLE);
		        	setClickListeners();
				}
			});
        }

        @Override
        public void onCharacteristicRead(BluetoothGatt gatt,
                                         BluetoothGattCharacteristic characteristic,
                                         int status) {
        }

        //FUNCTION CALLED WHEN THE APP RECEIVES A NOTIFICATION FROM THE REMOTTE. IT SENDS BROADCAST TO SENSORS ACTIVITY TO INFORM ABOUT THE CHANGE AND BRING THE NEW VALUE.
        @Override
        public void onCharacteristicChanged(BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic) {
        	if(characteristic.getUuid().toString().contains("2a19")){						//ON BATTERY CHANGE NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.BATTERY_CHANGED");
        		intent.putExtra("batt_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}else if(characteristic.getUuid().toString().contains("ffe1")){					//ON REMOTTE BUTTON PRESSED NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.KEY_PRESSED");
        		intent.putExtra("key_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}else if(characteristic.getUuid().toString().contains("aa11")){					//ON ACCELEROMETER VALUE CHANGED NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.ACCELEROMETER");
        		intent.putExtra("accel_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}else if(characteristic.getUuid().toString().contains("aa51")){					//ON GYROSCOPE VALUE CHANGED NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.GYROSCOPE");
        		intent.putExtra("gyro_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}else if(characteristic.getUuid().toString().contains("aa41")){					//ON ALTIMETER VALUE CHANGED NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.ALTIMETER");
        		intent.putExtra("alt_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}else if(characteristic.getUuid().toString().contains("aa01")){					//ON THERMOMETER VALUE CHANGED NOTIFICATION
        		Intent intent = new Intent();
        		intent.setAction("com.remotte.THERMOMETER");
        		intent.putExtra("temp_value", bytesToHex(characteristic.getValue()));
        		sendBroadcast(intent);
        	}
        }
    };

    //FUNCTION AUTOCALLED WHICH GETS THE DETECTED SERVICES
    public List<BluetoothGattService> getSupportedGattServices() {
        if (mBluetoothGatt == null) return null;

        return mBluetoothGatt.getServices();
    }

    //FUNCTION TO MODIFY/WRITE NEW VALUES IN A CERTAIN CHARACTERISTIC
    public static void writeCharacteristic(BluetoothGattCharacteristic characteristic) {
        try {
        	mBluetoothGatt.writeCharacteristic(characteristic);
		} catch (Exception e) {
		}

    }

    //FUNCTION TO READ THE VALUE OF A CERTAIN CHARACTERISTIC
    public static void readCharacteristic(BluetoothGattCharacteristic characteristic) {
        try {
        	mBluetoothGatt.readCharacteristic(characteristic);
		} catch (Exception e) {
		}

    }

    //HEXADECIMA STRING TO BYTE ARRAY CONVERTER
    public static byte[] hexStringToByteArray(String s) {
    	try {
        	int len = s.length();
            byte[] data = new byte[len/2];
            for(int i = 0; i < len; i+=2){
                data[i/2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16));
            }
            return data;
		} catch (Exception e) {
		}
        return new byte[]{00};
    }

    //BYTE ARRAY TO HEXADECIMAL STRING CONVERTER
    public static String bytesToHex(byte[] bytes) {
    	char[] hexArray = "0123456789ABCDEF".toCharArray();
    	char[] hexChars = null;
        try{
        	hexChars = new char[bytes.length * 2];
        }catch(Exception e){}
    	if(hexChars!=null){
    		for ( int j = 0; j < bytes.length; j++ ) {
                int v = bytes[j] & 0xFF;
                hexChars[j * 2] = hexArray[v >>> 4];
                hexChars[j * 2 + 1] = hexArray[v & 0x0F];
            }
    		return new String(hexChars);
    	}else{
    		return "--";
    	}
    }

    //POP-UP MENU
	@Override
	public boolean onMenuItemClick(MenuItem item) {
		switch (item.getItemId()) {

		case R.id.item_website:
			Intent web_intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://remotte.com/remotte-glass/"));
            startActivity(web_intent);
			return true;
		case R.id.item_exit:
			finish();
			return true;
		default:
			return false;
		}
	}

	//CALLED ON ACTIVITY RESUME
	@Override
    protected void onResume() {
        super.onResume();
        checkForBluetooth();		//CHECK BLUETOOTH STATE CHANGED
        if(connected){				//ENABLE BUTTONS IF CONNECTED TO REMOTTE DEVICE
        	setClickListeners();
        }
    }

	//CALLED WHEN APP/ACTIVITY DESTROYED
	@Override
	protected void onDestroy() {
		disconnect();		//DISCONNECT FROM ANY CONNECTED DEVICE
		super.onDestroy();
	}

}


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

namespace FastCgiNet
{
	internal class NvpEnumerator : IEnumerator<NameValuePair>
	{
		private Stream Contents;
		private int bufsize;
		private byte[] buf;
		private int unusedBytes;
		private NameValuePair lastIncompleteNvp;
		private long ContentLength;
		private long NvpBytesYielded;

		private void ShiftBufferLeftBy(int times)
		{
			for (int i = 0; i < bufsize - times; ++i)
				buf[i] = buf[i + times];
		}

		public bool MoveNext()
		{
            //TODO: Improve this implementation. Specifically, don't shift the buffer left every time. Keep a smaller buffer
            // that is big enough to create a Nvp and use it like RecordFactory does
			int readBytes;
			while (true)
			{
				// Know when to stop
				if (NvpBytesYielded == ContentLength)
					return false;

				// No need to read from the stream if our yielded bytes plus unusedBytes is equal to the expected content length
				if (unusedBytes + NvpBytesYielded < ContentLength)
				{
					int bytesToRead = bufsize - unusedBytes;
					if (bytesToRead > ContentLength - (unusedBytes + NvpBytesYielded))
						bytesToRead = (int)(ContentLength - (unusedBytes + NvpBytesYielded));

					readBytes = Contents.Read(buf, unusedBytes, bytesToRead);
				}
				else
					readBytes = 0;

				int endOfNvp;
				if (lastIncompleteNvp == null)
				{
					if (NvpFactory.TryCreateNvp(buf, 0, unusedBytes + readBytes, out lastIncompleteNvp, out endOfNvp))
					{
						// We had enough bytes to create the nvp. Did we have enough for all of its contents too?
						if (endOfNvp >= 0)
						{
							currentNvp = lastIncompleteNvp;
							lastIncompleteNvp = null;
							ShiftBufferLeftBy(endOfNvp + 1);
							unusedBytes = unusedBytes + readBytes - endOfNvp - 1;
							NvpBytesYielded += currentNvp.GetBytes().Sum(nvpB => nvpB.Count);
							return true;
						}
						else
						{
							unusedBytes = 0;
						}
					}
					else
					{
						// There weren't enough bytes to even create a nvp. Keep those bytes in the buffer as unused
						unusedBytes += readBytes;
					}
				}
				else
				{
					lastIncompleteNvp.FeedBytes(buf, 0, unusedBytes + readBytes, out endOfNvp);
					if (endOfNvp >= 0)
					{
						currentNvp = lastIncompleteNvp;
						lastIncompleteNvp = null;
						ShiftBufferLeftBy(endOfNvp + 1);
						unusedBytes = unusedBytes + readBytes - endOfNvp - 1;
						NvpBytesYielded += currentNvp.GetBytes().Sum(nvpB => nvpB.Count);
						return true;
					}
					else
					{
						unusedBytes = 0;
					}
				}
			}
		}
		public void Reset()
		{
			throw new NotSupportedException();
		}
		object System.Collections.IEnumerator.Current
		{
			get
			{
				return currentNvp;
			}
		}

		public void Dispose()
		{
		}

		private NameValuePair currentNvp;
		NameValuePair IEnumerator<NameValuePair>.Current
		{
			get
			{
				return currentNvp;
			}
		}

		public NvpEnumerator(Stream s, long contentLength)
		{
			Contents = s;
			ContentLength = contentLength;
			NvpBytesYielded = 0;

			bufsize = 128;
			buf = new byte[bufsize];
		}
	}
}

redpajama_set_name: RedPajamaGithub


text:
package org.opensplice.cm.impl;

import org.opensplice.cm.CMException;
import org.opensplice.cm.Query;
import org.opensplice.cm.ReaderSnapshot;
import org.opensplice.cm.com.CommunicationException;
import org.opensplice.cm.com.Communicator;
import org.opensplice.cm.data.State;
import org.opensplice.cm.qos.QoS;
import org.opensplice.cm.status.Status;

/**
 * Implementation of the Query interface.
 *
 * @date May 18, 2005
 */
public class QueryImpl extends ReaderImpl implements Query{
    private final String expression;
    private final String params;
    private final State instanceState;
    private final State sampleState;
    private final State viewState;

    /**
     * Constructs a new Query from the supplied arguments. This function is for
     * internal use only and should not be used by API users.
     *
     * @param _index
     *            The index of the handle of the kernel entity that is
     *            associated with this entity.
     * @param _serial
     *            The serial of the handle of the kernel entity that is
     *            associated with this entity.
     * @param _pointer
     *            The address of the user layer entity that is associated with
     *            this entity.
     * @param _name
     *            The name of the kernel entity that is associated with this
     *            entity.
     * @param _expression
     *            The query expression that is used to create the query.
     */
    public QueryImpl(Communicator communicator, long _index, long _serial, String _pointer, String _name,
 String _expression, String _params, State _instanceState,
            State _sampleState, State _viewState) {
        super(communicator, _index, _serial, _pointer, _name);
        expression = _expression;
        params = _params;
        instanceState = _instanceState;
        sampleState = _sampleState;
        viewState = _viewState;

    }

    /**
     * Creates a new Query from the supplied arguments. The Query is owned by
     * the caller of this constructor.
     *
     * @param source The Reader to attach the Query to.
     * @param name The name of the Query.
     * @param expression The query expression.
     * @throws CMException Thrown when Query could not be created.
     */
    public QueryImpl(ReaderImpl source, String name, String expression) throws CMException{
        super(source.getCommunicator(), 0, 0, "", "");
        owner = true;
        QueryImpl q;
        try {
            q = (QueryImpl)getCommunicator().queryNew(source, name, expression);
        } catch (CommunicationException e) {
            throw new CMException(e.getMessage());
        }
        if(q == null){
            throw new CMException("Query could not be created.");
        }
        this.index = q.index;
        this.serial = q.serial;
        this.name = q.name;
        this.pointer = q.pointer;
        this.expression = q.expression;
        this.enabled = q.enabled;
        this.params = null;
        this.instanceState = new State(0);
        this.sampleState = new State(0);
        this.viewState = new State(0);
        q.freed = true;
    }

    /**
     * Provides access to the query expression.
     *
     * @return The query expression.
     */
    @Override
    public String getExpression(){
        return expression;
    }

    @Override
    public String getExpressionParams(){
        return params;
    }

    @Override
    public State getInstanceState(){
        return instanceState;
    }

    @Override
    public State getSampleState(){
        return sampleState;
    }

    @Override
    public State getViewState(){
        return viewState;
    }

    @Override
    public Status getStatus() throws CMException{
        throw new CMException("Entity type has no status.");
    }

    @Override
    public QoS getQoS() throws CMException{
        throw new CMException("Entity type has no QoS.");
    }

    @Override
    public ReaderSnapshot makeSnapshot() throws CMException{
        throw new CMException("Snapshot of Query temporarily not supported (see BUCS_PL_CR_546).");
    }
}


text:
"""Python configuration for DragAndDropSortInput interaction."""

from __future__ import annotations

from extensions.interactions import base

class DragAndDropSortInput(base.BaseInteraction):
    """Interaction for Drag and Drop Sorting."""

    name = 'Drag And Drop Sort'
    description = 'Allows learners to drag and drop items for sorting.'
    display_mode = base.DISPLAY_MODE_SUPPLEMENTAL
    is_trainable = False
    _dependency_ids = []
    answer_type = 'ListOfSetsOfTranslatableHtmlContentIds'
    instructions = 'I18N_INTERACTIONS_DRAG_AND_DROP_INSTRUCTION'
    narrow_instructions = 'I18N_INTERACTIONS_DRAG_AND_DROP_INSTRUCTION'
    needs_summary = True
    can_have_solution = True
    show_generic_submit_button = True

    _customization_arg_specs = [{
        'name': 'choices',
        'description': 'Items for drag and drop',
        'schema': {
            'type': 'list',
            'validators': [{
                'id': 'has_length_at_least',
                # NOTE: There is slightly stricter validation of the number of
                # minimum choices in frontend. It should be at least 2 from the
                # frontend perspective but we can't impose it here as min_value
                # in the customization schema determines the number of RTEs that
                # appear in the customization modal initially that needs to be
                # 1. Here min_value: 2 and default_value: [''] aren't allowed as
                # default_value needs to be at least of same length as min_value
                # else schema tests for customization args will fail.
                'min_value': 1
            }],
            'items': {
                'type': 'custom',
                'obj_type': 'SubtitledHtml',
                'replacement_ui_config': {
                    'html': {
                        'hide_complex_extensions': True,
                        'placeholder': (
                            'Enter an option for the learner to drag and drop.')
                    }
                }
            },
            'ui_config': {
                'add_element_text': 'Add a new item',
            }
        },
        'default_value': [{
            'content_id': None,
            'html': ''
        }],
    }, {
        'name': 'allowMultipleItemsInSamePosition',
        'description': 'Allow multiple sort items in the same position',
        'schema': {
            'type': 'bool'
        },
        'default_value': False
    }]

    _answer_visualization_specs = []


text:
package cmd

import (
	"fmt"
	"os"
	"time"

	"github.com/tpisntgod/Agenda/entity/meeting"
	"github.com/tpisntgod/Agenda/entity/user"

	"github.com/spf13/cobra"
)

// mcCmd represents the mc command
var mcCmd = &cobra.Command{
	Use:   "mc",
	Short: "to create a new meeting",
	Long: `to create a new meeting with title, participator,starttime and endtime.
	 For example:

./app mc -ttest -pPeter -pMarry -s"2017-10-28 09:30:00" -e"2017-10-28 10:30:00"`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("mc called")
		title, _ := cmd.Flags().GetString("title")
		participators, _ := cmd.Flags().GetStringArray("parti")
		stime, _ := cmd.Flags().GetString("stime")
		etime, _ := cmd.Flags().GetString("etime")
		if !user.IsLogin() {
			fmt.Println("Login first!")
			os.Exit(1)
		}
		if title == "" {
			fmt.Println("title can not be blank")
			os.Exit(2)
		}
		if stime == "" {
			fmt.Println("stime can not be blank")
			os.Exit(3)
		}
		if etime == "" {
			fmt.Println("etime can not be blank")
			os.Exit(4)
		}
		t1, _ := time.Parse("2006-01-02 15:04:05", stime)
		t2, _ := time.Parse("2006-01-02 15:04:05", etime)
		if !meeting.CheckStarttimelessthanEndtime(t1, t2) {
			fmt.Println("start time should be less than end time")
			os.Exit(5)
		}
		isUsersUnregistered := 0
		for i := 0; i < len(participators); i++ {
			if !user.IsRegisteredUser(participators[i]) {
				isUsersUnregistered = 1
				fmt.Println(participators[i] + " is not registered")
			}
		}
		if isUsersUnregistered == 1 {
			os.Exit(6)
		}
		if err := meeting.CreateMeeting(title, participators, t1, t2); err != nil {
			fmt.Println(err)
			os.Exit(7)
		}
		//MeetingCreate(title, participators, stime, etime)
		fmt.Println(title + " created")

	},
}

func init() {
	RootCmd.AddCommand(mcCmd)
	var strarr []string

	// Here you will define your flags and configuration settings.

	// Cobra supports Persistent Flags which will work for this command
	// and all subcommands, e.g.:
	// mcCmd.PersistentFlags().String("foo", "", "A help for foo")

	// Cobra supports local flags which will only run when this command
	// is called directly, e.g.:
	// mcCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
	mcCmd.Flags().StringP("title", "t", "", "title of the meeting which should be unique")
	mcCmd.Flags().StringArrayP("parti", "p", strarr, "participators of the meeting ")
	mcCmd.Flags().StringP("stime", "s", "", "time when the meeting will begin")
	mcCmd.Flags().StringP("etime", "e", "", "time when the meeting will end")
}


text:
//
//  ZUXControl.h
//  ZUtilsX
//
//  Created by Char Aznable on 15/11/13.
//  Copyright © 2015年 org.cuc.n3. All rights reserved.
//

#ifndef ZUtilsX_ZUXControl_h
#define ZUtilsX_ZUXControl_h

#import <UIKit/UIKit.h>
#import "zarc.h"

extern float ZUXMinOperationInterval;

@interface ZUXControl : UIControl

@property (nonatomic, ZUX_STRONG) UIImage *backgroundImage;

- (void)zuxInitial;

@end

#endif /* ZUtilsX_ZUXControl_h */


text:
package com.kirak.web.rest.cross_role;

import com.fasterxml.jackson.annotation.JsonView;
import com.kirak.model.Country;
import com.kirak.service.CityService;
import com.kirak.service.CountryService;
import com.kirak.to.PlaceTo;
import com.kirak.web.View;
import com.kirak.web.abstr.RegionAbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Kir on 09.09.2017.
 */

@RestController
@RequestMapping("/retrieve_regions")
public class RegionsRetrievalController extends RegionAbstractController {

    @Autowired
    public RegionsRetrievalController(CityService cityService, CountryService countryService) {
        super(cityService, countryService);
    }

    @Override
    @JsonView(View.JsonUI.class)
    @GetMapping(value = "/cities", produces = MediaType.APPLICATION_JSON_VALUE)
    public List<PlaceTo> getAll(){
        return super.getAll();
    }

    @Override
    @JsonView(View.JsonUI.class)
    @GetMapping(value = "/countries", produces = MediaType.APPLICATION_JSON_VALUE)
    public List<Country> getAllCountries() {
        return super.getAllCountries();
    }
}


text:
<!DOCTYPE html>
<html lang="en">

<head>
    <title>Best books of 2015 : NPR</title>

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="nprbooks">
    <meta name="twitter:image" content="http://apps.npr.org/best-books-2015/assets/cover/progeorgia.jpg" />

    <meta property="og:title" content="NPR's Best Books of 2015 - ProGeorgia" />
    <meta property="og:url" content="http://127.0.0.1:8000/share/progeorgia.html" />
    <meta property="og:type" content="article" />
    <meta property="og:description" content="A great State Voices and America Votes affiliate that has both a c3 and a c4." />
    <meta property="og:image" content="http://apps.npr.org/best-books-2015/assets/cover/progeorgia.jpg" />
    <meta property="og:site_name" content="NPR.org" />
    <meta property="fb:app_id" content="1.38837436155e+14" />

    <meta name="thumbnail" content="http://apps.npr.org/best-books-2015/assets/cover/progeorgia.jpg" />
</head>

<body>
</body>

</html>


text:
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.min.js" type="text/javascript"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/sparkline/jquery.sparkline.min.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/knob/jquery.knob.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/daterangepicker/daterangepicker.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/datepicker/bootstrap-datepicker.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/iCheck/icheck.min.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/slimScroll/jquery.slimscroll.min.js') }}" type="text/javascript"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/plugins/fastclick/fastclick.min.js') }}"></script>
<script src="{{ URL::asset('packages/almasaeed2010/adminlte/dist/js/app.min.js') }}" type="text/javascript"></script>
<script>
    $('.dropdown-toggle').dropdown();
</script>


text:
require 'kramdown'

filename = ARGV[0]
if filename.nil?
  puts "Usage: md_outline.rb [FILENAME]"
  puts "Prints an outline of a markdown document as a markdown bulleted list"
  exit 1
end

doc = Kramdown::Document.new(File.read(filename))
puts doc.root.children.select{ |e| e.type == :header }.map{
      |e| "#{'  ' * (e.options[:level] - 1)}* #{e.options[:raw_text]}"}


text:
<?php

/* ApplicationSonataUserBundle:Navigation_temp:prosmotr.html.twig */
class __TwigTemplate_5db73113a02bebde302f095ebe4d9963 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->blocks = array(
            'stell' => array($this, 'block_stell'),
            'glav' => array($this, 'block_glav'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "ApplicationSonataUserBundle:Role_template:student.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        // line 1
        if ($this->env->getExtension('security')->isGranted("ROLE_STUDENT")) {
        }
        $this->getParent($context)->display($context, array_merge($this->blocks, $blocks));
    }

    // line 4
    public function block_stell($context, array $blocks = array())
    {
        // line 5
        echo "        <link rel=\"stylesheet\" href=\"";
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/userbundle/css/prosmotr.css"), "html", null, true);
        echo "\" type=\"text/css\" media=\"all\" />
        <link rel=\"stylesheet\" href=\"";
        // line 6
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/userbundle/css/fancybox/jquery.fancybox.css"), "html", null, true);
        echo "\" type=\"text/css\"/>

        <link rel=\"stylesheet\" href=\"";
        // line 8
        echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/userbundle/css/user.css"), "html", null, true);
        echo "\" type=\"text/css\" media=\"all\" />

";
    }

    // line 13
    public function block_glav($context, array $blocks = array())
    {
        // line 14
        echo "
Профиль ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "firstName"), "html", null, true);
        echo " ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "lastName"), "html", null, true);
        echo "

env, $this->env->getExtension('assets')->getAssetUrl($this->getAttribute($this->getContext($context, "entity"), "put")), "html", null, true);
        echo "\">env, $this->env->getExtension('assets')->getAssetUrl($this->getAttribute($this->getContext($context, "entity"), "put")), "html", null, true);
        echo "\">

<input type=\"button\" value=\"Написать сообщение\" id=\"sendMsgBtn\">

<input type=\"button\" value=\"Добавить в друзья\" onclick=\"\" id=\"buttonFriend\" class=\"textBtn\">

";
        // line 60
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("profile.show.firstName", array(), "FOSUserBundle"), "html", null, true);
        echo ": ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "firstName"), "html", null, true);
        echo "

";
        // line 61
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("profile.show.lastName", array(), "FOSUserBundle"), "html", null, true);
        echo ": ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "lastName"), "html", null, true);
        echo "

";
        // line 62
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("profile.show.email", array(), "FOSUserBundle"), "html", null, true);
        echo ": ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "email"), "html", null, true);
        echo "

";
        // line 63
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("fos_user_profile_form_spec", array(), "FOSUserBundle"), "html", null, true);
        echo " ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "spec"), "html", null, true);
        echo "

";
        // line 64
        echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans("fos_user_profile_form_grouppa", array(), "FOSUserBundle"), "html", null, true);
        echo " ";
        echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "entity"), "group"), "html", null, true);
        echo "

    <form action=\"";
        // line 69
        echo twig_escape_filter($this->env, $this->env->getExtension('routing')->getPath("prosmotr", array("id" => $this->getAttribute($this->getContext($context, "entity"), "id"))), "html", null, true);
        echo "\" method=\"post\" ";
        echo $this->env->getExtension('form')->renderEnctype($this->getContext($context, "form"));
        echo ">
        ";
        // line 70
        echo $this->env->getExtension('form')->renderWidget($this->getContext($context, "form"));
        echo "
        <input type=\"submit\" id=\"_submit2\" value=\"Отправить\" />
    </form>

";
    }

    public function getTemplateName()
    {
        return "ApplicationSonataUserBundle:Navigation_temp:prosmotr.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }
}


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Rad van Fortuin</title>

	<link rel="stylesheet" type="text/css" href="index.css">

SUPPORTERS VERENIGING V.V. DEN HAM