text
stringlengths
2
99.5k
meta
dict
<?php /* * $Id$ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.doctrine-project.org>. */ /** * Doctrine_Ticket_963_TestCase * * @package Doctrine * @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.doctrine-project.org * @since 1.0 * @version $Revision$ */ class Doctrine_Ticket_963_TestCase extends Doctrine_UnitTestCase { public function testInit() { $this->dbh = new Doctrine_Adapter_Mock('mysql'); $this->conn = Doctrine_Manager::getInstance()->openConnection($this->dbh); } public function testExportSql() { $sql = $this->conn->export->exportClassesSql(array('Ticket_963_User', 'Ticket_963_Email')); $this->assertEqual(count($sql), 3); $this->assertEqual($sql[0], 'CREATE TABLE ticket_963__user (id BIGINT AUTO_INCREMENT, username VARCHAR(255), password VARCHAR(255), PRIMARY KEY(id)) ENGINE = INNODB'); $this->assertEqual($sql[1], 'CREATE TABLE ticket_963__email (user_id INT, address2 VARCHAR(255), PRIMARY KEY(user_id)) ENGINE = INNODB'); $this->assertEqual($test = isset($sql[2]) ? $sql[2]:null, 'ALTER TABLE ticket_963__email ADD CONSTRAINT ticket_963__email_user_id_ticket_963__user_id FOREIGN KEY (user_id) REFERENCES ticket_963__user(id) ON DELETE CASCADE'); } } class Ticket_963_User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('username', 'string', 255); $this->hasColumn('password', 'string', 255); } public function setUp() { $this->hasOne('Ticket_963_Email as Email', array('local' => 'id', 'foreign' => 'user_id')); } } class Ticket_963_Email extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('user_id', 'integer', 4, array('primary' => true)); $this->hasColumn('address2', 'string', 255); } public function setUp() { $this->hasOne('Ticket_963_User as User', array( 'local' => 'user_id', 'foreign' => 'id', 'owningSide' => true, 'onDelete' => 'CASCADE')); } }
{ "pile_set_name": "Github" }
// Copyright (C) 2009 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.gerrit.server.ssh; import com.jcraft.jsch.HostKey; import java.util.List; public interface SshInfo { List<HostKey> getHostKeys(); }
{ "pile_set_name": "Github" }
<?php /** * UserEventApiTest * PHP version 5 * * @category Class * @package Swagger\Client * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ /** * BitMEX API * * ## REST API for the BitMEX Trading Platform [View Changelog](/app/apiChangelog) - #### Getting Started Base URI: [https://www.bitmex.com/api/v1](/api/v1) ##### Fetching Data All REST endpoints are documented below. You can try out any query right from this interface. Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first. Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI). _All_ table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits. ##### Return Types By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data. ##### Trade Data Queries _This is only a small subset of what is available, to get you started._ Fill in the parameters and click the `Try it out!` button to try any of these queries. - [Pricing Data](#!/Quote/Quote_get) - [Trade Data](#!/Trade/Trade_get) - [OrderBook Data](#!/OrderBook/OrderBook_getL2) - [Settlement Data](#!/Settlement/Settlement_get) - [Exchange Statistics](#!/Stats/Stats_history) Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available. ##### Swagger Specification [⇩ Download Swagger JSON](swagger.json) - ## All API Endpoints Click to expand a section. * * OpenAPI spec version: 1.2.0 * Contact: support@bitmex.com * Generated by: https://github.com/swagger-api/swagger-codegen.git * Swagger Codegen version: 2.4.11-SNAPSHOT */ /** * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen * Please update the test case below to test the endpoint. */ namespace Swagger\Client; use \Swagger\Client\Configuration; use \Swagger\Client\ApiException; use \Swagger\Client\ObjectSerializer; /** * UserEventApiTest Class Doc Comment * * @category Class * @package Swagger\Client * @author Swagger Codegen team * @link https://github.com/swagger-api/swagger-codegen */ class UserEventApiTest extends \PHPUnit_Framework_TestCase { /** * Setup before running any test cases */ public static function setUpBeforeClass() { } /** * Setup before running each test case */ public function setUp() { } /** * Clean up after running each test case */ public function tearDown() { } /** * Clean up after running all test cases */ public static function tearDownAfterClass() { } /** * Test case for userEventGet * * Get your user events. * */ public function testUserEventGet() { } }
{ "pile_set_name": "Github" }
#ifndef __WON_ROUTINGGROUPNAMECHANGEDOP_H__ #define __WON_ROUTINGGROUPNAMECHANGEDOP_H__ #include "WONShared.h" #include "RoutingOp.h" #include <string> namespace WONAPI { /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// class RoutingGroupNameChangedOp : public RoutingOp { private: unsigned short mGroupId; std::wstring mNewGroupName; virtual WONStatus HandleReply(unsigned char theMsgType, ReadBuffer &theMsg); public: RoutingGroupNameChangedOp(RoutingConnection *theConnection) : RoutingOp(theConnection) {} unsigned short GetGroupId() const { return mGroupId; } const std::wstring& GetNewGroupName() const { return mNewGroupName; } virtual RoutingOpType GetType() const { return RoutingOp_GroupNameChanged; } }; typedef SmartPtr<RoutingGroupNameChangedOp> RoutingGroupNameChangedOpPtr; }; // namespace WONAPI #endif
{ "pile_set_name": "Github" }
// // PersonCard.swift // // Generated by swagger-codegen // https://github.com/swagger-api/swagger-codegen // import Foundation /** This is an card object for a Person derived from BaseCard. */ public struct PersonCard: Codable { public var cardType: String public var firstName: String? public var lastName: String? public init(cardType: String, firstName: String?, lastName: String?) { self.cardType = cardType self.firstName = firstName self.lastName = lastName } }
{ "pile_set_name": "Github" }
/* This code demonstrates how to use the SPI master half duplex mode to read/write a AT932C46D EEPROM (8-bit mode). This example code is in the Public Domain (or CC0 licensed, at your option.) Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ #pragma once #include "driver/spi_master.h" #include "driver/gpio.h" #include "sdkconfig.h" /// Configurations of the spi_eeprom typedef struct { spi_host_device_t host; ///< The SPI host used, set before calling `spi_eeprom_init()` gpio_num_t cs_io; ///< CS gpio number, set before calling `spi_eeprom_init()` gpio_num_t miso_io; ///< MISO gpio number, set before calling `spi_eeprom_init()` bool intr_used; ///< Whether to use polling or interrupt when waiting for write to be done. Set before calling `spi_eeprom_init()`. } eeprom_config_t; typedef struct eeprom_context_t* eeprom_handle_t; /** * @brief Initialize the hardware. * * @param config Configuration of the EEPROM * @param out_handle Output context of EEPROM communication. * @return * - ESP_OK: on success * - ESP_ERR_INVALID_ARG: If the configuration in the context is incorrect. * - ESP_ERR_NO_MEM: if semaphore create failed. * - or other return value from `spi_bus_add_device()` or `gpio_isr_handler_add()`. */ esp_err_t spi_eeprom_init(const eeprom_config_t *config, eeprom_handle_t* out_handle); /** * @brief Release the resources used by the EEPROM. * * @param handle Context of EEPROM communication. * @return Always ESP_OK */ esp_err_t spi_eeprom_deinit(eeprom_handle_t handle); /** * @brief Read a byte from the EEPROM. * * @param handle Context of EEPROM communication. * @param addr Address to read. * @param out_data Buffer to output the read data. * @return return value from `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_read(eeprom_handle_t handle, uint8_t addr, uint8_t* out_data); /** * @brief Erase a byte in the EEPROM. * * @param handle Context of EEPROM communication. * @param addr Address to erase. * @return * - ESP_OK: on success * - ESP_ERR_TIMEOUT: if the EEPROM is not able to be ready before the time in the spec. This may mean that the connection is not correct. * - or return value from `spi_device_acquire_bus()` `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_erase(eeprom_handle_t handle, uint8_t addr); /** * @brief Write a byte into the EEPROM * * @param handle Context of EEPROM communication. * @param addr Address to write. * @param data The byte to write. * @return * - ESP_OK: on success * - ESP_ERR_TIMEOUT: if the EEPROM is not able to be ready before the time in the spec. This may mean that the connection is not correct. * - or return value from `spi_device_acquire_bus()` `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_write(eeprom_handle_t handle, uint8_t addr, uint8_t data); /** * @brief Enable following write/erase to the EEPROM. * * @param handle Context of EEPROM communication. * @return return value from `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_write_enable(eeprom_handle_t handle); /** * @brief Disable following write/erase to the EEPROM. * * @param handle Context of EEPROM communication. * @return return value from `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_write_disable(eeprom_handle_t handle); #if CONFIG_EXAMPLE_5V_COMMANDS /** * @brief Erase all the memory in the EEPROM. * * @note This is only supported when EEPROM VCC is 5V. * @param handle Context of EEPROM communication. * @return * - ESP_OK: on success * - ESP_ERR_TIMEOUT: if the EEPROM is not able to be ready before the time in the spec. This may mean that the connection is not correct. * - or return value from `spi_device_acquire_bus()` `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_erase_all(eeprom_handle_t handle); /** * @brief write all the memory in the EEPROM to the value given. * * @note This is only supported when EEPROM VCC is 5V. * @param handle Context of EEPROM communication. * @return * - ESP_OK: on success * - ESP_ERR_TIMEOUT: if the EEPROM is not able to be ready before the time in the spec. This may mean that the connection is not correct. * - or return value from `spi_device_acquire_bus()` `spi_device_polling_transmit()`. */ esp_err_t spi_eeprom_write_all(eeprom_handle_t handle, uint8_t data); #endif //CONFIG_EXAMPLE_5V_COMMANDS
{ "pile_set_name": "Github" }
# probabilistic_robotics I am working on detailed solutions of exercises of the book "probabilistic robotics". This is a work in progress, any helpful feedback is welcomed. I also deployed the fastslam nodejs/c++ app on google cloud [here](http://35.242.140.13:8080) (server running from 0000 to 0800 UTC). ![alt text](https://github.com/pptacher/probabilistic_robotics/blob/master/ch12_the_sparse_extended_information_filter/seif.jpg) ***SEIF** algorithm running on Victoria Park dataset* ## references - *Probabilistic robotics*, *MIT press*, Sebastian Thrun, Wolfram Burgard and Dieter Fox, [Probabilistic Robotics](https://mitpress.mit.edu/books/probabilistic-robotics) - *Victoria Park dataset*, The University of Sidney, Eduardo Nebot, [Victoria Park dataset](http://www-personal.acfr.usyd.edu.au/nebot/victoria_park.htm)
{ "pile_set_name": "Github" }
#ifndef HOOKS_H #define HOOKS_H #include <stdint.h> enum __parsec_benchmark { __parsec_blackscholes, }; uint64_t start, stop, res; inline double ticks_to_sec(uint64_t ticks); inline uint64_t rdtsc(void); inline void __parsec_bench_begin(enum __parsec_benchmark __bench) {}; inline void __parsec_bench_end() {}; inline void __parsec_roi_begin() { start = rdtsc(); } inline void __parsec_roi_end() { stop = rdtsc(); printf("Time spent in ROI: %f\n", ticks_to_sec(stop - start)); } #define CPU_FREQ_MHZ 3500 inline uint64_t rdtsc(void) { uint32_t lo, hi; asm volatile ("rdtsc" : "=a"(lo), "=d"(hi) :: "memory"); return ((uint64_t)hi << 32ULL | (uint64_t)lo); } inline double ticks_to_sec(uint64_t ticks) { return (double)ticks * (1.0/((double)CPU_FREQ_MHZ*1000000.0)); } #endif /* HOOKS_H */
{ "pile_set_name": "Github" }
from django.urls import reverse from wakawaka.tests.base import BaseTestCase class RevisionsTestCase(BaseTestCase): """ The Revisions view displays the list of revisions of a given page. """ def test_revisions(self): """ Calling the revisions view without a slug, displays all revisions of all pages. """ # Create a couple of Wiki pages self.create_wikipage('WikiIndex', 'First Content', 'Second Content') self.create_wikipage('CarrotCake', 'Carrot Content') response = self.client.get(reverse('wakawaka_revision_list')) self.assertContains(response, 'Created via API: First Content') self.assertContains(response, 'Created via API: Second Content') self.assertContains(response, 'Created via API: Carrot Content') def test_revisions_for_slug(self): """ Calling the Revisions View with a slug will only display the revisions of this page. """ # Create a couple of Wiki pages self.create_wikipage('WikiIndex', 'First Content', 'Second Content') self.create_wikipage('CarrotCake', 'Carrot Content') response = self.client.get( reverse('wakawaka_revision_list', kwargs={'slug': 'WikiIndex'}) ) self.assertContains(response, 'Created via API: First Content') self.assertContains(response, 'Created via API: Second Content') self.assertNotContains(response, 'Created via API: Carrot Content')
{ "pile_set_name": "Github" }
from celery.utils import uuid from celery.events import Event from html.parser import HTMLParser import xml.etree.ElementTree as ET class HtmlTableParser(HTMLParser): def __init__(self, *args, **kwargs): HTMLParser.__init__(self, *args, **kwargs) self.table = '' self.inTable = False def handle_starttag(self, tag, attrs): if tag == 'table': self.inTable = True if self.inTable: self.table += '<%s' % tag for attr in attrs: self.table += ' %s="%s"' % attr self.table += '>' def handle_endtag(self, tag): if self.inTable: self.table += '</%s>' % tag if tag == 'table': self.inTable = False def handle_data(self, data): if self.inTable: self.table += data def parse(self, source): self.feed(source) def query(self, pattern): root = ET.fromstring(self.table) return root.findall(pattern) def rows(self): return self.query('tbody/tr') def get_row(self, row_id): rows = self.query('tbody/tr') for r in rows: if r.attrib.get('id') == row_id: cells = r.findall('td') return list(map(lambda x: getattr(x, 'text'), cells)) def task_succeeded_events(worker, id=None, name=None, runtime=0.1234, retries=0): id = id or uuid() name = name or 'sometask' return [Event('task-received', uuid=id, name=name, args='(2, 2)', kwargs="{'foo': 'bar'}", retries=retries, eta=None, hostname=worker), Event('task-started', uuid=id, hostname=worker), Event('task-succeeded', uuid=id, result='4', runtime=runtime, hostname=worker)] def task_failed_events(worker, id=None, name=None): id = id or uuid() name = name or 'sometask' return [Event('task-received', uuid=id, name=name, args='(2, 2)', kwargs="{'foo': 'bar'}", retries=0, eta=None, hostname=worker), Event('task-started', uuid=id, hostname=worker), Event('task-failed', uuid=id, exception="KeyError('foo')", traceback='line 1 at main', hostname=worker)]
{ "pile_set_name": "Github" }
// Copyright 2010 Chris Patterson // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software distributed // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, either express or implied. See the License for the // specific language governing permissions and limitations under the License. namespace Stact.Internal { using System; using Magnum.Caching; /// <summary> /// Keeps track of a keyed fiber collection /// </summary> /// <typeparam name="TKey"></typeparam> public class KeyedFiberProvider<TKey> : FiberProvider<TKey> { readonly Cache<TKey, Fiber> _cache; readonly TimeSpan _timeout; public KeyedFiberProvider(FiberFactory missingFiberFactory, TimeSpan timeout) { _timeout = timeout; _cache = new ConcurrentCache<TKey, Fiber>(k => missingFiberFactory()); } public Fiber GetFiber(TKey key) { return _cache[key]; } public void Dispose() { _cache.Each(x => x.Shutdown(_timeout)); } } }
{ "pile_set_name": "Github" }
# Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # 0x00 (module # 0x08 [type] # (type $type0 (func (param i32 i32) (result i32))) # 0x11 [function] # 0x15 (export "mul" (func $func0)) # 0x1e [code] # 0x20 (func $func0 (param $var0 i32) (param $var1 i32) (result i32) # 0x23 get_local $var0 # 0x25 get_local $var1 # 0x27 i32.mul # ) # ) # 0x29 [name] BREAK_ADDRESS_0 = 0x0023 BREAK_ADDRESS_1 = 0x0025 BREAK_ADDRESS_2 = 0x0027 ARG_0 = 21 ARG_1 = 2
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="9,00" Name="libogg_static" ProjectGUID="{15CBFEFF-7965-41F5-B4E2-21E8795C9159}" RootNamespace="libogg" Keyword="Win32Proj" TargetFrameworkVersion="0" > <Platforms> <Platform Name="Win32" /> <Platform Name="x64" /> <Platform Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)" /> <Platform Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)" /> <Platform Name="Windows Mobile 6 Professional SDK (ARMV4I)" /> </Platforms> <ToolFiles> </ToolFiles> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" CallingConvention="0" CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Debug|x64" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="3" CallingConvention="0" CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" MinimalRebuild="true" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> <Configuration Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" MinimalRebuild="true" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" /> <Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_BIND_TO_CURRENT_CRT_VERSION;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS" StringPooling="true" ExceptionHandling="0" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="0" CallingConvention="0" CompileAs="1" DisableSpecificWarnings="4244" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|x64" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_BIND_TO_CURRENT_CRT_VERSION;WIN32;NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS" StringPooling="true" ExceptionHandling="0" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" WarningLevel="4" Detect64BitPortabilityProblems="true" DebugInformationFormat="0" CallingConvention="0" CompileAs="1" DisableSpecificWarnings="4244" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCPostBuildEventTool" /> </Configuration> <Configuration Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="2" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" StringPooling="true" ExceptionHandling="0" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" DisableSpecificWarnings="4244" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> <Configuration Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="2" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" StringPooling="true" ExceptionHandling="0" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" DisableSpecificWarnings="4244" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCFxCopTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> <Configuration Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="0" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="_DEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" MinimalRebuild="true" RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" CallingConvention="0" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> <Configuration Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="4" CharacterSet="1" WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" /> <Tool Name="VCCustomBuildTool" /> <Tool Name="VCXMLDataGeneratorTool" /> <Tool Name="VCWebServiceProxyGeneratorTool" /> <Tool Name="VCMIDLTool" TargetEnvironment="1" /> <Tool Name="VCCLCompilerTool" ExecutionBucket="7" Optimization="2" InlineFunctionExpansion="2" EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" AdditionalIncludeDirectories="..\..\include" PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;LIBOGG_EXPORTS;_WIN32_WCE=$(CEVER);UNDER_CE;WINCE;$(ARCHFAM);$(_ARCHFAM_)" StringPooling="true" ExceptionHandling="0" RuntimeLibrary="2" BufferSecurityCheck="false" UsePrecompiledHeader="0" WarningLevel="4" DebugInformationFormat="3" CompileAs="1" DisableSpecificWarnings="4244" CallingConvention="0" /> <Tool Name="VCManagedResourceCompilerTool" /> <Tool Name="VCResourceCompilerTool" /> <Tool Name="VCPreLinkEventTool" /> <Tool Name="VCLibrarianTool" AdditionalOptions="" /> <Tool Name="VCALinkTool" /> <Tool Name="VCXDCMakeTool" /> <Tool Name="VCBscMakeTool" /> <Tool Name="VCCodeSignTool" /> <Tool Name="VCPostBuildEventTool" /> <DeploymentTool ForceDirty="-1" RemoteDirectory="" RegisterOutput="0" AdditionalFiles="" /> <DebuggerTool /> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File RelativePath="..\..\src\bitwise.c" > </File> <File RelativePath="..\..\src\framing.c" > </File> <File RelativePath="..\ogg.def" > </File> </Filter> <Filter Name="Header Files" Filter="h;hpp;hxx;hm;inl;inc;xsd" UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File RelativePath="..\..\include\ogg\ogg.h" > </File> <File RelativePath="..\..\include\ogg\os_types.h" > </File> </Filter> <Filter Name="Resource Files" Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" > </Filter> </Files> <Globals> </Globals> </VisualStudioProject>
{ "pile_set_name": "Github" }
// Generated by CoffeeScript 1.9.1 (function() { var XMLComment, XMLNode, create, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty; create = require('lodash/create'); XMLNode = require('./XMLNode'); module.exports = XMLComment = (function(superClass) { extend(XMLComment, superClass); function XMLComment(parent, text) { XMLComment.__super__.constructor.call(this, parent); if (text == null) { throw new Error("Missing comment text"); } this.text = this.stringify.comment(text); } XMLComment.prototype.clone = function() { return create(XMLComment.prototype, this); }; XMLComment.prototype.toString = function(options, level) { var indent, newline, offset, pretty, r, ref, ref1, ref2, space; pretty = (options != null ? options.pretty : void 0) || false; indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' '; offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0; newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n'; level || (level = 0); space = new Array(level + offset + 1).join(indent); r = ''; if (pretty) { r += space; } r += '<!-- ' + this.text + ' -->'; if (pretty) { r += newline; } return r; }; return XMLComment; })(XMLNode); }).call(this);
{ "pile_set_name": "Github" }
<testcase> <info> <keywords> TELNET UPLOAD </keywords> </info> # # Server-side <reply> </reply> # # Client-side <client> <server> http </server> <features> telnet </features> <name> TELNET check of upload with stdout redirected </name> <stdin> GET /ignore/for/1327 HTTP/1.0 </stdin> <file name="log/1327.txt"> GET /we/want/1327 HTTP/1.0 </file> <command option="no-output"> telnet://%HOSTIP:%HTTPPORT -T log/1327.txt </command> </client> # # Verify data after the test has been "shot" <verify> <protocol> GET /we/want/1327 HTTP/1.0 </protocol> </verify> </testcase>
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Written by Eclipse BIRT 2.0 --> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.20"> <page-setup> <graphic-master-page name="My Page"> <contents> <data/> </contents> </graphic-master-page> </page-setup> <data-sources> <script-data-source name="myDataSource"/> </data-sources> <data-sets> <script-data-set name="firstDataSet"> <property name="dataSource">myDataSource</property> </script-data-set> <script-data-set name="secondDataSet"> <property name="dataSource">myDataSource</property> </script-data-set> </data-sets> <cubes> <tabular-cube name="testCube"> <property name="dataSet">firstDataSet</property> <property name="defaultMeasureGroup">testMeasureGroup</property> <property name="autoKey">true</property> <expression name="ACLExpression" type="javascript">ACL expression</expression> <list-property name="filter"> <structure> <property name="operator">lt</property> <expression name="expr">filter expression</expression> <expression name="value1">value1 expression</expression> <expression name="value2">value2 expression</expression> </structure> </list-property> <list-property name="dimensionConditions"> <structure> <property name="hierarchy">testHierarchy</property> <list-property name="joinConditions"> <structure> <property name="cubeKey">cubeKey</property> <property name="hierarchyKey">key</property> <property name="level">testDimension/testLevel</property> </structure> <structure> <property name="cubeKey">cubeKey2</property> <property name="hierarchyKey">key2</property> </structure> <structure> <property name="cubeKey">cubeKey4</property> <property name="hierarchyKey">key4</property> </structure> </list-property> </structure> <structure> <property name="hierarchy">nonExistingHierarchy</property> <list-property name="joinConditions"> <structure> <property name="cubeKey">cubeKey</property> <property name="hierarchyKey">key</property> </structure> </list-property> </structure> </list-property> <property name="dimensions"> <tabular-dimension name="testDimension"> <property name="isTimeType">true</property> <property name="defaultHierarchy">testHierarchy</property> <expression name="ACLExpression" type="javascript">ACL expression</expression> <property name="hierarchies"> <tabular-hierarchy name="testHierarchy"> <property name="dataSet">secondDataSet</property> <list-property name="filter"> <structure> <property name="operator">lt</property> <expression name="expr">filter expression</expression> <expression name="value1">value1 expression</expression> <expression name="value2">value2 expression</expression> </structure> </list-property> <simple-property-list name="primaryKeys"> <value>key</value> <value>key2</value> <value>key4</value> </simple-property-list> <property name="levels"> <tabular-level name="testLevel"> <property name="columnName">column1</property> <property name="displayColumnName">displayColumnName</property> <property name="dataType">integer</property> <property name="dateTimeLevelType">month</property> <property name="dateTimeFormat">mmm</property> <property name="interval">prefix</property> <property name="intervalRange">3.0</property> <property name="intervalBase">Jan</property> <property name="levelType">dynamic</property> <expression name="ACLExpression" type="javascript">ACL expression</expression> <expression name="memberACLExpression" type="javascript">member ACL expression</expression> <property name="alignment">justify</property> <list-property name="staticValues"> <structure> <property name="ruleExpre">rule expression</property> <property name="displayExpre">display expression</property> </structure> <structure> <property name="ruleExpre">rule expression2</property> <property name="displayExpre">display expression2</property> </structure> </list-property> <list-property name="attributes"> <structure> <property name="name">var1</property> <property name="dataType">string</property> </structure> <structure> <property name="name">var2</property> <property name="dataType">integer</property> </structure> </list-property> <structure name="action"> <expression name="uri">http://localhost:8080/bluehero</expression> </structure> <structure name="format"> <property name="category">testLevelFormatCategory</property> <property name="pattern">testLevelFormatPattern</property> <property name="locale">aa</property> </structure> </tabular-level> </property> </tabular-hierarchy> </property> </tabular-dimension> </property> <property name="measureGroups"> <tabular-measure-group name="testMeasureGroup"> <property name="measures"> <tabular-measure name="testMeasure"> <property name="function">min</property> <property name="measureExpression">column</property> <property name="isCalculated">false</property> <property name="dataType">string</property> <expression name="ACLExpression" type="javascript">ACL expression</expression> <property name="alignment">justify</property> <property name="isVisible">false</property> <structure name="action"> <expression name="uri">http://localhost:8080/bluehero</expression> </structure> <structure name="format"> <property name="category">testMeasureFormatCategory</property> <property name="pattern">testMeasureFormatPattern</property> </structure> </tabular-measure> </property> </tabular-measure-group> </property> </tabular-cube> </cubes> </report>
{ "pile_set_name": "Github" }
package cvm import ( "context" "fmt" "github.com/hashicorp/packer/helper/multistep" vpc "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc/v20170312" ) type stepConfigVPC struct { VpcId string CidrBlock string VpcName string isCreate bool } func (s *stepConfigVPC) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction { vpcClient := state.Get("vpc_client").(*vpc.Client) if len(s.VpcId) != 0 { Say(state, s.VpcId, "Trying to use existing vpc") req := vpc.NewDescribeVpcsRequest() req.VpcIds = []*string{&s.VpcId} var resp *vpc.DescribeVpcsResponse err := Retry(ctx, func(ctx context.Context) error { var e error resp, e = vpcClient.DescribeVpcs(req) return e }) if err != nil { return Halt(state, err, "Failed to get vpc info") } if *resp.Response.TotalCount > 0 { s.isCreate = false state.Put("vpc_id", *resp.Response.VpcSet[0].VpcId) Message(state, *resp.Response.VpcSet[0].VpcName, "Vpc found") return multistep.ActionContinue } return Halt(state, fmt.Errorf("The specified vpc(%s) does not exist", s.VpcId), "") } Say(state, "Trying to create a new vpc", "") req := vpc.NewCreateVpcRequest() req.VpcName = &s.VpcName req.CidrBlock = &s.CidrBlock var resp *vpc.CreateVpcResponse err := Retry(ctx, func(ctx context.Context) error { var e error resp, e = vpcClient.CreateVpc(req) return e }) if err != nil { return Halt(state, err, "Failed to create vpc") } s.isCreate = true s.VpcId = *resp.Response.Vpc.VpcId state.Put("vpc_id", s.VpcId) Message(state, s.VpcId, "Vpc created") return multistep.ActionContinue } func (s *stepConfigVPC) Cleanup(state multistep.StateBag) { if !s.isCreate { return } ctx := context.TODO() vpcClient := state.Get("vpc_client").(*vpc.Client) SayClean(state, "vpc") req := vpc.NewDeleteVpcRequest() req.VpcId = &s.VpcId err := Retry(ctx, func(ctx context.Context) error { _, e := vpcClient.DeleteVpc(req) return e }) if err != nil { Error(state, err, fmt.Sprintf("Failed to delete vpc(%s), please delete it manually", s.VpcId)) } }
{ "pile_set_name": "Github" }
#include <ctype.h> #include <locale.h> #include <stdio.h> #include <stdlib.h> static int do_test (locale_t l); int main (void) { locale_t l; locale_t l2; int result; l = newlocale (1 << LC_ALL, "de_DE.ISO-8859-1", NULL); if (l == NULL) { printf ("newlocale failed: %m\n"); exit (EXIT_FAILURE); } puts ("Running tests of created locale"); result = do_test (l); l2 = duplocale (l); if (l2 == NULL) { printf ("duplocale failed: %m\n"); exit (EXIT_FAILURE); } freelocale (l); puts ("Running tests of duplicated locale"); result |= do_test (l2); return result; } static const char str[] = "0123456789abcdef ABCDEF ghijklmnopqrstuvwxyzäÄöÖüÜ"; static const char exd[] = "11111111110000000000000000000000000000000000000000"; static const char exa[] = "00000000001111110111111011111111111111111111111111"; static const char exx[] = "11111111111111110111111000000000000000000000000000"; static int do_test (locale_t l) { int result = 0; size_t n; #define DO_TEST(TEST, RES) \ for (n = 0; n < sizeof (str) - 1; ++n) \ if ('0' + (TEST (str[n], l) != 0) != RES[n]) \ { \ printf ("%s(%c) failed\n", #TEST, str[n]); \ result = 1; \ } DO_TEST (isdigit_l, exd); DO_TEST (isalpha_l, exa); DO_TEST (isxdigit_l, exx); return result; }
{ "pile_set_name": "Github" }
#ifndef __CURL_CURLRULES_H #define __CURL_CURLRULES_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://curl.haxx.se/docs/copyright.html. * * You may opt to use, copy, modify, merge, publish, distribute and/or sell * copies of the Software, and permit persons to whom the Software is * furnished to do so, under the terms of the COPYING file. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ***************************************************************************/ /* ================================================================ */ /* COMPILE TIME SANITY CHECKS */ /* ================================================================ */ /* * NOTE 1: * ------- * * All checks done in this file are intentionally placed in a public * header file which is pulled by curl/curl.h when an application is * being built using an already built libcurl library. Additionally * this file is also included and used when building the library. * * If compilation fails on this file it is certainly sure that the * problem is elsewhere. It could be a problem in the curlbuild.h * header file, or simply that you are using different compilation * settings than those used to build the library. * * Nothing in this file is intended to be modified or adjusted by the * curl library user nor by the curl library builder. * * Do not deactivate any check, these are done to make sure that the * library is properly built and used. * * You can find further help on the libcurl development mailing list: * http://cool.haxx.se/mailman/listinfo/curl-library/ * * NOTE 2 * ------ * * Some of the following compile time checks are based on the fact * that the dimension of a constant array can not be a negative one. * In this way if the compile time verification fails, the compilation * will fail issuing an error. The error description wording is compiler * dependent but it will be quite similar to one of the following: * * "negative subscript or subscript is too large" * "array must have at least one element" * "-1 is an illegal array size" * "size of array is negative" * * If you are building an application which tries to use an already * built libcurl library and you are getting this kind of errors on * this file, it is a clear indication that there is a mismatch between * how the library was built and how you are trying to use it for your * application. Your already compiled or binary library provider is the * only one who can give you the details you need to properly use it. */ /* * Verify that some macros are actually defined. */ #ifndef CURL_SIZEOF_LONG # error "CURL_SIZEOF_LONG definition is missing!" Error Compilation_aborted_CURL_SIZEOF_LONG_is_missing #endif #ifndef CURL_TYPEOF_CURL_SOCKLEN_T # error "CURL_TYPEOF_CURL_SOCKLEN_T definition is missing!" Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_is_missing #endif #ifndef CURL_SIZEOF_CURL_SOCKLEN_T # error "CURL_SIZEOF_CURL_SOCKLEN_T definition is missing!" Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_is_missing #endif #ifndef CURL_TYPEOF_CURL_OFF_T # error "CURL_TYPEOF_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_is_missing #endif #ifndef CURL_FORMAT_CURL_OFF_T # error "CURL_FORMAT_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_T_is_missing #endif #ifndef CURL_FORMAT_CURL_OFF_TU # error "CURL_FORMAT_CURL_OFF_TU definition is missing!" Error Compilation_aborted_CURL_FORMAT_CURL_OFF_TU_is_missing #endif #ifndef CURL_FORMAT_OFF_T # error "CURL_FORMAT_OFF_T definition is missing!" Error Compilation_aborted_CURL_FORMAT_OFF_T_is_missing #endif #ifndef CURL_SIZEOF_CURL_OFF_T # error "CURL_SIZEOF_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_SIZEOF_CURL_OFF_T_is_missing #endif #ifndef CURL_SUFFIX_CURL_OFF_T # error "CURL_SUFFIX_CURL_OFF_T definition is missing!" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_T_is_missing #endif #ifndef CURL_SUFFIX_CURL_OFF_TU # error "CURL_SUFFIX_CURL_OFF_TU definition is missing!" Error Compilation_aborted_CURL_SUFFIX_CURL_OFF_TU_is_missing #endif /* * Macros private to this header file. */ #define CurlchkszEQ(t, s) sizeof(t) == s ? 1 : -1 #define CurlchkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 /* * Verify that the size previously defined and expected for long * is the same as the one reported by sizeof() at compile time. */ typedef char __curl_rule_01__ [CurlchkszEQ(long, CURL_SIZEOF_LONG)]; /* * Verify that the size previously defined and expected for * curl_off_t is actually the the same as the one reported * by sizeof() at compile time. */ typedef char __curl_rule_02__ [CurlchkszEQ(curl_off_t, CURL_SIZEOF_CURL_OFF_T)]; /* * Verify at compile time that the size of curl_off_t as reported * by sizeof() is greater or equal than the one reported for long * for the current compilation. */ typedef char __curl_rule_03__ [CurlchkszGE(curl_off_t, long)]; /* * Verify that the size previously defined and expected for * curl_socklen_t is actually the the same as the one reported * by sizeof() at compile time. */ typedef char __curl_rule_04__ [CurlchkszEQ(curl_socklen_t, CURL_SIZEOF_CURL_SOCKLEN_T)]; /* * Verify at compile time that the size of curl_socklen_t as reported * by sizeof() is greater or equal than the one reported for int for * the current compilation. */ typedef char __curl_rule_05__ [CurlchkszGE(curl_socklen_t, int)]; /* ================================================================ */ /* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */ /* ================================================================ */ /* * CURL_ISOCPP and CURL_OFF_T_C definitions are done here in order to allow * these to be visible and exported by the external libcurl interface API, * while also making them visible to the library internals, simply including * curl_setup.h, without actually needing to include curl.h internally. * If some day this section would grow big enough, all this should be moved * to its own header file. */ /* * Figure out if we can use the ## preprocessor operator, which is supported * by ISO/ANSI C and C++. Some compilers support it without setting __STDC__ * or __cplusplus so we need to carefully check for them too. */ #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \ defined(__HP_aCC) || defined(__BORLANDC__) || defined(__LCC__) || \ defined(__POCC__) || defined(__SALFORDC__) || defined(__HIGHC__) || \ defined(__ILEC400__) /* This compiler is believed to have an ISO compatible preprocessor */ #define CURL_ISOCPP #else /* This compiler is believed NOT to have an ISO compatible preprocessor */ #undef CURL_ISOCPP #endif /* * Macros for minimum-width signed and unsigned curl_off_t integer constants. */ #if defined(__BORLANDC__) && (__BORLANDC__ == 0x0551) # define __CURL_OFF_T_C_HLPR2(x) x # define __CURL_OFF_T_C_HLPR1(x) __CURL_OFF_T_C_HLPR2(x) # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_T) # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val) ## \ __CURL_OFF_T_C_HLPR1(CURL_SUFFIX_CURL_OFF_TU) #else # ifdef CURL_ISOCPP # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val ## Suffix # else # define __CURL_OFF_T_C_HLPR2(Val,Suffix) Val/**/Suffix # endif # define __CURL_OFF_T_C_HLPR1(Val,Suffix) __CURL_OFF_T_C_HLPR2(Val,Suffix) # define CURL_OFF_T_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_T) # define CURL_OFF_TU_C(Val) __CURL_OFF_T_C_HLPR1(Val,CURL_SUFFIX_CURL_OFF_TU) #endif /* * Get rid of macros private to this header file. */ #undef CurlchkszEQ #undef CurlchkszGE /* * Get rid of macros not intended to exist beyond this point. */ #undef CURL_PULL_WS2TCPIP_H #undef CURL_PULL_SYS_TYPES_H #undef CURL_PULL_SYS_SOCKET_H #undef CURL_PULL_SYS_POLL_H #undef CURL_PULL_STDINT_H #undef CURL_PULL_INTTYPES_H #undef CURL_TYPEOF_CURL_SOCKLEN_T #undef CURL_TYPEOF_CURL_OFF_T #ifdef CURL_NO_OLDIES #undef CURL_FORMAT_OFF_T /* not required since 7.19.0 - obsoleted in 7.20.0 */ #endif #endif /* __CURL_CURLRULES_H */
{ "pile_set_name": "Github" }
--- title: 把时间当作朋友 date: '2011-03-13' slug: let-time-be-a-friend --- 现在是夜里1点半了,显然我没把时间当朋友,尽管我刚花了五个小时读了《把时间当作朋友》。这本书写得比较踏实,是我还比较喜欢看的,因为感觉有不少真实经历在里面。不过我看完第一遍的感受是,这本书的别名可以是《如何作自我反省》,因为它谈的并不全是管理时间,而是自己扯下自己的面具,或用反省的方式让自己的劣性没有藏身之处,或学习控制自己。本小子一定程度上有同感,这也是本小子需要修炼的。
{ "pile_set_name": "Github" }
/// <reference path="../bower_components/jquery/dist/jquery.js" /> /* jquery-resizable Version 0.27 - 1/10/2018 © 2015-2017 Rick Strahl, West Wind Technologies www.west-wind.com Licensed under MIT License */ (function(factory, undefined) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof module === 'object' && typeof module.exports === 'object') { // CommonJS module.exports = factory(require('jquery')); } else { // Global jQuery factory(jQuery); } }(function($, undefined) { if ($.fn.myresizable) return; $.fn.myresizable = function fnResizable(options) { var defaultOptions = { // selector for handle that starts dragging handleSelector: null, // resize the width resizeWidth: true, // resize the height resizeHeight: true, // the side that the width resizing is relative to resizeWidthFrom: 'right', // the side that the height resizing is relative to resizeHeightFrom: 'bottom', // hook into start drag operation (event passed) onDragStart: null, // hook into stop drag operation (event passed) onDragEnd: null, // hook into each drag operation (event passed) onDrag: null, // disable touch-action on $handle // prevents browser level actions like forward back gestures touchActionNone: true, // instance id instanceId: null }; if (typeof options == "object") defaultOptions = $.extend(defaultOptions, options); return this.each(function () { var opt = $.extend({}, defaultOptions); if (!opt.instanceId) opt.instanceId = "rsz_" + new Date().getTime(); var startPos, startTransition; // get the element to resize var $el = $(this); var $handle; if (options === 'destroy') { opt = $el.data('resizable'); if (!opt) return; $handle = getHandle(opt.handleSelector, $el); $handle.off("mousedown." + opt.instanceId + " touchstart." + opt.instanceId); if (opt.touchActionNone) $handle.css("touch-action", ""); $el.removeClass("resizable"); return; } $el.data('resizable', opt); // get the drag handle $handle = getHandle(opt.handleSelector, $el); if (opt.touchActionNone) $handle.css("touch-action", "none"); $el.addClass("resizable"); $handle.on("mousedown." + opt.instanceId + " touchstart." + opt.instanceId, startDragging); function noop(e) { e.stopPropagation(); e.preventDefault(); }; function startDragging(e) { // Prevent dragging a ghost image in HTML5 / Firefox and maybe others if ( e.preventDefault ) { e.preventDefault(); } startPos = getMousePos(e); startPos.width = parseInt($el.width(), 10); startPos.height = parseInt($el.height(), 10); startTransition = $el.css("transition"); $el.css("transition", "none"); if (opt.onDragStart) { if (opt.onDragStart(e, $el, opt) === false) return; } $(document).on('mousemove.' + opt.instanceId, doDrag); $(document).on('mouseup.' + opt.instanceId, stopDragging); if (window.Touch || navigator.maxTouchPoints) { $(document).on('touchmove.' + opt.instanceId, doDrag); $(document).on('touchend.' + opt.instanceId, stopDragging); } $(document).on('selectstart.' + opt.instanceId, noop); // disable selection } function doDrag(e) { var pos = getMousePos(e), newWidth, newHeight; if (opt.resizeWidthFrom === 'left') newWidth = startPos.width - pos.x + startPos.x; else newWidth = startPos.width + pos.x - startPos.x; if (opt.resizeHeightFrom === 'top') newHeight = startPos.height - pos.y + startPos.y; else newHeight = startPos.height + pos.y - startPos.y; if (!opt.onDrag || opt.onDrag(e, $el, newWidth, newHeight, opt) !== false) { if (opt.resizeHeight) $el.height(newHeight); if (opt.resizeWidth) $el.width(newWidth); } } function stopDragging(e) { e.stopPropagation(); e.preventDefault(); $(document).off('mousemove.' + opt.instanceId); $(document).off('mouseup.' + opt.instanceId); if (window.Touch || navigator.maxTouchPoints) { $(document).off('touchmove.' + opt.instanceId); $(document).off('touchend.' + opt.instanceId); } $(document).off('selectstart.' + opt.instanceId, noop); // reset changed values $el.css("transition", startTransition); if (opt.onDragEnd) opt.onDragEnd(e, $el, opt); return false; } function getMousePos(e) { var pos = { x: 0, y: 0, width: 0, height: 0 }; if (typeof e.clientX === "number") { pos.x = e.clientX; pos.y = e.clientY; } else if (e.originalEvent.touches) { pos.x = e.originalEvent.touches[0].clientX; pos.y = e.originalEvent.touches[0].clientY; } else return null; return pos; } function getHandle(selector, $el) { if (selector && selector.trim()[0] === ">") { selector = selector.trim().replace(/^>\s*/, ""); return $el.find(selector); } // Search for the selector, but only in the parent element to limit the scope // This works for multiple objects on a page (using .class syntax most likely) // as long as each has a separate parent container. return selector ? $el.parent().find(selector) : $el; } }); }; }));
{ "pile_set_name": "Github" }
rule j3f9_05a6e1ed1ee31132 { meta: copyright="Copyright (c) 2014-2018 Support Intelligence Inc, All Rights Reserved." engine="saphire/1.3.1 divinorum/0.998 icewater/0.4" viz_url="http://icewater.io/en/cluster/query?h64=j3f9.05a6e1ed1ee31132" cluster="j3f9.05a6e1ed1ee31132" cluster_size="4" filetype = "application/x-dosexec" tlp = "amber" version = "icewater snowflake" author = "Rick Wesson (@wessorh) rick@support-intelligence.com" date = "20171123" license = "RIL-1.0 [Rick's Internet License] " family="razy malicious malob" md5_hashes="['00da2ef7727c3209b2b9bc8df6cb1550','74c7d64762ab2283aa4d73780ea51ec6','7c9461cdf145dbfeea7f8fcbb325f14e']" strings: $hex_string = { b158045e09801868201523bf143c1251c4b048d2445e3101be9e24c0706c38404dec0e03bc6dfd03c422605cb40ea026619c680c40500058f07919d5064de4a1 } condition: filesize > 4096 and filesize < 16384 and $hex_string }
{ "pile_set_name": "Github" }
/** */ package net.opengis.gml311; import org.eclipse.emf.ecore.EObject; import org.w3.xlink.ActuateType; import org.w3.xlink.ShowType; import org.w3.xlink.TypeType; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Engineering CRS Ref Type</b></em>'. * <!-- end-user-doc --> * * <!-- begin-model-doc --> * Association to an engineering coordinate reference system, either referencing or containing the definition of that reference system. * <!-- end-model-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getEngineeringCRS <em>Engineering CRS</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getActuate <em>Actuate</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getArcrole <em>Arcrole</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getHref <em>Href</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getRemoteSchema <em>Remote Schema</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getRole <em>Role</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getShow <em>Show</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getTitle <em>Title</em>}</li> * <li>{@link net.opengis.gml311.EngineeringCRSRefType#getType <em>Type</em>}</li> * </ul> * * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType() * @model extendedMetaData="name='EngineeringCRSRefType' kind='elementOnly'" * @generated */ public interface EngineeringCRSRefType extends EObject { /** * Returns the value of the '<em><b>Engineering CRS</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Engineering CRS</em>' containment reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Engineering CRS</em>' containment reference. * @see #setEngineeringCRS(EngineeringCRSType) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_EngineeringCRS() * @model containment="true" * extendedMetaData="kind='element' name='EngineeringCRS' namespace='##targetNamespace'" * @generated */ EngineeringCRSType getEngineeringCRS(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getEngineeringCRS <em>Engineering CRS</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Engineering CRS</em>' containment reference. * @see #getEngineeringCRS() * @generated */ void setEngineeringCRS(EngineeringCRSType value); /** * Returns the value of the '<em><b>Actuate</b></em>' attribute. * The literals are from the enumeration {@link org.w3.xlink.ActuateType}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Actuate</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Actuate</em>' attribute. * @see org.w3.xlink.ActuateType * @see #isSetActuate() * @see #unsetActuate() * @see #setActuate(ActuateType) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Actuate() * @model unsettable="true" * extendedMetaData="kind='attribute' name='actuate' namespace='http://www.w3.org/1999/xlink'" * @generated */ ActuateType getActuate(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getActuate <em>Actuate</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Actuate</em>' attribute. * @see org.w3.xlink.ActuateType * @see #isSetActuate() * @see #unsetActuate() * @see #getActuate() * @generated */ void setActuate(ActuateType value); /** * Unsets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getActuate <em>Actuate</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetActuate() * @see #getActuate() * @see #setActuate(ActuateType) * @generated */ void unsetActuate(); /** * Returns whether the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getActuate <em>Actuate</em>}' attribute is set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return whether the value of the '<em>Actuate</em>' attribute is set. * @see #unsetActuate() * @see #getActuate() * @see #setActuate(ActuateType) * @generated */ boolean isSetActuate(); /** * Returns the value of the '<em><b>Arcrole</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Arcrole</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Arcrole</em>' attribute. * @see #setArcrole(String) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Arcrole() * @model dataType="org.w3.xlink.ArcroleType" * extendedMetaData="kind='attribute' name='arcrole' namespace='http://www.w3.org/1999/xlink'" * @generated */ String getArcrole(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getArcrole <em>Arcrole</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Arcrole</em>' attribute. * @see #getArcrole() * @generated */ void setArcrole(String value); /** * Returns the value of the '<em><b>Href</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Href</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Href</em>' attribute. * @see #setHref(String) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Href() * @model dataType="org.w3.xlink.HrefType" * extendedMetaData="kind='attribute' name='href' namespace='http://www.w3.org/1999/xlink'" * @generated */ String getHref(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getHref <em>Href</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Href</em>' attribute. * @see #getHref() * @generated */ void setHref(String value); /** * Returns the value of the '<em><b>Remote Schema</b></em>' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * Reference to an XML Schema fragment that specifies the content model of the propertys value. This is in conformance with the XML Schema Section 4.14 Referencing Schemas from Elsewhere. * <!-- end-model-doc --> * @return the value of the '<em>Remote Schema</em>' attribute. * @see #setRemoteSchema(String) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_RemoteSchema() * @model dataType="org.eclipse.emf.ecore.xml.type.AnyURI" * extendedMetaData="kind='attribute' name='remoteSchema' namespace='##targetNamespace'" * @generated */ String getRemoteSchema(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getRemoteSchema <em>Remote Schema</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Remote Schema</em>' attribute. * @see #getRemoteSchema() * @generated */ void setRemoteSchema(String value); /** * Returns the value of the '<em><b>Role</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Role</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Role</em>' attribute. * @see #setRole(String) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Role() * @model dataType="org.w3.xlink.RoleType" * extendedMetaData="kind='attribute' name='role' namespace='http://www.w3.org/1999/xlink'" * @generated */ String getRole(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getRole <em>Role</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Role</em>' attribute. * @see #getRole() * @generated */ void setRole(String value); /** * Returns the value of the '<em><b>Show</b></em>' attribute. * The literals are from the enumeration {@link org.w3.xlink.ShowType}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Show</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Show</em>' attribute. * @see org.w3.xlink.ShowType * @see #isSetShow() * @see #unsetShow() * @see #setShow(ShowType) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Show() * @model unsettable="true" * extendedMetaData="kind='attribute' name='show' namespace='http://www.w3.org/1999/xlink'" * @generated */ ShowType getShow(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getShow <em>Show</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Show</em>' attribute. * @see org.w3.xlink.ShowType * @see #isSetShow() * @see #unsetShow() * @see #getShow() * @generated */ void setShow(ShowType value); /** * Unsets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getShow <em>Show</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetShow() * @see #getShow() * @see #setShow(ShowType) * @generated */ void unsetShow(); /** * Returns whether the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getShow <em>Show</em>}' attribute is set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return whether the value of the '<em>Show</em>' attribute is set. * @see #unsetShow() * @see #getShow() * @see #setShow(ShowType) * @generated */ boolean isSetShow(); /** * Returns the value of the '<em><b>Title</b></em>' attribute. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Title</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Title</em>' attribute. * @see #setTitle(String) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Title() * @model dataType="org.w3.xlink.TitleAttrType" * extendedMetaData="kind='attribute' name='title' namespace='http://www.w3.org/1999/xlink'" * @generated */ String getTitle(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getTitle <em>Title</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Title</em>' attribute. * @see #getTitle() * @generated */ void setTitle(String value); /** * Returns the value of the '<em><b>Type</b></em>' attribute. * The default value is <code>"simple"</code>. * The literals are from the enumeration {@link org.w3.xlink.TypeType}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Type</em>' attribute isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Type</em>' attribute. * @see org.w3.xlink.TypeType * @see #isSetType() * @see #unsetType() * @see #setType(TypeType) * @see net.opengis.gml311.Gml311Package#getEngineeringCRSRefType_Type() * @model default="simple" unsettable="true" * extendedMetaData="kind='attribute' name='type' namespace='http://www.w3.org/1999/xlink'" * @generated */ TypeType getType(); /** * Sets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getType <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>Type</em>' attribute. * @see org.w3.xlink.TypeType * @see #isSetType() * @see #unsetType() * @see #getType() * @generated */ void setType(TypeType value); /** * Unsets the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getType <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #isSetType() * @see #getType() * @see #setType(TypeType) * @generated */ void unsetType(); /** * Returns whether the value of the '{@link net.opengis.gml311.EngineeringCRSRefType#getType <em>Type</em>}' attribute is set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return whether the value of the '<em>Type</em>' attribute is set. * @see #unsetType() * @see #getType() * @see #setType(TypeType) * @generated */ boolean isSetType(); } // EngineeringCRSRefType
{ "pile_set_name": "Github" }
#include <stdio.h> #include <string.h> int main(void) { char *all = "안녕하세요"; char buf[16]; buf[0] = all[3]; buf[1] = all[4]; buf[2] = all[5]; buf[3] = '\0'; printf("%s\n", all); printf("length= %d\n", strlen(all)); //5? printf("all[3]= %c\n", all[3]); printf("all[3][4][5]= %c%c%c\n", all[3], all[4], all[5]); printf("buf = %s\n", buf); return 0; }
{ "pile_set_name": "Github" }
**This airport has been automatically generated** We have no information about DRRP[*] airport other than its name, ICAO and location (NE). This airport will have to be done from scratch, which includes adding runways, taxiways, parking locations, boundaries... Good luck if you decide to do this airport!
{ "pile_set_name": "Github" }
#include <linux/types.h> #include "event.h" #include "debug.h" #include "sort.h" #include "string.h" #include "strlist.h" #include "thread.h" #include "thread_map.h" static const char *perf_event__names[] = { [0] = "TOTAL", [PERF_RECORD_MMAP] = "MMAP", [PERF_RECORD_LOST] = "LOST", [PERF_RECORD_COMM] = "COMM", [PERF_RECORD_EXIT] = "EXIT", [PERF_RECORD_THROTTLE] = "THROTTLE", [PERF_RECORD_UNTHROTTLE] = "UNTHROTTLE", [PERF_RECORD_FORK] = "FORK", [PERF_RECORD_READ] = "READ", [PERF_RECORD_SAMPLE] = "SAMPLE", [PERF_RECORD_HEADER_ATTR] = "ATTR", [PERF_RECORD_HEADER_EVENT_TYPE] = "EVENT_TYPE", [PERF_RECORD_HEADER_TRACING_DATA] = "TRACING_DATA", [PERF_RECORD_HEADER_BUILD_ID] = "BUILD_ID", [PERF_RECORD_FINISHED_ROUND] = "FINISHED_ROUND", }; const char *perf_event__name(unsigned int id) { if (id >= ARRAY_SIZE(perf_event__names)) return "INVALID"; if (!perf_event__names[id]) return "UNKNOWN"; return perf_event__names[id]; } static struct perf_sample synth_sample = { .pid = -1, .tid = -1, .time = -1, .stream_id = -1, .cpu = -1, .period = 1, }; static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len) { char filename[PATH_MAX]; char bf[BUFSIZ]; FILE *fp; size_t size = 0; pid_t tgid = -1; snprintf(filename, sizeof(filename), "/proc/%d/status", pid); fp = fopen(filename, "r"); if (fp == NULL) { pr_debug("couldn't open %s\n", filename); return 0; } while (!comm[0] || (tgid < 0)) { if (fgets(bf, sizeof(bf), fp) == NULL) { pr_warning("couldn't get COMM and pgid, malformed %s\n", filename); break; } if (memcmp(bf, "Name:", 5) == 0) { char *name = bf + 5; while (*name && isspace(*name)) ++name; size = strlen(name) - 1; if (size >= len) size = len - 1; memcpy(comm, name, size); comm[size] = '\0'; } else if (memcmp(bf, "Tgid:", 5) == 0) { char *tgids = bf + 5; while (*tgids && isspace(*tgids)) ++tgids; tgid = atoi(tgids); } } fclose(fp); return tgid; } static pid_t perf_event__synthesize_comm(struct perf_tool *tool, union perf_event *event, pid_t pid, int full, perf_event__handler_t process, struct machine *machine) { char filename[PATH_MAX]; size_t size; DIR *tasks; struct dirent dirent, *next; pid_t tgid; memset(&event->comm, 0, sizeof(event->comm)); tgid = perf_event__get_comm_tgid(pid, event->comm.comm, sizeof(event->comm.comm)); if (tgid < 0) goto out; event->comm.pid = tgid; event->comm.header.type = PERF_RECORD_COMM; size = strlen(event->comm.comm) + 1; size = ALIGN(size, sizeof(u64)); memset(event->comm.comm + size, 0, machine->id_hdr_size); event->comm.header.size = (sizeof(event->comm) - (sizeof(event->comm.comm) - size) + machine->id_hdr_size); if (!full) { event->comm.tid = pid; process(tool, event, &synth_sample, machine); goto out; } snprintf(filename, sizeof(filename), "/proc/%d/task", pid); tasks = opendir(filename); if (tasks == NULL) { pr_debug("couldn't open %s\n", filename); return 0; } while (!readdir_r(tasks, &dirent, &next) && next) { char *end; pid = strtol(dirent.d_name, &end, 10); if (*end) continue; /* already have tgid; jut want to update the comm */ (void) perf_event__get_comm_tgid(pid, event->comm.comm, sizeof(event->comm.comm)); size = strlen(event->comm.comm) + 1; size = ALIGN(size, sizeof(u64)); memset(event->comm.comm + size, 0, machine->id_hdr_size); event->comm.header.size = (sizeof(event->comm) - (sizeof(event->comm.comm) - size) + machine->id_hdr_size); event->comm.tid = pid; process(tool, event, &synth_sample, machine); } closedir(tasks); out: return tgid; } static int perf_event__synthesize_mmap_events(struct perf_tool *tool, union perf_event *event, pid_t pid, pid_t tgid, perf_event__handler_t process, struct machine *machine) { char filename[PATH_MAX]; FILE *fp; snprintf(filename, sizeof(filename), "/proc/%d/maps", pid); fp = fopen(filename, "r"); if (fp == NULL) { /* * We raced with a task exiting - just return: */ pr_debug("couldn't open %s\n", filename); return -1; } event->header.type = PERF_RECORD_MMAP; /* * Just like the kernel, see __perf_event_mmap in kernel/perf_event.c */ event->header.misc = PERF_RECORD_MISC_USER; while (1) { char bf[BUFSIZ], *pbf = bf; int n; size_t size; if (fgets(bf, sizeof(bf), fp) == NULL) break; /* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ n = hex2u64(pbf, &event->mmap.start); if (n < 0) continue; pbf += n + 1; n = hex2u64(pbf, &event->mmap.len); if (n < 0) continue; pbf += n + 3; if (*pbf == 'x') { /* vm_exec */ char anonstr[] = "//anon\n"; char *execname = strchr(bf, '/'); /* Catch VDSO */ if (execname == NULL) execname = strstr(bf, "[vdso]"); /* Catch anonymous mmaps */ if ((execname == NULL) && !strstr(bf, "[")) execname = anonstr; if (execname == NULL) continue; pbf += 3; n = hex2u64(pbf, &event->mmap.pgoff); size = strlen(execname); execname[size - 1] = '\0'; /* Remove \n */ memcpy(event->mmap.filename, execname, size); size = ALIGN(size, sizeof(u64)); event->mmap.len -= event->mmap.start; event->mmap.header.size = (sizeof(event->mmap) - (sizeof(event->mmap.filename) - size)); memset(event->mmap.filename + size, 0, machine->id_hdr_size); event->mmap.header.size += machine->id_hdr_size; event->mmap.pid = tgid; event->mmap.tid = pid; process(tool, event, &synth_sample, machine); } } fclose(fp); return 0; } int perf_event__synthesize_modules(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { struct rb_node *nd; struct map_groups *kmaps = &machine->kmaps; union perf_event *event = zalloc((sizeof(event->mmap) + machine->id_hdr_size)); if (event == NULL) { pr_debug("Not enough memory synthesizing mmap event " "for kernel modules\n"); return -1; } event->header.type = PERF_RECORD_MMAP; /* * kernel uses 0 for user space maps, see kernel/perf_event.c * __perf_event_mmap */ if (machine__is_host(machine)) event->header.misc = PERF_RECORD_MISC_KERNEL; else event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; for (nd = rb_first(&kmaps->maps[MAP__FUNCTION]); nd; nd = rb_next(nd)) { size_t size; struct map *pos = rb_entry(nd, struct map, rb_node); if (pos->dso->kernel) continue; size = ALIGN(pos->dso->long_name_len + 1, sizeof(u64)); event->mmap.header.type = PERF_RECORD_MMAP; event->mmap.header.size = (sizeof(event->mmap) - (sizeof(event->mmap.filename) - size)); memset(event->mmap.filename + size, 0, machine->id_hdr_size); event->mmap.header.size += machine->id_hdr_size; event->mmap.start = pos->start; event->mmap.len = pos->end - pos->start; event->mmap.pid = machine->pid; memcpy(event->mmap.filename, pos->dso->long_name, pos->dso->long_name_len + 1); process(tool, event, &synth_sample, machine); } free(event); return 0; } static int __event__synthesize_thread(union perf_event *comm_event, union perf_event *mmap_event, pid_t pid, int full, perf_event__handler_t process, struct perf_tool *tool, struct machine *machine) { pid_t tgid = perf_event__synthesize_comm(tool, comm_event, pid, full, process, machine); if (tgid == -1) return -1; return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, process, machine); } int perf_event__synthesize_thread_map(struct perf_tool *tool, struct thread_map *threads, perf_event__handler_t process, struct machine *machine) { union perf_event *comm_event, *mmap_event; int err = -1, thread, j; comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); if (comm_event == NULL) goto out; mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); if (mmap_event == NULL) goto out_free_comm; err = 0; for (thread = 0; thread < threads->nr; ++thread) { if (__event__synthesize_thread(comm_event, mmap_event, threads->map[thread], 0, process, tool, machine)) { err = -1; break; } /* * comm.pid is set to thread group id by * perf_event__synthesize_comm */ if ((int) comm_event->comm.pid != threads->map[thread]) { bool need_leader = true; /* is thread group leader in thread_map? */ for (j = 0; j < threads->nr; ++j) { if ((int) comm_event->comm.pid == threads->map[j]) { need_leader = false; break; } } /* if not, generate events for it */ if (need_leader && __event__synthesize_thread(comm_event, mmap_event, comm_event->comm.pid, 0, process, tool, machine)) { err = -1; break; } } } free(mmap_event); out_free_comm: free(comm_event); out: return err; } int perf_event__synthesize_threads(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine) { DIR *proc; struct dirent dirent, *next; union perf_event *comm_event, *mmap_event; int err = -1; comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); if (comm_event == NULL) goto out; mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); if (mmap_event == NULL) goto out_free_comm; proc = opendir("/proc"); if (proc == NULL) goto out_free_mmap; while (!readdir_r(proc, &dirent, &next) && next) { char *end; pid_t pid = strtol(dirent.d_name, &end, 10); if (*end) /* only interested in proper numerical dirents */ continue; __event__synthesize_thread(comm_event, mmap_event, pid, 1, process, tool, machine); } closedir(proc); err = 0; out_free_mmap: free(mmap_event); out_free_comm: free(comm_event); out: return err; } struct process_symbol_args { const char *name; u64 start; }; static int find_symbol_cb(void *arg, const char *name, char type, u64 start, u64 end __used) { struct process_symbol_args *args = arg; /* * Must be a function or at least an alias, as in PARISC64, where "_text" is * an 'A' to the same address as "_stext". */ if (!(symbol_type__is_a(type, MAP__FUNCTION) || type == 'A') || strcmp(name, args->name)) return 0; args->start = start; return 1; } int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, perf_event__handler_t process, struct machine *machine, const char *symbol_name) { size_t size; const char *filename, *mmap_name; char path[PATH_MAX]; char name_buff[PATH_MAX]; struct map *map; int err; /* * We should get this from /sys/kernel/sections/.text, but till that is * available use this, and after it is use this as a fallback for older * kernels. */ struct process_symbol_args args = { .name = symbol_name, }; union perf_event *event = zalloc((sizeof(event->mmap) + machine->id_hdr_size)); if (event == NULL) { pr_debug("Not enough memory synthesizing mmap event " "for kernel modules\n"); return -1; } mmap_name = machine__mmap_name(machine, name_buff, sizeof(name_buff)); if (machine__is_host(machine)) { /* * kernel uses PERF_RECORD_MISC_USER for user space maps, * see kernel/perf_event.c __perf_event_mmap */ event->header.misc = PERF_RECORD_MISC_KERNEL; filename = "/proc/kallsyms"; } else { event->header.misc = PERF_RECORD_MISC_GUEST_KERNEL; if (machine__is_default_guest(machine)) filename = (char *) symbol_conf.default_guest_kallsyms; else { sprintf(path, "%s/proc/kallsyms", machine->root_dir); filename = path; } } if (kallsyms__parse(filename, &args, find_symbol_cb) <= 0) return -ENOENT; map = machine->vmlinux_maps[MAP__FUNCTION]; size = snprintf(event->mmap.filename, sizeof(event->mmap.filename), "%s%s", mmap_name, symbol_name) + 1; size = ALIGN(size, sizeof(u64)); event->mmap.header.type = PERF_RECORD_MMAP; event->mmap.header.size = (sizeof(event->mmap) - (sizeof(event->mmap.filename) - size) + machine->id_hdr_size); event->mmap.pgoff = args.start; event->mmap.start = map->start; event->mmap.len = map->end - event->mmap.start; event->mmap.pid = machine->pid; err = process(tool, event, &synth_sample, machine); free(event); return err; } size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp) { return fprintf(fp, ": %s:%d\n", event->comm.comm, event->comm.tid); } int perf_event__process_comm(struct perf_tool *tool __used, union perf_event *event, struct perf_sample *sample __used, struct machine *machine) { struct thread *thread = machine__findnew_thread(machine, event->comm.tid); if (dump_trace) perf_event__fprintf_comm(event, stdout); if (thread == NULL || thread__set_comm(thread, event->comm.comm)) { dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); return -1; } return 0; } int perf_event__process_lost(struct perf_tool *tool __used, union perf_event *event, struct perf_sample *sample __used, struct machine *machine __used) { dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", event->lost.id, event->lost.lost); return 0; } static void perf_event__set_kernel_mmap_len(union perf_event *event, struct map **maps) { maps[MAP__FUNCTION]->start = event->mmap.start; maps[MAP__FUNCTION]->end = event->mmap.start + event->mmap.len; /* * Be a bit paranoid here, some perf.data file came with * a zero sized synthesized MMAP event for the kernel. */ if (maps[MAP__FUNCTION]->end == 0) maps[MAP__FUNCTION]->end = ~0ULL; } static int perf_event__process_kernel_mmap(struct perf_tool *tool __used, union perf_event *event, struct machine *machine) { struct map *map; char kmmap_prefix[PATH_MAX]; enum dso_kernel_type kernel_type; bool is_kernel_mmap; machine__mmap_name(machine, kmmap_prefix, sizeof(kmmap_prefix)); if (machine__is_host(machine)) kernel_type = DSO_TYPE_KERNEL; else kernel_type = DSO_TYPE_GUEST_KERNEL; is_kernel_mmap = memcmp(event->mmap.filename, kmmap_prefix, strlen(kmmap_prefix) - 1) == 0; if (event->mmap.filename[0] == '/' || (!is_kernel_mmap && event->mmap.filename[0] == '[')) { char short_module_name[1024]; char *name, *dot; if (event->mmap.filename[0] == '/') { name = strrchr(event->mmap.filename, '/'); if (name == NULL) goto out_problem; ++name; /* skip / */ dot = strrchr(name, '.'); if (dot == NULL) goto out_problem; snprintf(short_module_name, sizeof(short_module_name), "[%.*s]", (int)(dot - name), name); strxfrchar(short_module_name, '-', '_'); } else strcpy(short_module_name, event->mmap.filename); map = machine__new_module(machine, event->mmap.start, event->mmap.filename); if (map == NULL) goto out_problem; name = strdup(short_module_name); if (name == NULL) goto out_problem; map->dso->short_name = name; map->dso->sname_alloc = 1; map->end = map->start + event->mmap.len; } else if (is_kernel_mmap) { const char *symbol_name = (event->mmap.filename + strlen(kmmap_prefix)); /* * Should be there already, from the build-id table in * the header. */ struct dso *kernel = __dsos__findnew(&machine->kernel_dsos, kmmap_prefix); if (kernel == NULL) goto out_problem; kernel->kernel = kernel_type; if (__machine__create_kernel_maps(machine, kernel) < 0) goto out_problem; perf_event__set_kernel_mmap_len(event, machine->vmlinux_maps); /* * Avoid using a zero address (kptr_restrict) for the ref reloc * symbol. Effectively having zero here means that at record * time /proc/sys/kernel/kptr_restrict was non zero. */ if (event->mmap.pgoff != 0) { maps__set_kallsyms_ref_reloc_sym(machine->vmlinux_maps, symbol_name, event->mmap.pgoff); } if (machine__is_default_guest(machine)) { /* * preload dso of guest kernel and modules */ dso__load(kernel, machine->vmlinux_maps[MAP__FUNCTION], NULL); } } return 0; out_problem: return -1; } size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp) { return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %s\n", event->mmap.pid, event->mmap.tid, event->mmap.start, event->mmap.len, event->mmap.pgoff, event->mmap.filename); } int perf_event__process_mmap(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __used, struct machine *machine) { struct thread *thread; struct map *map; u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; int ret = 0; if (dump_trace) perf_event__fprintf_mmap(event, stdout); if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL || cpumode == PERF_RECORD_MISC_KERNEL) { ret = perf_event__process_kernel_mmap(tool, event, machine); if (ret < 0) goto out_problem; return 0; } thread = machine__findnew_thread(machine, event->mmap.pid); if (thread == NULL) goto out_problem; map = map__new(&machine->user_dsos, event->mmap.start, event->mmap.len, event->mmap.pgoff, event->mmap.pid, event->mmap.filename, MAP__FUNCTION); if (map == NULL) goto out_problem; thread__insert_map(thread, map); return 0; out_problem: dump_printf("problem processing PERF_RECORD_MMAP, skipping event.\n"); return 0; } size_t perf_event__fprintf_task(union perf_event *event, FILE *fp) { return fprintf(fp, "(%d:%d):(%d:%d)\n", event->fork.pid, event->fork.tid, event->fork.ppid, event->fork.ptid); } int perf_event__process_task(struct perf_tool *tool __used, union perf_event *event, struct perf_sample *sample __used, struct machine *machine) { struct thread *thread = machine__findnew_thread(machine, event->fork.tid); struct thread *parent = machine__findnew_thread(machine, event->fork.ptid); if (dump_trace) perf_event__fprintf_task(event, stdout); if (event->header.type == PERF_RECORD_EXIT) { machine__remove_thread(machine, thread); return 0; } if (thread == NULL || parent == NULL || thread__fork(thread, parent) < 0) { dump_printf("problem processing PERF_RECORD_FORK, skipping event.\n"); return -1; } return 0; } size_t perf_event__fprintf(union perf_event *event, FILE *fp) { size_t ret = fprintf(fp, "PERF_RECORD_%s", perf_event__name(event->header.type)); switch (event->header.type) { case PERF_RECORD_COMM: ret += perf_event__fprintf_comm(event, fp); break; case PERF_RECORD_FORK: case PERF_RECORD_EXIT: ret += perf_event__fprintf_task(event, fp); break; case PERF_RECORD_MMAP: ret += perf_event__fprintf_mmap(event, fp); break; default: ret += fprintf(fp, "\n"); } return ret; } int perf_event__process(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct machine *machine) { switch (event->header.type) { case PERF_RECORD_COMM: perf_event__process_comm(tool, event, sample, machine); break; case PERF_RECORD_MMAP: perf_event__process_mmap(tool, event, sample, machine); break; case PERF_RECORD_FORK: case PERF_RECORD_EXIT: perf_event__process_task(tool, event, sample, machine); break; case PERF_RECORD_LOST: perf_event__process_lost(tool, event, sample, machine); default: break; } return 0; } void thread__find_addr_map(struct thread *self, struct machine *machine, u8 cpumode, enum map_type type, u64 addr, struct addr_location *al) { struct map_groups *mg = &self->mg; al->thread = self; al->addr = addr; al->cpumode = cpumode; al->filtered = false; if (machine == NULL) { al->map = NULL; return; } if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) { al->level = 'k'; mg = &machine->kmaps; } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) { al->level = '.'; } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) { al->level = 'g'; mg = &machine->kmaps; } else { /* * 'u' means guest os user space. * TODO: We don't support guest user space. Might support late. */ if (cpumode == PERF_RECORD_MISC_GUEST_USER && perf_guest) al->level = 'u'; else al->level = 'H'; al->map = NULL; if ((cpumode == PERF_RECORD_MISC_GUEST_USER || cpumode == PERF_RECORD_MISC_GUEST_KERNEL) && !perf_guest) al->filtered = true; if ((cpumode == PERF_RECORD_MISC_USER || cpumode == PERF_RECORD_MISC_KERNEL) && !perf_host) al->filtered = true; return; } try_again: al->map = map_groups__find(mg, type, al->addr); if (al->map == NULL) { /* * If this is outside of all known maps, and is a negative * address, try to look it up in the kernel dso, as it might be * a vsyscall or vdso (which executes in user-mode). * * XXX This is nasty, we should have a symbol list in the * "[vdso]" dso, but for now lets use the old trick of looking * in the whole kernel symbol list. */ if ((long long)al->addr < 0 && cpumode == PERF_RECORD_MISC_USER && machine && mg != &machine->kmaps) { mg = &machine->kmaps; goto try_again; } } else al->addr = al->map->map_ip(al->map, al->addr); } void thread__find_addr_location(struct thread *thread, struct machine *machine, u8 cpumode, enum map_type type, u64 addr, struct addr_location *al, symbol_filter_t filter) { thread__find_addr_map(thread, machine, cpumode, type, addr, al); if (al->map != NULL) al->sym = map__find_symbol(al->map, al->addr, filter); else al->sym = NULL; } int perf_event__preprocess_sample(const union perf_event *event, struct machine *machine, struct addr_location *al, struct perf_sample *sample, symbol_filter_t filter) { u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; struct thread *thread = machine__findnew_thread(machine, event->ip.pid); if (thread == NULL) return -1; if (symbol_conf.comm_list && !strlist__has_entry(symbol_conf.comm_list, thread->comm)) goto out_filtered; dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid); /* * Have we already created the kernel maps for this machine? * * This should have happened earlier, when we processed the kernel MMAP * events, but for older perf.data files there was no such thing, so do * it now. */ if (cpumode == PERF_RECORD_MISC_KERNEL && machine->vmlinux_maps[MAP__FUNCTION] == NULL) machine__create_kernel_maps(machine); thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, event->ip.ip, al); dump_printf(" ...... dso: %s\n", al->map ? al->map->dso->long_name : al->level == 'H' ? "[hypervisor]" : "<not found>"); al->sym = NULL; al->cpu = sample->cpu; if (al->map) { struct dso *dso = al->map->dso; if (symbol_conf.dso_list && (!dso || !(strlist__has_entry(symbol_conf.dso_list, dso->short_name) || (dso->short_name != dso->long_name && strlist__has_entry(symbol_conf.dso_list, dso->long_name))))) goto out_filtered; al->sym = map__find_symbol(al->map, al->addr, filter); } if (symbol_conf.sym_list && al->sym && !strlist__has_entry(symbol_conf.sym_list, al->sym->name)) goto out_filtered; return 0; out_filtered: al->filtered = true; return 0; }
{ "pile_set_name": "Github" }
org/bukkit/entity/Damageable _INVALID_damage (I)V damage org/bukkit/entity/Damageable _INVALID_damage (ILorg/bukkit/entity/Entity;)V damage org/bukkit/entity/Damageable _INVALID_getHealth ()I getHealth org/bukkit/entity/Damageable _INVALID_setHealth (I)V setHealth org/bukkit/entity/Damageable _INVALID_getMaxHealth ()I getMaxHealth org/bukkit/entity/Damageable _INVALID_setMaxHealth (I)V setMaxHealth org/bukkit/entity/LivingEntity _INVALID_getLastDamage ()I getLastDamage org/bukkit/entity/LivingEntity _INVALID_setLastDamage (I)V setLastDamage org/bukkit/event/entity/EntityDamageEvent _INVALID_getDamage ()I getDamage org/bukkit/event/entity/EntityDamageEvent _INVALID_setDamage (I)V setDamage org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_getDamage ()I getDamage org/bukkit/event/vehicle/VehicleDamageEvent _INVALID_setDamage (I)V setDamage org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_getAmount ()I getAmount org/bukkit/event/entity/EntityRegainHealthEvent _INVALID_setAmount (I)V setAmount org/bukkit/entity/Minecart _INVALID_getDamage ()I getDamage org/bukkit/entity/Minecart _INVALID_setDamage (I)V setDamage org/bukkit/entity/Projectile _INVALID_getShooter ()Lorg/bukkit/entity/LivingEntity; getShooter org/bukkit/entity/Projectile _INVALID_setShooter (Lorg/bukkit/entity/LivingEntity;)V setShooter org/bukkit/Bukkit _INVALID_getOnlinePlayers ()[Lorg/bukkit/entity/Player; getOnlinePlayers org/bukkit/Server _INVALID_getOnlinePlayers ()[Lorg/bukkit/entity/Player; getOnlinePlayers
{ "pile_set_name": "Github" }
/* * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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. */ package org.springframework.jdbc.core; import java.sql.PreparedStatement; import java.sql.SQLException; import org.springframework.lang.Nullable; /** * Simple adapter for {@link PreparedStatementSetter} that applies a given array of arguments. * * @author Juergen Hoeller * @since 3.2.3 */ public class ArgumentPreparedStatementSetter implements PreparedStatementSetter, ParameterDisposer { @Nullable private final Object[] args; /** * Create a new ArgPreparedStatementSetter for the given arguments. * @param args the arguments to set */ public ArgumentPreparedStatementSetter(@Nullable Object[] args) { this.args = args; } @Override public void setValues(PreparedStatement ps) throws SQLException { if (this.args != null) { for (int i = 0; i < this.args.length; i++) { Object arg = this.args[i]; doSetValue(ps, i + 1, arg); } } } /** * Set the value for prepared statements specified parameter index using the passed in value. * This method can be overridden by sub-classes if needed. * @param ps the PreparedStatement * @param parameterPosition index of the parameter position * @param argValue the value to set * @throws SQLException if thrown by PreparedStatement methods */ protected void doSetValue(PreparedStatement ps, int parameterPosition, Object argValue) throws SQLException { if (argValue instanceof SqlParameterValue) { SqlParameterValue paramValue = (SqlParameterValue) argValue; StatementCreatorUtils.setParameterValue(ps, parameterPosition, paramValue, paramValue.getValue()); } else { StatementCreatorUtils.setParameterValue(ps, parameterPosition, SqlTypeValue.TYPE_UNKNOWN, argValue); } } @Override public void cleanupParameters() { StatementCreatorUtils.cleanupParameters(this.args); } }
{ "pile_set_name": "Github" }
out vec4 FragColor; uniform sampler2D strokeColor; uniform sampler2D strokeDepth; uniform float amplitude; uniform float period; uniform float phase; uniform int orientation; uniform vec2 wsize; #define M_PI 3.1415926535897932384626433832795 #define HORIZONTAL 0 #define VERTICAL 1 void main() { vec4 outcolor; ivec2 uv = ivec2(gl_FragCoord.xy); float stroke_depth; float value; if (orientation == HORIZONTAL) { float pval = (uv.x * M_PI) / wsize[0]; value = amplitude * sin((period * pval) + phase); outcolor = texelFetch(strokeColor, ivec2(uv.x, uv.y + value), 0); stroke_depth = texelFetch(strokeDepth, ivec2(uv.x, uv.y + value), 0).r; } else { float pval = (uv.y * M_PI) / wsize[1]; value = amplitude * sin((period * pval) + phase); outcolor = texelFetch(strokeColor, ivec2(uv.x + value, uv.y), 0); stroke_depth = texelFetch(strokeDepth, ivec2(uv.x + value, uv.y), 0).r; } FragColor = outcolor; gl_FragDepth = stroke_depth; if (outcolor.a < 0.02f) { discard; } }
{ "pile_set_name": "Github" }
// https://codeforces.com/contest/1199/problem/C #include <bits/stdc++.h> using namespace std; using mii = map<int, int>; int main() { int n, I, x; cin >> n >> I; mii m; for (int i = 0; i < n; i++) { cin >> x; m[x]++; } int k = (8 * I) / n; int K = 1; for (int i = 0; i < k; i++) { K *= 2; if (K >= m.size()) { cout << 0 << endl; return 0; } } int p = m.size(); vector<int> a; for (auto x : m) a.push_back(x.second); int M = 1000000000; int z = 0; for (int i = 0; i < K; i++) z += a[i]; M = min(M, n - z); for (int i = K; i < p; i++) { z -= a[i - K]; z += a[i]; M = min(M, n - z); } cout << M << endl; }
{ "pile_set_name": "Github" }
# # MSILO usage example # # $ID: daniel $ # udp_workers=2 check_via=no # (cmd. line: -v) dns=off # (cmd. line: -r) rev_dns=off # (cmd. line: -R) # ------------------ module loading ---------------------------------- #set module path mpath="/usr/local/lib/opensips/modules/" loadmodule "textops.so" loadmodule "sl.so" loadmodule "db_mysql.so" loadmodule "maxfwd.so" loadmodule "tm.so" loadmodule "usrloc.so" loadmodule "registrar.so" loadmodule "msilo.so" # ----------------- setting module-specific parameters --------------- # -- registrar params -- modparam("registrar", "default_expires", 120) # -- usrloc params -- modparam("usrloc", "db_mode", 0) # -- msilo params -- modparam("msilo", "db_url", "mysql://opensips:opensipsrw@localhost/opensips") # -- tm params -- modparam("tm", "fr_timer", 10 ) modparam("tm", "fr_inv_timer", 15 ) modparam("tm", "wt_timer", 10 ) route{ if ( !mf_process_maxfwd_header("10") ) { sl_send_reply("483","To Many Hops"); exit; }; if (is_myself("$rd")) { # for testing purposes, simply okay all REGISTERs # is_method("XYZ") is faster than ($rm=="XYZ") # but requires textops module if (is_method("REGISTER")) { save("location"); log("REGISTER received -> dumping messages with MSILO\n"); # MSILO - dumping user's offline messages if (m_dump()) { log("MSILO: offline messages dumped - if they were\n"); } else { log("MSILO: no offline messages dumped\n"); }; exit; }; # backup r-uri for m_dump() in case of delivery failure $avp(11) = $ru; # domestic SIP destinations are handled using our USRLOC DB if(!lookup("location")) { if (! t_newtran()) { sl_reply_error(); exit; }; # we do not care about anything else but MESSAGEs if (!is_method("MESSAGE")) { if (!t_reply("404", "Not found")) { sl_reply_error(); }; exit; }; log("MESSAGE received -> storing using MSILO\n"); # MSILO - storing as offline message if (m_store("$ru")) { log("MSILO: offline message stored\n"); if (!t_reply("202", "Accepted")) { sl_reply_error(); }; }else{ log("MSILO: offline message NOT stored\n"); if (!t_reply("503", "Service Unavailable")) { sl_reply_error(); }; }; exit; }; # if the downstream UA does not support MESSAGE requests # go to failure_route[1] t_on_failure("1"); t_relay(); exit; }; # forward anything else t_relay(); } failure_route[1] { # forwarding failed -- check if the request was a MESSAGE if (!is_method("MESSAGE")) exit; log(1,"MSILO: the downstream UA does not support MESSAGE requests ...\n"); # we have changed the R-URI with the contact address -- ignore it now if (m_store("$avp(11)")) { log("MSILO: offline message stored\n"); t_reply("202", "Accepted"); }else{ log("MSILO: offline message NOT stored\n"); t_reply("503", "Service Unavailable"); }; }
{ "pile_set_name": "Github" }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef BACKENDS_PLUGINS_SDL_H #define BACKENDS_PLUGINS_SDL_H #include "base/plugins.h" #if defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) class SDLPluginProvider : public FilePluginProvider { protected: Plugin* createPlugin(const Common::FSNode &node) const; }; #endif // defined(DYNAMIC_MODULES) && defined(SDL_BACKEND) #endif
{ "pile_set_name": "Github" }
package com.mashibing.controller.base; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.stereotype.Controller; /** * <p> * 自定义类型 前端控制器 * </p> * * @author lian * @since 2020-04-18 */ @Controller @RequestMapping("/tblCustomType") public class TblCustomTypeController { }
{ "pile_set_name": "Github" }
// 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) var dP = require('./_object-dp'); var $export = require('./_export'); var anObject = require('./_an-object'); var toPrimitive = require('./_to-primitive'); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false $export($export.S + $export.F * require('./_fails')(function () { // eslint-disable-next-line no-undef Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); }), 'Reflect', { defineProperty: function defineProperty(target, propertyKey, attributes) { anObject(target); propertyKey = toPrimitive(propertyKey, true); anObject(attributes); try { dP.f(target, propertyKey, attributes); return true; } catch (e) { return false; } } });
{ "pile_set_name": "Github" }
# Blender v2.78 (sub 0) OBJ File: '' # www.blender.org o collision_mesh_Cube v 1.670722 -0.127512 -28.506155 v 1.160390 -0.022079 -28.506147 v 1.160390 -0.022079 -29.095850 v 1.670722 -0.127512 -31.214417 v 7.181986 -0.294439 -16.803648 v 4.320757 -3.384111 -17.799223 v 2.375209 -0.294435 -28.506155 v 4.320757 3.466504 -17.799223 v 7.181986 0.376831 -16.803648 v 2.375209 0.376835 -28.506155 v -4.291919 -3.384111 -17.799206 v -2.346404 -0.294435 -28.506147 v 6.440376 -3.384111 -17.061693 v -8.962100 0.339741 -16.478279 v -9.230039 0.724865 -16.478279 v -9.335758 0.530979 -16.796093 v -9.143806 0.255075 -16.796093 v 6.440376 3.466504 -17.061693 v -6.430764 3.466500 -5.229502 v -11.466506 1.405055 -5.576606 v -11.466506 1.405053 -1.420516 v -6.440376 3.466498 -0.152408 v 11.495368 -1.322671 -5.576653 v 11.495352 1.405055 -5.576649 v 11.495353 1.405053 -1.420548 v 11.495377 -1.322673 -1.420551 v -1.117825 -3.384113 -4.703391 v -6.430764 -3.384115 -5.229506 v 6.440376 3.466500 -5.229513 v 6.440376 3.466498 -0.152408 v 6.440376 -3.384115 -5.229515 v 6.440376 -3.384117 -0.152412 v -11.466495 -1.322671 -5.576606 v -6.440376 -3.384117 -0.152412 v -11.466490 -1.322673 -1.420516 v 11.495353 1.405051 5.881690 v 11.495377 -1.322675 5.881690 v 8.197359 -0.587044 5.896743 v 8.197359 0.669419 5.896743 v -5.104052 1.865917 -0.152410 v 5.132942 1.865917 -0.152410 v -5.104052 -1.783537 -0.152410 v -6.354040 -0.596332 -0.152410 v 6.382930 0.678711 -0.152410 v -11.466490 -1.322675 5.881690 v -11.466506 1.405051 5.881690 v -8.168447 0.669420 5.896767 v -8.168447 -0.587044 5.896767 v 6.382931 -0.596332 -0.152410 v 6.440376 -3.384119 5.881690 v 6.986341 -1.783539 5.899220 v -6.440376 -3.384119 5.881690 v -6.957430 -1.783539 5.899240 v -6.440376 3.466492 15.631774 v -11.466506 1.405048 15.631772 v -11.466506 1.405047 19.095119 v -6.440376 3.466492 19.095119 v -12.370783 0.876847 17.207783 v -12.370779 0.409939 16.685438 v -12.370773 -0.327570 16.685438 v -12.370769 -0.794479 17.207783 v -12.370769 -0.794479 17.730131 v -12.370773 -0.328008 18.260187 v -12.370779 0.410377 18.260187 v -12.370783 0.876847 17.730131 v -6.440376 -3.384123 15.631770 v 6.440376 -3.384123 15.631770 v 6.440376 -3.384123 19.095119 v -6.440376 -3.384123 19.095119 v 11.495353 1.405048 15.631772 v 6.440376 3.466492 15.631774 v 6.440376 3.466492 19.095119 v 11.495353 1.405047 19.095119 v 11.495377 -1.322677 15.631772 v 11.495377 -1.322679 19.095119 v -11.466490 -1.322677 15.631772 v -11.466490 -1.322679 19.095119 v -11.466490 -1.300472 15.675435 v -11.466495 -0.336753 16.141020 v -11.466500 0.419122 16.141020 v -11.466506 1.357710 15.724846 v 0.000000 -1.936993 19.095119 v 1.343374 -1.350787 19.095119 v 0.893794 -0.884943 20.184601 v 0.000000 -1.274967 20.184601 v -3.941836 0.041185 19.095119 v -4.493916 1.448328 19.095119 v -4.932480 0.977407 20.184601 v -4.565162 0.041185 20.184601 v -6.354040 0.678712 -0.152410 v -6.957431 1.865915 5.899241 v 5.132942 -1.783537 -0.152410 v 6.986340 1.865915 5.899220 v 6.440376 3.466496 5.881691 v -6.440376 3.466496 5.881691 v -6.425147 3.466502 -9.641721 v -11.466506 1.405057 -9.198973 v 11.495353 -1.322667 -15.302793 v 11.495353 1.405059 -15.302793 v 11.495352 1.405057 -9.199015 v 11.495363 -1.322670 -9.199018 v -11.466500 -0.717729 -8.862511 v -11.466501 -0.298437 -8.753048 v -11.466504 0.380820 -8.753048 v -11.466505 0.797739 -8.861190 v -11.466499 -1.322670 -9.198973 v -6.425147 -3.384113 -9.641729 v 6.440376 -3.384113 -9.641742 v 6.440376 3.466502 -9.641738 v -11.466506 1.405059 -15.302760 v -11.466506 -1.322667 -15.302760 v 11.495367 -0.520921 -6.247777 v 11.495362 -0.520921 -8.527891 v 15.544081 -0.399815 -7.881511 v 15.544086 -0.399815 -6.894135 v -15.515222 -0.177331 -8.106689 v -15.515223 0.259715 -8.106689 v 11.495358 0.380820 -6.022574 v 11.495364 -0.298437 -6.022576 v 15.544083 -0.177331 -6.668935 v 15.544075 0.259714 -6.668934 v -11.466496 -0.715355 -5.914390 v -11.466496 -0.520921 -6.247734 v -11.466500 -0.520921 -8.527846 v -15.515217 -0.399815 -6.894114 v -15.515220 -0.399815 -7.881489 v 11.495355 0.603305 -8.527888 v 11.495355 0.603305 -6.247774 v 15.544070 0.482199 -6.894135 v 15.544070 0.482199 -7.881509 v 11.495361 -0.715355 -8.861235 v 11.495367 -0.717729 -5.913114 v -11.466505 0.603305 -6.247734 v -11.466505 0.603305 -8.527846 v -15.515224 0.482199 -7.881489 v -15.515224 0.482199 -6.894114 v -11.466498 -0.298437 -6.022532 v -11.466503 0.380820 -6.022532 v -15.515222 0.259715 -6.668913 v -15.515218 -0.177331 -6.668912 v 15.544078 -0.177331 -8.106712 v 15.544073 0.259714 -8.106712 v 11.495360 -0.298437 -8.753092 v 11.495356 0.380820 -8.753091 v 11.495355 0.800113 -8.862553 v 11.495355 0.797739 -5.914431 v -11.466505 0.800113 -5.913069 v 8.990939 0.339741 -16.478304 v 9.258879 0.724865 -16.478304 v 9.364598 0.530979 -16.796118 v 9.172646 0.255075 -16.796118 v 9.959394 -0.716346 -15.837201 v 10.341614 -0.334127 -15.704250 v 9.959394 0.798737 -15.837201 v 9.218599 0.798737 -16.095449 v 10.341614 0.416519 -15.704250 v 8.921708 0.371999 -16.198372 v 8.921708 -0.289607 -16.198372 v 9.218599 -0.716345 -16.095449 v 9.927436 -0.642474 -16.478304 v 9.258879 -0.642473 -16.478304 v 9.364598 -0.448588 -16.796118 v 9.843555 -0.448588 -16.796118 v 9.927436 0.724865 -16.478304 v 10.272382 0.379919 -16.478304 v 10.090676 0.283859 -16.796118 v 9.843555 0.530979 -16.796118 v 10.090676 -0.201467 -16.796118 v 9.172646 -0.172683 -16.796118 v 8.990939 -0.257349 -16.478304 v 10.272382 -0.297528 -16.478304 v -8.892868 -0.289607 -16.198347 v -9.189759 -0.716345 -16.095425 v -6.411536 -3.384111 -17.061668 v -7.153146 -0.294439 -16.803623 v -9.898596 -0.642474 -16.478279 v -9.230039 -0.642473 -16.478279 v -9.335758 -0.448588 -16.796093 v -9.814715 -0.448588 -16.796093 v -9.898596 0.724865 -16.478279 v -10.243542 0.379919 -16.478279 v -10.061836 0.283859 -16.796093 v -9.814715 0.530979 -16.796093 v -10.061836 -0.201467 -16.796093 v -9.143806 -0.172683 -16.796093 v -8.962100 -0.257349 -16.478279 v -10.243542 -0.297528 -16.478279 v -8.892868 0.371999 -16.198347 v -9.189759 0.798737 -16.095425 v -9.930554 -0.716346 -15.837175 v -6.690624 1.109840 -16.964571 v -4.291919 3.466504 -17.799206 v -7.153146 0.376830 -16.803623 v -2.346404 0.376835 -28.506147 v -10.312774 -0.334127 -15.704226 v -6.342933 1.740057 -17.085550 v -6.411536 3.466504 -17.061668 v -7.390203 2.568582 -16.721197 v -7.686477 1.181673 -16.618170 v -7.876395 1.496453 -16.552177 v -6.822341 2.542189 -16.918745 v -7.216944 1.038852 -16.781467 v -7.958065 1.913118 -16.523649 v -7.797903 2.249522 -16.579351 v -10.312774 0.416519 -15.704226 v -9.930554 0.798737 -15.837175 v -7.876395 1.496453 -17.167423 v -7.958065 1.913118 -17.167423 v -7.390203 2.568582 -17.167423 v -7.797903 2.249522 -17.167423 v -7.686477 1.181673 -17.167423 v -6.428829 2.199146 -17.055664 v -6.428829 2.199146 -17.167423 v -6.822341 2.542189 -17.167423 v -6.342933 1.740057 -17.167423 v -6.690624 1.109840 -17.167423 v -7.216944 1.038852 -17.167423 v -7.370066 1.710777 -17.800037 v -7.394770 1.836808 -17.800037 v -7.223004 2.035072 -17.800037 v -7.346324 1.938563 -17.800037 v -7.312620 1.615562 -17.800037 v -6.932209 1.923325 -17.800037 v -7.051239 2.027088 -17.800037 v -6.906227 1.784461 -17.800037 v -7.011396 1.593834 -17.800037 v -7.170597 1.572362 -17.800037 v -6.021791 3.103588 -17.197285 v -6.406102 3.103588 -17.063566 v -6.021791 2.376150 -17.197285 v -6.406102 2.376150 -17.063566 v -6.406102 3.103588 -17.259331 v -6.406102 2.376150 -17.259331 v -6.283042 2.514444 -17.259331 v -6.283042 2.965294 -17.259331 v -6.283042 2.965294 -20.715477 v -6.283042 2.514444 -20.105965 v -6.021791 2.376150 -17.259331 v -6.021791 3.103588 -17.259331 v -6.144851 2.965294 -17.259331 v -6.144851 2.514444 -17.259331 v -6.144851 2.965294 -20.715477 v -6.144851 2.514444 -20.105965 v 1.160390 0.104479 -28.506147 v 1.670722 0.209912 -28.506155 v 1.160390 0.104479 -29.095850 v 1.670722 0.209912 -30.841608 v -11.466491 -1.063676 16.879541 v -11.466491 -1.063676 18.089882 v 11.495355 1.146044 16.840733 v 11.495355 1.146044 18.128691 v 12.399632 0.876847 17.817123 v 12.399632 0.876847 17.120789 v 11.495361 0.412915 18.836117 v 11.495368 -0.330550 18.836117 v 12.399648 -0.328010 18.260187 v 12.399637 0.410375 18.260187 v 11.495368 -0.332223 16.141020 v 11.495361 0.414588 16.141020 v 12.399637 0.409937 16.685438 v 12.399648 -0.327572 16.685438 v 11.495353 1.382841 15.675435 v 11.495376 -1.275342 15.724846 v 12.399654 -0.794479 17.098259 v 12.399654 -0.794479 17.839653 v -11.466504 1.146044 18.106234 v -11.466504 1.146044 16.863190 v 11.495376 -1.063676 18.112803 v 11.495376 -1.063676 16.856623 v -11.466496 -0.316937 18.836117 v -11.466500 0.399306 18.836117 v -7.083487 -1.365960 19.095119 v -7.677632 0.041185 19.095119 v -7.072903 1.426706 19.095119 v -4.502884 -1.344338 19.095119 v -5.809732 -1.859078 19.095119 v -5.809736 1.941448 19.095119 v 7.181937 -1.323244 19.095119 v 5.821898 -1.875427 19.095119 v 4.604730 -1.447808 19.095119 v 7.039059 1.534650 19.095119 v 7.683243 0.041183 19.095119 v 4.461857 1.401135 19.095119 v 5.821892 1.957794 19.095119 v 1.343374 1.433156 19.095119 v 1.909115 0.041184 19.095119 v 1.270201 0.041184 20.184601 v 3.960549 0.041184 19.095119 v 6.726779 -0.866618 20.184601 v 5.821898 -1.234005 20.184601 v 0.893794 0.967312 20.184601 v 7.060315 0.041183 20.184601 v -1.343374 -1.350787 19.095119 v -0.893794 -0.884943 20.184601 v -4.938448 -0.880653 20.184601 v 6.631717 1.034839 20.184601 v -1.343374 1.433156 19.095119 v 0.000000 2.019362 19.095119 v -1.909115 0.041184 19.095119 v -5.807940 -1.223127 20.184601 v -7.050719 0.041185 20.184601 v -6.648371 0.963021 20.184601 v -0.893794 0.967312 20.184601 v 0.000000 1.357335 20.184601 v -5.807940 0.041185 20.184601 v 5.821896 0.041183 20.184601 v 5.821893 1.316372 20.184601 v -6.655414 -0.895038 20.184601 v -5.807942 1.305497 20.184601 v 5.012073 -0.949495 20.184601 v 4.583476 0.041184 20.184601 v 4.917015 0.946007 20.184601 v 0.000000 0.041184 20.184601 v -1.270201 0.041184 20.184601 v -0.012051 -3.384115 -5.571629 v -0.012049 -3.384117 -3.840661 v -0.012050 -6.229169 -4.709375 v 1.284377 -3.384113 -4.716390 vn 0.2363 -0.2902 -0.9273 vn -0.3685 -0.3002 -0.8798 vn -0.8230 -0.5608 -0.0903 vn 0.0284 -0.4538 -0.8907 vn 0.6050 -0.1097 -0.7887 vn 0.2724 -0.9159 -0.2949 vn 0.4562 -0.5013 -0.7352 vn 0.2724 0.9159 -0.2949 vn 0.6050 0.1097 -0.7887 vn 0.4562 0.5013 -0.7352 vn -0.2724 -0.9159 -0.2949 vn -0.4562 -0.5013 -0.7352 vn 0.3249 -0.7195 -0.6137 vn -0.8798 -0.2841 0.3812 vn -0.4152 -0.8285 0.3757 vn -0.2573 -0.4973 0.8286 vn -0.5277 -0.1564 0.8349 vn 0.3249 0.7195 -0.6137 vn -0.1930 0.9812 -0.0002 vn -0.8303 0.5573 -0.0002 vn -0.7306 0.4501 0.5134 vn -0.2189 0.7015 0.6782 vn 0.8299 -0.5578 -0.0000 vn 0.8299 0.5578 0.0000 vn 0.7302 0.4507 0.5135 vn 0.7302 -0.4507 0.5135 vn -0.0155 -0.9101 -0.4141 vn -0.2667 -0.9638 0.0006 vn -0.1930 -0.9812 -0.0002 vn 0.1924 0.9813 0.0000 vn 0.2177 0.7020 0.6781 vn 0.1924 -0.9813 -0.0000 vn 0.2177 -0.7020 0.6781 vn -0.8303 -0.5573 -0.0002 vn -0.2189 -0.7015 0.6782 vn -0.7306 -0.4501 0.5134 vn 0.6635 0.4429 -0.6030 vn 0.6648 -0.4450 -0.6000 vn 0.4536 -0.1779 -0.8733 vn 0.4543 0.1756 -0.8734 vn -0.2629 0.5949 0.7596 vn 0.2632 0.5953 0.7592 vn -0.2629 -0.5949 0.7596 vn -0.7375 -0.2567 0.6247 vn 0.7373 0.2576 0.6245 vn -0.6639 -0.4422 -0.6031 vn -0.6651 0.4443 -0.6001 vn -0.4536 0.1778 -0.8733 vn -0.4542 -0.1756 -0.8734 vn 0.7373 -0.2576 0.6245 vn 0.1442 -0.7276 -0.6706 vn 0.2361 -0.4874 -0.8407 vn -0.1450 -0.7276 -0.6705 vn -0.2362 -0.4881 -0.8402 vn -0.1934 0.9811 0.0000 vn -0.8305 0.5570 0.0000 vn -0.6640 0.4453 0.6006 vn -0.1442 0.7318 0.6661 vn -0.7685 0.6070 -0.2026 vn -0.8047 0.2645 -0.5315 vn -0.8038 -0.2674 -0.5314 vn -0.7674 -0.6080 -0.2036 vn -0.7698 -0.6066 0.1986 vn -0.8090 -0.2679 0.5233 vn -0.8099 0.2649 0.5233 vn -0.7709 0.6056 0.1975 vn -0.1934 -0.9811 -0.0000 vn 0.1435 -0.7318 0.6663 vn -0.1442 -0.7318 0.6661 vn 0.8299 0.5579 0.0000 vn 0.1435 0.7318 0.6663 vn 0.6636 0.4461 0.6005 vn 0.6637 -0.4461 0.6005 vn -0.8305 -0.5570 -0.0000 vn -0.6640 -0.4454 0.6006 vn -1.0000 -0.0000 0.0000 vn -0.9192 -0.1402 -0.3680 vn -0.9189 0.1394 -0.3691 vn 0.0000 -0.5135 0.8581 vn 0.2799 -0.2746 0.9199 vn 0.4140 -0.3999 0.8178 vn 0.0000 -0.5755 0.8178 vn 0.5252 -0.0026 0.8510 vn 0.2683 0.2742 0.9235 vn 0.4106 0.4132 0.8128 vn 0.5814 -0.0036 0.8136 vn -0.7375 0.2567 0.6247 vn -0.2344 0.4871 -0.8413 vn 0.2632 -0.5953 0.7592 vn 0.2339 0.4886 -0.8406 vn 0.1449 0.7283 -0.6698 vn -0.0123 -0.9175 0.3975 vn -0.1422 0.7290 -0.6696 vn -0.1928 0.9812 -0.0002 vn -0.8302 0.5575 -0.0002 vn 0.7559 -0.4515 -0.4741 vn 0.7559 0.4515 -0.4741 vn -0.8458 -0.2018 -0.4938 vn -0.8458 0.2018 -0.4938 vn -0.8302 -0.5575 -0.0002 vn -0.1928 -0.9812 -0.0002 vn -0.8020 0.5926 -0.0747 vn -0.7948 -0.6068 -0.0002 vn 0.8281 -0.5116 0.2292 vn 0.8281 -0.5116 -0.2292 vn 0.6617 -0.7027 -0.2613 vn 0.6617 -0.7027 0.2613 vn -0.6878 -0.2857 -0.6673 vn -0.6878 0.2856 -0.6673 vn 0.8458 0.2018 0.4938 vn 0.8458 -0.2018 0.4938 vn 0.6878 -0.2856 0.6673 vn 0.6878 0.2857 0.6673 vn -0.8281 -0.5116 0.2292 vn -0.8281 -0.5116 -0.2292 vn -0.6617 -0.7027 0.2613 vn -0.6617 -0.7027 -0.2613 vn 0.8281 0.5116 -0.2292 vn 0.8281 0.5116 0.2292 vn 0.6617 0.7027 0.2613 vn 0.6617 0.7027 -0.2613 vn 1.0000 0.0000 -0.0000 vn -0.8281 0.5116 0.2292 vn -0.8281 0.5116 -0.2292 vn -0.6617 0.7027 -0.2613 vn -0.6617 0.7027 0.2613 vn -0.8458 -0.2018 0.4938 vn -0.8458 0.2018 0.4938 vn -0.6878 0.2856 0.6673 vn -0.6878 -0.2857 0.6673 vn 0.6878 -0.2856 -0.6673 vn 0.6878 0.2857 -0.6673 vn 0.8458 -0.2018 -0.4938 vn 0.8458 0.2018 -0.4938 vn -0.8798 0.2841 -0.3812 vn -0.4152 0.8285 -0.3757 vn -0.2573 0.4973 -0.8286 vn -0.5277 0.1564 -0.8349 vn 0.4801 -0.4483 -0.7540 vn 0.6736 -0.1623 -0.7210 vn 0.4801 0.4483 -0.7540 vn 0.0743 0.4958 -0.8652 vn 0.6736 0.1623 -0.7210 vn -0.3269 0.2115 -0.9211 vn -0.3269 -0.2115 -0.9211 vn 0.0743 -0.4958 -0.8652 vn 0.3715 -0.8656 -0.3356 vn -0.4152 -0.8285 -0.3757 vn -0.2573 -0.4973 -0.8286 vn 0.2106 -0.5123 -0.8326 vn 0.3715 0.8656 -0.3356 vn 0.8770 0.3622 -0.3156 vn 0.5213 0.2066 -0.8280 vn 0.2106 0.5123 -0.8326 vn 0.5213 -0.2066 -0.8280 vn -0.5277 -0.1564 -0.8349 vn -0.8798 -0.2841 -0.3812 vn 0.8770 -0.3622 -0.3156 vn -0.3269 0.2115 0.9211 vn 0.0743 0.4958 0.8652 vn 0.3286 -0.0000 0.9445 vn 0.3285 -0.0001 0.9445 vn 0.3715 0.8656 0.3356 vn -0.4152 0.8285 0.3757 vn -0.2573 0.4973 0.8286 vn 0.2106 0.5123 0.8326 vn 0.3715 -0.8656 0.3356 vn 0.8770 -0.3622 0.3156 vn 0.5213 -0.2066 0.8280 vn 0.2106 -0.5123 0.8326 vn 0.5213 0.2066 0.8280 vn -0.5277 0.1564 0.8349 vn -0.8798 0.2841 0.3812 vn 0.8770 0.3622 0.3156 vn -0.3269 -0.2114 0.9211 vn 0.0751 -0.4960 0.8651 vn 0.5049 0.5846 0.6351 vn 0.0572 -0.2186 -0.9741 vn -0.2724 0.9159 -0.2949 vn -0.8761 0.2426 -0.4167 vn -0.4562 0.5013 -0.7352 vn 0.6737 0.1624 0.7210 vn -0.2917 -0.8347 -0.4672 vn 0.3287 0.0001 0.9444 vn 0.4496 -0.1304 -0.8837 vn -0.8413 -0.2223 -0.4927 vn -0.3249 0.7195 -0.6138 vn -0.4602 0.5296 -0.7125 vn 0.5966 0.4002 0.6957 vn 0.7517 0.1974 0.6293 vn -0.0634 0.6278 -0.7758 vn 0.0130 0.9192 0.3936 vn 0.3243 0.6354 0.7008 vn -0.6822 0.2088 -0.7007 vn -0.6781 0.3381 -0.6526 vn 0.6736 -0.1623 0.7210 vn 0.4956 -0.5218 0.6944 vn 0.7877 0.1131 0.6055 vn 0.3287 -0.0000 0.9445 vn 0.8778 0.3395 0.3380 vn 0.9299 0.1823 0.3194 vn -0.2866 0.8993 -0.3305 vn -0.7372 0.5877 -0.3334 vn 0.5808 0.7421 0.3345 vn 0.3372 0.3918 -0.8561 vn 0.8177 0.4666 -0.3371 vn 0.3527 0.8744 -0.3332 vn -0.8547 0.4069 -0.3223 vn 0.9316 -0.1463 -0.3327 vn -0.1274 0.9446 0.3025 vn 0.0762 0.9410 0.3298 vn 0.8361 -0.4613 -0.2969 vn 0.7051 0.2699 0.6558 vn 0.7475 0.1465 0.6479 vn -0.1469 0.4591 -0.8761 vn -0.3598 0.2931 -0.8858 vn 0.4501 0.5898 0.6705 vn 0.4089 0.2355 -0.8817 vn 0.1747 0.4435 -0.8791 vn -0.3124 0.1487 -0.9382 vn 0.4714 -0.0830 -0.8780 vn -0.1031 0.7641 0.6368 vn 0.0610 0.7608 0.6461 vn 0.3465 -0.1911 -0.9184 vn 0.0000 0.0000 -1.0000 vn 0.0046 0.3936 -0.9193 vn -0.5597 0.2218 -0.7985 vn 0.0046 -0.3936 -0.9193 vn -0.5597 -0.2217 -0.7985 vn -0.5774 0.5774 -0.5774 vn -0.5774 -0.5774 -0.5774 vn -0.3015 -0.3015 -0.9045 vn -0.3015 0.3015 -0.9045 vn -0.5435 0.2628 -0.7972 vn -0.6430 -0.7274 -0.2398 vn 0.5774 -0.5774 -0.5774 vn 0.5774 0.5774 -0.5774 vn 0.3015 0.3015 -0.9045 vn 0.3015 -0.3015 -0.9045 vn 0.5435 0.2628 -0.7972 vn 0.6430 -0.7274 -0.2398 vn -0.3685 0.3002 -0.8798 vn 0.2363 0.2902 -0.9273 vn -0.7610 0.6433 -0.0840 vn 0.1692 0.7802 -0.6022 vn -0.8936 -0.4094 -0.1842 vn -0.8960 -0.4037 0.1850 vn 0.8957 0.4022 -0.1894 vn 0.8976 0.3982 0.1890 vn 0.7642 0.6059 0.2212 vn 0.7609 0.6069 -0.2295 vn 0.9201 0.1314 0.3689 vn 0.9198 -0.1312 0.3697 vn 0.8141 -0.2463 0.5259 vn 0.8143 0.2472 0.5252 vn 0.9155 -0.1343 -0.3793 vn 0.9158 0.1345 -0.3785 vn 0.8078 0.2471 -0.5352 vn 0.8076 -0.2462 -0.5358 vn 0.7569 -0.6086 -0.2383 vn 0.7604 -0.6074 0.2298 vn -0.8978 0.3993 0.1860 vn -0.8954 0.4050 -0.1853 vn 0.8953 -0.4036 0.1884 vn 0.8934 -0.4077 -0.1887 vn -0.9222 -0.1353 0.3622 vn -0.9220 0.1346 0.3632 vn -0.2712 -0.2814 0.9205 vn -0.5252 0.0028 0.8510 vn -0.2765 0.2852 0.9177 vn 0.2734 -0.2775 0.9210 vn 0.0012 -0.5206 0.8538 vn -0.0068 0.5206 0.8538 vn 0.2755 -0.2675 0.9233 vn 0.0112 -0.5182 0.8552 vn -0.2610 -0.2841 0.9226 vn 0.2601 0.2837 0.9230 vn 0.5253 0.0130 0.8508 vn -0.2764 0.2678 0.9230 vn -0.0126 0.5182 0.8552 vn 0.2799 0.2746 0.9199 vn 0.5202 0.0000 0.8540 vn 0.5779 0.0000 0.8161 vn -0.5253 -0.0130 0.8508 vn 0.4193 -0.4030 0.8135 vn 0.0156 -0.5726 0.8197 vn 0.4140 0.3999 0.8178 vn 0.5814 0.0183 0.8134 vn -0.2799 -0.2746 0.9199 vn -0.4140 -0.3999 0.8178 vn 0.4115 -0.4120 0.8130 vn 0.4006 0.4218 0.8134 vn -0.2799 0.2746 0.9199 vn 0.0000 0.5135 0.8581 vn -0.5202 0.0000 0.8540 vn 0.0022 -0.5763 0.8172 vn -0.5850 0.0041 0.8110 vn -0.4078 0.4141 0.8138 vn -0.4140 0.3999 0.8178 vn 0.0000 0.5755 0.8178 vn -0.0000 0.0000 1.0000 vn -0.0176 0.5725 0.8197 vn -0.4070 -0.4153 0.8136 vn -0.0091 0.5763 0.8172 vn -0.4010 -0.4214 0.8134 vn -0.5816 -0.0183 0.8133 vn -0.4196 0.4027 0.8135 vn -0.5779 0.0000 0.8161 vn 0.2242 -0.9746 -0.0012 vn -0.0196 -0.9998 -0.0006 s 1 f 1//1 2//2 3//3 4//4 f 5//5 6//6 7//7 f 8//8 9//9 10//10 f 9//9 5//5 7//7 10//10 f 6//6 11//11 12//12 7//7 f 13//13 6//6 5//5 f 14//14 15//15 16//16 17//17 f 8//8 18//18 9//9 f 19//19 20//20 21//21 22//22 f 23//23 24//24 25//25 26//26 f 315//27 27//28 28//29 f 24//24 29//30 30//31 25//25 f 31//32 23//23 26//26 32//33 f 33//34 28//29 34//35 35//36 f 20//20 33//34 35//36 21//21 f 29//30 19//19 22//22 30//31 f 36//37 37//38 38//39 39//40 f 30//31 22//22 40//41 41//42 f 35//36 34//35 42//43 43//44 f 25//25 30//31 41//42 44//45 f 45//46 46//47 47//48 48//49 f 26//26 25//25 44//45 49//50 f 37//38 50//51 51//52 38//39 f 50//51 52//53 53//54 51//52 f 54//55 55//56 56//57 57//58 f 58//59 59//60 60//61 61//62 62//63 63//64 64//65 65//66 f 66//67 67//32 68//68 69//69 f 70//70 71//30 72//71 73//72 f 67//32 74//23 75//73 68//68 f 76//74 66//67 69//69 77//75 f 78//76 79//77 80//78 81//76 55//56 76//74 f 71//30 54//55 57//58 72//71 f 82//79 83//80 84//81 85//82 f 86//83 87//84 88//85 89//86 f 40//41 90//87 47//48 91//88 f 49//50 44//45 39//40 38//39 f 42//43 92//89 51//52 53//54 f 44//45 41//42 93//90 39//40 f 92//89 49//50 38//39 51//52 f 43//44 42//43 53//54 48//49 f 90//87 43//44 48//49 47//48 f 41//42 40//41 91//88 93//90 f 94//91 36//37 39//40 93//90 f 22//22 21//21 90//87 40//41 f 52//53 45//46 48//49 53//54 f 34//35 27//28 316//92 f 95//93 94//91 93//90 91//88 f 32//33 26//26 49//50 92//89 f 21//21 35//36 43//44 90//87 f 46//47 95//93 91//88 47//48 f 96//94 97//95 20//20 19//19 f 98//96 99//97 100//24 101//23 f 102//76 103//98 104//99 105//76 97//95 106//100 f 107//101 108//32 31//32 315//27 28//29 f 99//97 18//18 109//30 100//24 f 100//24 109//30 29//30 24//24 f 13//13 98//96 101//23 108//32 f 108//32 101//23 23//23 31//32 f 106//100 107//101 28//29 33//34 f 110//102 111//103 106//100 97//95 f 112//104 113//105 114//106 115//107 f 109//30 96//94 19//19 29//30 f 104//99 103//98 116//108 117//109 f 118//110 119//111 120//112 121//113 f 122//76 123//114 124//115 102//76 106//100 33//34 f 124//115 123//114 125//116 126//117 f 127//118 128//119 129//120 130//121 f 131//122 113//105 112//104 132//122 23//23 101//23 f 133//123 134//124 135//125 136//126 f 137//127 138//128 139//129 140//130 f 114//106 141//131 142//132 130//121 129//120 121//113 120//112 115//107 f 143//133 144//134 142//132 141//131 f 145//122 144//134 143//133 131//122 101//23 100//24 f 135//125 117//109 116//108 126//117 125//116 140//130 139//129 136//126 f 146//122 128//119 127//118 145//122 100//24 24//24 f 132//122 119//111 118//110 146//122 24//24 23//23 f 147//76 138//128 137//127 122//76 33//34 20//20 f 104//99 134//124 105//76 f 133//123 138//128 147//76 f 112//104 119//111 132//122 f 143//133 113//105 131//122 f 127//118 144//134 145//122 f 118//110 128//119 146//122 f 137//127 123//114 122//76 f 124//115 103//98 102//76 f 125//116 123//114 137//127 140//130 f 133//123 136//126 139//129 138//128 f 135//125 134//124 104//99 117//109 f 124//115 126//117 116//108 103//98 f 129//120 128//119 118//110 121//113 f 112//104 115//107 120//112 119//111 f 114//106 113//105 143//133 141//131 f 127//118 130//121 142//132 144//134 f 105//76 134//124 133//123 147//76 20//20 97//95 f 148//135 149//136 150//137 151//138 f 152//139 153//140 98//96 f 154//141 155//142 18//18 99//97 f 153//140 156//143 99//97 98//96 f 157//144 158//145 5//5 9//9 f 158//145 159//146 13//13 5//5 f 155//142 157//144 9//9 18//18 f 160//147 161//148 162//149 163//150 f 164//151 165//152 166//153 167//154 f 167//154 166//153 168//155 163//150 f 150//137 167//154 163//150 162//149 f 151//138 150//137 162//149 169//156 f 161//148 170//157 169//156 162//149 f 170//157 148//135 151//138 169//156 f 165//152 171//158 168//155 166//153 f 149//136 164//151 167//154 150//137 f 171//158 160//147 163//150 168//155 f 157//144 155//142 149//136 148//135 f 152//139 159//146 161//148 160//147 f 154//141 156//143 165//152 164//151 f 159//146 158//145 170//157 161//148 f 158//145 157//144 148//135 170//157 f 156//143 153//140 171//158 165//152 f 155//142 154//141 164//151 149//136 f 153//140 152//139 160//147 171//158 f 172//159 173//160 174//161 175//162 f 176//163 177//164 178//165 179//166 f 180//167 181//168 182//169 183//170 f 183//170 182//169 184//171 179//166 f 16//16 183//170 179//166 178//165 f 17//17 16//16 178//165 185//172 f 177//164 186//173 185//172 178//165 f 186//173 14//14 17//17 185//172 f 181//168 187//174 184//171 182//169 f 15//15 180//167 183//170 16//16 f 187//174 176//163 179//166 184//171 f 188//175 189//176 15//15 14//14 f 190//177 173//160 177//164 176//163 f 173//160 172//159 186//173 177//164 f 172//159 188//175 14//14 186//173 f 191//178 192//179 193//180 f 193//180 192//179 194//181 f 195//182 190//177 176//163 187//174 f 13//13 174//183 11//11 6//6 f 173//160 190//177 195//182 111//184 174//161 f 192//179 191//178 196//185 f 11//11 174//183 175//186 f 197//187 110//102 97//95 96//94 f 174//183 13//13 108//32 107//101 f 111//103 174//183 107//101 106//100 f 18//18 197//187 96//94 109//30 f 197//187 18//18 8//8 192//179 f 188//175 172//159 175//162 193//161 f 197//187 198//188 110//102 f 11//11 175//186 12//12 f 175//186 193//180 194//181 12//12 f 192//179 8//8 10//10 194//181 f 199//189 200//190 189//176 188//175 f 159//146 152//139 98//96 13//13 f 201//191 198//188 197//187 f 191//192 202//193 188//175 193//161 f 202//193 199//189 188//175 f 203//194 110//102 204//195 f 205//196 206//197 200//190 203//198 110//199 f 156//143 154//141 99//97 f 203//198 200//190 207//200 208//201 f 206//197 205//196 181//168 180//167 f 205//196 195//182 187//174 181//168 f 189//176 206//197 180//167 15//15 f 195//182 205//196 110//199 111//184 f 200//190 206//197 189//176 f 110//102 198//188 204//195 f 204//195 198//188 209//202 210//203 f 200//190 199//189 211//204 207//200 f 201//191 212//205 213//206 214//207 f 203//194 204//195 210//203 208//208 f 212//205 196//185 215//209 213//206 f 202//193 191//192 216//210 217//211 f 199//189 202//193 217//211 211//204 f 196//185 191//178 216//212 215//209 f 198//188 201//191 214//207 209//202 f 208//201 207//200 218//213 219//214 f 210//203 209//202 220//215 221//216 f 207//200 211//204 222//217 218//213 f 214//207 213//206 223//218 224//219 f 208//208 210//203 221//216 219//220 f 213//206 215//209 225//221 223//218 f 217//211 216//210 226//222 227//223 f 211//204 217//211 227//223 222//217 f 209//202 214//207 224//219 220//215 f 215//209 216//212 226//224 225//221 f 222//225 218//225 227//225 f 226//224 227//225 225//221 f 224//219 227//225 221//216 f 220//215 224//219 221//216 f 218//225 219//220 221//216 f 218//225 221//216 227//225 f 224//219 223//218 225//221 f 227//225 224//219 225//221 f 228//226 229//227 197//187 192//179 f 230//228 228//226 192//179 f 231//229 230//228 196//185 212//205 f 231//229 229//227 232//230 233//231 f 229//227 231//229 201//191 197//187 f 231//229 212//205 201//191 f 196//185 230//228 192//179 f 234//232 235//233 236//234 237//235 f 230//228 231//229 233//231 238//236 f 228//226 230//228 238//236 239//237 f 229//227 228//226 239//237 232//230 f 240//238 235//233 232//230 239//237 f 241//239 240//238 239//237 238//236 f 234//232 241//239 238//236 233//231 f 235//233 234//232 233//231 232//230 f 237//235 236//234 242//240 243//241 f 241//239 234//232 237//235 243//241 f 240//238 241//239 243//241 242//240 f 235//233 240//238 242//240 236//234 f 244//242 2//2 12//12 194//181 f 1//1 245//243 10//10 7//7 f 245//243 244//242 194//181 10//10 f 2//2 1//1 7//7 12//12 f 246//244 247//245 4//4 3//3 f 244//242 245//243 247//245 246//244 f 245//243 1//1 4//4 247//245 f 2//2 244//242 246//244 3//3 f 95//93 46//47 55//56 54//55 f 37//38 36//37 70//70 74//23 f 52//53 50//51 67//32 66//67 f 36//37 94//91 71//30 70//70 f 50//51 37//38 74//23 67//32 f 45//46 52//53 66//67 76//74 f 46//47 45//46 76//74 55//56 f 94//91 95//93 54//55 71//30 f 248//246 249//247 62//63 61//62 f 250//248 251//249 252//250 253//251 f 254//252 255//253 256//254 257//255 f 80//78 79//77 60//61 59//60 f 258//256 259//257 260//258 261//259 f 262//122 259//257 258//256 263//122 74//23 70//70 f 264//260 261//259 260//258 253//251 252//250 257//255 256//254 265//261 f 266//262 267//263 58//59 65//66 f 268//264 269//265 264//260 265//261 f 80//78 267//263 81//76 f 250//248 259//257 262//122 f 258//256 269//265 263//122 f 248//246 79//77 78//76 f 58//59 267//263 80//78 59//60 f 248//246 61//62 60//61 79//77 f 264//260 269//265 258//256 261//259 f 250//248 253//251 260//258 259//257 f 270//266 63//64 62//63 249//247 f 256//254 255//253 268//264 265//261 f 254//252 257//255 252//250 251//249 f 64//65 271//267 266//262 65//66 f 270//266 271//267 64//65 63//64 f 56//57 77//75 272//268 273//269 274//270 f 77//75 69//69 275//271 276//272 272//268 f 57//58 56//57 274//270 277//273 87//84 f 68//68 75//73 278//274 279//275 280//276 f 75//73 73//72 281//277 282//278 278//274 f 73//72 72//71 283//279 284//280 281//277 f 83//80 68//68 280//276 f 72//71 285//281 283//279 f 83//80 286//282 287//283 84//81 f 285//281 286//282 83//80 280//276 288//284 283//279 f 279//275 278//274 289//285 290//286 f 286//282 285//281 291//287 287//283 f 278//274 282//278 292//288 289//285 f 293//289 82//79 85//82 294//290 f 275//271 86//83 89//86 295//291 f 282//278 281//277 296//292 292//288 f 75//73 255//253 254//252 73//72 f 56//57 271//267 270//266 77//75 f 263//122 269//265 268//264 75//73 74//23 f 81//76 267//263 266//262 56//57 55//56 f 73//72 251//249 250//248 262//122 70//70 f 77//75 249//247 248//246 78//76 76//74 f 270//266 249//247 77//75 f 266//262 271//267 56//57 f 254//252 251//249 73//72 f 268//264 255//253 75//73 f 297//293 57//58 87//84 f 72//71 57//58 297//293 298//294 285//281 f 69//69 68//68 83//80 82//79 293//289 f 293//289 299//295 297//293 87//84 86//83 275//271 f 69//69 293//289 275//271 f 276//272 275//271 295//291 300//296 f 274//270 273//269 301//297 302//298 f 298//294 297//293 303//299 304//300 f 305//301 300//296 295//291 89//86 f 306//301 292//288 296//292 307//302 f 301//297 308//303 300//296 305//301 f 302//298 301//297 305//301 309//304 f 309//304 305//301 89//86 88//85 f 290//286 289//285 292//288 306//301 f 310//305 290//286 306//301 311//306 f 311//306 306//301 307//302 312//307 f 313//301 314//308 294//290 85//82 f 287//283 313//301 85//82 84//81 f 291//287 304//300 313//301 287//283 f 304//300 303//299 314//308 313//301 f 283//279 288//284 311//306 312//307 f 277//273 274//270 302//298 309//304 f 87//84 277//273 309//304 88//85 f 297//293 299//295 314//308 303//299 f 281//277 284//280 307//302 296//292 f 284//280 283//279 312//307 307//302 f 285//281 298//294 304//300 291//287 f 288//284 280//276 310//305 311//306 f 299//295 293//289 294//290 314//308 f 273//269 272//268 308//303 301//297 f 280//276 279//275 290//286 310//305 f 272//268 276//272 300//296 308//303 f 34//35 316//92 32//33 f 42//43 34//35 32//33 92//89 f 318//309 315//27 31//32 f 31//32 32//33 318//309 f 34//35 28//29 27//28 f 316//92 318//309 32//33 f 316//92 27//28 317//310 f 317//310 315//27 318//309 f 27//28 315//27 317//310 f 316//92 317//310 318//309
{ "pile_set_name": "Github" }
/*M/////////////////////////////////////////////////////////////////////////////////////// // // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. // // By downloading, copying, installing or using the software you agree to this license. // If you do not agree to this license, do not download, install, // copy or use the software. // // // License Agreement // For Open Source Computer Vision Library // // Copyright (C) 2013, OpenCV Foundation, all rights reserved. // Third party copyrights are property of their respective owners. // // Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met: // // * Redistribution's of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistribution's in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * The name of the copyright holders may not be used to endorse or promote products // derived from this software without specific prior written permission. // // This software is provided by the copyright holders and contributors "as is" and // any express or implied warranties, including, but not limited to, the implied // warranties of merchantability and fitness for a particular purpose are disclaimed. // In no event shall the Intel Corporation or contributors be liable for any direct, // indirect, incidental, special, exemplary, or consequential damages // (including, but not limited to, procurement of substitute goods or services; // loss of use, data, or profits; or business interruption) however caused // and on any theory of liability, whether in contract, strict liability, // or tort (including negligence or otherwise) arising in any way out of // the use of this software, even if advised of the possibility of such damage. // //M*/ #ifndef OPENCV_DNN_HPP #define OPENCV_DNN_HPP // This is an umbrealla header to include into you project. // We are free to change headers layout in dnn subfolder, so please include // this header for future compatibility /** @defgroup dnn Deep Neural Network module @{ This module contains: - API for new layers creation, layers are building bricks of neural networks; - set of built-in most-useful Layers; - API to constuct and modify comprehensive neural networks from layers; - functionality for loading serialized networks models from differnet frameworks. Functionality of this module is designed only for forward pass computations (i. e. network testing). A network training is in principle not supported. @} */ #include <opencv2/dnn/dnn.hpp> #endif /* OPENCV_DNN_HPP */
{ "pile_set_name": "Github" }
module.exports = { 'camelCase': require('./string/camelCase'), 'capitalize': require('./string/capitalize'), 'deburr': require('./string/deburr'), 'endsWith': require('./string/endsWith'), 'escape': require('./string/escape'), 'escapeRegExp': require('./string/escapeRegExp'), 'kebabCase': require('./string/kebabCase'), 'pad': require('./string/pad'), 'padLeft': require('./string/padLeft'), 'padRight': require('./string/padRight'), 'parseInt': require('./string/parseInt'), 'repeat': require('./string/repeat'), 'snakeCase': require('./string/snakeCase'), 'startCase': require('./string/startCase'), 'startsWith': require('./string/startsWith'), 'template': require('./string/template'), 'templateSettings': require('./string/templateSettings'), 'trim': require('./string/trim'), 'trimLeft': require('./string/trimLeft'), 'trimRight': require('./string/trimRight'), 'trunc': require('./string/trunc'), 'unescape': require('./string/unescape'), 'words': require('./string/words') };
{ "pile_set_name": "Github" }
import _ from 'lodash'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { inputTypes } from 'Helpers/Props'; import Button from 'Components/Link/Button'; import Form from 'Components/Form/Form'; import FormGroup from 'Components/Form/FormGroup'; import FormLabel from 'Components/Form/FormLabel'; import FormInputGroup from 'Components/Form/FormInputGroup'; import ModalContent from 'Components/Modal/ModalContent'; import ModalHeader from 'Components/Modal/ModalHeader'; import ModalBody from 'Components/Modal/ModalBody'; import ModalFooter from 'Components/Modal/ModalFooter'; const posterSizeOptions = [ { key: 'small', value: 'Small' }, { key: 'medium', value: 'Medium' }, { key: 'large', value: 'Large' } ]; class SeriesIndexOverviewOptionsModalContent extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { detailedProgressBar: props.detailedProgressBar, size: props.size, showMonitored: props.showMonitored, showNetwork: props.showNetwork, showQualityProfile: props.showQualityProfile, showPreviousAiring: props.showPreviousAiring, showAdded: props.showAdded, showSeasonCount: props.showSeasonCount, showPath: props.showPath, showSizeOnDisk: props.showSizeOnDisk, showSearchAction: props.showSearchAction }; } componentDidUpdate(prevProps) { const { detailedProgressBar, size, showMonitored, showNetwork, showQualityProfile, showPreviousAiring, showAdded, showSeasonCount, showPath, showSizeOnDisk, showSearchAction } = this.props; const state = {}; if (detailedProgressBar !== prevProps.detailedProgressBar) { state.detailedProgressBar = detailedProgressBar; } if (size !== prevProps.size) { state.size = size; } if (showMonitored !== prevProps.showMonitored) { state.showMonitored = showMonitored; } if (showNetwork !== prevProps.showNetwork) { state.showNetwork = showNetwork; } if (showQualityProfile !== prevProps.showQualityProfile) { state.showQualityProfile = showQualityProfile; } if (showPreviousAiring !== prevProps.showPreviousAiring) { state.showPreviousAiring = showPreviousAiring; } if (showAdded !== prevProps.showAdded) { state.showAdded = showAdded; } if (showSeasonCount !== prevProps.showSeasonCount) { state.showSeasonCount = showSeasonCount; } if (showPath !== prevProps.showPath) { state.showPath = showPath; } if (showSizeOnDisk !== prevProps.showSizeOnDisk) { state.showSizeOnDisk = showSizeOnDisk; } if (showSearchAction !== prevProps.showSearchAction) { state.showSearchAction = showSearchAction; } if (!_.isEmpty(state)) { this.setState(state); } } // // Listeners onChangeOverviewOption = ({ name, value }) => { this.setState({ [name]: value }, () => { this.props.onChangeOverviewOption({ [name]: value }); }); } // // Render render() { const { onModalClose } = this.props; const { detailedProgressBar, size, showMonitored, showNetwork, showQualityProfile, showPreviousAiring, showAdded, showSeasonCount, showPath, showSizeOnDisk, showSearchAction } = this.state; return ( <ModalContent onModalClose={onModalClose}> <ModalHeader> Overview Options </ModalHeader> <ModalBody> <Form> <FormGroup> <FormLabel>Poster Size</FormLabel> <FormInputGroup type={inputTypes.SELECT} name="size" value={size} values={posterSizeOptions} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Detailed Progress Bar</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="detailedProgressBar" value={detailedProgressBar} helpText="Show text on progess bar" onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Monitored</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showMonitored" value={showMonitored} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Network</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showNetwork" value={showNetwork} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Quality Profile</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showQualityProfile" value={showQualityProfile} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Previous Airing</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showPreviousAiring" value={showPreviousAiring} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Date Added</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showAdded" value={showAdded} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Season Count</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showSeasonCount" value={showSeasonCount} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Path</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showPath" value={showPath} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Size on Disk</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showSizeOnDisk" value={showSizeOnDisk} onChange={this.onChangeOverviewOption} /> </FormGroup> <FormGroup> <FormLabel>Show Search</FormLabel> <FormInputGroup type={inputTypes.CHECK} name="showSearchAction" value={showSearchAction} helpText="Show search button on hover" onChange={this.onChangeOverviewOption} /> </FormGroup> </Form> </ModalBody> <ModalFooter> <Button onPress={onModalClose} > Close </Button> </ModalFooter> </ModalContent> ); } } SeriesIndexOverviewOptionsModalContent.propTypes = { size: PropTypes.string.isRequired, detailedProgressBar: PropTypes.bool.isRequired, showMonitored: PropTypes.bool.isRequired, showNetwork: PropTypes.bool.isRequired, showQualityProfile: PropTypes.bool.isRequired, showPreviousAiring: PropTypes.bool.isRequired, showAdded: PropTypes.bool.isRequired, showSeasonCount: PropTypes.bool.isRequired, showPath: PropTypes.bool.isRequired, showSizeOnDisk: PropTypes.bool.isRequired, showSearchAction: PropTypes.bool.isRequired, onChangeOverviewOption: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default SeriesIndexOverviewOptionsModalContent;
{ "pile_set_name": "Github" }
using cloudscribe.Multitenancy; namespace Microsoft.AspNetCore.Http { /// <summary> /// Multitenant extensions for <see cref="HttpContext"/>. /// </summary> public static class MultitenancyHttpContextExtensions { private const string TenantContextKey = "cloudscribe.TenantContext"; public static void SetTenantContext<TTenant>(this HttpContext context, TenantContext<TTenant> tenantContext) { Ensure.Argument.NotNull(context, nameof(context)); Ensure.Argument.NotNull(tenantContext, nameof(tenantContext)); context.Items[TenantContextKey] = tenantContext; } public static TenantContext<TTenant> GetTenantContext<TTenant>(this HttpContext context) { Ensure.Argument.NotNull(context, nameof(context)); object tenantContext; if (context.Items.TryGetValue(TenantContextKey, out tenantContext)) { return tenantContext as TenantContext<TTenant>; } return null; } public static TTenant GetTenant<TTenant>(this HttpContext context) { Ensure.Argument.NotNull(context, nameof(context)); var tenantContext = GetTenantContext<TTenant>(context); if (tenantContext != null) { return tenantContext.Tenant; } return default(TTenant); } } }
{ "pile_set_name": "Github" }
# -*- encoding : utf-8 -*- # ClientSideValidations Initializer # Uncomment to disable uniqueness validator, possible security issue # ClientSideValidations::Config.disabled_validators = [:uniqueness] # Uncomment to validate number format with current I18n locale # ClientSideValidations::Config.number_format_with_locale = true # Uncomment the following block if you want each input field to have the validation messages attached. ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| unless html_tag =~ /^<label/ %{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe else %{<div class="field_with_errors">#{html_tag}</div>}.html_safe end end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" ?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.0"> <office:scripts /> <office:font-face-decls> <style:font-face style:name="Times New Roman" svg:font-family="&apos;Times New Roman&apos;" style:font-family-generic="roman" style:font-pitch="variable" /> <style:font-face style:name="Lucida Sans Unicode" svg:font-family="&apos;Lucida Sans Unicode&apos;" style:font-family-generic="system" style:font-pitch="variable" /> <style:font-face style:name="Tahoma" svg:font-family="Tahoma" style:font-family-generic="system" style:font-pitch="variable" /> </office:font-face-decls> <office:automatic-styles /> <office:body> <office:text> <office:forms form:automatic-focus="false" form:apply-design-mode="false" /> <text:sequence-decls> <text:sequence-decl text:display-outline-level="0" text:name="Illustration" /> <text:sequence-decl text:display-outline-level="0" text:name="Table" /> <text:sequence-decl text:display-outline-level="0" text:name="Text" /> <text:sequence-decl text:display-outline-level="0" text:name="Drawing" /> </text:sequence-decls> <text:p text:style-name="Standard">Some text</text:p> </office:text> </office:body> </office:document-content>
{ "pile_set_name": "Github" }
--- title: 保護された Web API アプリを構成する |Microsoft titleSuffix: Microsoft identity platform description: 保護された Web API をビルドして、アプリケーションのコードを構成する方法について学習します。 services: active-directory author: jmprieur manager: CelesteDG ms.service: active-directory ms.subservice: develop ms.topic: conceptual ms.workload: identity ms.date: 07/15/2020 ms.author: jmprieur ms.custom: aaddev ms.openlocfilehash: 50de800c94bd0a65fafcff3ef6613d6f063a3797 ms.sourcegitcommit: b33c9ad17598d7e4d66fe11d511daa78b4b8b330 ms.translationtype: HT ms.contentlocale: ja-JP ms.lasthandoff: 08/25/2020 ms.locfileid: "88855486" --- # <a name="protected-web-api-code-configuration"></a>保護された Web API: コード構成 保護された Web API のコードを構成するには、次の点を理解しておく必要があります。 - API を保護対象として定義するもの - ベアラー トークンの構成方法 - トークンの検証方法 ## <a name="what-defines-aspnet-and-aspnet-core-apis-as-protected"></a>ASP.NET と ASP.NET Core の API を保護対象として定義するものとは Web アプリと同じように、ASP.NET と ASP.NET Core の Web API は、そのコントローラー アクションに **[Authorize]** 属性のプレフィックスがあるため、保護されています。 コントローラー アクションは、承認されている ID で API が呼び出された場合にのみ呼び出すことができます。 次の質問について考えてみましょう。 - Web API を呼び出せるのはアプリのみです。 API では、呼び出し元のアプリの ID をどのように認識しますか? - ユーザーの代わりにアプリで API が呼び出される場合、ユーザーの ID は何ですか? ## <a name="bearer-token"></a>ベアラー トークン アプリが呼び出されたときにヘッダーに設定されるベアラー トークンには、アプリ ID に関する情報が保持されます。 また、Web アプリがデーモン アプリからのサービス間の呼び出しを受け入れる場合を除き、ユーザーに関する情報も保持されます。 以下は、.NET 用 Microsoft Authentication Library (MSAL.NET) を使用してトークンを取得した後、API を呼び出すクライアントを示す C# コードの例です。 ```csharp var scopes = new[] {$"api://.../access_as_user"}; var result = await app.AcquireToken(scopes) .ExecuteAsync(); httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result.AccessToken); // Call the web API. HttpResponseMessage response = await _httpClient.GetAsync(apiUri); ``` > [!IMPORTANT] > クライアント アプリケーションにより、"*Web API の*" Microsoft ID プラットフォーム エンドポイントにベアラー トークンが要求されます。 Web API は、トークンを検証し、含まれている要求を表示する必要がある唯一のアプリケーションです。 クライアント アプリで、トークンの要求を検査してみることはできません > > 将来、Web API で、トークンの暗号化が要求される可能性があります。 この要件により、アクセス トークンを表示できるクライアント アプリのアクセスが禁止されます。 ## <a name="jwtbearer-configuration"></a>JwtBearer の構成 このセクションでは、ベアラー トークンの構成方法について説明します。 ### <a name="config-file"></a>config ファイル ```Json { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "ClientId": "[Client_id-of-web-api-eg-2ec40e65-ba09-4853-bcde-bcb60029e596]", /* You need specify the TenantId only if you want to accept access tokens from a single tenant (line-of-business app). Otherwise, you can leave them set to common. This can be: - A GUID (Tenant ID = Directory ID) - 'common' (any organization and personal accounts) - 'organizations' (any organization) - 'consumers' (Microsoft personal accounts) */ "TenantId": "common" }, "Logging": { "LogLevel": { "Default": "Warning" } }, "AllowedHosts": "*" } ``` #### <a name="case-where-you-used-a-custom-app-id-uri-for-your-web-api"></a>Web API にカスタム アプリ ID URI を使用したケース アプリ登録ポータルによって提案されたアプリ ID URI を受け入れた場合は、対象ユーザーを指定する必要はありません (「[アプリケーション ID の URI とスコープ](scenario-protected-web-api-app-registration.md#application-id-uri-and-scopes)」を参照してください)。 それ以外の場合は、Web API のアプリ ID URI を値とする `Audience` プロパティを追加する必要があります。 ```Json { "AzureAd": { "Instance": "https://login.microsoftonline.com/", "ClientId": "[Client_id-of-web-api-eg-2ec40e65-ba09-4853-bcde-bcb60029e596]", "TenantId": "common", "Audience": "custom App ID URI for your web API" }, // more lines } ``` ### <a name="code-initialization"></a>コードの初期化 **[Authorize]** 属性を保持するコントローラー アクションでアプリが呼び出されると、ASP.NET と ASP.NET Core により、Authorization ヘッダーのベアラー トークンからアクセス トークンが抽出されます。 その後、アクセス トークンは JwtBearer ミドルウェアに転送され、Microsoft IdentityModel Extensions for .NET が呼び出されます。 #### <a name="using-microsoftidentityweb-templates"></a>Microsoft.Identity.Web テンプレートを使用する Microsoft.Identity.Web プロジェクト テンプレートを使用して、Web API を最初から作成できます。 詳細については、「[Microsoft.Identity.Web - Web API プロジェクト テンプレート](https://aka.ms/ms-id-web/webapi-project-templates)」を参照してください。 #### <a name="starting-from-an-existing-aspnet-core-31-application"></a>既存の ASP.NET Core 3.1 アプリケーションから開始する 現在、ASP.NET Core 3.1 では、Microsoft.AspNetCore.AzureAD.UI ライブラリが使用されています。 このミドルウェアは Startup.cs ファイルで初期化されます。 ```csharp using Microsoft.AspNetCore.Authentication.JwtBearer; ``` この命令によって、ミドルウェアが Web API に追加されます。 ```csharp // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddAuthentication(AzureADDefaults.JwtBearerAuthenticationScheme) .AddAzureADBearer(options => Configuration.Bind("AzureAd", options)); } ``` 現在、ASP.NET Core テンプレートでは、ご自分の組織または任意の組織内のユーザーのサインインを行う、Azure Active Directory (Azure AD) Web API が作成されます。 個人アカウントを使用してユーザーをサインインさせることはありません。 ただし、NuGet パッケージとして使用可能な [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) を使用して *Startup.cs* 内のコードを置き換えることで、Microsoft ID プラットフォーム エンドポイントを使用するようにテンプレートを変更できます。 ```csharp using Microsoft.Identity.Web; ``` ```csharp public void ConfigureServices(IServiceCollection services) { // Adds Microsoft Identity platform (AAD v2.0) support to protect this API services.AddMicrosoftIdentityWebApiAuthentication(Configuration, "AzureAd"); services.AddControllers(); } ``` また、次のように記述することもできます (こちらも同等です) ```csharp public void ConfigureServices(IServiceCollection services) { // Adds Microsoft Identity platform (AAD v2.0) support to protect this API services.AddMicrosoftIdentityWebApiAuthentication(Configuration, "AzureAd"); services.AddControllers(); } ``` > [!NOTE] > Microsoft.Identity.Web を使用し、*appsettings.json*内に `Audience` を設定しない場合、次が使用されます。 > - `$"{ClientId}"`。[アクセス トークンで承認されたバージョン](scenario-protected-web-api-app-registration.md#accepted-token-version)を `2` に設定している場合、または Azure AD B2C Web API の場合。 > - `$"api://{ClientId}`。その他すべての場合 (v1.0 [アクセス トークン](access-tokens.md)の場合)。 > 詳細については、Microsoft.Identity.Web の[ソース コード](https://github.com/AzureAD/microsoft-identity-web/blob/d2ad0f5f830391a34175d48621a2c56011a45082/src/Microsoft.Identity.Web/Resource/RegisterValidAudience.cs#L70-L83)を参照してください。 上記のコード スニペットは、[ASP.NET Core Web API の増分チュートリアル](https://github.com/Azure-Samples/active-directory-dotnet-native-aspnetcore-v2/blob/63087e83326e6a332d05fee6e1586b66d840b08f/1.%20Desktop%20app%20calls%20Web%20API/TodoListService/Startup.cs#L23-L28)から引用されています。 **AddMicrosoftIdentityWebApiAuthentication** に関する詳細については [Microsoft.Identity.Web](https://github.com/AzureAD/microsoft-identity-web/blob/d2ad0f5f830391a34175d48621a2c56011a45082/src/Microsoft.Identity.Web/WebApiExtensions/WebApiServiceCollectionExtensions.cs#L27) を参照してください。 このメソッドにより [AddMicrosoftWebAPI](https://github.com/AzureAD/microsoft-identity-web/blob/d2ad0f5f830391a34175d48621a2c56011a45082/src/Microsoft.Identity.Web/WebApiExtensions/WebApiAuthenticationBuilderExtensions.cs#L58) が呼び出されます。これ自体がトークンの検証方法をミドルウェアに指示します。 詳細については、その[ソース コード](https://github.com/AzureAD/microsoft-identity-web/blob/d2ad0f5f830391a34175d48621a2c56011a45082/src/Microsoft.Identity.Web/WebApiExtensions/WebApiAuthenticationBuilderExtensions.cs#L104-L122)を参照してください。 ## <a name="token-validation"></a>トークンの検証 前のスニペットでは、Web アプリの OpenID Connect ミドルウェアと同様に、JwtBearer ミドルウェアによって `TokenValidationParameters` の値に基づいてトークンが検証されます。 トークンは必要に応じて暗号化が解除され、要求が抽出され、署名が検証されます。 その後、ミドルウェアでは、このデータを調べてトークンを確認します。 - Audience:トークンが Web API のターゲットとなっていること。 - サブ:Web API の呼び出しが許可されているアプリに対して発行されたこと。 - 発行者:信頼できるセキュリティ トークン サービス (STS) によって発行されたこと。 - 有効期限:有効期間が範囲内であること。 - 署名:改ざんされていないこと。 特別な検証もできます。 たとえば、署名キー (トークンに埋め込まれている場合) が信頼されていること、およびトークンが再生されていないことを確認することができます。 最後に、一部のプロトコルでは、特定の検証が必要です。 ### <a name="validators"></a>検証コントロール 確認手順は、検証コントロールでキャプチャされます。これらは [Microsoft IdentityModel Extensions for .NET](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet) のオープン ソース ライブラリで提供されています。 検証コントロールは、ライブラリ ソース ファイル [Microsoft.IdentityModel.Tokens/Validators.cs](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/master/src/Microsoft.IdentityModel.Tokens/Validators.cs) で定義されています。 次の表では、検証コントロールについて説明します。 | 検証コントロール | 説明 | |---------|---------| | **ValidateAudience** | トークンが、自分のトークンを確認するアプリケーション用であることを保証します。 | | **ValidateIssuer** | トークンが信頼できる STS、つまり自分が信頼する人から発行されたことを保証します。 | | **ValidateIssuerSigningKey** | トークンを確認するアプリケーションで、トークンの署名に使用されたキーが信頼されていることを保証します キーがトークンに埋め込まれている特殊なケースがあります。 ただし、このケースは通常は発生しません。 | | **ValidateLifetime** | トークンが引き続きまたは既に有効であることを保証します。 検証コントロールにより、トークンの有効期間が **notbefore** 要求と **expires** 要求で指定された範囲内にあるかどうかが確認されます。 | | **ValidateSignature** | トークンが改ざんされていないことを保証します。 | | **ValidateTokenReplay** | トークンが再生されていないことを保証します 一部の 1 回限りの使用のプロトコルには特殊なケースがあります。 | #### <a name="customizing-token-validation"></a>トークンの検証のカスタマイズ 検証コントロールは、**TokenValidationParameters** クラスのプロパティに関連付けられています。 このプロパティは、ASP.NET と ASP.NET Core の構成から初期化されます。 ほとんどの場合、パラメーターを変更する必要はありません。 シングル テナントではないアプリは例外です。 これらの Web アプリでは、任意の組織から、または個人用 Microsoft アカウントからのユーザーを受け入れます。 この場合、発行者を検証する必要があります。 Microsoft.Identity.Web では発行者の検証も行われます。 詳細については、Microsoft.Identity.Web の [AadIssuerValidator](https://github.com/AzureAD/microsoft-identity-web/blob/master/src/Microsoft.Identity.Web/Resource/AadIssuerValidator.cs) を参照してください。 ASP.NET Core で、トークン検証パラメーターをカスタマイズする場合は、*Startup.cs* で次のスニペットを使用します。 ```c# services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddMicrosoftIdentityWebApi(Configuration); services.Configure<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme, options => { var existingOnTokenValidatedHandler = options.Events.OnTokenValidated; options.Events.OnTokenValidated = async context => { await existingOnTokenValidatedHandler(context); // Your code to add extra configuration that will be executed after the current event implementation. options.TokenValidationParameters.ValidIssuers = new[] { /* list of valid issuers */ }; options.TokenValidationParameters.ValidAudiences = new[] { /* list of valid audiences */}; } }); ``` ASP.NET MVC の場合、次のコード サンプルにカスタム トークンの検証を行う方法が示されています。 https://github.com/azure-samples/active-directory-dotnet-webapi-manual-jwt-validation ## <a name="token-validation-in-azure-functions"></a>Azure Functions でのトークンの検証 Azure Functions では、受信アクセス トークンを検証することもできます。 このような検証の例については、GitHub の次のコード サンプルを参照してください。 - .NET:[Azure-Samples/ms-identity-dotnet-webapi-azurefunctions](https://github.com/Azure-Samples/ms-identity-dotnet-webapi-azurefunctions) - Node.js:[Azure-Samples/ms-identity-nodejs-webapi-azurefunctions](https://github.com/Azure-Samples/ms-identity-nodejs-webapi-azurefunctions) - Python: [Azure-Samples/ms-identity-python-webapi-azurefunctions)](https://github.com/Azure-Samples/ms-identity-python-webapi-azurefunctions) ## <a name="next-steps"></a>次のステップ > [!div class="nextstepaction"] > [コードでスコープとアプリのロールを検証する](scenario-protected-web-api-verification-scope-app-roles.md)
{ "pile_set_name": "Github" }
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #ifndef ENGINE_CLIENT_INPUT_H #define ENGINE_CLIENT_INPUT_H class CInput : public IEngineInput { IEngineGraphics *m_pGraphics; int m_InputGrabbed; int64 m_LastRelease; int64 m_ReleaseDelta; void AddEvent(int Unicode, int Key, int Flags); IEngineGraphics *Graphics() { return m_pGraphics; } public: CInput(); virtual void Init(); virtual void MouseRelative(float *x, float *y); virtual void MouseModeAbsolute(); virtual void MouseModeRelative(); virtual int MouseDoubleClick(); void ClearKeyStates(); int KeyState(int Key); int ButtonPressed(int Button) { return m_aInputState[m_InputCurrent][Button]; } virtual int Update(); }; #endif
{ "pile_set_name": "Github" }
<!DOCTYPE html> html(lang="en") head meta(charset="UTF-8") meta(name="viewport", content="width=device-width, initial-scale=1.0") meta(http-equiv="X-UA-Compatible", content="ie=edge") title Document body h1 Pug
{ "pile_set_name": "Github" }
<?php namespace Ushahidi\App\Http\Controllers\API\Posts; /** * Ushahidi API Posts Revisions Controller * * @author Ushahidi Team <team@ushahidi.com> * @package Ushahidi\Application\Controllers * @copyright 2013 Ushahidi * @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3) */ class RevisionsController extends PostsController { protected $postType = 'revision'; }
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_POP_BACK_FWD_HPP_INCLUDED #define BOOST_MPL_POP_BACK_FWD_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ // $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { template< typename Tag > struct pop_back_impl; template< typename Sequence > struct pop_back; }} #endif // BOOST_MPL_POP_BACK_FWD_HPP_INCLUDED
{ "pile_set_name": "Github" }
15 46 30 82 90 56 17 95 15 48 26 4 58 71 79 92 60 12 21 63 47 19 41 90 85 14 9 52 71 79 16 81 51 95 93 34 10 79 95 61 92 89 88 66 64 92 63 66 64 39 51 27 0 95 12 8 66 47 42 74 69 89 83 66 41 90 78 65 79 90 33 53 29 85 22 33 37 36 68 60 58 36 60 42 42 67 15 16 18 56 79 8 59 61 97 55 81 75 40 90 1 37 35 43 67 12 11 33 93 54 53 26 18 86 70 84 14 31 99 86 30
{ "pile_set_name": "Github" }
(ns prosemirror.commands (:require [prosemirror.core :as pm] ["prosemirror-state" :as state] ["prosemirror-history" :as history] ["prosemirror-commands" :as commands] ["prosemirror-inputrules" :as input-rules] [applied-science.js-interop :as j])) (def chain commands/chainCommands) (def undo history/undo) (def redo history/redo) (def inline-bold (pm/toggle-mark :strong)) (def inline-italic (pm/toggle-mark :em)) (def inline-code (pm/toggle-mark :code)) (def block-list-bullet (pm/wrap-in-list :bullet_list)) (def block-list-ordered (pm/wrap-in-list :ordered_list)) (def block-paragraph (pm/set-block-type :paragraph)) (defn block-heading [i] (pm/set-block-type :heading #js {"level" i})) (def outdent (chain pm/lift-list-item pm/lift)) (def indent (chain pm/sink-list-item block-list-bullet)) (def hard-break (chain commands/exitCode (fn [^js/pm.EditorState state dispatch] (dispatch (->> (j/call (pm/get-node state :hard_break) :create) (.replaceSelectionWith (.-tr state)) (pm/scroll-into-view))) true))) (def newline-in-code commands/newlineInCode) (defn empty-node? [node] (= 0 (j/get-in node [:content :size]))) (defn delete-cursor-node [state dispatch] (let [pos (j/get-in state [:selection :$anchor :pos])] (dispatch (j/call (.-tr state) :.deleteRange (max 0 (dec pos)) (inc pos))))) (def enter (chain pm/split-list-item commands/createParagraphNear commands/liftEmptyBlock commands/splitBlock)) (defn clear-empty-non-paragraph-nodes "If the cursor is in an empty node which is a heading or code-block, convert the node to a paragraph." [state dispatch] (let [node (pm/cursor-node state) $cursor (.-$anchor (.-selection state))] (when (and (#{(pm/get-node state :heading) (pm/get-node state :code_block)} (.-type node)) (or (= 0 (.-size (.-content node))) (= 0 (some-> $cursor (.-parentOffset))))) ((pm/set-block-type :paragraph) state dispatch)))) (def backspace (chain commands/deleteSelection clear-empty-non-paragraph-nodes commands/joinBackward input-rules/undoInputRule)) (def join-up commands/joinUp) (def join-down commands/joinDown) (def select-parent-node commands/selectParentNode) (def select-all commands/selectAll) (def selection-stack (atom '())) (defn clear-selections! [] (reset! selection-stack '())) (defn stack-selection! [n] (when (not= n (first @selection-stack)) (swap! selection-stack conj n))) (defn read-selection! [] (let [n (second @selection-stack)] (swap! selection-stack rest) n)) (defn select-word [state dispatch] ;; TODO ;; implement `select-word` as the first step of `expand-selection` ;; also: select word by default on M1, to match behaviour of code ) (defn expand-selection "Expand selection upwards, by block." [state dispatch] (let [original-selection (.-selection state) had-selected-node? (and (not= (.-from original-selection) (.-to original-selection)) (let [node-selection (.create state/NodeSelection (.-doc state) (.-from original-selection))] (and (= (.-from original-selection) (.-from node-selection)) (= (.-to original-selection) (.-to node-selection)))))] (when (= (.-from original-selection) (.-to original-selection)) (clear-selections!)) (loop [sel original-selection] (let [$from (.-$from sel) to (.-to sel) same (.sharedDepth $from to)] (if (= same 0) (do (stack-selection! 0) (select-all state dispatch)) (let [pos (.before $from same) $pos (.resolve (.-doc state) pos) the-node (.-nodeAfter $pos) node-selection (pm/NodeSelection. $pos)] (if (and (= 1 (.-childCount the-node)) had-selected-node?) (recur node-selection) (when dispatch (stack-selection! pos) (dispatch (.setSelection (.-tr state) node-selection)))))))))) (defn contract-selection [state dispatch] (when dispatch (let [sel (.-selection state)] (if (= (.-from sel) (.-to sel)) (clear-selections!) (dispatch (.setSelection (.-tr state) (if-let [pos (read-selection!)] (pm/NodeSelection. (.resolve (.-doc state) pos)) (.near pm/Selection (.-$anchor sel))))))))) (defn heading->paragraph [state dispatch] (when (pm/is-node-type? state :heading) ((pm/set-block-type :paragraph) state dispatch))) (defn adjust-font-size [f state dispatch] (let [node (pm/cursor-node state)] (when-let [heading-level (condp = (.-type node) (pm/get-node state :paragraph) 4 (pm/get-node state :heading) (let [level (.-level (.-attrs node))] (cond-> level (>= level 4) (inc))) :else nil)] (let [target-index (min (f heading-level) 7)] ((cond (<= target-index 3) (pm/set-block-type :heading #js {:level target-index}) (= target-index 4) (pm/set-block-type :paragraph) :else (pm/set-block-type :heading #js {:level (dec target-index)})) state dispatch))))) (defn clear-stored-marks [state dispatch] (dispatch (reduce (fn [tr mark] (.removeStoredMark tr mark)) (.-tr state) (.. state -selection -$cursor (marks))))) ;;;;;; Input rules ;; TODO: mark input rules, see https://discuss.prosemirror.net/t/input-rules-for-wrapping-marks/537/10 (def rule-blockquote-start (pm/input-rule-wrap-block #"^>\s" :blockquote nil)) (def rule-toggle-code (input-rules/InputRule. #"[^`\\]+`$" (fn [state & _] (pm/toggle-mark-tr state :code)))) (def rule-block-list-bullet-start (pm/input-rule-wrap-block #"^\s*([-+*])\s$" :bullet_list nil)) (def rule-block-list-numbered-start (pm/input-rule-wrap-block #"^(\d+)\.\s$" :ordered_list (fn [match] #js {"order" (second match)}))) (def rule-block-code-start (pm/input-rule-wrap-inline #"^`$" :code_block nil)) (def rule-paragraph-start (pm/input-rule-wrap-inline #"^/p$" :paragraph nil)) (comment ;; need to implement a transform that adds an hr element ;; also need to handle selection/delete of hr (def hr (input-rules/InputRule. #"—-" "---"))) (def rule-block-heading-start (pm/input-rule-wrap-inline #"^(#{1,6})\s$" :heading (fn [match] #js {"level" (count (second match))}))) ;; TODO ;; command to increase/decrease header level #_(defn size-change [mode] (fn [state dispatch] (let [set-p (pm/set-block-type :paragraph) set-h1 (pm/set-block-type :heading #js {"level" 1}) active? (or (set-p state) (set-h1 state))] ))) (defn apply-command [prosemirror command] (command (.-state prosemirror) (.-dispatch prosemirror) prosemirror)) (defn open-link ([state dispatch] (open-link false state dispatch nil)) ([state dispatch view] (open-link false state dispatch view)) ([force? state dispatch view] (when-let [$cursor (.. state -selection -$cursor)] (when-let [link-mark (pm/pos-mark state $cursor :link)] (let [{:keys [from to]} (pm/mark-extend state $cursor :link) text (str "[" (.textBetween (.-doc state) from to) "](" (.. link-mark -attrs -href) ")")] (when (or force? (= to (.-pos $cursor))) (dispatch (-> (.-tr state) (.removeMark from to (pm/get-mark state :link)) (.insertText text from to))) true)))))) (defn open-image [state dispatch] (when-let [$cursor (.. state -selection -$cursor)] (let [image-node (.-nodeBefore $cursor) image-type (pm/get-node state :image) to (.-pos $cursor)] (when (= (some-> image-node (.-type)) image-type) (let [from (- to (.-nodeSize image-node)) text (str "![" (.. image-node -attrs -title) "](" (.. image-node -attrs -src) ")")] (when (= to (.-pos $cursor)) (dispatch (-> (.-tr state) (.insertText text from to))) true)))))) (defn end-link [state dispatch] (when-let [$cursor (.. state -selection -$cursor)] (let [the-mark (pm/get-mark state :link)] (when (pm/has-mark? state the-mark) (let [{:keys [to]} (pm/mark-extend state $cursor the-mark)] (when (= to (.-pos $cursor)) (when (re-find #"[\.\s]" (.textBetween (.-doc state) (dec to) to)) (dispatch (-> (.-tr state) (.removeMark (dec to) to the-mark) (.removeStoredMark the-mark)))))))))) (def rule-image-and-links (input-rules/InputRule. #"(\!?)\[(.*)\]\((.*)\)\s?$" (fn [state [the-match kind label target] from to] (if (= kind "!") (pm/add-image-tr state from to label target) (pm/add-link-tr state from to label target)))))
{ "pile_set_name": "Github" }
import os from glob import glob import cv2 import numpy as np from tqdm import tqdm def main(): img_size = 96 paths = glob('inputs/data-science-bowl-2018/stage1_train/*') os.makedirs('inputs/dsb2018_%d/images' % img_size, exist_ok=True) os.makedirs('inputs/dsb2018_%d/masks/0' % img_size, exist_ok=True) for i in tqdm(range(len(paths))): path = paths[i] img = cv2.imread(os.path.join(path, 'images', os.path.basename(path) + '.png')) mask = np.zeros((img.shape[0], img.shape[1])) for mask_path in glob(os.path.join(path, 'masks', '*')): mask_ = cv2.imread(mask_path, cv2.IMREAD_GRAYSCALE) > 127 mask[mask_] = 1 if len(img.shape) == 2: img = np.tile(img[..., None], (1, 1, 3)) if img.shape[2] == 4: img = img[..., :3] img = cv2.resize(img, (img_size, img_size)) mask = cv2.resize(mask, (img_size, img_size)) cv2.imwrite(os.path.join('inputs/dsb2018_%d/images' % img_size, os.path.basename(path) + '.png'), img) cv2.imwrite(os.path.join('inputs/dsb2018_%d/masks/0' % img_size, os.path.basename(path) + '.png'), (mask * 255).astype('uint8')) if __name__ == '__main__': main()
{ "pile_set_name": "Github" }
{ "comments": { // symbol used for single line comment. Remove this entry if your language does not support line comments "lineComment": "//", // symbols used for start and end a block comment. Remove this entry if your language does not support block comments "blockComment": [ "/*", "*/" ] }, // symbols used as brackets "brackets": [ [ "{", "}" ], [ "[", "]" ], [ "(", ")" ] ], "autoClosingPairs": [ [ "{", "}" ], [ "[", "]" ], [ "(", ")" ] ] }
{ "pile_set_name": "Github" }
/* * Copyright 2011 The WebRTC Project Authors. All rights reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #include "rtc_base/messagedigest.h" #include <string.h> #include <cstdint> #include <memory> #include "rtc_base/openssldigest.h" #include "rtc_base/stringencode.h" namespace rtc { // From RFC 4572. const char DIGEST_MD5[] = "md5"; const char DIGEST_SHA_1[] = "sha-1"; const char DIGEST_SHA_224[] = "sha-224"; const char DIGEST_SHA_256[] = "sha-256"; const char DIGEST_SHA_384[] = "sha-384"; const char DIGEST_SHA_512[] = "sha-512"; static const size_t kBlockSize = 64; // valid for SHA-256 and down MessageDigest* MessageDigestFactory::Create(const std::string& alg) { MessageDigest* digest = new OpenSSLDigest(alg); if (digest->Size() == 0) { // invalid algorithm delete digest; digest = nullptr; } return digest; } bool IsFips180DigestAlgorithm(const std::string& alg) { // These are the FIPS 180 algorithms. According to RFC 4572 Section 5, // "Self-signed certificates (for which legacy certificates are not a // consideration) MUST use one of the FIPS 180 algorithms (SHA-1, // SHA-224, SHA-256, SHA-384, or SHA-512) as their signature algorithm, // and thus also MUST use it to calculate certificate fingerprints." return alg == DIGEST_SHA_1 || alg == DIGEST_SHA_224 || alg == DIGEST_SHA_256 || alg == DIGEST_SHA_384 || alg == DIGEST_SHA_512; } size_t ComputeDigest(MessageDigest* digest, const void* input, size_t in_len, void* output, size_t out_len) { digest->Update(input, in_len); return digest->Finish(output, out_len); } size_t ComputeDigest(const std::string& alg, const void* input, size_t in_len, void* output, size_t out_len) { std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg)); return (digest) ? ComputeDigest(digest.get(), input, in_len, output, out_len) : 0; } std::string ComputeDigest(MessageDigest* digest, const std::string& input) { std::unique_ptr<char[]> output(new char[digest->Size()]); ComputeDigest(digest, input.data(), input.size(), output.get(), digest->Size()); return hex_encode(output.get(), digest->Size()); } bool ComputeDigest(const std::string& alg, const std::string& input, std::string* output) { std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg)); if (!digest) { return false; } *output = ComputeDigest(digest.get(), input); return true; } std::string ComputeDigest(const std::string& alg, const std::string& input) { std::string output; ComputeDigest(alg, input, &output); return output; } // Compute a RFC 2104 HMAC: H(K XOR opad, H(K XOR ipad, text)) size_t ComputeHmac(MessageDigest* digest, const void* key, size_t key_len, const void* input, size_t in_len, void* output, size_t out_len) { // We only handle algorithms with a 64-byte blocksize. // TODO: Add BlockSize() method to MessageDigest. size_t block_len = kBlockSize; if (digest->Size() > 32) { return 0; } // Copy the key to a block-sized buffer to simplify padding. // If the key is longer than a block, hash it and use the result instead. std::unique_ptr<uint8_t[]> new_key(new uint8_t[block_len]); if (key_len > block_len) { ComputeDigest(digest, key, key_len, new_key.get(), block_len); memset(new_key.get() + digest->Size(), 0, block_len - digest->Size()); } else { memcpy(new_key.get(), key, key_len); memset(new_key.get() + key_len, 0, block_len - key_len); } // Set up the padding from the key, salting appropriately for each padding. std::unique_ptr<uint8_t[]> o_pad(new uint8_t[block_len]); std::unique_ptr<uint8_t[]> i_pad(new uint8_t[block_len]); for (size_t i = 0; i < block_len; ++i) { o_pad[i] = 0x5c ^ new_key[i]; i_pad[i] = 0x36 ^ new_key[i]; } // Inner hash; hash the inner padding, and then the input buffer. std::unique_ptr<uint8_t[]> inner(new uint8_t[digest->Size()]); digest->Update(i_pad.get(), block_len); digest->Update(input, in_len); digest->Finish(inner.get(), digest->Size()); // Outer hash; hash the outer padding, and then the result of the inner hash. digest->Update(o_pad.get(), block_len); digest->Update(inner.get(), digest->Size()); return digest->Finish(output, out_len); } size_t ComputeHmac(const std::string& alg, const void* key, size_t key_len, const void* input, size_t in_len, void* output, size_t out_len) { std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg)); if (!digest) { return 0; } return ComputeHmac(digest.get(), key, key_len, input, in_len, output, out_len); } std::string ComputeHmac(MessageDigest* digest, const std::string& key, const std::string& input) { std::unique_ptr<char[]> output(new char[digest->Size()]); ComputeHmac(digest, key.data(), key.size(), input.data(), input.size(), output.get(), digest->Size()); return hex_encode(output.get(), digest->Size()); } bool ComputeHmac(const std::string& alg, const std::string& key, const std::string& input, std::string* output) { std::unique_ptr<MessageDigest> digest(MessageDigestFactory::Create(alg)); if (!digest) { return false; } *output = ComputeHmac(digest.get(), key, input); return true; } std::string ComputeHmac(const std::string& alg, const std::string& key, const std::string& input) { std::string output; ComputeHmac(alg, key, input, &output); return output; } } // namespace rtc
{ "pile_set_name": "Github" }
<?php /* * This file is part of Respect/Validation. * * (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net> * * For the full copyright and license information, please view the LICENSE file * that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Validation\Rules; use Respect\Validation\Test\RuleTestCase; use stdClass; /** * @group rule * * @covers \Respect\Validation\Rules\StringType * * @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net> * @author Gabriel Caruso <carusogabriel34@gmail.com> * @author Henrique Moody <henriquemoody@gmail.com> * @author Marcel dos Santos <marcelgsantos@gmail.com> */ final class StringTypeTest extends RuleTestCase { /** * {@inheritDoc} */ public function providerForValidInput(): array { $rule = new StringType(); return [ [$rule, ''], [$rule, '165.7'], ]; } /** * {@inheritDoc} */ public function providerForInvalidInput(): array { $rule = new StringType(); return [ [$rule, null], [$rule, []], [$rule, new stdClass()], [$rule, 150], ]; } }
{ "pile_set_name": "Github" }
var convert = require('./convert'), func = convert('curryRight', require('../curryRight')); func.placeholder = require('./placeholder'); module.exports = func;
{ "pile_set_name": "Github" }
/* Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ //----------------------------------------------------------------------------------- // Common definitions #include "cs_chorus.h" #define NMODS 3 #define VERSION "0.4.0" static const char* maker = "Fons Adriaensen <fons@kokkinizita.net>"; static const char* copyr = "(C) 2003-2008 Fons Adriaensen - License: GPL2"; static void pconnect(LADSPA_Handle H, unsigned long port, LADSPA_Data* data) { ((LadspaPlugin*)H)->setport(port, data); } static void activate(LADSPA_Handle H) { ((LadspaPlugin*)H)->active(true); } static void runplugin(LADSPA_Handle H, unsigned long k) { ((LadspaPlugin*)H)->runproc(k, false); } static void runadding(LADSPA_Handle H, unsigned long k) { ((LadspaPlugin*)H)->runproc(k, true); } static void setadding(LADSPA_Handle H, LADSPA_Data gain) { ((LadspaPlugin*)H)->setgain(gain); } static void deactivate(LADSPA_Handle H) { ((LadspaPlugin*)H)->active(false); } static void cleanup(LADSPA_Handle H) { delete (LadspaPlugin*)H; } //----------------------------------------------------------------------------------- // Plugin definitions static const char* name1 = "Chorus1 - Based on CSound orchestra by Sean Costello"; static const char* label1 = "Chorus1"; static LADSPA_Handle instant1(const struct _LADSPA_Descriptor* desc, unsigned long rate) { return new Ladspa_CS_chorus1(rate); } static const char* name2 = "Chorus2 - Based on CSound orchestra by Sean Costello"; static const char* label2 = "Chorus2"; static LADSPA_Handle instant2(const struct _LADSPA_Descriptor* desc, unsigned long rate) { return new Ladspa_CS_chorus2(rate); } static const char* name3 = "Triple chorus"; static const char* label3 = "TripleChorus"; static LADSPA_Handle instant3(const struct _LADSPA_Descriptor* desc, unsigned long rate) { return new Ladspa_CS_chorus3(rate); } static const LADSPA_PortDescriptor pdesc12[Ladspa_CS_chorus1::NPORT] = { LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL }; static const char* const pname12[Ladspa_CS_chorus1::NPORT] = { "Input", "Output", "Delay (ms)", "Mod Frequency 1 (Hz)", "Mod Amplitude 1 (ms)", "Mod Frequency 2 (Hz)", "Mod Amplitude 2 (ms)" }; static const LADSPA_PortRangeHint phint12[Ladspa_CS_chorus1::NPORT] = { { 0, 0, 0 }, { 0, 0, 0 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 30 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_LOGARITHMIC, 0.003, 10 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 10 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_LOGARITHMIC, 0.01, 30 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 3 } }; static const LADSPA_PortDescriptor pdesc3[Ladspa_CS_chorus3::NPORT] = { LADSPA_PORT_INPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_OUTPUT | LADSPA_PORT_AUDIO, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL, LADSPA_PORT_INPUT | LADSPA_PORT_CONTROL }; static const char* const pname3[Ladspa_CS_chorus3::NPORT] = { "Input", "Output1", "Output2", "Output3", "Delay (ms)", "Mod Frequency 1 (Hz)", "Mod Amplitude 1 (ms)", "Mod Frequency 2 (Hz)", "Mod Amplitude 2 (ms)" }; static const LADSPA_PortRangeHint phint3[Ladspa_CS_chorus3::NPORT] = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 30 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_LOGARITHMIC, 0.003, 10 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 10 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_LOGARITHMIC, 0.01, 30 }, { LADSPA_HINT_BOUNDED_BELOW | LADSPA_HINT_BOUNDED_ABOVE | LADSPA_HINT_DEFAULT_0, 0, 3 } }; static const LADSPA_Descriptor moddescr[NMODS] = { { 1944, label1, LADSPA_PROPERTY_REALTIME | LADSPA_PROPERTY_HARD_RT_CAPABLE, name1, maker, copyr, Ladspa_CS_chorus1::NPORT, pdesc12, pname12, phint12, 0, instant1, pconnect, activate, runplugin, runadding, setadding, deactivate, cleanup }, { 1945, label2, LADSPA_PROPERTY_REALTIME | LADSPA_PROPERTY_HARD_RT_CAPABLE, name2, maker, copyr, Ladspa_CS_chorus1::NPORT, pdesc12, pname12, phint12, 0, instant2, pconnect, activate, runplugin, runadding, setadding, deactivate, cleanup }, { 1951, label3, LADSPA_PROPERTY_REALTIME | LADSPA_PROPERTY_HARD_RT_CAPABLE, name3, maker, copyr, Ladspa_CS_chorus3::NPORT, pdesc3, pname3, phint3, 0, instant3, pconnect, activate, runplugin, runadding, setadding, deactivate, cleanup } }; extern "C" const LADSPA_Descriptor* ladspa_descriptor(unsigned long i) { if (i >= NMODS) { return 0; } return moddescr + i; } //-----------------------------------------------------------------------------------
{ "pile_set_name": "Github" }
--- kind: Template apiVersion: v1 metadata: annotations: iconClass: icon-jboss tags: rhdm,decisionserver,jboss,kieserver version: "7.6" openshift.io/display-name: Red Hat Decision Manager 7.6 managed KIE Server openshift.io/provider-display-name: Red Hat, Inc. description: Application template for a managed KIE Server, for Red Hat Decision Manager 7.6 - Deprecated template.openshift.io/long-description: This template defines resources needed to execute Rules on Red Hat Decision Manager KIE server 7.6, including application deployment configuration, secure and insecure http communication. Template for Red Hat OpenShift Container Platform version 3.11. Deprecated since Red Hat Decision Manager version 7.5; consider using the Red Hat Business Automation Operator. template.openshift.io/documentation-url: https://access.redhat.com/documentation/en-us/red_hat_decision_manager/7.6/html/deploying_a_red_hat_decision_manager_7.6_managed_server_environment_on_red_hat_openshift_container_platform/ template.openshift.io/support-url: https://access.redhat.com template.openshift.io/bindable: "false" name: rhdm76-kieserver labels: template: rhdm76-kieserver rhdm: "7.6" message: |- A new Decision Manager KIE server application has been created in your project. The user name/password for accessing the KIE server User name: ${KIE_SERVER_USER} Password: ${KIE_SERVER_PWD} Please be sure to create the secret named "${KIE_SERVER_HTTPS_SECRET}" containing the ${KIE_SERVER_HTTPS_KEYSTORE} file used for serving secure content. parameters: - displayName: Application Name description: The name for the application. name: APPLICATION_NAME value: myapp required: true - displayName: Maven mirror URL description: Maven mirror that KIE server must use. If you configure a mirror, this mirror must contain all artifacts that are required for deploying your services. name: MAVEN_MIRROR_URL required: false - displayName: Maven mirror of description: Maven mirror configuration for KIE server. name: MAVEN_MIRROR_OF value: "external:*" required: false - displayName: Maven repository ID description: "The id to use for the maven repository. If set, it can be excluded from the optionally configured mirror by adding it to MAVEN_MIRROR_OF. For example: external:*,!repo-rhdmcentr,!repo-custom. If MAVEN_MIRROR_URL is set but MAVEN_MIRROR_ID is not set, an id will be generated randomly, but won't be usable in MAVEN_MIRROR_OF." name: MAVEN_REPO_ID value: repo-custom required: false - displayName: Maven repository URL description: Fully qualified URL to a Maven repository or service. name: MAVEN_REPO_URL example: http://nexus.nexus-project.svc.cluster.local:8081/nexus/content/groups/public/ required: true - displayName: Maven repository user name description: User name for accessing the Maven repository, if required. name: MAVEN_REPO_USERNAME required: false - displayName: Maven repository password description: Password to access the Maven repository, if required. name: MAVEN_REPO_PASSWORD required: false - displayName: Name of the Decision Central service description: The Service name for the optional Decision Central, where it can be reached, to allow service lookups (for example, maven repo usage), if required. name: DECISION_CENTRAL_SERVICE example: "myapp-rhdmcentr" required: false - displayName: User name for the Maven service hosted by Decision Central description: User name for accessing the Maven service hosted by Decision Central inside EAP. name: DECISION_CENTRAL_MAVEN_USERNAME example: "mavenUser" required: false - displayName: Password for the Maven service hosted by Decision Central description: Password to access the Maven service hosted by Decision Central inside EAP. name: DECISION_CENTRAL_MAVEN_PASSWORD example: "maven1!" required: false - displayName: KIE Admin User description: KIE administrator user name. name: KIE_ADMIN_USER value: adminUser required: false - displayName: KIE Admin Password description: KIE administrator password. name: KIE_ADMIN_PWD from: "[a-zA-Z]{6}[0-9]{1}!" generate: expression required: false - displayName: KIE Server User description: KIE server user name. (Sets the org.kie.server.user system property) name: KIE_SERVER_USER value: executionUser required: false - displayName: KIE Server Password description: KIE server password. (Sets the org.kie.server.pwd system property) name: KIE_SERVER_PWD from: "[a-zA-Z]{6}[0-9]{1}!" generate: expression required: false - displayName: ImageStream Namespace description: Namespace in which the ImageStreams for Red Hat Decision Manager images are installed. These ImageStreams are normally installed in the openshift namespace. You should only need to modify this if you installed the ImageStreams in a different namespace/project. name: IMAGE_STREAM_NAMESPACE value: openshift required: true - displayName: KIE Server ImageStream Name description: The name of the image stream to use for KIE server. Default is "rhdm-kieserver-rhel8". name: KIE_SERVER_IMAGE_STREAM_NAME value: "rhdm-kieserver-rhel8" required: true - displayName: ImageStream Tag description: A named pointer to an image in an image stream. Default is "7.6.0". name: IMAGE_STREAM_TAG value: "7.6.0" required: true - displayName: KIE Server Mode description: "The KIE Server mode. Valid values are 'DEVELOPMENT' or 'PRODUCTION'. In production mode, you can not deploy SNAPSHOT versions of artifacts on the KIE server and can not change the version of an artifact in an existing container. (Sets the org.kie.server.mode system property)." name: KIE_SERVER_MODE value: "PRODUCTION" required: false - displayName: KIE MBeans description: KIE server mbeans enabled/disabled. (Sets the kie.mbeans and kie.scanner.mbeans system properties) name: KIE_MBEANS value: enabled required: false - displayName: Drools Server Filter Classes description: KIE server class filtering. (Sets the org.drools.server.filter.classes system property) name: DROOLS_SERVER_FILTER_CLASSES value: 'true' required: false - displayName: Prometheus Server Extension Disabled description: If set to false, the prometheus server extension will be enabled. (Sets the org.kie.prometheus.server.ext.disabled system property) name: PROMETHEUS_SERVER_EXT_DISABLED example: 'false' required: false - displayName: KIE Server Custom http Route Hostname description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: insecure-<application-name>-kieserver-<project>.<default-domain-suffix>' name: KIE_SERVER_HOSTNAME_HTTP value: '' required: false - displayName: KIE Server Custom https Route Hostname description: 'Custom hostname for https service route. Leave blank for default hostname, e.g.: <application-name>-kieserver-<project>.<default-domain-suffix>' name: KIE_SERVER_HOSTNAME_HTTPS value: '' required: false - displayName: KIE Server Keystore Secret Name description: The name of the secret containing the keystore file. name: KIE_SERVER_HTTPS_SECRET example: kieserver-app-secret required: true - displayName: KIE Server Keystore Filename description: The name of the keystore file within the secret. name: KIE_SERVER_HTTPS_KEYSTORE value: keystore.jks required: false - displayName: KIE Server Certificate Name description: The name associated with the server certificate. name: KIE_SERVER_HTTPS_NAME value: jboss required: false - displayName: KIE Server Keystore Password description: The password for the keystore and certificate. name: KIE_SERVER_HTTPS_PASSWORD value: mykeystorepass required: false - displayName: KIE Server Bypass Auth User description: Allows the KIE server to bypass the authenticated user for task-related operations, for example, queries. (Sets the org.kie.server.bypass.auth.user system property) name: KIE_SERVER_BYPASS_AUTH_USER value: 'false' required: false - displayName: KIE Server Container Memory Limit description: KIE server Container memory limit. name: KIE_SERVER_MEMORY_LIMIT value: 1Gi required: false - displayName: KIE Server Container Deployment description: 'KIE Server Container deployment configuration with optional alias. Format: containerId=groupId:artifactId:version|c2(alias2)=g2:a2:v2' name: KIE_SERVER_CONTAINER_DEPLOYMENT example: rhdm-kieserver-library=org.openshift.quickstarts:rhdm-kieserver-library:1.6.0-SNAPSHOT required: false - displayName: Disable KIE Server Management description: "Disable management api and don't allow KIE containers to be deployed/undeployed or started/stopped. Sets the property org.kie.server.mgmt.api.disabled to true and org.kie.server.startup.strategy to LocalContainersStartupStrategy." name: KIE_SERVER_MGMT_DISABLED example: "true" required: false - displayName: RH-SSO URL description: RH-SSO URL. name: SSO_URL example: https://rh-sso.example.com/auth required: false - displayName: RH-SSO Realm name description: RH-SSO Realm name. name: SSO_REALM required: false - displayName: KIE Server RH-SSO Client name description: KIE Server RH-SSO Client name. name: KIE_SERVER_SSO_CLIENT required: false - displayName: KIE Server RH-SSO Client Secret description: KIE Server RH-SSO Client Secret name: KIE_SERVER_SSO_SECRET example: "252793ed-7118-4ca8-8dab-5622fa97d892" required: false - displayName: RH-SSO Realm admin user name description: RH-SSO Realm admin user name used to create the Client if it doesn't exist. name: SSO_USERNAME required: false - displayName: RH-SSO Realm Admin Password description: RH-SSO Realm Admin Password used to create the Client. name: SSO_PASSWORD required: false - displayName: RH-SSO Disable SSL Certificate Validation description: RH-SSO Disable SSL Certificate Validation. name: SSO_DISABLE_SSL_CERTIFICATE_VALIDATION value: "false" required: false - displayName: RH-SSO Principal Attribute description: RH-SSO Principal Attribute to use as user name. name: SSO_PRINCIPAL_ATTRIBUTE value: preferred_username required: false - displayName: LDAP Endpoint description: LDAP Endpoint to connect for authentication. name: AUTH_LDAP_URL example: "ldap://myldap.example.com" required: false - displayName: LDAP Bind DN description: Bind DN used for authentication. name: AUTH_LDAP_BIND_DN example: "uid=admin,ou=users,ou=example,ou=com" required: false - displayName: LDAP Bind Credentials description: LDAP Credentials used for authentication. name: AUTH_LDAP_BIND_CREDENTIAL example: "Password" required: false - displayName: LDAP JAAS Security Domain description: The JMX ObjectName of the JaasSecurityDomain used to decrypt the password. name: AUTH_LDAP_JAAS_SECURITY_DOMAIN required: false - displayName: LDAP Base DN description: LDAP Base DN of the top-level context to begin the user search. name: AUTH_LDAP_BASE_CTX_DN example: "ou=users,ou=example,ou=com" required: false - displayName: LDAP Base Search filter description: LDAP search filter used to locate the context of the user to authenticate. The input username or userDN obtained from the login module callback is substituted into the filter anywhere a {0} expression is used. A common example for the search filter is (uid={0}). name: AUTH_LDAP_BASE_FILTER example: "(uid={0})" required: false - displayName: LDAP Search scope description: The search scope to use. name: AUTH_LDAP_SEARCH_SCOPE example: "SUBTREE_SCOPE" required: false - displayName: LDAP Search time limit description: The timeout in milliseconds for user or role searches. name: AUTH_LDAP_SEARCH_TIME_LIMIT example: "10000" required: false - displayName: LDAP DN attribute description: The name of the attribute in the user entry that contains the DN of the user. This may be necessary if the DN of the user itself contains special characters, backslash for example, that prevent correct user mapping. If the attribute does not exist, the entry’s DN is used. name: AUTH_LDAP_DISTINGUISHED_NAME_ATTRIBUTE example: "distinguishedName" required: false - displayName: LDAP Parse username description: A flag indicating if the DN is to be parsed for the user name. If set to true, the DN is parsed for the user name. If set to false the DN is not parsed for the user name. This option is used together with usernameBeginString and usernameEndString. name: AUTH_LDAP_PARSE_USERNAME example: "true" required: false - displayName: LDAP Username begin string description: Defines the String which is to be removed from the start of the DN to reveal the user name. This option is used together with usernameEndString and only taken into account if parseUsername is set to true. name: AUTH_LDAP_USERNAME_BEGIN_STRING required: false - displayName: LDAP Username end string description: Defines the String which is to be removed from the end of the DN to reveal the user name. This option is used together with usernameEndString and only taken into account if parseUsername is set to true. name: AUTH_LDAP_USERNAME_END_STRING required: false - displayName: LDAP Role attributeID description: Name of the attribute containing the user roles. name: AUTH_LDAP_ROLE_ATTRIBUTE_ID example: memberOf required: false - displayName: LDAP Roles Search DN description: The fixed DN of the context to search for user roles. This is not the DN where the actual roles are, but the DN where the objects containing the user roles are. For example, in a Microsoft Active Directory server, this is the DN where the user account is. name: AUTH_LDAP_ROLES_CTX_DN example: "ou=groups,ou=example,ou=com" required: false - displayName: LDAP Role search filter description: A search filter used to locate the roles associated with the authenticated user. The input username or userDN obtained from the login module callback is substituted into the filter anywhere a {0} expression is used. The authenticated userDN is substituted into the filter anywhere a {1} is used. An example search filter that matches on the input username is (member={0}). An alternative that matches on the authenticated userDN is (member={1}). name: AUTH_LDAP_ROLE_FILTER example: "(memberOf={1})" required: false - displayName: LDAP Role recursion description: The number of levels of recursion the role search will go below a matching context. Disable recursion by setting this to 0. name: AUTH_LDAP_ROLE_RECURSION example: "1" required: false - displayName: LDAP Default role description: A role included for all authenticated users. name: AUTH_LDAP_DEFAULT_ROLE example: "user" required: false - displayName: LDAP Role name attribute ID description: Name of the attribute within the roleCtxDN context which contains the role name. If the roleAttributeIsDN property is set to true, this property is used to find the role object’s name attribute. name: AUTH_LDAP_ROLE_NAME_ATTRIBUTE_ID example: "name" required: false - displayName: LDAP Role DN contains roleNameAttributeID description: A flag indicating if the DN returned by a query contains the roleNameAttributeID. If set to true, the DN is checked for the roleNameAttributeID. If set to false, the DN is not checked for the roleNameAttributeID. This flag can improve the performance of LDAP queries. name: AUTH_LDAP_PARSE_ROLE_NAME_FROM_DN example: "false" required: false - displayName: LDAP Role Attribute ID is DN description: Whether or not the roleAttributeID contains the fully-qualified DN of a role object. If false, the role name is taken from the value of the roleNameAttributeId attribute of the context name. Certain directory schemas, such as Microsoft Active Directory, require this attribute to be set to true. name: AUTH_LDAP_ROLE_ATTRIBUTE_IS_DN example: "false" required: false - displayName: LDAP Referral user attribute ID description: If you are not using referrals, you can ignore this option. When using referrals, this option denotes the attribute name which contains users defined for a certain role, for example member, if the role object is inside the referral. Users are checked against the content of this attribute name. If this option is not set, the check will always fail, so role objects cannot be stored in a referral tree. name: AUTH_LDAP_REFERRAL_USER_ATTRIBUTE_ID_TO_CHECK required: false - displayName: RoleMapping rolesProperties file path description: When present, the RoleMapping Login Module will be configured to use the provided file. This property defines the fully-qualified file path and name of a properties file or resource which maps roles to replacement roles. The format is original_role=role1,role2,role3 name: AUTH_ROLE_MAPPER_ROLES_PROPERTIES required: false - displayName: RoleMapping replaceRole property description: Whether to add to the current roles, or replace the current roles with the mapped ones. Replaces if set to true. name: AUTH_ROLE_MAPPER_REPLACE_ROLE required: false objects: - kind: ServiceAccount apiVersion: v1 metadata: name: "${APPLICATION_NAME}-kieserver" labels: application: "${APPLICATION_NAME}" - kind: RoleBinding apiVersion: v1 metadata: name: "${APPLICATION_NAME}-kieserver-edit" labels: application: "${APPLICATION_NAME}" subjects: - kind: ServiceAccount name: "${APPLICATION_NAME}-kieserver" roleRef: name: edit - kind: Service apiVersion: v1 spec: ports: - name: http port: 8080 targetPort: 8080 - name: https port: 8443 targetPort: 8443 selector: deploymentConfig: "${APPLICATION_NAME}-kieserver" sessionAffinity: ClientIP sessionAffinityConfig: clientIP: timeoutSeconds: 3600 metadata: name: "${APPLICATION_NAME}-kieserver" labels: application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" annotations: description: All the KIE server web server's ports. - kind: Service apiVersion: v1 spec: clusterIP: "None" ports: - name: "ping" port: 8888 targetPort: 8888 selector: deploymentConfig: "${APPLICATION_NAME}-kieserver" metadata: name: "${APPLICATION_NAME}-kieserver-ping" labels: application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" description: "The JGroups ping port for clustering." - kind: Route apiVersion: v1 id: "insecure-${APPLICATION_NAME}-kieserver-http" metadata: name: "insecure-${APPLICATION_NAME}-kieserver" labels: application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" annotations: description: Route for KIE server's http service. haproxy.router.openshift.io/balance: source spec: host: "${KIE_SERVER_HOSTNAME_HTTP}" to: name: "${APPLICATION_NAME}-kieserver" port: targetPort: http - kind: Route apiVersion: v1 id: "${APPLICATION_NAME}-kieserver-https" metadata: name: "${APPLICATION_NAME}-kieserver" labels: application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" annotations: description: Route for KIE server's https service. spec: host: "${KIE_SERVER_HOSTNAME_HTTPS}" to: name: "${APPLICATION_NAME}-kieserver" port: targetPort: https tls: termination: passthrough - kind: DeploymentConfig apiVersion: v1 metadata: name: "${APPLICATION_NAME}-kieserver" labels: application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" services.server.kie.org/kie-server-id: "${APPLICATION_NAME}-kieserver" annotations: template.alpha.openshift.io/wait-for-ready: "true" spec: revisionHistoryLimit: 10 strategy: rollingParams: maxSurge: 100% maxUnavailable: 0 type: Rolling triggers: - type: ImageChange imageChangeParams: automatic: true containerNames: - "${APPLICATION_NAME}-kieserver" from: kind: ImageStreamTag namespace: "${IMAGE_STREAM_NAMESPACE}" name: "${KIE_SERVER_IMAGE_STREAM_NAME}:${IMAGE_STREAM_TAG}" - type: ConfigChange replicas: 1 selector: deploymentConfig: "${APPLICATION_NAME}-kieserver" template: metadata: name: "${APPLICATION_NAME}-kieserver" labels: deploymentConfig: "${APPLICATION_NAME}-kieserver" application: "${APPLICATION_NAME}" service: "${APPLICATION_NAME}-kieserver" services.server.kie.org/kie-server-id: "${APPLICATION_NAME}-kieserver" spec: serviceAccountName: "${APPLICATION_NAME}-kieserver" terminationGracePeriodSeconds: 90 containers: - name: "${APPLICATION_NAME}-kieserver" image: "${KIE_SERVER_IMAGE_STREAM_NAME}" imagePullPolicy: Always lifecycle: postStart: exec: command: - /bin/sh - /opt/eap/bin/launch/jboss-kie-kieserver-hooks.sh preStop: exec: command: - /bin/sh - /opt/eap/bin/launch/jboss-kie-kieserver-hooks.sh resources: limits: memory: "${KIE_SERVER_MEMORY_LIMIT}" volumeMounts: - name: kieserver-keystore-volume mountPath: "/etc/kieserver-secret-volume" readOnly: true livenessProbe: httpGet: path: /services/rest/server/healthcheck port: 8080 scheme: HTTP initialDelaySeconds: 180 timeoutSeconds: 2 periodSeconds: 15 failureThreshold: 3 readinessProbe: httpGet: path: /services/rest/server/readycheck port: 8080 scheme: HTTP initialDelaySeconds: 30 timeoutSeconds: 2 periodSeconds: 5 failureThreshold: 36 ports: - name: jolokia containerPort: 8778 protocol: TCP - name: http containerPort: 8080 protocol: TCP - name: https containerPort: 8443 protocol: TCP - name: ping containerPort: 8888 protocol: TCP env: - name: WORKBENCH_SERVICE_NAME value: "${DECISION_CENTRAL_SERVICE}" - name: KIE_ADMIN_USER value: "${KIE_ADMIN_USER}" - name: KIE_ADMIN_PWD value: "${KIE_ADMIN_PWD}" - name: KIE_SERVER_MODE value: "${KIE_SERVER_MODE}" - name: KIE_MBEANS value: "${KIE_MBEANS}" - name: DROOLS_SERVER_FILTER_CLASSES value: "${DROOLS_SERVER_FILTER_CLASSES}" - name: PROMETHEUS_SERVER_EXT_DISABLED value: "${PROMETHEUS_SERVER_EXT_DISABLED}" - name: KIE_SERVER_BYPASS_AUTH_USER value: "${KIE_SERVER_BYPASS_AUTH_USER}" - name: KIE_SERVER_ID valueFrom: fieldRef: fieldPath: metadata.labels['services.server.kie.org/kie-server-id'] - name: KIE_SERVER_ROUTE_NAME value: "${APPLICATION_NAME}-kieserver" - name: KIE_SERVER_USER value: "${KIE_SERVER_USER}" - name: KIE_SERVER_PWD value: "${KIE_SERVER_PWD}" - name: KIE_SERVER_CONTAINER_DEPLOYMENT value: "${KIE_SERVER_CONTAINER_DEPLOYMENT}" - name: MAVEN_MIRROR_URL value: "${MAVEN_MIRROR_URL}" - name: MAVEN_MIRROR_OF value: "${MAVEN_MIRROR_OF}" - name: MAVEN_REPOS value: "RHDMCENTR,EXTERNAL" - name: RHDMCENTR_MAVEN_REPO_ID value: "repo-rhdmcentr" - name: RHDMCENTR_MAVEN_REPO_SERVICE value: "${DECISION_CENTRAL_SERVICE}" - name: RHDMCENTR_MAVEN_REPO_PATH value: "/maven2/" - name: RHDMCENTR_MAVEN_REPO_USERNAME value: "${DECISION_CENTRAL_MAVEN_USERNAME}" - name: RHDMCENTR_MAVEN_REPO_PASSWORD value: "${DECISION_CENTRAL_MAVEN_PASSWORD}" - name: EXTERNAL_MAVEN_REPO_ID value: "${MAVEN_REPO_ID}" - name: EXTERNAL_MAVEN_REPO_URL value: "${MAVEN_REPO_URL}" - name: EXTERNAL_MAVEN_REPO_USERNAME value: "${MAVEN_REPO_USERNAME}" - name: EXTERNAL_MAVEN_REPO_PASSWORD value: "${MAVEN_REPO_PASSWORD}" - name: KIE_SERVER_MGMT_DISABLED value: "${KIE_SERVER_MGMT_DISABLED}" - name: KIE_SERVER_STARTUP_STRATEGY value: "OpenShiftStartupStrategy" - name: HTTPS_KEYSTORE_DIR value: "/etc/kieserver-secret-volume" - name: HTTPS_KEYSTORE value: "${KIE_SERVER_HTTPS_KEYSTORE}" - name: HTTPS_NAME value: "${KIE_SERVER_HTTPS_NAME}" - name: HTTPS_PASSWORD value: "${KIE_SERVER_HTTPS_PASSWORD}" - name: JGROUPS_PING_PROTOCOL value: "openshift.DNS_PING" - name: OPENSHIFT_DNS_PING_SERVICE_NAME value: "${APPLICATION_NAME}-kieserver-ping" - name: OPENSHIFT_DNS_PING_SERVICE_PORT value: "8888" - name: SSO_URL value: "${SSO_URL}" - name: SSO_OPENIDCONNECT_DEPLOYMENTS value: "ROOT.war" - name: SSO_REALM value: "${SSO_REALM}" - name: SSO_SECRET value: "${KIE_SERVER_SSO_SECRET}" - name: SSO_CLIENT value: "${KIE_SERVER_SSO_CLIENT}" - name: SSO_USERNAME value: "${SSO_USERNAME}" - name: SSO_PASSWORD value: "${SSO_PASSWORD}" - name: SSO_DISABLE_SSL_CERTIFICATE_VALIDATION value: "${SSO_DISABLE_SSL_CERTIFICATE_VALIDATION}" - name: SSO_PRINCIPAL_ATTRIBUTE value: "${SSO_PRINCIPAL_ATTRIBUTE}" - name: HOSTNAME_HTTP value: "${KIE_SERVER_HOSTNAME_HTTP}" - name: HOSTNAME_HTTPS value: "${KIE_SERVER_HOSTNAME_HTTPS}" - name: AUTH_LDAP_URL value: "${AUTH_LDAP_URL}" - name: AUTH_LDAP_BIND_DN value: "${AUTH_LDAP_BIND_DN}" - name: AUTH_LDAP_BIND_CREDENTIAL value: "${AUTH_LDAP_BIND_CREDENTIAL}" - name: AUTH_LDAP_JAAS_SECURITY_DOMAIN value: "${AUTH_LDAP_JAAS_SECURITY_DOMAIN}" - name: AUTH_LDAP_BASE_CTX_DN value: "${AUTH_LDAP_BASE_CTX_DN}" - name: AUTH_LDAP_BASE_FILTER value: "${AUTH_LDAP_BASE_FILTER}" - name: AUTH_LDAP_SEARCH_SCOPE value: "${AUTH_LDAP_SEARCH_SCOPE}" - name: AUTH_LDAP_SEARCH_TIME_LIMIT value: "${AUTH_LDAP_SEARCH_TIME_LIMIT}" - name: AUTH_LDAP_DISTINGUISHED_NAME_ATTRIBUTE value: "${AUTH_LDAP_DISTINGUISHED_NAME_ATTRIBUTE}" - name: AUTH_LDAP_PARSE_USERNAME value: "${AUTH_LDAP_PARSE_USERNAME}" - name: AUTH_LDAP_USERNAME_BEGIN_STRING value: "${AUTH_LDAP_USERNAME_BEGIN_STRING}" - name: AUTH_LDAP_USERNAME_END_STRING value: "${AUTH_LDAP_USERNAME_END_STRING}" - name: AUTH_LDAP_ROLE_ATTRIBUTE_ID value: "${AUTH_LDAP_ROLE_ATTRIBUTE_ID}" - name: AUTH_LDAP_ROLES_CTX_DN value: "${AUTH_LDAP_ROLES_CTX_DN}" - name: AUTH_LDAP_ROLE_FILTER value: "${AUTH_LDAP_ROLE_FILTER}" - name: AUTH_LDAP_ROLE_RECURSION value: "${AUTH_LDAP_ROLE_RECURSION}" - name: AUTH_LDAP_DEFAULT_ROLE value: "${AUTH_LDAP_DEFAULT_ROLE}" - name: AUTH_LDAP_ROLE_NAME_ATTRIBUTE_ID value: "${AUTH_LDAP_ROLE_NAME_ATTRIBUTE_ID}" - name: AUTH_LDAP_PARSE_ROLE_NAME_FROM_DN value: "${AUTH_LDAP_PARSE_ROLE_NAME_FROM_DN}" - name: AUTH_LDAP_ROLE_ATTRIBUTE_IS_DN value: "${AUTH_LDAP_ROLE_ATTRIBUTE_IS_DN}" - name: AUTH_LDAP_REFERRAL_USER_ATTRIBUTE_ID_TO_CHECK value: "${AUTH_LDAP_REFERRAL_USER_ATTRIBUTE_ID_TO_CHECK}" - name: AUTH_ROLE_MAPPER_ROLES_PROPERTIES value: "${AUTH_ROLE_MAPPER_ROLES_PROPERTIES}" - name: AUTH_ROLE_MAPPER_REPLACE_ROLE value: "${AUTH_ROLE_MAPPER_REPLACE_ROLE}" volumes: - name: kieserver-keystore-volume secret: secretName: "${KIE_SERVER_HTTPS_SECRET}"
{ "pile_set_name": "Github" }
/* * Copyright 2019. Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://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. */ package com.google.android.apps.playgames.simpleengine; public class ShaderSource { private static final String COMMON_DECLS = "precision mediump float; \n" + "uniform mat4 u_Matrix; \n" + "uniform vec4 u_Color; \n" + "uniform float u_TintFactor; \n" + "uniform sampler2D u_Sampler; \n " + "varying vec4 v_Color; \n" + "varying vec2 v_TexCoord; \n"; public static final String VERTEX_SHADER = COMMON_DECLS + "attribute vec4 a_Position; \n" + "attribute vec2 a_TexCoord; \n" + "void main() \n" + "{ \n" + " v_Color = u_Color; \n" + " v_TexCoord = a_TexCoord; \n" + " gl_Position = u_Matrix * a_Position; \n" + "} \n"; public static final String FRAG_SHADER = COMMON_DECLS + "void main() \n" + "{ \n" + " vec4 c = mix(texture2D(u_Sampler, v_TexCoord), u_Color, u_TintFactor);\n" + " gl_FragColor = c;\n" + "}\n"; }
{ "pile_set_name": "Github" }
![DynamicColor](http://yannickloriot.com/resources/dynamiccolor-header.png) [![Supported Plateforms](https://cocoapod-badges.herokuapp.com/p/DynamicColor/badge.svg)](http://cocoadocs.org/docsets/DynamicColor/) [![Version](https://cocoapod-badges.herokuapp.com/v/DynamicColor/badge.svg)](http://cocoadocs.org/docsets/DynamicColor/) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Build Status](https://travis-ci.org/yannickl/DynamicColor.png?branch=master)](https://travis-ci.org/yannickl/DynamicColor) DynamicColor provides powerful methods to manipulate colours in an easy way. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-sample-screenshot.png" alt="example screenshot" width="300" /> </p> ## Usage #### Darken & Lighten These two create a new color by adjusting the lightness of the receiver. You have to use a value between 0 and 1. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-darkenlighten.png" alt="lighten and darken color" width="280"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let lighterColor = originalColor.lighterColor() // equivalent to // lighterColor = originalColor.lightenColor(0.2) let darkerColor = originalColor.darkerColor() // equivalent to // darkerColor = originalColor.darkenColor(0.2) ``` #### Saturate, Desaturate & Grayscale These will adjust the saturation of the color object, much like `darkenColor` and `lightenColor` adjusted the lightness. Again, you need to use a value between 0 and 1. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-saturateddesaturatedgrayscale.png" alt="saturate, desaturate and grayscale color" width="373"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let saturatedColor = originalColor.saturatedColor() // equivalent to // saturatedColor = originalColor.saturateColor(0.2) let desaturatedColor = originalColor.desaturatedColor() // equivalent to // desaturatedColor = originalColor.desaturateColor(0.2) let grayscaleColor = originalColor.grayscaledColor() ``` #### Adjust-hue & Complement These adjust the hue value of the color in the same way like the others do. Again, it takes a value between 0 and 1 to update the value. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-adjustedhuecomplement.png" alt="ajusted-hue and complement color" width="280"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let adjustHueColor = originalColor.adjustedHueColor(45 / 360) let complementColor = originalColor.complementColor() ```` #### Tint & Shade A tint is the mixture of a color with white and a shade is the mixture of a color with black. Again, it takes a value between 0 and 1 to update the value. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-tintshadecolor.png" alt="tint and shade color" width="280"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let tintColor = originalColor.tintColor() // equivalent to // tintColor = originalColor.tintColor(amount: 0.2) let shadeColor = originalColor.shadeColor() // equivalent to // shadeColor = originalColor.shadeColor(amount: 0.2) ``` #### Invert This can invert the color object. The red, green, and blue values are inverted, while the opacity is left alone. <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-invert.png" alt="invert color" width="187"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let invertColor = originalColor.invertColor() ``` #### Mix This can mix a given color with the receiver. It takes the average of each of the RGB components, optionally weighted by the given percentage (value between 0 and 1). <p align="center"> <img src="http://yannickloriot.com/resources/dynamiccolor-mixcolor.png" alt="mix color" width="373"/> </p> ```swift let originalColor = UIColor(hex: 0xc0392b) let mixColor = originalColor.mixWithColor(UIColor.blueColor()) // equivalent to // mixColor = originalColor.mixWithColor(UIColor.blueColor(), weight: 0.5) ``` #### And many more... `DynamicColor` also provides many another useful methods to manipulate the colors like hex strings, color components, etc. To go further, take a look at the example project. ## Installation #### CocoaPods Install CocoaPods if not already available: ``` bash $ [sudo] gem install cocoapods $ pod setup ``` Go to the directory of your Xcode project, and Create and Edit your Podfile and add _DynamicColor_: ``` bash $ cd /path/to/MyProject $ touch Podfile $ edit Podfile source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' use_frameworks! pod 'DynamicColor', '~> 1.5.4' ``` Install into your project: ``` bash $ pod install ``` Open your project in Xcode from the .xcworkspace file (not the usual project file): ``` bash $ open MyProject.xcworkspace ``` You can now `import DynamicColor` framework into your files. #### Carthage [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application. You can install Carthage with [Homebrew](http://brew.sh/) using the following command: ```bash $ brew update $ brew install carthage ``` To integrate `DynamicColor` into your Xcode project using Carthage, specify it in your `Cartfile` file: ```ogdl github "yannickl/DynamicColor" >= 1.5.4 ``` #### Manually [Download](https://github.com/YannickL/DynamicColor/archive/master.zip) the project and copy the `DynamicColor` folder into your project to use it in. ## Contact Yannick Loriot - [https://twitter.com/yannickloriot](https://twitter.com/yannickloriot) - [contact@yannickloriot.com](mailto:contact@yannickloriot.com) ## License (MIT) Copyright (c) 2015-present - Yannick Loriot Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
{ "pile_set_name": "Github" }
/* Copyright (C) 2006 StrmnNrmn This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #pragma once #ifndef DYNAREC_ASSEMBLYUTILS_H_ #define DYNAREC_ASSEMBLYUTILS_H_ #include <stdlib.h> #include "Base/Types.h" class CCodeLabel { public: CCodeLabel () : mpLocation( nullptr ) {} explicit CCodeLabel( const void * p_location ) : mpLocation( p_location ) { } bool IsSet() const { return mpLocation != nullptr; } const void * GetTarget() const { return mpLocation; } const u8 * GetTargetU8P() const { return reinterpret_cast< const u8 * >( mpLocation ); } private: const void * mpLocation; // This is the location of an arbitrary block of code }; class CJumpLocation { public: CJumpLocation () : mpLocation( nullptr ) {} explicit CJumpLocation( void * p_location ) : mpLocation( p_location ) { } bool IsSet() const { return mpLocation != nullptr; } s32 GetOffset( const CCodeLabel & label ) const { return label.GetTargetU8P() - GetTargetU8P(); } const u8 * GetTargetU8P() const { return reinterpret_cast< const u8 * >( mpLocation ); } u8 * GetWritableU8P() const { //Todo: PSP return reinterpret_cast< u8 * >( MAKE_UNCACHED_PTR(mpLocation) ); //Todo: Check this //return reinterpret_cast< u8 * >( mpLocation ); } private: void * mpLocation; // This is the location of a jump instruction }; namespace AssemblyUtils { bool PatchJumpLong( CJumpLocation jump, CCodeLabel target ); bool PatchJumpLongAndFlush( CJumpLocation jump, CCodeLabel target ); void ReplaceBranchWithJump( CJumpLocation branch, CCodeLabel target ); } #endif // DYNAREC_ASSEMBLYUTILS_H_
{ "pile_set_name": "Github" }
#ifndef BOOST_METAPARSE_V1_STRING_TAG_HPP #define BOOST_METAPARSE_V1_STRING_TAG_HPP // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) namespace boost { namespace metaparse { namespace v1 { struct string_tag { typedef string_tag type; }; } } } #endif
{ "pile_set_name": "Github" }
/* Copyright (c) 2012, Broadcom Europe Ltd All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** \file * MMAL test application which plays back video files * Note: this is test code. Do not use this in your app. It *will* change or even be removed without notice. */ #include <memory.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <stdarg.h> #include "mmalplay.h" VCOS_LOG_CAT_T mmalplay_log_category; #include "interface/mmal/mmal_logging.h" #include "interface/mmal/util/mmal_util.h" #include "interface/mmal/util/mmal_connection.h" #include "interface/mmal/util/mmal_util_params.h" #include "interface/mmal/util/mmal_default_components.h" #define MMALPLAY_STILL_IMAGE_PAUSE 2000 #define MMALPLAY_MAX_STRING 128 #define MMALPLAY_MAX_CONNECTIONS 16 #define MMALPLAY_MAX_RENDERERS 3 static unsigned int video_render_num; /** Structure describing a mmal component */ typedef struct { struct MMALPLAY_T *ctx; MMAL_COMPONENT_T *comp; /* Used for debug / statistics */ char name[MMALPLAY_MAX_STRING]; int64_t time_setup; int64_t time_cleanup; } MMALPLAY_COMPONENT_T; /** Context for a mmalplay playback instance */ struct MMALPLAY_T { const char *uri; VCOS_SEMAPHORE_T event; unsigned int component_num; MMALPLAY_COMPONENT_T component[MMALPLAY_MAX_CONNECTIONS*2]; unsigned int connection_num; MMAL_CONNECTION_T *connection[MMALPLAY_MAX_CONNECTIONS]; MMAL_STATUS_T status; unsigned int stop; MMAL_BOOL_T is_still_image; MMAL_PORT_T *reader_video; MMAL_PORT_T *reader_audio; MMAL_PORT_T *video_out_port; MMAL_PORT_T *converter_out_port; MMAL_PORT_T *audio_clock; MMAL_PORT_T *video_clock; MMALPLAY_OPTIONS_T options; /* Used for debug / statistics */ int64_t time_playback; unsigned int decoded_frames; }; typedef struct MMALPLAY_CONNECTIONS_T { unsigned int num; struct { MMAL_PORT_T *in; MMAL_PORT_T *out; uint32_t flags; } connection[MMALPLAY_MAX_CONNECTIONS+1]; } MMALPLAY_CONNECTIONS_T; #define MMALPLAY_CONNECTION_IN(cx) (cx)->connection[(cx)->num].in #define MMALPLAY_CONNECTION_OUT(cx) (cx)->connection[(cx)->num].out #define MMALPLAY_CONNECTION_ADD(cx) if (++(cx)->num > MMALPLAY_MAX_CONNECTIONS) goto error #define MMALPLAY_CONNECTION_SET(cx, f) do { (cx)->connection[(cx)->num].flags |= (f); } while(0) static MMAL_COMPONENT_T *mmalplay_component_create(MMALPLAY_T *ctx, const char *name, MMAL_STATUS_T *status); static MMAL_STATUS_T mmalplay_connection_create(MMALPLAY_T *ctx, MMAL_PORT_T *out, MMAL_PORT_T *in, uint32_t flags); /* Utility function to setup the container reader component */ static MMAL_STATUS_T mmalplay_setup_container_reader(MMALPLAY_T *, MMAL_COMPONENT_T *, const char *uri); /* Utility function to setup the container writer component */ static MMAL_STATUS_T mmalplay_setup_container_writer(MMALPLAY_T *, MMAL_COMPONENT_T *, const char *uri); /* Utility function to setup the video decoder component */ static MMAL_STATUS_T mmalplay_setup_video_decoder(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the splitter component */ static MMAL_STATUS_T mmalplay_setup_splitter(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the video converter component */ static MMAL_STATUS_T mmalplay_setup_video_converter(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the video render component */ static MMAL_STATUS_T mmalplay_setup_video_render(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the video scheduler component */ static MMAL_STATUS_T mmalplay_setup_video_scheduler(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the audio decoder component */ static MMAL_STATUS_T mmalplay_setup_audio_decoder(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); /* Utility function to setup the audio render component */ static MMAL_STATUS_T mmalplay_setup_audio_render(MMALPLAY_T *ctx, MMAL_COMPONENT_T *); static void log_format(MMAL_ES_FORMAT_T *format, MMAL_PORT_T *port); /*****************************************************************************/ /** Callback from a control port. Error and EOS events stop playback. */ static void mmalplay_bh_control_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { MMALPLAY_T *ctx = (MMALPLAY_T *)port->userdata; LOG_TRACE("%s(%p),%p,%4.4s", port->name, port, buffer, (char *)&buffer->cmd); if (buffer->cmd == MMAL_EVENT_ERROR || buffer->cmd == MMAL_EVENT_EOS) { if (buffer->cmd == MMAL_EVENT_ERROR) { LOG_INFO("error event from %s: %s", port->name, mmal_status_to_string(*(MMAL_STATUS_T*)buffer->data)); ctx->status = *(MMAL_STATUS_T *)buffer->data; } else if (buffer->cmd == MMAL_EVENT_EOS) LOG_INFO("%s: EOS received", port->name); mmalplay_stop(ctx); } mmal_buffer_header_release(buffer); } /** Callback from the connection. Buffer is available. */ static void mmalplay_connection_cb(MMAL_CONNECTION_T *connection) { MMALPLAY_T *ctx = (MMALPLAY_T *)connection->user_data; vcos_semaphore_post(&ctx->event); } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_event_handle(MMAL_CONNECTION_T *connection, MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) { MMAL_STATUS_T status = MMAL_SUCCESS; LOG_INFO("%s(%p) received event %4.4s (%i bytes)", port->name, port, (char *)&buffer->cmd, (int)buffer->length); if (buffer->cmd == MMAL_EVENT_FORMAT_CHANGED && port->type == MMAL_PORT_TYPE_OUTPUT) { MMAL_EVENT_FORMAT_CHANGED_T *event = mmal_event_format_changed_get(buffer); if (event) { LOG_INFO("----------Port format changed----------"); log_format(port->format, port); LOG_INFO("-----------------to---------------------"); log_format(event->format, 0); LOG_INFO(" buffers num (opt %i, min %i), size (opt %i, min: %i)", event->buffer_num_recommended, event->buffer_num_min, event->buffer_size_recommended, event->buffer_size_min); LOG_INFO("----------------------------------------"); } status = mmal_connection_event_format_changed(connection, buffer); } mmal_buffer_header_release(buffer); return status; } static MMAL_STATUS_T mmalplay_pipeline_audio_create(MMALPLAY_T *ctx, MMAL_PORT_T *source, MMALPLAY_CONNECTIONS_T *connections) { MMAL_STATUS_T status; MMAL_COMPONENT_T *component; unsigned int save = connections->num; if (!source || ctx->options.disable_audio) return MMAL_EINVAL; MMALPLAY_CONNECTION_OUT(connections) = source; /* Create and setup audio decoder component */ component = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_AUDIO_DECODER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); MMALPLAY_CONNECTION_OUT(connections) = component->output[0]; /* Create and setup audio render component */ component = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_AUDIO_RENDERER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); return MMAL_SUCCESS; error: connections->num = save; return status == MMAL_SUCCESS ? MMAL_ENOSPC : status; } static MMAL_STATUS_T mmalplay_pipeline_video_create(MMALPLAY_T *ctx, MMAL_PORT_T *source, MMALPLAY_CONNECTIONS_T *connections) { MMAL_STATUS_T status; MMAL_COMPONENT_T *component, *previous = NULL; unsigned int i, save = connections->num; if (!source || ctx->options.disable_video) return MMAL_EINVAL; MMALPLAY_CONNECTION_OUT(connections) = source; if (ctx->options.output_uri) { /* Create and setup container writer component */ component = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_CONTAINER_WRITER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); return MMAL_SUCCESS; } /* Create and setup video decoder component */ if (!ctx->options.disable_video_decode) { component = previous = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_VIDEO_DECODER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); MMALPLAY_CONNECTION_OUT(connections) = component->output[0]; } else ctx->video_out_port = source; if (ctx->options.enable_scheduling) { /* Create a scheduler component */ component = previous = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_SCHEDULER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); MMALPLAY_CONNECTION_OUT(connections) = component->output[0]; } /* Create and setup video converter component */ if (ctx->options.render_format || (ctx->options.render_rect.width && ctx->options.render_rect.height)) { component = previous = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_VIDEO_CONVERTER, &status); if (!component) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); MMALPLAY_CONNECTION_OUT(connections) = component->output[0]; } if (ctx->options.output_num > 1) { /* Create and setup splitter component */ component = previous = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_SPLITTER, &status); if (!component || component->output_num < ctx->options.output_num) goto error; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); MMALPLAY_CONNECTION_OUT(connections) = component->output[0]; } /* Create and setup video render components */ for (i = 0; i < ctx->options.output_num; i++) { component = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &status); if (!component) goto error; MMALPLAY_CONNECTION_OUT(connections) = previous ? previous->output[i] : source; MMALPLAY_CONNECTION_IN(connections) = component->input[0]; MMALPLAY_CONNECTION_ADD(connections); } return MMAL_SUCCESS; error: connections->num = save; return status == MMAL_SUCCESS ? MMAL_ENOSPC : status; } static MMAL_STATUS_T mmalplay_pipeline_clock_create(MMALPLAY_T *ctx, MMALPLAY_CONNECTIONS_T *connections) { MMAL_STATUS_T status = MMAL_EINVAL; if (!ctx->options.enable_scheduling) return MMAL_SUCCESS; if (!ctx->audio_clock || !ctx->video_clock) { LOG_ERROR("clock port(s) not present %p %p", ctx->audio_clock, ctx->video_clock); return MMAL_SUCCESS; } /* Connect audio clock to video clock */ MMALPLAY_CONNECTION_SET(connections, MMAL_CONNECTION_FLAG_TUNNELLING); MMALPLAY_CONNECTION_OUT(connections) = ctx->audio_clock; MMALPLAY_CONNECTION_IN(connections) = ctx->video_clock; MMALPLAY_CONNECTION_ADD(connections); /* Set audio clock as master */ status = mmal_port_parameter_set_boolean(ctx->audio_clock, MMAL_PARAMETER_CLOCK_REFERENCE, MMAL_TRUE); if (status != MMAL_SUCCESS) LOG_ERROR("failed to set clock reference"); error: return status; } /** Create an instance of mmalplay. * Note: this is test code. Do not use it in your app. It *will* change or even be removed without notice. */ MMALPLAY_T *mmalplay_create(const char *uri, MMALPLAY_OPTIONS_T *opts, MMAL_STATUS_T *pstatus) { MMAL_STATUS_T status = MMAL_SUCCESS, status_audio, status_video, status_clock; MMALPLAY_T *ctx; MMAL_COMPONENT_T *component; MMALPLAY_CONNECTIONS_T connections; unsigned int i; LOG_TRACE("%s", uri); if (pstatus) *pstatus = MMAL_ENOMEM; /* Allocate and initialise context */ ctx = malloc(sizeof(MMALPLAY_T)); if (!ctx) return NULL; memset(ctx, 0, sizeof(*ctx)); memset(&connections, 0, sizeof(connections)); if (vcos_semaphore_create(&ctx->event, "MMALTest", 1) != VCOS_SUCCESS) { free(ctx); return NULL; } ctx->uri = uri; if (opts) ctx->options = *opts; ctx->options.output_num = MMAL_MAX(ctx->options.output_num, 1); ctx->options.output_num = MMAL_MIN(ctx->options.output_num, MMALPLAY_MAX_RENDERERS); connections.num = 0; /* Create and setup the container reader component */ component = mmalplay_component_create(ctx, MMAL_COMPONENT_DEFAULT_CONTAINER_READER, &status); if (!component) goto error; status_video = mmalplay_pipeline_video_create(ctx, ctx->reader_video, &connections); status_audio = mmalplay_pipeline_audio_create(ctx, ctx->reader_audio, &connections); status_clock = mmalplay_pipeline_clock_create(ctx, &connections); if (status_video != MMAL_SUCCESS && status_audio != MMAL_SUCCESS && status_clock != MMAL_SUCCESS) { status = status_video; goto error; } /* Create our connections */ for (i = 0; i < connections.num; i++) { status = mmalplay_connection_create(ctx, connections.connection[i].out, connections.connection[i].in, connections.connection[i].flags); if (status != MMAL_SUCCESS) goto error; } /* Enable our connections */ for (i = 0; i < ctx->connection_num; i++) { status = mmal_connection_enable(ctx->connection[i]); if (status != MMAL_SUCCESS) goto error; } if (pstatus) *pstatus = MMAL_SUCCESS; return ctx; error: mmalplay_destroy(ctx); if (status == MMAL_SUCCESS) status = MMAL_ENOSPC; if (pstatus) *pstatus = status; return NULL; } /** Start playback on an instance of mmalplay. * Note: this is test code. Do not use it in your app. It *will* change or even be removed without notice. */ MMAL_STATUS_T mmalplay_play(MMALPLAY_T *ctx) { MMAL_STATUS_T status = MMAL_SUCCESS; unsigned int i; LOG_TRACE("%p, %s", ctx, ctx->uri); ctx->time_playback = vcos_getmicrosecs(); /* Start the clocks */ if (ctx->video_clock) mmal_port_parameter_set_boolean(ctx->video_clock, MMAL_PARAMETER_CLOCK_ACTIVE, MMAL_TRUE); if (ctx->audio_clock) mmal_port_parameter_set_boolean(ctx->audio_clock, MMAL_PARAMETER_CLOCK_ACTIVE, MMAL_TRUE); while(1) { MMAL_BUFFER_HEADER_T *buffer; vcos_semaphore_wait(&ctx->event); if (ctx->stop || ctx->status != MMAL_SUCCESS) { status = ctx->status; break; } /* Loop through all the connections */ for (i = 0; i < ctx->connection_num; i++) { MMAL_CONNECTION_T *connection = ctx->connection[i]; if (connection->flags & MMAL_CONNECTION_FLAG_TUNNELLING) continue; /* Nothing else to do in tunnelling mode */ /* Send any queued buffer to the next component */ buffer = mmal_queue_get(connection->queue); while (buffer) { if (buffer->cmd) { status = mmalplay_event_handle(connection, connection->out, buffer); if (status != MMAL_SUCCESS) goto error; buffer = mmal_queue_get(connection->queue); continue; } /* Code specific to handling of the video output port */ if (connection->out == ctx->video_out_port) { if (buffer->length) ctx->decoded_frames++; if (ctx->options.stepping) getchar(); } status = mmal_port_send_buffer(connection->in, buffer); if (status != MMAL_SUCCESS) { LOG_ERROR("mmal_port_send_buffer failed (%i)", status); mmal_queue_put_back(connection->queue, buffer); goto error; } buffer = mmal_queue_get(connection->queue); } /* Send empty buffers to the output port of the connection */ buffer = connection->pool ? mmal_queue_get(connection->pool->queue) : NULL; while (buffer) { status = mmal_port_send_buffer(connection->out, buffer); if (status != MMAL_SUCCESS) { LOG_ERROR("mmal_port_send_buffer failed (%i)", status); mmal_queue_put_back(connection->pool->queue, buffer); goto error; } buffer = mmal_queue_get(connection->pool->queue); } } } error: ctx->time_playback = vcos_getmicrosecs() - ctx->time_playback; /* For still images we want to pause a bit once they are displayed */ if (ctx->is_still_image && status == MMAL_SUCCESS) vcos_sleep(MMALPLAY_STILL_IMAGE_PAUSE); return status; } /** Stop the playback on an instance of mmalplay. * Note: this is test code. Do not use it in your app. It *will* change or even be removed without notice. */ void mmalplay_stop(MMALPLAY_T *ctx) { ctx->stop = 1; vcos_semaphore_post(&ctx->event); } /** Destroys an instance of mmalplay. * Note: this is test code. Do not use it in your app. It *will* change or even be removed without notice. */ void mmalplay_destroy(MMALPLAY_T *ctx) { unsigned int i; LOG_TRACE("%p, %s", ctx, ctx->uri); /* Disable connections */ for (i = ctx->connection_num; i; i--) mmal_connection_disable(ctx->connection[i-1]); LOG_INFO("--- statistics ---"); LOG_INFO("decoded %i frames in %.2fs (%.2ffps)", (int)ctx->decoded_frames, ctx->time_playback / 1000000.0, ctx->decoded_frames * 1000000.0 / ctx->time_playback); for (i = 0; i < ctx->connection_num; i++) { LOG_INFO("%s", ctx->connection[i]->name); LOG_INFO("- setup time: %ims", (int)(ctx->connection[i]->time_setup / 1000)); LOG_INFO("- enable time: %ims, disable time: %ims", (int)(ctx->connection[i]->time_enable / 1000), (int)(ctx->connection[i]->time_disable / 1000)); } /* Destroy connections */ for (i = ctx->connection_num; i; i--) mmal_connection_destroy(ctx->connection[i-1]); /* Destroy components */ for (i = ctx->component_num; i; i--) { ctx->component[i-1].time_cleanup = vcos_getmicrosecs(); mmal_component_destroy(ctx->component[i-1].comp); ctx->component[i-1].time_cleanup = vcos_getmicrosecs() - ctx->component[i-1].time_cleanup; } vcos_semaphore_delete(&ctx->event); for (i = 0; i < ctx->component_num; i++) { LOG_INFO("%s:", ctx->component[i].name); LOG_INFO("- setup time: %ims, cleanup time: %ims", (int)(ctx->component[i].time_setup / 1000), (int)(ctx->component[i].time_cleanup / 1000)); } LOG_INFO("-----------------"); free(ctx); } /*****************************************************************************/ static MMAL_COMPONENT_T *mmalplay_component_create(MMALPLAY_T *ctx, const char *name, MMAL_STATUS_T *status) { MMALPLAY_COMPONENT_T *component = &ctx->component[ctx->component_num]; const char *component_name = name; LOG_TRACE("%p, %s", ctx, name); if (ctx->component_num >= MMAL_COUNTOF(ctx->component)) { *status = MMAL_ENOSPC; return NULL; } /* Decide whether we want an image decoder instead of a video_decoder */ if (ctx->is_still_image && !strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_DECODER) && !ctx->options.component_video_decoder) ctx->options.component_video_decoder = MMAL_COMPONENT_DEFAULT_IMAGE_DECODER; /* Override name if requested by the user */ if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_DECODER) && ctx->options.component_video_decoder) component_name = ctx->options.component_video_decoder; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_SPLITTER) && ctx->options.component_splitter) component_name = ctx->options.component_splitter; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER) && ctx->options.component_video_render) component_name = ctx->options.component_video_render; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_CONVERTER) && ctx->options.component_video_converter) component_name = ctx->options.component_video_converter; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_SCHEDULER) && ctx->options.component_video_scheduler) component_name = ctx->options.component_video_scheduler; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_AUDIO_DECODER) && ctx->options.component_audio_decoder) component_name = ctx->options.component_audio_decoder; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_AUDIO_RENDERER) && ctx->options.component_audio_render) component_name = ctx->options.component_audio_render; else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_CONTAINER_READER) && ctx->options.component_container_reader) component_name = ctx->options.component_container_reader; component->comp = NULL; vcos_safe_strcpy(component->name, component_name, sizeof(component->name), 0); component->time_setup = vcos_getmicrosecs(); /* Create the component */ *status = mmal_component_create(component_name, &component->comp); if(*status != MMAL_SUCCESS) { LOG_ERROR("couldn't create %s", component_name); goto error; } if (!strcmp(name, MMAL_COMPONENT_DEFAULT_CONTAINER_READER)) *status = mmalplay_setup_container_reader(ctx, component->comp, ctx->uri); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_CONTAINER_WRITER)) *status = mmalplay_setup_container_writer(ctx, component->comp, ctx->options.output_uri); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_DECODER)) *status = mmalplay_setup_video_decoder(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_SPLITTER)) *status = mmalplay_setup_splitter(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_CONVERTER)) *status = mmalplay_setup_video_converter(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER)) *status = mmalplay_setup_video_render(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_SCHEDULER)) *status = mmalplay_setup_video_scheduler(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_AUDIO_DECODER)) *status = mmalplay_setup_audio_decoder(ctx, component->comp); else if (!strcmp(name, MMAL_COMPONENT_DEFAULT_AUDIO_RENDERER)) *status = mmalplay_setup_audio_render(ctx, component->comp); if (*status != MMAL_SUCCESS) goto error; /* Enable component */ *status = mmal_component_enable(component->comp); if(*status) { LOG_ERROR("%s couldn't be enabled", component_name); goto error; } /* Enable control port. The callback specified here is the function which * will be called when an empty buffer header comes back to the port. */ component->comp->control->userdata = (void *)ctx; *status = mmal_port_enable(component->comp->control, mmalplay_bh_control_cb); if (*status) { LOG_ERROR("control port couldn't be enabled"); goto error; } component->time_setup = vcos_getmicrosecs() - component->time_setup; ctx->component_num++; return component->comp; error: component->time_setup = vcos_getmicrosecs() - component->time_setup; if (component->comp) mmal_component_destroy(component->comp); return NULL; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_connection_create(MMALPLAY_T *ctx, MMAL_PORT_T *out, MMAL_PORT_T *in, uint32_t flags) { MMAL_CONNECTION_T **connection = &ctx->connection[ctx->connection_num]; uint32_t encoding_override = MMAL_ENCODING_UNKNOWN; MMAL_RECT_T *rect_override = NULL; MMAL_BOOL_T format_override = MMAL_FALSE; MMAL_STATUS_T status; if (ctx->connection_num >= MMAL_COUNTOF(ctx->connection)) return MMAL_ENOMEM; /* Globally enable tunnelling if requested by the user */ flags |= ctx->options.tunnelling ? MMAL_CONNECTION_FLAG_TUNNELLING : 0; /* Apply any override to the format specified by the user */ if (out == ctx->video_out_port) { encoding_override = ctx->options.output_format; rect_override = &ctx->options.output_rect; } else if (out == ctx->converter_out_port) { encoding_override = ctx->options.render_format; rect_override = &ctx->options.render_rect; } if (encoding_override != MMAL_ENCODING_UNKNOWN && encoding_override != out->format->encoding) { out->format->encoding = encoding_override; format_override = MMAL_TRUE; } if (rect_override && rect_override->width && rect_override->height) { out->format->es->video.crop = *rect_override; out->format->es->video.width = rect_override->width; out->format->es->video.height = rect_override->height; format_override = MMAL_TRUE; } if (format_override) { status = mmal_port_format_commit(out); if (status != MMAL_SUCCESS) { LOG_ERROR("cannot override format on output port %s", out->name); return status; } } /* Create the actual connection */ status = mmal_connection_create(connection, out, in, flags); if (status != MMAL_SUCCESS) { LOG_ERROR("cannot create connection"); return status; } /* Set our connection callback */ (*connection)->callback = mmalplay_connection_cb; (*connection)->user_data = (void *)ctx; log_format(out->format, out); log_format(in->format, in); ctx->connection_num++; return MMAL_SUCCESS; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_video_decoder(MMALPLAY_T *ctx, MMAL_COMPONENT_T *decoder) { MMAL_PARAMETER_BOOLEAN_T param_zc = {{MMAL_PARAMETER_ZERO_COPY, sizeof(MMAL_PARAMETER_BOOLEAN_T)}, 1}; MMAL_STATUS_T status = MMAL_EINVAL; if(!decoder->input_num || !decoder->output_num) { LOG_ERROR("%s doesn't have input/output ports", decoder->name); goto error; } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_input) { status = mmal_port_parameter_set(decoder->input[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", decoder->input[0]->name); goto error; } } if (!ctx->options.copy_output) { status = mmal_port_parameter_set(decoder->output[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", decoder->output[0]->name); goto error; } } ctx->video_out_port = decoder->output[0]; status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_splitter(MMALPLAY_T *ctx, MMAL_COMPONENT_T *splitter) { MMAL_STATUS_T status = MMAL_EINVAL; if(!splitter->input_num || !splitter->output_num) { LOG_ERROR("%s doesn't have input ports", splitter->name); goto error; } if(splitter->output_num < ctx->options.output_num) { LOG_ERROR("%s doesn't have enough output ports (%u/%u)", splitter->name, (unsigned int)splitter->output_num, ctx->options.output_num); goto error; } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_output) { MMAL_PARAMETER_BOOLEAN_T param_zc = {{MMAL_PARAMETER_ZERO_COPY, sizeof(MMAL_PARAMETER_BOOLEAN_T)}, 1}; unsigned int i; status = mmal_port_parameter_set(splitter->input[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", splitter->input[0]->name); goto error; } for (i = 0; i < splitter->output_num; i++) { status = mmal_port_parameter_set(splitter->output[i], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", splitter->output[i]->name); goto error; } } } status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_video_converter(MMALPLAY_T *ctx, MMAL_COMPONENT_T *converter) { MMAL_PARAMETER_BOOLEAN_T param_zc = {{MMAL_PARAMETER_ZERO_COPY, sizeof(MMAL_PARAMETER_BOOLEAN_T)}, 1}; MMAL_STATUS_T status = MMAL_EINVAL; if(!converter->input_num || !converter->output_num) { LOG_ERROR("%s doesn't have input/output ports", converter->name); goto error; } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_output) { status = mmal_port_parameter_set(converter->input[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", converter->input[0]->name); goto error; } status = mmal_port_parameter_set(converter->output[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", converter->output[0]->name); goto error; } } ctx->converter_out_port = converter->output[0]; status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_video_render(MMALPLAY_T *ctx, MMAL_COMPONENT_T *render) { MMAL_STATUS_T status = MMAL_EINVAL; unsigned int render_num; if(!render->input_num) { LOG_ERROR("%s doesn't have input ports", render->name); goto error; } render_num = video_render_num++; /* Give higher priority to the overlay layer */ MMAL_DISPLAYREGION_T param; param.hdr.id = MMAL_PARAMETER_DISPLAYREGION; param.hdr.size = sizeof(MMAL_DISPLAYREGION_T); param.set = MMAL_DISPLAY_SET_LAYER|MMAL_DISPLAY_SET_NUM; param.layer = ctx->options.render_layer + 2; /* Offset of two to put it above the Android UI layer */ param.display_num = ctx->options.video_destination; if (ctx->options.window) { param.dest_rect.x = 0; param.dest_rect.width = 512; param.dest_rect.height = 256; param.dest_rect.y = param.dest_rect.height * render_num; param.mode = MMAL_DISPLAY_MODE_LETTERBOX; param.fullscreen = 0; param.set |= MMAL_DISPLAY_SET_DEST_RECT|MMAL_DISPLAY_SET_MODE|MMAL_DISPLAY_SET_FULLSCREEN; } status = mmal_port_parameter_set( render->input[0], &param.hdr ); if(status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("could not set video render layer on %s", render->input[0]->name); goto error; } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_output) { MMAL_PARAMETER_BOOLEAN_T param_zc = {{MMAL_PARAMETER_ZERO_COPY, sizeof(MMAL_PARAMETER_BOOLEAN_T)}, 1}; status = mmal_port_parameter_set(render->input[0], &param_zc.hdr); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", render->input[0]->name); goto error; } } status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_container_reader(MMALPLAY_T *ctx, MMAL_COMPONENT_T *reader, const char *uri) { MMAL_PARAMETER_SEEK_T seek = {{MMAL_PARAMETER_SEEK, sizeof(MMAL_PARAMETER_SEEK_T)},0,0}; MMAL_PARAMETER_STRING_T *param = 0; unsigned int param_size, track_audio, track_video; MMAL_STATUS_T status = MMAL_EINVAL; uint32_t encoding; size_t uri_len; if(!reader->output_num) { LOG_ERROR("%s doesn't have output ports", reader->name); goto error; } /* Open the given URI */ uri_len = strlen(uri); param_size = sizeof(MMAL_PARAMETER_STRING_T) + uri_len; param = malloc(param_size); if(!param) { LOG_ERROR("out of memory"); status = MMAL_ENOMEM; goto error; } memset(param, 0, param_size); param->hdr.id = MMAL_PARAMETER_URI; param->hdr.size = param_size; vcos_safe_strcpy(param->str, uri, uri_len + 1, 0); status = mmal_port_parameter_set(reader->control, &param->hdr); if(status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("%s could not open file %s", reader->name, uri); goto error; } status = MMAL_SUCCESS; /* Look for a video track */ for(track_video = 0; track_video < reader->output_num; track_video++) if(reader->output[track_video]->format->type == MMAL_ES_TYPE_VIDEO) break; if(track_video != reader->output_num) { ctx->reader_video = reader->output[track_video]; /* Try to detect still images */ encoding = ctx->reader_video->format->encoding; if (encoding == MMAL_ENCODING_JPEG || encoding == MMAL_ENCODING_GIF || encoding == MMAL_ENCODING_PNG || encoding == MMAL_ENCODING_PPM || encoding == MMAL_ENCODING_TGA || encoding == MMAL_ENCODING_BMP) ctx->is_still_image = 1; } /* Look for an audio track */ for(track_audio = 0; track_audio < reader->output_num; track_audio++) if(reader->output[track_audio]->format->type == MMAL_ES_TYPE_AUDIO) break; if(track_audio != reader->output_num) ctx->reader_audio = reader->output[track_audio]; if(track_video == reader->output_num && track_audio == reader->output_num) { LOG_ERROR("no track to decode"); status = MMAL_EINVAL; goto error; } LOG_INFO("----Reader input port format-----"); if(track_video != reader->output_num) log_format(reader->output[track_video]->format, 0); if(track_audio != reader->output_num) log_format(reader->output[track_audio]->format, 0); if(ctx->options.seeking) { LOG_DEBUG("seek to %fs", ctx->options.seeking); seek.offset = ctx->options.seeking * INT64_C(1000000); status = mmal_port_parameter_set(reader->control, &seek.hdr); if(status != MMAL_SUCCESS) LOG_ERROR("failed to seek to %fs", ctx->options.seeking); } error: if(param) free(param); return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_container_writer(MMALPLAY_T *ctx, MMAL_COMPONENT_T *writer, const char *uri) { MMAL_PARAMETER_URI_T *param = 0; unsigned int param_size; MMAL_STATUS_T status = MMAL_EINVAL; size_t uri_len; MMAL_PARAM_UNUSED(ctx); if(!writer->input_num) { LOG_ERROR("%s doesn't have input ports", writer->name); goto error; } /* Open the given URI */ uri_len = strlen(uri); param_size = sizeof(MMAL_PARAMETER_HEADER_T) + uri_len; param = malloc(param_size); if(!param) { LOG_ERROR("out of memory"); status = MMAL_ENOMEM; goto error; } memset(param, 0, param_size); param->hdr.id = MMAL_PARAMETER_URI; param->hdr.size = param_size; vcos_safe_strcpy(param->uri, uri, uri_len + 1, 0); status = mmal_port_parameter_set(writer->control, &param->hdr); if(status != MMAL_SUCCESS) { LOG_ERROR("could not open file %s", uri); goto error; } error: if(param) free(param); return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_video_scheduler(MMALPLAY_T *ctx, MMAL_COMPONENT_T *scheduler) { MMAL_STATUS_T status = MMAL_EINVAL; if (!scheduler->input_num || !scheduler->output_num || !scheduler->clock_num) { LOG_ERROR("%s doesn't have input/output/clock ports", scheduler->name); goto error; } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_output) { status = mmal_port_parameter_set_boolean(scheduler->input[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", scheduler->input[0]->name); goto error; } status = mmal_port_parameter_set_boolean(scheduler->output[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", scheduler->output[0]->name); goto error; } } /* Save a copy of the clock port to connect to the audio clock port */ ctx->video_clock = scheduler->clock[0]; status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_audio_decoder(MMALPLAY_T *ctx, MMAL_COMPONENT_T *decoder) { MMAL_STATUS_T status = MMAL_EINVAL; if (!decoder->input_num || !decoder->output_num) { LOG_ERROR("%s doesn't have input/output ports", decoder->name); goto error; } if (ctx->options.audio_passthrough) { status = mmal_port_parameter_set_boolean(decoder->control, MMAL_PARAMETER_AUDIO_PASSTHROUGH, MMAL_TRUE); if (status != MMAL_SUCCESS) LOG_INFO("could not set audio passthrough mode"); } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_input) { status = mmal_port_parameter_set_boolean(decoder->input[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", decoder->input[0]->name); goto error; } } if (!ctx->options.copy_output) { status = mmal_port_parameter_set_boolean(decoder->output[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", decoder->output[0]->name); goto error; } } status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static MMAL_STATUS_T mmalplay_setup_audio_render(MMALPLAY_T *ctx, MMAL_COMPONENT_T *render) { MMAL_STATUS_T status = MMAL_EINVAL; /* Set the audio destination - not all audio render components support this */ if (ctx->options.audio_destination) { status = mmal_port_parameter_set_string(render->control, MMAL_PARAMETER_AUDIO_DESTINATION, ctx->options.audio_destination); if (status != MMAL_SUCCESS) LOG_INFO("could not set audio destination"); } /* Enable Zero Copy if requested. This needs to be sent before enabling the port. */ if (!ctx->options.copy_output) { status = mmal_port_parameter_set_boolean(render->input[0], MMAL_PARAMETER_ZERO_COPY, MMAL_TRUE); if (status != MMAL_SUCCESS && status != MMAL_ENOSYS) { LOG_ERROR("failed to set zero copy on %s", render->input[0]->name); goto error; } } if (render->clock_num) ctx->audio_clock = render->clock[0]; else LOG_ERROR("%s doesn't have a clock port", render->name); status = MMAL_SUCCESS; error: return status; } /*****************************************************************************/ static void log_format(MMAL_ES_FORMAT_T *format, MMAL_PORT_T *port) { const char *name_type; if(port) LOG_INFO("%s:%s:%i", port->component->name, port->type == MMAL_PORT_TYPE_CONTROL ? "ctr" : port->type == MMAL_PORT_TYPE_INPUT ? "in" : port->type == MMAL_PORT_TYPE_OUTPUT ? "out" : "invalid", (int)port->index); switch(format->type) { case MMAL_ES_TYPE_AUDIO: name_type = "audio"; break; case MMAL_ES_TYPE_VIDEO: name_type = "video"; break; case MMAL_ES_TYPE_SUBPICTURE: name_type = "subpicture"; break; default: name_type = "unknown"; break; } LOG_INFO("type: %s, fourcc: %4.4s", name_type, (char *)&format->encoding); LOG_INFO(" bitrate: %i, framed: %i", format->bitrate, !!(format->flags & MMAL_ES_FORMAT_FLAG_FRAMED)); LOG_INFO(" extra data: %i, %p", format->extradata_size, format->extradata); switch(format->type) { case MMAL_ES_TYPE_AUDIO: LOG_INFO(" samplerate: %i, channels: %i, bps: %i, block align: %i", format->es->audio.sample_rate, format->es->audio.channels, format->es->audio.bits_per_sample, format->es->audio.block_align); break; case MMAL_ES_TYPE_VIDEO: LOG_INFO(" width: %i, height: %i, (%i,%i,%i,%i)", format->es->video.width, format->es->video.height, format->es->video.crop.x, format->es->video.crop.y, format->es->video.crop.width, format->es->video.crop.height); LOG_INFO(" pixel aspect ratio: %i/%i, frame rate: %i/%i", format->es->video.par.num, format->es->video.par.den, format->es->video.frame_rate.num, format->es->video.frame_rate.den); break; case MMAL_ES_TYPE_SUBPICTURE: break; default: break; } if(!port) return; LOG_INFO(" buffers num: %i(opt %i, min %i), size: %i(opt %i, min: %i), align: %i", port->buffer_num, port->buffer_num_recommended, port->buffer_num_min, port->buffer_size, port->buffer_size_recommended, port->buffer_size_min, port->buffer_alignment_min); }
{ "pile_set_name": "Github" }
0.preset.3=eNrTNbQO8ffSNgvQDkksSk8tsTazNgDDtMSc4lQoaW1oam1obWYAlTI2sDY0BAqUFJWmYiUguiwNrE1RjEEmweoMDTBswlRpgKzDzAAATE06Sg== 0.preset.2=eNrTNbT2K83JKcjPzczL13bMydEOLsjMszazNgDDtMSc4lQoaW1oam1obWYAlTI2sDY0tDayLikqTcVKQHQZWhhYm6KYAyER6gwNgCYha8Gi2gAsDwAI4zoF 0.preset.1=eNrTNbR2yslPzk7Kr7A2szYAw7TEnOJUKGltaGptaG1mAJUyNrA2NATSJUWlqSjqMEldQ2tTLMJIOg0NgKah2oapHuocAJ0hN9M\= 0.preset.0=eNrTNbQO8feyNrM2AMO0xJziVChpbWhqbWhtZgCVMjawNjQECpQUlaZiJSC6DC0MrE1RzIGQCHWGBhg2YSo3AKsFADK1NAU\=
{ "pile_set_name": "Github" }
#!/usr/bin/env python from __future__ import division, print_function import os def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('matrixlib', parent_package, top_path) config.add_data_dir('tests') return config if __name__ == "__main__": from numpy.distutils.core import setup config = configuration(top_path='').todict() setup(**config)
{ "pile_set_name": "Github" }
- hosts: localhost roles: - role: create-afs-token # CentOS - role: release-afs-volume afs_volume: mirror.wheel.cent7x64 - role: release-afs-volume afs_volume: mirror.wheel.cent8x64 - role: release-afs-volume afs_volume: mirror.wheel.cent8a64 # Debian - role: release-afs-volume afs_volume: mirror.wheel.busterx64 - role: release-afs-volume afs_volume: mirror.wheel.bustera64 # Ubuntu - role: release-afs-volume afs_volume: mirror.wheel.xenialx64 - role: release-afs-volume afs_volume: mirror.wheel.xeniala64 - role: release-afs-volume afs_volume: mirror.wheel.bionicx64 - role: release-afs-volume afs_volume: mirror.wheel.bionica64 - role: release-afs-volume afs_volume: mirror.wheel.focalx64 - role: release-afs-volume afs_volume: mirror.wheel.focala64 # Fin - role: destroy-afs-token
{ "pile_set_name": "Github" }
/* * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc. * * This file is part of Jam - see jam.c for Copyright information. */ #ifndef JAM_BUILTINS_H # define JAM_BUILTINS_H # include "frames.h" /* * builtins.h - compile parsed jam statements */ void load_builtins(); void init_set(); void init_path(); void init_regex(); void init_property_set(); void init_sequence(); void init_order(); LIST *builtin_calc( PARSE *parse, FRAME *args ); LIST *builtin_depends( PARSE *parse, FRAME *args ); LIST *builtin_rebuilds( PARSE *parse, FRAME *args ); LIST *builtin_echo( PARSE *parse, FRAME *args ); LIST *builtin_exit( PARSE *parse, FRAME *args ); LIST *builtin_flags( PARSE *parse, FRAME *args ); LIST *builtin_glob( PARSE *parse, FRAME *args ); LIST *builtin_glob_recursive( PARSE *parse, FRAME *frame ); LIST *builtin_subst( PARSE *parse, FRAME *args ); LIST *builtin_match( PARSE *parse, FRAME *args ); LIST *builtin_split_by_characters( PARSE *parse, FRAME *args ); LIST *builtin_hdrmacro( PARSE *parse, FRAME *args ); LIST *builtin_rulenames( PARSE *parse, FRAME *args ); LIST *builtin_varnames( PARSE *parse, FRAME *args ); LIST *builtin_delete_module( PARSE *parse, FRAME *args ); LIST *builtin_import( PARSE *parse, FRAME *args ); LIST *builtin_export( PARSE *parse, FRAME *args ); LIST *builtin_caller_module( PARSE *parse, FRAME *args ); LIST *builtin_backtrace( PARSE *parse, FRAME *args ); LIST *builtin_pwd( PARSE *parse, FRAME *args ); LIST *builtin_update( PARSE *parse, FRAME *args ); LIST *builtin_update_now( PARSE *parse, FRAME *args ); LIST *builtin_search_for_target( PARSE *parse, FRAME *args ); LIST *builtin_import_module( PARSE *parse, FRAME *args ); LIST *builtin_imported_modules( PARSE *parse, FRAME *frame ); LIST *builtin_instance( PARSE *parse, FRAME *frame ); LIST *builtin_sort( PARSE *parse, FRAME *frame ); LIST *builtin_normalize_path( PARSE *parse, FRAME *frame ); LIST *builtin_native_rule( PARSE *parse, FRAME *frame ); LIST *builtin_has_native_rule( PARSE *parse, FRAME *frame ); LIST *builtin_user_module( PARSE *parse, FRAME *frame ); LIST *builtin_nearest_user_location( PARSE *parse, FRAME *frame ); LIST *builtin_check_if_file( PARSE *parse, FRAME *frame ); LIST *builtin_python_import_rule( PARSE *parse, FRAME *frame ); LIST *builtin_shell( PARSE *parse, FRAME *frame ); LIST *builtin_md5( PARSE *parse, FRAME *frame ); LIST *builtin_file_open( PARSE *parse, FRAME *frame ); LIST *builtin_pad( PARSE *parse, FRAME *frame ); LIST *builtin_precious( PARSE *parse, FRAME *frame ); LIST *builtin_self_path( PARSE *parse, FRAME *frame ); LIST *builtin_makedir( PARSE *parse, FRAME *frame ); void backtrace( FRAME *frame ); extern int last_update_now_status; #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Author</key> <string>Lectorius, Inc.</string> <key>Builder Version</key> <string>534.57.2</string> <key>CFBundleDisplayName</key> <string>Mitro Helpers Test</string> <key>CFBundleIdentifier</key> <string>com.mitro.helperstest</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleShortVersionString</key> <string>0.9.1</string> <key>CFBundleVersion</key> <string>1</string> <key>Chrome</key> <dict> <key>Database Quota</key> <real>52428800</real> <key>Global Page</key> <string>background.html</string> <key>Popovers</key> <array> <dict> <key>Filename</key> <string>html/popup.html</string> <key>Height</key> <real>400</real> <key>Identifier</key> <string>Popup</string> <key>Width</key> <real>600</real> </dict> </array> <key>Toolbar Items</key> <array> <dict> <key>Identifier</key> <string>mitro-button</string> <key>Image</key> <string>blank.png</string> <key>Label</key> <string>Button</string> <key>Popover</key> <string>Popup</string> </dict> </array> </dict> <key>Content</key> <dict> <key>Blacklist</key> <array> <string>http://selenium.mitro.co/*</string> <string>safari-extension://*/*</string> </array> <key>Scripts</key> <dict> <key>Start</key> <array /> </dict> </dict> <key>ExtensionInfoDictionaryVersion</key> <string>1.0</string> <key>Permissions</key> <dict> <key>Website Access</key> <dict> <key>Include Secure Pages</key> <true/> <key>Level</key> <string>All</string> </dict> </dict> <key>Website</key> <string>https://www.mitro.co</string> </dict> </plist>
{ "pile_set_name": "Github" }
Fix a bug that reading and writing on the same file may cause race on multiple processes.
{ "pile_set_name": "Github" }
/* * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this * file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_LICENSE_HEADER_END@ */ #ifndef _powermanagement_mig_h_ #define _powermanagement_mig_h_ #define kPMMIGStringLength 1024 typedef char * string_t; enum { kIOPMGetValueDWBTSupportOnAC = 1, kIOPMGetValueDWBTSupportOnBatt = 2 }; /* * Arguments to powermanagement.defs MIG call io_pm_assertion_copy_details * parameter "whichData" */ enum { kIOPMAssertionMIGCopyOneAssertionProperties = 1, kIOPMAssertionMIGCopyAll = 2, kIOPMAssertionMIGCopyStatus = 3, kIOPMAssertionMIGCopyTimedOutAssertions = 4, kIOPMPowerEventsMIGCopyScheduledEvents = 5, kIOPMPowerEventsMIGCopyRepeatEvents = 6, }; /* * Arguments to powermanagement.defs MIG call io_pm_assertion_retain_release * parameter "action" */ enum { kIOPMAssertionMIGDoRetain = 1, kIOPMAssertionMIGDoRelease = -1 }; #endif
{ "pile_set_name": "Github" }
/* * Copyright (c) 2010 Jiri Svoboda * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef P_TYPE_H_ #define P_TYPE_H_ #include "mytypes.h" stree_texpr_t *parse_texpr(parse_t *parse); #endif
{ "pile_set_name": "Github" }
ruby: ext: ['.rb', '.rake'] after: ['^#!', '^#.*encoding:'] comment: open: '#\n' close: '#\n' prefix: '# ' perl: ext: ['.pl'] after: ['^#!', '^#.*encoding:'] comment: open: '#\n' close: '#\n' prefix: '# ' # Support PEP 0263 comments: # coding=<encoding name> # -*- coding: <encoding name> -*- # vim: set fileencoding=<encoding name> : python: ext: ['.py'] after: ['^#!', '^#.*coding:', '^#.*coding=', '^#.*fileencoding='] comment: open: '\n' close: '\n' prefix: '# ' html: ext: ['.html', '.htm', '.xhtml'] comment: open: '<!--\n' close: '-->\n' prefix: ' ' php: ext: ['.php'] after: [ '^#!' ] comment: open: '<?php \n/*\n' close: ' */ ?>\n' prefix: ' * ' javacript: ext: ['.js'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * ' css: ext: ['.css'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * ' c: ext: ['.c', '.h'] comment: open: '/*' close: ' */\n\n' prefix: ' * ' cpp: ext: ['.cpp', '.hpp', '.cc', '.hh'] comment: open: '//\n' close: '//\n\n' prefix: '// ' java: ext: ['.java'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * ' groovy: ext: ['.groovy'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * ' haml: ext: ['.haml', '.hamlc'] comment: open: '-#\n' close: '-#\n' prefix: '-# ' coffee: ext: ['.coffee'] comment: open: '###\n' close: '###\n' prefix: '' # M4 macro language, use #, not dnl m4: ext: ['.m4'] comment: open: '#\n' close: '#\n' prefix: '# ' # Most shells, really shell: ext: ['.sh'] after: ['^#!'] comment: open: '#\n' close: '#\n' prefix: '# ' # Use "-- " to make sure e.g. MySQL understands it sql: ext: ['.sql'] comment: open: '-- \n' close: '-- \n' prefix: '-- ' # XML is *not* the same as HTML, and the comments need to go after a # preprocessing directive, if present. # FIXME: only supports single line directives xml: ext: ['.xml', '.xsd', '.mxml'] after: ['^<\?'] comment: open: '<!--\n' close: '-->\n' prefix: ' ' yaml: ext: ['.yml', '.yaml'] comment: open: '#\n' close: '#\n' prefix: '# ' action_script: ext: ['.as'] comment: open: '//\n' close: '//\n\n' prefix: '// ' sass: ext: ['.sass', '.scss'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * ' go: ext: ['.go'] comment: open: '/*\n' close: ' */\n\n' prefix: ' * '
{ "pile_set_name": "Github" }
/* Copyright 2018 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated clientset. package kubernetes
{ "pile_set_name": "Github" }
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M21 5v14h2V5h-2zm-4 14h2V5h-2v14zM15 5H1v14h14V5zM8 7.75c1.24 0 2.25 1.01 2.25 2.25S9.24 12.25 8 12.25 5.75 11.24 5.75 10 6.76 7.75 8 7.75zM12.5 17h-9v-.75c0-1.5 3-2.25 4.5-2.25s4.5.75 4.5 2.25V17z" /> , 'RecentActorsSharp');
{ "pile_set_name": "Github" }
/* Copyright (c) 2009 M. J. D. Powell (mjdp@cam.ac.uk) * Modifications Copyright (c) 2010 Massachusetts Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
{ "pile_set_name": "Github" }
syntax = "proto3"; package envoy.service.discovery.v4alpha; import "envoy/service/discovery/v4alpha/discovery.proto"; import "udpa/annotations/status.proto"; import "udpa/annotations/versioning.proto"; option java_package = "io.envoyproxy.envoy.service.discovery.v4alpha"; option java_outer_classname = "AdsProto"; option java_multiple_files = true; option java_generic_services = true; option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; // [#protodoc-title: Aggregated Discovery Service (ADS)] // [#not-implemented-hide:] Discovery services for endpoints, clusters, routes, // and listeners are retained in the package `envoy.api.v2` for backwards // compatibility with existing management servers. New development in discovery // services should proceed in the package `envoy.service.discovery.v2`. // See https://github.com/lyft/envoy-api#apis for a description of the role of // ADS and how it is intended to be used by a management server. ADS requests // have the same structure as their singleton xDS counterparts, but can // multiplex many resource types on a single stream. The type_url in the // DiscoveryRequest/DiscoveryResponse provides sufficient information to recover // the multiplexed singleton APIs at the Envoy instance and management server. service AggregatedDiscoveryService { // This is a gRPC-only API. rpc StreamAggregatedResources(stream DiscoveryRequest) returns (stream DiscoveryResponse) { } rpc DeltaAggregatedResources(stream DeltaDiscoveryRequest) returns (stream DeltaDiscoveryResponse) { } } // [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing // services: https://github.com/google/protobuf/issues/4221 message AdsDummy { option (udpa.annotations.versioning).previous_message_type = "envoy.service.discovery.v3.AdsDummy"; }
{ "pile_set_name": "Github" }
// Helper for combining css classes inside components export type IClassName = string | string[] | IClassNameMap; export type IClassNameMap = { [className: string]: boolean | any; }; export function cssNames(...args: IClassName[]): string { const map: IClassNameMap = {}; args.forEach(className => { if (typeof className === "string" || Array.isArray(className)) { [].concat(className).forEach(name => map[name] = true); } else { Object.assign(map, className); } }); return Object.entries(map) .filter(([className, isActive]) => !!isActive) .map(([className]) => className.trim()) .join(' '); }
{ "pile_set_name": "Github" }
{ "info" : { "version" : 1, "author" : "xcode" } }
{ "pile_set_name": "Github" }
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4-1.js ECMA Section: 15.6.4 Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). Author: christine@netscape.com Date: 30 september 1997 */ var VERSION = "ECMA_1" startTest(); var SECTION = "15.6.4-1"; writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) ); new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) ); new TestCase( SECTION, "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", "[object Boolean]", eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); test();
{ "pile_set_name": "Github" }
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ import {DebugElement, NO_ERRORS_SCHEMA} from '@angular/core'; import {TestBed} from '@angular/core/testing'; import {MatButtonModule} from '@angular/material/button'; import {MatTabsModule} from '@angular/material/tabs'; import {MatToolbarModule} from '@angular/material/toolbar'; import {MatSelectModule} from '@angular/material/select'; import {By} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {Store} from '@ngrx/store'; import {provideMockStore, MockStore} from '@ngrx/store/testing'; import {MatIconTestingModule} from '../testing/mat_icon_module'; import {HeaderComponent} from './header_component'; import {PluginSelectorComponent} from './plugin_selector_component'; import {PluginSelectorContainer} from './plugin_selector_container'; import {ReloadContainer} from './reload_container'; import { getPluginsListLoaded, getActivePlugin, getPlugins, } from '../core/store/core_selectors'; import {DataLoadState} from '../types/data'; import {changePlugin, manualReload} from '../core/actions'; import {State} from '../core/store'; import { createPluginMetadata, createState, createCoreState, buildPluginMetadata, } from '../core/testing'; import {PluginId} from '../types/api'; /** @typehack */ import * as _typeHackStore from '@ngrx/store'; describe('header test', () => { let store: MockStore<State>; beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ MatButtonModule, MatIconTestingModule, MatSelectModule, MatTabsModule, MatToolbarModule, NoopAnimationsModule, ], providers: [ provideMockStore({ initialState: createState( createCoreState({ plugins: { foo: createPluginMetadata('Foo Fighter'), bar: createPluginMetadata('Barber'), }, }) ), }), HeaderComponent, ], declarations: [ HeaderComponent, PluginSelectorComponent, PluginSelectorContainer, ReloadContainer, ], schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); store = TestBed.inject<Store<State>>(Store) as MockStore<State>; store.overrideSelector(getPlugins, { foo: createPluginMetadata('Foo Fighter'), bar: createPluginMetadata('Barber'), }); store.overrideSelector(getActivePlugin, 'foo'); }); function assertDebugElementText(el: DebugElement, text: string) { expect(el.nativeElement.innerText.trim().toUpperCase()).toBe(text); } function setActivePlugin(activePlugin: PluginId | null) { store.overrideSelector(getActivePlugin, activePlugin); store.refreshState(); } it('renders pluginsList', () => { const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const els = fixture.debugElement.queryAll(By.css('.mat-tab-label')); expect(els.length).toBe(2); assertDebugElementText(els[0], 'FOO FIGHTER'); assertDebugElementText(els[1], 'BARBER'); }); it('updates list of tabs when pluginsList updates', async () => { const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); store.overrideSelector(getPlugins, { cat: createPluginMetadata('Meow'), dog: createPluginMetadata('Woof'), elephant: createPluginMetadata('Trumpet'), }); setActivePlugin(null); fixture.detectChanges(); await fixture.whenStable(); const els = fixture.debugElement.queryAll(By.css('.mat-tab-label')); expect(els.length).toBe(3); assertDebugElementText(els[0], 'MEOW'); assertDebugElementText(els[1], 'WOOF'); assertDebugElementText(els[2], 'TRUMPET'); }); it('selects 0th element by default', () => { const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const group = fixture.debugElement.query(By.css('mat-tab-group')); expect(group.componentInstance.selectedIndex).toBe(0); }); it('sets tab group selection to match index of activePlugin', async () => { const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); setActivePlugin('bar'); fixture.detectChanges(); await fixture.whenStable(); const group = fixture.debugElement.query(By.css('mat-tab-group')); expect(group.componentInstance.selectedIndex).toBe(1); }); it('fires an action when a tab is clicked', async () => { const dispatch = spyOn(store, 'dispatch'); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const [, barEl] = fixture.debugElement.queryAll(By.css('.plugin-name')); barEl.nativeElement.click(); fixture.detectChanges(); await fixture.whenStable(); expect(dispatch).toHaveBeenCalledTimes(1); expect(dispatch).toHaveBeenCalledWith(changePlugin({plugin: 'bar'})); }); describe('reload', () => { it('dispatches manual reload when clicking on the reload button', () => { const dispatch = spyOn(store, 'dispatch'); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const button = fixture.debugElement.query( By.css('app-header-reload button') ); button.nativeElement.click(); fixture.detectChanges(); expect(dispatch).toHaveBeenCalledTimes(1); expect(dispatch).toHaveBeenCalledWith(manualReload()); }); it('renders the time of refresh in title', () => { store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.LOADED, lastLoadedTimeInMs: new Date('2000/01/01').getTime(), failureCode: null, }); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const button = fixture.debugElement.query( By.css('app-header-reload button') ); expect(button.properties['title']).toBe( 'Last Updated: Jan 1, 2000, 12:00:00 AM' ); }); it('renders "Loading" if it was never loaded before', () => { store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.NOT_LOADED, lastLoadedTimeInMs: null, failureCode: null, }); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const button = fixture.debugElement.query( By.css('app-header-reload button') ); expect(button.properties['title']).toBe('Loading...'); }); it('spins the indicator when loading', () => { store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.NOT_LOADED, lastLoadedTimeInMs: null, failureCode: null, }); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const buttonBefore = fixture.debugElement.query( By.css('app-header-reload button') ); expect(buttonBefore.classes['loading']).not.toBeDefined(); store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.LOADING, lastLoadedTimeInMs: null, failureCode: null, }); store.refreshState(); fixture.detectChanges(); const buttonAfter = fixture.debugElement.query( By.css('app-header-reload button') ); expect(buttonAfter.classes['loading']).toBe(true); }); it('stops spinner when going from loading to loaded', () => { store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.LOADING, lastLoadedTimeInMs: null, failureCode: null, }); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const buttonBefore = fixture.debugElement.query( By.css('app-header-reload button') ); expect(buttonBefore.classes['loading']).toBe(true); store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.LOADED, lastLoadedTimeInMs: 1, failureCode: null, }); store.refreshState(); fixture.detectChanges(); const buttonAfter = fixture.debugElement.query( By.css('app-header-reload button') ); expect(buttonAfter.classes['loading']).not.toBeDefined(); }); it('disables the reload button if active plugin does not want reload', () => { store.overrideSelector(getPlugins, { foo: buildPluginMetadata({ disable_reload: true, tab_name: 'Foo', }), }); store.overrideSelector(getActivePlugin, 'foo'); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const button = fixture.debugElement.query( By.css('app-header-reload button') ); expect(button.attributes['disabled']).toBe('true'); }); it('does not spin the spinner when reload is disabled', () => { store.overrideSelector(getPluginsListLoaded, { state: DataLoadState.LOADING, lastLoadedTimeInMs: null, failureCode: null, }); store.overrideSelector(getPlugins, { foo: buildPluginMetadata({ disable_reload: true, tab_name: 'Foo', }), }); store.overrideSelector(getActivePlugin, 'foo'); const fixture = TestBed.createComponent(HeaderComponent); fixture.detectChanges(); const buttonBefore = fixture.debugElement.query( By.css('app-header-reload button') ); expect(buttonBefore.classes['loading']).not.toBeDefined(); }); }); });
{ "pile_set_name": "Github" }
############## mysql-test\t\concurrent_insert_basic.test ####################### # # # Variable Name: concurrent_insert # # Scope: GLOBAL # # Access Type: Dynamic # # Data Type: Boolean & Numeric # # Default Value: 1 # # Valid Values: 0,1 & 2 # # # # # # Creation Date: 2008-03-07 # # Author: Salman Rawala # # # # Modified: HHunger 2009-02-23 Inserted a wait condition right after the # # "INSERT ..record_6" to wait for the end of # # the insert. # # mleich This test needs some inporovements # # # # Description: Test Cases of Dynamic System Variable "concurrent_insert" # # that checks functionality of this variable # # # # Reference: # # http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html # # # ################################################################################ --source include/force_myisam_default.inc # Skip the test if MyISAM is not available --source include/have_myisam.inc --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings ######################### # Creating new table # ######################### --echo ## Creating new table ## CREATE TABLE t1 ( name VARCHAR(30) ); --echo '#--------------------FN_DYNVARS_018_01-------------------------#' #################################################################### # Setting initial value of concurrent_insert to 1 # concurrent_insert = 1 means Enables concurrent insert # for MyISAM tables that don't have holes #################################################################### SET @start_value= @@global.concurrent_insert; --echo ## Setting initial value of variable to 1 ## SET @@global.concurrent_insert = 1; INSERT INTO t1(name) VALUES('Record_1'); INSERT INTO t1(name) VALUES('Record_2'); INSERT INTO t1(name) VALUES('Record_3'); --echo ## locking table ## LOCK TABLE t1 READ LOCAL; --echo ## Creating new connection to insert some rows in table ## connect (test_con1,localhost,root,,); --echo connection test_con1; connection test_con1; --echo ## New records should come at the end of all rows ## INSERT INTO t1(name) VALUES('Record_4'); SELECT * FROM t1; --echo ## unlocking tables ## --echo connection default; connection default; UNLOCK TABLES; --echo ## deleting record to create hole in table ## DELETE FROM t1 WHERE name ='Record_2'; --echo '#--------------------FN_DYNVARS_018_02-------------------------#' #################################################################### # Setting initial value of concurrent_insert to 1 # concurrent_insert = 1 and trying to insert some values # in MyISAM tables that have holes #################################################################### # lock table and connect with connection1 LOCK TABLE t1 READ LOCAL; --echo connection test_con1; connection test_con1; # setting value of concurrent_insert to 1 SET @@global.concurrent_insert=1; --echo ## send INSERT which should be blocked until unlock of the table ## send INSERT INTO t1(name) VALUES('Record_7'); --echo connection default; connection default; # wait until INSERT will be locked (low performance) let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%"; --source include/wait_condition.inc --echo ## show processlist info and state ## SELECT state,info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE state= "Waiting for table level lock" AND info LIKE "INSERT INTO t1%"; --echo ## table contents befor UNLOCK ## SELECT * FROM t1; UNLOCK TABLES; --echo ## table contens after UNLOCK ## SELECT * FROM t1; INSERT INTO t1(name) VALUES('Record_6'); let $wait_condition= SELECT COUNT(*) = 5 FROM t1; --source include/wait_condition.inc --echo connection test_con1; connection test_con1; # to complete the send above^ reap; SELECT * FROM t1; --echo connection default; connection default; --echo '#--------------------FN_DYNVARS_018_03-------------------------#' ################################################################################ # Setting value of concurrent_insert to 2 to verify values after inserting # it into table with holes # concurrent_insert = 2 means Enables concurrent insert # for MyISAM tables that have holes but inserts values at the end of all rows ################################################################################ --echo ## lock table and connect with connection1 ## LOCK TABLE t1 READ LOCAL; --echo connection test_con1; connection test_con1; --echo ## setting value of concurrent_insert to 2 ## SET @@global.concurrent_insert=2; --echo ## Inserting record in table, record should go at the end of the table ## INSERT INTO t1(name) VALUES('Record_5'); SELECT * FROM t1; SELECT @@concurrent_insert; --echo connection default; connection default; --echo ## Unlocking table ## UNLOCK TABLES; SELECT * FROM t1; --echo ## Inserting new row, this should go in the hole ## INSERT INTO t1(name) VALUES('Record_6'); SELECT * FROM t1; --echo ## connection test_con1 ## DELETE FROM t1 WHERE name ='Record_3'; SELECT * FROM t1; --echo ## Dropping table ## DROP TABLE t1; --echo ## Disconnecting connection ## disconnect test_con1; SET @@global.concurrent_insert= @start_value;
{ "pile_set_name": "Github" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.content.model; /** * A batch entry encoding a single non-batch datafeeds response. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Content API for Shopping. For a detailed explanation * see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class DatafeedsCustomBatchResponseEntry extends com.google.api.client.json.GenericJson { /** * The ID of the request entry this entry responds to. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Long batchId; /** * The requested data feed. Defined if and only if the request was successful. * The value may be {@code null}. */ @com.google.api.client.util.Key private Datafeed datafeed; /** * A list of errors defined if and only if the request failed. * The value may be {@code null}. */ @com.google.api.client.util.Key private Errors errors; /** * The ID of the request entry this entry responds to. * @return value or {@code null} for none */ public java.lang.Long getBatchId() { return batchId; } /** * The ID of the request entry this entry responds to. * @param batchId batchId or {@code null} for none */ public DatafeedsCustomBatchResponseEntry setBatchId(java.lang.Long batchId) { this.batchId = batchId; return this; } /** * The requested data feed. Defined if and only if the request was successful. * @return value or {@code null} for none */ public Datafeed getDatafeed() { return datafeed; } /** * The requested data feed. Defined if and only if the request was successful. * @param datafeed datafeed or {@code null} for none */ public DatafeedsCustomBatchResponseEntry setDatafeed(Datafeed datafeed) { this.datafeed = datafeed; return this; } /** * A list of errors defined if and only if the request failed. * @return value or {@code null} for none */ public Errors getErrors() { return errors; } /** * A list of errors defined if and only if the request failed. * @param errors errors or {@code null} for none */ public DatafeedsCustomBatchResponseEntry setErrors(Errors errors) { this.errors = errors; return this; } @Override public DatafeedsCustomBatchResponseEntry set(String fieldName, Object value) { return (DatafeedsCustomBatchResponseEntry) super.set(fieldName, value); } @Override public DatafeedsCustomBatchResponseEntry clone() { return (DatafeedsCustomBatchResponseEntry) super.clone(); } }
{ "pile_set_name": "Github" }
using Nancy.Metadata.Module; using Nancy.Swagger; namespace OmniSharp.CodeActions.Metadata { public class GetCodeActionsMetadataModule : MetadataModule<SwaggerRouteData> { public GetCodeActionsMetadataModule() { Describe["GetCodeActions"] = desc => desc.AsSwagger(builder => builder .ResourcePath("/getcodeactions") .BodyParam<CodeActionRequest>() .Response(200) .Model<GetCodeActionsResponse>()); } } }
{ "pile_set_name": "Github" }
#include "unp.h" void tv_sub(struct timeval *out, struct timeval *in) { if ( (out->tv_usec -= in->tv_usec) < 0) { /* out -= in */ --out->tv_sec; out->tv_usec += 1000000; } out->tv_sec -= in->tv_sec; }
{ "pile_set_name": "Github" }
/*! @file Defines operators for Iterables. @copyright Louis Dionne 2013-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP #define BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP #include <boost/hana/config.hpp> #include <boost/hana/fwd/at.hpp> BOOST_HANA_NAMESPACE_BEGIN namespace detail { template <typename Derived> struct iterable_operators { template <typename N> constexpr decltype(auto) operator[](N&& n) & { return hana::at(static_cast<Derived&>(*this), static_cast<N&&>(n)); } template <typename N> constexpr decltype(auto) operator[](N&& n) const& { return hana::at(static_cast<Derived const&>(*this), static_cast<N&&>(n)); } template <typename N> constexpr decltype(auto) operator[](N&& n) && { return hana::at(static_cast<Derived&&>(*this), static_cast<N&&>(n)); } }; } BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_DETAIL_OPERATORS_ITERABLE_HPP
{ "pile_set_name": "Github" }
# created by tools/tclZIC.tcl - do not edit set TZData(:Asia/Taipei) { {-9223372036854775808 29160 0 LMT} {-2335248360 28800 0 CST} {-1017820800 32400 0 JST} {-766224000 28800 0 CST} {-745833600 32400 1 CDT} {-733827600 28800 0 CST} {-716889600 32400 1 CDT} {-699613200 28800 0 CST} {-683884800 32400 1 CDT} {-670669200 28800 0 CST} {-652348800 32400 1 CDT} {-639133200 28800 0 CST} {-620812800 32400 1 CDT} {-607597200 28800 0 CST} {-589276800 32400 1 CDT} {-576061200 28800 0 CST} {-562924800 32400 1 CDT} {-541760400 28800 0 CST} {-528710400 32400 1 CDT} {-510224400 28800 0 CST} {-497174400 32400 1 CDT} {-478688400 28800 0 CST} {-465638400 32400 1 CDT} {-449830800 28800 0 CST} {-434016000 32400 1 CDT} {-418208400 28800 0 CST} {-402480000 32400 1 CDT} {-386672400 28800 0 CST} {-370944000 32400 1 CDT} {-355136400 28800 0 CST} {-339408000 32400 1 CDT} {-323600400 28800 0 CST} {-302515200 32400 1 CDT} {-291978000 28800 0 CST} {-270979200 32400 1 CDT} {-260442000 28800 0 CST} {133977600 32400 1 CDT} {149785200 28800 0 CST} {165513600 32400 1 CDT} {181321200 28800 0 CST} {299606400 32400 1 CDT} {307551600 28800 0 CST} }
{ "pile_set_name": "Github" }
# frozen_string_literal: true class Fakes::EndProductStore < Fakes::PersistentStore class << self def redis_ns "end_product_records_#{Rails.env}" end end class Contention < OpenStruct; end class BgsContention < OpenStruct; end # we call it a "child" because even though Redis has only key:value pairs, # logically the object is a child of an EndProduct class ChildStore < Fakes::EndProductStore def initialize(parent_key:, child_key:, child:) @parent_key = parent_key @child_key = child_key.to_s.to_sym @child = child end def create children = fetch_children || {} children[child_key] = child deflate_and_store(parent_key, children) end def update children = fetch_children fail "No values for #{parent_key}" unless children children[child_key] = child deflate_and_store(parent_key, children) end def remove children = fetch_children fail "No values for #{parent_key}" unless children children.delete(child_key) deflate_and_store(parent_key, children) end private attr_reader :parent_key, :child_key, :child def fetch_children fetch_and_inflate(parent_key) end end def store_end_product_record(veteran_id, end_product) claim_id = end_product[:benefit_claim_id] existing_eps = fetch_and_inflate(veteran_id) if existing_eps existing_eps[claim_id] = end_product deflate_and_store(veteran_id, existing_eps) else deflate_and_store(veteran_id, claim_id => end_product) end end def update_ep_status(veteran_id, claim_id, new_status) eps = fetch_and_inflate(veteran_id) eps[claim_id.to_sym][:status_type_code] = new_status deflate_and_store(veteran_id, eps) end # contentions are "children" of End Products but we store by claim_id # rather than veteran_id to make look up easier. Dispositions are similar. def create_contention(contention) contention_child_store(contention).create end def update_contention(contention) contention_child_store(contention).update end def remove_contention(contention) contention_child_store(contention).remove end def inflated_contentions_for(claim_id) children_to_structs(contention_key(claim_id)).map { |struct| Contention.new(struct) } end def inflated_bgs_contentions_for(claim_id) (fetch_and_inflate(contention_key(claim_id)) || {}).values.map do |hash| hash[:table][:reference_id] = hash[:table][:reference_id] || hash[:table][:id] BgsContention.new(hash[:table]) end end def create_disposition(disposition) disposition_child_store(disposition).create end def update_disposition(disposition) disposition_child_store(disposition).update end def remove_disposition(disposition) disposition_child_store(disposition).remove end def inflated_dispositions_for(claim_id) children_to_structs(disposition_key(claim_id)) end private def contention_key(claim_id) "contention_#{claim_id}" end def disposition_key(claim_id) "disposition_#{claim_id}" end def contention_child_store(contention) claim_id = contention.claim_id ChildStore.new( parent_key: contention_key(claim_id), child: contention, child_key: contention.id || contention.reference_id ) end def disposition_child_store(disposition) claim_id = disposition.claim_id ChildStore.new(parent_key: disposition_key(claim_id), child: disposition, child_key: disposition.contention_id) end def children_to_structs(key) (fetch_and_inflate(key) || {}).values.map { |hash| OpenStruct.new(hash[:table]) } end end
{ "pile_set_name": "Github" }
/*----------------------------------------------------------------------------*/ /** * This confidential and proprietary software may be used only as * authorised by a licensing agreement from ARM Limited * (C) COPYRIGHT 2011-2012 ARM Limited * ALL RIGHTS RESERVED * * The entire notice above must be reproduced on all authorised * copies and copies may only be made to the extent permitted * by a licensing agreement from ARM Limited. * * @brief Functions for managing ASTC codec images. */ /*----------------------------------------------------------------------------*/ #include <math.h> #include "astc_codec_internals.h" #include "softfloat.h" #include <stdint.h> #include <stdio.h> // conversion functions between the LNS representation and the FP16 representation. float float_to_lns(float p) { if (astc_isnan(p) || p <= 1.0f / 67108864.0f) { // underflow or NaN value, return 0. // We count underflow if the input value is smaller than 2^-26. return 0; } if (fabs(p) >= 65536.0f) { // overflow, return a +INF value return 65535; } int expo; float normfrac = frexp(p, &expo); float p1; if (expo < -13) { // input number is smaller than 2^-14. In this case, multiply by 2^25. p1 = p * 33554432.0f; expo = 0; } else { expo += 14; p1 = (normfrac - 0.5f) * 4096.0f; } if (p1 < 384.0f) p1 *= 4.0f / 3.0f; else if (p1 <= 1408.0f) p1 += 128.0f; else p1 = (p1 + 512.0f) * (4.0f / 5.0f); p1 += expo * 2048.0f; return p1 + 1.0f; } uint16_t lns_to_sf16(uint16_t p) { uint16_t mc = p & 0x7FF; uint16_t ec = p >> 11; uint16_t mt; if (mc < 512) mt = 3 * mc; else if (mc < 1536) mt = 4 * mc - 512; else mt = 5 * mc - 2048; uint16_t res = (ec << 10) | (mt >> 3); if (res >= 0x7BFF) res = 0x7BFF; return res; } // conversion function from 16-bit LDR value to FP16. // note: for LDR interpolation, it is impossible to get a denormal result; // this simplifies the conversion. // FALSE; we can receive a very small UNORM16 through the constant-block. uint16_t unorm16_to_sf16(uint16_t p) { if (p == 0xFFFF) return 0x3C00; // value of 1.0 . if (p < 4) return p << 8; int lz = clz32(p) - 16; p <<= (lz + 1); p >>= 6; p |= (14 - lz) << 10; return p; } void imageblock_initialize_deriv_from_work_and_orig(imageblock * pb, int pixelcount) { int i; const float *fptr = pb->orig_data; const float *wptr = pb->work_data; float *dptr = pb->deriv_data; for (i = 0; i < pixelcount; i++) { // compute derivatives for RGB first if (pb->rgb_lns[i]) { float r = MAX(fptr[0], 6e-5f); float g = MAX(fptr[1], 6e-5f); float b = MAX(fptr[2], 6e-5f); float rderiv = (float_to_lns(r * 1.05f) - float_to_lns(r)) / (r * 0.05f); float gderiv = (float_to_lns(g * 1.05f) - float_to_lns(g)) / (g * 0.05f); float bderiv = (float_to_lns(b * 1.05f) - float_to_lns(b)) / (b * 0.05f); // the derivative may not actually take values smaller than 1/32 or larger than 2^25; // if it does, we clamp it. if (rderiv < (1.0f / 32.0f)) rderiv = (1.0f / 32.0f); else if (rderiv > 33554432.0f) rderiv = 33554432.0f; if (gderiv < (1.0f / 32.0f)) gderiv = (1.0f / 32.0f); else if (gderiv > 33554432.0f) gderiv = 33554432.0f; if (bderiv < (1.0f / 32.0f)) bderiv = (1.0f / 32.0f); else if (bderiv > 33554432.0f) bderiv = 33554432.0f; dptr[0] = rderiv; dptr[1] = gderiv; dptr[2] = bderiv; } else { dptr[0] = 65535.0f; dptr[1] = 65535.0f; dptr[2] = 65535.0f; } // then compute derivatives for Alpha if (pb->alpha_lns[i]) { float a = MAX(fptr[3], 6e-5f); float aderiv = (float_to_lns(a * 1.05f) - float_to_lns(a)) / (a * 0.05f); // the derivative may not actually take values smaller than 1/32 or larger than 2^25; // if it does, we clamp it. if (aderiv < (1.0f / 32.0f)) aderiv = (1.0f / 32.0f); else if (aderiv > 33554432.0f) aderiv = 33554432.0f; dptr[3] = aderiv; } else { dptr[3] = 65535.0f; } fptr += 4; wptr += 4; dptr += 4; } } // helper function to initialize the work-data from the orig-data void imageblock_initialize_work_from_orig(imageblock * pb, int pixelcount) { int i; float *fptr = pb->orig_data; float *wptr = pb->work_data; for (i = 0; i < pixelcount; i++) { if (pb->rgb_lns[i]) { wptr[0] = float_to_lns(fptr[0]); wptr[1] = float_to_lns(fptr[1]); wptr[2] = float_to_lns(fptr[2]); } else { wptr[0] = fptr[0] * 65535.0f; wptr[1] = fptr[1] * 65535.0f; wptr[2] = fptr[2] * 65535.0f; } if (pb->alpha_lns[i]) { wptr[3] = float_to_lns(fptr[3]); } else { wptr[3] = fptr[3] * 65535.0f; } fptr += 4; wptr += 4; } imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount); } // helper function to initialize the orig-data from the work-data void imageblock_initialize_orig_from_work(imageblock * pb, int pixelcount) { int i; float *fptr = pb->orig_data; float *wptr = pb->work_data; for (i = 0; i < pixelcount; i++) { if (pb->rgb_lns[i]) { fptr[0] = sf16_to_float(lns_to_sf16((uint16_t) wptr[0])); fptr[1] = sf16_to_float(lns_to_sf16((uint16_t) wptr[1])); fptr[2] = sf16_to_float(lns_to_sf16((uint16_t) wptr[2])); } else { fptr[0] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[0])); fptr[1] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[1])); fptr[2] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[2])); } if (pb->alpha_lns[i]) { fptr[3] = sf16_to_float(lns_to_sf16((uint16_t) wptr[3])); } else { fptr[3] = sf16_to_float(unorm16_to_sf16((uint16_t) wptr[3])); } fptr += 4; wptr += 4; } imageblock_initialize_deriv_from_work_and_orig(pb, pixelcount); } /* For an imageblock, update its flags. The updating is done based on work_data, not orig_data. */ void update_imageblock_flags(imageblock * pb, int xdim, int ydim, int zdim) { int i; float red_min = 1e38f, red_max = -1e38f; float green_min = 1e38f, green_max = -1e38f; float blue_min = 1e38f, blue_max = -1e38f; float alpha_min = 1e38f, alpha_max = -1e38f; int texels_per_block = xdim * ydim * zdim; int grayscale = 1; for (i = 0; i < texels_per_block; i++) { float red = pb->work_data[4 * i]; float green = pb->work_data[4 * i + 1]; float blue = pb->work_data[4 * i + 2]; float alpha = pb->work_data[4 * i + 3]; if (red < red_min) red_min = red; if (red > red_max) red_max = red; if (green < green_min) green_min = green; if (green > green_max) green_max = green; if (blue < blue_min) blue_min = blue; if (blue > blue_max) blue_max = blue; if (alpha < alpha_min) alpha_min = alpha; if (alpha > alpha_max) alpha_max = alpha; if (grayscale == 1 && (red != green || red != blue)) grayscale = 0; } pb->red_min = red_min; pb->red_max = red_max; pb->green_min = green_min; pb->green_max = green_max; pb->blue_min = blue_min; pb->blue_max = blue_max; pb->alpha_min = alpha_min; pb->alpha_max = alpha_max; pb->grayscale = grayscale; }
{ "pile_set_name": "Github" }
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import("//build/buildflag_header.gni") import("//chromecast/chromecast.gni") import("//third_party/protobuf/proto_library.gni") buildflag_header("buildflags") { header = "buildflags.h" flags = [ "HAVE_FULL_MIXER=$have_full_mixer" ] } proto_library("proto") { proto_out_dir = "chromecast/media/audio/mixer_service" sources = [ "mixer_service.proto" ] } cast_source_set("common") { sources = [ "constants.cc", "constants.h", "conversions.cc", "conversions.h", "loopback_interrupt_reason.h", "mixer_socket.cc", "mixer_socket.h", ] deps = [ ":buildflags", "//base", "//chromecast/net:io_buffer_pool", "//chromecast/public", "//chromecast/public/media", "//net", ] public_deps = [ ":proto", "//chromecast/net:small_message_socket", ] } cast_source_set("connection") { sources = [ "mixer_connection.cc", "mixer_connection.h", ] deps = [ ":audio_socket_service", ":common", "//base", "//chromecast/base", "//net", ] } cast_source_set("output_stream_connection") { sources = [ "output_stream_connection.cc", "output_stream_connection.h", ] deps = [ ":common", ":connection", ":proto", "//base", "//chromecast/net:io_buffer_pool", "//net", ] } cast_source_set("control_connection") { sources = [ "control_connection.cc", "control_connection.h", ] deps = [ ":common", ":connection", ":proto", "//base", "//chromecast/public", "//net", ] } cast_source_set("mixer_control") { sources = [ "mixer_control.cc", "mixer_control.h", ] deps = [ ":common", ":control_connection", "//base", "//chromecast/media/audio:audio_io_thread", ] } cast_source_set("loopback_connection") { sources = [ "loopback_connection.cc", "loopback_connection.h", ] public_deps = [ ":common" ] deps = [ ":connection", ":proto", "//base", "//chromecast/net:io_buffer_pool", "//chromecast/public/media", "//net", ] } cast_source_set("redirected_audio_connection") { sources = [ "redirected_audio_connection.cc", "redirected_audio_connection.h", ] deps = [ ":common", ":connection", ":proto", "//base", "//chromecast/net:io_buffer_pool", "//chromecast/public", "//chromecast/public/media", "//net", ] } cast_source_set("audio_socket_service") { sources = [ "audio_socket_service.cc", "audio_socket_service.h", ] if (use_unix_sockets) { sources += [ "audio_socket_service_uds.cc" ] } else { sources += [ "audio_socket_service_tcp.cc" ] } deps = [ "//base", "//net", ] }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: e85a3776f5266b144a8e170c88e08647 timeCreated: 1493210307 licenseType: Free TextureImporter: fileIDToRecycleName: 8900000: generatedCubemap serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 1 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 2 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: 1 maxTextureSize: 2048 textureSettings: filterMode: -1 aniso: -1 mipBias: -1 wrapMode: -1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 0 textureShape: 2 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - buildTarget: DefaultTexturePlatform maxTextureSize: 2048 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 - buildTarget: Standalone maxTextureSize: 2048 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.3.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); /** * Postgres Result Class * * This class extends the parent result class: CI_DB_result * * @package CodeIgniter * @subpackage Drivers * @category Database * @author EllisLab Dev Team * @link https://codeigniter.com/user_guide/database/ */ class CI_DB_postgre_result extends CI_DB_result { /** * Number of rows in the result set * * @return int */ public function num_rows() { return is_int($this->num_rows) ? $this->num_rows : $this->num_rows = pg_num_rows($this->result_id); } // -------------------------------------------------------------------- /** * Number of fields in the result set * * @return int */ public function num_fields() { return pg_num_fields($this->result_id); } // -------------------------------------------------------------------- /** * Fetch Field Names * * Generates an array of column names * * @return array */ public function list_fields() { $field_names = array(); for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $field_names[] = pg_field_name($this->result_id, $i); } return $field_names; } // -------------------------------------------------------------------- /** * Field data * * Generates an array of objects containing field meta-data * * @return array */ public function field_data() { $retval = array(); for ($i = 0, $c = $this->num_fields(); $i < $c; $i++) { $retval[$i] = new stdClass(); $retval[$i]->name = pg_field_name($this->result_id, $i); $retval[$i]->type = pg_field_type($this->result_id, $i); $retval[$i]->max_length = pg_field_size($this->result_id, $i); } return $retval; } // -------------------------------------------------------------------- /** * Free the result * * @return void */ public function free_result() { if (is_resource($this->result_id)) { pg_free_result($this->result_id); $this->result_id = FALSE; } } // -------------------------------------------------------------------- /** * Data Seek * * Moves the internal pointer to the desired offset. We call * this internally before fetching results to make sure the * result set starts at zero. * * @param int $n * @return bool */ public function data_seek($n = 0) { return pg_result_seek($this->result_id, $n); } // -------------------------------------------------------------------- /** * Result - associative array * * Returns the result set as an array * * @return array */ protected function _fetch_assoc() { return pg_fetch_assoc($this->result_id); } // -------------------------------------------------------------------- /** * Result - object * * Returns the result set as an object * * @param string $class_name * @return object */ protected function _fetch_object($class_name = 'stdClass') { return pg_fetch_object($this->result_id, NULL, $class_name); } }
{ "pile_set_name": "Github" }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Config; use Symfony\Component\Config\Resource\SelfCheckingResourceChecker; /** * ConfigCache caches arbitrary content in files on disk. * * When in debug mode, those metadata resources that implement * \Symfony\Component\Config\Resource\SelfCheckingResourceInterface will * be used to check cache freshness. * * @author Fabien Potencier <fabien@symfony.com> * @author Matthias Pigulla <mp@webfactory.de> */ class ConfigCache extends ResourceCheckerConfigCache { private $debug; /** * @param string $file The absolute cache path * @param bool $debug Whether debugging is enabled or not */ public function __construct($file, $debug) { $this->debug = (bool) $debug; $checkers = []; if (true === $this->debug) { $checkers = [new SelfCheckingResourceChecker()]; } parent::__construct($file, $checkers); } /** * Checks if the cache is still fresh. * * This implementation always returns true when debug is off and the * cache file exists. * * @return bool true if the cache is fresh, false otherwise */ public function isFresh() { if (!$this->debug && is_file($this->getPath())) { return true; } return parent::isFresh(); } }
{ "pile_set_name": "Github" }
<?php /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@magento.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magento.com for more information. * * @category Tests * @package Tests_Functional * @copyright Copyright (c) 2006-2020 Magento, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Mage\Adminhtml\Test\Block\CatalogRule\Promo\Catalog\Edit; use Mage\Adminhtml\Test\Block\Widget\FormTabs; use Magento\Mtf\Client\Element\SimpleElement as Element; use Magento\Mtf\Fixture\FixtureInterface; /** * Form for creation of a Catalog Price Rule. */ class PromoForm extends FormTabs { /** * Fill form with tabs. * * @param FixtureInterface $fixture * @param Element $element * @param array $replace * @return $this|FormTabs */ public function fill(FixtureInterface $fixture, Element $element = null, array $replace = null) { $tabs = $this->getFieldsByTabs($fixture); if ($replace) { $tabs = $this->prepareData($tabs, $replace); } $this->fillTabs($tabs, $element); } /** * Replace placeholders in each values of data. * * @param array $tabs * @param array $replace * @return array */ protected function prepareData(array $tabs, array $replace) { foreach ($replace as $tabName => $fields) { foreach ($fields as $key => $pairs) { if (isset($tabs[$tabName][$key])) { $tabs[$tabName][$key]['value'] = str_replace( array_keys($pairs), array_values($pairs), $tabs[$tabName][$key]['value'] ); } } } return $tabs; } }
{ "pile_set_name": "Github" }
'use strict'; var isImplemented = require('../../../string/from-code-point/is-implemented'); module.exports = function (a) { a(isImplemented(), true); };
{ "pile_set_name": "Github" }
/* NOLINT(build/header_guard) */ /* Copyright 2016 Google Inc. All Rights Reserved. Distributed under MIT license. See file LICENSE for detail or copy at https://opensource.org/licenses/MIT */ /* template parameters: FN, BUCKET_BITS, NUM_BANKS, BANK_BITS, NUM_LAST_DISTANCES_TO_CHECK */ /* A (forgetful) hash table to the data seen by the compressor, to help create backward references to previous data. Hashes are stored in chains which are bucketed to groups. Group of chains share a storage "bank". When more than "bank size" chain nodes are added, oldest nodes are replaced; this way several chains may share a tail. */ #define HashForgetfulChain HASHER() #define BANK_SIZE (1 << BANK_BITS) /* Number of hash buckets. */ #define BUCKET_SIZE (1 << BUCKET_BITS) #define CAPPED_CHAINS 0 static BROTLI_INLINE size_t FN(HashTypeLength)(void) { return 4; } static BROTLI_INLINE size_t FN(StoreLookahead)(void) { return 4; } /* HashBytes is the function that chooses the bucket to place the address in.*/ static BROTLI_INLINE size_t FN(HashBytes)(const uint8_t* BROTLI_RESTRICT data) { const uint32_t h = BROTLI_UNALIGNED_LOAD32LE(data) * kHashMul32; /* The higher bits contain more mixture from the multiplication, so we take our results from there. */ return h >> (32 - BUCKET_BITS); } typedef struct FN(Slot) { uint16_t delta; uint16_t next; } FN(Slot); typedef struct FN(Bank) { FN(Slot) slots[BANK_SIZE]; } FN(Bank); typedef struct HashForgetfulChain { uint16_t free_slot_idx[NUM_BANKS]; /* Up to 1KiB. Move to dynamic? */ size_t max_hops; /* Shortcuts. */ void* extra; HasherCommon* common; /* --- Dynamic size members --- */ /* uint32_t addr[BUCKET_SIZE]; */ /* uint16_t head[BUCKET_SIZE]; */ /* Truncated hash used for quick rejection of "distance cache" candidates. */ /* uint8_t tiny_hash[65536];*/ /* FN(Bank) banks[NUM_BANKS]; */ } HashForgetfulChain; static uint32_t* FN(Addr)(void* extra) { return (uint32_t*)extra; } static uint16_t* FN(Head)(void* extra) { return (uint16_t*)(&FN(Addr)(extra)[BUCKET_SIZE]); } static uint8_t* FN(TinyHash)(void* extra) { return (uint8_t*)(&FN(Head)(extra)[BUCKET_SIZE]); } static FN(Bank)* FN(Banks)(void* extra) { return (FN(Bank)*)(&FN(TinyHash)(extra)[65536]); } static void FN(Initialize)( HasherCommon* common, HashForgetfulChain* BROTLI_RESTRICT self, const BrotliEncoderParams* params) { self->common = common; self->extra = common->extra; self->max_hops = (params->quality > 6 ? 7u : 8u) << (params->quality - 4); } static void FN(Prepare)( HashForgetfulChain* BROTLI_RESTRICT self, BROTLI_BOOL one_shot, size_t input_size, const uint8_t* BROTLI_RESTRICT data) { uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra); uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra); uint8_t* BROTLI_RESTRICT tiny_hash = FN(TinyHash)(self->extra); /* Partial preparation is 100 times slower (per socket). */ size_t partial_prepare_threshold = BUCKET_SIZE >> 6; if (one_shot && input_size <= partial_prepare_threshold) { size_t i; for (i = 0; i < input_size; ++i) { size_t bucket = FN(HashBytes)(&data[i]); /* See InitEmpty comment. */ addr[bucket] = 0xCCCCCCCC; head[bucket] = 0xCCCC; } } else { /* Fill |addr| array with 0xCCCCCCCC value. Because of wrapping, position processed by hasher never reaches 3GB + 64M; this makes all new chains to be terminated after the first node. */ memset(addr, 0xCC, sizeof(uint32_t) * BUCKET_SIZE); memset(head, 0, sizeof(uint16_t) * BUCKET_SIZE); } memset(tiny_hash, 0, sizeof(uint8_t) * 65536); memset(self->free_slot_idx, 0, sizeof(self->free_slot_idx)); } static BROTLI_INLINE size_t FN(HashMemAllocInBytes)( const BrotliEncoderParams* params, BROTLI_BOOL one_shot, size_t input_size) { BROTLI_UNUSED(params); BROTLI_UNUSED(one_shot); BROTLI_UNUSED(input_size); return sizeof(uint32_t) * BUCKET_SIZE + sizeof(uint16_t) * BUCKET_SIZE + sizeof(uint8_t) * 65536 + sizeof(FN(Bank)) * NUM_BANKS; } /* Look at 4 bytes at &data[ix & mask]. Compute a hash from these, and prepend node to corresponding chain; also update tiny_hash for current position. */ static BROTLI_INLINE void FN(Store)(HashForgetfulChain* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix) { uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra); uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra); uint8_t* BROTLI_RESTRICT tiny_hash = FN(TinyHash)(self->extra); FN(Bank)* BROTLI_RESTRICT banks = FN(Banks)(self->extra); const size_t key = FN(HashBytes)(&data[ix & mask]); const size_t bank = key & (NUM_BANKS - 1); const size_t idx = self->free_slot_idx[bank]++ & (BANK_SIZE - 1); size_t delta = ix - addr[key]; tiny_hash[(uint16_t)ix] = (uint8_t)key; if (delta > 0xFFFF) delta = CAPPED_CHAINS ? 0 : 0xFFFF; banks[bank].slots[idx].delta = (uint16_t)delta; banks[bank].slots[idx].next = head[key]; addr[key] = (uint32_t)ix; head[key] = (uint16_t)idx; } static BROTLI_INLINE void FN(StoreRange)( HashForgetfulChain* BROTLI_RESTRICT self, const uint8_t* BROTLI_RESTRICT data, const size_t mask, const size_t ix_start, const size_t ix_end) { size_t i; for (i = ix_start; i < ix_end; ++i) { FN(Store)(self, data, mask, i); } } static BROTLI_INLINE void FN(StitchToPreviousBlock)( HashForgetfulChain* BROTLI_RESTRICT self, size_t num_bytes, size_t position, const uint8_t* ringbuffer, size_t ring_buffer_mask) { if (num_bytes >= FN(HashTypeLength)() - 1 && position >= 3) { /* Prepare the hashes for three last bytes of the last write. These could not be calculated before, since they require knowledge of both the previous and the current block. */ FN(Store)(self, ringbuffer, ring_buffer_mask, position - 3); FN(Store)(self, ringbuffer, ring_buffer_mask, position - 2); FN(Store)(self, ringbuffer, ring_buffer_mask, position - 1); } } static BROTLI_INLINE void FN(PrepareDistanceCache)( HashForgetfulChain* BROTLI_RESTRICT self, int* BROTLI_RESTRICT distance_cache) { BROTLI_UNUSED(self); PrepareDistanceCache(distance_cache, NUM_LAST_DISTANCES_TO_CHECK); } /* Find a longest backward match of &data[cur_ix] up to the length of max_length and stores the position cur_ix in the hash table. REQUIRES: FN(PrepareDistanceCache) must be invoked for current distance cache values; if this method is invoked repeatedly with the same distance cache values, it is enough to invoke FN(PrepareDistanceCache) once. Does not look for matches longer than max_length. Does not look for matches further away than max_backward. Writes the best match into |out|. |out|->score is updated only if a better match is found. */ static BROTLI_INLINE void FN(FindLongestMatch)( HashForgetfulChain* BROTLI_RESTRICT self, const BrotliEncoderDictionary* dictionary, const uint8_t* BROTLI_RESTRICT data, const size_t ring_buffer_mask, const int* BROTLI_RESTRICT distance_cache, const size_t cur_ix, const size_t max_length, const size_t max_backward, const size_t dictionary_distance, const size_t max_distance, HasherSearchResult* BROTLI_RESTRICT out) { uint32_t* BROTLI_RESTRICT addr = FN(Addr)(self->extra); uint16_t* BROTLI_RESTRICT head = FN(Head)(self->extra); uint8_t* BROTLI_RESTRICT tiny_hashes = FN(TinyHash)(self->extra); FN(Bank)* BROTLI_RESTRICT banks = FN(Banks)(self->extra); const size_t cur_ix_masked = cur_ix & ring_buffer_mask; /* Don't accept a short copy from far away. */ score_t min_score = out->score; score_t best_score = out->score; size_t best_len = out->len; size_t i; const size_t key = FN(HashBytes)(&data[cur_ix_masked]); const uint8_t tiny_hash = (uint8_t)(key); out->len = 0; out->len_code_delta = 0; /* Try last distance first. */ for (i = 0; i < NUM_LAST_DISTANCES_TO_CHECK; ++i) { const size_t backward = (size_t)distance_cache[i]; size_t prev_ix = (cur_ix - backward); /* For distance code 0 we want to consider 2-byte matches. */ if (i > 0 && tiny_hashes[(uint16_t)prev_ix] != tiny_hash) continue; if (prev_ix >= cur_ix || backward > max_backward) { continue; } prev_ix &= ring_buffer_mask; { const size_t len = FindMatchLengthWithLimit(&data[prev_ix], &data[cur_ix_masked], max_length); if (len >= 2) { score_t score = BackwardReferenceScoreUsingLastDistance(len); if (best_score < score) { if (i != 0) score -= BackwardReferencePenaltyUsingLastDistance(i); if (best_score < score) { best_score = score; best_len = len; out->len = best_len; out->distance = backward; out->score = best_score; } } } } } { const size_t bank = key & (NUM_BANKS - 1); size_t backward = 0; size_t hops = self->max_hops; size_t delta = cur_ix - addr[key]; size_t slot = head[key]; while (hops--) { size_t prev_ix; size_t last = slot; backward += delta; if (backward > max_backward || (CAPPED_CHAINS && !delta)) break; prev_ix = (cur_ix - backward) & ring_buffer_mask; slot = banks[bank].slots[last].next; delta = banks[bank].slots[last].delta; if (cur_ix_masked + best_len > ring_buffer_mask || prev_ix + best_len > ring_buffer_mask || data[cur_ix_masked + best_len] != data[prev_ix + best_len]) { continue; } { const size_t len = FindMatchLengthWithLimit(&data[prev_ix], &data[cur_ix_masked], max_length); if (len >= 4) { /* Comparing for >= 3 does not change the semantics, but just saves for a few unnecessary binary logarithms in backward reference score, since we are not interested in such short matches. */ score_t score = BackwardReferenceScore(len, backward); if (best_score < score) { best_score = score; best_len = len; out->len = best_len; out->distance = backward; out->score = best_score; } } } } FN(Store)(self, data, ring_buffer_mask, cur_ix); } if (out->score == min_score) { SearchInStaticDictionary(dictionary, self->common, &data[cur_ix_masked], max_length, dictionary_distance, max_distance, out, BROTLI_FALSE); } } #undef BANK_SIZE #undef BUCKET_SIZE #undef CAPPED_CHAINS #undef HashForgetfulChain
{ "pile_set_name": "Github" }
# -*- mode: ruby -*- # vi: set ft=ruby : # Provisioning script to install the reference policy $install_refpolicy = <<-SHELL # fail as soon as a command failed set -e # we set to permissive to allow loading and working with reference policy as opposed to fedora's fork echo "Setting SELinux to Permissive Mode..." setenforce 0 # build the reference policy sudo -su vagrant make -C /vagrant bare sudo -su vagrant make -C /vagrant conf sudo -su vagrant make -C /vagrant all sudo -su vagrant make -C /vagrant validate rm -f /usr/share/selinux/refpolicy/*.pp make -C /vagrant install make -C /vagrant install-headers semodule -s refpolicy -i /usr/share/selinux/refpolicy/*.pp # Load the module specific to Vagrant VM semodule -s refpolicy -i /vagrant/support/vagrant-vm.cil if ! (LANG=C sestatus -v | grep '^Loaded policy name:\s*refpolicy$' > /dev/null) then # Use the reference policy sed -i -e 's/^\\(SELINUXTYPE=\\).*/SELINUXTYPE=refpolicy/' /etc/selinux/config fi semodule --reload # allow every domain to use /dev/urandom semanage boolean --modify --on global_ssp # allow opening SSH sessions as unconfined_u and sysadm_u semanage boolean --modify --on ssh_sysadm_login # allow systemd-tmpfiles to manage every file semanage boolean --modify --on systemd_tmpfiles_manage_all # make vagrant user use unconfined_u context if ! (semanage login -l | grep '^vagrant' > /dev/null) then echo "Configuring SELinux context for vagrant user" semanage login -a -s unconfined_u vagrant fi # label /vagrant as vagrant's home files if semanage fcontext --list | grep '^/vagrant(/\.\*)?' then semanage fcontext -m -s unconfined_u -t user_home_t '/vagrant(/.*)?' else semanage fcontext -a -s unconfined_u -t user_home_t '/vagrant(/.*)?' fi # Update interface_info sepolgen-ifgen -o /var/lib/sepolgen/interface_info -i /usr/share/selinux/refpolicy echo "Relabelling the system..." restorecon -RF / echo "If this is a fresh install, you need to reboot in order to enable enforcing mode" SHELL # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # build a Fedora 30 VM config.vm.define "fedora" do |fedora| fedora.vm.box = "fedora/30-cloud-base" # assign a nice hostname fedora.vm.hostname = "selinux-fedora-devel" # give it a private internal IP address fedora.vm.network "private_network", type: "dhcp" # Customize the amount of memory on the VM fedora.vm.provider "virtualbox" do |vb| vb.memory = 1024 end fedora.vm.provider "libvirt" do |lv| lv.memory = 1024 end # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. fedora.vm.provision "shell", run: "once", inline: <<-SHELL # get the man pages echo "Upgrading DNF and installing man pages..." dnf install -q -y man-pages >/dev/null dnf upgrade -q -y dnf >/dev/null # install a few packages to make this machine ready to go out of the box echo "Installing SELinux dev dependencies..." dnf install -q -y \ bash-completion \ gcc \ man-pages \ vim \ make \ kernel-devel \ selinux-policy-devel \ libselinux-python3 \ >/dev/null # configure the reference policy for Fedora if ! grep '^DISTRO = fedora$' /vagrant/build.conf > /dev/null then echo 'DISTRO = fedora' >> /vagrant/build.conf echo 'SYSTEMD = y' >> /vagrant/build.conf echo 'UBAC = n' >> /vagrant/build.conf fi #{$install_refpolicy} SHELL end # build a Debian 10 VM config.vm.define "debian" do |debian| debian.vm.box = "debian/buster64" # assign a nice hostname debian.vm.hostname = "selinux-debian-devel" # give it a private internal IP address debian.vm.network "private_network", type: "dhcp" # Customize the amount of memory on the VM debian.vm.provider "virtualbox" do |vb| vb.memory = 1024 end debian.vm.provider "libvirt" do |lv| lv.memory = 1024 end # redefine the /vagrant as a synced folder (not an NFS share), in order to work cleanly on it debian.vm.synced_folder ".", "/vagrant", disabled: true debian.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ".vagrant/" debian.vm.provision "shell", run: "once", inline: <<-SHELL # install a few packages to make this machine ready to go out of the box echo "Installing SELinux dev dependencies..." export DEBIAN_FRONTEND=noninteractive apt-get -qq update apt-get install --no-install-recommends --no-install-suggests -qy \ bash-completion \ gcc \ git \ libc6-dev \ vim \ make \ auditd \ selinux-basics \ selinux-policy-default \ selinux-policy-dev \ setools # If SELinux is not enabled, enable it with Debian's policy and ask for a reboot if ! selinuxenabled then echo "Enabling SELinux for Debian according to https://wiki.debian.org/SELinux/Setup" selinux-activate echo "Please reboot now in order to enable SELinux:" echo "vagrant reload debian && vagrant provision debian" exit fi # configure the reference policy for Debian if ! grep '^DISTRO = debian$' /vagrant/build.conf > /dev/null then echo 'DISTRO = debian' >> /vagrant/build.conf echo 'SYSTEMD = y' >> /vagrant/build.conf echo 'UBAC = n' >> /vagrant/build.conf fi #{$install_refpolicy} SHELL end end
{ "pile_set_name": "Github" }
13 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
{ "pile_set_name": "Github" }
package com.huantansheng.easyphotos.models.ad; import android.view.View; /** * 广告实体 * Created by huan on 2017/10/24. */ public class AdEntity { public View adView; public int lineIndex; public AdEntity(View adView, int lineIndex) { this.adView = adView; this.lineIndex = lineIndex; } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <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/xsd/maven-4.0.0.xsd"> <parent> <groupId>org.opencoweb</groupId> <artifactId>coweb-admin</artifactId> <version>1.0.1-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>admin-jar</artifactId> <packaging>jar</packaging> <name>OpenCoweb :: Java :: Admin :: Jar</name> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.apache.wink</groupId> <artifactId>wink-json4j</artifactId> <version>1.1.2-incubating</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.opencoweb</groupId> <artifactId>coweb-server</artifactId> <version>${project.version}</version> <type>jar</type> <scope>provided</scope> </dependency> </dependencies> </project>
{ "pile_set_name": "Github" }
CONFIG_RCU_REF_SCALE_TEST=y CONFIG_PRINTK_TIME=y
{ "pile_set_name": "Github" }
using System; using System.Collections; using System.Collections.Generic; using System.Globalization; namespace SortingDemo { class Program { static void Main() { string[] names = {"Alabama", "Texas", "Washington", "Virginia", "Wisconsin", "Wyoming", "Kentucky", "Missouri", "Utah", "Hawaii", "Kansas", "Louisiana", "Alaska", "Arizona"}; CultureInfo.CurrentCulture = new CultureInfo("fi-FI"); Array.Sort(names); DisplayNames("Sorted using the Finnish culture", names); // sort using the invariant culture Array.Sort(names, Comparer.DefaultInvariant); DisplayNames("Sorted using the invariant culture", names); } public static void DisplayNames(string title, IEnumerable<string> names) { Console.WriteLine(title); Console.WriteLine(string.Join("-", names)); Console.WriteLine(); } } }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <configuration> <system.webServer> <handlers> <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> </handlers> <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" /> </system.webServer> </configuration>
{ "pile_set_name": "Github" }
#!/usr/bin/env bash # # test of qemu-img convert -n - convert without creation # # Copyright (C) 2009 Red Hat, Inc. # Copyright (C) 2013 Alex Bligh (alex@alex.org.uk) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # creator owner=alex@alex.org.uk seq=`basename $0` echo "QA output created by $seq" status=1 # failure is the default! _cleanup() { _cleanup_test_img for img in "$TEST_IMG".{orig,raw1,raw2,target}; do _rm_test_img "$img" done } trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter . ./common.pattern _supported_fmt qcow qcow2 vmdk qed raw _supported_proto file _unsupported_imgopts "subformat=monolithicFlat" \ "subformat=twoGbMaxExtentFlat" \ "subformat=twoGbMaxExtentSparse" \ "subformat=streamOptimized" _make_test_img 4M echo "== Testing conversion with -n fails with no target file ==" if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" >/dev/null 2>&1; then exit 1 fi echo "== Testing conversion with -n succeeds with a target file ==" _rm_test_img "$TEST_IMG.orig" TEST_IMG="$TEST_IMG.orig" _make_test_img 4M if ! $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.orig" ; then exit 1 fi echo "== Testing conversion to raw is the same after conversion with -n ==" # compare the raw files if ! $QEMU_IMG convert -f $IMGFMT -O raw "$TEST_IMG" "$TEST_IMG.raw1" ; then exit 1 fi if ! $QEMU_IMG convert -f $IMGFMT -O raw "$TEST_IMG.orig" "$TEST_IMG.raw2" ; then exit 1 fi if ! cmp "$TEST_IMG.raw1" "$TEST_IMG.raw2" ; then exit 1 fi echo "== Testing conversion back to original format ==" if ! $QEMU_IMG convert -f raw -O $IMGFMT -n "$TEST_IMG.raw2" "$TEST_IMG" ; then exit 1 fi _check_test_img echo "== Testing conversion to a smaller file fails ==" TEST_IMG="$TEST_IMG.target" _make_test_img 2M if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG" "$TEST_IMG.target" >/dev/null 2>&1; then exit 1 fi echo "== Regression testing for copy offloading bug ==" _make_test_img 1M TEST_IMG="$TEST_IMG.target" _make_test_img 1M $QEMU_IO -c 'write -P 1 0 512k' -c 'write -P 2 512k 512k' "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c 'write -P 4 512k 512k' -c 'write -P 3 0 512k' "$TEST_IMG.target" | _filter_qemu_io $QEMU_IMG convert -n -O $IMGFMT "$TEST_IMG" "$TEST_IMG.target" $QEMU_IMG compare "$TEST_IMG" "$TEST_IMG.target" echo "*** done" rm -f $seq.full status=0 exit 0
{ "pile_set_name": "Github" }