text:
<?xml version="1.0" encoding="utf-8"?>
<sca:svcagent xmlns:sca="http://www.td-tech.com/ubp/platform/sca/xml"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.td-tech.com/ubp/platform/sca/xml svc_agent_4.0.xsd"
         name="svc_agent">
         <!-- tcmalloc_trigger="on" : open tcmalloc -->
         <!-- valgrind_trigger="on" : open valgrind -->
    <ServiceInfo svc_type="mrs_vgw_agent" code_type="cplus" user="ubp" team="MRS" tcmalloc_trigger="off" valgrind_trigger="off">
      <SvcParams>
        <Param name="dllvalue" value="ubp_mrs_vgw"/>
        <Param name="dbenable" value="True"/>
        <Param name="db_max_conn" value="5"/>
        <Param name="db_min_conn" value="3"/>
        <Param name="hikvision_sdk_connect_time" value="2000"/>
        <Param name="hikvision_sdk_log_level" value="0"/>
        <Param name="hikvision_sdk_exception_ignore_level" value="0"/>
        <Param name="huawei_sdk_play_local_ip" value=""/>
        <Param name="huawei_sdk_log_enable" value="0"/>
        <Param name="yaan_getvideo_trigger_exception_max_error_num" value="3"/>
        <Param name="rtcp_timeout" value="180"/>
        <Param name="ptz_monitor_time" value="40"/>
        <Param name="noise_suppressor_flag" value="1"/>
        <Param name="auto_gain_control_flag" value="0"/>
        <Param name="huawei_stream_encryption" value="0"/>
        <Param name="traffic_shaping_flag" value="1"/>
        <Param name="traffic_shaping_max_tasknum" value="100"/>
        <Param name="traffic_shaping_schedule_interval" value="1"/>
        <Param name="traffic_shaping_bitrate_QCIF" value="300"/>
        <Param name="traffic_shaping_bitrate_CIF" value="600"/>
        <Param name="traffic_shaping_bitrate_D1" value="1500"/>
        <Param name="traffic_shaping_bitrate_720p" value="3000"/>
        <Param name="traffic_shaping_bitrate_1080p" value="6000"/>
        <Param name="emergency_videocall_flag" value="0"/>
      </SvcParams>
      <LoadModules>
        <Module lib="ubp_svcmgr" entry="CreateModule"/>
        <Module lib="ubp_threadpool" entry="CreateModule"/>
        <Module lib="ubp_timer" entry="CreateModule"/>
        <Module lib="ubp_encryption" entry="CreateModule"/>
        <Module lib="ubp_dao" entry="CreateModule"/>
        <Module lib="ubp_mq" entry="CreateModule"/>
        <Module lib="ubp_lmproxy" entry="CreateModule"/>
        <Module lib="ubp_fmproxy" entry="CreateModule"/>
        <Module lib="ubp_meta" entry="CreateModule"/>
      </LoadModules>
      <LoadPB>
      </LoadPB>
      <DependSvcs>
        <Svc name="cm_agent" />
        <Svc name="mrs_node_mgr_agent" />
      </DependSvcs>
    </ServiceInfo>
</sca:svcagent>

redpajama_set_name: RedPajamaGithub


text:
package org.ovirt.engine.ui.webadmin.gin.uicommon;

import org.ovirt.engine.core.common.businessentities.AuditLog;
import org.ovirt.engine.core.common.businessentities.DiskImage;
import org.ovirt.engine.core.common.businessentities.VM;
import org.ovirt.engine.core.common.businessentities.VmNetworkInterface;
import org.ovirt.engine.core.common.businessentities.VmType;
import org.ovirt.engine.core.common.businessentities.permissions;
import org.ovirt.engine.ui.uicommonweb.UICommand;
import org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel;
import org.ovirt.engine.ui.uicommonweb.models.Model;
import org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.SnapshotModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmAppListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmDiskListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmEventListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmGeneralModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmInterfaceListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel;
import org.ovirt.engine.ui.uicommonweb.models.vms.VmSnapshotListModel;
import org.ovirt.engine.ui.webadmin.gin.ClientGinjector;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.AbstractModelBoundPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.AssignTagsPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.PermissionsPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.RemoveConfirmationPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.datacenter.FindSingleStoragePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.guide.GuidePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmChangeCDPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmDesktopNewPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmDiskPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmExportPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmInterfacePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmMakeTemplatePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmMigratePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmRunOncePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmServerNewPopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.vm.VmSnapshotCreatePopupPresenterWidget;
import org.ovirt.engine.ui.webadmin.uicommon.model.DetailModelProvider;
import org.ovirt.engine.ui.webadmin.uicommon.model.DetailTabModelProvider;
import org.ovirt.engine.ui.webadmin.uicommon.model.MainModelProvider;
import org.ovirt.engine.ui.webadmin.uicommon.model.MainTabModelProvider;
import org.ovirt.engine.ui.webadmin.uicommon.model.SearchableDetailModelProvider;
import org.ovirt.engine.ui.webadmin.uicommon.model.SearchableDetailTabModelProvider;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.inject.Provider;
import com.google.inject.Provides;
import com.google.inject.Singleton;

public class VirtualMachineModule extends AbstractGinModule {

    // Main List Model

    @Provides
    @Singleton
    public MainModelProvider<VM, VmListModel> getVmListProvider(ClientGinjector ginjector,
            final Provider<AssignTagsPopupPresenterWidget> assignTagsPopupProvider,
            final Provider<VmMakeTemplatePopupPresenterWidget> makeTemplatePopupProvider,
            final Provider<VmRunOncePopupPresenterWidget> runOncePopupProvider,
            final Provider<VmChangeCDPopupPresenterWidget> changeCDPopupProvider,
            final Provider<VmExportPopupPresenterWidget> exportPopupProvider,
            final Provider<VmMigratePopupPresenterWidget> migratePopupProvider,
            final Provider<FindSingleStoragePopupPresenterWidget> movePopupProvider,
            final Provider<VmDesktopNewPopupPresenterWidget> newDesktopVmPopupProvider,
            final Provider<VmServerNewPopupPresenterWidget> newServerVmPopupProvider,
            final Provider<GuidePopupPresenterWidget> guidePopupProvider,
            final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider) {
        return new MainTabModelProvider<VM, VmListModel>(ginjector, VmListModel.class) {
            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getAssignTagsCommand()) {
                    return assignTagsPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getNewTemplateCommand()) {
                    return makeTemplatePopupProvider.get();
                } else if (lastExecutedCommand == getModel().getRunOnceCommand()) {
                    return runOncePopupProvider.get();
                } else if (lastExecutedCommand == getModel().getChangeCdCommand()) {
                    return changeCDPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getExportCommand()) {
                    return exportPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getMigrateCommand()) {
                    return migratePopupProvider.get();
                } else if (lastExecutedCommand == getModel().getMoveCommand()) {
                    return movePopupProvider.get();
                } else if (lastExecutedCommand == getModel().getRemoveCommand()) {
                    return removeConfirmPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getNewDesktopCommand()) {
                    return newDesktopVmPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getNewServerCommand()) {
                    return newServerVmPopupProvider.get();
                } else if (lastExecutedCommand == getModel().getEditCommand()) {
                    UnitVmModel vm = (UnitVmModel) getModel().getWindow();
                    if (vm.getVmType().equals(VmType.Desktop)) {
                        return newDesktopVmPopupProvider.get();
                    } else {
                        return newServerVmPopupProvider.get();
                    }
                } else if (lastExecutedCommand == getModel().getGuideCommand()) {
                    return guidePopupProvider.get();
                } else {
                    return super.getModelPopup(lastExecutedCommand);
                }
            }

            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getRemoveCommand() ||
                        lastExecutedCommand == getModel().getStopCommand() ||
                        lastExecutedCommand == getModel().getShutdownCommand()) {
                    return removeConfirmPopupProvider.get();
                } else {
                    return super.getConfirmModelPopup(lastExecutedCommand);
                }
            }
        };
    }

    // Form Detail Models

    @Provides
    @Singleton
    public DetailModelProvider<VmListModel, VmGeneralModel> getVmGeneralProvider(ClientGinjector ginjector) {
        return new DetailTabModelProvider<VmListModel, VmGeneralModel>(ginjector,
                VmListModel.class,
                VmGeneralModel.class);
    }

    // Searchable Detail Models
    @Provides
    @Singleton
    public SearchableDetailModelProvider<permissions, VmListModel, PermissionListModel> getPermissionListProvider(ClientGinjector ginjector,
            final Provider<PermissionsPopupPresenterWidget> popupProvider,
            final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider) {
        return new SearchableDetailTabModelProvider<permissions, VmListModel, PermissionListModel>(ginjector,
                VmListModel.class,
                PermissionListModel.class) {
            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UICommand lastExecutedCommand) {
                PermissionListModel model = getModel();

                if (lastExecutedCommand == model.getAddCommand()) {
                    return popupProvider.get();
                } else {
                    return super.getModelPopup(lastExecutedCommand);
                }
            }

            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getRemoveCommand()) {
                    return removeConfirmPopupProvider.get();
                } else {
                    return super.getConfirmModelPopup(lastExecutedCommand);
                }
            }
        };
    }

    @Provides
    @Singleton
    public SearchableDetailModelProvider<DiskImage, VmListModel, VmDiskListModel> getVmDiskListProvider(ClientGinjector ginjector,
            final Provider<VmDiskPopupPresenterWidget> popupProvider,
            final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider) {
        return new SearchableDetailTabModelProvider<DiskImage, VmListModel, VmDiskListModel>(ginjector,
                VmListModel.class,
                VmDiskListModel.class) {
            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UICommand lastExecutedCommand) {
                VmDiskListModel model = getModel();

                if (lastExecutedCommand == model.getNewCommand() || lastExecutedCommand == model.getEditCommand()) {
                    return popupProvider.get();
                } else {
                    return super.getModelPopup(lastExecutedCommand);
                }
            }

            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getRemoveCommand()) {
                    return removeConfirmPopupProvider.get();
                } else {
                    return super.getConfirmModelPopup(lastExecutedCommand);
                }
            }
        };
    }

    @Provides
    @Singleton
    public SearchableDetailModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel> getVmInterfaceListProvider(ClientGinjector ginjector,
            final Provider<VmInterfacePopupPresenterWidget> popupProvider,
            final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider) {
        return new SearchableDetailTabModelProvider<VmNetworkInterface, VmListModel, VmInterfaceListModel>(ginjector,
                VmListModel.class,
                VmInterfaceListModel.class) {
            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UICommand lastExecutedCommand) {
                VmInterfaceListModel model = getModel();

                if (lastExecutedCommand == model.getNewCommand() || lastExecutedCommand == model.getEditCommand()) {
                    return popupProvider.get();
                } else {
                    return super.getModelPopup(lastExecutedCommand);
                }
            }

            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getRemoveCommand()) {
                    return removeConfirmPopupProvider.get();
                } else {
                    return super.getConfirmModelPopup(lastExecutedCommand);
                }
            }
        };
    }

    @Provides
    @Singleton
    public SearchableDetailModelProvider<AuditLog, VmListModel, VmEventListModel> getVmEventListProvider(ClientGinjector ginjector) {
        return new SearchableDetailTabModelProvider<AuditLog, VmListModel, VmEventListModel>(ginjector,
                VmListModel.class,
                VmEventListModel.class);
    }

    @Provides
    @Singleton
    public SearchableDetailModelProvider<String, VmListModel, VmAppListModel> getVmAppsProvider(ClientGinjector ginjector) {
        return new SearchableDetailTabModelProvider<String, VmListModel, VmAppListModel>(ginjector,
                VmListModel.class,
                VmAppListModel.class);
    }

    @Provides
    @Singleton
    public SearchableDetailModelProvider<SnapshotModel, VmListModel, VmSnapshotListModel> getVmSnapshotListProvider(ClientGinjector ginjector,
            final Provider<VmSnapshotCreatePopupPresenterWidget> createPopupProvider) {
        return new SearchableDetailTabModelProvider<SnapshotModel, VmListModel, VmSnapshotListModel>(ginjector,
                VmListModel.class, VmSnapshotListModel.class) {
            @Override
            protected AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getNewCommand()) {
                    return createPopupProvider.get();
                } else {
                    return super.getModelPopup(lastExecutedCommand);
                }
            }
        };
    }

    @Override
    protected void configure() {
    }

}


text:
<!--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you 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 the following location:

      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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.apereo.inspektr</groupId>
        <artifactId>inspektr</artifactId>
        <version>2.0.0-SNAPSHOT</version>
    </parent>
    <description>Inspektr Spring Support</description>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>inspektr-support-spring</artifactId>
    <packaging>jar</packaging>
    <name>Inspektr - Spring Framework Support</name>
    <dependencies>
        <dependency>
            <groupId>org.apereo.inspektr</groupId>
            <artifactId>inspektr-audit</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.apereo.inspektr</groupId>
            <artifactId>inspektr-common</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apereo.springwebflow</groupId>
            <artifactId>spring-webflow</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
    </dependencies>
</project>


text:
from unittest import mock

from senlin.drivers.os import cinder_v2
from senlin.drivers import sdk
from senlin.tests.unit.common import base
from senlin.tests.unit.common import utils

class TestCinderV2(base.SenlinTestCase):

    def setUp(self):
        super(TestCinderV2, self).setUp()

        self.ctx = utils.dummy_context()
        self.conn_params = self.ctx.to_dict()
        self.mock_conn = mock.Mock()
        self.mock_create = self.patchobject(sdk, 'create_connection',
                                            return_value=self.mock_conn)
        self.volume = self.mock_conn.block_store
        self.vo = cinder_v2.CinderClient(self.conn_params)

    def test_init(self):
        self.mock_create.assert_called_once_with(self.conn_params)
        self.assertEqual(self.mock_conn, self.vo.conn)

    def test_volume_get(self):
        self.vo.volume_get('foo')
        self.volume.get_volume.assert_called_once_with('foo')

    def test_volume_create(self):
        self.vo.volume_create(name='foo')
        self.volume.create_volume.assert_called_once_with(name='foo')

    def test_volume_delete(self):
        self.vo.volume_delete('foo', True)
        self.volume.delete_volume.assert_called_once_with(
            'foo', ignore_missing=True)
        self.volume.delete_volume.reset_mock()

        self.vo.volume_delete('foo', False)
        self.volume.delete_volume.assert_called_once_with(
            'foo', ignore_missing=False)
        self.volume.delete_volume.reset_mock()

        self.vo.volume_delete('foo')
        self.volume.delete_volume.assert_called_once_with(
            'foo', ignore_missing=True)

    def test_snapshot_create(self):
        self.vo.snapshot_create(name='foo')
        self.volume.create_snapshot.assert_called_once_with(name='foo')

    def test_snapshot_delete(self):
        self.vo.snapshot_delete('foo', True)
        self.volume.delete_snapshot.assert_called_once_with(
            'foo', ignore_missing=True)
        self.volume.delete_snapshot.reset_mock()

        self.vo.snapshot_delete('foo', False)
        self.volume.delete_snapshot.assert_called_once_with(
            'foo', ignore_missing=False)

        self.volume.delete_snapshot.reset_mock()
        self.vo.snapshot_delete('foo')
        self.volume.delete_snapshot.assert_called_once_with(
            'foo', ignore_missing=True)

    def test_snapshot_get(self):
        self.vo.snapshot_get('foo')
        self.volume.get_snapshot.assert_called_once_with('foo')


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Reinwardtia 9(2): 216 (1975)

#### Original name
Guepiniopsis oresbia Rangkuti & Rifai

### Remarks
null


text:
require 'rails_helper'

RSpec.describe "Ingresses", type: :request do
  describe "GET /ingresses" do
    it "works! (now write some real specs)" do
      get ingresses_path
      expect(response).to have_http_status(200)
    end
  end
end


text:
import frappe
from frappe import _
from frappe.utils import now

sitemap = 1

def get_context(context):
	doc = frappe.get_doc("Contact Us Settings", "Contact Us Settings")

	if doc.query_options:
		query_options = [opt.strip() for opt in doc.query_options.replace(",", "\n").split("\n") if opt]
	else:
		query_options = ["Sales", "Support", "General"]

	out = {"query_options": query_options, "parents": [{"name": _("Home"), "route": "/"}]}
	out.update(doc.as_dict())

	return out

max_communications_per_hour = 1000

@frappe.whitelist(allow_guest=True)
def send_message(subject="Website Query", message="", sender=""):
	if not message:
		frappe.response["message"] = "Please write something"
		return

	if not sender:
		frappe.response["message"] = "Email Address Required"
		return

	# guest method, cap max writes per hour
	if (
		frappe.db.sql(
			"""select count(*) from `tabCommunication`
		where `sent_or_received`="Received"
		and TIMEDIFF(%s, modified) < '01:00:00'""",
			now(),
		)[0][0]
		> max_communications_per_hour
	):
		frappe.response[
			"message"
		] = "Sorry: we believe we have received an unreasonably high number of requests of this kind. Please try later"
		return

	# send email
	forward_to_email = frappe.db.get_single_value("Contact Us Settings", "forward_to_email")
	if forward_to_email:
		frappe.sendmail(recipients=forward_to_email, sender=sender, content=message, subject=subject)

	# add to to-do ?
	frappe.get_doc(
		dict(
			doctype="Communication",
			sender=sender,
			subject=_("New Message from Website Contact Page"),
			sent_or_received="Received",
			content=message,
			status="Open",
		)
	).insert(ignore_permissions=True)

	return "okay"


text:
<?php

/**
 *
 * @category   Rohde
 * @package    Rohde_Onestepcheckout
 * @author     Support <j.rohde@nederland.live>
 */
class Rohde_Onestepcheckout_Helper_Shipping extends Mage_Core_Helper_Data {

    /**
     * set shipping method for first load checkout page
     */
    public function initShippingMethod() {
        if (!$this->getQuote()->getShippingAddress()->getShippingMethod()) {
            $shippingRates = $this->getShippingRates();
            if ((count($shippingRates) == 1)) {
                $currentShippingRate = current($shippingRates);
                if (count($currentShippingRate) == 1) {
                    $shippingRate = current($currentShippingRate);
                    $shippingMethod = $shippingRate->getCode();
                }
            } elseif ($lastShippingMethod = $this->_getLastShippingMethod()) {
                $shippingMethod = $lastShippingMethod;
            } elseif ($defaultShippingMethod = Mage::helper('onestepcheckout/config')->getDefaultShippingMethod()) {
                $shippingMethod = $defaultShippingMethod;
            }
            if (isset($shippingMethod)) {
                $this->getOnepage()->saveShippingMethod($shippingMethod);
            }
        }
    }

    public function getShippingRates() {
        $address = Mage::getSingleton('checkout/session')
                ->getQuote()
                ->getShippingAddress()
                ->collectShippingRates()
                ->save()
        ;
        return $address->getGroupedAllShippingRates();
        ;
    }

    protected function _getLastShippingMethod() {
        $customer = Mage::getSingleton('customer/session')->getCustomer();
        if (!$customer->getId()) {
            return false;
        }
        $orderCollection = Mage::getResourceModel('sales/order_collection')
                ->addFilter('customer_id', $customer->getId())
                ->addFieldToFilter('shipping_method', array('neq' => ''))
                ->addAttributeToSort('created_at', Varien_Data_Collection_Db::SORT_ORDER_DESC)
                ->setPageSize(1);

        $lastOrder = $orderCollection->getFirstItem();
        if (!$lastOrder->getId()) {
            return false;
        }
        return $lastOrder->getShippingMethod();
    }

    /**
     * @return Mage_Checkout_Model_Type_Onepage
     */
    public function getOnepage() {
        return Mage::getSingleton('checkout/type_onepage');
    }

    public function getQuote() {
        return Mage::getSingleton('checkout/session')->getQuote();
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping         http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd">
    <class name="Sonata\PaymentBundle\Entity\BaseTransaction">
        <getter property="transactionId">
            <constraint name="NotNull"/>
        </getter>
        <getter property="state">
            <constraint name="NotNull"/>
        </getter>
        <getter property="statusCode">
            <constraint name="NotNull"/>
        </getter>
        <getter property="paymentCode">
            <constraint name="NotNull"/>
        </getter>
    </class>
</constraint-mapping>


text:
var mocha = require('gulp-mocha');

module.exports = function(gulp, config) {
  gulp.task('spec', function() {
    var stream = gulp
      .src(config.spec.paths)
      .pipe(mocha());

    return stream;
  });
};


text:
var posix = require(__dirname + '/../build/default/posixtools.node');
var PipeParser = require(__dirname + '/../lib/tiamat/pipe_parser').PipeParser;
var net = require("net");
var fs = require("fs");
var netBinding = process.binding('net');

var pipeFDs = [];
pipeFDs.push(netBinding.pipe());
pipeFDs.push(netBinding.pipe());
var pid = posix.fork();

function prepareTalk(pipe) {
  netBinding.close(pipe[0]); // close the read fd
  var pipeWriteStream = new net.Stream();
  pipeWriteStream.open(pipe[1]);
  return pipeWriteStream;
}
function prepareListen(pipe) {
  netBinding.close(pipe[1]); // close the write fd
}

function talkOnPipe(writeStream, msg) {
  var output = [PipeParser.startToken(), new Buffer(JSON.stringify(msg)), PipeParser.endToken()];
  output.forEach(function(out) {
    writeStream.write(out);
    writeStream.flush();
  });
}
function listenOnPipe(parser, pipe, cb) {
  var pipeReadStream = new net.Stream();

  pipeReadStream.on('data', function(data) {
    parser.parse(data);
  });

  pipeReadStream.on('end', function(data) {
    console.log(posix.getpid() + " write pipe was closed");
  });

  pipeReadStream.open(pipe[0]); // listen on the read fd
  pipeReadStream.resume();
}

if (pid == 0) {
  console.log("child:"  + posix.getpid());
  prepareListen(pipeFDs[0]);
  var writeStream = prepareTalk(pipeFDs[1]);
  var parser = new PipeParser();
  parser.on("message", function(data) {
    console.log(posix.getpid() + ", child received: %s, %s", data, JSON.parse(data));
  });
  parser.on("error", function(msg) { console.error(msg); });

  listenOnPipe(parser, pipeFDs[0], function() {
    console.log("parent closed write pipe");
  });

  for (var i = 0; i < 10; ++i) {
    talkOnPipe(writeStream, {message:("hello parent, " + i)});
  }
  writeStream.destroySoon();
}
else {
  console.log("parent:" + posix.getpid());
  prepareListen(pipeFDs[1]);
  var writeStream = prepareTalk(pipeFDs[0]);
  var parser = new PipeParser();
  parser.on("message", function(data) {
    console.log(posix.getpid() + ", parent received: %s, %s", data, JSON.parse(data));
  });
  parser.on("error", function(msg) { console.error(msg); });
  listenOnPipe(parser, pipeFDs[1], function() {
    console.log("child closed write pipe");
  });
  for (var i = 0; i < 10; ++i) {
    talkOnPipe(writeStream, {message:("hello child, " + i)});
  }
  writeStream.destroySoon();
}


text:
namespace CatLib._3rd.SharpCompress.Common.SevenZip
{
    internal class CCoderInfo
    {
        internal CMethodId MethodId;
        internal byte[] Props;
        internal int NumInStreams;
        internal int NumOutStreams;
    }
}


text: **You can usually treat piles yourself.**


text:
We use XC8's peripheral libraries (_plib_), read timeout is not implemented.

## Devices
Currently only MPU6050 is supported without DMP functions. There's an example MPLABX project showing how to read raw data from the MPU.

Adding more functions and devices should be straighforward after reading the source code.

## Licence
I2Cdev device library code is placed under the MIT license.

_Copyright (c) 2011 Jeff Rowberg. Copyright (c) 2014 Marton Sebok._


text:
class Renderer : public Component {
    Material *material;
    Shader *shader, *borderShader;
    Model *model;
    bool useShadow;
    bool isSelected = false;
public:
    Renderer(Material *material, Shader *shader, bool useShadow = true);

    std::string getName() override;

    void start() override;

    void updateGraphics(RenderLayer renderLayer) override;

    void destroy() override;

    Material *getMaterial() const;

    void setMaterial(Material *material);

    bool getSelected() const;

    void setSelected(bool isSelected);
};

#endif //ELFGE_MESHRENDER_H


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JSDoc: Source: d3.layout.odmap.js</title>

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">

Source: d3.layout.odmap.js

/*global nmap,d3,nmap_extend,nmap_squared,console,nmap_element */
/*jshint unused:false*/

/**
* d3 layout helper for origin-destination visualizations
* @constructor
* @param {object} args
* @param {object} args.s - data selectors
* @param {string} args.s.x="x" - x position of item
* @param {string} args.s.y="y" - y position of item
* @param {string} args.s.id="id" - id of item (required)
* @param {string} args.s.title="id" - title of item
* @param {string} args.s.hx="hx" - alternative x position of item
* @param {string} args.s.hy="hy" - alternative y position of item
* @param {string} args.s.hwidth="hwidth" - alternative width of item
* @param {string} args.s.hheight="hheight" - alternative height of item
* @param {integer|float} args.height=300 - height of the available space
* @param {integer|float} args.width=300 - width of the available space
* @param {boolean} args.hand=false - If the dataset contains alternative coordinates (hx,hy,hwidth,hheight)
* @param {object} args.nmap - Settings for the nmap algorithm
* @param {string} args.cut="alternate" - nmap method
* @param {string} args.method="border" - nmap_squared method
* @param {boolean} args.square=true - nmap_squared option
* @param {float|integer} args.border_adv=1.9 - nmap_squared option
* @return {object} odmap helper
*/
d3.layout.odmap = function(args){
	if(typeof(nmap) !== typeof(Function)){ throw "ERROR: You need to include the nmap.js library."; }

	//data
	var data = [];

	var defaults = {
		s:{
			//Geographic x/y coordinates
			x : "x",
			y : "y",
			//id/title attribute
			id : "id",
			title : "id",
			//handwritten grid
			hx : "hx",
			hy : "hy",
			hwidth : "hwidth",
			hheight : "hheight"
		},
		nmap:{
			cut:"alternate",
			method:"border",
			square:true,
			border_adv:1.0
		},
		hand:false,
		width:300,
		height:300
	};

	//given arguments and defaults
	var attr = nmap_extend(defaults, args);

	/**
	* Create squared
	* @constructor
	*/
	function od(){
	}

	od();

	var swidth,
		sheight,
		fwidth,
		fheight,
		sx,
		sy,
		i, ii, iii,
		data_switch = "",
		mm={
			min : Number.MAX_VALUE,
			max : -Number.MAX_VALUE,
			imin : Number.MAX_VALUE,
			imax : -Number.MAX_VALUE,
			//Max/Min without transfers where (o == d)
			smin : Number.MAX_VALUE,
			smax : -Number.MAX_VALUE,
			ismin : Number.MAX_VALUE,
			ismax : -Number.MAX_VALUE
		},
		grid_width,
		grid_height,
		row_count,
		col_count;

	/**
	* setup the data
	* @param {array} d - The array contains a list of points
	* @param {object} d[] - The structure of the objects depends on the selectors set in the initial arguments
	*/
	od.data = function(d){
		/*--- Calculate the extend of the data and normalize it ---*/
		var maxX = -Number.MAX_VALUE,
			minX = Number.MAX_VALUE,
			maxY = -Number.MAX_VALUE,
			minY = Number.MAX_VALUE,
			hmaxX = -Number.MAX_VALUE,
			hminX = Number.MAX_VALUE,
			hmaxY = -Number.MAX_VALUE,
			hminY = Number.MAX_VALUE;

		var x,y,hx,hy,hwidth,hheight,shx,shy;

		for(i = 0; i<d.length; i++){
			x = parseFloat(d[i].x);
			y = parseFloat(d[i].y);

			if(x > maxX){maxX = x;}
			if(x < minX){minX = x;}

			if(y > maxY){maxY = y;}
			if(y < minY){minY = y;}

			if(attr.hand){
				hx = parseFloat(d[i][attr.s.hx]);
				hy = parseFloat(d[i][attr.s.hy]);

				hwidth = parseFloat(d[i][attr.s.hwidth]);
				hheight = parseFloat(d[i][attr.s.hheight]);

				if((hx+hwidth) > hmaxX){hmaxX = hx;}
				if(hx < hminX){hminX = hx;}

				if((hy+hheight) > hmaxY){hmaxY = hy;}
				if(hy < hminY){hminY = hy;}
			}

		}

		swidth = maxX - minX;
		sheight = maxY - minY;
		sx = attr.width/swidth;
		sy = attr.height/sheight;

		if(sx<sy){
			sy = sx;
		}else{
			sx = sy;
		}

		fwidth = swidth*sx;
		fheight = sheight*sy;

		if(attr.hand){
			hwidth = hmaxX;
			hheight = hmaxY;
			shx = fwidth/hwidth;
			shy = fheight/hheight;
		}

		row_count = col_count = Math.ceil(Math.sqrt(d.length));
		grid_width = fwidth / col_count;
		grid_height = fheight / row_count;

		for(i = 0; i<d.length; i++){
			var item = {
				id:d[i][attr.s.id],
				title:d[i][attr.s.title],
				x:(parseFloat(d[i][attr.s.x])-minX)*sx,
				y:(parseFloat(d[i][attr.s.y])-minY)*sy,
				ox:d[i][attr.s.x],
				oy:d[i][attr.s.y],
				h:{
					x:0,
					y:0,
					width:0,
					height:0
				},
				g:{
					x:(i-Math.floor(i/col_count)*col_count)*grid_width,
					y:Math.floor(i/row_count)*grid_height,
					width:grid_width,
					height:grid_height
				},
				data:{
					min:Number.MAX_VALUE,
					max:-Number.MAX_VALUE,
					data:[]
				},
				idata:{
					min:Number.MAX_VALUE,
					max:-Number.MAX_VALUE,
					data:[]
				},
				n:{
					x:0,
					y:0,
					width:0,
					height:0
				}
			};

			//If available get the handwritten grid
			if(attr.hand){
				item.h.x = (parseFloat(d[i][attr.s.hx])-hminX)*shx;
				item.h.y = (parseFloat(d[i][attr.s.hy])-hminY)*shy;
				item.h.width = parseFloat(d[i][attr.s.hwidth])*shx;
				item.h.height = parseFloat(d[i][attr.s.hheight])*shy;
			}

			//Sorting the data for o/d and d/o
			var n,dd;
			for(ii = 0; ii<d.length; ii++){
				n = parseFloat(d[ii][item.id]);
				dd = {
					amount:n,
					x:0,
					y:0,
					width:0,
					height:0,
					id:d[ii][attr.s.id]
				};
				item.data.data.push(dd);

				if(n > item.data.max){
					item.data.max = n;
				}
				if(n < item.data.min){
					item.data.min = n;
				}
				if(n > mm.max){
					mm.max = d[ii][item.id];
				}
				if(n < mm.min){
					mm.min = d[ii][item.id];
				}
				if(i!==ii){
					if(n > mm.smax){
						mm.smax = d[ii][item.id];
					}
					if(n < mm.smin){
						mm.smin = d[ii][item.id];
					}
				}
			}

			for(ii = 0; ii<d.length; ii++){
				n = parseFloat(d[i][d[ii][attr.s.id]]);
				dd = {
					amount:n,
					x:0,
					y:0,
					width:0,
					height:0,
					id:d[ii][attr.s.id]
				};
				item.idata.data.push(dd);

				if(n > item.idata.max){
					item.idata.max = n;
				}
				if(n < item.idata.min){
					item.idata.min = n;
				}
				if(n > mm.imax){
					mm.imax = d[ii][item.id];
				}
				if(n < mm.imin){
					mm.imin = d[ii][item.id];
				}
				if(i!==ii){
					if(n > mm.ismax){
						mm.ismax = d[ii][item.id];
					}
					if(n < mm.ismin){
						mm.ismin = d[ii][item.id];
					}
				}
			}

			data.push(item);
		}

		/*--- NMAP MAPPING ---*/

		var nmap_data = nmap_squared({
			width:attr.width,
			height:attr.height,
			data:data,
			method:attr.nmap.method,
			square:attr.nmap.square,
			border_adv:attr.nmap.border_adv
		});

		var nmap_elements = [];
		for(i = 0; i<nmap_data.data.length; i++){
			nmap_elements.push(new nmap_element({
				id:nmap_data.data[i].id,
				x:nmap_data.data[i].x,
				y:nmap_data.data[i].y,
				weight:10000+Math.random(),
				klass:nmap_data.data[i].class
			}));
		}

		var odNmap = new nmap({
			x:0,
			y:0,
			width:nmap_data.width,
			height:nmap_data.height
		});

		var nmap_cut;
		if(attr.nmap.cut==="alternate"){
			nmap_cut = odNmap.alternateCut({
				elements:nmap_elements
			});
		}else{
			nmap_cut = odNmap.equalWeight({
				elements:nmap_elements
			});
		}

		for(ii = 0; ii<data.length; ii++){
			for(i = 0; i<nmap_cut.length; i++){
				if(nmap_cut[i].attr().element.attr().id === data[ii].id){
					data[ii].n.x = nmap_cut[i].attr().x;
					data[ii].n.y = nmap_cut[i].attr().y;
					data[ii].n.width = nmap_cut[i].attr().width;
					data[ii].n.height = nmap_cut[i].attr().height;
				}
			}
		}

	};

	/**
	* Helper functions for switching between o/d and d/o
	*/
	od.toggle = function(){
		if(data_switch === ""){
			data_switch = "i";
		}else{
			data_switch = "";
		}
	};

	/**
	* Helper function for switching to either o/d and d/o
	* @param {string} to - either "i" -> inverse or "" -> normal
	*/
	od.switchTo = function(to){
		data_switch = to;
	};

	/**
	* Original position normalized to given space
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.geo = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:fwidth,
			height:fheight,
			data:[]
		};

		for(i = 0; i<data.length; i++){
			r.data.push({
				x:data[i].x,
				y:data[i].y,
				width:data[i].g.width,
				height:data[i].g.height,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* Nmap position generated through nmap_squared > nmap
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.nmap = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:fwidth,
			height:fheight,
			data:[]
		};
		for(i = 0; i<data.length; i++){
			r.data.push({
				x:data[i].n.x,
				y:data[i].n.y,
				width:data[i].n.width,
				height:data[i].n.height,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* Alternative positions from the original dataset via attr.s.hx/attr.s.hy and attr.s.hwidth/attr.s.hheight
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.hand = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:fwidth,
			height:fheight,
			data:[]
		};

		for(i = 0; i<data.length; i++){
			r.data.push({
				x:data[i].h.x,
				y:data[i].h.y,
				width:data[i].h.width,
				height:data[i].h.height,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* An origin destination matrix with rows and cols
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.matrix = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:attr.width,
			height:attr.height,
			data:[]
		};

		if(typeof inner === 'undefined'){
			for(i = 0; i<data.length; i++){
				r.data.push({
					x:i*attr.width/data.length,
					y:0,
					width:attr.width/data.length,
					height:attr.height,
					id:data[i].id,
					data:data[i][data_switch+"data"]
				});
			}
		}else{
			for(i = 0; i<data.length; i++){
			r.data.push({
				x:0,
				y:i*attr.height/data.length,
				width:attr.width,
				height:attr.height/data.length,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* output optimized for d3 sankey plugin
	* @return {array} r - result array
	* @return {array} r[].nodes - nodes (origins and destinations) The first half of the array contains the origins and the second half the destinations
	* @return {object} r[].nodes[] - origin/destination object
	* @return {string} r[].nodes[].name - id of origin/destination
	* @return {object} r[].links[] - connection object
	* @return {integer} r[].links[].source - id of object in nodes array
	* @return {integer} r[].links[].target - id of object in nodes array
	* @return {integer|float} r[].links[].value - od value
	*/
	od.sankey = function(){
		var r = {
			nodes:[],
			links:[]
		};

		//add origins
		for(i = 0; i<data.length; i++){
			r.nodes.push({name:data[i].id});
		}

		//add destinations
		for(i = 0; i<data[0][data_switch+"data"].data.length; i++){
			r.nodes.push({name:data[i].id});
		}

		//add links
		for(i = 0; i<data.length; i++){
			for(ii = 0; ii<data[i][data_switch+"data"].data.length; ii++){
				r.links.push({
					source:i,
					target:ii+data.length,
					value:data[i][data_switch+"data"].data[ii].amount
				});
			}
		}

		return r;
	};

	/**
	* output an array optimized for the d3 biPartite visualization
	* @return {array} r - result array
	* @return {string} r[][0] - id of origin
	* @return {string} r[][1] - id of destination
	* @return {integer|float} r[][2] - id of value of od
	*/
	od.bipartite = function(){
		var r = [];
		for(i = 0; i<data.length; i++){
			for(ii = 0; ii<data[i][data_switch+"data"].data.length; ii++){
				r.push([
					data[i].id,
					data[i][data_switch+"data"].data[ii].id,
					data[i][data_switch+"data"].data[ii].amount
				]);
			}
		}

		return r;
	};

	/**
	* A simple list, ordered by the given order from the original data set
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.list = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:fwidth,
			height:fheight,
			data:[]
		};

		for(i = 0; i<data.length; i++){
			r.data.push({
				x:0,
				y:(attr.height/data.length)*i,
				width:attr.width,
				height:attr.height/data.length,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* A simple grid, order given from the original dataset
	* @param {function} inner - d3.layout.odmap function for the inner representation of the data
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.grid = function(inner){
		var r = {
			min:mm[data_switch+"min"],
			max:mm[data_switch+"max"],
			smin:mm[data_switch+"smin"],
			smax:mm[data_switch+"smax"],
			width:fwidth,
			height:fheight,
			data:[]
		};

		for(i = 0; i<data.length; i++){
			r.data.push({
				x:data[i].g.x,
				y:data[i].g.y,
				width:data[i].g.width,
				height:data[i].g.height,
				id:data[i].id,
				data:data[i][data_switch+"data"]
			});
		}

		if(typeof inner === 'undefined'){
			return r;
		}else{
			return od.setData(r, inner);
		}
	};

	/**
	* This function receives two dataset one for the outer positioning and one for the inner and combines them and returns a unified result object
	* @param {object} r - result object (see below)
	* @param {object} inner - result object (see below)
	* @return {object} r - result array
	* @return {float|integer} r.min - minimum for od-values
	* @return {float|integer} r.max - minimum for od-values
	* @return {float|integer} r.smin - minimum for od-values without data where (o == d)
	* @return {float|integer} r.smax - minimum for od-values without data where (o == d)
	* @return {float|integer} r.width - width
	* @return {float|integer} r.height - width
	* @return {array} r.data - the origin data
	* @return {float|integer} r.data[].x - x position of origin data
	* @return {float|integer} r.data[].y - y position of origin data
	* @return {float|integer} r.data[].width - width position of origin data
	* @return {float|integer} r.data[].height - height position of origin data
	* @return {string} r.data[].id - id of origin data
	* @return {object} r.data[].data - destination data for this origin
	* @return {float|integer} r.data[].data.max - max for this group of ods
	* @return {float|integer} r.data[].data.min - min for this group of ods
	* @return {array} r.data[].data.data - destination data for this origin
	* @return {float|integer} r.data[].data.data[].x - x position of destination data
	* @return {float|integer} r.data[].data.data[].y - y position of destination data
	* @return {float|integer} r.data[].data.data[].width - width position of destination data
	* @return {float|integer} r.data[].data.data[].height - height position of destination data
	* @return {string} r.data[].data.data[].id - id of destination data
	*/
	od.setData = function(r, inner){
		var inner_key = [];
		for(iii = 0; iii<inner.data.length; iii++){
			inner_key[inner.data[iii].id] = iii;
		}

		for(i = 0; i<r.data.length; i++){
			for(ii = 0; ii<r.data[i].data.data.length; ii++){
				for(iii = 0; iii<inner.data.length; iii++){
					r.data[i].data.data[ii].x = inner.data[inner_key[r.data[i].data.data[ii].id]].x;
					r.data[i].data.data[ii].y = inner.data[inner_key[r.data[i].data.data[ii].id]].y;
					r.data[i].data.data[ii].width = inner.data[inner_key[r.data[i].data.data[ii].id]].width;
					r.data[i].data.data[ii].height = inner.data[inner_key[r.data[i].data.data[ii].id]].height;
				}
			}
		}

		return r;
	};

	return od;
};

Home

Classes

odmap

od

    Documentation generated by JSDoc 3.3.3 on Mon Sep 28 2015 16:33:12 GMT+0100 (BST)


text:
'use strict';

const Rule = require('../src/permissions/rule').Rule;

const assert = require('assert');

const make_request = (type, collection, options) => {
  if (collection !== null) {
    return { request_id: 5, type, options: Object.assign({ collection }, options) };
  } else {
    return { request_id: 5, type, options };
  }
};

const context = { id: 123, groups: [ 'admin', 'default', 'authenticated' ] };

describe('Permissions', () => {
  describe('Template', () => {
    it('any', () => {
      const rule = new Rule('foo', { template: 'any()' });

      const tests = [ { },
                      { type: 'query', options: { collection: 'test' } },
                      { fake: 'bar' },
                      { options: { } },
                      { type: 'query', options: { fake: 'baz' } } ];

      for (const t of tests) {
        assert(rule.is_match(t, context));
        assert(rule.is_valid());
      }
    });

    it('any read', () => {
      const rule = new Rule('foo', { template: 'collection(any()).anyRead()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('fake', 'test', { }), context));
      assert(!rule.is_match(make_request('store', 'test', { }), context));
      assert(!rule.is_match(make_request('query', null, { }), context));
      assert(rule.is_match(make_request('query', 'fake', { }), context));
      assert(rule.is_match(make_request('query', 'fake', { find: { } }), context));
      assert(rule.is_match(make_request('query', 'test', { bar: 'baz' }), context));
      assert(rule.is_match(make_request('query', 'test', { find_all: [ { }, { } ] }), context));
      assert(!rule.is_match(make_request('subscribe', null, { }), context));
      assert(rule.is_match(make_request('subscribe', 'fake', { }), context));
      assert(rule.is_match(make_request('subscribe', 'fake', { find: { } }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { bar: 'baz' }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { find_all: [ { }, { } ] }), context));
    });

    it('any read with collection', () => {
      const rule = new Rule('foo', { template: 'collection("test").anyRead()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'fake', { }), context));
      assert(rule.is_match(make_request('query', 'test', { }), context));
      assert(rule.is_match(make_request('query', 'test', { }), context));
      assert(rule.is_match(make_request('query', 'test', { }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { }), context));
    });

    it('any read with order', () => {
      // TODO: allow for any number of fields in order
      const rule = new Rule('foo', { template: 'collection("test").order(any(), any()).anyRead()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'fake', { order: [ 'foo', 'ascending' ] }), context));
      assert(!rule.is_match(make_request('query', 'test', { }), context));
      assert(!rule.is_match(make_request('query', 'test', { order: [ 'baz' ] }), context));
      assert(!rule.is_match(make_request('query', 'test', { order: [ 'baz', 'fake' ] }), context));
      assert(!rule.is_match(make_request('query', 'test', { order: [ [ 'fake' ] ] }), context));
      assert(rule.is_match(make_request('query', 'test', { order: [ [ 'foo' ], 'ascending' ] }), context));
      assert(rule.is_match(make_request('query', 'test', { order: [ [ 'bar' ], 'descending' ] }), context));
      assert(rule.is_match(make_request('query', 'test', { order: [ [ 'baz' ], 'fake' ] }), context));
      assert(rule.is_match(make_request('query', 'test', { find: { }, order: [ [ 'baz' ], 'fake' ] }), context));
      assert(rule.is_match(make_request('query', 'test', { find_all: [ { } ], order: [ [ 'baz' ], 'fake' ] }), context));
      assert(rule.is_match(make_request('query', 'test', { fake: 'baz', order: [ [ 'baz' ], 'fake' ] }), context));
    });

    it('any read with find', () => {
      const rule = new Rule('foo', { template: 'collection("test").find(any()).anyRead()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'fake', { find: { } }), context));
      assert(!rule.is_match(make_request('query', 'test', { }), context));
      assert(rule.is_match(make_request('query', 'test', { find: { } }), context));
      assert(rule.is_match(make_request('query', 'test', { find: { }, fake: 'baz' }), context));
    });

    it('any read with findAll', () => {
      // TODO: allow for any number of arguments in findAll
      const rule = new Rule('foo', { template: 'collection("test").findAll(any()).anyRead()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'fake', { find_all: { } }), context));
      assert(!rule.is_match(make_request('query', 'test', { }), context));
      assert(rule.is_match(make_request('query', 'test', { find_all: [ { } ] }), context));
      assert(rule.is_match(make_request('query', 'test', { find_all: [ { } ], fake: 'baz' }), context));
    });

    it('collection fetch', () => {
      const rule = new Rule('foo', { template: 'collection("test").fetch()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'fake', { }), context));
      assert(!rule.is_match(make_request('query', 'test', { bar: 'baz' }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: { id: 5 } }), context));
      assert(rule.is_match(make_request('query', 'test', { }), context));
    });

    it('collection watch', () => {
      const rule = new Rule('foo', { template: 'collection("test").watch()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('subscribe', 'fake', { }), context));
      assert(!rule.is_match(make_request('subscribe', 'test', { bar: 'baz' }), context));
      assert(!rule.is_match(make_request('subscribe', 'test', { find: { id: 5 } }), context));
      assert(rule.is_match(make_request('subscribe', 'test', { }), context));
    });

    for (const type of [ 'store', 'update', 'insert', 'upsert', 'replace', 'remove' ]) {
      it(`collection ${type}`, () => {
        const rule = new Rule('foo', { template: `collection("test").${type}(any())` });
        assert(rule.is_valid());
        assert(!rule.is_match(make_request(type, 'test', { }), context));
        assert(!rule.is_match(make_request(type, 'test', { data: { } }), context));
        assert(!rule.is_match(make_request(type, 'test', { data: [ ] }), context));
        assert(!rule.is_match(make_request(type, 'fake', { data: [ { } ] }), context));
        assert(!rule.is_match(make_request(type, 'test', { data: [ { } ], fake: 6 }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ { } ] }), context));
      });
      it(`collection ${type} batch`, () => {
        const rule = new Rule('foo', { template: `collection("test").${type}(anyArray(any()))` });
        assert(rule.is_valid());
        assert(!rule.is_match(make_request(type, 'test', { }), context));
        assert(!rule.is_match(make_request(type, 'test', { data: { } }), context));
        assert(!rule.is_match(make_request(type, 'test', { data: [ { } ], fake: 6 }), context));
        assert(!rule.is_match(make_request(type, 'fake', { data: [ { } ] }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ ] }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ { } ] }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ { }, { bar: 'baz' } ] }), context));
      });
    }

    it('any write', () => {
      const rule = new Rule('foo', { template: 'collection("test").anyWrite()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('fake', 'test', { }), context));
      assert(!rule.is_match(make_request('query', 'test', { }), context));
      assert(!rule.is_match(make_request('store', null, { }), context));

      for (const type of [ 'store', 'update', 'insert', 'upsert', 'replace', 'remove' ]) {
        assert(!rule.is_match(make_request(type, 'fake', { }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ ] }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ { } ] }), context));
        assert(rule.is_match(make_request(type, 'test', { data: [ ], bar: 'baz' }), context));
      }
    });

    it('userId in find', () => {
      const rule = new Rule('foo', { template: 'collection("test").find({ owner: userId() }).fetch()' });
      assert(rule.is_valid());
      assert(!rule.is_match(make_request('query', 'test', { find: { } }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: true }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: [ ] }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: { bar: 'baz' } }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: { owner: (context.id + 1) } }), context));
      assert(!rule.is_match(make_request('query', 'test', { find: { owner: context.id, bar: 'baz' } }), context));
      assert(rule.is_match(make_request('query', 'test', { find: { owner: context.id } }), context));
    });

    it('adds readAny() implicitly', () => {
      {
        const rule = new Rule('foo', { template: 'collection("test")' });
        assert(rule.is_valid());
        assert(rule.is_match(make_request('query', 'test', { find: { } }), context));
        assert(rule.is_match(make_request('query', 'test', { find: { bar: 'baz' } }), context));
      }
      {
        const rule = new Rule('foo', { template: 'collection("test").find({bar: any()})' });
        assert(rule.is_valid());
        assert(!rule.is_match(make_request('query', 'test', { find: { } }), context));
        assert(rule.is_match(make_request('query', 'test', { find: { bar: 'baz' } }), context));
      }
    });

    it('error on incomplete template', () => {
      assert.throws(() => new Rule('foo', { template: '({ })' }), /Incomplete template/);
      assert.throws(() => new Rule('foo', { template: '[ ]' }), /Invalid template/);
      assert.throws(() => new Rule('foo', { template: '5' }), /Invalid template/);
      assert.throws(() => new Rule('foo', { template: 'null' }), /Invalid template/);
    });
  });
});


text:
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonExtensionComponents_2;

/**
 * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2
 * @xmlType
 * @xmlName UBLExtensionsType
 * @var oasis\names\specification\ubl\schema\xsd\CommonExtensionComponents_2\UBLExtensionsType
 * @xmlDefinition
        A container for all extensions present in the document.

 */
class UBLExtensionsType
	{

	/**
	 * @Definition
            A single extension for private use.

	 * @xmlType element
	 * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2
	 * @xmlMinOccurs 1
	 * @xmlMaxOccurs unbounded
	 * @xmlName UBLExtension
	 * @var oasis\names\specification\ubl\schema\xsd\CommonExtensionComponents_2\UBLExtension
	 */
	public $UBLExtension;

} // end class UBLExtensionsType


text:
layout: redirect
sitemap: false
---