text:
namespace AGE
{
	BasicDemoCameraSystem::BasicDemoCameraSystem(AScene *scene) :
		System(scene),
		_filter(scene)
	{
	}

	bool BasicDemoCameraSystem::initialize()
	{
		_filter.requireComponent<CameraComponent>();
		return (true);
	}

	void BasicDemoCameraSystem::updateBegin(float time)
	{
	}

	void BasicDemoCameraSystem::mainUpdate(float time)
	{
		for (Entity const &entity : _filter.getCollection())
		{
			static float trigger = 1.0f;
			Joystick controller;
			auto inputs = _scene->getInstance<Input>();
			bool controllerEnabled = inputs->getJoystick(0, controller);
			if ((inputs->getPhysicalKeyPressed(AgeKeys::AGE_SPACE) || (controllerEnabled && controller.getButtonPressed(AgeJoystickButtons::AGE_JOYSTICK_BUTTON_RIGHTSHOULDER))) && trigger >= 0.15f)
			{
				trigger = 0.0f;
				auto e = _scene->createEntity();
				e->addComponent<Lifetime>(15.0f);
				auto &link = e->getLink();
				auto &cameraLink = entity->getLink();
				const glm::quat &cameraOrientation = cameraLink.getOrientation();
				const glm::vec3 cameraForward = glm::vec3(glm::mat4(glm::toMat4(cameraOrientation) * glm::translate(glm::mat4(1), glm::vec3(0.0f, 0.0f, -1.0f)))[3]);
				link.setPosition(cameraLink.getPosition() + cameraOrientation * glm::vec3(0, 0, -2));
				link.setOrientation(cameraOrientation);
				link.setScale(glm::vec3(1.0f));
				e->addComponent<MeshRenderer>(_scene->getInstance<AGE::AssetsManager>()->getMesh("cube/cube.sage"),
											 _scene->getInstance<AGE::AssetsManager>()->getMaterial(OldFile("cube/cube.mage")))->enableRenderMode(RenderModes::AGE_OPAQUE);
				e->addComponent<RigidBody>()->addForce(10.0f * cameraForward, Physics::ForceMode::Impulse);
				e->addComponent<Collider>(Physics::ColliderType::Box);
				auto pl = e->addComponent<PointLightComponent>();
				pl->setColor(glm::vec3(float(rand() % 100) / 100.0f, float(rand() % 100) / 100.0f, float(rand() % 100) / 100.0f));
			}

			trigger += time;

#if defined(EDITOR_ENABLED)
			entity->getComponent<CameraComponent>()->editorUpdate();

			auto camComponent = entity->getComponent<CameraComponent>();
			static char const *pipelineNames[RenderType::TOTAL] = { "Debug deferred rendering", "Deferred rendering" };
			ImGui::ListBox("Pipelines", &_pipelineIndex, pipelineNames, int(RenderType::TOTAL));
			if (camComponent->getPipeline() != (RenderType)_pipelineIndex)
			{
				camComponent->setPipeline((RenderType)_pipelineIndex);
				_scene->getSystem<RenderCameraSystem>()->drawDebugLines(_pipelineIndex == (int)RenderType::DEBUG_DEFERRED ? true : false);
			}
#endif
		}
	}

	void BasicDemoCameraSystem::updateEnd(float time)
	{
	}
}


text:
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Admin::ReturnItemsController do
  fixtures :products, :product_styles, :admin_users
  fixtures :return_items

  before do
    @controller.class.skip_before_filter @controller.class.before_filters
    @controller.class.skip_after_filter @controller.class.after_filters
    @ps = product_styles(:have_classcategory2)
    @ri = return_items(:return_items_1)
    session[:admin_user] = admin_users(:admin10)
  end

  it "should use Admin::ProductController" do
    controller.should be_instance_of(Admin::ReturnItemsController)
  end

  describe "GET 'index'" do
    it "should be successful" do
      get "index"
      response.should be_success
    end
  end

  describe "GET 'search;" do

    it "should ok" do
      search = {:name => ""}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles].size.should > 0
    end

    it "with name" do
      search = {:name => @ps.product_name}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles][0].product_name.should == @ps.product_name
    end

    it "with product_id" do
      search = {:product_id => @ps.product_id}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles][0].product_id.should == @ps.product_id
    end

    it "with code" do
      search = {:code => @ps.code}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles][0].code.should == @ps.code
    end

    it "with manufacturer" do
      search = {:manufacturer => @ps.manufacturer_id}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles][0].manufacturer_id.should == @ps.manufacturer_id
    end

    it "with fail_retailer" do
      session[:admin_user] = admin_users(:admin17_retailer_id_is_fails)
      search = {}
      get "search", :condition => search
      response.should be_success
      assigns[:product_styles].should == []
    end

  end

  describe "GET 'new'" do

    it "should ok" do
      get "new", :id => @ps.id
      response.should be_success
    end

    it "no id, should redirect to index" do
      get "new"
      response.should redirect_to(:action => :index)
    end

  end

  describe "POST 'create'" do
    it "should ok" do
      return_item = {:product_id => @ps.product_id,
        :product_style_id => @ps.id,
        :returned_count => 2,
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "1",
        "returned_at(3i)" => "1",
        :comment => "test"}
      post 'create', :return_item => return_item
      response.should redirect_to(:action => :index)
    end

    it "without product_id is error" do
      return_item = {:product_style_id => @ps.id,
        :returned_count => 2,
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "1",
        "returned_at(3i)" => "1",
        :comment => "test"}
      post 'create', :return_item => return_item
      response.should render_template('admin/return_items/new.html.erb')
    end

    it "without returned_at is error" do
      return_item = {:product_id => @ps.product_id,
        :product_style_id => @ps.id,
        :returned_count => 2,
        "returned_at(1i)" => "",
        "returned_at(2i)" => "",
        "returned_at(3i)" => "",
        :comment => "test"}
      post 'create', :return_item => return_item
      response.should render_template('admin/return_items/new.html.erb')
    end

    it "returned_count < 0 is error" do
      return_item = {:product_id => @ps.product_id,
        :product_style_id => @ps.id,
        :returned_count => "-3",
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "1",
        "returned_at(3i)" => "1",
        :comment => "test"}
      post 'create', :return_item => return_item
      response.should render_template('admin/return_items/new.html.erb')
    end
  end

  describe "GET 'history'" do
    it "should ok" do
      get 'history'
      response.should be_success
    end
  end

  describe "GET 'history_search'" do

    it "should ok" do
      condition = {:name => ""}
      get 'history_search', :condition => condition
      assigns[:return_items].size.should > 0
      response.should be_success
    end

    it "with name" do
      condition = {:name => @ri.product.name}
      get 'history_search', :condition => condition
      assigns[:return_items][0].product.name.should == @ri.product.name
      response.should be_success
    end

    it "with code" do
      condition = {:code => @ri.product_style.code}
      get 'history_search', :condition => condition
      assigns[:return_items][0].product_style.code.should == @ri.product_style.code
      response.should be_success
    end

    it "with product_id" do
      condition = {:product_id => @ri.product_id}
      get 'history_search', :condition => condition
      assigns[:return_items][0].product_id.should == @ri.product_id
      response.should be_success
    end

    it "with manufacturer" do
      condition = {:manufacturer => @ri.product_style.manufacturer_id}
      get 'history_search', :condition => condition
      assigns[:return_items][0].product_style.manufacturer_id.should == @ri.product_style.manufacturer_id
      response.should be_success
    end

    it "is fail_retailer" do
      session[:admin_user] = admin_users(:admin17_retailer_id_is_fails)
      condition = {:name => ""}
      get 'history_search', :condition => condition
      assigns[:return_items].size.should == 0
      response.should be_success
    end

  end

  describe "GET 'edit'" do
    it "should ok" do
      get 'edit', :id => @ri.id
      response.should be_success
    end

    it "without id is error" do
      get 'edit'
      response.should redirect_to(:action => :history)
    end
  end

  describe "POST 'update'" do
    it "should ok" do
      get 'edit', :id => @ri.id
      return_item = {:id => @ri.id,
        :product_id => @ri.product_id,
        :product_style_id => @ri.product_style_id,
        :returned_count => 3,
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "2",
        "returned_at(3i)" => "3",
        :comment => "Test"}
      post 'update', :return_item => return_item
      response.should redirect_to(:action => :history)
    end

    it "without comment is error" do
      get 'edit', :id => @ri.id
      return_item = {:id => @ri.id,
        :product_id => @ri.product_id,
        :product_style_id => @ri.product_style_id,
        :returned_count => 3,
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "2",
        "returned_at(3i)" => "3",
        :comment => ""}
      post 'update', :return_item => return_item
      response.should render_template("admin/return_items/edit.html.erb")
    end
  end

  describe "POST 'destroy'" do
    it "should ok" do
      post 'destroy', :id => @ri.id
      response.should redirect_to(:action => :history)
    end

    it "without id is error" do
      lambda{post 'destroy'}.should raise_error(NoMethodError)
    end
  end

  describe "GET 'csv_index'" do
    it "should ok" do
      get 'csv_index'
      response.should be_success
    end
  end

  describe "GET 'new_csv'" do
    it "should ok" do
      get 'new_csv'
      response.should be_redirect
    end
  end

  describe "GET 'csv'" do
    it "should ok" do
      csv_line_count = ReturnItem.find(:all).size + 1
      get 'csv', :id => DateTime.now.strftime('%Y%m%d_%H%M%S')
      response.body.count("\n").should == csv_line_count
    end

    it "cache is ok" do
      pending "テストではキャッシュが有効にならないため"
      id = DateTime.now.strftime('%Y%m%d_%H%M%S')
      csv_line_count = ReturnItem.find(:all).size + 1
      get 'csv', :id => id
      response.body.count("\n").should == csv_line_count
      return_item = {:product_id => @ps.product_id,
        :product_style_id => @ps.id,
        :returned_count => 2,
        "returned_at(1i)" => "2010",
        "returned_at(2i)" => "1",
        "returned_at(3i)" => "1",
        :comment => "test"}
      post 'create', :return_item => return_item
      get 'csv', :id => id
      response.body.count("\n").should == csv_line_count
    end

    it "is retailer_fail" do
      session[:admin_user] = admin_users(:admin17_retailer_id_is_fails)
      get 'csv', :id => DateTime.now.strftime('%Y%m%d_%H%M%S')
      response.headers['Content-Type'].should =~ %r(^application/octet-stream)
      rows = response.body.chomp.split("\n")
      rows.size.should == 1
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>

<workflow xmlns="http://www.attivio.com/configuration/type/workflowType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="ingestPrincipalsIndexer" type="ingest" xsi:schemaLocation="http://www.attivio.com/configuration/type/workflowType http://www.attivio.com/configuration/type/workflowType.xsd ">
  <description>Sends the processed principals to the indexer</description>
  <documentTransformer name="processIngestedPrincipals"/>
  <documentTransformer name="standardAnalyzer"/>
</workflow>


text:
using UnityEngine;
using System.Collections;
using Chronos;

public class TimeControlle : BaseBehaviour{

    public static TimeControlle instance;
    public void Awake()
    {
        instance = this;
    }

	public void PauseTime(string key,float time)
    {
        Timekeeper.instance.Clock(key).localTimeScale = 0.13f;
        StartCoroutine(continuePause(time, key));
    }
    IEnumerator continuePause(float waitTime,string key)
    {
        yield return new WaitForSeconds(waitTime);
        Timekeeper.instance.Clock(key).localTimeScale = 1;
    }
}


text:
package r_kvstore

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

import (
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
	"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)

// SwitchInstanceHA invokes the r_kvstore.SwitchInstanceHA API synchronously
func (client *Client) SwitchInstanceHA(request *SwitchInstanceHARequest) (response *SwitchInstanceHAResponse, err error) {
	response = CreateSwitchInstanceHAResponse()
	err = client.DoAction(request, response)
	return
}

// SwitchInstanceHAWithChan invokes the r_kvstore.SwitchInstanceHA API asynchronously
func (client *Client) SwitchInstanceHAWithChan(request *SwitchInstanceHARequest) (<-chan *SwitchInstanceHAResponse, <-chan error) {
	responseChan := make(chan *SwitchInstanceHAResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.SwitchInstanceHA(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

// SwitchInstanceHAWithCallback invokes the r_kvstore.SwitchInstanceHA API asynchronously
func (client *Client) SwitchInstanceHAWithCallback(request *SwitchInstanceHARequest, callback func(response *SwitchInstanceHAResponse, err error)) <-chan int {
	result := make(chan int, 1)
	err := client.AddAsyncTask(func() {
		var response *SwitchInstanceHAResponse
		var err error
		defer close(result)
		response, err = client.SwitchInstanceHA(request)
		callback(response, err)
		result <- 1
	})
	if err != nil {
		defer close(result)
		callback(nil, err)
		result <- 0
	}
	return result
}

// SwitchInstanceHARequest is the request struct for api SwitchInstanceHA
type SwitchInstanceHARequest struct {
	*requests.RpcRequest
	ResourceOwnerId      requests.Integer `position:"Query" name:"ResourceOwnerId"`
	SwitchMode           requests.Integer `position:"Query" name:"SwitchMode"`
	SecurityToken        string           `position:"Query" name:"SecurityToken"`
	NodeId               string           `position:"Query" name:"NodeId"`
	Product              string           `position:"Query" name:"Product"`
	ResourceOwnerAccount string           `position:"Query" name:"ResourceOwnerAccount"`
	OwnerAccount         string           `position:"Query" name:"OwnerAccount"`
	OwnerId              requests.Integer `position:"Query" name:"OwnerId"`
	InstanceId           string           `position:"Query" name:"InstanceId"`
	SwitchType           string           `position:"Query" name:"SwitchType"`
	Category             string           `position:"Query" name:"Category"`
}

// SwitchInstanceHAResponse is the response struct for api SwitchInstanceHA
type SwitchInstanceHAResponse struct {
	*responses.BaseResponse
	RequestId string `json:"RequestId" xml:"RequestId"`
}

// CreateSwitchInstanceHARequest creates a request to invoke SwitchInstanceHA API
func CreateSwitchInstanceHARequest() (request *SwitchInstanceHARequest) {
	request = &SwitchInstanceHARequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("R-kvstore", "2015-01-01", "SwitchInstanceHA", "redisa", "openAPI")
	request.Method = requests.POST
	return
}

// CreateSwitchInstanceHAResponse creates a response to parse from SwitchInstanceHA response
func CreateSwitchInstanceHAResponse() (response *SwitchInstanceHAResponse) {
	response = &SwitchInstanceHAResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
[?php if ($field->isPartial()): ?]
[?php include_partial('<?php echo $this->getModuleName() ?>/'.$name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?]
[?php elseif ($field->isComponent()): ?]
[?php include_component('<?php echo $this->getModuleName() ?>', $name, array('type' => 'filter', 'form' => $form, 'attributes' => $attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes)) ?]
[?php else: ?]

[?php echo $form[$name]->renderLabel($label) ?]

  [?php echo $form[$name]->renderError() ?]

  [?php echo $form[$name]->render($attributes instanceof sfOutputEscaper ? $attributes->getRawValue() : $attributes) ?]

  [?php if ($help || $help = $form[$name]->renderHelp()): ?]

[?php echo __($help, array(), '<?php echo $this->getI18nCatalogue() ?>') ?]

  [?php endif; ?]

[?php endif; ?]


text:
from direct.showbase.ShowBase import ShowBase
base = ShowBase()

from direct.gui.DirectGui import *
from panda3d.core import TextNode
import sys

soundtrack = base.loader.loadSfx("sound\secunda.mp3")
soundtrack.setLoopCount(9999999999999999) # loop (virually) forever
soundtrack.play()

class World(object):

    def __init__(self):

        # This is the initialization we had before
        self.title = OnscreenText(  # Create the title
            text="Mundus",
            parent=base.a2dBottomRight, align=TextNode.A_right,
            style=1, fg=(1, 1, 1, 1), pos=(-0.1, 0.1), scale=.07)

        base.setBackgroundColor(0, 0, 0)  # Set the background to black
        base.disableMouse()  # disable mouse control of the camera
        camera.setPos(0, 0, 45)  # Set the camera position (X, Y, Z)
        camera.setHpr(0, -90, 0)  # Set the camera orientation
        #(heading, pitch, roll) in degrees

        # Here again is where we put our global variables. Added this time are
        # variables to control the relative speeds of spinning and orbits in the
        # simulation
        # Number of seconds a full rotation of Earth around the sun should take
        self.yearscale = 60
        # Number of seconds a day rotation of Earth should take.
        # It is scaled from its correct value for easier visability
        self.dayscale = self.yearscale / 365.0 * 15
        self.orbitscale = 2  # Orbit scale
        self.sizescale = 0.6  # Planet size scale

        self.loadPlanets()  # Load and position the models

        # Finally, we call the rotatePlanets function which puts the planets,
        # sun, and moon into motion.
        self.rotatePlanets()

    def loadPlanets(self):
        # This is the same function that we completed in the previous step
        # It is unchanged in this version

        # Create the dummy nodes
        self.orbit_root_mercury = render.attachNewNode('orbit_root_mercury')
        self.orbit_root_venus = render.attachNewNode('orbit_root_venus')
        self.orbit_root_mars = render.attachNewNode('orbit_root_mars')
        self.orbit_root_earth = render.attachNewNode('orbit_root_earth')

        # The moon orbits Earth, not the sun
        self.orbit_root_moon = (
            self.orbit_root_earth.attachNewNode('orbit_root_moon'))

        ###############################################################

        # Load the sky
        self.sky = loader.loadModel("models/solar_sky_sphere")
        self.sky_tex = loader.loadTexture("models/stars_1k_tex.jpg")
        self.sky.setTexture(self.sky_tex, 1)
        self.sky.reparentTo(render)
        self.sky.setScale(40)

        # Load Nirn
        self.sun = loader.loadModel("models/planet_sphere")
        self.sun_tex = loader.loadTexture("models/nirn.jpg")
        self.sun.setTexture(self.sun_tex, 1)
        self.sun.reparentTo(render)
        self.sun.setScale(2 * self.sizescale)

        # Load Kynareth
        self.mercury = loader.loadModel("models/planet_sphere")
        self.mercury_tex = loader.loadTexture("models/kynareth.jpg")
        self.mercury.setTexture(self.mercury_tex, 1)
        self.mercury.reparentTo(self.orbit_root_mercury)
        self.mercury.setPos(3 * self.orbitscale, 0, 0)
        self.mercury.setScale(0.700 * self.sizescale)

        # Load Akatosh
        self.venus = loader.loadModel("models/planet_sphere")
        self.venus_tex = loader.loadTexture("models/akatosh.jpg")
        self.venus.setTexture(self.venus_tex, 1)
        self.venus.reparentTo(self.orbit_root_venus)
        self.venus.setPos(3 * self.orbitscale, 0, 0)
        self.venus.setScale(0.923 * self.sizescale)

        # Load Zenithar
        self.mars = loader.loadModel("models/planet_sphere")
        self.mars_tex = loader.loadTexture("models/zenithar.jpg")
        self.mars.setTexture(self.mars_tex, 1)
        self.mars.reparentTo(self.orbit_root_mars)
        self.mars.setPos(5.0 * self.orbitscale, 0, 0)
        self.mars.setScale(0.800 * self.sizescale)

        # Load Masser
        self.earth = loader.loadModel("models/planet_sphere")
        self.earth_tex = loader.loadTexture("models/masser.jpg")
        self.earth.setTexture(self.earth_tex, 1)
        self.earth.reparentTo(self.orbit_root_earth)
        self.earth.setScale(self.sizescale)
        self.earth.setPos(self.orbitscale, 0, 0)

        # Offest the moon dummy node so that it is positioned properly
        self.orbit_root_moon.setPos(self.orbitscale, 0, 0)

        # Load Secunda
        self.moon = loader.loadModel("models/planet_sphere")
        self.moon_tex = loader.loadTexture("models/secunda.jpg")
        self.moon.setTexture(self.moon_tex, 1)
        self.moon.reparentTo(self.orbit_root_moon)
        self.moon.setScale(0.5 * self.sizescale)
        self.moon.setPos(0.5 * self.orbitscale, 0, 0)
    # end loadPlanets()

    def rotatePlanets(self):
        # rotatePlanets creates intervals to actually use the hierarchy we created
        # to turn the sun, planets, and moon to give a rough representation of the
        # solar system. The next lesson will go into more depth on intervals.
        self.day_period_sun = self.sun.hprInterval(20, (360, 0, 0))

        self.orbit_period_mercury = self.orbit_root_mercury.hprInterval(
            (0.241 * self.yearscale), (360, 0, 0))
        self.day_period_mercury = self.mercury.hprInterval(
            (59 * self.dayscale), (360, 0, 0))

        self.orbit_period_venus = self.orbit_root_venus.hprInterval(
            (0.615 * self.yearscale), (360, 0, 0))
        self.day_period_venus = self.venus.hprInterval(
            (243 * self.dayscale), (360, 0, 0))

        self.orbit_period_earth = self.orbit_root_earth.hprInterval(
            self.yearscale, (360, 0, 0))
        self.day_period_earth = self.earth.hprInterval(
            self.dayscale, (360, 0, 0))

        self.orbit_period_moon = self.orbit_root_moon.hprInterval(
            (.0749 * self.yearscale), (360, 0, 0))
        self.day_period_moon = self.moon.hprInterval(
            (.0749 * self.yearscale), (360, 0, 0))

        self.orbit_period_mars = self.orbit_root_mars.hprInterval(
            (1.881 * self.yearscale), (360, 0, 0))
        self.day_period_mars = self.mars.hprInterval(
            (1.03 * self.dayscale), (360, 0, 0))

        self.day_period_sun.loop()
        self.orbit_period_mercury.loop()
        self.day_period_mercury.loop()
        self.orbit_period_venus.loop()
        self.day_period_venus.loop()
        self.orbit_period_earth.loop()
        self.day_period_earth.loop()
        self.orbit_period_moon.loop()
        self.day_period_moon.loop()
        self.orbit_period_mars.loop()
        self.day_period_mars.loop()
    # end RotatePlanets()
# end class world

w = World()
base.run()


text:
package io.spine.query;

import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.protobuf.Message;
import io.spine.annotation.SPI;

import java.util.function.Function;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * A builder for {@link RecordQuery}.
 *
 * @param
 *         the type of identifiers of the queried records
 * @param <R>
 *         the type of the queried records
 */
@SPI
public class RecordQueryBuilder
        extends AbstractQueryBuilder<I,
                                     R,
                                     RecordSubjectParameter<R, ?>,
                                     RecordQueryBuilder,
                                     RecordQuery> {

    protected RecordQueryBuilder(Class idType, Class<R> recordType) {
        super(idType, recordType);
    }

    @Override
    protected RecordQueryBuilder thisRef() {
        return this;
    }

    /**
     * Creates a new instance of a corresponding query using the data of this builder.
     *
     *
If the {@linkplain #limit(int) record limit} is set, checks that at least
     * one sorting directive is present. Otherwise throws an {@linkplain IllegalStateException}.
     */
    @Override
    public RecordQuery build() {
        return new RecordQuery<>(this);
    }

    /**
     * Builds a query on top of this record query builder and transforms it according
     * to the logic of the passed transformer.
     *
     *
This method is a syntax sugar for a convenient method chaining for those who wishes to use
     * the produced query in their own transformation flow.
     *
     * @param transformer
     *         function transforming the query
     * @param <T>
     *         the type of the resulting object
     * @return a transformed query instance
     */
    public <T> T build(Function<RecordQuery<?, ?>, T> transformer) {
        checkNotNull(transformer);
        var query = build();
        var result = transformer.apply(query);
        return result;
    }

    /**
     * Creates a criterion for a particular record column.
     *
     * @param column
     *         the record column which will be queried
     * @param <V>
     *         the type of the record column values
     * @return a new criterion for the given column
     */
    @CanIgnoreReturnValue
    public <V> RecordCriterion where(RecordColumn<R, V> column) {
        return new RecordCriterion<>(column, this);
    }

    /**
     * Creates a criterion for the identifier values of the queried records.
     *
     * @return a new instance of a criterion
     */
    public IdCriterion<I, RecordQueryBuilder> id() {
        return new IdCriterion<>(thisRef());
    }
}


text:
@interface MOBProjectionEPSG4885 : MOBProjection

@end


text:
PRODUCT = "Kayak"
DESCRIPTION = "Kayak is an event-base IO libary for .NET. Kayak allows you to easily create TCP clients and servers, and contains an HTTP/1.1 server implementation."
VERSION = "0.7.2"
AUTHORS = "Benjamin van der Veen"
COPYRIGHT = "Copyright (c) 2007-2011 Benjamin van der Veen"
LICENSE_URL = "https://github.com/kayak/kayak/raw/HEAD/LICENSE"
PROJECT_URL = "https://github.com/kayak/kayak"

require 'albacore'
require 'uri'
require 'net/http'
require 'net/https'

# Monkey patch Dir.exists? for Ruby 1.8.x
if RUBY_VERSION =~ /^1\.8/
  class Dir
    class << self
      def exists? (path)
        File.directory?(path)
      end
      alias_method :exist?, :exists?
    end
  end
end

def is_nix
  !RUBY_PLATFORM.match("linux|darwin").nil?
end

def invoke_runtime(cmd)
  command = cmd
  if is_nix()
    command = "mono --runtime=v4.0 #{cmd}"
  end
  command
end

def transform_xml(input, output)
  input_file = File.new(input)
  xml = REXML::Document.new input_file

  yield xml

  input_file.close

  output_file = File.open(output, "w")
  formatter = REXML::Formatters::Default.new()
  formatter.write(xml, output_file)
  output_file.close
end

def ensure_submodules()
  system("git submodule init")
  system("git submodule update")
end

def fetch(uri, limit = 10, &block)
  # We should choose a better exception.
  raise ArgumentError, 'too many HTTP redirects' if limit == 0

  http = Net::HTTP.new(uri.host, uri.port)
  if uri.scheme == "https"
    http.verify_mode = OpenSSL::SSL::VERIFY_PEER
    http.use_ssl = true
  end

  resp = http.request(Net::HTTP::Get.new(uri.request_uri)) { |response|
    case response
    when Net::HTTPRedirection then
      location = response['location']
      if block_given? then
        fetch(URI(location), limit - 1, &block)
      else
        fetch(URI(location), limit - 1)
      end
      return
    else
      response.read_body do |segment|
        yield segment
      end
      return
    end
  }
end

def rename_file(oldname, newname)
  # Ruby 1.8.7 on Mac sometimes reports File.exist? incorrectly
  # so work around this [not sure why that happens]
  begin
    File.delete(newname)
  rescue => msg
    # File probably doesn't exist, if it does File.size? will work properly
    if File.size?(newname) != nil then
      fail "Failed to delete old file #{newname} with: #{msg}"
      raise
    end
  end
  File.rename(oldname, newname)
end

def unpack_nuget_pkg(file, destination)
  unzip = Unzip.new
  unzip.destination = destination
  unzip.file = file
  unzip.execute
end

def ensure_nuget_package_nix(name)
  # NuGet doesn't work on Mono. So we're going to download our dependencies from NuGet.org.

  zip_file = PACKAGES[name][:filename]
  tmp_file = "#{zip_file}.tmp"

  if File.exist?(zip_file) and File.size?(zip_file) != nil then
    puts "#{zip_file} already exists, skipping download"
    unpack_nuget_pkg(zip_file, PACKAGES[name][:folder])
    return
  end

  puts "fetching #{zip_file}"
  File.open(tmp_file, "w") { |f|
    uri = URI.parse(PACKAGES[name][:url])

    fetch(uri) do |seg|
      f.write(seg)
    end
  }

  if File.size?(tmp_file) == nil then
    fail "Download failed for #{zip_file}"
  end

  rename_file(tmp_file, zip_file)
  unpack_nuget_pkg(zip_file, PACKAGES[name][:folder])
end

def all_nuget_packages_present?()
  result = true
  PACKAGES.values.each { |pkg|
    if !Dir.exists? pkg[:folder] then
      puts "Package missing: #{pkg[:name]}"
      result = false
    end
  }
  return result
end

def print_nuget_package_manifest()
  puts "Building with NuGet packages:"
  PACKAGES.values.each { |pkg|
    puts "#{pkg[:name]} => #{pkg[:version]}"
  }
end

def ensure_all_nuget_packages_nix()
  PACKAGES.values.each { |pkg|
    ensure_nuget_package_nix(pkg[:name])
  }
end

def read_package_config(filename)
  input_file = File.new(filename)
  xml = REXML::Document.new input_file

  xml.elements.each("packages/package") { |element|
    yield element
  }

  input_file.close
end

def read_nuget_packages()
  FileList["**/packages.config"].each { |config_file|
    read_package_config(config_file) { |pkg|
      name = pkg.attributes["id"]
      version = pkg.attributes["version"]
      # puts "Read package #{name} with version #{version}"
      PACKAGES[name]={}
      PACKAGES[name][:name]=name
      PACKAGES[name][:version]=version
      PACKAGES[name][:folder]="#{PACKAGES_DIR}/#{name}.#{version}"
      PACKAGES[name][:filename]="#{PACKAGES_DIR}/#{name}.#{version}.nupkg"
      PACKAGES[name][:url]="http://packages.nuget.org/api/v1/package/#{name}/#{version}"
    }
  }
end

def ensure_nuget_packages()
  Dir.mkdir PACKAGES_DIR unless Dir.exists? PACKAGES_DIR
  read_nuget_packages
  if all_nuget_packages_present?() then
    puts "All packages up to date"
    print_nuget_package_manifest
    return
  end

  if (is_nix()) then
    puts "updating packages with internal nuget replacement"
    ensure_all_nuget_packages_nix
    print_nuget_package_manifest
  else
    puts "updating packages with nuget"
    sh invoke_runtime("tools\\nuget.exe install Kayak.Tests\\packages.config -o #{PACKAGES_DIR}")
    print_nuget_package_manifest
  end
end

task :default => [:build, :test]

CONFIGURATION = "Release"
BUILD_DIR = File.expand_path("build")
OUTPUT_DIR = "#{BUILD_DIR}/out"
BIN_DIR = "#{BUILD_DIR}/bin"
PACKAGES_DIR = "packages"
PACKAGES = {}

assemblyinfo :assemblyinfo => :clean do |a|
  a.product_name = a.title = PRODUCT
  a.description = DESCRIPTION
  a.version = a.file_version = VERSION
  a.copyright = COPYRIGHT
  a.output_file = "Kayak/Properties/AssemblyInfo.cs"
  a.namespaces "System.Runtime.CompilerServices"
  a.custom_attributes :InternalsVisibleTo => "Kayak.Tests"
end

msbuild :build_msbuild do |b|
  b.properties :configuration => CONFIGURATION, "OutputPath" => OUTPUT_DIR
  b.targets :Build
  b.solution = "Kayak.sln"
end

xbuild :build_xbuild do |b|
  b.properties :configuration => CONFIGURATION, "OutputPath" => OUTPUT_DIR
  b.targets :Build
  b.solution = "Kayak.sln"
end

task :build => :assemblyinfo do
  ensure_submodules()
  ensure_nuget_packages()
  build_task = is_nix() ? "build_xbuild" : "build_msbuild"
  Rake::Task[build_task].invoke
end

task :test => :build do
  nunit = invoke_runtime("packages/NUnit.2.5.10.11092/tools/nunit-console.exe")
  sh "#{nunit} -labels #{OUTPUT_DIR}/Kayak.Tests.dll"
end

task :binaries => :build do
  Dir.mkdir(BIN_DIR)
  binaries = FileList("#{OUTPUT_DIR}/*.dll", "#{OUTPUT_DIR}/*.pdb") do |x|
    x.exclude(/nunit/)
    x.exclude(/.Tests/)
    x.exclude(/KayakExamples./)
  end
  FileUtils.cp_r binaries, BIN_DIR
end

task :dist_nuget => [:binaries, :build] do
  if is_nix()
    puts "Not running on Windows, skipping NuGet package creation."
  else
    input_nuspec = "Kayak.nuspec"
    output_nuspec = "#{BUILD_DIR}/Kayak.nuspec"

    transform_xml input_nuspec, output_nuspec do |x|
      x.root.elements["metadata/id"].text = PRODUCT
      x.root.elements["metadata/version"].text = VERSION
      x.root.elements["metadata/authors"].text = AUTHORS
      x.root.elements["metadata/owners"].text = AUTHORS
      x.root.elements["metadata/description"].text = DESCRIPTION
      x.root.elements["metadata/licenseUrl"].text = LICENSE_URL
      x.root.elements["metadata/projectUrl"].text = PROJECT_URL
      x.root.elements["metadata/tags"].text = "http io socket network async"
    end

    nuget = NuGetPack.new
    nuget.command = "tools/NuGet.exe"
    nuget.nuspec = output_nuspec
    nuget.output = BUILD_DIR
    #using base_folder throws as there are two options that begin with b in nuget 1.4
    nuget.parameters = "-Symbols"
    nuget.execute
  end
end

zip :dist_zip => [:build, :binaries] do |z|
  z.directories_to_zip BIN_DIR
  z.output_file = "kayak-#{VERSION}.zip"
  z.output_path = BUILD_DIR
end

task :dist => [:test, :dist_nuget, :dist_zip] do
end

task :clean do
  FileUtils.rm_rf BUILD_DIR
  FileUtils.rm_rf "Kayak/bin"
  FileUtils.rm_rf "Kayak/obj"
  FileUtils.rm_rf "Kayak.Tests/bin"
  FileUtils.rm_rf "Kayak.Tests/obj"
end

task :dist_clean => [:clean] do
  FileUtils.rm_rf PACKAGES_DIR
end


text:
OtherInfoSchema = new SimpleSchema({
  currentEmployment: {
    type: String,
  },
  availabilityFrom: {
    type: Date,
    optional: true,
    autoform: {
      type: 'bootstrap-datepicker',
    },
  },
  availabilityDepartureAbroad: {
    type: Boolean,
  },
  hobbies: {
    type: String,
    optional: true,
  },
  tattoos: {
    type: Boolean,
    optional: true,
    defaultValue: false,
  },
  whereTattoo: {
    type: String,
    optional: true,
    custom: function() {
      if (this.field('tattoos').value && !this.isSet && (!this.operator || (this.value === null || this.value === ''))) {
        return 'required';
      };
    },
  },
  skiDownhill: {
    type: String,
    autoform: {
      options: {
        No: 'No',
        Basic: 'Sufficient',
        Independent: 'Good',
        Proficient: 'Excellent'
      },
    },
  },
  snowboard: {
    type: String,
    autoform: {
      options: {
        No: 'No',
        Basic: 'Sufficient',
        Independent: 'Good',
        Proficient: 'Excellent'
      },
    },
  },
  SLRcameras: {
    type: Boolean,
  },

  howDidRecruitment: {
    type: String,
    autoform: {
      options: {
        No: 'Bacheche scolastiche',
        Basic: 'Facebook',
        Independent: 'Fiere',
        Proficient: 'Passaparola'
      },
    },
  },
  miscellaneous: {
    type: String,
    optional: true,
  },

});

Meteor.startup(function() {
  OtherInfoSchema.i18n('schemas.other-info');
});


text:
trait A {
  class C {}
}

trait B extends A {
  class C {} // error: cannot override
}

trait C extends A {
  type C = Int // error: cannot override
}


text:
namespace wildstar
{
    namespace data
    {
        QDataStream& operator>>( QDataStream& stream, IStreamable& data )
        {
            data.read( stream );
            return stream;
        }
    }
}


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

import java.math.*;

import javax.annotation.Generated;

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

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

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

    public UpdateTrailResult unmarshall(JsonUnmarshallerContext context) throws Exception {
        UpdateTrailResult updateTrailResult = new UpdateTrailResult();

        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 updateTrailResult;
        }

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

            if (token == FIELD_NAME || token == START_OBJECT) {
                if (context.testExpression("Name", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("S3BucketName", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setS3BucketName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("S3KeyPrefix", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setS3KeyPrefix(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("SnsTopicName", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setSnsTopicName(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("SnsTopicARN", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setSnsTopicARN(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("IncludeGlobalServiceEvents", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setIncludeGlobalServiceEvents(context.getUnmarshaller(Boolean.class).unmarshall(context));
                }
                if (context.testExpression("IsMultiRegionTrail", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setIsMultiRegionTrail(context.getUnmarshaller(Boolean.class).unmarshall(context));
                }
                if (context.testExpression("TrailARN", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setTrailARN(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("LogFileValidationEnabled", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setLogFileValidationEnabled(context.getUnmarshaller(Boolean.class).unmarshall(context));
                }
                if (context.testExpression("CloudWatchLogsLogGroupArn", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setCloudWatchLogsLogGroupArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("CloudWatchLogsRoleArn", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setCloudWatchLogsRoleArn(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("KmsKeyId", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setKmsKeyId(context.getUnmarshaller(String.class).unmarshall(context));
                }
                if (context.testExpression("IsOrganizationTrail", targetDepth)) {
                    context.nextToken();
                    updateTrailResult.setIsOrganizationTrail(context.getUnmarshaller(Boolean.class).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 updateTrailResult;
    }

    private static UpdateTrailResultJsonUnmarshaller instance;

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


text:
<?php

namespace San4io\EloquentFilter\Filters;

use Illuminate\Database\Eloquent\Builder;

class WhereFilter extends AbstractFilter
{
    /**
     * @param string $key
     * @param array|int $value
     * @return Builder
     */
    public function filter(string $key, $value): Builder
    {
        if (is_array($value)) {
            return $this->model->whereIn($key, $value);
        }

        return $this->model->where($key, $value);
    }
}


text:
import { Cordova, Plugin } from './plugin';
import { Observable } from 'rxjs/Observable';

/**
 * @name Keyboard
 * @description
 * @usage
 * ```typescript
 * import { Keyboard } from 'ionic-native';
 *
 *
 *
 * ```
 */
@Plugin({
  pluginName: 'Keyboard',
  plugin: 'ionic-plugin-keyboard',
  pluginRef: 'cordova.plugins.Keyboard',
  repo: 'https://github.com/driftyco/ionic-plugin-keyboard'
})
export class Keyboard {

  /**
   * Hide the keyboard accessory bar with the next, previous and done buttons.
   * @param hide {boolean}
   */
   @Cordova({sync: true})
  static hideKeyboardAccessoryBar(hide: boolean): void { }

  /**
   * Force keyboard to be shown.
   */
  @Cordova({
    sync: true,
    platforms: ['Android', 'BlackBerry 10', 'Windows']
  })
  static show(): void { }

  /**
   * Close the keyboard if open.
   */
  @Cordova({
    sync: true,
    platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
  })
  static close(): void { }

  /**
   * Prevents the native UIScrollView from moving when an input is focused.
   * @param disable
   */
  @Cordova({
    sync: true,
    platforms: ['iOS', 'Windows']
  })
  static disableScroll(disable: boolean): void { }

  /**
   * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
   */
  @Cordova({
    eventObservable: true,
    event: 'native.keyboardshow',
    platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
  })
  static onKeyboardShow(): Observable<any> { return; }

  /**
   * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
   */
  @Cordova({
    eventObservable: true,
    event: 'native.keyboardhide',
    platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
  })
  static onKeyboardHide(): Observable<any> { return; }

}


text:
.. _index:

South documentation
===================

South is a tool to provide consistent, easy-to-use and database-agnostic
migrations for Django applications.

This is the documentation for the current version (0.7); previous versions'
documentation was written directly into our wiki, but is mostly a subset of
what is written here.

If you want to view the old docs (for example, if you need something that was
only in 0.6) they're `still available <http://south.aeracode.org/wiki/OldDocumentation>`_.

Support
-------

For initial help with problems, see our `mailing list <http://groups.google.com/group/south-users>`_, or `#django-south <irc://irc.freenode.net/django-south>`_ on `freenode <http://freenode.net/>`_. If you find a real bug, then `file a new ticket <http://south.aeracode.org/newticket>`_.

Contents
--------

.. toctree::
   :maxdepth: 2

   about
   whataremigrations
   installation
   tutorial/index
   databaseapi
   convertinganapp
   migrationstructure
   dependencies
   commands
   unittests
   ormfreezing
   generics
   customfields
   autodetector
   signals
   fixtures
   settings
   releasenotes/index


text:
{% load i18n static %}
{% block extra_js %}

  <script type="text/javascript">
  $(function() {
    $('#id_drf__submit_date__gte').datetimepicker({
      timepicker: false,
      format: 'Y-m-d',
      i18n: {
          lang: window.dateTimePickerTranslations
      },
      lang: 'lang'
    });
    $('#id_drf__submit_date__lte').datetimepicker({
      timepicker: false,
      format: 'Y-m-d',
      i18n: {
          lang: window.dateTimePickerTranslations
      },
      lang: 'lang'
    });
    $("#resetbtn").click(function(){
      $(':input','#date_range_filter').val("");
    });
  });
  </script>
{% endblock %}
<h3 class="filter__label">
  {% blocktrans with filter_title=title %} By {{ filter_title }} {% endblocktrans %}
</h3>
{% with choices.0 as i %}
<form id="date_range_filter" method="GET" action="">
  {{ spec.form.media }}
  {{ spec.form.as_p }}
  {% for k, v in i.get_query.items %}
    <input type="hidden" name="{{ k }}" value="{{ v }}">
  {% endfor %}
  <button class="button" type="submit">{% trans "Search" %}</button>
  <button class="button" type="submit" id="resetbtn">{% trans "Clear" %}</button>
</form>
{% endwith %}


text:
package com.msgilligan.bitcoinj.json.conversion;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.KeyDeserializer;
import org.bitcoinj.core.Address;
import org.bitcoinj.core.NetworkParameters;

import java.io.IOException;

/**
 * Key Deserializer to support using Address as the key in a Map.
 */
public class AddressKeyDeserializer extends KeyDeserializer {
    private final NetworkParameters netParams;

    public AddressKeyDeserializer(NetworkParameters netParams) {
        this.netParams = netParams;
    }

    @Override
    public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return Address.fromString(netParams, key);
    }
}


text:
namespace RogueMetalicana.Constants.Shop
{
    public class ShopConstants
    {
        public const char Symbol = '$';

        public static string lastBought { get; set; }

        public static bool lastSuccess { get; set; }

        public static void PrintLastShopAction()
        {
            if (lastBought==null)
            {
                return;
            }
            if (lastSuccess)
            {
                Visualization.Visualisator.PrintUnderTheBattleField($"You have bought {lastBought} for {Constants.Potions.PotionsConstants.MarketPrice} gold");
            }
            else
            {
                Visualization.Visualisator.PrintUnderTheBattleField($"You don't have enought money!");

            }
        }

    }
}


text:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#F4F4F4" />
    <stroke
        android:width="@dimen/dimen_0.5dp"
        android:color="@color/divider_color" />
    <solid android:color="@color/white" />
    <corners android:radius="18dp" />
</shape>


text:
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"

#include <string>
#include <vector>

#include "base/bind.h"
#include "base/platform_file.h"
#include "base/string_util.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
#include "chrome/browser/chromeos/gdata/gdata_file_system.h"
#include "chrome/browser/chromeos/gdata/gdata.pb.h"
#include "chrome/browser/chromeos/gdata/gdata_system_service.h"
#include "chrome/browser/chromeos/gdata/gdata_util.h"
#include "webkit/blob/shareable_file_reference.h"
#include "webkit/fileapi/file_system_file_util_proxy.h"
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_util.h"

using base::MessageLoopProxy;
using content::BrowserThread;
using fileapi::FileSystemOperationInterface;
using webkit_blob::ShareableFileReference;

namespace {

const char kGDataRootDirectory[] = "drive";
const char kFeedField[] = "feed";

// Helper function to run SnapshotFileCallback from
// GDataFileSystemProxy::CreateSnapshotFile().
void CallSnapshotFileCallback(
    const FileSystemOperationInterface::SnapshotFileCallback& callback,
    base::PlatformFileInfo file_info,
    base::PlatformFileError error,
    const FilePath& local_path,
    const std::string& unused_mime_type,
    gdata::GDataFileType file_type) {
  scoped_refptr<ShareableFileReference> file_ref;

  // If the file is a hosted document, a temporary JSON file is created to
  // represent the document. The JSON file is not cached and its lifetime
  // is managed by ShareableFileReference.
  if (error == base::PLATFORM_FILE_OK && file_type == gdata::HOSTED_DOCUMENT) {
    file_ref = ShareableFileReference::GetOrCreate(
        local_path, ShareableFileReference::DELETE_ON_FINAL_RELEASE,
        BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
  }

  callback.Run(error, file_info, local_path, file_ref);
}

}  // namespace

namespace gdata {

base::FileUtilProxy::Entry GDataEntryProtoToFileUtilProxyEntry(
    const GDataEntryProto& proto) {
  base::PlatformFileInfo file_info;
  GDataEntry::ConvertProtoToPlatformFileInfo(proto.file_info(), &file_info);

  base::FileUtilProxy::Entry entry;
  entry.name = proto.file_name();
  entry.is_directory = file_info.is_directory;
  entry.size = file_info.size;
  entry.last_modified_time = file_info.last_modified;
  return entry;
}

// GDataFileSystemProxy class implementation.

GDataFileSystemProxy::GDataFileSystemProxy(
    GDataFileSystemInterface* file_system)
    : file_system_(file_system) {
  // Should be created from the file browser extension API (AddMountFunction)
  // on UI thread.
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
}

GDataFileSystemProxy::~GDataFileSystemProxy() {
  // Should be deleted from the CrosMountPointProvider on IO thread.
  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
}

void GDataFileSystemProxy::GetFileInfo(const GURL& file_url,
    const FileSystemOperationInterface::GetMetadataCallback& callback) {
  FilePath file_path;
  if (!ValidateUrl(file_url, &file_path)) {
    base::MessageLoopProxy::current()->PostTask(
        FROM_HERE,
        base::Bind(callback,
                   base::PLATFORM_FILE_ERROR_NOT_FOUND,
                   base::PlatformFileInfo(),
                   FilePath()));
    return;
  }

  file_system_->GetEntryInfoByPathAsync(
      file_path,
      base::Bind(&GDataFileSystemProxy::OnGetMetadata,
                 this,
                 file_path,
                 callback));
}

void GDataFileSystemProxy::Copy(const GURL& src_file_url,
    const GURL& dest_file_url,
    const FileSystemOperationInterface::StatusCallback& callback) {
  FilePath src_file_path, dest_file_path;
  if (!ValidateUrl(src_file_url, &src_file_path) ||
      !ValidateUrl(dest_file_url, &dest_file_path)) {
    MessageLoopProxy::current()->PostTask(FROM_HERE,
         base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
    return;
  }

  file_system_->Copy(src_file_path, dest_file_path, callback);
}

void GDataFileSystemProxy::Move(const GURL& src_file_url,
    const GURL& dest_file_url,
    const FileSystemOperationInterface::StatusCallback& callback) {
  FilePath src_file_path, dest_file_path;
  if (!ValidateUrl(src_file_url, &src_file_path) ||
      !ValidateUrl(dest_file_url, &dest_file_path)) {
    MessageLoopProxy::current()->PostTask(FROM_HERE,
         base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
    return;
  }

  file_system_->Move(src_file_path, dest_file_path, callback);
}

void DoNothing(base::PlatformFileError /*error*/,
               int /*bytes_total*/,
               int /*bytes_used*/) {
}

void GDataFileSystemProxy::ReadDirectory(const GURL& file_url,
    const FileSystemOperationInterface::ReadDirectoryCallback& callback) {
  FilePath file_path;
  if (!ValidateUrl(file_url, &file_path)) {
    base::MessageLoopProxy::current()->PostTask(
        FROM_HERE,
        base::Bind(callback,
                   base::PLATFORM_FILE_ERROR_NOT_FOUND,
                   std::vector<base::FileUtilProxy::Entry>(),
                   false));
    return;
  }

  // File paths with type GDATA_SEARH_PATH_QUERY are virtual path reserved for
  // displaying gdata content search results. They are formatted so their base
  // name equals to search query. So to get their contents, we have to kick off
  // content search.
  if (util::GetSearchPathStatus(file_path) == util::GDATA_SEARCH_PATH_QUERY) {
    file_system_->SearchAsync(
        file_path.BaseName().value(),
        base::Bind(&GDataFileSystemProxy::OnReadDirectory,
                   this,
                   file_system_->hide_hosted_documents(),
                   callback));
    return;
  }

  file_system_->ReadDirectoryByPathAsync(
      file_path,
      base::Bind(&GDataFileSystemProxy::OnReadDirectory,
                 this,
                 file_system_->hide_hosted_documents(),
                 callback));
}

void GDataFileSystemProxy::Remove(const GURL& file_url, bool recursive,
    const FileSystemOperationInterface::StatusCallback& callback) {
  FilePath file_path;
  if (!ValidateUrl(file_url, &file_path)) {
    MessageLoopProxy::current()->PostTask(FROM_HERE,
         base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
    return;
  }

  file_system_->Remove(file_path, recursive, callback);
}

void GDataFileSystemProxy::CreateDirectory(
    const GURL& file_url,
    bool exclusive,
    bool recursive,
    const FileSystemOperationInterface::StatusCallback& callback) {
  FilePath file_path;
  if (!ValidateUrl(file_url, &file_path)) {
    MessageLoopProxy::current()->PostTask(FROM_HERE,
         base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND));
    return;
  }

  file_system_->CreateDirectory(file_path, exclusive, recursive, callback);
}

void GDataFileSystemProxy::CreateSnapshotFile(
    const GURL& file_url,
    const FileSystemOperationInterface::SnapshotFileCallback& callback) {
  FilePath file_path;
  base::PlatformFileInfo file_info;
  GDataFileProperties file_properties;
  if (!ValidateUrl(file_url, &file_path) ||
      !file_system_->GetFileInfoByPath(file_path, &file_properties)) {
    MessageLoopProxy::current()->PostTask(FROM_HERE,
         base::Bind(callback,
                    base::PLATFORM_FILE_ERROR_NOT_FOUND,
                    base::PlatformFileInfo(),
                    FilePath(),
                    scoped_refptr<ShareableFileReference>(NULL)));
    return;
  }

  file_system_->GetFileByPath(file_path,
                              base::Bind(&CallSnapshotFileCallback,
                                         callback,
                                         file_properties.file_info),
                              GetDownloadDataCallback());
}

// static.
bool GDataFileSystemProxy::ValidateUrl(const GURL& url, FilePath* file_path) {
  // what platform you're on.
  FilePath raw_path;
  fileapi::FileSystemType type = fileapi::kFileSystemTypeUnknown;
  if (!fileapi::CrackFileSystemURL(url, NULL, &type, file_path) ||
      type != fileapi::kFileSystemTypeExternal) {
    return false;
  }
  return true;
}

void GDataFileSystemProxy::OnGetMetadata(
    const FilePath& file_path,
    const FileSystemOperationInterface::GetMetadataCallback& callback,
    base::PlatformFileError error,
    const FilePath& entry_path,
    scoped_ptr<gdata::GDataEntryProto> entry_proto) {
  if (error != base::PLATFORM_FILE_OK) {
    callback.Run(error, base::PlatformFileInfo(), FilePath());
    return;
  }
  DCHECK(entry_proto.get());

  base::PlatformFileInfo file_info;
  GDataEntry::ConvertProtoToPlatformFileInfo(
      entry_proto->file_info(),
      &file_info);

  callback.Run(base::PLATFORM_FILE_OK, file_info, file_path);
}

void GDataFileSystemProxy::OnReadDirectory(
    bool hide_hosted_documents,
    const FileSystemOperationInterface::ReadDirectoryCallback&
    callback,
    base::PlatformFileError error,
    scoped_ptr<gdata::GDataDirectoryProto> directory_proto) {
  if (error != base::PLATFORM_FILE_OK) {
    callback.Run(error, std::vector<base::FileUtilProxy::Entry>(), false);
    return;
  }
  std::vector<base::FileUtilProxy::Entry> entries;
  // Convert gdata files to something File API stack can understand.
  for (int i = 0; i < directory_proto->child_directories_size(); ++i) {
    const GDataDirectoryProto& proto = directory_proto->child_directories(i);
    entries.push_back(
        GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry()));
  }
  for (int i = 0; i < directory_proto->child_files_size(); ++i) {
    const GDataFileProto& proto = directory_proto->child_files(i);
    if (hide_hosted_documents && proto.is_hosted_document())
        continue;
    entries.push_back(
        GDataEntryProtoToFileUtilProxyEntry(proto.gdata_entry()));
  }

  callback.Run(base::PLATFORM_FILE_OK, entries, false);
}

}  // namespace gdata


text:
@implementation CleanLaunchAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self.thirdPartiesConfigurator configurate];
    [self.applicationConfigurator setupCoreDataStack];
    [self.applicationConfigurator configureInitialSettings];
    [self.spotlightCoreDataStackCoordinator setupCoreDataStack];
    [self.indexerMonitor startMonitoring];
    [self.quickActionDaemon start];
    [self.lectureMaterialService createCachedDirectoryIfNeeded];
    [self.cleanStartRouter openInitialScreen];

    return YES;
}

@end


text:
package org.syncope.core.persistence.beans;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class SyncopeConf extends AbstractBaseBean {

    private static final long serialVersionUID = -899341077670090120L;

    @Id
    @Column(name = "confKey")
    private String key;

    @Column(name = "confValue")
    private String value;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

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


text:
var /* Declaring imports */

	_options = {
			currentLocale : "ptBR",
			locales : [ "ptBR", "enUS" ]
	},
	_data = {};

module.exports = {

	configure : function(options){

		_options = options;
	},
	setLocale : function(locale){

		_options.currentLocale = locale;
	},

	getLocales : function(){

		return _options.locales;
	},

	load : function(name, module){

		_data[name] = {};

		for(var i = 0; i < _options.locales.length; i++){

			var l = _options.locales[i];
			_data[name][l] = require(module + l + '.json');
		}
		return this;
	},

	get : function(name, locale){

		locale = locale || _options.currentLocale;

		return _data[name][locale];
	}
};


text:
<?php
class Userinfo_model extends CI_Model {

	public function __construct()
	{
		// Call the CI_Model constructor
		parent::__construct();
	}

}


text:
(function ($, w, undefined) {
    if (w.footable === undefined || w.footable === null)
        throw new Error('Please check and make sure footable.js is included in the page and is loaded prior to this script.');

    var defaults = {
        filter: {
            enabled: true,
            input: '.footable-filter',
            timeout: 300,
            minimum: 2,
            disableEnter: false,
            filterFunction: function(index) {
                var $t = $(this),
                    $table = $t.parents('table:first'),
                    filter = $table.data('current-filter').toUpperCase();
                var text = $t.find('td[filter-ignore="false"]').text();
                if (!$table.data('filter-text-only')) {
                    $t.find('td[data-value]').each(function () {
                        text += $(this).data('value');
                    });
                }
                return text.toUpperCase().indexOf(filter) >= 0;
            }
        }
    };

    function Filter() {
        var p = this;
        p.name = 'Footable Filter';
        p.init = function (ft) {
            p.footable = ft;
            if (ft.options.filter.enabled === true) {
                if ($(ft.table).data('filter') === false) return;
                ft.timers.register('filter');
                $(ft.table)
                    .unbind('.filtering')
                    .bind({
                        'footable_initialized.filtering': function (e) {
                            var $table = $(ft.table);
                            var data = {
                                'input': $table.data('filter') || ft.options.filter.input,
                                'timeout': $table.data('filter-timeout') || ft.options.filter.timeout,
                                'minimum': $table.data('filter-minimum') || ft.options.filter.minimum,
                                'disableEnter': $table.data('filter-disable-enter') || ft.options.filter.disableEnter
                            };
                            if (data.disableEnter) {
                                $(data.input).keypress(function (event) {
                                    if (window.event)
                                        return (window.event.keyCode !== 13);
                                    else
                                        return (event.which !== 13);
                                });
                            }
                            $table.bind('footable_clear_filter', function () {
                                $(data.input).val('');
                                p.clearFilter();
                            });
                            $table.bind('footable_filter', function (event, args) {
                                p.filter(args.filter);
                            });
                            $(data.input).keyup(function (eve) {
                                ft.timers.filter.stop();
                                if (eve.which === 27) {
                                    $(data.input).val('');
                                }
                                ft.timers.filter.start(function () {
                                    var val = $(data.input).val() || '';
                                    p.filter(val);
                                }, data.timeout);
                            });
                        },
                        'footable_redrawn.filtering': function (e) {
                            var $table = $(ft.table),
                                filter = $table.data('filter-string');
                            if (filter) {
                                p.filter(filter);
                            }
                        }
                })
                //save the filter object onto the table so we can access it later
                .data('footable-filter', p);
            }
        };

        p.filter = function (filterString) {
            var ft = p.footable,
                $table = $(ft.table),
                minimum = $table.data('filter-minimum') || ft.options.filter.minimum,
                clear = !filterString;

            //raise a pre-filter event so that we can cancel the filtering if needed
            var event = ft.raise('footable_filtering', { filter: filterString, clear: clear });
            if (event && event.result === false) return;
            if (event.filter && event.filter.length < minimum) {
              return; //if we do not have the minimum chars then do nothing
            }

          if (event.clear) {
                p.clearFilter();
            } else {
                var filters = event.filter.split(' ');

                $table.find('> tbody > tr').hide().addClass('footable-filtered');
                var rows = $table.find('> tbody > tr:not(.footable-row-detail)');
                $.each(filters, function (i, f) {
                    if (f && f.length > 0) {
                        $table.data('current-filter', f);
                        rows = rows.filter(ft.options.filter.filterFunction);
                    }
                });
                rows.each(function () {
                    p.showRow(this, ft);
                    $(this).removeClass('footable-filtered');
                });
                $table.data('filter-string', event.filter);
                ft.raise('footable_filtered', { filter: event.filter, clear: false });
            }
        };

        p.clearFilter = function () {
            var ft = p.footable,
                $table = $(ft.table);

            $table.find('> tbody > tr:not(.footable-row-detail)').removeClass('footable-filtered').each(function () {
                p.showRow(this, ft);
            });
            $table.removeData('filter-string');
            ft.raise('footable_filtered', { clear: true });
        };

        p.showRow = function (row, ft) {
            var $row = $(row), $next = $row.next(), $table = $(ft.table);
            if ($row.is(':visible')) return; //already visible - do nothing
            if ($table.hasClass('breakpoint') && $row.hasClass('footable-detail-show') && $next.hasClass('footable-row-detail')) {
                $row.add($next).show();
                ft.createOrUpdateDetailRow(row);
            }
            else $row.show();
        };
    }

    w.footable.plugins.register(Filter, defaults);

})(jQuery, window);


text:
package org.kie.server.integrationtests.drools;

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

import org.drools.core.command.runtime.rule.ClearRuleFlowGroupCommand;
import org.junit.BeforeClass;
import org.junit.Test;
import org.kie.api.command.BatchExecutionCommand;
import org.kie.api.command.Command;
import org.kie.server.api.model.KieContainerResource;
import org.kie.server.api.model.ReleaseId;
import org.kie.server.api.model.ServiceResponse;

public class RuleFlowIntegrationTest extends DroolsKieServerBaseIntegrationTest {

    private static ReleaseId releaseId = new ReleaseId("org.kie.server.testing", "ruleflow-group",
            "1.0.0.Final");

    private static final String CONTAINER_ID = "ruleflow";
    private static final String KIE_SESSION = "defaultKieSession";
    private static final String KIE_SESSION_STATELESS = "defaultStatelessKieSession";
    private static final String PROCESS_ID = "simple-ruleflow";
    private static final String LIST_NAME = "list";
    private static final String LIST_OUTPUT_NAME = "output-list";
    private static final String RULEFLOW_GROUP_1 = "ruleflow-group1";

    @BeforeClass
    public static void buildAndDeployArtifacts() {
        buildAndDeployCommonMavenParent();
        buildAndDeployMavenProject(ClassLoader.class.getResource("/kjars-sources/ruleflow-group").getFile());
    }

    @Test
    public void testExecuteSimpleRuleFlowProcess() {
        assertSuccess(client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)));

        List<Command<?>> commands = new ArrayList<Command<?>>();
        BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION);

        commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME));
        commands.add(commandsFactory.newStartProcess(PROCESS_ID));
        commands.add(commandsFactory.newFireAllRules());
        commands.add(commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME));

        ServiceResponse<String> response = ruleClient.executeCommands(CONTAINER_ID, batchExecution);
        assertSuccess(response);
        String result = response.getResult();
        assertResultContainsStringRegex(result,
            ".*Rule from first ruleflow group executed.*Rule from second ruleflow group executed.*");
    }

    @Test
    public void testExecuteSimpleRuleFlowProcessInStatelessSession() {
        assertSuccess(client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)));

        List<Command<?>> commands = new ArrayList<Command<?>>();
        BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION_STATELESS);

        commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME));
        commands.add(commandsFactory.newStartProcess(PROCESS_ID));
        commands.add(commandsFactory.newFireAllRules());
        commands.add(commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME));

        ServiceResponse<String> response = ruleClient.executeCommands(CONTAINER_ID, batchExecution);
        assertSuccess(response);
        String result = response.getResult();
        assertResultContainsStringRegex(result,
            ".*Rule from first ruleflow group executed.*Rule from second ruleflow group executed.*");
    }

    @Test
    public void testClearRuleFlowGroup() {
        assertSuccess(client.createContainer(CONTAINER_ID, new KieContainerResource(CONTAINER_ID, releaseId)));

        List<Command<?>> commands = new ArrayList<Command<?>>();
        BatchExecutionCommand batchExecution = commandsFactory.newBatchExecution(commands, KIE_SESSION);

        commands.add(commandsFactory.newSetGlobal(LIST_NAME, new ArrayList<String>(), LIST_OUTPUT_NAME));
        // Replace if/after Clear command is added to command factory.
        // commands.add(commandsFactory.newClearRuleFlowGroup(RULEFLOW_GROUP_1));
        commands.add(new ClearRuleFlowGroupCommand(RULEFLOW_GROUP_1));
        commands.add(commandsFactory.newStartProcess(PROCESS_ID));
        commands.add(commandsFactory.newFireAllRules());
        commands.add(commandsFactory.newGetGlobal(LIST_NAME, LIST_OUTPUT_NAME));

        ServiceResponse<String> response = ruleClient.executeCommands(CONTAINER_ID, batchExecution);
        assertSuccess(response);
        String result = response.getResult();
        assertResultContainsStringRegex(result,
                ".*Rule from second ruleflow group executed.*");
        assertResultNotContainingStringRegex(result,
            ".*Rule from first ruleflow group executed.*");
    }
}


text:
using System;
using Entitas.CodeGenerator;
using My.Namespace;
using NSpec;

class describe_ComponentExtensionsGenerator : nspec {

    const bool logResults = false;

    const string classSuffix = "GeneratedExtension";

    void generates(ComponentInfo componentInfo, string expectedFileContent) {
        expectedFileContent = expectedFileContent.ToUnixLineEndings();
        var files = new ComponentExtensionsGenerator().Generate(new[] { componentInfo });
        var expectedFilePath = componentInfo.fullTypeName + classSuffix;

        files.Length.should_be(1);
        var file = files[0];

        #pragma warning disable
        if (logResults) {
            Console.WriteLine("should:\n" + expectedFileContent);
            Console.WriteLine("was:\n" + file.fileContent);
        }

        file.fileName.should_be(expectedFilePath);
        file.fileContent.should_be(expectedFileContent);
    }

    void when_generating() {
        it["component without fields"] = () => generates(MovableComponent.componentInfo, MovableComponent.extensions);
        it["component with fields"] = () => generates(PersonComponent.componentInfo, PersonComponent.extensions);
        it["single component without fields"] = () => generates(AnimatingComponent.componentInfo, AnimatingComponent.extensions);
        it["single component with fields"] = () => generates(UserComponent.componentInfo, UserComponent.extensions);
        it["component for custom pool"] = () => generates(OtherPoolComponent.componentInfo, OtherPoolComponent.extensions);
        it["supports properties"] = () => generates(ComponentWithFieldsAndProperties.componentInfo, ComponentWithFieldsAndProperties.extensions);
        it["ignores [DontGenerate]"] = () => {
            var componentInfo = DontGenerateComponent.componentInfo;
            var files = new ComponentExtensionsGenerator().Generate(new[] { componentInfo });
            files.Length.should_be(0);
        };

        it["works with namespaces"] = () => generates(NamespaceComponent.componentInfo, NamespaceComponent.extensions);
        it["generates matchers for each pool"] = () => generates(CComponent.componentInfo, CComponent.extensions);
        it["generates custom prefix"] = () => generates(CustomPrefixComponent.componentInfo, CustomPrefixComponent.extensions);
        it["generates component with default pool"] = () => generates(DefaultPoolComponent.componentInfo, DefaultPoolComponent.extensions);
        it["generates component with default pool and others"] = () => generates(MultiplePoolAndDefaultPoolComponent.componentInfo, MultiplePoolAndDefaultPoolComponent.extensions);

        it["generates component for class"] = () => generates(SomeClass.componentInfo, SomeClass.extensions);
        it["generates component for struct"] = () => generates(SomeStruct.componentInfo, SomeStruct.extensions);
    }
}


text:
/**
 * Custom JavaScript functions for VehicleOrderApp
 *
 */
// don't define this twice
if (!AETF) {AETF = {};};

(function() {
  // 'namespaces'
  AETF.vehicleorder = {};
  AETF.vehicleorder.dealer = {};
  AETF.vehicleorder.accessories = {};

  // private vars here
  var geocoder = new google.maps.Geocoder();

  // functions
  AETF.vehicleorder.init = function() { };

  /**
   * Loop through dealers and create map markers for each one
   * */
  AETF.vehicleorder.dealer.loadDealers = function() {
    // GMaps needs upper-case letters
    var letter = 'A';
    var map = Tiggzi('dealer_map').gmap;

    VehicleOrderService_DealerService_JSDO.jsdo
      .eDealer
      .foreach(function(dealer) {
          AETF.vehicleorder.dealer.addMarker(dealer.data, map, letter);
          letter = AETF.util.nextChar(letter);
        });
  };

  /**
   * Once a dealer is selected, update the eShoppingCart
   */
  AETF.vehicleorder.dealer.selectDealer = function(element) {
    // From the cart, set the current dealer
    // The service call to VehicleOrderService_ShoppingCartService_eShoppingCart_Row
    // has already selected the correct record, so we don't need to
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCart
        .assign({"DealerId"   : $(element).val(),
                 "DealerCode" : $(element).find('option:selected').text()});
  };

  AETF.vehicleorder.dealer.setSelectedDealer = function(dlrId) {
   var dlrList =  Tiggzi('dealer_list');
  // set the value of the Dealer drop-down/select
    dlrList.find(" > option[value='" + dlrId+ "']")
           .attr('selected', 'selected');
    dlrList.selectmenu('refresh');

    AETF.vehicleorder.dealer.selectDealer(dlrList);
  };

  AETF.vehicleorder.dealer.infoWindows = [];

  AETF.vehicleorder.dealer.addMarker = function(dealer, dealer_map, letter) {
    // Uses dealer.Location because it's got a better chance of actually
    // existing (dealer.StreetAddress is basically made up
    geocoder.geocode({address : dealer.Location},
        function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
              var marker = new google.maps.Marker(
                  {title: dealer.Name,
                   position: results[0].geometry.location,
                   map : dealer_map,
                   icon : "http://maps.google.com/mapfiles/marker" + letter + ".png"
                  }
              );

            var contentString = '
'
                + '
'
                + '
'
                + '
'
                + dealer.Name
                + '
'
                + '
'
                + '

'
                + '
Address	' + dealer.StreetAddress
                + '
'
                + '
Email Sales	' + dealer.SalesEmail
                + '
' + '
Phone	' + dealer.PhoneNumber
                + '
'
                + '
<button type="button" onclick="AETF.vehicleorder.dealer.setSelectedDealer(\''+dealer.DealerId+'\');">'
                + 'Choose ' + dealer.Name + '</button>'
                + '<button type="button" onclick="console.log(\'no-op\');">Get directions</button>	'
                + '
'
                + '

' + '

';

            var infowindow = new google.maps.InfoWindow({content : contentString });

            // store reference to keep for later so that we can remove when another marker clicked
            AETF.vehicleorder.dealer.infoWindows.push(infowindow);

            google.maps.event.addListener(marker, 'click', function() {
                //automatically close other infowindows when a new one is opened
                while (AETF.vehicleorder.dealer.infoWindows.length > 0) {
                    var iw = AETF.vehicleorder.dealer.infoWindows.pop();
                    iw.close();
                  };
                infowindow.open(dealer_map, marker);
            });
          } else {
            alert("Geocode was not successful for the following reason: "+ status);};
        });
  };

  AETF.vehicleorder.accessories.addInput = function(inputType, inputName, item, option,html) {
    html = html + '<input type="'+inputType+'" name="' + inputName
        + '" id="'+inputType+'-' + item.data.ItemNum
        + '" value="' + item.data.ItemId
        + '" data-option-id="' + item.data.ItemId
        + '" data-option-price="' + item.data.Price
        + '" data-option-name="' + item.data.ItemName
        + '" data-option-num="' + item.data.ItemNum
        + '" data-option-type="' + item.data.ItemType
        + '" data-option-qty="' + option.data.Quantity
        + '" ';

    if (option.data.StandardOption) {html = html + ' checked="checked" ';};

    html = html + '/>' + ''
        + '
'
        + item.data.Description + '
'
        + '
'
        + accounting.formatMoney(item.data.Price) + '
' + '';

    return html;
  };

  AETF.vehicleorder.accessories.loadInterior = function() {
    Tiggzi('interior_accessories').empty();
    Tiggzi('interior_trimmaterial').empty();
    Tiggzi('interior_trimcolour').empty();

    // add accessories to UI

    // build up the UI widgets from item options
    var accessoryHtml = '<fieldset data-role="controlgroup">';
    var materialHtml = '<fieldset data-role="controlgroup">';
    var colourHtml = '<fieldset data-role="controlgroup">';

    // eVehicle should be available via service call and will filter the options
    VehicleOrderService_BrandDataService_JSDO.jsdo
        .eItemOption
        .foreach(function(itemOption) {
          // console.log(option);
          // Find the relevant Item, for the name,id and type
          var item = VehicleOrderService_BrandDataService_JSDO.jsdo
              .eItem
              .find(function(item) {
                return (itemOption.data.ChildItemId === item.data.ItemId);});

          if (itemOption.data.ChildType === "Accessories") {
            accessoryHtml = AETF.vehicleorder.accessories.addInput('checkbox', 'checkbox-accessories', item, itemOption, accessoryHtml);
          };
          if (itemOption.data.ChildType === "Trim-Material") {
            materialHtml = AETF.vehicleorder.accessories.addInput('radio', 'radio-trim-material', item, itemOption, materialHtml);
          };
          if (itemOption.data.ChildType === "Trim-Colour") {
            colourHtml = AETF.vehicleorder.accessories.addInput('radio', 'radio-trim-colour', item, itemOption, colourHtml);
          };
        });

    accessoryHtml = accessoryHtml + '</fieldset>';
    materialHtml = materialHtml + '</fieldset>';
    colourHtml = colourHtml + '</fieldset>';

    Tiggzi('interior_accessories').append(accessoryHtml);
    Tiggzi('interior_accessories').trigger("create");

    Tiggzi('interior_trimmaterial').append(materialHtml);
    Tiggzi('interior_trimmaterial').trigger("create");

    Tiggzi('interior_trimcolour').append(colourHtml);
    Tiggzi('interior_trimcolour').trigger("create");

    // now select from cart options
    // Cart should be available already
    VehicleOrderService_ShoppingCartService_JSDO.jsdo.eShoppingCart.record;

    // .findById(localStorage.getItem('cartId'));
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCartOption
        .foreach(function(cartOption) {

          if (cartOption.data.ItemType === "Accessories") {
            //$('input:checkbox[name=checkbox-accessories]').selectByValue(cartOption.data.ItemId);
            Tiggzi('checkbox-accessories')
                .find(" > option[value='" + cartOption.data.ItemId+ "']")
                .attr('selected', 'selected');
            };
          if (cartOption.data.ItemType === "Trim-Material") {
            //$('input:radio[name=radio-trim-material]').selectByValue(cartOption.data.ItemId);
            Tiggzi('radio-trim-material')
                .find(" > option[value='" + cartOption.data.ItemId+ "']")
                .attr('checked', 'checked');
          };
          if (cartOption.data.ItemType === "Trim-Colour") {
              console.log(cartOption.data);
            //$('input:radio[name=radio-trim-colour]').selectByValue(cartOption.data.ItemId);
            console.log(Tiggzi('radio-trim-colour').find(" > option[value='" + cartOption.data.ItemId+ "']"));

              Tiggzi('radio-trim-colour')
                .find(" > option[value='" + cartOption.data.ItemId+ "']")
                .attr('checked', 'checked');
          };
        });

    Tiggzi('interior_accessories').refresh();
    Tiggzi('interior_trimmaterial').refresh();
    Tiggzi('interior_trimcolour').refresh();
  };

  AETF.vehicleorder.accessories.loadExterior = function() {
    Tiggzi('exterior_moonroof').empty();
    Tiggzi('exterior_wheels').empty();
    Tiggzi('exterior_paintcolour').empty();

    // add accessories to UI
    // vars for new content
    var moonroofHtml = '<fieldset data-role="controlgroup">';
    var wheelsHtml = '<fieldset data-role="controlgroup">';
    var colourHtml = '<fieldset data-role="controlgroup">';

    // eVehicle should be available via service call and will filter the options
    VehicleOrderService_BrandDataService_JSDO.jsdo
        .eItemOption
        .foreach(function(option) {
          // console.log(option);
          // Find the relevant Item, for the name,id and type
          var item = VehicleOrderService_BrandDataService_JSDO.jsdo
              .eItem
              .find(function(item) {return (option.data.ChildItemId === item.data.ItemId);
              });

          if (option.data.ChildType === "Moonroof") {
            moonroofHtml = AETF.vehicleorder.accessories.addInput('radio', 'radio-moonroof', item, option, moonroofHtml);
          };
          if (option.data.ChildType === "Wheels") {
            wheelsHtml = AETF.vehicleorder.accessories.addInput('radio', 'radio-wheels', item, option, wheelsHtml);
          };
          if (option.data.ChildType === "Ext-Colour") {
            colourHtml = AETF.vehicleorder.accessories.addInput('radio', 'radio-ext-colour', item, option, colourHtml);
            };
        });

    moonroofHtml = moonroofHtml + '</fieldset>';
    wheelsHtml = wheelsHtml + '</fieldset>';
    colourHtml = colourHtml + '</fieldset>';

    Tiggzi('exterior_moonroof').append(moonroofHtml);
    Tiggzi('exterior_moonroof').trigger("create");

    Tiggzi('exterior_wheels').append(wheelsHtml);
    Tiggzi('exterior_wheels').trigger("create");

    Tiggzi('exterior_paintcolour').append(colourHtml);
    Tiggzi('exterior_paintcolour').trigger("create");

    // now select from cart options
    // .findById(localStorage.getItem('cartId'));
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCartOption
        .foreach(function(cartOption) {
          if (cartOption.data.ItemType === "Moonroof") {
            $('input:radio[name=radio-moonroof]').selectByValue(cartOption.data.ItemId);
          };
          if (cartOption.data.ItemType === "Wheels") {
            $('input:radio[name=radio-wheels]').selectByValue(cartOption.data.ItemId);
          };
          if (cartOption.data.ItemType === "Ext-Colour") {
            $('input:radio[name=radio-ext-colour]').selectByValue(cartOption.data.ItemId);
          };
        });
    Tiggzi('exterior_moonroof').refresh();
    Tiggzi('exterior_wheels').refresh();
    Tiggzi('exterior_paintcolour').refresh();
  };

  AETF.vehicleorder.updateCartTotal = function(cart) {
    // total up the cart price with all options, not just this page
    var cartTotal = +0.0;
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCartOption
        .foreach(function(sco) {
          var itemTotal = +0.0;
          itemTotal += (sco.data.Price * sco.data.Quantity);
          if (sco.data.Discount > 0) {
            itemTotal = itemTotal - (sco.data.Discount * itemTotal) / 100;};

          cartTotal += itemTotal;
        });

    var vehicle = VehicleOrderService_BrandDataService_JSDO.jsdo
        .eVehicle
        .findById(localStorage.getItem('vehicleId'));

    cartTotal = (vehicle.data.Price + cartTotal) * cart.data.Qty;
    if (cart.data.Discount > 0) {
      cartTotal = cartTotal - (cart.data.Discount * cartTotal) / 100;
    };

    cart.assign({"Price" : cartTotal});
  };

  AETF.vehicleorder.updateCartOptions = function(pageName) {
    var cartOptionTable = VehicleOrderService_ShoppingCartService_JSDO.jsdo
          .eShoppingCartOption;

    var shoppingCart = VehicleOrderService_ShoppingCartService_JSDO.jsdo
          .eShoppingCart.record; // returns JSRecord

    if (pageName === 'interior') {
      // delete all accessories options, since we don't know how many were
      // previously selected nor which ones
      cartOptionTable.foreach(function(removeOption) {
        if (removeOption.ItemType === "Accessories") {removeOption.remove();}
      });

      updateOptionFromUI("interior_accessories", shoppingCart.data.Id, "Accessories", true);
      updateOptionFromUI("interior_trimmaterial", shoppingCart.data.Id, "Trim-Material", false);
      updateOptionFromUI("interior_trimcolour", shoppingCart.data.Id, "Trim-Colour", false);
    } else if (pageName === 'exterior') {
      // add options from UI
      updateOptionFromUI("exterior_moonroof", shoppingCart.data.Id, "Moonroof", false);
      updateOptionFromUI("exterior_wheels", shoppingCart.data.Id, "Ext-Wheels", false);
      updateOptionFromUI("exterior_paintcolour", shoppingCart.data.Id, "Ext-Colour", false);
    };

    AETF.vehicleorder.updateCartTotal(shoppingCart);

    function updateOptionFromUI(widgetName, cartId, itemType, allowMultiple) {
      $('[dsid="' + widgetName + '"] input:checked ').each(function() {
        if (!allowMultiple) {
          // is there already a selected accessory?
          var optionRecord = cartOptionTable.find(function(sco) {
            return (sco.data.ItemType === itemType);
          });
        }
        ;
        // if not, create one
        if (!optionRecord) {
          optionRecord = cartOptionTable.add({
            "Id" : cartId,
            "ItemType" : itemType
          });
        };

        optionRecord.assign({
          "ItemId" : $(this).attr('data-option-id'),
          "Quantity" : $(this).attr('data-option-qty'),
          "Price" : $(this).attr('data-option-price'),
          "ItemType" : $(this).attr('data-option-type'),
          "ItemNum" : $(this).attr('data-option-num'),
          "ItemName" : $(this).attr('data-option-name')
        });
      });
    };
  }; // AETF.vehicleorder.updateCartOptions

  /**
   * selectVehicle fired when a particular vehicle style is selected
   */
  AETF.vehicleorder.selectVehicle = function(selectedElement) {
    // we always have a cart. explicitly get the cart here
    var cart = VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCart
        .findById(localStorage.getItem('cartId')); // returns JSRecord

    // if this is a different item in the cart, clear out the old contents,
    // and add new stuff
    if ($(selectedElement).attr('data-item-id') !== cart.data.ItemId) {
      // Find the vehicle record
      var vehicle = VehicleOrderService_BrandDataService_JSDO.jsdo
          .eVehicle
          .findById($(selectedElement).attr('data-vehicle-id'));

      cart.assign({
        "Price" : vehicle.data.Price,
        "ItemName" : vehicle.data.VehicleName,
        "ItemId" : vehicle.data.ItemId,
        "Qty" : 1,
        "ItemType" : vehicle.data.VehicleType
      });

      // remove cart options, if any exist
      VehicleOrderService_ShoppingCartService_JSDO.jsdo
          .eShoppingCartOption
          .foreach(function(cartOption) {
            // console.log(cartOption);
            // console.log('removing old option ' + cartOption.data.ItemName);
            cartOption.remove();
          });

      // add standard options to cart
      VehicleOrderService_BrandDataService_JSDO.jsdo
          .eItemOption
          .foreach(function(itemOption) {
            if (itemOption.data.StandardOption) {
              // find the eItem for the eItemOption. The foreach()
              // does this find by traversing the ProDataSet relations
              var item = VehicleOrderService_BrandDataService_JSDO.jsdo
                  .eItem.record;

              // console.log('adding std option=' + itemOption.data.ChildType +
              // ' ' + accounting.formatMoney(item.data.Price));
              VehicleOrderService_ShoppingCartService_JSDO.jsdo
                  .eShoppingCartOption
                  .add({
                    "Id" : cart.data.Id,
                    "ItemId" : itemOption.data.ChildItemId,
                    "Quantity" : itemOption.data.Quantity,
                    "ItemType" : itemOption.data.ChildType,
                    "ItemNum" : itemOption.data.ChildItemNum,
                    "Discount" : 0,
                    "Price" : item.data.Price
                  });
            };
          });
    };
  };

  /**
   * updates the vehicledetail page with info from the (updated) cart
   */
  AETF.vehicleorder.showCartDetail = function() {
    // we always have a cart. explicitly get the cart here
    var cart = VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCart
        .findById(localStorage.getItem('cartId')); // returns JSRecord

    // vehicle should already be selected/available
    var vehicle = VehicleOrderService_BrandDataService_JSDO.jsdo
        .eVehicle.record; // returns JSRecord

    // calculate and display the value of the selected accessories,
    // from then shopping cart options
    var intPrice = +0.0;
    var extPrice = +0.0;
    var itemTotal = +0.0;

    // This foreach() is implicitly filtered by the cart
    // we found above
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
        .eShoppingCartOption
        .foreach(function(cartOption) {
          if (cartOption.data.ItemType === "Moonroof"
              || cartOption.data.ItemType === "Wheels"
              || cartOption.data.ItemType === "Ext-Colour") {
            itemTotal = (cartOption.data.Price * cartOption.data.Quantity);
            if (cartOption.data.Discount > 0) {
              itemTotal = itemTotal - (cartOption.data.Discount * itemTotal) / 100;};
            extPrice += itemTotal;
          };

          if (cartOption.data.ItemType === "Accessories"
              || cartOption.data.ItemType === "Trim-Material"
              || cartOption.data.ItemType === "Trim-Colour") {
            itemTotal = (cartOption.data.Price * cartOption.data.Quantity);
            if (cartOption.data.Discount > 0) {
              itemTotal = itemTotal - (cartOption.data.Discount * itemTotal) / 100;};
            intPrice += itemTotal;
          };
        });

    Tiggzi('detail_interior_price').text(accounting.formatMoney(intPrice));
    Tiggzi('detail_interior_price').refresh();

    Tiggzi('detail_exterior_price').text(accounting.formatMoney(extPrice));
    Tiggzi('detail_exterior_price').refresh();

    Tiggzi('detail_cart_total').text('Cart total ' + accounting.formatMoney(cart.data.Price));
    Tiggzi('detail_cart_total').refresh();

    Tiggzi('detail_dealer_name').text((cart.data.DealerCode === '' ? 'No dealer selected' : cart.data.DealerCode));
    Tiggzi('detail_dealer_name').refresh();
  };

    AETF.vehicleorder.processActionResult = function() {
      var result = JSON.parse(localStorage.getItem('actionResult'));
        if (result != undefined ) {
            if (result.error) {
            Tiggzi('result_text').text(result.messages);
            } else if (result.orderNum != undefined) {
            Tiggzi('result_text').text('Order '  + result.orderNum + ' created.');
            };
        };
    };
})();


text:
namespace weblayer {

namespace {

// This install helper simply checks if the necessary package (Google Play
// Services for AR, aka arcore) is installed. It doesn't attempt to initiate an
// install or update.
class ArInstallHelper : public content::XrInstallHelper {
 public:
  explicit ArInstallHelper() = default;
  ~ArInstallHelper() override = default;
  ArInstallHelper(const ArInstallHelper&) = delete;
  ArInstallHelper& operator=(const ArInstallHelper&) = delete;

  // content::XrInstallHelper implementation.
  void EnsureInstalled(
      int render_process_id,
      int render_frame_id,
      base::OnceCallback<void(bool)> install_callback) override {
    std::move(install_callback)
        .Run(Java_ArCoreVersionUtils_isInstalledAndCompatible(
            base::android::AttachCurrentThread()));
  }
};

}  // namespace

bool XrIntegrationClientImpl::IsEnabled() {
  return Java_ArCoreVersionUtils_isEnabled(
      base::android::AttachCurrentThread());
}

std::unique_ptr<content::XrInstallHelper>
XrIntegrationClientImpl::GetInstallHelper(device::mojom::XRDeviceId device_id) {
  if (device_id == device::mojom::XRDeviceId::ARCORE_DEVICE_ID)
    return std::make_unique<ArInstallHelper>();

  return nullptr;
}

content::XRProviderList XrIntegrationClientImpl::GetAdditionalProviders() {
  content::XRProviderList providers;

  if (base::FeatureList::IsEnabled(features::kWebXrArModule)) {
    base::android::ScopedJavaLocalRef<jobject>
        j_ar_compositor_delegate_provider =
            Java_ArCompositorDelegateProviderImpl_Constructor(
                base::android::AttachCurrentThread());

    providers.push_back(std::make_unique<webxr::ArCoreDeviceProvider>(
        webxr::ArCompositorDelegateProvider(
            std::move(j_ar_compositor_delegate_provider))));
  }

  return providers;
}

}  // namespace weblayer


text:
using System.Linq;
using System.Web.Mvc;
using Orchard.Logging;
using Orchard.Mvc.Filters;
using Orchard.UI.Admin;

namespace Orchard.Security {
    public class SecurityFilter : FilterProvider, IExceptionFilter, IAuthorizationFilter {
        private readonly IAuthorizer _authorizer;

        public SecurityFilter(IAuthorizer authorizer) {
            _authorizer = authorizer;
            Logger = NullLogger.Instance;
        }

        public ILogger Logger { get; set; }

        public void OnAuthorization(AuthorizationContext filterContext) {

            var accessFrontEnd = filterContext.ActionDescriptor.GetCustomAttributes(typeof (AlwaysAccessibleAttribute), true).Any();

            if (!accessFrontEnd && filterContext.ActionDescriptor.ControllerDescriptor.ControllerType.GetCustomAttributes(typeof(AlwaysAccessibleAttribute), true).Any()) {
                accessFrontEnd = true;
            }

            if (!AdminFilter.IsApplied(filterContext.RequestContext) && !accessFrontEnd && !_authorizer.Authorize(StandardPermissions.AccessFrontEnd)) {
                filterContext.Result = new HttpUnauthorizedResult();
            }
        }

        public void OnException(ExceptionContext filterContext) {
            if (!(filterContext.Exception is OrchardSecurityException))
                return;

            try {
                Logger.Information(filterContext.Exception, "Security exception converted to access denied result");
            }
            catch {
                //a logger exception can't be allowed to interrupt this process
            }

            filterContext.Result = new HttpUnauthorizedResult();
            filterContext.ExceptionHandled = true;
        }
    }
}


text:
"""
Created on Thu Aug 21 21:13:47 2014

@author: simonwoerpel

menu tags
"""

from django import template
from erm.settings import MENU_MODELS

register = template.Library()

@register.inclusion_tag('erm/menu.html')
def main_menu():
    '''renders the main menu for the top navbar'''

    menu = []

    for model in MENU_MODELS:
        parent = model._meta.verbose_name_plural
        children = []

        for child in model.objects.all():
            children += [child]

        menu += [{
            'name': parent,
            'children': children,
        }]

    return {'parents': menu}