text:
<?xml version="1.0"?>
<template
    format="5"
    revision="1"
    name="Art 全家桶"
    minApi="9"
    minBuildApi="15"
    description="一键创建 MVPArt 单个页面所需要的全部组件, JessYan 将这个高度可配置的模板献给强大的 MVPArt, 使用详情请见 README">

    <category value="Activity" />
    <formfactor value="Mobile" />

    <parameter
            id="packageName"
            name="Root Package Name"
            type="string"
            constraints="package"
            default="com.mycompany.myapp"
            help="请填写你的项目包名,请认真核实此包名是否是正确的项目包名,不能包含子包,正确的格式如:me.jessyan.arms"
            />

    <parameter
        id="pageName"
        name="Page Name"
        type="string"
        constraints="unique|nonempty"
        default="Main"
        help="请填写页面名,如填写 Main,会自动生成 MainActivity, MainPresenter 等文件" />

    <parameter
        id="needActivity"
        name="Generate Activity"
        type="boolean"
        default="true"
        help="是否需要生成 Activity ? 不勾选则不生成" />

<parameter
        id="activityLayoutName"
        name="Activity Layout Name"
        type="string"
        constraints="layout|nonempty"
        suggest="${activityToLayout(pageName)}"
        default="activity_main"
        visibility="needActivity"
        help="Activity 创建之前需要填写 Activity 的布局名,若布局已创建就直接填写此布局名,若还没创建此布局,请勾选下面的单选框" />

    <parameter
        id="generateActivityLayout"
        name="Generate Activity Layout"
        type="boolean"
        default="true"
        visibility="needActivity"
        help="是否需要给 Activity 生成布局? 若勾选,则使用上面的布局名给此 Activity 创建默认的布局" />

 <parameter
        id="ativityPackageName"
        name="Ativity Package Name"
        type="string"
        constraints="nonempty"
        suggest=".mvp.ui.activity"
        visibility="needActivity"
        help="Activity 将被输出到此包下,请认真核实此包名是否是你需要输出的目标包名 (基于 Root Package Name )"
        />

    <parameter
        id="needFragment"
        name="Generate Fragment"
        type="boolean"
        default="false"
        help="是否需要生成 Fragment ? 不勾选则不生成" />

    <parameter
        id="fragmentLayoutName"
        name="Fragment Layout Name"
        type="string"
        constraints="layout|nonempty"
        suggest="fragment_${classToResource(pageName)}"
        default="fragment_main"
        visibility="needFragment"
        help="Fragment 创建之前需要填写 Fragment 的布局名,若布局已创建就直接填写此布局名,若还没创建此布局,请勾选下面的单选框" />

 <parameter
        id="generateFragmentLayout"
        name="Generate Fragment Layout"
        type="boolean"
        default="true"
        visibility="needFragment"
        help="是否需要给 Fragment 生成布局? 若勾选,则使用上面的布局名给此 Fragment 创建默认的布局" />

 <parameter
        id="fragmentPackageName"
        name="Fragment Package Name"
        type="string"
        constraints="nonempty"
        suggest=".mvp.ui.fragment"
        visibility="needFragment"
        help="Fragment 将被输出到此包下,请认真核实此包名是否是你需要输出的目标包名 (基于 Root Package Name )"
        />

<parameter
        id="presenterName"
        name="Presenter Name"
        type="string"
        constraints="unique"
        suggest="${pageName}Presenter"
        default="Main"
        help="请填写 Presenter 名(若此栏为空,则 Activity/Fragment 不会引用任何 Presenter),若填写的 Presenter 并未创建,请勾选下面的单选框" />

<parameter
        id="needPresenter"
        name="Generate Presenter"
        type="boolean"
        default="true"
        help="是否需要生成 Presenter ? 不勾选则不生成" />

 <parameter
        id="presenterPackageName"
        name="Presenter Package Name"
        type="string"
        constraints="nonempty"
        suggest=".mvp.presenter"
        visibility="needPresenter"
        help="Presenter 将被输出到此包下,请认真核实此包名是否是你需要输出的目标包名 (基于 Root Package Name )"
        />

<parameter
        id="modelName"
        name="Model Name"
        type="string"
        constraints="unique"
        suggest="${pageName}Repository"
        default="Main"
        help="请填写 Model 名(若此栏为空,则 Presenter 不会引用任何 Model),若填写的 Model 并未创建,请勾选下面的单选框" />

<parameter
        id="needModel"
        name="Generate Model"
        type="boolean"
        default="true"
        help="是否需要生成 Model ? 不勾选则不生成" />

<parameter
        id="modelPackageName"
        name="Model Package Name"
        type="string"
        constraints="nonempty"
        suggest=".mvp.model"
        visibility="needModel"
        help="Model 将被输出到此包下,请认真核实此包名是否是你需要输出的目标包名 (基于 Root Package Name )"
        />

    <!-- 128x128 thumbnails relative to template.xml -->
    <thumbs>
        <!-- default thumbnail is required -->
        <thumb>template_blank_activity.png</thumb>
    </thumbs>

    <globals file="globals.xml.ftl" />
    <execute file="recipe.xml.ftl" />

</template>


text:
using namespace Ogre;
using namespace OgreBites;

class _OgreSampleClassExport Sample_HLMS : public SdkSample
{
public:

	Sample_HLMS() : mHlmsManager(NULL)
    {
        mInfo["Title"] = "HLMS";
        mInfo["Description"] = "Shows how to use hlms.";
        mInfo["Thumbnail"] = "thumb_hlms.png";
        mInfo["Category"] = "Lighting";
    }

private:
	Ogre::HlmsManager* mHlmsManager;
	Ogre::vector<Ogre::PbsMaterial*>::type mPBSMaterialList;
	Ogre::vector<String>::type mMaterialList;
	Ogre::SceneNode* mLightNodes[3];
	Ogre::MeshPtr mFloor;

protected:

	void cleanupContent()
	{
		for (size_t i = 0; i < mPBSMaterialList.size(); ++i)
		{
			delete mPBSMaterialList[i];
		}

		for (size_t i = 0; i < mMaterialList.size(); ++i)
		{
			MaterialManager::getSingleton().unload(mMaterialList[i], ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
			MaterialManager::getSingleton().remove(mMaterialList[i], ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
		}
		mMaterialList.clear();
		mFloor->unload();
		MeshManager::getSingleton().remove(mFloor);
		mFloor.reset();

		mHlmsManager->unbindAll("pbs");
		delete mHlmsManager;
	}

    void setupContent()
    {
		mHlmsManager = new Ogre::HlmsManager(mSceneMgr);

        // setup some basic lighting for our scene
		Ogre::SceneNode *rootNode = mSceneMgr->getRootSceneNode();

		Ogre::Light *light = mSceneMgr->createLight();
		Ogre::SceneNode *lightNode = rootNode->createChildSceneNode();
		lightNode->attachObject(light);
		light->setPowerScale(1.0f);
		light->setType(Ogre::Light::LT_DIRECTIONAL);
		light->setDirection(Ogre::Vector3(-1, -1, -1).normalisedCopy());
		mLightNodes[0] = lightNode;

		mSceneMgr->setAmbientLight(Ogre::ColourValue(0.3f, 0.5f, 0.7f));

		light = mSceneMgr->createLight();
		lightNode = rootNode->createChildSceneNode();
		lightNode->attachObject(light);
		light->setDiffuseColour(0.8f, 0.4f, 0.2f); //Warm
		light->setSpecularColour(0.8f, 0.4f, 0.2f);
		light->setPowerScale(Ogre::Math::PI);
		light->setType(Ogre::Light::LT_SPOTLIGHT);
		lightNode->setPosition(-10.0f, 10.0f, 10.0f);
		light->setDirection(Ogre::Vector3(1, -1, -1).normalisedCopy());
		mLightNodes[1] = lightNode;

		light = mSceneMgr->createLight();
		lightNode = rootNode->createChildSceneNode();
		lightNode->attachObject(light);
		light->setDiffuseColour(0.2f, 0.4f, 0.8f); //Cold
		light->setSpecularColour(0.2f, 0.4f, 0.8f);
		light->setPowerScale(Ogre::Math::PI);
		light->setType(Ogre::Light::LT_SPOTLIGHT);
		lightNode->setPosition(10.0f, 10.0f, -10.0f);
		light->setDirection(Ogre::Vector3(-1, -1, 1).normalisedCopy());
		mLightNodes[2] = lightNode;

		mViewport->setBackgroundColour(ColourValue(0.8f, 1.0f, 1.0f));
		mSceneMgr->setFog(Ogre::FOG_LINEAR, ColourValue(0.8f, 1.0f, 1.0f), 0, 15, 100);

		// create a floor mesh resource
		mFloor = MeshManager::getSingleton().createPlane("floor", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
			Plane(Vector3::UNIT_Y, 0), 100, 100, 10, 10, true, 1, 10, 10, Vector3::UNIT_Z);

		// create a floor entity, give it a material, and place it at the origin
		Entity* floor = mSceneMgr->createEntity(mFloor);
		floor->setMaterialName("Examples/Rockwall");
		floor->setCastShadows(false);
		mSceneMgr->getRootSceneNode()->attachObject(floor);

		const int numX = 8;
		const int numZ = 8;

		const float armsLength = 1.0f;
		const float startX = (numX - 1) / 2.0f;
		const float startZ = (numZ - 1) / 2.0f;

		TexturePtr cubeMap = Ogre::TextureManager::getSingletonPtr()->load("cubescene.jpg", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_CUBE_MAP);
		//TexturePtr anisoTex = Ogre::TextureManager::getSingletonPtr()->load("hlms_aniso_baked.png", ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
		//
		//{
		//	MeshPtr sphere = MeshManager::getSingleton().load("SphereManualTangents.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		//	ensureHasTangents(sphere);

		//	Ogre::Entity *ent = mSceneMgr->createEntity(sphere);
		//	Ogre::SceneNode *sceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
		//	sceneNode->setPosition(0,	3.0f, 0);
		//	sceneNode->setScale(Vector3(0.5));
		//	sceneNode->attachObject(ent);

		//	PbsMaterial* pbsMaterial = new PbsMaterial();
		//	pbsMaterial->setAlbedo(ColourValue::Green);

		//	pbsMaterial->setRoughness(0.32);
		//	pbsMaterial->setLightRoughnessOffset(0.2);
		//	pbsMaterial->setF0(Ogre::ColourValue(0.9, 0.9, 0.9));
		//	pbsMaterial->setEnvironmentMap(cubeMap);
		//	pbsMaterial->setNormalrTexture(PbsMaterial::MS_MAIN, anisoTex, PbsMaterial::TextureAddressing(), 1.0, 1.0);
		//	createHLMSMaterial(ent, pbsMaterial, "PBS_ANISO");
		//}

		for (int x = 0; x<numX; ++x)
		{
			for (int z = 0; z<numZ; ++z)
			{
				Entity *ent = mSceneMgr->createEntity("Sphere1000.mesh");
				SceneNode *sceneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
				sceneNode->setPosition(Vector3(armsLength * x - startX,	1.0f, armsLength * z - startZ));
				sceneNode->attachObject(ent);

				PbsMaterial* pbsMaterial = new PbsMaterial();
				pbsMaterial->setAlbedo(ColourValue::Green);

				pbsMaterial->setRoughness(std::max<float>(0.02f, x / std::max<float>(1, (float)(numX - 1)))  * 0.6 );
				pbsMaterial->setLightRoughnessOffset(0.2);

				float f0 = (z / std::max<float>(1, (float)(numZ - 1))) * 0.9 + 0.1;
				pbsMaterial->setF0(Ogre::ColourValue(f0, f0, f0));
				pbsMaterial->setEnvironmentMap(cubeMap);

				createHLMSMaterial(ent, pbsMaterial, "PBS_" + Ogre::StringConverter::toString(x) + "_" + Ogre::StringConverter::toString(z));
			}
		}

		mCameraMan->setStyle(CS_ORBIT);
		mTrayMgr->showCursor();
		mCameraMan->setYawPitchDist(Degree(0), Degree(25), 20);
		mCameraMan->setTopSpeed(5);
		mCamera->setNearClipDistance(1);
    }

	void createHLMSMaterial(Ogre::Entity *ent, PbsMaterial* pbsMaterial, String matName)
	{
		size_t count = ent->getNumSubEntities();
		for (size_t i = 0; i < count; i++)
		{
			Ogre::SubEntity* subEnt = ent->getSubEntity(i);
			Ogre::MaterialPtr newMat = subEnt->getMaterial()->clone(matName + "_" + Ogre::StringConverter::toString(i));
			newMat->removeAllTechniques();
			Ogre::Pass* pass = newMat->createTechnique()->createPass();
#if defined(INCLUDE_RTSHADER_SYSTEM)
			// ensures that this material does not get picked up by the RTSS
			newMat->getTechnique(0)->setSchemeName(mViewport->getMaterialScheme());
#endif
			pass->setName("pbs");
			subEnt->setMaterial(newMat);
			mMaterialList.push_back(newMat->getName());
			mHlmsManager->bind(subEnt, pbsMaterial, "pbs");
		}
	}

	static void ensureHasTangents(Ogre::MeshPtr mesh)
	{
		bool generateTangents = false;
		if (mesh->sharedVertexData)
		{
			Ogre::VertexDeclaration *vertexDecl = mesh->sharedVertexData->vertexDeclaration;
			generateTangents |= hasNoTangentsAndCanGenerate(vertexDecl);
		}

		for (ushort i = 0; i<mesh->getNumSubMeshes(); ++i)
		{
			Ogre::SubMesh *subMesh = mesh->getSubMesh(i);
			if (subMesh->vertexData)
			{
				Ogre::VertexDeclaration *vertexDecl = subMesh->vertexData->vertexDeclaration;
				generateTangents |= hasNoTangentsAndCanGenerate(vertexDecl);
			}
		}

		try
		{
			if (generateTangents)
			{
				mesh->buildTangentVectors();
			}

		}
		catch (...) {}
	}

	static bool hasNoTangentsAndCanGenerate(Ogre::VertexDeclaration *vertexDecl)
	{
		bool hasTangents = false;
		bool hasUVs = false;
		const Ogre::VertexDeclaration::VertexElementList &elementList = vertexDecl->getElements();
		Ogre::VertexDeclaration::VertexElementList::const_iterator itor = elementList.begin();
		Ogre::VertexDeclaration::VertexElementList::const_iterator end = elementList.end();

		while (itor != end && !hasTangents)
		{
			const Ogre::VertexElement &vertexElem = *itor;
			if (vertexElem.getSemantic() == Ogre::VES_TANGENT)
				hasTangents = true;
			if (vertexElem.getSemantic() == Ogre::VES_TEXTURE_COORDINATES)
				hasUVs = true;

			++itor;
		}

		return !hasTangents && hasUVs;
	}
};

#endif

redpajama_set_name: RedPajamaGithub


text:
[Javascript](/)
* [Basic Javascript](/javascript)


text:
'use strict';

requirejs.config({
  baseUrl: 'http://localhost:9000/',
  paths: {

    // Flight
    'flight': 'bower_components/flight',
    'flight-router': 'bower_components/flight-router',

    // Application Components
    'component': 'js/component',
    'data': 'js/data',
    'mixin': 'js/mixin',
    'page': 'js/page',

    // Hogan Templating Support
    'hogan': 'bower_components/hogan/web/builds/2.0.0/hogan-2.0.0.amd',
    'templates': 'js/templates',
    // 'text': 'bower_components/text/text',
    // 'hgn': 'bower_components/requirejs-hogan-plugin/hgn',
    // 'hogan': 'bower_components/requirejs-hogan-plugin/hogan'
  }
});

require(
  [
    'flight/lib/compose',
    'flight/lib/registry',
    'flight/lib/advice',
    'flight/lib/logger',
    'flight-router/lib/with_route'
  ],

  function(compose, registry, advice, withLogging, withRouter) {
    // debug.enable(true);
    // console.log(withRouter)
    compose.mixin(registry, [advice.withAdvice, withLogging]);

    require(['page/index'], function(initializeIndex) {
      initializeIndex();
    });
  }
);


text:
from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {'metadata_version': '1.1',
                    'status': ['preview'],
                    'supported_by': 'community'}

DOCUMENTATION = '''
---
module: azure_rm_devtestlabschedule
version_added: "2.8"
short_description: Manage Azure DevTest Lab Schedule instance
description:
    - Create, update and delete instance of Azure DecTest Lab Schedule.

options:
    resource_group:
        description:
            - The name of the resource group.
        required: True
    lab_name:
        description:
            - The name of the lab.
        required: True
    name:
        description:
            - The name of the schedule.
        required: True
        choices:
            - lab_vms_startup
            - lab_vms_shutdown
    time:
        description:
            - The time of day the schedule will occur.
    time_zone_id:
        description:
            - The time zone ID.
    state:
      description:
          - Assert the state of the Schedule.
          - Use C(present) to create or update an Schedule and C(absent) to delete it.
      default: present
      choices:
          - absent
          - present

extends_documentation_fragment:
    - azure
    - azure_tags

author:
    - Zim Kalinowski (@zikalino)

'''

EXAMPLES = '''
  - name: Create (or update) DevTest Lab Schedule
    azure_rm_devtestlabschedule:
      resource_group: myResourceGroup
      lab_name: myLab
      name: lab_vms_shutdown
      time: "1030"
      time_zone_id: "UTC+12"
'''

RETURN = '''
id:
    description:
        - The identifier of the resource.
    returned: always
    type: str
    sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourcegroups/myResourceGroup/providers/microsoft.devtestlab/labs/myLab/schedules/l
             abVmsShutdown"
'''

import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
from ansible.module_utils.common.dict_transformations import _snake_to_camel

try:
    from msrestazure.azure_exceptions import CloudError
    from msrest.polling import LROPoller
    from msrestazure.azure_operation import AzureOperationPoller
    from azure.mgmt.devtestlabs import DevTestLabsClient
    from msrest.serialization import Model
except ImportError:
    # This is handled in azure_rm_common
    pass

class Actions:
    NoAction, Create, Update, Delete = range(4)

class AzureRMSchedule(AzureRMModuleBase):
    """Configuration class for an Azure RM Schedule resource"""

    def __init__(self):
        self.module_arg_spec = dict(
            resource_group=dict(
                type='str',
                required=True
            ),
            lab_name=dict(
                type='str',
                required=True
            ),
            name=dict(
                type='str',
                required=True,
                choices=['lab_vms_startup', 'lab_vms_shutdown']
            ),
            time=dict(
                type='str'
            ),
            time_zone_id=dict(
                type='str'
            ),
            state=dict(
                type='str',
                default='present',
                choices=['present', 'absent']
            )
        )

        self.resource_group = None
        self.lab_name = None
        self.name = None
        self.schedule = dict()

        self.results = dict(changed=False)
        self.mgmt_client = None
        self.state = None
        self.to_do = Actions.NoAction

        required_if = [
            ('state', 'present', ['time', 'time_zone_id'])
        ]

        super(AzureRMSchedule, self).__init__(derived_arg_spec=self.module_arg_spec,
                                              supports_check_mode=True,
                                              supports_tags=True,
                                              required_if=required_if)

    def exec_module(self, **kwargs):
        """Main module execution method"""

        for key in list(self.module_arg_spec.keys()) + ['tags']:
            if hasattr(self, key):
                setattr(self, key, kwargs[key])
            elif kwargs[key] is not None:
                self.schedule[key] = kwargs[key]

        self.schedule['status'] = "Enabled"

        if self.name == 'lab_vms_startup':
            self.name = 'LabVmsStartup'
            self.schedule['task_type'] = 'LabVmsStartupTask'
        elif self.name == 'lab_vms_shutdown':
            self.name = 'LabVmsShutdown'
            self.schedule['task_type'] = 'LabVmsShutdownTask'

        if self.state == 'present':
            self.schedule['daily_recurrence'] = {'time': self.schedule.pop('time')}
            self.schedule['time_zone_id'] = self.schedule['time_zone_id'].upper()

        response = None

        self.mgmt_client = self.get_mgmt_svc_client(DevTestLabsClient,
                                                    base_url=self._cloud_environment.endpoints.resource_manager)

        resource_group = self.get_resource_group(self.resource_group)

        old_response = self.get_schedule()

        if not old_response:
            self.log("Schedule instance doesn't exist")
            if self.state == 'absent':
                self.log("Old instance didn't exist")
            else:
                self.to_do = Actions.Create
        else:
            self.log("Schedule instance already exists")
            if self.state == 'absent':
                self.to_do = Actions.Delete
            elif self.state == 'present':
                if (not default_compare(self.schedule, old_response, '', self.results)):
                    self.to_do = Actions.Update

        if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
            self.log("Need to Create / Update the Schedule instance")

            if self.check_mode:
                self.results['changed'] = True
                return self.results

            response = self.create_update_schedule()

            self.results['changed'] = True
            self.log("Creation / Update done")
        elif self.to_do == Actions.Delete:
            self.log("Schedule instance deleted")
            self.results['changed'] = True

            if self.check_mode:
                return self.results

            self.delete_schedule()
            # This currently doesn't work as there is a bug in SDK / Service
            if isinstance(response, LROPoller) or isinstance(response, AzureOperationPoller):
                response = self.get_poller_result(response)
        else:
            self.log("Schedule instance unchanged")
            self.results['changed'] = False
            response = old_response

        if self.state == 'present':
            self.results.update({
                'id': response.get('id', None)
            })
        return self.results

    def create_update_schedule(self):
        '''
        Creates or updates Schedule with the specified configuration.

        :return: deserialized Schedule instance state dictionary
        '''
        self.log("Creating / Updating the Schedule instance {0}".format(self.name))

        try:
            response = self.mgmt_client.schedules.create_or_update(resource_group_name=self.resource_group,
                                                                   lab_name=self.lab_name,
                                                                   name=self.name,
                                                                   schedule=self.schedule)
            if isinstance(response, LROPoller) or isinstance(response, AzureOperationPoller):
                response = self.get_poller_result(response)

        except CloudError as exc:
            self.log('Error attempting to create the Schedule instance.')
            self.fail("Error creating the Schedule instance: {0}".format(str(exc)))
        return response.as_dict()

    def delete_schedule(self):
        '''
        Deletes specified Schedule instance in the specified subscription and resource group.

        :return: True
        '''
        self.log("Deleting the Schedule instance {0}".format(self.name))
        try:
            response = self.mgmt_client.schedules.delete(resource_group_name=self.resource_group,
                                                         lab_name=self.lab_name,
                                                         name=self.name)
        except CloudError as e:
            self.log('Error attempting to delete the Schedule instance.')
            self.fail("Error deleting the Schedule instance: {0}".format(str(e)))

        return True

    def get_schedule(self):
        '''
        Gets the properties of the specified Schedule.

        :return: deserialized Schedule instance state dictionary
        '''
        self.log("Checking if the Schedule instance {0} is present".format(self.name))
        found = False
        try:
            response = self.mgmt_client.schedules.get(resource_group_name=self.resource_group,
                                                      lab_name=self.lab_name,
                                                      name=self.name)
            found = True
            self.log("Response : {0}".format(response))
            self.log("Schedule instance : {0} found".format(response.name))
        except CloudError as e:
            self.log('Did not find the Schedule instance.')
        if found is True:
            return response.as_dict()

        return False

def default_compare(new, old, path, result):
    if new is None:
        return True
    elif isinstance(new, dict):
        if not isinstance(old, dict):
            result['compare'] = 'changed [' + path + '] old dict is null'
            return False
        for k in new.keys():
            if not default_compare(new.get(k), old.get(k, None), path + '/' + k, result):
                return False
        return True
    elif isinstance(new, list):
        if not isinstance(old, list) or len(new) != len(old):
            result['compare'] = 'changed [' + path + '] length is different or null'
            return False
        if isinstance(old[0], dict):
            key = None
            if 'id' in old[0] and 'id' in new[0]:
                key = 'id'
            elif 'name' in old[0] and 'name' in new[0]:
                key = 'name'
            else:
                key = list(old[0])[0]
            new = sorted(new, key=lambda x: x.get(key, None))
            old = sorted(old, key=lambda x: x.get(key, None))
        else:
            new = sorted(new)
            old = sorted(old)
        for i in range(len(new)):
            if not default_compare(new[i], old[i], path + '/*', result):
                return False
        return True
    else:
        if path == '/location':
            new = new.replace(' ', '').lower()
            old = new.replace(' ', '').lower()
        if new == old:
            return True
        else:
            result['compare'] = 'changed [' + path + '] ' + str(new) + ' != ' + str(old)
            return False

def main():
    """Main execution"""
    AzureRMSchedule()

if __name__ == '__main__':
    main()


text:
@interface ALPreferenceViewController : NSViewController {
	IBOutlet NSTextField* hostField;
	IBOutlet NSTextField* portField;
	IBOutlet NSSecureTextField* passwordField;
}

@property (retain) NSString* versionString;
@property (retain) NSString* configuredHost;
@property (retain) NSString* configuredPassword;

- (IBAction)didEnterHostname:(id)sender;
- (IBAction)didEnterPassword:(id)sender;

+ (void)updatePassword:(NSString*)newPassword forHost:(NSString*)host;
+ (NSString*)retrievePasswordForHost:(NSString*)host;
+ (NSString*)messageForStatusCode:(OSStatus)status;

@end


text:
import { GraphQLObjectType, GraphQLInputObjectType, GraphQLScalarType, GraphQLString, GraphQLID, GraphQLInt, GraphQLBoolean } from 'graphql';

export const UploadedFileType = new GraphQLObjectType({
  name:  'UploadedFileType',
  fields: () => ({
    id: { type: GraphQLID },
    fileName: { type: GraphQLString },
    caption: { type: GraphQLString },
    type: { type: GraphQLString },
    specialization: { type: GraphQLString },
    size: { type: GraphQLInt },
    createdAt: {type: GraphQLString},
    updatedAt: {type: GraphQLString}
  })
});

export const FileDataInput = new GraphQLInputObjectType({
  name:  'FileDataInput',
  fields: () => ({
    fieldname: { type: GraphQLString },
    originalname: { type: GraphQLString },
    encoding: { type: GraphQLString },
    destination: { type: GraphQLString },
    path: { type: GraphQLString },
    filename: { type: GraphQLString },
    mimetype: { type: GraphQLString },
    size: { type: GraphQLInt }
  })
});


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Example - Sticky Footer</title>
    <link rel="stylesheet" type="text/css" href="../dist/jquery.sticky-footer.min.css">
    <link href="style.css" rel="stylesheet" type="text/css" />

            I'm a Header

            Hello World
            <button>Add content</button>
            <button>Stick</button>
            <button>Destroy</button>

        I'm the Sticky Footer.


text:
package com.reason.ide.hints;

import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.colors.*;
import com.intellij.openapi.editor.markup.*;
import com.intellij.openapi.project.*;
import com.intellij.openapi.vfs.*;
import com.reason.ide.highlight.*;
import org.jetbrains.annotations.*;

import java.util.*;

import static com.reason.ide.hints.CodeLens.*;

public class OREditorLinePainter extends EditorLinePainter {
    @Override
    public @Nullable Collection<LineExtensionInfo> getLineExtensions(@NotNull Project project, @NotNull VirtualFile file, int lineNumber) {
        Collection<LineExtensionInfo> result = null;

        CodeLens signatures = file.getUserData(CODE_LENS);
        if (signatures != null) {
            String signature = signatures.get(lineNumber);
            if (signature != null) {
                EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme();
                TextAttributes codeLens = globalScheme.getAttributes(ORSyntaxHighlighter.CODE_LENS_);
                result = Collections.singletonList(new LineExtensionInfo("  " + signature, codeLens));
            }
        }

        return result;
    }
}


text:
/**
 * 跑马灯
 * @class MarqueeLine
 * @memberof module:components/dumb
 * @example
 * import { marqueeLine } from 'path/to/components/dumb'
 * export default {
 *     render: h => <marquee-line speed={ 5 }>
 *
Hello World

 *
a same dream

 *     </marquee-line>
 * }
 */
const marqueeLine = {
    name: 'marqueeLine',
    /**
     * @lends module:components/dumb.MarqueeLine
     */
    props: {
        /**
         * @type {number}
         * @desc 移动速度
         */
        speed: {
            type: Number,
            default: 5
        },
        /**
         * @type {number}
         * @desc 偏移量微调
         */
        offset: {
            type: Number,
            default: 15
        }
    },
    data: () => ({
        marqueeId: 0
    }),
    render(h) { // eslint-disable-line no-unused-vars
        return (

                { this.$slots.default }
                { this.$slots.default }

        );
    },
    mounted() {
        this.$nextTick(() => {
            const { offset } = this;
            const container = this.$refs.container;
            const children = container.querySelectorAll('div');
            const totalWidth = Array.from(children).reduce((sum, item) => sum += item.offsetWidth, 0);
            const speed = this.speed;
            const motion = () => {
                if (container.scrollLeft >= totalWidth - container.offsetWidth)
                    container.scrollLeft -= totalWidth - container.offsetWidth - offset;
                else
                    container.scrollLeft += speed;

                window.requestAnimationFrame(motion);
            };

            window.requestAnimationFrame(motion);
        });
    }
};

export default marqueeLine;


text:
using FoxTool.Fox.Types.Values;

namespace FoxTool.Tpp.Classes
{
    public class SimInertialControlParam
    {
        // Static properties
        public FoxFloat Coefficient { get; set; }
    }
}


text:
import Vue from 'vue'
import eventBus from '@/plugins/event-bus'
import { create as createEventsSandbox } from '@/services/plugin-manager/sandbox/events-sandbox'

Vue.prototype.$eventBus = eventBus

describe('Events Sandbox', () => {
  let app
  let walletApi
  beforeEach(() => {
    walletApi = {}
    app = new Vue()
    createEventsSandbox(walletApi, app)()
  })

  it('should expose functions', () => {
    expect(walletApi.eventBus).toBeTruthy()
  })

  describe('on', () => {
    it('should enable and trigger event', async () => {
      const eventTriggerMock = jest.fn()
      walletApi.eventBus.on('test:event', eventTriggerMock)

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)

      await app.$eventBus.emit('test:event')
      await app.$eventBus.emit('test:event')
      await app.$eventBus.emit('test:event')

      expect(eventTriggerMock).toHaveBeenCalledTimes(3)
    })

    it('should allow regex', async () => {
      const eventTriggerMock = jest.fn()
      walletApi.eventBus.on(/test:event:\d/, eventTriggerMock)

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)

      await app.$eventBus.emit('test:event:1')
      await app.$eventBus.emit('test:event:2')
      await app.$eventBus.emit('test:event:3')

      expect(eventTriggerMock).toHaveBeenCalledTimes(3)
    })
  })

  describe('off', () => {
    it('should disable event', async () => {
      const eventTriggerMock = jest.fn()
      walletApi.eventBus.on('test:event', eventTriggerMock)

      await app.$eventBus.emit('test:event')

      expect(eventTriggerMock).toHaveBeenCalledTimes(1)

      walletApi.eventBus.off('test:event', eventTriggerMock)
      eventTriggerMock.mockReset()

      await app.$eventBus.emit('test:event')
      await app.$eventBus.emit('test:event')
      await app.$eventBus.emit('test:event')

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)
    })

    it('should disable regex', async () => {
      const eventTriggerMock = jest.fn()
      walletApi.eventBus.on(/test:event:\d/, eventTriggerMock)

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)

      await app.$eventBus.emit('test:event:1')
      await app.$eventBus.emit('test:event:2')
      await app.$eventBus.emit('test:event:3')

      expect(eventTriggerMock).toHaveBeenCalledTimes(3)

      walletApi.eventBus.off(/test:event:\d/, eventTriggerMock)
      eventTriggerMock.mockReset()

      await app.$eventBus.emit('test:event:1')
      await app.$eventBus.emit('test:event:2')
      await app.$eventBus.emit('test:event:3')

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)
    })
  })

  describe('destroy', () => {
    it('should clear all events', async () => {
      const eventTriggerMock = jest.fn()
      walletApi.eventBus.on('test:event:1', eventTriggerMock)
      walletApi.eventBus.on('test:event:2', eventTriggerMock)
      walletApi.eventBus.on('test:event:3', eventTriggerMock)

      await app.$eventBus.emit('test:event:1')
      await app.$eventBus.emit('test:event:2')
      await app.$eventBus.emit('test:event:3')

      expect(eventTriggerMock).toHaveBeenCalledTimes(3)

      walletApi.eventBus.destroy()
      eventTriggerMock.mockReset()

      await app.$eventBus.emit('test:event:1')
      await app.$eventBus.emit('test:event:2')
      await app.$eventBus.emit('test:event:3')

      expect(eventTriggerMock).toHaveBeenCalledTimes(0)
    })
  })
})


text:
.class public interface abstract Landroid/provider/ContactsContract$PhotoFilesColumns;
.super Ljava/lang/Object;
.source "ContactsContract.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/provider/ContactsContract;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x60c
    name = "PhotoFilesColumns"
.end annotation

# static fields
.field public static final FILESIZE:Ljava/lang/String; = "filesize"

.field public static final HEIGHT:Ljava/lang/String; = "height"

.field public static final WIDTH:Ljava/lang/String; = "width"


text:
homebrew-alt
============

My alternative homebrews


text:
title: Plaisirs connus II
layout: post
permalink: works/known_pleasuresII
img: known_pleasuresII.jpg
img_quantity: 3
material: Acrylique sur toile, laine, fibre acrylique, coton, viscose de bambou, élastique.
size: Diptique 70cm x 50cm / 50cm x 40cm
series: Joie

---


text:
package AsposeCellsExamples.TechnicalArticles;

import java.util.ArrayList;

import com.aspose.cells.FontSetting;
import com.aspose.cells.SaveFormat;
import com.aspose.cells.Shape;
import com.aspose.cells.Workbook;
import AsposeCellsExamples.Utils;

public class ChangeCharacterSpacing {
	public static void main(String[] args) throws Exception {

		// The path to the documents directory.
		String dataDir = Utils.getSharedDataDir(ChangeCharacterSpacing.class) + "TechnicalArticles/";
		// Load your excel file inside a workbook obect
		Workbook wb = new Workbook(dataDir + "character-spacing.xlsx");

		// Access your text box which is also a shape object from shapes collection
		Shape shape = wb.getWorksheets().get(0).getShapes().get(0);

		// Access the first font setting object via GetCharacters() method
		ArrayList<FontSetting> lst = shape.getCharacters();
		FontSetting fs = lst.get(0);

		// Set the character spacing to point 4
		fs.getTextOptions().setSpacing(4);

		// Save the workbook in xlsx format
		wb.save(dataDir + "CCSpacing_out.xlsx", SaveFormat.XLSX);

	}

}


text:
using namespace thewizardplusplus::wizard_basic_2::framework::graphics;

GraphicsModule& GraphicsModule::getInstance(void) {
	static GraphicsModule module;
	return module;
}

float GraphicsModule::getScreenWidth(void) {
	return private_realization->getScreenWidth();
}

float GraphicsModule::getScreenHeight(void) {
	return private_realization->getScreenHeight();
}

void GraphicsModule::setCameraPosition(float x, float y, float z) {
	private_realization->setCameraPosition(x, y, z);
}

void GraphicsModule::setCameraRotation(float x, float y, float z) {
	private_realization->setCameraRotation(x, y, z);
}

void GraphicsModule::setFogMode(float fog_mode) {
	private_realization->setFogMode(fog_mode);
}

void GraphicsModule::setFogColor(float r, float g, float b) {
	private_realization->setFogColor(r, g, b);
}

void GraphicsModule::setFogDepth(float end_depth) {
	private_realization->setFogDepth(end_depth);
}

float GraphicsModule::loadObject(const base::Array& filename) {
	return private_realization->loadObject(filename);
}

void GraphicsModule::setObjectPosition(float object_id, float x, float y,
	float z)
{
	private_realization->setObjectPosition(object_id, x, y, z);
}

void GraphicsModule::setObjectRotation(float object_id, float x, float y,
	float z)
{
	private_realization->setObjectRotation(object_id, x, y, z);
}

void GraphicsModule::setObjectScale(float object_id, float x, float y,
	float z)
{
	private_realization->setObjectScale(object_id, x, y, z);
}

void GraphicsModule::playObjectAnimation(float object_id, float start_frame,
	float end_frame, float loop)
{
	private_realization->playObjectAnimation(object_id, start_frame, end_frame,
		loop);
}

void GraphicsModule::pauseObjectAnimation(float object_id) {
	private_realization->pauseObjectAnimation(object_id);
}

float GraphicsModule::isKeyPressed(float key_code) {
	return private_realization->isKeyPressed(key_code);
}

float GraphicsModule::getButtons(void) {
	return private_realization->getButtons();
}

float GraphicsModule::getPointerPositionX(void) const {
	return private_realization->getPointerPositionX();
}

float GraphicsModule::getPointerPositionY(void) const {
	return private_realization->getPointerPositionY();
}

void GraphicsModule::setPointerPosition(float x, float y) {
	private_realization->setPointerPosition(x, y);
}

void GraphicsModule::update(void) {
	private_realization->update();
}

GraphicsModule::GraphicsModule(void) {
	private_realization.reset(new GraphicsModulePrivate());
}


text:
package com.bbxyard.mp.annotation.mapper;

import com.bbxyard.mp.annotation.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

import java.util.List;

import static org.junit.Assert.*;

@Slf4j
@SpringBootTest
@RunWith(SpringRunner.class)
public class UserMapperTest {

    @Resource
    private UserMapper userMapper;

    @Test
    public void testSelectAll() {
        List<User> list = userMapper.selectList(null);
        log.info("Result: length is " + list.size());
    }
}


text:
<?php

namespace Point\PointAccounting\Http\Requests;

use App\Http\Requests\Request;
use Point\Core\Helpers\TempDataHelper;
use Point\Core\Models\Temp;
use Point\PointAccounting\Helpers\CutOffHelper;

class CutOffSubledgerRequest extends Request
{

    public function response(array $errors){

        return redirect()->back()->withErrors($errors)->withInput(\Input::all());
    }

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'foot_amount'=>'required',
            'form_date'=>'required',
            'approval_to'=>'required'
        ];

        if(\Input::get('foot_amount') < 1){
            $rules['Failed_foot_credit_less_then_one'] = 'accepted';
            $rules['Failed_foot_debit_less_then_one'] = 'accepted';

        }

        return $rules;
    }

    public function messages()
    {
        return [
            'accepted' => ':attribute',
        ];
    }

}


text:
package de.raysha.lib.telegram.bot.api.model;

import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * This object represents an audio file (voice note).
 */
public class Audio {

    /**
     * Unique identifier for this file
     */
    private String file_id;

    /**
     * Duration of the audio in seconds as defined by sender
     */
    private Integer duration;

    /**
     * Optional. Performer of the audio as defined by sender or by audio tags
     */
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    private String performer;

    /**
     * Optional. Title of the audio as defined by sender or by audio tags
     */
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    private String title;

    /**
     * Optional. MIME type of the file as defined by sender
     */
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    private String mime_type;

    /**
     * Optional. File size
     */
    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
    private Integer file_size;

    public String getFile_id() {
        return file_id;
    }

    public void setFile_id(String file_id) {
        this.file_id = file_id;
    }

    public Integer getDuration() {
        return duration;
    }

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    public String getPerformer() {
        return performer;
    }

    public void setPerformer(String performer) {
        this.performer = performer;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getMime_type() {
        return mime_type;
    }

    public void setMime_type(String mime_type) {
        this.mime_type = mime_type;
    }

    public Integer getFile_size() {
        return file_size;
    }

    public void setFile_size(Integer file_size) {
        this.file_size = file_size;
    }

    @Override
    public String toString() {
        return "Audio{" +
                "file_id='" + file_id + '\'' +
                ", duration=" + duration +
                ", performer='" + performer + '\'' +
                ", title='" + title + '\'' +
                ", mime_type='" + mime_type + '\'' +
                ", file_size=" + file_size +
                '}';
    }
}