text:
package cz.pojd.homeautomation.model.outdoor;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import mockit.Mocked;
import mockit.NonStrictExpectations;

import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Before;
import org.junit.Test;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.JdbcTemplate;

import cz.pojd.homeautomation.model.dao.StorageCleanup;
import cz.pojd.homeautomation.model.outdoor.factory.OutdoorFactory;
import cz.pojd.homeautomation.model.refresh.Refresher;
import cz.pojd.homeautomation.model.spring.OutdoorSpecification;
import cz.pojd.rpi.MockControl;
import cz.pojd.rpi.MockObservableSensor;
import cz.pojd.rpi.State;
import cz.pojd.rpi.controls.Control;
import cz.pojd.rpi.sensors.Reading;
import cz.pojd.rpi.sensors.Reading.Type;
import cz.pojd.rpi.sensors.Sensor;

public class OutdoorDAOImplTestCase {

    private static final String INSERT_SQL_STATEMENT = "insert SQL statement";

    private OutdoorDAOImpl dao;

    @Mocked
    private JdbcTemplate jdbcTemplate;
    private List<Sensor> sensors;
    @Mocked
    private Sensor sensor, sensor2;
    @Mocked
    private Refresher refresher;
    @Mocked
    private StorageCleanup storageCleanup;

    private Outdoor outdoor;
    private OutdoorDetail detail;

    private MockObservableSensor mockedLightSwitch, mockedMotionSensor;
    private Control mockControl;

    @Before
    public void setup() {
	mockedLightSwitch = new MockObservableSensor();
	mockedMotionSensor = new MockObservableSensor();
	mockControl = new MockControl();

	sensors = new ArrayList<>();
	sensors.add(sensor);

	detail = new OutdoorDetail();
	detail.setMotionSensor(State.newBuilder().build());
	detail.setLightControl(State.newBuilder().build());
	detail.setLightSwitch(State.newBuilder().build());

	outdoor = new Outdoor();
	outdoor.setSensors(sensors);
	outdoor.setMotionSensor(mockedMotionSensor);
	outdoor.setLightControl(mockControl);
	outdoor.setLightSwitch(mockedLightSwitch);
	outdoor.setLastDetail(detail);

	dao = new OutdoorDAOImpl(new OutdoorFactory() {
	    public Outdoor create(OutdoorSpecification outdoorSpecification) {
		return outdoor;
	    }
	}, new OutdoorSpecification(), storageCleanup);
	dao.setJdbcTemplate(jdbcTemplate);
	dao.setRefresher(refresher);
    }

    @Test
    public void testSaveStateNoReadingBeforeShouldNotCallJdbc() {
	new NonStrictExpectations() {
	    {
		jdbcTemplate.batchUpdate(anyString, withInstanceLike(new ArrayList<Object[]>()));
		times = 0;
	    }
	};
	dao.saveState(new Date());
    }

    @Test
    public void testSaveStateReadingsBeforeShouldCallJdbc() {
	detectState();

	new NonStrictExpectations() {
	    {
		jdbcTemplate.batchUpdate(withEqual(INSERT_SQL_STATEMENT), withArgThat(new BaseMatcher<List<Object[]>>() {
		    @Override
		    public boolean matches(Object item) {
			@SuppressWarnings("unchecked")
			List<Object[]> argsAll = (List<Object[]>) item;
			if (argsAll.size() != 1 || argsAll.get(0).length != 3) {
			    return false;
			}
			Object[] args = argsAll.get(0);
			if (!("pressure".equals(args[0]))) {
			    return false;
			}
			if (!(args[1] instanceof Date)) {
			    return false;
			}
			if (!(args[2] instanceof Double)) {
			    return false;
			}
			if (Double.compare(5., (Double) args[2]) != 0) {
			    return false;
			}

			return true;
		    }

		    @Override
		    public void describeTo(Description description) {
			description.appendText("with argument list that contains attributes of the outdoor ");
		    }
		}));
		times = 1;
	    }
	};

	dao.setInsertSql(INSERT_SQL_STATEMENT);
	dao.saveState(new Date());
    }

    @Test
    public void testSaveStateInvalidReadingsSHouldNotCallJdbc() {
	new NonStrictExpectations() {
	    {
		sensor.readAll();
		result = Collections.singletonList(Reading.invalid(Type.pressure));
		times = 1;

		jdbcTemplate.batchUpdate(anyString, (BatchPreparedStatementSetter) any);
		maxTimes = 0;
	    }
	};

	dao.detectState();
	dao.setInsertSql(INSERT_SQL_STATEMENT);
	dao.saveState(new Date());
    }

    @Test
    public void testDetectStateShouldReadAllSensors() {
	sensors.add(sensor2);
	new NonStrictExpectations() {
	    {
		sensor.readAll();
		result = Collections.singletonList(Reading.newBuilder().doubleValue(5).type(Type.pressure).build());
		times = 1;

		sensor2.readAll();
		result = Collections.singletonList(Reading.newBuilder().doubleValue(50).type(Type.humidity).build());
		times = 1;
	    }
	};
	dao.detectState();

	// just confirm the readings got there (values checked in different method)
	assertEquals(2, dao.get().getSensorReadings().size());
    }

    @Test
    public void testGetNoStateDetectedShouldGetNoReadings() {
	OutdoorDetail outdoorDetail = dao.get();

	assertNotNull(outdoorDetail.getSensorReadings());
	assertTrue(outdoorDetail.getSensorReadings().isEmpty());
    }

    @Test
    public void testGetStateDetectedShouldReturnOK() {
	detectState();

	OutdoorDetail outdoorDetail = dao.get();
	Collection<Reading> list = outdoorDetail.getSensorReadings();
	assertEquals(1, list.size());
	Reading r = list.iterator().next();
	assertEquals(5., r.getDoubleValue(), 0.001);
	assertEquals("5.00Pa", r.getStringValue());
	assertEquals(Type.pressure, r.getType());
    }

    @Test
    public void testGetShouldReturnLastValidReadings() {
	new NonStrictExpectations() {
	    {
		sensor.readAll();
		returns(Collections.singletonList(Reading.newBuilder().doubleValue(5).type(Type.pressure).units("Pa").build()),
			Collections.singletonList(Reading.invalid(Type.pressure)));
		times = 2;
	    }
	};
	dao.detectState();
	dao.detectState();

	OutdoorDetail outdoorDetail = dao.get();
	Collection<Reading> list = outdoorDetail.getSensorReadings();
	assertEquals(1, list.size());
	Reading r = list.iterator().next();
	assertEquals(5., r.getDoubleValue(), 0.001);
	assertEquals("5.00Pa", r.getStringValue());
	assertEquals(Type.pressure, r.getType());
    }

    @Test
    public void testGetShouldHaveLightDetailsSet() {
	detectState();

	OutdoorDetail outdoorDetail = dao.get();
	assertNotNull(outdoorDetail);
	assertNotNull(outdoorDetail.getMotionSensor());
	assertNotNull(outdoorDetail.getLightControl());
	assertNotNull(outdoorDetail.getLightSwitch());
    }

    @Test
    public void testSaveMotionSensorOn() {
	detectState();
	detail.setMotionSensor(State.newBuilder().enabled(true).build());
	dao.save(detail);

	assertNotNull(dao.get().getMotionSensor());
	assertEquals(true, dao.get().getMotionSensor().isEnabled());
    }

    @Test
    public void testSaveMotionSensorOff() {
	detectState();
	detail.setMotionSensor(State.newBuilder().enabled(false).build());
	dao.save(detail);

	assertNotNull(dao.get().getMotionSensor());
	assertEquals(false, dao.get().getMotionSensor().isEnabled());
    }

    @Test
    public void testSaveShouldChangeLightControlAndSwitchToo() {
	detectState();
	detail.setMotionSensor(State.newBuilder().enabled(true).build());
	detail.setLightControl(State.newBuilder().enabled(true).switchedOn(true).build());
	detail.setLightSwitch(State.newBuilder().enabled(true).build());
	dao.save(detail);

	assertEquals(true, dao.get().getMotionSensor().isEnabled());
	assertEquals(true, dao.get().getLightControl().isEnabled());
	// for light control we are storing state too, not only enabling/disabling
	assertEquals(true, dao.get().getLightControl().isSwitchedOn());
	assertEquals(true, dao.get().getLightSwitch().isEnabled());
    }

    @Test
    public void testSaveShouldChangeOutdoorToo() {
	detectState();
	detail.setMotionSensor(State.newBuilder().enabled(true).build());
	detail.setLightControl(State.newBuilder().enabled(true).switchedOn(true).build());
	detail.setLightSwitch(State.newBuilder().enabled(true).build());
	dao.save(detail);

	detectState();

	assertEquals(true, dao.get().getMotionSensor().isEnabled());
	assertEquals(true, dao.get().getLightControl().isEnabled());
	// for light control we are storing state too, not only enabling/disabling
	assertEquals(true, dao.get().getLightControl().isSwitchedOn());
	assertEquals(true, dao.get().getLightSwitch().isEnabled());
    }

    @Test
    public void testGetWithHistoryNoGraphData() {
	detectState();

	new NonStrictExpectations() {
	    {
		jdbcTemplate.queryForList(anyString, any);
		result = new ArrayList<>();
	    }
	};
	OutdoorDetail detail = dao.getWithHistory();
	assertNotNull(detail.getOutdoorHistory());
	assertEquals(3, detail.getOutdoorHistory().length);
	assertNotNull(detail.getOutdoorHistory()[0].getValues());
	assertEquals(0, detail.getOutdoorHistory()[0].getValues().length);
    }

    @Test
    public void testGetWithHistorySomeGraphData() {
	detectState();

	final Map<String, Object> row = new HashMap<String, Object>();
	row.put("at", new Date());
	row.put("reading", 28.);
	row.put("name", Type.temperature.toString());

	final Map<String, Object> rowInvalid = new HashMap<String, Object>();
	rowInvalid.put("at", new Date());
	rowInvalid.put("reading", 28.);
	rowInvalid.put("name", "bad type");

	new NonStrictExpectations() {
	    {
		jdbcTemplate.queryForList(anyString, (Object[]) any);
		returns(Arrays.asList(row, rowInvalid), new ArrayList<>());
	    }
	};
	OutdoorDetail detail = dao.getWithHistory();
	assertNotNull(detail.getOutdoorHistory());
	assertEquals(3, detail.getOutdoorHistory().length);
	assertNotNull(detail.getOutdoorHistory()[0].getValues());
	assertEquals(1, detail.getOutdoorHistory()[0].getValues().length);
	assertEquals(2, detail.getOutdoorHistory()[0].getValues()[0].length);
	assertEquals(28., (double) detail.getOutdoorHistory()[0].getValues()[0][1], 0.001);
    }

    @Test(expected = OutdoorDAOException.class)
    public void testGetWithHistoryGraphDataSqlError() {
	detectState();

	new NonStrictExpectations() {
	    {
		jdbcTemplate.queryForList(anyString, (Object[]) any);
		result = new RuntimeException("Some error ocurred while calling JDBC here...");
	    }
	};
	dao.getWithHistory();
    }

    private void detectState() {
	new NonStrictExpectations() {
	    {
		sensor.readAll();
		result = Collections.singletonList(Reading.newBuilder().doubleValue(5).type(Type.pressure).units("Pa").build());
		times = 1;
	    }
	};

	// we do want to test getAll in isolation - we could call refresh here, but the tests would be too dependent on each other then, so we use the
	// fact the below is protected
	dao.detectState();
    }
}


text:
<?php

class GearPage extends Page {
   static $db = array(
   'City' => "Enum('Auckland, Hamilton, Tauranga, Taupo, Wellington, Christchurch, Dunedin, Palmerston North  ')",
   'buy' => 'Boolean',
   'sell' => 'Boolean',
   'hire' => 'Boolean',
   'open' => 'text',
   'lat' => 'Text',
   'lng' => 'Text',
   'StreetAddress' => 'Text',
   'Contact' => 'Text',
);

   static $has_one = array(
   	'Image' => 'Image'
   );

	function getCMSFields() {
   		$fields = parent::getCMSFields();
   		$fields->addFieldToTab('Root.Content.Main', new TextField('lat','lat'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new TextField('lng','lng'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new TextField('StreetAddress','Street address'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new TextField('Contact','Contact details'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new DropdownField(
   		   		  			'City',
   		   		  			'City',
   		singleton('GearPage')->dbObject('City')->enumValues()
   		), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new TextField('open','trading hours'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new CheckBoxField('buy','company buys goods'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new CheckBoxField('sell','company sells goods'), 'Content');
   		$fields->addFieldToTab('Root.Content.Main', new CheckBoxField('hire','company hires goods'), 'Content');
		$fields->addFieldToTab('Root.Content.Main', new ImageField('Image', 'Image'), 'Content');
   		return $fields;
	}
}

class GearPage_Controller extends Page_Controller {
	public static $allowed_actions = array (
	);

	public function init() {
		parent::init();
		Requirements::javascript('mysite/javascript/jquery.js');
		Requirements::javascript('http://maps.google.com/maps/api/js?sensor=false');
		Requirements::javascriptTemplate('mysite/javascript/GearMap.js', array(
				'lat' => $this->lat,
				'lng' => $this->lng
		));
	}
}

?>

redpajama_set_name: RedPajamaGithub


text:
package com.challengers.trackmyorder;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.challengers.trackmyorder.util.Constants;

public class LoginActivity extends AppCompatActivity {
    EditText userIdEditText,userPassEditText;
    String userName,userPass, loginType;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_dboy);
        setTitle("Login");
        userIdEditText = (EditText) findViewById(R.id.userName);
        userPassEditText = (EditText) findViewById(R.id.userPass);

        loginType = getIntent().getStringExtra(Constants.LOGINTYPE);
    }

    public void doLogin(View v){
        userName = userIdEditText.getText().toString();
        userPass = userPassEditText.getText().toString();
        String usernameString = "delboy1";
        if(loginType.equals("D")) {
            if (userName.equals(usernameString) && userPass.equals("d")) {
                Intent intent = new Intent(this, DboyActivity.class);
                intent.putExtra(Constants.CURRENT_DELBOY, usernameString);
                startActivity(intent);
            } else {
                Toast.makeText(this, "Wrong Username or Password", Toast.LENGTH_SHORT).show();
            }
        } else {
            String userId = "kalyan123";
            if (userName.equals(userId) && userPass.equals("k")) {
                Intent intent = new Intent(this, ShowUserOrdersActivity.class);
                intent.putExtra(Constants.CURRENT_USER, userId);
                startActivity(intent);
            } else {
                Toast.makeText(this, "Wrong Username or Password", Toast.LENGTH_SHORT).show();
            }
        }

    }
}


text:
import { IRayConf } from './interfaces';

/**
 * This is default config used in castRays()
 */
export const defaultConfig: IRayConf = {
    rayCount: 256,
    fov: (Math.PI/2),
    fisheye: false,
    center: true
};


text:
package com.gooddata.md;

import com.gooddata.util.GoodDataToStringBuilder;

/**
 * Metadata query restriction. See static factory methods to get instance of desired restriction type.
 */
public class Restriction {

    private final Type type;

    private final String value;

    private Restriction(Type type, String value) {
        this.type = type;
        this.value = value;
    }

    public Type getType() {
        return type;
    }

    public String getValue() {
        return value;
    }

    /**
     * Construct a new instance with restriction type identifier and given value.
     *
     * @param value identifier you want to search for
     * @return new restriction for identifier restriction
     */
    public static Restriction identifier(String value) {
        return new Restriction(Type.IDENTIFIER, value);
    }

    /**
     * Construct a new instance with restriction type title and given value.
     *
     * @param value title you want to search for
     * @return new restriction for title restriction
     */
    public static Restriction title(String value) {
        return new Restriction(Type.TITLE, value);
    }

    /**
     * Construct a new instance with restriction type summary and given value.
     *
     * @param value summary you want to search for
     * @return new restriction for summary restriction
     */
    public static Restriction summary(String value) {
        return new Restriction(Type.SUMMARY, value);
    }

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

    enum Type {
        IDENTIFIER, TITLE, SUMMARY
    }
}


text:
var ListView=NFView.extend({
    _name: "list_view",
    events: {
        "click .search-btn": "click_search",
        "click ul.nav-tabs a": "click_tab"
    },

    initialize: function(options) {
        //log("list_view.initialize",this);
        var that=this;
        NFView.prototype.initialize.call(this,options);
        if (!this.options.model) throw "ListView: missing model";
        if (this.options.list_layout) {
            var layout=this.options.list_layout;
        } else {
            if (this.options.view_xml) {
                var list_view=get_xml_layout({name:this.options.view_xml});
            } else {
                var list_view=get_xml_layout({model:this.options.model,type:"list"});
            }
            var layout=list_view.layout;
        }
        if (_.isString(layout)) {
            var doc=$.parseXML(layout);
            this.$list=$(doc).children();
        } else {
            this.$list=layout;
        }
        this.data.colors=this.$list.attr("colors");
        this.data.render_list_head=function(ctx) { return that.render_list_head.call(that,ctx); };
        this.data.render_list_top=function(ctx) { return that.render_list_top.call(that,ctx); };
        this.data.on_click_item=_.bind(this.on_click_item,this);
        if (this.options.tabs) {
            var tabs=this.options.tabs;
            if (_.isString(tabs)) {
                var tabs=JSON.parse(tabs);
            }
            this.data.tabs=[];
            var tab_no=0;
            _.each(tabs,function(tab) {
                that.data.tabs.push({
                    string: tab[0],
                    condition: tab[1],
                    tab_no: tab_no,
                    action: that.options.action_name,
                    action_opts: (tab[0]!="All"&&tab[0]!="Active")?"tab="+tab[0]:"" // XXX
                });
                tab_no++;
            });
            //log("tabs",this.data.tabs);
        }
        this.modes=this.options.modes;
        if (!this.modes) this.modes="list,form";
        if (_.isString(this.modes)) {
            this.modes=this.modes.split(",");
        }
        this.search_condition=this.options.search_condition;
        if (this.options.reload_event) {
            nf_listen(this.options.reload_event,function() {
                log("reload view",this);
                that.render();
            });
        }
        this.active_id=this.options.active_id;
        this.tab_no=parseInt(this.options.tab_no);
    },

    render: function() {
        //log("list_view.render",this);
        var that=this;
        var model_name=this.options.model;
        var field_names=[];
        var cols=[];
        this.data.noselect=this.options.noselect || this.$list.attr("noselect");
        this.$list.children().each(function() {
            var tag=$(this).prop("tagName");
            if (tag=="field") {
                var name=$(this).attr("name");
                var field=get_field(that.options.model,name);
                field_names.push(name);
                if (!$(this).attr("invisible")) {
                    var col={
                        col_type: "field",
                        name: name,
                        link: $(this).attr("link"),
                        target: $(this).attr("target"),
                        preview: $(this).attr("preview"),
                        view: $(this).attr("view")
                    };
                    if (field.type=="float") {
                        col.align="right";
                    }
                    if (field.store) {
                        col.can_sort=true;
                    }
                    cols.push(col);
                }
            } else if (tag=="button") {
                var col={
                    col_type: "button",
                    string: $(this).attr("string"),
                    method: $(this).attr("method"),
                    type: $(this).attr("type"),
                    icon: $(this).attr("icon")
                }
                cols.push(col);
            }
        });
        this.data.cols=cols;
        var model=get_model_cls(model_name);
        var condition=this.options.condition||[];
        if (_.isString(condition)) {
            var ctx=clean_context(_.extend({},this.context,this.options));
            condition=eval_json(condition,ctx);
        }
        var search_condition=this.search_condition||[];
        if (_.isString(search_condition)) {
            search_condition=JSON.parse(search_condition);
        }
        if (search_condition.length>0) {
            if (condition.length>0) {
                condition=[condition,search_condition];
            } else {
                condition=search_condition;
            }
        }
        var tab_condition=null;
        if (this.options.tabs) {
            var tabs=this.options.tabs;
            if (_.isString(tabs)) {
                tabs=JSON.parse(tabs);
            }
            var tab_no=this.tab_no||0;
            var tab=tabs[tab_no];
            var tab_condition=tab[1];
            if (_.isObject(tab_condition)) {
                condition=condition.concat(tab_condition);
            }
        }
        if (!_.isString(tab_condition)) {
            this.data.show_list=true;
        } else {
            this.data.show_list=false;
        }
        var opts={
            field_names: field_names,
            order: this.options.order,
            offset: this.options.offset,
            limit: this.options.limit||100,
            count: true
        }
        if (that.options.show_full) {
            this.data.header_scroll=true;
        }
        if (!_.isString(tab_condition)) {
            this.render_waiting();
            rpc_execute(model_name,"search_read",[condition],opts,function(err,data) {
                that.collection=new NFCollection(data[0],{name:model_name});
                that.collection.fields=field_names;
                that.collection.condition=condition;
                that.collection.order=that.options.order;
                that.collection.search_condition=condition; // XXX: check this
                if (that.options.show_full||that.options.show_pagination) { // FIXME
                    that.collection.count=data[1];
                    that.collection.offset=parseInt(that.options.offset);
                    that.collection.limit=that.options.limit||100;
                }
                that.collection.on("click",that.line_click,that);
                that.collection.on("reload",that.reload,that);
                that.data.context.data=data;
                that.data.context.collection=that.collection;
                that.data.context.model=null; // XXX
                if (that.$list.attr("group_fields")) {
                    that.data.group_fields=that.$list.attr("group_fields").split(",");
                }
                that.data.active_id=that.active_id;
                NFView.prototype.render.call(that);
                if (that.search_condition) {
                    that.show_search();
                }
                that.show_active_tab();
            });
        } else {
            NFView.prototype.render.call(this);
            this.show_active_tab();
            var action_name=tab_condition;
            var action=get_action(action_name);
            var view_cls=get_view_cls(action.view_cls||"action");
            var view=new view_cls({options:action});
            view.render();
            this.$el.append(view.el);
        }
        return this;
    },

    reload: function() {
        this.render();
    },

    render_waiting: function() {
        var img=$("").attr("src","/static/img/spinner.gif");
        this.$el.empty();
        this.$el.append(img);
    },

    render_list_head: function(context) {
        //log("list_view.render_list_head",this,context);
        var that=this;
        var html=$("
");
        if ((this.options.show_full || this.options.show_search) && !this.$list.attr("no_search")) { // XXX
            if (_.isEmpty(this.options.search_condition)) {
                html.append('<button type="button" class="btn btn-sm btn-default pull-right search-btn" style="white-space:nowrap;"> Search</button>');
            }
        }
        if (this.options.show_full||this.options.show_default_buttons) { // XXX
            if (!this.$list.find("head").attr("replace")) {
                if (check_model_permission(this.options.model,"delete")) {
                    var opts={
                        string: "Delete",
                        type: "danger",
                        size: "small",
                        method: "_delete",
                        context: context
                    };
                    var view=Button.make_view(opts);
                    html.append("

");
                }
                if (has_field(this.options.model,"active") && check_model_permission(this.options.model,"write"))  {
                    var show_archived=false;
                    if (this.options.tabs) {
                        var tabs=this.options.tabs;
                        if (_.isString(tabs)) {
                            tabs=JSON.parse(tabs);
                        }
                        var tab_no=this.tab_no||0;
                        var tab=tabs[tab_no];
                        show_archived=tab[0]=="Archived"; // XXX
                    }
                    if (show_archived) {
                        var opts={
                            string: "Restore",
                            size: "small",
                            method: "_restore",
                            context: context
                        };
                    } else {
                        var opts={
                            string: "Archive",
                            size: "small",
                            method: "_archive",
                            context: context
                        };
                    }
                    var view=Button.make_view(opts);
                    html.append("

");
                }
                var opts={
                    string: "Export",
                    size: "small",
                    method: "_export2",
                    context: context
                };
                var view=Button.make_view(opts);
                html.append("

");
            }
        }
        this.$list.find("head").children().each(function() {
            var $el=$(this);
            var tag=$el.prop("tagName");
            if (tag=="button") {
                var opts={
                    string: $el.attr("string"),
                    method: $el.attr("method"),
                    action: $el.attr("action"),
                    action_options: $el.attr("action_options"),
                    size: $el.attr("size")||"small",
                    type: $el.attr("type"),
                    next: $el.attr("next"),
                    icon: $el.attr("icon"),
                    perm: $el.attr("perm"),
                    confirm: $el.attr("confirm"),
                    context: context
                };
                if (!$el.attr("noselect")) {
                    opts.select=true;
                }
                var view=Button.make_view(opts);
                html.append("

");
            }
        });
        return html.html();
    },

    render_list_top: function(context) {
        //log("list_view.render_list_top",this,context);
        var that=this;
        var html=$("
");
        if (!this.$list.find("top").attr("replace")) {
            if (check_model_permission(this.options.model,"create")) {
                var new_string="New";
                var model_cls=get_model(this.options.model);
                model_string=this.options.model_string||model_cls.string;
                if (model_string) {
                    new_string+=" "+model_string;
                }
                var opts={
                    string: new_string,
                    onclick: function() { that.trigger("change_mode",{mode:"form"}); },
                    icon: "plus-sign",
                    context: context
                };
                var view=Button.make_view(opts);
                html.append("

");
                var opts={
                    string: "Import",
                    action: "import_data",
                    action_options: "import_model="+that.options.model+"&next="+this.options.action_name,
                    icon: "download",
                    context: that.data.context
                };
                var view=Button.make_view(opts);
                html.append("

");
            }
        }
        this.$list.find("top").children().each(function() {
            var $el=$(this);
            var tag=$el.prop("tagName");
            if (tag=="button") {
                var opts={
                    string: $el.attr("string"),
                    model: that.options.model,
                    method: $el.attr("method"),
                    static_method: true,
                    action: $el.attr("action"),
                    action_options: $el.attr("action_options"),
                    size: $el.attr("size"),
                    type: $el.attr("type"),
                    next: $el.attr("next"),
                    icon: $el.attr("icon"),
                    perm: $el.attr("perm"),
                    dropdown: $el.attr("dropdown"),
                    context: context
                };
                if (opts.dropdown) {
                    var inner="";
                    $el.children().each(function() {
                        var $el2=$(this);
                        var tag=$el2.prop("tagName");
                        if (tag=="item") {
                            var opts2={
                                string: $el2.attr("string"),
                                method: $el2.attr("method"),
                                static_method: true,
                                action: $el2.attr("action"),
                                action_options: $el2.attr("action_options"),
                                perm: $el2.attr("perm"),
                                context: context
                            }
                            var view=Item.make_view(opts2);
                            inner+="

";
                        } else if (tag=="divider") {
                            inner+="

";
                        }
                    });
                    opts.inner=function() {return inner; };
                    var view=ButtonGroup.make_view(opts);
                } else {
                    var view=Button.make_view(opts);
                }
                html.append("

");
            }
        });
        if (_.contains(this.modes,"grid")) {
            var opts={
                string: "Grid",
                icon: "th",
                pull: "right",
                onclick: function() { that.trigger("change_mode",{"mode":"grid"}); },
                context: context
            };
            var view=Button.make_view(opts);
            html.append("

");
        }
        if (_.contains(this.modes,"calendar")) {
            var opts={
                string: "Calendar",
                icon: "calendar",
                pull: "right",
                onclick: function() { that.trigger("change_mode",{"mode":"calendar"}); },
                context: context
            };
            var view=Button.make_view(opts);
            html.append("

");
        }
        return html.html();
    },

    line_click: function(model) {
        log("list_view.line_click",this,model);
        if (this.options.no_click) return;
        if (this.$list.attr("action")) {
            var action={name:this.$list.attr("action")};
            if (this.$list.attr("action_options")) {
                var action_options=qs_to_obj(this.$list.attr("action_options"));
                _.extend(action,action_options);
            }
            action.active_id=model.id;
            if (this.tab_no) {
                action.tab_no=this.tab_no;
            }
            if (this.search_condition) {
                action.search_condition=this.search_condition;
            }
            if (this.collection.offset) {
                action.offset=this.collection.offset;
            }
        } else if (this.options.action) {
            var action={name:this.options.action};
            if (this.options.action_options) {
                _.extend(action,this.options.action_options);
            }
            action.active_id=model.id;
            if (this.search_condition) {
                action.search_condition=this.search_condition; // XXX
            }
            if (this.tab_no) {
                action.tab_no=this.tab_no; // XXX: simplify this
            }
            if (this.collection.offset) {
                action.offset=this.collection.offset; // XXX: simplify this
            }
        } else if (_.contains(this.modes,"form")) {
            var action=find_details_action(this.options.model,model.id);
        }
        exec_action(action);
    },

    click_search: function(e) {
        e.preventDefault();
        e.stopPropagation();
        this.show_search();
    },

    show_search: function(e) {
        log("list_view.show_search");
        var that=this;
        var opts={
            model: this.options.model
        };
        if (this.options.search_view_xml) {
            opts.view_xml=this.options.search_view_xml;
        } else if (this.options.search_layout) {
            opts.view_layout=this.options.search_layout;
        }
        var $el=this.$list.find("search");
        if ($el.length>0) {
            opts.view_layout=$el;
        }
        var view=new SearchView({options:opts});
        if (that.search_condition) {
            view.set_condition(that.search_condition);
        }
        view.render();
        this.$el.find(".search-btn").hide();
        this.$el.find(".search").append(view.el);
        view.on("close",function() {
            that.$el.find(".search-btn").show();
        });
        view.on("search",function() {
            that.search_condition=view.get_condition();
            that.collection.offset=0;
            that.render();

            var h=window.location.hash.substr(1);
            var action=qs_to_obj(h);
            action.search_condition=that.search_condition;
            if (_.isEmpty(action.search_condition)) delete action.search_condition;
            if (action.offset) delete action.offset;
            var h2=obj_to_qs(action);
            workspace.navigate(h2);
        });
    },

    click_tab: function(e) {
        log("list_view.click_tab",this,e);
        e.preventDefault();
        var tab_no=$(e.target).parent("li").data("tab");
        log("tab_no",tab_no);
        this.tab_no=tab_no;
        this.search_condition=null;
        this.active_id=null;
        this.render();

        var h=window.location.hash.substr(1);
        var action=qs_to_obj(h);
        action.tab_no=tab_no;
        if (action.search_condition) delete action.search_condition;
        if (action.active_id) delete action.active_id;
        if (action.offset) delete action.offset;
        var h2=obj_to_qs(action);
        workspace.navigate(h2);
    },

    show_active_tab: function() {
        var tab_no=this.tab_no||0;
        this.$el.find("li[data-tab="+tab_no+"]").addClass("active");
    },

    get_selected_ids: function() {
        var ids=[];
        this.$el.find(".list-line-select input:checked").each(function() {
            var id=$(this).closest("tr").data("model-id");
            ids.push(id);
        });
        return ids;
    },

    on_click_item: function(model_id) {
        this.trigger("click_item",{active_id:model_id});
    }
});

ListView.register();


text:
/**
 * Class {{ $config->modelNames->name }}APIController
 */


text:
Ideas?

That's what we live for.

                                Wix is an online website builder with a simple drag & drop interface, meaning you do the work online and instantly publish to the web. Try It Now!Don't worry it's for free

Design With Simplicity.

                                You can replace all this text with your own text. Want an easier solution for a Free Website?

                                Head straight to Wix and immediately start customizing your website!

                                Wix is an online website builder with a simple drag & drop interface, meaning you do the work online and instantly publish to the web.

                                You can replace all this text with your own text. Want an easier solution for a Free Website?

                                Head straight to Wix and immediately start customizing your website!

                                Wix is an online website builder with a simple drag & drop interface, meaning you do the work online and instantly publish to the web.


text:
import java.util.*;

public class Main {
  public void testOptional(Optional<String> str) {
    if (str == null) str = Optional.empty();
      str.ifPresent(System.out::println);
  }
}


text:
const { Command } = require('../../cjs/index.cjs');

module.exports = class BuildCommand extends Command {
	static path = 'build';

	static aliases = ['make'];

	static description = 'Build a project';

	static deprecated = true;

	async run() {
		//
	}
};


text:
package org.beyene.protege.processor.atom;

import java.nio.ByteBuffer;

import org.beyene.protege.core.encoding.Encoding;
import org.beyene.protege.core.encoding.FloatEncoding;
import org.beyene.protege.core.data.Primitive;

class FloatProcessor implements AtomProcessor<Float> {

    private static final int MAX_BYTES = 4;

    @Override
    public Primitive<Float> getPrimitive() {
	return Primitive.FLOAT;
    }

    @Override
    public Float interpret(byte[] bytes, Encoding<Float> encoding) {
	ByteBuffer bb = ByteBuffer.allocate(MAX_BYTES);
	// bb.order(ByteOrder.LITTLE_ENDIAN);
	// bb.position(MAX_BYTES - bytes.length);

	if (encoding != FloatEncoding.IEEE_754_SINGLE
		&& bytes.length != MAX_BYTES)
	    throw new IllegalArgumentException(
		    "Only IEEE 754 single precision encoding supported for type float!");

	bb.put(bytes);
	bb.position(0);

	return Float.intBitsToFloat(bb.asIntBuffer().get());
    }

    @Override
    public byte[] toBytes(Float element, Encoding<Float> encoding, int bytes) {
	ByteBuffer bb = ByteBuffer.allocate(MAX_BYTES);
	// bb.order(ByteOrder.LITTLE_ENDIAN);
	bb.putInt(Float.floatToIntBits(element));

	if (encoding != FloatEncoding.IEEE_754_SINGLE)
	    throw new IllegalArgumentException(
		    "Only IEEE 754 single precision encoding supported for type float!");

	bb.position(bb.limit() - MAX_BYTES);
	byte[] encoded = new byte[MAX_BYTES];
	bb.get(encoded);

	assert interpret(encoded, encoding).equals(element) : "Encoded bytes are invalid!";

	return encoded;
    }
}


text:
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/ec2/model/TrafficMirrorSession.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Xml
{
  class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
  class AWS_EC2_API CreateTrafficMirrorSessionResponse
  {
  public:
    CreateTrafficMirrorSessionResponse();
    CreateTrafficMirrorSessionResponse(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
    CreateTrafficMirrorSessionResponse& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);

    /**
     *
Information about the Traffic Mirror session.

     */
    inline const TrafficMirrorSession& GetTrafficMirrorSession() const{ return m_trafficMirrorSession; }

    /**
     *
Information about the Traffic Mirror session.

     */
    inline void SetTrafficMirrorSession(const TrafficMirrorSession& value) { m_trafficMirrorSession = value; }

    /**
     *
Information about the Traffic Mirror session.

     */
    inline void SetTrafficMirrorSession(TrafficMirrorSession&& value) { m_trafficMirrorSession = std::move(value); }

    /**
     *
Information about the Traffic Mirror session.

     */
    inline CreateTrafficMirrorSessionResponse& WithTrafficMirrorSession(const TrafficMirrorSession& value) { SetTrafficMirrorSession(value); return *this;}

    /**
     *
Information about the Traffic Mirror session.

     */
    inline CreateTrafficMirrorSessionResponse& WithTrafficMirrorSession(TrafficMirrorSession&& value) { SetTrafficMirrorSession(std::move(value)); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline const Aws::String& GetClientToken() const{ return m_clientToken; }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(const Aws::String& value) { m_clientToken = value; }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(Aws::String&& value) { m_clientToken = std::move(value); }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline void SetClientToken(const char* value) { m_clientToken.assign(value); }

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorSessionResponse& WithClientToken(const Aws::String& value) { SetClientToken(value); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorSessionResponse& WithClientToken(Aws::String&& value) { SetClientToken(std::move(value)); return *this;}

    /**
     *
Unique, case-sensitive identifier that you provide to ensure the idempotency
     * of the request. For more information, see How
     * to ensure idempotency.

     */
    inline CreateTrafficMirrorSessionResponse& WithClientToken(const char* value) { SetClientToken(value); return *this;}

    inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }

    inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }

    inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }

    inline CreateTrafficMirrorSessionResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}

    inline CreateTrafficMirrorSessionResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}

  private:

    TrafficMirrorSession m_trafficMirrorSession;

    Aws::String m_clientToken;

    ResponseMetadata m_responseMetadata;
  };

} // namespace Model
} // namespace EC2
} // namespace Aws


text:
#include <common.h>
#include <spl.h>
#include <libfdt.h>
#include <nand.h>
#include <stdio.h>
#include <linux/io.h>
#include <linux/printk.h>
#include <../drivers/mtd/nand/denali.h>

#include "init.h"

static void nand_denali_wp_disable(void)
{
#ifdef CONFIG_NAND_DENALI
	/*
	 * Since the boot rom enables the write protection for NAND boot mode,
	 * it must be disabled somewhere for "nand write", "nand erase", etc.
	 * The workaround is here to not disturb the Denali NAND controller
	 * driver just for a really SoC-specific thing.
	 */
	void __iomem *denali_reg = (void __iomem *)CONFIG_SYS_NAND_REGS_BASE;

	writel(WRITE_PROTECT__FLAG, denali_reg + WRITE_PROTECT);
#endif
}

static int uniphier_set_fdt_file(void)
{
	DECLARE_GLOBAL_DATA_PTR;
	const char *compat;
	char dtb_name[256];
	int buf_len = sizeof(dtb_name);

	if (env_get("fdt_file"))
		return 0;	/* do nothing if it is already set */

	compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
	if (!compat)
		return -EINVAL;

	/* rip off the vendor prefix "socionext,"  */
	compat = strchr(compat, ',');
	if (!compat)
		return -EINVAL;
	compat++;

	strncpy(dtb_name, compat, buf_len);
	buf_len -= strlen(compat);

	strncat(dtb_name, ".dtb", buf_len);

	return env_set("fdt_file", dtb_name);
}

int board_late_init(void)
{
	puts("MODE:  ");

	switch (uniphier_boot_device_raw()) {
	case BOOT_DEVICE_MMC1:
		printf("eMMC Boot");
		env_set("bootmode", "emmcboot");
		break;
	case BOOT_DEVICE_NAND:
		printf("NAND Boot");
		env_set("bootmode", "nandboot");
		nand_denali_wp_disable();
		break;
	case BOOT_DEVICE_NOR:
		printf("NOR Boot");
		env_set("bootmode", "norboot");
		break;
	case BOOT_DEVICE_USB:
		printf("USB Boot");
		env_set("bootmode", "usbboot");
		break;
	default:
		printf("Unknown");
		break;
	}

	if (uniphier_have_internal_stm())
		printf(" (STM: %s)",
		       uniphier_boot_from_backend() ? "OFF" : "ON");

	printf("\n");

	if (uniphier_set_fdt_file())
		pr_warn("fdt_file environment was not set correctly\n");

	return 0;
}


text:
class WuNv : public PlayerEntity
{
public:
	WuNv(GameGrail *engine, int id, int color): PlayerEntity(engine, id, color){tap =false; tongShengID = -1;}
	bool cmdMsgParse(UserTask *session, uint16_t type, ::google::protobuf::Message *proto);
	int p_turn_begin(int &step, int currentPlayerID);
	int p_boot(int &step, int currentPlayerID);
	int p_timeline_4(int &step, CONTEXT_TIMELINE_4 *con);
	int p_hand_change(int &step, int playerID);
	int p_true_lose_morale(int &step, CONTEXT_LOSE_MORALE *con);
	int v_magic_skill(Action *action);
	int p_magic_skill(int &step, Action* action);
private:
	int TongShengQiangSi(int &step, Action* action);
	int XueZhiAiShang(int &step, int srcID);
	int XueZhiAiShangJudge(CONTEXT_TIMELINE_4 *con);
	int NiLiu(int &step, Action* action);
	int XueZhiBeiMing(Action* action);
	int XueZhiZuZhou(int &step, Action* action);
	int ToLiuXueXingTai(CONTEXT_LOSE_MORALE *context);
	int ToPuTongXingTai(int playerID);
	int LiuXue(int playerID);

	int tongShengID;
	int aiShangChoose=0;
	int aiShangDst;
};


text:
package org.apache.metamodel.data;

import org.apache.metamodel.insert.RowInsertionBuilder;
import org.apache.metamodel.schema.Column;
import org.apache.metamodel.schema.Table;
import org.apache.metamodel.update.RowUpdationBuilder;

/**
 * Abstract interface for objects that build rows, either for eg. insert or
 * update purposes.
 *
 * @see RowInsertionBuilder
 * @see RowUpdationBuilder
 *
 * @param <RB>
 *            the RowBuilder subtype, used for cascading return values
 */
public interface RowBuilder<RB extends RowBuilder<?>> {

    /**
     * Gets the table that this row builder pertains to.
     *
     * @return the table that this row builder pertains to.
     */
    public Table getTable();

    /**
     * Sets the value of a column, by column index
     *
     * @param columnIndex
     * @param value
     * @return
     */
    public RB value(int columnIndex, Object value);

    /**
     * Sets the value of a column, by column index
     *
     * @param columnIndex
     * @param value
     * @param style
     * @return
     */
    public RB value(int columnIndex, Object value, Style style);

    /**
     * Sets the value of a column
     *
     * @param column
     * @param value
     * @return
     */
    public RB value(Column column, Object value);

    /**
     * Sets the value of a column
     *
     * @param column
     * @param value
     * @param style
     * @return
     */
    public RB value(Column column, Object value, Style style);

    /**
     * Sets the value of a column, by column name
     *
     * @param columnName
     * @param value
     * @return
     */
    public RB value(String columnName, Object value);

    /**
     * Sets the value and the style of this value of a column, by column name
     *
     * @param columnName
     * @param value
     * @param style
     * @return
     */
    public RB value(String columnName, Object value, Style style);

    /**
     * Gets the built record represented as a {@link Row} object.
     *
     * @return a {@link Row} object as it will appear if committed and queried.
     */
    public Row toRow();

    /**
     * Determines if a column's value has been explicitly specified or not. This
     * can be used to tell explicit NULL values apart from just unspecified
     * values in a statement.
     *
     * @param column
     *            the column to check
     * @return true if the column's value has been set, or false if not
     */
    public boolean isSet(Column column);
}


text:
module load global/cluster

spherepath=$1
datapath=$2
resultspath=$3
homepath=$4

nb_spheres=`cat $resultspath/nb_spheres.txt`
for i in `seq $nb_spheres`;
do
	X=`awk "NR=="$i $resultspath/centresX.txt`
	Y=`awk "NR=="$i $resultspath/centresY.txt`
	Z=`awk "NR=="$i $resultspath/centresZ.txt`
	R=`awk "NR=="$i $resultspath/radii.txt`

	qsub -N job3 -pe smp 2 -j y -t $i -tc 10 $homepath/selector.sh $X $Y $Z $R $spherepath/sphere$i $datapath $homepath $resultspath
done


text:
import Ember from 'ember';

export default Ember.Component.extend({
  setupAutocomplete: function() {
    var $this = this;

    var autocomplete = UIkit.autocomplete(this.$('div.uk-autocomplete'), {
      template: '
{{~items}}
{{$item.name}}
{{$item.desc}}

{{/items}}
',

      source: function(release) {
        $this.sendAction('textEntered', $this.get('searchText'), release);
      },
    });

    this.$().on('selectitem.uk.autocomplete', function(eventObject, data) {
      $this.valueUpdater(data);
    });
  }.on('didInsertElement'),

  valueUpdater: function(data) {
    this.set('value', data.id);
  }.observes('searchText')
});


text:
package DDS;

public final class DataReaderHolder
{
  public DDS.DataReader value = null;

  public DataReaderHolder ()
  {
  }

}


text:
package com.deleidos.rtws.tools.repository;

import java.io.OutputStreamWriter;

import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;

import com.deleidos.rtws.commons.repository.tools.ContentDownloader;
import com.deleidos.rtws.commons.util.env.SystemEnvUtil;

/**
 * The driver of the ingest content downloader. The program reads from a config
 * file of all the content its interested in pulling from the repository and
 * than goes download them from the repository. This program was design to run
 * before ingest starts up pulling in all the required content that ingest
 * needs.
 */
public class IngestContentDownloader extends ContentDownloader {

	/** The log handler */
	private static final Logger log = Logger
			.getLogger(IngestContentDownloader.class);

	public IngestContentDownloader() {

	}

	/**
	 * Driver main method.
	 *
	 * @param args
	 *            Expects a xml configuration file when invoked.
	 */
	public static void main(String[] args) {

		// Added so that error messages can be written to the console.
		ConsoleAppender appender = new ConsoleAppender();
		appender.setWriter(new OutputStreamWriter(System.out));
		appender.setLayout(new PatternLayout("%-5p [%t]: %m%n"));
		log.addAppender(appender);

		if (SystemEnvUtil.isInApplianceMode()) {
			System.out.println("Running in appliance mode, bypassing content downloading...");
			System.exit(0);
		}

		if (args.length < 1) {
			System.err
					.println("Usage: java IngestServiceDownloader <xmlConfig>");
			System.exit(1);
		}

		if (!args[0].endsWith(".xml")) {
			System.err
					.println("Invalid input: Please enter the xml input file");
			System.exit(2);
		}

		String configFileName = args[0];
		Integer retryInterval = 5000;

		if (args.length > 1) {
			retryInterval = Integer.parseInt(args[1]) * 1000;
		}

		try {

			IngestContentDownloader client = new IngestContentDownloader();
			client.downloadRepositoryFiles(configFileName, retryInterval);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(3);
		}

	}

}


text:
package com.srikalyan.dnscache.api;

/**
 * Defines various useful methods to play with DNS cache.
 */
public interface Revoker {

    /**
     * Returns the {@link DNSCacheEntry} represented by the hostname in the {@link
     * java.net.InetAddress} cache.
     *
     * @param hostname - String representing the hostname whose cache entry is to be returned.
     * @return - {@link DNSCacheEntry} instance or null.
     */
    public DNSCacheEntry getDNSCacheEntry(String hostname);

    /**
     * Revokes the cache entry in the {@link java.net.InetAddress}.
     *
     * @param hostname - String representing the hostname whose cache entry is to be returned.
     * @return - true if there is an entry in the cache with the hostname and is removed otherwise
     *         false.
     */
    public boolean revokeDNSCacheEntry(String hostname);
}


text:
<?php

class Users_model extends CI_Model {

	function validate()
	{
		$this->db->where('username', $this->input->post('username'));
		$this->db->where('password', md5($this->input->post('password')));
		$queryusers = $this->db->get('users');

		if ($queryusers->num_rows == 1) //username and password validate
		{

			$row = $queryusers->row_array();

			$this->db->where('user_id', $row['user_id']);
			$this->db->order_by('rating_id', 'desc');
			$queryratings = $this->db->get('ratings');  //get ratings for this user_id

			if ($queryratings->num_rows > 0) // There are some ratings
			{

				$user_and_ratings = array(
					'ratings_array' => $queryratings->result_array(),
					'user_id' => $row['user_id'],
				);

				//Now return user id and ratings to the controller and render the view from this list!
				return $user_and_ratings;

			} else return false;

		}

	}

	function create_user()
	{

		// check to see if the username and/or email is taken if so return message ---- TO DO (MVP)

		//else create new user:

		$new_user_insert_data = array(
			'email_address' => $this->input->post('email_address'),
			'username' => $this->input->post('username'),
			'password' => md5($this->input->post('password'))
		);

		$insert = $this->db->insert('users', $new_user_insert_data);

		// Now get the new user_id to create default ratings:

		$this->db->where('username', $this->input->post('username'));
		$query_user_id = $this->db->get('users');

		if ($query_user_id->num_rows == 1) //we should only get back the row we just created
		{

			$row = $query_user_id->row_array();
			$new_user_id = $row['user_id'];

			return $new_user_id;

		}
	}
}


text:
package fi.jyffe.opentiku.targetservice.repository;

import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Collection;

public interface TargetRepository extends JpaRepository<Target, Long> {
	Collection<Target> findById(String id);
}


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license Informationrmation.

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Host.Config;
using Microsoft.Azure.WebJobs.Script.Scale;
using Microsoft.Azure.WebJobs.Script.WebHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Moq;
using Xunit;

namespace Microsoft.Azure.WebJobs.Script.Tests.Integration.Host
{
    public class WebJobsScriptHostServiceTests
    {
        private readonly WebJobsScriptHostService _scriptHostService;
        private readonly Mock<IScriptJobHostEnvironment> _mockJobHostEnvironment;
        private readonly TestFunctionHost _testHost;
        private readonly Collection<string> _exceededCounters = new Collection<string>();
        private readonly HostHealthMonitorOptions _healthMonitorOptions;
        private bool _underHighLoad;
        private bool _shutdownCalled;

        public WebJobsScriptHostServiceTests()
        {
            string testScriptPath = @"TestScripts\CSharp";
            string testLogPath = Path.Combine(TestHelpers.FunctionsTestDirectory, "Logs", Guid.NewGuid().ToString(), @"Functions");

            // configure the monitor so it will fail within a couple seconds
            _healthMonitorOptions = new HostHealthMonitorOptions
            {
                HealthCheckInterval = TimeSpan.FromMilliseconds(100),
                HealthCheckWindow = TimeSpan.FromSeconds(1),
                HealthCheckThreshold = 5
            };
            var wrappedHealthMonitorOptions = new OptionsWrapper<HostHealthMonitorOptions>(_healthMonitorOptions);

            _mockJobHostEnvironment = new Mock<IScriptJobHostEnvironment>(MockBehavior.Strict);
            _mockJobHostEnvironment.Setup(p => p.Shutdown())
                .Callback(() =>
                {
                    _shutdownCalled = true;
                });

            var mockEnvironment = new Mock<IEnvironment>();
            mockEnvironment.Setup(p => p.GetEnvironmentVariable(EnvironmentSettingNames.AzureWebsiteInstanceId)).Returns("testapp");

            var mockHostPerformanceManager = new Mock<HostPerformanceManager>(mockEnvironment.Object, wrappedHealthMonitorOptions);

            mockHostPerformanceManager.Setup(p => p.IsUnderHighLoad(It.IsAny<Collection<string>>(), It.IsAny<ILogger>()))
                .Callback<Collection<string>, ILogger>((c, l) =>
                {
                    if (_underHighLoad)
                    {
                        foreach (var counter in _exceededCounters)
                        {
                            c.Add(counter);
                        }
                    }
                })
                .Returns(() => _underHighLoad);

            _testHost = new TestFunctionHost(testScriptPath, testLogPath,
                configureWebHostServices: services =>
                {
                    services.AddSingleton<IOptions<HostHealthMonitorOptions>>(wrappedHealthMonitorOptions);
                    services.AddSingleton<IScriptJobHostEnvironment>(_mockJobHostEnvironment.Object);
                    services.AddSingleton<IEnvironment>(mockEnvironment.Object);
                    services.AddSingleton<HostPerformanceManager>(mockHostPerformanceManager.Object);

                    services.AddSingleton<IConfigureBuilder<IWebJobsBuilder>>(new DelegatedConfigureBuilder<IWebJobsBuilder>(b =>
                    {
                        b.UseHostId("1234");
                        b.Services.Configure<ScriptJobHostOptions>(o => o.Functions = new[] { "ManualTrigger", "Scenarios" });
                    }));
                });

            _scriptHostService = _testHost.JobHostServices.GetService<IScriptHostManager>() as WebJobsScriptHostService;
        }

        [Fact]
        public void InitializationLogs_AreEmitted()
        {
            // verify startup trace logs
            string[] expectedPatternsWebHost = new string[]
            {
                "Information Reading host configuration file",
                "Information Host configuration file read",
            };

            string[] expectedPatternsScriptHost = new string[]
            {
                @"Information Generating 2 job function\(s\)",
                "Host initialization: ConsecutiveErrors=0, StartupCount=1",
                @"Information Starting Host \(HostId=(.*), InstanceId=(.*), Version=(.+), ProcessId=[0-9]+, AppDomainId=[0-9]+, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=\)",
                "Information Found the following functions:",
                "Information Job host started",
            };

            IList<LogMessage> logs = _testHost.GetWebHostLogMessages();
            foreach (string pattern in expectedPatternsWebHost)
            {
                Assert.True(logs.Any(p => Regex.IsMatch($"{p.Level} {p.FormattedMessage}", pattern)), $"Expected trace event {pattern} not found.");
            }

            logs = _testHost.GetScriptHostLogMessages();
            foreach (string pattern in expectedPatternsScriptHost)
            {
                Assert.True(logs.Any(p => Regex.IsMatch($"{p.Level} {p.FormattedMessage}", pattern)), $"Expected trace event {pattern} not found.");
            }
        }

        [Fact]
        public void WebHookProvider_IsRegistered()
        {
            Assert.NotNull(_scriptHostService.Services.GetService<IWebHookProvider>());
            Assert.NotNull(_scriptHostService.Services.GetService<IScriptWebHookProvider>());
        }

        [Fact]
        public async Task HostHealthMonitor_TriggersShutdown_WhenHostUnhealthy()
        {
            Assert.Equal(ScriptHostState.Running, _scriptHostService.State);

            // make host unhealthy
            _exceededCounters.Add("Connections");
            _underHighLoad = true;

            await TestHelpers.Await(() => _shutdownCalled);

            Assert.Equal(ScriptHostState.Error, _scriptHostService.State);
            _mockJobHostEnvironment.Verify(p => p.Shutdown(), Times.Once);

            // we expect a few restart iterations
            var scriptHostLogMessages = _testHost.GetScriptHostLogMessages();
            var webHostLogMessages = _testHost.GetWebHostLogMessages();

            var thresholdErrors = scriptHostLogMessages.Where(p => p.Exception is InvalidOperationException && p.Exception.Message == "Host thresholds exceeded: [Connections]. For more information, see https://aka.ms/functions-thresholds.");
            var count = thresholdErrors.Count();
            Assert.True(count > 0);

            var log = webHostLogMessages.First(p => p.FormattedMessage == "Host is unhealthy. Initiating a restart." && p.Level == LogLevel.Error);
            Assert.Equal(LogLevel.Error, log.Level);

            log = webHostLogMessages.First(p => p.FormattedMessage == "Host unhealthy count exceeds the threshold of 5 for time window 00:00:01. Initiating shutdown.");
            Assert.Equal(LogLevel.Error, log.Level);

            Assert.Contains(scriptHostLogMessages, p => p.FormattedMessage == "Stopping JobHost");
        }

        [Fact]
        public async Task HostHealthMonitor_RestartsSuccessfully_WhenHostRecovers()
        {
            Assert.Equal(ScriptHostState.Running, _scriptHostService.State);

            // crank this number up so we don't do a shutdown but instead
            // continue the retry loop
            _healthMonitorOptions.HealthCheckThreshold = 100;

            // now that host is running make host unhealthy and wait
            // for host shutdown
            _exceededCounters.Add("Connections");
            _underHighLoad = true;

            await TestHelpers.Await(() => _scriptHostService.State == ScriptHostState.Error);
            var lastError = _scriptHostService.LastError;
            Assert.Equal("Host thresholds exceeded: [Connections]. For more information, see https://aka.ms/functions-thresholds.", _scriptHostService.LastError.Message);

            // verify we are in a startup/retry loop
            await TestHelpers.Await(() =>
            {
                var allLogs = _testHost.GetLog();
                return allLogs.Contains("Host initialization: ConsecutiveErrors=3");
            });
            Assert.Equal(ScriptHostState.Error, _scriptHostService.State);
            _mockJobHostEnvironment.Verify(p => p.Shutdown(), Times.Never);

            // after a few retries, put the host back to health and verify
            // it starts successfully
            _exceededCounters.Clear();
            _underHighLoad = false;

            await TestHelpers.Await(() => _scriptHostService.State == ScriptHostState.Running);
            Assert.Null(_scriptHostService.LastError);

            var logMessages = _testHost.GetScriptHostLogMessages();
            Assert.Contains(logMessages, p => p.FormattedMessage == "Job host started");
        }

        [Fact]
        public void IsHostHealthy_ReturnsExpectedResult()
        {
            _healthMonitorOptions.Enabled = false;
            Assert.True(_scriptHostService.IsHostHealthy());

            _healthMonitorOptions.Enabled = true;
            Assert.True(_scriptHostService.IsHostHealthy());

            _underHighLoad = true;
            _exceededCounters.Add("Foo");
            _exceededCounters.Add("Bar");
            Assert.False(_scriptHostService.IsHostHealthy());

            var ex = Assert.Throws<InvalidOperationException>(() => _scriptHostService.IsHostHealthy(true));
            Assert.Equal("Host thresholds exceeded: [Foo, Bar]. For more information, see https://aka.ms/functions-thresholds.", ex.Message);

            _healthMonitorOptions.Enabled = false;
            Assert.True(_scriptHostService.IsHostHealthy());
        }
    }
}


text:
/* *** mirrorJS ***
 *
 */

var iApp = require("./iApp");
var protocol = require("./protocol");
var logger = require("./logger");

var __VERSION = {
    "MAJOR": 0,
    "MINOR": 2,
    "REVISION": 1
};

exports.VERSION = __VERSION["MAJOR"] + "." + __VERSION["MINOR"] + "." + __VERSION["REVISION"];

exports.servers = require("./servers");

var livingApp = function (uiHandler, onStartupCallback, conf, isLocal)
{
    var protocolHandler = new protocol(uiHandler, this);

    // app interface instance
    this.app = new iApp(protocolHandler);

    protocolHandler.attachApplicationInterface(this.app);

    if (conf === undefined)
    {
        conf = {};
    }

    if (conf["widgets"] && conf["widgets"]["prefixID"])
    {
        this.app.prefixID = conf["widgets"]["prefixID"];
    }

    // Application ID (used for remote apps by the server manager (servers.js))
    this.applicationID = 0;

    /**
     * Parses remote app protocol
     * @param o
     */
    this.parseRequests = function (o)
    {

        logger.log("Backend: Parsing protocol...", logger.level.LOG_DEBUG);

        switch (o["a"])
        {
            case "u":
                // Update (unused)
                // all widget's modification should pass via events
                break;

            case "e":
                // fire event
                this.app.fireEvent(o["w"], o["t"], o["p"]);
                break;

            case "Fp":
                // Replies the backend with the prop asked to the frontend
                this.app.handleFrontendProp(/* handle */ o["w"],
                    /* requestID */ o["r"],
                    /* status */ o["s"],
                    /* params */ o["p"]);
                break;

            case "m":
                // custom event (emit/on)
                this.triggerCustomEvent(/* custom event name */ o["t"],
                    /* params */ o["w"]);
                break;

            default:
                console.log("parseRequests ", o);
        }
    };

    var __app_instance__ = new onStartupCallback(this.app, conf["args"]);

    this.onClose = function ()
    {
        // Calls the application's instance "onClose" handler (if defined)
        if (__app_instance__.onClose !== undefined)
        {
            __app_instance__.onClose();
        }

        if (conf["events"] && conf["events"]["onClose"] !== undefined)
        {
            conf["events"]["onClose"](this.app);
        }
    };

    // TODO: needs more testing
    this.onError = function ()
    {
        // Calls the application's instance "onError" handler (if defined)
        if (__app_instance__.onError !== undefined)
        {
            __app_instance__.onError();
        }

        if (conf["events"] && conf["events"]["onError"] !== undefined)
        {
            conf["events"]["onError"](this.app);
        }
    };

    // **** Emit/On ****

    // custom events registry (emit/on)
    var __customEvents = {};

    if (isLocal === true)
    {
        this.on = function (eventName, callback)
        {
            logger.log("Fontend: Binding custom event " + eventName, logger.level.LOG_EVENTS);
            __customEvents[eventName] = callback;
        };

        this.emit = function (eventName, object)
        {
            this.app.triggerCustomEvent(eventName, object);
        };

        this.triggerCustomEvent = function (eventName, object)
        {
            if (__customEvents[eventName] !== undefined)
            {
                __customEvents[eventName](eventName, object);
            }
        };
    }
    else
    {
        // remote apps use the app.on and app.emit methods
        this.on = this.app.on;
        this.emit = this.app.emit;
        this.triggerCustomEvent = this.app.triggerCustomEvent;
    }

};

exports.app = {};

// fat clients
exports.app["local"] = function (uiHandler, onStartupCallback, conf)
{
    return new livingApp(uiHandler, onStartupCallback, conf, /* isLocal */ true);
};

// thin clients (backend)
exports.app["server"] = function (uiHandler, onStartupCallback, conf)
{
    return new livingApp(uiHandler, onStartupCallback, conf, /* isLocal */ false);
};

// thin clients (frontend)
exports.app["remote"] = function (uiHandler, alias, conf)
{
    var protocolHandler = new protocol(uiHandler, this);
    var app = new iApp(protocolHandler);
    protocolHandler.attachApplicationInterface(app);

    uiHandler.connection.connect(function ()   //onopen
        {
            // sends the alias (protocol)
            uiHandler.connection.send('{"a":"x","w":"' + alias + '"}\n');

            if (conf && conf["onConnect"])
            {
                conf["onConnect"]();
            }
        },
        function (msg)   //onmessage
        {
            protocolHandler.handle(msg.split("\n").map(function (m)
            {
                if (m.length > 0)
                {
                    return JSON.parse(m)
                }
            }));
        },
        function (obj)   //onclose
        {
            protocolHandler.close();

            if (conf && conf["onClose"])
            {
                conf["onClose"](obj);
            }
        }
    );

    // **** Emit/On ****

    // custom events registry (emit/on)
    var __customEvents = {};

    this.on = function (eventName, callback)
    {
        logger.log("Fontend: Binding custom event " + eventName, logger.level.LOG_EVENTS);
        __customEvents[eventName] = callback;
    };

    this.emit = function (eventName, object)
    {
        var buffer = JSON.stringify({
                "a": "m",
                "t": eventName,
                "w": object
            }) + "\n";

        protocolHandler.send(buffer);
    };

    this.triggerCustomEvent = function (eventName, object)
    {
        if (__customEvents[eventName] !== undefined)
        {
            __customEvents[eventName](eventName, object);
        }
    };

};

exports.widgets = {
    "controller": require("./widgets"),
    "base": require("./base")
};

exports.connectors = require("./connectors");

exports.ui = require("./ui");

exports.logger = require("./logger");

// banner
console.log("mirrorjs v" + exports.VERSION);


text:
CREATE EXTENSION IF NOT EXISTS gp_inject_fault;

DROP TABLE if exists lu_customer;
CREATE TABLE lu_customer (
    customer_id numeric(28,0),
    cust_first_name character varying(50),
    cust_last_name character varying(50),
    cust_birthdate date,
    address character varying(50),
    income_id numeric(28,0),
    email character varying(50),
    cust_city_id numeric(28,0)
);

BEGIN;
 SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
 CREATE TABLE cursor (a int, b int) distributed by (b);
 INSERT INTO cursor VALUES (1);
DECLARE c1 NO SCROLL CURSOR FOR SELECT * FROM cursor;
UPDATE cursor SET a = 2;
 FETCH ALL FROM c1;

 COMMIT;
 DROP TABLE cursor;

begin;
savepoint x;
create table abc (a int) distributed randomly;
insert into abc values (5);
insert into abc values (10);
 --order 1
declare foo  no scroll cursor for select * from abc order by 1;
fetch from foo;
rollback to x;
fetch from foo;
commit;
begin;
create table abc (a int) distributed randomly;
insert into abc values (5);
insert into abc values (10);
insert into abc values (15);
--order 1
 declare foo  no scroll cursor for select * from abc order by 1;
fetch from foo;
savepoint x;
fetch from foo;
rollback to x;
fetch from foo;
abort;

-- Test to validate cursor QE reader is correctly able to perform visibility in
-- subtransaction, even after QE writer has moved ahead and updated the tuple
CREATE TABLE cursor_writer_reader (a int, b int) DISTRIBUTED BY (a);
BEGIN;
INSERT INTO cursor_writer_reader VALUES(1, 666);
select gp_inject_fault('qe_got_snapshot_and_interconnect', 'suspend', 2);
DECLARE cursor_c2 CURSOR FOR SELECT * FROM cursor_writer_reader WHERE b=666 ORDER BY 1;
SAVEPOINT x;
UPDATE cursor_writer_reader SET b=333 WHERE b=666;
select gp_inject_fault('qe_got_snapshot_and_interconnect', 'status', 2);
select gp_inject_fault('qe_got_snapshot_and_interconnect', 'resume', 2);
FETCH cursor_c2;
SELECT * FROM cursor_writer_reader WHERE b=666 ORDER BY 1;
END;
select gp_inject_fault('qe_got_snapshot_and_interconnect', 'reset', 2);

-- start_ignore
------------------------------------------------------------------------------
-- LAST MODIFIED:
--     2010-04-04 mgilkey
--         To avoid the error message:
--             ERROR:  Cursor-Reader gang not able to provide correct
--             visibility 2/2, writer modified table while cursor was
--             scanning.
--         which is caused by a deliberate change (see MPP-8622 and MPP-8655),
--         I modified the table named "y" so that its distribution policy was
--         no longer "random".
--
--	2010-04-21: Ngoc
-- 		QA-838 or MPP-8622
-- 		Added the following GUC + tables are created without random distribution
-- 		Test case might be still intermittently failed
------------------------------------------------------------------------------
-- end_ignore
--start_ignore
drop table if exists y_schema.y;
drop schema if exists y_schema;
--end_ignore

create schema y_schema;
create table y_schema.y (a int, b int) distributed by (a);
Begin;
insert into y_schema.y values(10, 666);
insert into y_schema.y values(20, 666);
insert into y_schema.y values(30, 666);
insert into y_schema.y values(40, 666);
update y_schema.y set b =333 where b =666;
--order 1
declare c0 cursor for select * from y_schema.y where b =333 order by 1;
savepoint x;
update y_schema.y set b =666 where b =333;
fetch c0;
fetch c0;
fetch c0;
fetch c0;
--order 1
declare c1 cursor for select * from y_schema.y where b =333 order by 1;
--order 1
declare c2 cursor for select * from y_schema.y where b =666 order by 1;
fetch c2;
fetch c2;
fetch c2;
fetch c2;
savepoint y;
fetch c1;
fetch c1;
rollback to y;
fetch c2;
fetch c2;
rollback to x;
fetch c0;
fetch c0;
commit;
--start_ignore
drop table if exists y_schema.y;
drop schema if exists y_schema;
--end_ignore

--start_ignore
drop table if exists x_schema.y;
drop schema if exists x_schema;
--end_ignore
create schema x_schema;
 create table x_schema.y (a int, b int) distributed randomly;
begin;
declare c1 cursor for select * from x_schema.y where b =666;
savepoint x;
insert into x_schema.y values(10, 666);
insert into x_schema.y values(20, 666);
insert into x_schema.y values(30, 666);
insert into x_schema.y values(40, 666);
update x_schema.y set b =333 where b =666;
fetch c1;
--order 1
declare c2 cursor for select * from x_schema.y where b =666 order by 1;
fetch c2;
--order 1
declare c3 cursor for select * from x_schema.y where b =333 order by 1;
fetch c3;
fetch c3;
fetch c3;
fetch c3;
fetch c3;
commit;
--start_ignore
drop table if exists x_schema.y;
drop schema if exists x_schema;
--end_ignore

-- QA-838 or MPP-8622
-- Added the following GUC + tables are created without random distribution
-- Test case might be still intermittently failed
-- Ngoc

--start_ignore
drop table if exists z_schema.y;
drop schema if exists z_schema;
--end_ignore

create schema z_schema;
 --create table z_schema.y (a int, b int) distributed randomly;
 create table z_schema.y (a int, b int) distributed by (a);
begin;
insert into z_schema.y values(10, 666);
insert into z_schema.y values(20, 666);
insert into z_schema.y values(30, 666);
insert into z_schema.y values(40, 666);
--order 1
declare c1 cursor for select * from z_schema.y where b =666 order by 1;
savepoint x;
update z_schema.y set b =333 where b =666 ;
rollback to x;
fetch c1;
fetch c1;
fetch c1;
fetch c1;
fetch c1;
commit;
--start_ignore
drop table if exists z_schema.y;
drop schema if exists z_schema;
--end_ignore
--start_ignore
DROP TABLE films;
--end_ignore
CREATE TABLE films (
    code        char(5) CONSTRAINT firstkey PRIMARY KEY,
    title       varchar(40) NOT NULL,
    did         integer NOT NULL,
    date_prod   date,
    kind        varchar(10),
    len         interval hour to minute
) distributed by (code);
INSERT INTO films VALUES
    ('UA502', 'Bananas', 105, '1971-07-13', 'Comedy', '82 minutes');
INSERT INTO films (code, title, did, date_prod, kind)
    VALUES ('T_601', 'Yojimbo', 106, '1961-06-16', 'Drama');

INSERT INTO films (code, title, did, date_prod, kind) VALUES
    ('B6717', 'Tampopo', 110, '1985-02-10', 'Comedy'),
    ('HG120', 'The Dinner Game', 140, DEFAULT, 'Comedy');

BEGIN;
--order
DECLARE liahona SCROLL CURSOR FOR SELECT * FROM films order by 1;
FETCH FORWARD 3 FROM liahona;
MOVE liahona;
FETCH liahona;
CLOSE liahona;
COMMIT;
--start_ignore
DROP TABLE films;
--end_ignore

--start_ignore
DROP TABLE refcur1;
--end_ignore

CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS '
BEGIN
    OPEN $1 FOR SELECT col FROM refcur1;
    RETURN $1;
END;
' LANGUAGE plpgsql READS SQL DATA;

CREATE TABLE refcur1 (col text) distributed randomly;

INSERT INTO refcur1 VALUES ('123');
BEGIN;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
INSERT INTO refcur1 VALUES ('123');
INSERT INTO refcur1 VALUES ('123');
INSERT INTO refcur1 VALUES ('123');
INSERT INTO refcur1 VALUES ('123');
FETCH ALL IN funccursor;

SELECT reffunc('funccursor2');
COMMIT;
SELECT reffunc('funccursor2');
--start_ignore
DROP TABLE refcur1;
--end_ignore

--start_ignore
DROP TABLE table_1;
DROP TABLE table_2;
--end_ignore

CREATE FUNCTION myfunc(refcursor, refcursor) RETURNS SETOF refcursor AS $$
BEGIN
    OPEN $1 FOR SELECT * FROM table_1;
    RETURN NEXT $1;
    OPEN $2 FOR SELECT * FROM table_2;
    RETURN NEXT $2;
END;
$$ LANGUAGE plpgsql READS SQL DATA;
CREATE TABLE table_1 (a1 text, b1 integer) distributed randomly;
INSERT INTO table_1 VALUES ('abcd',10);
CREATE TABLE table_2 (a1 text, b1 integer) distributed randomly;
INSERT INTO table_2 VALUES ('abcde',110);
BEGIN;
--order 1
SELECT * FROM myfunc('a', 'b');
--order 1
FETCH ALL FROM a;
--order 1
FETCH ALL FROM b;
COMMIT;
--start_ignore
DROP TABLE table_1;
DROP TABLE table_2;
--end_ignore

--start_ignore
DROP TABLE if exists mpp_1389;
--end_ignore

CREATE TABLE mpp_1389(num int, letter text) distributed randomly;

insert into mpp_1389 values('1', 'a');
insert into mpp_1389 values('2', 'b');
insert into mpp_1389 values('3', 'c');
insert into mpp_1389 values('4', 'd');
insert into mpp_1389 values('5', 'e');
insert into mpp_1389 values('6', 'f');
insert into mpp_1389 values('7', 'g');

begin;
--order 1
DECLARE f CURSOR WITH HOLD FOR
select * from mpp_1389
ORDER BY num, letter;
commit;
FETCH FROM f;
--start_ignore
DROP TABLE if exists mpp_1389;
--end_ignore
--start_ignore
DROP INDEX if exists ctest_id_idx;
DROP TABLE if exists ctest;
--end_ignore

CREATE TABLE ctest (
	id int8,
	name varchar
 ) distributed randomly;

INSERT INTO ctest (id, name) SELECT id, 'Test' || id FROM generate_series(1, 1000) AS id;

CREATE INDEX ctest_id_idx ON ctest(id);

\d ctest;

--
-- Return absolute cursor records using sequential scan & index
--

BEGIN;

SET enable_seqscan =on;
--order 1
DECLARE CUR SCROLL CURSOR FOR SELECT * FROM ctest WHERE id >= 990 order by 1;
FETCH ABSOLUTE 1 IN CUR;
FETCH ABSOLUTE 3 IN CUR;
CLOSE CUR;

SET enable_seqscan = off;
--order 1
DECLARE CUR SCROLL CURSOR FOR SELECT * FROM ctest WHERE id >= 990 order by 1;
FETCH ABSOLUTE 1 IN CUR;
FETCH ABSOLUTE 3 IN CUR;
CLOSE CUR;

COMMIT;

--
-- Rebuild with btree or bitmap
--

DROP INDEX ctest_id_idx;
CREATE INDEX ctest_id_gist_idx ON ctest USING bitmap(id);

--
-- Now try again... and check if results returned are correct using seq scan.
--

BEGIN;

SET enable_seqscan =on;
--order 1
DECLARE CUR SCROLL CURSOR FOR SELECT * FROM ctest WHERE id >= 990::bigint order by 1;
FETCH ABSOLUTE 1 IN CUR;
FETCH ABSOLUTE 3 IN CUR;
CLOSE CUR;

SET enable_seqscan = off;
--order 1
DECLARE CUR SCROLL CURSOR FOR SELECT * FROM ctest WHERE id >= 990::bigint order by 1;
FETCH ABSOLUTE 1 IN CUR;
FETCH ABSOLUTE 3 IN CUR;
CLOSE CUR;

COMMIT;
--
-- Change of Gp_interconnect_queue_depth after a Cursor will success
BEGIN;

DECLARE CUR SCROLL CURSOR FOR SELECT * FROM ctest WHERE id >= 990::bigint order by 1;
SET gp_interconnect_queue_depth to 20;
FETCH ABSOLUTE 1 IN CUR;

COMMIT;
--start_ignore
DROP INDEX if exists ctest_id_idx;
DROP TABLE if exists ctest;
--end_ignore


text:
package com.amazonaws.services.chime.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.chime.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * PhoneNumberAssociation JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PhoneNumberAssociationJsonUnmarshaller implements Unmarshaller<PhoneNumberAssociation, JsonUnmarshallerContext> {

    public PhoneNumberAssociation unmarshall(JsonUnmarshallerContext context) throws Exception {
        PhoneNumberAssociation phoneNumberAssociation = new PhoneNumberAssociation();

        int originalDepth = context.getCurrentDepth();
        String currentParentElement = context.getCurrentParentElement();
        int targetDepth = originalDepth + 1;

        JsonToken token = context.getCurrentToken();
        if (token == null)
            token = context.nextToken();
        if (token == VALUE_NULL) {
            return null;
        }

        while (true) {
            if (token == null)
                break;

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("Value", targetDepth)) {
                    context.nextToken();
                    phoneNumberAssociation.setValue(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("Name", targetDepth)) {
                    context.nextToken();
                    phoneNumberAssociation.setName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("AssociatedTimestamp", targetDepth)) {
                    context.nextToken();
                    phoneNumberAssociation.setAssociatedTimestamp(DateJsonUnmarshallerFactory.getInstance("iso8601").unmarshall(context));
                }
            } else if (token == END_ARRAY || token == END_OBJECT) {
                if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
                    if (context.getCurrentDepth() <= originalDepth)
                        break;
                }
            }
            token = context.nextToken();
        }

        return phoneNumberAssociation;
    }

    private static PhoneNumberAssociationJsonUnmarshaller instance;

    public static PhoneNumberAssociationJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new PhoneNumberAssociationJsonUnmarshaller();
        return instance;
    }
}


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

		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>Locations list page</title>
		<meta name="description" content="Locations:of users" />
		<meta name="keywords" content="Locations of users" />
		<meta name="author" content="Codrops" />
		<link rel="shortcut icon" href="../favicon.ico">
		<link rel="stylesheet" type="text/css" href="{% static 'EcoKitchen/normalize.css' %}" />
		<link rel="stylesheet" type="text/css" href="{% static 'EcoKitchen/demo.css' %}" />
		<link rel="stylesheet" type="text/css" href="{% static 'EcoKitchen/component.css' %}" />

Locations of Entrepreneurs Validation of location

					Feedback
					Locations of Entrepreneurs
					List of users
					List of Entrepreneurs

Locations:

List of suggested locations for the kiosk

							User profile
							Location
							Latitude
							Longitude
							Status
							Description

						{% for location in locations_list %}

{{location.user.name}}	{{location.address}}	{{location.lat}}	{{location.long}}	{{location.status}}	{{location.description}}

                        {% endfor %}


text:
package org.http4s.util

import java.util.Locale

import org.http4s.Http4sSpec
import org.scalacheck.{Prop, Arbitrary, Gen}
import scalaz.scalacheck.ScalazProperties

class CaseInsensitiveStringSpec extends Http4sSpec {
  "equals" should {
    "be consistent with equalsIgnoreCase of the values" in {
      prop { s: String =>
        val lc = s.toLowerCase(Locale.ROOT)
        (s.equalsIgnoreCase(lc)) == (s.ci == lc.ci)
      }
    }
  }

  "hashCode" should {
    "be consistent with equality" in {
      prop { s: String =>
        val lc = s.toLowerCase(Locale.ROOT)
        (s.ci == lc.ci) ==> (s.ci.## == lc.ci.##)
      }
    }
  }

  "toString" should {
    "return the original as its toString" in {
      prop { s: String => s.ci.toString equals (s)}
    }
  }

  "length" should {
    "be consistent with the orignal's length" in {
      prop { s: String => s.ci.length equals (s.length)}
    }
  }

  "charAt" should {
    "be consistent with the orignal's charAt" in {
      def gen = for {
        s <- Arbitrary.arbitrary[String]
        i <- Gen.choose(0, s.length - 1)
      } yield (s, i)
      Prop.forAll(gen) { case (s, i) => s.nonEmpty ==> { s.ci.charAt(i) equals (s.charAt(i)) }}
    }
  }

  "subSequence" should {
    "be consistent with the orignal's subSequence" in {
      def gen = for {
        s <- Arbitrary.arbitrary[String]
        i <- Gen.choose(0, s.length - 1)
        j <- Gen.choose(i, s.length - 1)
      } yield (s, i, j)
      Prop.forAll(gen) { case (s, i, j) => s.nonEmpty ==> { s.ci.subSequence(i, j) equals (s.subSequence(i, j).ci) }}
    }
  }
}


text:
package cn.wedfrend.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.URLDecoder;

import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoadServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public LoadServlet() {
		super();
	}

	/**
	 * Destruction of the servlet.

	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet.

	 *
	 * This method is called when a form has its tag value method equals to get.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html charset='utf-8'");
		response.setCharacterEncoding("utf-8");
		//ÅжÏÓû§ÊÇ·ñÊǵǽµÄ״̬
		if(request.getSession().getAttribute("name")==null){
			response.sendRedirect("index.jsp");
			return;
		}

//		request.getRequestDispatcher("example.jsp").forward(request, response);

		//²é¿´cookÖµ
		Cookie[] cookies = request.getCookies();
		if(cookies!= null){
			for (int i = 0; i < cookies.length; i++) {
				System.out.println("cookies[i].getName()-------"+cookies[i].getName());
				System.out.println("cookies[i].getValue()------"+cookies[i].getValue());
			}
		}
		//´ÓsessionÖÐÈ¡Öµ
		HttpSession session = request.getSession();

		System.out.println(session.isNew());

		String name = (String)session.getAttribute("name");

		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("");
		out.println("  <TITLE>wedfrend introduction</TITLE>");
		out.println("  ");
		out.println("ÄúÊǵÚ"+this.getServletContext().getAttribute("count")+"λ·ÃÎʸÃÍøÕ¾");
		out.print("
welcome to "+name+" webpage!

 ");
		out.print("
");
		out.print("ËùÓÐÈ˵ļáÇ¿£¬¶¼ÊÇÈáÈíÉúµÄ¼ë
");
		out.print("<big>×ÜÓм¸·ÖÖÓ£¬ÆäÖеÄÿһÃ룬Ä㶼ԸÒâÄÃÒ»ÄêÈ¥»»È¡</big>
");
		out.print("×ÜÓÐ¼¸¾ä»°£¬ÆäÖеÄÿ¸ö×ÖÑÛ£¬Ä㶼ԸÒâÄÃËùÓеÄÒ¹ÍíÈ¥¸´Ï°
");
		out.print("×ÜÓм¸¶Î³¡¾°£¬ÆäÖеÄÿ·ù»Ã棬Ä㶼ԸÒâÄÃÈ«²¿µÄÁ¦Á¿È¥Ãú¼Ç
");
		out.print("×ÜÓм¸¿ÅÀá£¬ÆäÖеÄÿһ´Î³éÆü£¬Ä㶼ԸÒâÄÃÂúÊֵijÐŵȥ´úÌæ
");
		out.print("
");
		out.print("
");

		out.print("
"+name+" CSDN link
");
		out.print("
½øÈëÁÄÌìÊÒ
");
		out.print("
°®ºÃÁбí
");
		out.print("
°®ºÃÁбíjsp
");
		out.print("
Êé¼®Áбí
");
		out.print("
ÉÏ´«Í¼Æ¬×ÊÔ´
");
		out.print("
ÏÂÔØ×ÊÔ´
");
		out.print("
EL±í´ïʽ×Ô¶¨Òåtaglib
");
		out.print("
¸öÈË°®ºÃÁбí
");
//		author(out);
		out.print("
");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the   "+request.getMethod()+"   method");
		out.println("  ");
		out.println("");
		out.flush();
		out.close();

	}

	/**
	 * ¶¨Òåê
	 * @param out
	 */
	private void author(PrintWriter out){

		out.print("
");
		out.print("ÎҵĽéÉÜ");
		out.print("

");

		out.print("
");
		out.print("ÎҵļòÀú");
		out.print("

");

		out.print("
");
		out.print("¼¼ÊõÌس¤");
		out.print("

");
		for (int i = 0; i < 50; i++) {
			out.print(i+"
");
		}
		out.print("
");
		out.print("ÎҵĽéÉÜ");
		out.print("

");
		for (int i = 0; i < 50; i++) {
			out.print(i+"
");
		}
		out.print("
");
		out.print("ÎҵļòÀú");
		out.print("

");
		for (int i = 0; i < 50; i++) {
			out.print(i+"
");
		}
		out.print("
");
		out.print("¼¼ÊõÌس¤");
		out.print("

");
	}

	/**
	 * The doPost method of the servlet.

	 *
	 * This method is called when a form has its tag value method equals to post.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
		out.println("");
		out.println("  <TITLE>A Servlet</TITLE>");
		out.println("  ");
		out.print("    This is ");
		out.print(this.getClass());
		out.println(", using the POST method");
		out.println("  ");
		out.println("");
		out.flush();
		out.close();
	}

	/**
	 * Initialization of the servlet.

	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException {
		// Put your code here
		System.out.println("Init Servlet");
	}

}


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends Front_Controller {

	function __construct()
	{
		parent::__construct();
	}

    //--------------------------------------------------------------------

	/*
		Method: index()

		Displays homepage.
	*/
	public function index()
	{
		$this->load->model('banner/banner_model');
		$this->load->model('project/project_model');
		$this->load->model('project/project_type_model');
		$this->load->model('project/project_location_model');

        $banner 	= $this->banner_model->order_by('position','asc')->where('publish','Y')->find_all();

        $category 	= $this->project_model->order_by('title','desc')->find_all();
		foreach($category as $category_list)
		{
			$data["category"][$category_list->id] = $category_list;

			$data["category"][$category_list->id]->type = $this->project_type_model->order_by('title','asc')->find_all_by('project_type.category_id', $category_list->id);
		}

		$location = $this->project_location_model->order_by('title','asc')->find_all();

        $vars = array(
						'banner'      	=> $banner,
						'category'		=> $category,
						'location'		=> $location,
					);

        //print_r($vars);exit();

        Template::set('data', $vars);
        Template::set('toolbar_title', "Home");
        Template::set_view('front_page/index');
		Template::render();
	}

    //--------------------------------------------------------------------

	/*
		Method: member_section()

		Displays member section.
	*/
	public function member_section()
	{
		$this->load->model('project/project_type_model');

        $property_type = $this->project_type_model->find_all();

        $vars = array(
						'property_type'  => $property_type,
					);

        //print_r($vars);exit();

        $this->load->view("front_page/_content/member_section", $vars);
	}

    //--------------------------------------------------------------------
}
/* End of file home.php */
/* Location: ./modules/home/controllers/home.php */


text:
package com.christopherdcanfield;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class App
{
	public static final ScheduledExecutorService scheduledExecutor = Executors.newScheduledThreadPool(1);
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Logs</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.openqa.selenium.logging

Interface Logs

All Known Implementing Classes:

LocalLogs, RemoteLogs

@Beta
public interface Logs

Interface for providing logs.

Method Summary

Methods

Modifier and Type
Method and Description

LogEntries
get(java.lang.String logType)

Fetches available log entries for the given log type.

java.util.Set<java.lang.String>
getAvailableLogTypes()

Queries for available log types.

Method Detail

get

LogEntries get(java.lang.String logType)

Fetches available log entries for the given log type.

 Note that log buffers are reset after each call, meaning that available log
 entries correspond to those entries not yet returned for a given log type.
 In practice, this means that this call will return the available log entries
 since the last call, or from the start of the session.

 For more info on enabling logging, look at LoggingPreferences.

Parameters:

logType - The log type.

Returns:

Available log entries for the specified log type.

getAvailableLogTypes

java.util.Set<java.lang.String> getAvailableLogTypes()

Queries for available log types.

Returns:

A set of available log types.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method