text:
<?php
App::uses('UnattachedMessage', 'Model');
App::uses('ProgramSetting', 'Model');
App::uses('ProgramSpecificMongoModel', 'Model');

class UnattachedMessageTestCase extends CakeTestCase
{

    public function setUp()
    {
        parent::setUp();
        $dbName = 'testdbprogram';
        $this->UnattachedMessage = ProgramSpecificMongoModel::init(
            'UnattachedMessage', $dbName);
        $this->ProgramSetting = ProgramSpecificMongoModel::init(
            'ProgramSetting', $dbName);
        $this->dropData();

    }

    public function tearDown()
    {
        $this->dropData();
        unset($this->UnattachedMessage);
        parent::tearDown();
    }

    public function dropData()
    {
        $this->UnattachedMessage->deleteAll(true, false);
        $this->ProgramSetting->deleteAll(true, false);
    }

    public function testSave_ok_minimu()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $unattachedMessage = array(
            'send-to-type' => 'all',
            'content' => 'hello there how are you',
            'type-schedule' => 'immediately',
            'created-by' => 1);
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);

        $this->assertEquals(1, $this->UnattachedMessage->find('count'));
        $this->assertRegExp('/^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}:\d{2} \w* \w*$/', $savedUnattachedMessage['UnattachedMessage']['name']);
    }

    public function testSave_ok_allParticipants()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);

        $this->assertEquals(1, $this->UnattachedMessage->find('count'));
        $this->assertEquals('4', $savedUnattachedMessage['UnattachedMessage']['model-version']);
        $this->assertEquals('unattached-message', $savedUnattachedMessage['UnattachedMessage']['object-type']);
    }

    public function testSave_ok_matchParticipants()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'match',
            'send-to-match-operator' => 'all',
            'send-to-match-conditions' => array('a tag'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);
        //$this->assertTrue($savedUnattachedMessage);
        $this->assertEquals(1, $this->UnattachedMessage->find('count'));
        $this->assertEquals('4', $savedUnattachedMessage['UnattachedMessage']['model-version']);
        $this->assertEquals('unattached-message', $savedUnattachedMessage['UnattachedMessage']['object-type']);
    }

    public function testSave_fail_noCreatedBy()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'match',
            'send-to-match-operator' => 'all',
            'send-to-match-conditions' => array('a tag'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i')
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);

        $this->assertEquals(0, $this->UnattachedMessage->find('count'));
        $this->assertEquals(
            'Message must be created by a user.',
            $this->UnattachedMessage->validationErrors['created-by'][0]);
    }

    public function testSave_fail_matchParticipants_noSendToOperator()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'match',
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(0, $this->UnattachedMessage->find('count'));
    }

    public function testSave_fail_matchParticipants_noSendToMatchConditions()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'match',
            'send-to-match-operator'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(
            'Select conditions.',
            $this->UnattachedMessage->validationErrors['send-to-match-conditions'][0]);
    }

    public function testSave_fail_matchParticipants_noSendToType()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-match-operator'=> 'all',
            'send-to-match-conditions' => array('a tag'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(0, $this->UnattachedMessage->find('count'));
    }

    public function testSave_fail_forbiddenapostrophe()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name' => 'hello',
            'send-to-type'=> 'all',
            'content' => 'what's that',
            'type-schedule' => 'fixed-time',
            'fixed-time' => $date->format('d/m/Y H:i')
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(
            'The apostrophe used in this message is not valid.',
            $this->UnattachedMessage->validationErrors['content'][0]);
    }

    public function testSave_ok_update_matchToPhone()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'match',
            'send-to-match-operator' => 'all',
            'send-to-match-conditions' => array('a tag'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by'=>1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);
        $this->assertEquals('match', $savedUnattachedMessage['UnattachedMessage']['send-to-type']);

        $unattachedMessage['send-to-type'] = "phone";
        $unattachedMessage['send-to-phone'] = array("+256777");

        $this->UnattachedMessage->id =  $savedUnattachedMessage['UnattachedMessage']['_id']."";
        $this->UnattachedMessage->save($unattachedMessage);
        $updateUnattachedMessage = $this->UnattachedMessage->find('first');
        $this->assertEquals(1, $this->UnattachedMessage->find('count'));
        $this->assertEquals('phone', $updateUnattachedMessage['UnattachedMessage']['send-to-type']);
        $this->assertEquals(
            $unattachedMessage['send-to-phone'],
            $updateUnattachedMessage['UnattachedMessage']['send-to-phone']);
        $this->assertTrue(!isset($updateUnattachedMessage['UnattachedMessage']['send-to-match-operator']));
        $this->assertTrue(!isset($updateUnattachedMessage['UnattachedMessage']['send-to-match-conditions']));
    }

    public function testSave_ok_tagAndLabel()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type' => 'match',
            'send-to-match-operator' => 'all',
            'send-to-match-conditions' => array(
                'geek',
                'a tag',
                'city:kampala',
                'some label:some value'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($unattachedMessage);

        $this->assertEquals(1,$this->UnattachedMessage->find('count'));
    }

    public function testSave_fail_fixedTime_isPast()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=>'05/04/2012 14:30',
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($otherUnattachedMessage);

        //1st assertion, count does not increase, remains 1
        $this->assertEquals(0,$this->UnattachedMessage->find('count'));
        //2st assertion, error fixed time cannot be in the past
        $this->assertEquals(
            'Fixed time cannot be in the past.',
            $this->UnattachedMessage->validationErrors['fixed-time'][0]);
    }

    public function testSave_fail_noScheduleType()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'created-by' => 1);
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($otherUnattachedMessage);

        //1st assertion, count does not increase, remains 1
        $this->assertEquals(
            0,
            $this->UnattachedMessage->find('count'));
        //2st assertion, error fixed time cannot be in the past
        $this->assertEquals(
            'Please choose a type of schedule for this message.',
            $this->UnattachedMessage->validationErrors['type-schedule'][0]);
        $this->assertEqual(
            "",
            $this->UnattachedMessage->data['UnattachedMessage']['fixed-time']);
    }

    public function testSave_fail_noFixedTime()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name' => 'hello',
            'send-to-type' => 'all',
            'content' => 'hello there',
            'type-schedule' => 'fixed-time',
            'created-by' => 1);
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($otherUnattachedMessage);

        //1st assertion, count does not increase, remains 1
        $this->assertEquals(0,$this->UnattachedMessage->find('count'));
        //2st assertion, error fixed time cannot be in the past
        $this->assertEquals(
            'Please enter a fixed time for this message.',
            $this->UnattachedMessage->validationErrors['fixed-time'][0]);
    }

    public function testSave_fail_notAccepted_typeSchedule()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name' => 'hello',
            'send-to-type' => 'all',
            'content' => 'hello there',
            'type-schedule' => 'something',
            'created-by' => 1);
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($otherUnattachedMessage);
        $this->assertEquals(
            'This type of schedule is not allowed.',
            $this->UnattachedMessage->validationErrors['type-schedule'][0]);
    }

    public function testSave_ok_typeSchedule_none()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name' => 'hello',
            'send-to-type' => 'all',
            'content' => 'hello there',
            'type-schedule' => 'none',
            'created-by' => 1);
        $this->UnattachedMessage->create("unattached-message");
        $unattached = $this->UnattachedMessage->save($otherUnattachedMessage);
        $this->assertTrue(isset($unattached['UnattachedMessage']));
    }

    public function testSave_ok_scheduleImmediatly()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'immediately',
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($otherUnattachedMessage);

        $this->assertEquals(1, $this->UnattachedMessage->find('count'));
        $this->assertEquals('immediately', $savedUnattachedMessage['UnattachedMessage']['type-schedule']);
    }

    public function testSave_fail_specialCharacters()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type' => 'match',
            'send-to-match-operator' => 'all',
            'send-to-match-conditions' => array('a\nt"ag'),
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time'=> $date->format('d/m/Y H:i')
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($unattachedMessage);

        $this->assertFalse($savedUnattachedMessage);
        $this->assertEquals(
            'Incorrect tag or label.',
            $this->UnattachedMessage->validationErrors['send-to-match-conditions'][0]);
    }

    public function testGetNameIdForFilter()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $output = $this->UnattachedMessage->getNameIdForFilter();
        $this->assertEquals(
            null,
            $output);

        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'immediately',
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage1 = $this->UnattachedMessage->save($unattachedMessage);

        $unattachedMessage = array(
            'name'=>'hello2',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'immediately',
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage2 = $this->UnattachedMessage->save($unattachedMessage);

        $output = $this->UnattachedMessage->getNameIdForFilter();
        $this->assertEquals(
            array($savedUnattachedMessage1['UnattachedMessage']['_id'] => 'hello',
                $savedUnattachedMessage2['UnattachedMessage']['_id'] => 'hello2'),
            $output);
    }

    public function testIsNotPast()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');
        $now = new DateTime('now', timezone_open('Africa/Kampala'));
        $past = $now->modify('-30 minutes')->format("Y-m-d\TH:i:s");

        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'fixed-time',
            'fixed-time' => $past,
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($unattachedMessage);
        $this->assertEquals(
            'Fixed time cannot be in the past.',
            $this->UnattachedMessage->validationErrors['fixed-time'][0]);
    }

    public function testSave_ok_dynamicContent()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name' => 'hello',
            'send-to-type'=> 'all',
            'content' => 'There is a an [participant.name] here.',
            'type-schedule' => 'fixed-time',
            'fixed-time' => $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($unattachedMessage);
        $this->assertEquals(1,$this->UnattachedMessage->find('count'));

        $unattachedMessage02 = array(
            'name' => 'weather',
            'send-to-type'=> 'all',
            'content' => 'The weather today is [contentVariable.program.weather].',
            'type-schedule' => 'fixed-time',
            'fixed-time' => $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->UnattachedMessage->save($unattachedMessage02);
        $this->assertEquals(2,$this->UnattachedMessage->find('count'));
    }

    public function testSave_fail_dynamicContent()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $date = new DateTime('tomorrow');
        $date->modify("+4 hour");
        $unattachedMessage = array(
            'name' => 'hello',
            'send-to-type'=> 'all',
            'content' => 'There is a an [shoe.box] here.',
            'type-schedule' => 'fixed-time',
            'fixed-time' => $date->format('d/m/Y H:i'),
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(
            "To be used as customized content, 'shoe' can only be either: participant, contentVariable or time.",
            $this->UnattachedMessage->validationErrors['content'][0]);

        $unattachedMessage['content'] = "Hello [participant.gender.name]";
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(
            "To be used in message, participant only accepts one key.",
            $this->UnattachedMessage->validationErrors['content'][0]);

        $unattachedMessage['content'] = "Hello [contentVariable.kampala.pork.male.price]";
        $this->assertFalse($this->UnattachedMessage->save($unattachedMessage));
        $this->assertEquals(
            "To be used in message, contentVariable only accepts maximum three keys.",
            $this->UnattachedMessage->validationErrors['content'][0]);
    }

    public function testSave_ok_customizedContent_contentVariable()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $otherUnattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello the price of chicken today is [contentVariable.mombasa.chicken.price]',
            'type-schedule'=>'immediately',
            'created-by' => 1
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage = $this->UnattachedMessage->save($otherUnattachedMessage);

        $this->assertEquals(1,$this->UnattachedMessage->find('count'));
    }

    public function testGet_unattachedMessageNmae_By_ID()
    {
        $this->ProgramSetting->saveProgramSetting('timezone','Africa/Kampala');

        $unattachedMessage = array(
            'name'=>'hello',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'immediately',
            'created-by' => 1,
            '_id' => 02
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage_01 = $this->UnattachedMessage->save($unattachedMessage);

        $unattachedMessage = array(
            'name'=>'hello2',
            'send-to-type'=> 'all',
            'content'=>'hello there',
            'type-schedule'=>'immediately',
            'created-by' => 1,
            '_id' => 04
            );
        $this->UnattachedMessage->create("unattached-message");
        $savedUnattachedMessage_02 = $this->UnattachedMessage->save($unattachedMessage);

        $output = $this->UnattachedMessage->getNameById(02);
        $this->assertEquals('hello', $output);
    }

}


text:
package sedion.jeffli.buildin;

import sedion.jeffli.util.ActivityUtils;
import sedion.jeffli.util.GlobalParameterApplication;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;

/*
 *Fragment作为Activity界面的一部分组成出现
 *可以在一个Activity中同时出现多个Fragment,并且,一个Fragment亦可在多个Activity中使用。
 *在Activity运行过程中,可以添加、移除或者替换Fragment(add()、remove()、replace())
 *Fragment可以响应自己的输入事件,并且有自己的生命周期,当然,它们的生命周期直接被其所属的
 *宿主activity的生命周期影响。
 * */
public class BaseFragment extends Fragment implements View.OnClickListener{

	private int ulId;
	private String userName;
	private String userPass;

	public Context context;

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		this.context = this.getActivity();
	}

	@Override
	public void onClick(View v) {
	}

	public void exit(){
		this.getActivity().finish();
	}
	public void exitToHome(){
		ActivityUtils.finishAll();
	}

	public static final void setTextStyle(TextView view, boolean bold){
		view.getPaint().setFakeBoldText(bold);
	}

	public int getUlId() {
		return  ((GlobalParameterApplication) getActivity().getApplicationContext()).getUlId();
	}

	public String getUserName() {
		return ((GlobalParameterApplication) getActivity().getApplicationContext()).getUserName();
	}

	public String getUserPass() {
		return ((GlobalParameterApplication) getActivity().getApplicationContext()).getUserPass();
	}

	public boolean onKeyDown(int keyCode, KeyEvent event)
	{
		return false;
	}
}

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import classNames from 'classnames';

var Radial = React.createClass({
  render: function () {
    var percentage;
    if ((this.props.progress !== null && this.props.progress !== undefined) && !this.props.spin && !this.props.error) {
      percentage = (

      );
    } else {
      percentage =

;
    }
    var classes = classNames({
      'radial-progress': true,
      'radial-spinner': this.props.spin,
      'radial-negative': this.props.error,
      'radial-thick': this.props.thick || false,
      'radial-gray': this.props.gray || false,
      'radial-transparent': this.props.transparent || false
    });
    return (

          {percentage}

    );
  }
});

module.exports = Radial;


text:
package org.sqlite.struct;

import org.moe.natj.c.StructObject;
import org.moe.natj.c.ann.Structure;
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;

@Generated
@Structure()
public final class sqlite3_index_constraint extends StructObject {
	static {
		NatJ.register();
	}
	private static long __natjCache;

	@Generated
	public sqlite3_index_constraint() {
		super(sqlite3_index_constraint.class);
	}

	@Generated
	protected sqlite3_index_constraint(Pointer peer) {
		super(peer);
	}

	@Generated
	public sqlite3_index_constraint(int iColumn, byte op, byte usable,
			int iTermOffset) {
		super(sqlite3_index_constraint.class);
		setIColumn(iColumn);
		setOp(op);
		setUsable(usable);
		setITermOffset(iTermOffset);
	}

	@Generated
	@StructureField(order = 0, isGetter = true)
	public native int iColumn();

	@Generated
	@StructureField(order = 0, isGetter = false)
	public native void setIColumn(int value);

	@Generated
	@StructureField(order = 1, isGetter = true)
	public native byte op();

	@Generated
	@StructureField(order = 1, isGetter = false)
	public native void setOp(byte value);

	@Generated
	@StructureField(order = 2, isGetter = true)
	public native byte usable();

	@Generated
	@StructureField(order = 2, isGetter = false)
	public native void setUsable(byte value);

	@Generated
	@StructureField(order = 3, isGetter = true)
	public native int iTermOffset();

	@Generated
	@StructureField(order = 3, isGetter = false)
	public native void setITermOffset(int value);
}


text:
package org.apache.dubbo.common.threadpool.support.limited;

import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.threadlocal.NamedInternalThreadFactory;
import org.apache.dubbo.common.threadpool.ThreadPool;
import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport;

import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Creates a thread pool that creates new threads as needed until limits reaches. This thread pool will not shrink
 * automatically.
 */
public class LimitedThreadPool implements ThreadPool {

    @Override
    public Executor getExecutor(URL url) {
        String name = url.getParameter(Constants.THREAD_NAME_KEY, Constants.DEFAULT_THREAD_NAME);
        int cores = url.getParameter(Constants.CORE_THREADS_KEY, Constants.DEFAULT_CORE_THREADS);
        int threads = url.getParameter(Constants.THREADS_KEY, Constants.DEFAULT_THREADS);
        int queues = url.getParameter(Constants.QUEUES_KEY, Constants.DEFAULT_QUEUES);
        return new ThreadPoolExecutor(cores, threads, Long.MAX_VALUE, TimeUnit.MILLISECONDS,
                queues == 0 ? new SynchronousQueue<Runnable>() :
                        (queues < 0 ? new LinkedBlockingQueue<Runnable>()
                                : new LinkedBlockingQueue<Runnable>(queues)),
                new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url));
    }

}


text:
package org.kie.workbench.common.screens.social.hp.client.homepage.header;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import com.google.gwt.user.client.ui.IsWidget;
import org.uberfire.mvp.Command;
import org.uberfire.mvp.ParameterizedCommand;

@Dependent
public class HeaderPresenter {

    public View getView() {
        return view;
    }

    @Inject
    private View view;

    public interface View extends IsWidget {

        void setOnSelectCommand( ParameterizedCommand<String> onSelectCommand );

        void setViewAllCommand( Command viewAllCommand );

        void setNumberOfItemsLabel( String numberOfItemsLabel );

        void setUpdatesMenuList( List<String> items );
    }

    @PostConstruct
    public void setup() {
    }

    public void setOnSelectCommand( ParameterizedCommand onSelectCommand ) {
        view.setOnSelectCommand( onSelectCommand );
    }

    public void setNumberOfItemsLabel( String numberOfItemsLabel ) {
        view.setNumberOfItemsLabel( numberOfItemsLabel );
    }

    public void setUpdatesMenuList( List<String> items ) {
        view.setUpdatesMenuList( items );
    }

    public void setViewAllCommand( Command viewAllCommand ) {
        view.setViewAllCommand( viewAllCommand );
    }

}


text:
class AddStatusIndexToSubmissions < ActiveRecord::Migration
  def change
    add_index :submissions, :status
  end
end


text:
======================
rustle1314/Joint_Learning_Predictions_as_Features_for_Multi_Label_Classification
======================

Run
------------
bash jcc.sh data_dir

Contributors
------------
- `lietal <https://github.com/rustle1314>`_i


text:
<?php
/**
 * Created by PhpStorm.
 * User: luoxiaojun
 * Date: 15/11/13
 * Time: 下午10:01
 * Lb framework css asset file
 */

namespace lb\components\assets;

use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use lb\BaseClass;
use lb\components\helpers\HashHelper;
use lb\Lb;

class Css extends BaseClass
{
    public static function dump($css_files)
    {
        $css_assets = [];
        foreach ($css_files as $css_file) {
            $css_assets[] = new FileAsset($css_file);
        }
        $css = new AssetCollection($css_assets);
        $css_html = $css->dump();
        $assets_cache_dir = Lb::app()->getRootDir() . DIRECTORY_SEPARATOR . 'web' . DIRECTORY_SEPARATOR . 'assets/css';
        if (!is_dir($assets_cache_dir)) {
            mkdir($assets_cache_dir, 0777, true);
        }
        $assets_cache_name = HashHelper::hash(Lb::app()->serialize($css_files));
        $assets_cache_path = $assets_cache_dir . DIRECTORY_SEPARATOR . $assets_cache_name;
        if (!file_exists($assets_cache_path)) {
            file_put_contents($assets_cache_path, $css_html);
        }
        return DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . $assets_cache_name;
    }
}


text:
#ifndef ADAPTIVEWATERLINE_HPP
#define ADAPTIVEWATERLINE_HPP

#include <iostream>
#include <string>
#include <vector>

#include <boost/foreach.hpp>

#include "waterline.hpp"
#include "fiber.hpp"

namespace ocl
{

class Span;

/// \brief a Waterline toolpath follows the shape of the model at a constant z-height in the xy-plane

class AdaptiveWaterline : public Waterline {
    public:
        /// create an empty Waterline object
        AdaptiveWaterline();
        virtual ~AdaptiveWaterline();
        /// set the minimum sampling interval
        void setMinSampling(double s) {min_sampling=s;}
        /// set the cosine limit for the flat() predicate
        void setCosLimit(double lim) {cosLimit=lim;}

        /// run the Waterline algorithm. setSTL, setCutter, setSampling, and setZ must
        /// be called before a call to run()
        void run();
        void run2();

        virtual void setSampling(double s) {
            sampling=s;
            min_sampling = sampling/10.0; // default to this when setMinSampling is not called
        }

    protected:
        /// adaptive waterline algorithm
        void adaptive_sampling_run();
        /// x-direction adaptive sampling
        void xfiber_adaptive_sample(const Span* span, double start_t, double stop_t, Fiber start_f, Fiber stop_f);
        /// y-direction adaptive sampling
        void yfiber_adaptive_sample(const Span* span, double start_t, double stop_t, Fiber start_f, Fiber stop_f);
        /// flatness predicate for fibers. Checks Fiber.size() and then calls flat() on cl-points
        bool flat( Fiber& start, Fiber& mid, Fiber& stop ) const;
        /// flatness predicate for cl-points. checks for angle metween start-mid-stop
        bool flat(Point start_cl, Point mid_cl, Point stop_cl) const;

    // DATA

        /// minimum x-coordinate
        double minx;
        /// maximum x-coordinate
        double maxx;
        /// minimum y-coordinate
        double miny;
        /// maximum y-coordinate
        double maxy;
        /// the minimum sampling interval when subdividing
        double min_sampling;
        /// the cosine limit value for cl-point flat(). In the constructor, cosLimit = 0.999 by default.
        double cosLimit;
};

} // end namespace

#endif


text:
<?php

/**
 * The Kirki_Fonts object.
 */
final class Kirki_Fonts {

	/**
	 * The mode we'll be using to add google fonts.
	 * This is a todo item, not yet functional.
	 *
	 * @static
	 * @todo
	 * @access public
	 * @var string
	 */
	public static $mode = 'link';

	/**
	 * Holds a single instance of this object.
	 *
	 * @static
	 * @access private
	 * @var null|object
	 */
	private static $instance = null;

	/**
	 * An array of our google fonts.
	 *
	 * @static
	 * @access public
	 * @var null|object
	 */
	public static $google_fonts = null;

	/**
	 * The class constructor.
	 */
	private function __construct() {}

	/**
	 * Get the one, true instance of this class.
	 * Prevents performance issues since this is only loaded once.
	 *
	 * @return object Kirki_Fonts
	 */
	public static function get_instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
		}
		return self::$instance;
	}

	/**
	 * Compile font options from different sources.
	 *
	 * @return array    All available fonts.
	 */
	public static function get_all_fonts() {
		$standard_fonts = self::get_standard_fonts();
		$google_fonts   = self::get_google_fonts();

		return apply_filters( 'kirki/fonts/all', array_merge( $standard_fonts, $google_fonts ) );
	}

	/**
	 * Return an array of standard websafe fonts.
	 *
	 * @return array    Standard websafe fonts.
	 */
	public static function get_standard_fonts() {
		$standard_fonts = array(
			'serif' => array(
				'label' => 'Serif',
				'stack' => 'Georgia,Times,"Times New Roman",serif',
			),
			'sans-serif' => array(
				'label'  => 'Sans Serif',
				'stack'  => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
			),
			'monospace' => array(
				'label' => 'Monospace',
				'stack' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace',
			),
		);
		return apply_filters( 'kirki/fonts/standard_fonts', $standard_fonts );
	}

	/**
	 * Return an array of backup fonts based on the font-category
	 *
	 * @return array
	 */
	public static function get_backup_fonts() {
		$backup_fonts = array(
			'sans-serif'  => 'Helvetica, Arial, sans-serif',
			'serif'       => 'Georgia, serif',
			'display'     => '"Comic Sans MS", cursive, sans-serif',
			'handwriting' => '"Comic Sans MS", cursive, sans-serif',
			'monospace'   => '"Lucida Console", Monaco, monospace',
		);
		return apply_filters( 'kirki/fonts/backup_fonts', $backup_fonts );
	}

	/**
	 * Return an array of all available Google Fonts.
	 *
	 * @return array    All Google Fonts.
	 */
	public static function get_google_fonts() {

		if ( null === self::$google_fonts || empty( self::$google_fonts ) ) {

			$fonts = include_once wp_normalize_path( dirname( __FILE__ ) . '/webfonts.php' );

			$google_fonts = array();
			if ( is_array( $fonts ) ) {
				foreach ( $fonts['items'] as $font ) {
					$google_fonts[ $font['family'] ] = array(
						'label'    => $font['family'],
						'variants' => $font['variants'],
						'subsets'  => $font['subsets'],
						'category' => $font['category'],
					);
				}
			}

			self::$google_fonts = apply_filters( 'kirki/fonts/google_fonts', $google_fonts );

		}

		return self::$google_fonts;

	}

	/**
	 * Dummy function to avoid issues with backwards-compatibility.
	 * This is not functional, but it will prevent PHP Fatal errors.
	 *
	 * @static
	 * @access public
	 */
	public static function get_google_font_uri() {}

	/**
	 * Returns an array of all available subsets.
	 *
	 * @static
	 * @access public
	 * @return array
	 */
	public static function get_google_font_subsets() {
		return array(
			'cyrillic'     => 'Cyrillic',
			'cyrillic-ext' => 'Cyrillic Extended',
			'devanagari'   => 'Devanagari',
			'greek'        => 'Greek',
			'greek-ext'    => 'Greek Extended',
			'khmer'        => 'Khmer',
			'latin'        => 'Latin',
			'latin-ext'    => 'Latin Extended',
			'vietnamese'   => 'Vietnamese',
			'hebrew'       => 'Hebrew',
			'arabic'       => 'Arabic',
			'bengali'      => 'Bengali',
			'gujarati'     => 'Gujarati',
			'tamil'        => 'Tamil',
			'telugu'       => 'Telugu',
			'thai'         => 'Thai',
		);
	}

	/**
	 * Returns an array of all available variants.
	 *
	 * @static
	 * @access public
	 * @return array
	 */
	public static function get_all_variants() {
		return array(
			'100'       => esc_attr__( 'Ultra-Light 100', 'kirki' ),
			'100light'  => esc_attr__( 'Ultra-Light 100', 'kirki' ),
			'100italic' => esc_attr__( 'Ultra-Light 100 Italic', 'kirki' ),
			'200'       => esc_attr__( 'Light 200', 'kirki' ),
			'200italic' => esc_attr__( 'Light 200 Italic', 'kirki' ),
			'300'       => esc_attr__( 'Book 300', 'kirki' ),
			'300italic' => esc_attr__( 'Book 300 Italic', 'kirki' ),
			'400'       => esc_attr__( 'Normal 400', 'kirki' ),
			'regular'   => esc_attr__( 'Normal 400', 'kirki' ),
			'italic'    => esc_attr__( 'Normal 400 Italic', 'kirki' ),
			'500'       => esc_attr__( 'Medium 500', 'kirki' ),
			'500italic' => esc_attr__( 'Medium 500 Italic', 'kirki' ),
			'600'       => esc_attr__( 'Semi-Bold 600', 'kirki' ),
			'600bold'   => esc_attr__( 'Semi-Bold 600', 'kirki' ),
			'600italic' => esc_attr__( 'Semi-Bold 600 Italic', 'kirki' ),
			'700'       => esc_attr__( 'Bold 700', 'kirki' ),
			'700italic' => esc_attr__( 'Bold 700 Italic', 'kirki' ),
			'800'       => esc_attr__( 'Extra-Bold 800', 'kirki' ),
			'800bold'   => esc_attr__( 'Extra-Bold 800', 'kirki' ),
			'800italic' => esc_attr__( 'Extra-Bold 800 Italic', 'kirki' ),
			'900'       => esc_attr__( 'Ultra-Bold 900', 'kirki' ),
			'900bold'   => esc_attr__( 'Ultra-Bold 900', 'kirki' ),
			'900italic' => esc_attr__( 'Ultra-Bold 900 Italic', 'kirki' ),
		);
	}

	/**
	 * Determine if a font-name is a valid google font or not.
	 *
	 * @static
	 * @access public
	 * @param string $fontname The name of the font we want to check.
	 * @return bool
	 */
	public static function is_google_font( $fontname ) {
		return ( array_key_exists( $fontname, self::$google_fonts ) );
	}

	/**
	 * Gets available options for a font.
	 *
	 * @static
	 * @access public
	 * @return array
	 */
	public static function get_font_choices() {
		$fonts = self::get_all_fonts();
		$fonts_array = array();
		foreach ( $fonts as $key => $args ) {
			$fonts_array[ $key ] = $key;
		}
		return $fonts_array;
	}
}


text:
extern crate msi_keyboard;
extern crate hidapi_rust;

use hidapi_rust::HidApi;
use msi_keyboard::{MSIKeyboard, Mode, Region, Color, Level};

fn main() {
    let api = HidApi::new().unwrap();
    let mut keyboard = MSIKeyboard::new(&api);

    keyboard.set_color(Region::Left, Color::Green, Level::High);
    keyboard.set_color(Region::Middle, Color::Yellow, Level::High);
    keyboard.set_color(Region::Right, Color::Red, Level::High);
}