text
stringlengths 2
100k
| meta
dict |
---|---|
/*
* 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.vision.v1.model;
/**
* Information about a product.
*
* <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 Cloud Vision API. 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 GoogleCloudVisionV1p3beta1ProductSearchResultsResult extends com.google.api.client.json.GenericJson {
/**
* The resource name of the image from the product that is the closest match to the query.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String image;
/**
* The Product.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private GoogleCloudVisionV1p3beta1Product product;
/**
* A confidence level on the match, ranging from 0 (no confidence) to 1 (full confidence).
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.Float score;
/**
* The resource name of the image from the product that is the closest match to the query.
* @return value or {@code null} for none
*/
public java.lang.String getImage() {
return image;
}
/**
* The resource name of the image from the product that is the closest match to the query.
* @param image image or {@code null} for none
*/
public GoogleCloudVisionV1p3beta1ProductSearchResultsResult setImage(java.lang.String image) {
this.image = image;
return this;
}
/**
* The Product.
* @return value or {@code null} for none
*/
public GoogleCloudVisionV1p3beta1Product getProduct() {
return product;
}
/**
* The Product.
* @param product product or {@code null} for none
*/
public GoogleCloudVisionV1p3beta1ProductSearchResultsResult setProduct(GoogleCloudVisionV1p3beta1Product product) {
this.product = product;
return this;
}
/**
* A confidence level on the match, ranging from 0 (no confidence) to 1 (full confidence).
* @return value or {@code null} for none
*/
public java.lang.Float getScore() {
return score;
}
/**
* A confidence level on the match, ranging from 0 (no confidence) to 1 (full confidence).
* @param score score or {@code null} for none
*/
public GoogleCloudVisionV1p3beta1ProductSearchResultsResult setScore(java.lang.Float score) {
this.score = score;
return this;
}
@Override
public GoogleCloudVisionV1p3beta1ProductSearchResultsResult set(String fieldName, Object value) {
return (GoogleCloudVisionV1p3beta1ProductSearchResultsResult) super.set(fieldName, value);
}
@Override
public GoogleCloudVisionV1p3beta1ProductSearchResultsResult clone() {
return (GoogleCloudVisionV1p3beta1ProductSearchResultsResult) super.clone();
}
}
| {
"pile_set_name": "Github"
} |
#ifndef HLSL_TOKENIZER_H
#define HLSL_TOKENIZER_H
namespace M4
{
/** In addition to the values in this enum, all of the ASCII characters are
valid tokens. */
enum HLSLToken
{
// Built-in types.
HLSLToken_Float = 256,
HLSLToken_Float1,
HLSLToken_Float1x1,
HLSLToken_Float2,
HLSLToken_Float2x1,
HLSLToken_Float3,
HLSLToken_Float3x1,
HLSLToken_Float4,
HLSLToken_Float4x1,
HLSLToken_Float2x4,
HLSLToken_Float2x3,
HLSLToken_Float2x2,
HLSLToken_Float3x4,
HLSLToken_Float3x3,
HLSLToken_Float3x2,
HLSLToken_Float4x4,
HLSLToken_Float4x3,
HLSLToken_Float4x2,
HLSLToken_Half,
HLSLToken_Half1,
HLSLToken_Half1x1,
HLSLToken_Half2,
HLSLToken_Half2x1,
HLSLToken_Half3,
HLSLToken_Half3x1,
HLSLToken_Half4,
HLSLToken_Half4x1,
HLSLToken_Half2x4,
HLSLToken_Half2x3,
HLSLToken_Half2x2,
HLSLToken_Half3x4,
HLSLToken_Half3x3,
HLSLToken_Half3x2,
HLSLToken_Half4x4,
HLSLToken_Half4x3,
HLSLToken_Half4x2,
HLSLToken_Double,
HLSLToken_Double1,
HLSLToken_Double1x1,
HLSLToken_Double2,
HLSLToken_Double2x1,
HLSLToken_Double3,
HLSLToken_Double3x1,
HLSLToken_Double4,
HLSLToken_Double4x1,
HLSLToken_Double2x4,
HLSLToken_Double2x3,
HLSLToken_Double2x2,
HLSLToken_Double3x4,
HLSLToken_Double3x3,
HLSLToken_Double3x2,
HLSLToken_Double4x4,
HLSLToken_Double4x3,
HLSLToken_Double4x2,
HLSLToken_Bool,
HLSLToken_Bool2,
HLSLToken_Bool3,
HLSLToken_Bool4,
HLSLToken_Int,
HLSLToken_Int2,
HLSLToken_Int3,
HLSLToken_Int4,
HLSLToken_Uint,
HLSLToken_Uint2,
HLSLToken_Uint3,
HLSLToken_Uint4,
HLSLToken_Texture,
HLSLToken_Sampler,
HLSLToken_Sampler2D,
HLSLToken_Sampler3D,
HLSLToken_SamplerCube,
HLSLToken_Sampler2DShadow,
HLSLToken_Sampler2DMS,
HLSLToken_Sampler2DArray,
// Reserved words.
HLSLToken_If,
HLSLToken_Else,
HLSLToken_For,
HLSLToken_While,
HLSLToken_Break,
HLSLToken_True,
HLSLToken_False,
HLSLToken_Void,
HLSLToken_Struct,
HLSLToken_CBuffer,
HLSLToken_TBuffer,
HLSLToken_Register,
HLSLToken_Return,
HLSLToken_Continue,
HLSLToken_Discard,
HLSLToken_Const,
HLSLToken_Static,
HLSLToken_Inline,
HLSLToken_PreprocessorDefine,
HLSLToken_PreprocessorIf,
HLSLToken_PreprocessorElse,
HLSLToken_PreprocessorEndif,
// Input modifiers.
HLSLToken_Uniform,
HLSLToken_In,
HLSLToken_Out,
HLSLToken_InOut,
// Effect keywords.
HLSLToken_SamplerState,
HLSLToken_Technique,
HLSLToken_Pass,
// Multi-character symbols.
HLSLToken_LessEqual,
HLSLToken_GreaterEqual,
HLSLToken_EqualEqual,
HLSLToken_NotEqual,
HLSLToken_PlusPlus,
HLSLToken_MinusMinus,
HLSLToken_PlusEqual,
HLSLToken_MinusEqual,
HLSLToken_TimesEqual,
HLSLToken_DivideEqual,
HLSLToken_AndAnd, // &&
HLSLToken_BarBar, // ||
// Other token types.
HLSLToken_FloatLiteral,
HLSLToken_IntLiteral,
HLSLToken_Identifier,
HLSLToken_EndOfLine,
HLSLToken_EndOfStream,
};
class HLSLTokenizer
{
public:
HLSLTokenizer() { }
/// Maximum string length of an identifier.
static const int s_maxIdentifier = 255 + 1;
/** The file name is only used for error reporting. */
HLSLTokenizer(const char* fileName, const char* buffer, size_t length);
/** Advances to the next token in the stream. */
void Next(const bool EOLSkipping = true);
/** Returns the current token in the stream. */
int GetToken() const;
/** Returns the number of the current token. */
float GetFloat() const;
int GetInt() const;
/** Returns the identifier for the current token. */
const char* GetIdentifier() const;
/** Returns the line number where the current token began. */
int GetLineNumber() const;
/** Returns the file name where the current token began. */
const char* GetFileName() const;
/** Gets a human readable text description of the current token. */
void GetTokenName(char buffer[s_maxIdentifier]) const;
/** Reports an error using printf style formatting. The current line number
is included. Only the first error reported will be output. */
void Error(const char* format, ...);
/** Gets a human readable text description of the specified token. */
static void GetTokenName(int token, char buffer[s_maxIdentifier]);
/** Returns true if the next caracterer is a whitespace. */
bool NextIsWhitespace();
const char* getLastPos(const bool trimmed);
const char* getCurrentPos() { return m_buffer; }
void ReturnToPos(const char * pos);
private:
bool SkipWhitespace(const bool EOLSkipping);
bool SkipComment(const char **buffer, const bool EOLSkipping);
bool SkipPragmaDirective();
bool ScanNumber();
bool ScanLineDirective();
private:
const char* m_fileName;
const char* m_buffer;
const char* m_bufferPrevious;
const char* m_bufferEnd;
int m_lineNumber;
bool m_error;
int m_token;
float m_fValue;
int m_iValue;
char m_identifier[s_maxIdentifier];
char m_lineDirectiveFileName[s_maxIdentifier];
int m_tokenLineNumber;
};
}
#endif
| {
"pile_set_name": "Github"
} |
{
"created_at": "2015-02-27T22:28:42.940787",
"description": "Advanced Rest Client for Google Chrome.",
"fork": false,
"full_name": "jarrodek/advanced-rest-client",
"language": "JavaScript",
"updated_at": "2015-02-27T23:43:19.522577"
} | {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
*
* DeviceConfigurationDeviceStatus File
* PHP version 7
*
* @category Library
* @package Microsoft.Graph
* @copyright © Microsoft Corporation. All rights reserved.
* @license https://opensource.org/licenses/MIT MIT License
* @link https://graph.microsoft.com
*/
namespace Beta\Microsoft\Graph\Model;
/**
* DeviceConfigurationDeviceStatus class
*
* @category Model
* @package Microsoft.Graph
* @copyright © Microsoft Corporation. All rights reserved.
* @license https://opensource.org/licenses/MIT MIT License
* @link https://graph.microsoft.com
*/
class DeviceConfigurationDeviceStatus extends Entity
{
/**
* Gets the complianceGracePeriodExpirationDateTime
* The DateTime when device compliance grace period expires
*
* @return \DateTime The complianceGracePeriodExpirationDateTime
*/
public function getComplianceGracePeriodExpirationDateTime()
{
if (array_key_exists("complianceGracePeriodExpirationDateTime", $this->_propDict)) {
if (is_a($this->_propDict["complianceGracePeriodExpirationDateTime"], "\DateTime")) {
return $this->_propDict["complianceGracePeriodExpirationDateTime"];
} else {
$this->_propDict["complianceGracePeriodExpirationDateTime"] = new \DateTime($this->_propDict["complianceGracePeriodExpirationDateTime"]);
return $this->_propDict["complianceGracePeriodExpirationDateTime"];
}
}
return null;
}
/**
* Sets the complianceGracePeriodExpirationDateTime
* The DateTime when device compliance grace period expires
*
* @param \DateTime $val The complianceGracePeriodExpirationDateTime
*
* @return DeviceConfigurationDeviceStatus
*/
public function setComplianceGracePeriodExpirationDateTime($val)
{
$this->_propDict["complianceGracePeriodExpirationDateTime"] = $val;
return $this;
}
/**
* Gets the deviceDisplayName
* Device name of the DevicePolicyStatus.
*
* @return string The deviceDisplayName
*/
public function getDeviceDisplayName()
{
if (array_key_exists("deviceDisplayName", $this->_propDict)) {
return $this->_propDict["deviceDisplayName"];
} else {
return null;
}
}
/**
* Sets the deviceDisplayName
* Device name of the DevicePolicyStatus.
*
* @param string $val The deviceDisplayName
*
* @return DeviceConfigurationDeviceStatus
*/
public function setDeviceDisplayName($val)
{
$this->_propDict["deviceDisplayName"] = $val;
return $this;
}
/**
* Gets the deviceModel
* The device model that is being reported
*
* @return string The deviceModel
*/
public function getDeviceModel()
{
if (array_key_exists("deviceModel", $this->_propDict)) {
return $this->_propDict["deviceModel"];
} else {
return null;
}
}
/**
* Sets the deviceModel
* The device model that is being reported
*
* @param string $val The deviceModel
*
* @return DeviceConfigurationDeviceStatus
*/
public function setDeviceModel($val)
{
$this->_propDict["deviceModel"] = $val;
return $this;
}
/**
* Gets the lastReportedDateTime
* Last modified date time of the policy report.
*
* @return \DateTime The lastReportedDateTime
*/
public function getLastReportedDateTime()
{
if (array_key_exists("lastReportedDateTime", $this->_propDict)) {
if (is_a($this->_propDict["lastReportedDateTime"], "\DateTime")) {
return $this->_propDict["lastReportedDateTime"];
} else {
$this->_propDict["lastReportedDateTime"] = new \DateTime($this->_propDict["lastReportedDateTime"]);
return $this->_propDict["lastReportedDateTime"];
}
}
return null;
}
/**
* Sets the lastReportedDateTime
* Last modified date time of the policy report.
*
* @param \DateTime $val The lastReportedDateTime
*
* @return DeviceConfigurationDeviceStatus
*/
public function setLastReportedDateTime($val)
{
$this->_propDict["lastReportedDateTime"] = $val;
return $this;
}
/**
* Gets the platform
* Platform of the device that is being reported
*
* @return int The platform
*/
public function getPlatform()
{
if (array_key_exists("platform", $this->_propDict)) {
return $this->_propDict["platform"];
} else {
return null;
}
}
/**
* Sets the platform
* Platform of the device that is being reported
*
* @param int $val The platform
*
* @return DeviceConfigurationDeviceStatus
*/
public function setPlatform($val)
{
$this->_propDict["platform"] = intval($val);
return $this;
}
/**
* Gets the status
* Compliance status of the policy report. Possible values are: unknown, notApplicable, compliant, remediated, nonCompliant, error, conflict, notAssigned.
*
* @return ComplianceStatus The status
*/
public function getStatus()
{
if (array_key_exists("status", $this->_propDict)) {
if (is_a($this->_propDict["status"], "Beta\Microsoft\Graph\Model\ComplianceStatus")) {
return $this->_propDict["status"];
} else {
$this->_propDict["status"] = new ComplianceStatus($this->_propDict["status"]);
return $this->_propDict["status"];
}
}
return null;
}
/**
* Sets the status
* Compliance status of the policy report. Possible values are: unknown, notApplicable, compliant, remediated, nonCompliant, error, conflict, notAssigned.
*
* @param ComplianceStatus $val The status
*
* @return DeviceConfigurationDeviceStatus
*/
public function setStatus($val)
{
$this->_propDict["status"] = $val;
return $this;
}
/**
* Gets the userName
* The User Name that is being reported
*
* @return string The userName
*/
public function getUserName()
{
if (array_key_exists("userName", $this->_propDict)) {
return $this->_propDict["userName"];
} else {
return null;
}
}
/**
* Sets the userName
* The User Name that is being reported
*
* @param string $val The userName
*
* @return DeviceConfigurationDeviceStatus
*/
public function setUserName($val)
{
$this->_propDict["userName"] = $val;
return $this;
}
/**
* Gets the userPrincipalName
* UserPrincipalName.
*
* @return string The userPrincipalName
*/
public function getUserPrincipalName()
{
if (array_key_exists("userPrincipalName", $this->_propDict)) {
return $this->_propDict["userPrincipalName"];
} else {
return null;
}
}
/**
* Sets the userPrincipalName
* UserPrincipalName.
*
* @param string $val The userPrincipalName
*
* @return DeviceConfigurationDeviceStatus
*/
public function setUserPrincipalName($val)
{
$this->_propDict["userPrincipalName"] = $val;
return $this;
}
} | {
"pile_set_name": "Github"
} |
#include "uthash.h"
#include <stdlib.h> /* malloc */
#include <stdio.h> /* printf */
typedef struct example_user_t {
int id;
int cookie;
UT_hash_handle hh;
} example_user_t;
int main(int argc,char *argv[]) {
int i;
example_user_t *user, *users=NULL;
/* create elements */
for(i=0;i<10;i++) {
if ( (user = (example_user_t*)malloc(sizeof(example_user_t))) == NULL) exit(-1);
user->id = i;
user->cookie = i*i;
HASH_ADD_INT(users,id,user);
}
printf("hash contains %d items\n", HASH_COUNT(users));
return 0;
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env bash
EXPECTED="<location>/input.fq"
if [ "$1" != "$EXPECTED" ]; then
echo "1st argument expected '$EXPECTED' saw '$1'"
exit 1
fi
EXPECTED="--ref=<location>/input2.fq"
if [ "$2" != "$EXPECTED" ]; then
echo "2nd argument expected '$EXPECTED' saw '$2'"
exit 1
fi
EXPECTED="--ref2=<fullpath>/input2.fq"
if [ "$3" != "$EXPECTED" ]; then
echo "3rd argument expected '$EXPECTED' saw '$3'"
exit 1
fi
EXPECTED="--string=sentence"
if [ "$4" != "$EXPECTED" ]; then
echo "4nd argument expected '$EXPECTED' saw '$4'"
exit 1
fi
| {
"pile_set_name": "Github"
} |
var getMapData = require('./_getMapData');
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
module.exports = mapCacheDelete;
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.controller.class">Symfony\Bundle\AsseticBundle\Controller\AsseticController</parameter>
<parameter key="assetic.routing_loader.class">Symfony\Bundle\AsseticBundle\Routing\AsseticLoader</parameter>
<parameter key="assetic.cache.class">Assetic\Cache\FilesystemCache</parameter>
<parameter key="assetic.use_controller_worker.class">Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker</parameter>
<parameter key="assetic.request_listener.class">Symfony\Bundle\AsseticBundle\EventListener\RequestListener</parameter>
</parameters>
<services>
<service id="assetic.routing_loader" class="%assetic.routing_loader.class%" public="false">
<tag name="routing.loader" />
<argument type="service" id="assetic.asset_manager" />
</service>
<service id="assetic.controller" class="%assetic.controller.class%" scope="prototype">
<argument type="service" id="request" />
<argument type="service" id="assetic.asset_manager" />
<argument type="service" id="assetic.cache" />
<argument>%assetic.enable_profiler%</argument>
<argument type="service" id="profiler" on-invalid="null" />
<call method="setValueSupplier">
<argument type="service" id="assetic.value_supplier" on-invalid="ignore" />
</call>
</service>
<service id="assetic.cache" class="%assetic.cache.class%" public="false">
<argument>%assetic.cache_dir%/assets</argument>
</service>
<service id="assetic.use_controller_worker" class="%assetic.use_controller_worker.class%" public="false">
<tag name="assetic.factory_worker" />
</service>
<service id="assetic.request_listener" class="%assetic.request_listener.class%">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" />
</service>
</services>
</container>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
/******************************************************************************
Copyright:: 2020- IBM, Inc
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.
*****************************************************************************/
-->
<html lang="en">
<head>
<title>RPT Test Suite</title>
</head>
<body>
<a href="#navskip">skip to main content</a>
<!-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->
<h3>Cannot have multiple mains</h3>
<h2 id="hd1">Another heading to be used as landmark label</h2>
<main aria-labelledby="hd1">Text</main>
<main aria-labelledby="hd1">Text</main>
<a name="navskip"></a>
<script type="text/javascript">
//<![CDATA[
if (typeof(OpenAjax) == 'undefined') OpenAjax = {}
if (typeof(OpenAjax.a11y) == 'undefined') OpenAjax.a11y = {}
OpenAjax.a11y.ruleCoverage = [{
ruleId: "1182",
passedXpaths: [],
failedXpaths: [
"/html/body/main",
"/html/body/main[2]"
]
}];
//]]>
</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# BIDMach: basic classification"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For this tutorial, we'll BIDMach's GLM (Generalized Linear Model) package. It includes linear regression, logistic regression, and support vector machines (SVMs). The imports below include both BIDMat's matrix classes, and BIDMach machine learning classes. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import $exec.^.lib.bidmach_notebook_init\n",
"if (Mat.hasCUDA > 0) GPUmem"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dataset: Reuters RCV1 V2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The dataset is the widely used Reuters news article dataset RCV1 V2. This dataset and several others are loaded by running the script <code>getdata.sh</code> from the BIDMach/scripts directory. The data include both train and test subsets, and train and test labels (cats). "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"var dir = \"../data/rcv1/\" // Assumes bidmach is run from BIDMach/tutorials. Adjust to point to the BIDMach/data/rcv1 directory\n",
"tic\n",
"val train = loadSMat(dir+\"docs.smat.lz4\")\n",
"val cats = loadFMat(dir+\"cats.fmat.lz4\")\n",
"val test = loadSMat(dir+\"testdocs.smat.lz4\")\n",
"val tcats = loadFMat(dir+\"testcats.fmat.lz4\")\n",
"toc"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"BIDMach's basic classifiers can invoked like this on data that fits in memory:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val (mm, opts) = GLM.learner(train, cats, GLM.logistic)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The last option specifies the type of model, linear, logistic or SVM. The syntax is a little unusual. There are two values returned. The first <code>mm</code> is a \"learner\" which includes model, optimizer, and mixin classes. The second <code>opts</code> is an options object specialized to that combination of learner components. This design facilitates rapid iteration over model parameters from the command line or notebook. \n",
"\n",
"The parameters of the model can be viewed and modified by doing <code>opts.what</code>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"opts.what\n",
"opts.lrate=0.3f"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Most of these will work well with their default values. On the other hand, a few have a strong effect on performance. Those include:\n",
"<pre>\n",
"lrate: the learning rate\n",
"batchSize: the minibatch size\n",
"npasses: the number of passes over the dataset\n",
"</pre>\n",
"We will talk about tuning those in a moment. For now lets train the model:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"opts.npasses=2\n",
"mm.train"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The output includes important information about the training cycle:\n",
"* Percentage of dataset processed\n",
"* Cross-validated log likelihood (or negative loss)\n",
"* Overall throughput in gigaflops\n",
"* Elapsed time in seconds\n",
"* Total Gigabytes processed\n",
"* I/O throughput in MB/s\n",
"* GPU memory remaining (if using a GPU)\n",
"\n",
"The likelihood is calculated on a set of minibatches that are held out from training on every cycle. So this is a cross-validated likelihood estimate. Cross-validated likelihood will increase initially, but will then flatten and may decrease. There is random variation in the likelihood estimates because we are using SGD. Determining the best point to stop is tricky to do automatically, and is instead left to the analyst. \n",
"\n",
"To evaluate the model, we build a classifier from it:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val (pp, popts) = GLM.predictor(mm.model, test)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"And invoke the predict method on the predictor:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"pp.predict"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Although ll values are printed above, they are not meaningful (there is no target to compare the prediction with). \n",
"\n",
"We can now compare the accuracy of predictions (preds matrix) with ground truth (the tcats matrix). "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val preds = FMat(pp.preds(0))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val lls = mean(ln(1e-7f + tcats ∘ preds + (1-tcats) ∘ (1-preds)),2) // actual logistic likelihood\n",
"mean(lls)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A more thorough measure is ROC area:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val rocs = roc2(preds, tcats, 1-tcats, 100) // Compute ROC curves for all categories\n",
"plot(rocs(?,6))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plot(rocs(?,0->5))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"val aucs = mean(rocs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"aucs(6)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We could go ahead and start tuning our model, or we automate the process as in the next worksheet."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": "text/x-scala",
"file_extension": ".scala",
"mimetype": "text/x-scala",
"name": "scala211",
"nbconvert_exporter": "script",
"pygments_lexer": "scala",
"version": "2.11.11"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
| {
"pile_set_name": "Github"
} |
/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'button', 'el', {
selectedLabel: '%1 (Επιλεγμένο)'
} );
| {
"pile_set_name": "Github"
} |
a {
margin-top: 1px;
}
b {
margin-right: 2px;
}
c {
margin-bottom: 3px;
}
d {
margin-left: 4px;
}
| {
"pile_set_name": "Github"
} |
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [ 'dynamic-library' ]
RustLibrary('osclientcerts-static')
| {
"pile_set_name": "Github"
} |
.convert-user-to-org-element {
padding: 10px;
}
.convert-user-to-org .convert-form {
padding: 20px;
}
.convert-user-to-org .convert-form h3 {
margin-bottom: 20px;
}
.convert-user-to-org #convertForm {
max-width: 700px;
margin-top: 20px;
}
.convert-user-to-org #convertForm .form-group {
margin-bottom: 20px;
}
.convert-user-to-org #convertForm input {
margin-bottom: 10px;
}
.convert-user-to-org #convertForm .existing-data {
display: block;
font-size: 16px;
font-weight: bold;
}
.convert-user-to-org #convertForm .existing-data .avatar {
margin-right: 4px;
}
.convert-user-to-org #convertForm .existing-data .username {
vertical-align: middle;
}
.convert-user-to-org #convertForm .description {
margin-top: 10px;
display: block;
color: #888;
font-size: 12px;
}
.convert-user-to-org .org-list {
list-style: none;
}
.convert-user-to-org .org-list li {
margin-top: 4px;
}
.convert-user-to-org .org-list li a {
vertical-align: middle;
margin-left: 6px;
}
.convert-user-to-org .fa-arrow-circle-right {
margin-left: 6px;
}
.convert-user-to-org .form-group-content {
padding-left: 10px;
padding-top: 10px;
}
.convert-user-to-org .form-group-content .co-table {
margin: 0px;
}
.convert-user-to-org .co-option-table {
margin-top: 12px;
} | {
"pile_set_name": "Github"
} |
object {
string bar;
array { integer; } numbers = [ 1,2,3;
integer foo;
} myobj;
| {
"pile_set_name": "Github"
} |
Log file created at: 2018/11/16 17:03:00
Running on machine: PC-20160710NSGJ
Binary: Built with gc go1.9.2 for windows/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I1116 17:03:00.703520 402728 tmain.go:37] 8888
I1116 17:03:00.756523 402728 tmain.go:38] Golang语言社区
I1116 17:03:00.896531 402728 tmain.go:55] 本机几核:4
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
#include <math.h>
#include "omp_testsuite.h"
/*! Utility function to spend some time in a loop */
static void
do_some_work2 ()
{
int i;
double sum = 0;
for (i = 0; i < 1000; i++)
{
sum += sqrt (i);
}
}
int
check_parallel_for_private (FILE * logFile)
{
int sum = 0;
/*int sum0=0; */
int known_sum;
int i, i2;
#pragma omp parallel for reduction(+:sum) private(i2) schedule(static,1)
for (i = 1; i <= LOOPCOUNT; i++)
{
i2 = i;
#pragma omp flush
do_some_work2 ();
#pragma omp flush
sum = sum + i2;
} /*end of for */
known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2;
return (known_sum == sum);
} /* end of check_paralel_for_private */
int
crosscheck_parallel_for_private (FILE * logFile)
{
int sum = 0;
/*int sum0=0; */
int known_sum;
int i, i2;
#pragma omp parallel for reduction(+:sum) schedule(static,1)
for (i = 1; i <= LOOPCOUNT; i++)
{
i2 = i;
#pragma omp flush
do_some_work2 ();
#pragma omp flush
sum = sum + i2;
} /*end of for */
known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2;
return (known_sum == sum);
} /* end of check_paralel_for_private */
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
/*
* $Id: ExtensionsTable.java 469672 2006-10-31 21:56:19Z minchau $
*/
package org.apache.xalan.extensions;
import java.util.Hashtable;
import java.util.Vector;
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.templates.StylesheetRoot;
import org.apache.xpath.XPathProcessorException;
import org.apache.xpath.functions.FuncExtFunction;
/**
* Class holding a table registered extension namespace handlers
* @xsl.usage internal
*/
public class ExtensionsTable
{
/**
* Table of extensions that may be called from the expression language
* via the call(name, ...) function. Objects are keyed on the call
* name.
* @xsl.usage internal
*/
public Hashtable m_extensionFunctionNamespaces = new Hashtable();
/**
* The StylesheetRoot associated with this extensions table.
*/
private StylesheetRoot m_sroot;
/**
* The constructor (called from TransformerImpl) registers the
* StylesheetRoot for the transformation and instantiates an
* ExtensionHandler for each extension namespace.
* @xsl.usage advanced
*/
public ExtensionsTable(StylesheetRoot sroot)
throws javax.xml.transform.TransformerException
{
m_sroot = sroot;
Vector extensions = m_sroot.getExtensions();
for (int i = 0; i < extensions.size(); i++)
{
ExtensionNamespaceSupport extNamespaceSpt =
(ExtensionNamespaceSupport)extensions.get(i);
ExtensionHandler extHandler = extNamespaceSpt.launch();
if (extHandler != null)
addExtensionNamespace(extNamespaceSpt.getNamespace(), extHandler);
}
}
/**
* Get an ExtensionHandler object that represents the
* given namespace.
* @param extns A valid extension namespace.
*
* @return ExtensionHandler object that represents the
* given namespace.
*/
public ExtensionHandler get(String extns)
{
return (ExtensionHandler) m_extensionFunctionNamespaces.get(extns);
}
/**
* Register an extension namespace handler. This handler provides
* functions for testing whether a function is known within the
* namespace and also for invoking the functions.
*
* @param uri the URI for the extension.
* @param extNS the extension handler.
* @xsl.usage advanced
*/
public void addExtensionNamespace(String uri, ExtensionHandler extNS)
{
m_extensionFunctionNamespaces.put(uri, extNS);
}
/**
* Execute the function-available() function.
* @param ns the URI of namespace in which the function is needed
* @param funcName the function name being tested
*
* @return whether the given function is available or not.
*
* @throws javax.xml.transform.TransformerException
*/
public boolean functionAvailable(String ns, String funcName)
throws javax.xml.transform.TransformerException
{
boolean isAvailable = false;
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (extNS != null)
isAvailable = extNS.isFunctionAvailable(funcName);
}
return isAvailable;
}
/**
* Execute the element-available() function.
* @param ns the URI of namespace in which the function is needed
* @param elemName name of element being tested
*
* @return whether the given element is available or not.
*
* @throws javax.xml.transform.TransformerException
*/
public boolean elementAvailable(String ns, String elemName)
throws javax.xml.transform.TransformerException
{
boolean isAvailable = false;
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (extNS != null) // defensive
isAvailable = extNS.isElementAvailable(elemName);
}
return isAvailable;
}
/**
* Handle an extension function.
* @param ns the URI of namespace in which the function is needed
* @param funcName the function name being called
* @param argVec arguments to the function in a vector
* @param methodKey a unique key identifying this function instance in the
* stylesheet
* @param exprContext a context which may be passed to an extension function
* and provides callback functions to access various
* areas in the environment
*
* @return result of executing the function
*
* @throws javax.xml.transform.TransformerException
*/
public Object extFunction(String ns, String funcName,
Vector argVec, Object methodKey,
ExpressionContext exprContext)
throws javax.xml.transform.TransformerException
{
Object result = null;
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (null != extNS)
{
try
{
result = extNS.callFunction(funcName, argVec, methodKey,
exprContext);
}
catch (javax.xml.transform.TransformerException e)
{
throw e;
}
catch (Exception e)
{
throw new javax.xml.transform.TransformerException(e);
}
}
else
{
throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN, new Object[]{ns, funcName }));
//"Extension function '" + ns + ":" + funcName + "' is unknown");
}
}
return result;
}
/**
* Handle an extension function.
* @param extFunction the extension function
* @param argVec arguments to the function in a vector
* @param exprContext a context which may be passed to an extension function
* and provides callback functions to access various
* areas in the environment
*
* @return result of executing the function
*
* @throws javax.xml.transform.TransformerException
*/
public Object extFunction(FuncExtFunction extFunction, Vector argVec,
ExpressionContext exprContext)
throws javax.xml.transform.TransformerException
{
Object result = null;
String ns = extFunction.getNamespace();
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (null != extNS)
{
try
{
result = extNS.callFunction(extFunction, argVec, exprContext);
}
catch (javax.xml.transform.TransformerException e)
{
throw e;
}
catch (Exception e)
{
throw new javax.xml.transform.TransformerException(e);
}
}
else
{
throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
new Object[]{ns, extFunction.getFunctionName()}));
}
}
return result;
}
}
| {
"pile_set_name": "Github"
} |
<?php
namespace {
const bar = 42;
use const foo\bar;
}
namespace {
echo "Done";
}
?>
| {
"pile_set_name": "Github"
} |
// API
module.exports = state;
/**
* Creates initial state object
* for iteration over list
*
* @param {array|object} list - list to iterate over
* @param {function|null} sortMethod - function to use for keys sort,
* or `null` to keep them as is
* @returns {object} - initial state object
*/
function state(list, sortMethod)
{
var isNamedList = !Array.isArray(list)
, initState =
{
index : 0,
keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
jobs : {},
results : isNamedList ? {} : [],
size : isNamedList ? Object.keys(list).length : list.length
}
;
if (sortMethod)
{
// sort array keys based on it's values
// sort object's keys just on own merit
initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
{
return sortMethod(list[a], list[b]);
});
}
return initState;
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Faker\Provider\da_DK;
/**
* @author Antoine Corcy <[email protected]>
*/
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
/**
* @var array Danish phonenumber formats.
*/
protected static $formats = array(
'+45 ## ## ## ##',
'+45 #### ####',
'+45########',
'## ## ## ##',
'#### ####',
'########',
);
}
| {
"pile_set_name": "Github"
} |
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2020 iText Group NV
Authors: Bruno Lowagie, Paulo Soares, et al.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://itextpdf.com/terms-of-use/
The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.
In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using iText.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the iText software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping iText with a closed
source product.
For more information, please contact iText Software Corp. at this
address: [email protected]
*/
package com.itextpdf.kernel.pdf;
import com.itextpdf.kernel.counter.event.IMetaInfo;
import java.io.Serializable;
public class DocumentProperties implements Serializable {
private static final long serialVersionUID = -6625621282242153134L;
protected IMetaInfo metaInfo = null;
public DocumentProperties() {
}
public DocumentProperties(DocumentProperties other) {
this.metaInfo = other.metaInfo;
}
/**
* Sets document meta info. This meta info will be passed to the {@link com.itextpdf.kernel.counter.EventCounter}
* with {@link com.itextpdf.kernel.counter.event.CoreEvent} and can be used to determine event origin.
*
* @param metaInfo meta info to set
* @return this {@link DocumentProperties} instance
*/
public DocumentProperties setEventCountingMetaInfo(IMetaInfo metaInfo) {
this.metaInfo = metaInfo;
return this;
}
}
| {
"pile_set_name": "Github"
} |
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2008 Gael Guennebaud <[email protected]>
// Copyright (C) 2008 Benoit Jacob <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_PARAMETRIZEDLINE_H
#define EIGEN_PARAMETRIZEDLINE_H
namespace Eigen {
/** \geometry_module \ingroup Geometry_Module
*
* \class ParametrizedLine
*
* \brief A parametrized line
*
* A parametrized line is defined by an origin point \f$ \mathbf{o} \f$ and a unit
* direction vector \f$ \mathbf{d} \f$ such that the line corresponds to
* the set \f$ l(t) = \mathbf{o} + t \mathbf{d} \f$, \f$ t \in \mathbf{R} \f$.
*
* \tparam _Scalar the scalar type, i.e., the type of the coefficients
* \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
*/
template <typename _Scalar, int _AmbientDim, int _Options>
class ParametrizedLine
{
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
enum {
AmbientDimAtCompileTime = _AmbientDim,
Options = _Options
};
typedef _Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3
typedef Matrix<Scalar,AmbientDimAtCompileTime,1,Options> VectorType;
/** Default constructor without initialization */
EIGEN_DEVICE_FUNC inline ParametrizedLine() {}
template<int OtherOptions>
EIGEN_DEVICE_FUNC ParametrizedLine(const ParametrizedLine<Scalar,AmbientDimAtCompileTime,OtherOptions>& other)
: m_origin(other.origin()), m_direction(other.direction())
{}
/** Constructs a dynamic-size line with \a _dim the dimension
* of the ambient space */
EIGEN_DEVICE_FUNC inline explicit ParametrizedLine(Index _dim) : m_origin(_dim), m_direction(_dim) {}
/** Initializes a parametrized line of direction \a direction and origin \a origin.
* \warning the vector direction is assumed to be normalized.
*/
EIGEN_DEVICE_FUNC ParametrizedLine(const VectorType& origin, const VectorType& direction)
: m_origin(origin), m_direction(direction) {}
template <int OtherOptions>
EIGEN_DEVICE_FUNC explicit ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane);
/** Constructs a parametrized line going from \a p0 to \a p1. */
EIGEN_DEVICE_FUNC static inline ParametrizedLine Through(const VectorType& p0, const VectorType& p1)
{ return ParametrizedLine(p0, (p1-p0).normalized()); }
EIGEN_DEVICE_FUNC ~ParametrizedLine() {}
/** \returns the dimension in which the line holds */
EIGEN_DEVICE_FUNC inline Index dim() const { return m_direction.size(); }
EIGEN_DEVICE_FUNC const VectorType& origin() const { return m_origin; }
EIGEN_DEVICE_FUNC VectorType& origin() { return m_origin; }
EIGEN_DEVICE_FUNC const VectorType& direction() const { return m_direction; }
EIGEN_DEVICE_FUNC VectorType& direction() { return m_direction; }
/** \returns the squared distance of a point \a p to its projection onto the line \c *this.
* \sa distance()
*/
EIGEN_DEVICE_FUNC RealScalar squaredDistance(const VectorType& p) const
{
VectorType diff = p - origin();
return (diff - direction().dot(diff) * direction()).squaredNorm();
}
/** \returns the distance of a point \a p to its projection onto the line \c *this.
* \sa squaredDistance()
*/
EIGEN_DEVICE_FUNC RealScalar distance(const VectorType& p) const { EIGEN_USING_STD_MATH(sqrt) return sqrt(squaredDistance(p)); }
/** \returns the projection of a point \a p onto the line \c *this. */
EIGEN_DEVICE_FUNC VectorType projection(const VectorType& p) const
{ return origin() + direction().dot(p-origin()) * direction(); }
EIGEN_DEVICE_FUNC VectorType pointAt(const Scalar& t) const;
template <int OtherOptions>
EIGEN_DEVICE_FUNC Scalar intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
template <int OtherOptions>
EIGEN_DEVICE_FUNC Scalar intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
template <int OtherOptions>
EIGEN_DEVICE_FUNC VectorType intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const;
/** \returns \c *this with scalar type casted to \a NewScalarType
*
* Note that if \a NewScalarType is equal to the current scalar type of \c *this
* then this function smartly returns a const reference to \c *this.
*/
template<typename NewScalarType>
EIGEN_DEVICE_FUNC inline typename internal::cast_return_type<ParametrizedLine,
ParametrizedLine<NewScalarType,AmbientDimAtCompileTime,Options> >::type cast() const
{
return typename internal::cast_return_type<ParametrizedLine,
ParametrizedLine<NewScalarType,AmbientDimAtCompileTime,Options> >::type(*this);
}
/** Copy constructor with scalar type conversion */
template<typename OtherScalarType,int OtherOptions>
EIGEN_DEVICE_FUNC inline explicit ParametrizedLine(const ParametrizedLine<OtherScalarType,AmbientDimAtCompileTime,OtherOptions>& other)
{
m_origin = other.origin().template cast<Scalar>();
m_direction = other.direction().template cast<Scalar>();
}
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
* determined by \a prec.
*
* \sa MatrixBase::isApprox() */
EIGEN_DEVICE_FUNC bool isApprox(const ParametrizedLine& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
{ return m_origin.isApprox(other.m_origin, prec) && m_direction.isApprox(other.m_direction, prec); }
protected:
VectorType m_origin, m_direction;
};
/** Constructs a parametrized line from a 2D hyperplane
*
* \warning the ambient space must have dimension 2 such that the hyperplane actually describes a line
*/
template <typename _Scalar, int _AmbientDim, int _Options>
template <int OtherOptions>
EIGEN_DEVICE_FUNC inline ParametrizedLine<_Scalar, _AmbientDim,_Options>::ParametrizedLine(const Hyperplane<_Scalar, _AmbientDim,OtherOptions>& hyperplane)
{
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 2)
direction() = hyperplane.normal().unitOrthogonal();
origin() = -hyperplane.normal()*hyperplane.offset();
}
/** \returns the point at \a t along this line
*/
template <typename _Scalar, int _AmbientDim, int _Options>
EIGEN_DEVICE_FUNC inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType
ParametrizedLine<_Scalar, _AmbientDim,_Options>::pointAt(const _Scalar& t) const
{
return origin() + (direction()*t);
}
/** \returns the parameter value of the intersection between \c *this and the given \a hyperplane
*/
template <typename _Scalar, int _AmbientDim, int _Options>
template <int OtherOptions>
EIGEN_DEVICE_FUNC inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionParameter(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
{
return -(hyperplane.offset()+hyperplane.normal().dot(origin()))
/ hyperplane.normal().dot(direction());
}
/** \deprecated use intersectionParameter()
* \returns the parameter value of the intersection between \c *this and the given \a hyperplane
*/
template <typename _Scalar, int _AmbientDim, int _Options>
template <int OtherOptions>
EIGEN_DEVICE_FUNC inline _Scalar ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersection(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
{
return intersectionParameter(hyperplane);
}
/** \returns the point of the intersection between \c *this and the given hyperplane
*/
template <typename _Scalar, int _AmbientDim, int _Options>
template <int OtherOptions>
EIGEN_DEVICE_FUNC inline typename ParametrizedLine<_Scalar, _AmbientDim,_Options>::VectorType
ParametrizedLine<_Scalar, _AmbientDim,_Options>::intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& hyperplane) const
{
return pointAt(intersectionParameter(hyperplane));
}
} // end namespace Eigen
#endif // EIGEN_PARAMETRIZEDLINE_H
| {
"pile_set_name": "Github"
} |
.container, .text-container {
margin: 0 auto;
position: relative;
padding: 0 20px;
}
.text-container {
max-width: 750px;
}
.youtube-container {
margin: 0 auto;
position: relative;
padding: 0 20px;
max-width: 1100px;
}
.container {
max-width: 1140px;
&.max-container {
max-width: 100%;
padding: 0;
}
}
header {
color: #fff;
padding: 20px 0;
background: $brand-color; /* Old browsers */
background: linear-gradient(to bottom, $brand-color 0%, $middle-gradient-color 100%) no-repeat $brand-color;
a {
color: #fff;
text-decoration: none;
z-index: 1;
position: relative;
&:hover {
text-decoration: none;
}
}
.company-name {
font-size: 1.7em;
line-height: 0;
min-height: 38px;
a {
padding: 20px 0px 0px 0px;
display: inline-block;
}
img {
display: block;
width: auto;
}
}
}
.content {
background: #fff;
padding: 1px 0 0 0;
position: relative;
}
.screenshot{
max-width: 100%;
height: auto;
display: block;
box-shadow: 0 1px 0 #ccc, 0 1px 0 1px #eee;
border-radius: 2px;
margin-left: auto;
margin-right: auto;
background: #DDD url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2244%22%20height%3D%2212%22%20viewBox%3D%220%200%2044%2012%22%3E%3Ccircle%20cx%3D%226%22%20cy%3D%226%22%20r%3D%224%22%20fill%3D%22%23eee%22%20%2F%3E%3Ccircle%20cx%3D%2222%22%20cy%3D%226%22%20r%3D%224%22%20fill%3D%22%23eee%22%20%2F%3E%3Ccircle%20cx%3D%2238%22%20cy%3D%226%22%20r%3D%224%22%20fill%3D%22%23eee%22%20%2F%3E%3C%2Fsvg%3E') 4px 4px no-repeat;
padding: 20px 0 0 0;
position: relative;
}
section {
padding: 50px 0;
}
section + section {
padding-top: 0;
}
.subtext {
margin-top: 10px;
text-align: center;
}
.cta {
margin: 60px 0;
}
.page h2 {
text-align: center;
}
blockquote {
padding: 18px 25px;
margin: 0;
quotes: "\201C""\201D""\2018""\2019";
font-style: italic;
.author {
display: block;
font-weight: bold;
margin: 10px 0 0 0;
font-size: .85em;
font-style: normal;
}
p {
display: inline;
}
}
blockquote:before {
color: #ccc;
content: open-quote;
font-size: 4em;
line-height: 0.1em;
margin-right: 0.25em;
vertical-align: -0.4em;
}
.square-image {
width: 150px;
height: 150px;
overflow: hidden;
margin: 25px auto 0 auto;
position: relative;
border-radius: 200px;
img {
position: absolute;
margin: auto;
width: 150px;
}
}
.page {
margin-bottom: 0;
padding-bottom: 80px;
}
.center-text {
text-align: center;
}
.right-text {
text-align: right;
}
.youtube2 {
position: relative;
width: 100%;
padding-top: 56.25%;
}
.youtube2 iframe {
position: absolute;
top: 0;
right: 0;
width: 100% !important;
height: 100% !important;
}
.top-padding {
padding: 50px 0 0 0;
} | {
"pile_set_name": "Github"
} |
/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2008 Jose Aparicio
Copyright (C) 2008 Chris Kenyon
Copyright (C) 2008 Roland Lichters
Copyright (C) 2008 StatPro Italia srl
Copyright (C) 2009 Ferdinando Ametrano
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<[email protected]>. The license is also available online at
<http://quantlib.org/license.shtml>.
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 license for more details.
*/
#include <ql/termstructures/credit/hazardratestructure.hpp>
#include <ql/math/integrals/gaussianquadratures.hpp>
#include <ql/functional.hpp>
namespace QuantLib {
namespace {
template <class F>
struct remapper {
F f;
Time T;
remapper(const F& f, Time T) : f(f), T(T) {}
// This remaps [-1,1] to [0,T]. No differential included.
Real operator()(Real x) const {
const Real arg = (x+1.0)*T/2.0;
return f(arg);
}
};
template <class F>
remapper<F> remap(const F& f, Time T) {
return remapper<F>(f,T);
}
}
HazardRateStructure::HazardRateStructure(
const DayCounter& dc,
const std::vector<Handle<Quote> >& jumps,
const std::vector<Date>& jumpDates)
: DefaultProbabilityTermStructure(dc, jumps, jumpDates) {}
HazardRateStructure::HazardRateStructure(
const Date& refDate,
const Calendar& cal,
const DayCounter& dc,
const std::vector<Handle<Quote> >& jumps,
const std::vector<Date>& jumpDates)
: DefaultProbabilityTermStructure(refDate, cal, dc, jumps, jumpDates) {}
HazardRateStructure::HazardRateStructure(
Natural settlDays,
const Calendar& cal,
const DayCounter& dc,
const std::vector<Handle<Quote> >& jumps,
const std::vector<Date>& jumpDates)
: DefaultProbabilityTermStructure(settlDays, cal, dc, jumps, jumpDates) {}
Probability HazardRateStructure::survivalProbabilityImpl(Time t) const {
using namespace ext::placeholders;
static GaussChebyshevIntegration integral(48);
// this stores the address of the method to integrate (so that
// we don't have to insert its full expression inside the
// integral below--it's long enough already)
Real (HazardRateStructure::*f)(Time) const =
&HazardRateStructure::hazardRateImpl;
// the Gauss-Chebyshev quadratures integrate over [-1,1],
// hence the remapping (and the Jacobian term t/2)
return std::exp(-integral(remap(ext::bind(f,this,_1), t)) * t/2.0);
}
}
| {
"pile_set_name": "Github"
} |
/* GMODULE - GLIB wrapper code for dynamic module loading
* Copyright (C) 1998 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GMODULE_H__
#define __GMODULE_H__
#include <glib.h>
G_BEGIN_DECLS
/* exporting and importing functions, this is special cased
* to feature Windows dll stubs.
*/
#define G_MODULE_IMPORT extern
#ifdef G_PLATFORM_WIN32
# define G_MODULE_EXPORT __declspec(dllexport)
#else /* !G_PLATFORM_WIN32 */
# define G_MODULE_EXPORT
#endif /* !G_PLATFORM_WIN32 */
typedef enum
{
G_MODULE_BIND_LAZY = 1 << 0,
G_MODULE_BIND_LOCAL = 1 << 1,
G_MODULE_BIND_MASK = 0x03
} GModuleFlags;
typedef struct _GModule GModule;
typedef const gchar* (*GModuleCheckInit) (GModule *module);
typedef void (*GModuleUnload) (GModule *module);
/* return TRUE if dynamic module loading is supported */
GLIB_AVAILABLE_IN_ALL
gboolean g_module_supported (void) G_GNUC_CONST;
/* open a module 'file_name' and return handle, which is NULL on error */
GLIB_AVAILABLE_IN_ALL
GModule* g_module_open (const gchar *file_name,
GModuleFlags flags);
/* close a previously opened module, returns TRUE on success */
GLIB_AVAILABLE_IN_ALL
gboolean g_module_close (GModule *module);
/* make a module resident so g_module_close on it will be ignored */
GLIB_AVAILABLE_IN_ALL
void g_module_make_resident (GModule *module);
/* query the last module error as a string */
GLIB_AVAILABLE_IN_ALL
const gchar * g_module_error (void);
/* retrieve a symbol pointer from 'module', returns TRUE on success */
GLIB_AVAILABLE_IN_ALL
gboolean g_module_symbol (GModule *module,
const gchar *symbol_name,
gpointer *symbol);
/* retrieve the file name from an existing module */
GLIB_AVAILABLE_IN_ALL
const gchar * g_module_name (GModule *module);
/* Build the actual file name containing a module. 'directory' is the
* directory where the module file is supposed to be, or NULL or empty
* in which case it should either be in the current directory or, on
* some operating systems, in some standard place, for instance on the
* PATH. Hence, to be absoultely sure to get the correct module,
* always pass in a directory. The file name consists of the directory,
* if supplied, and 'module_name' suitably decorated according to
* the operating system's conventions (for instance lib*.so or *.dll).
*
* No checks are made that the file exists, or is of correct type.
*/
GLIB_AVAILABLE_IN_ALL
gchar* g_module_build_path (const gchar *directory,
const gchar *module_name);
#ifndef __GTK_DOC_IGNORE__
#ifdef G_OS_WIN32
#define g_module_open g_module_open_utf8
#define g_module_name g_module_name_utf8
GLIB_AVAILABLE_IN_ALL
GModule * g_module_open_utf8 (const gchar *file_name,
GModuleFlags flags);
GLIB_AVAILABLE_IN_ALL
const gchar *g_module_name_utf8 (GModule *module);
#endif
#endif
G_END_DECLS
#endif /* __GMODULE_H__ */
| {
"pile_set_name": "Github"
} |
/*
Copyright 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 typed clients.
package v1beta2
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_144) on Tue Oct 03 09:17:58 PDT 2017 -->
<title>VideoBitmapDecoder (glide API)</title>
<meta name="date" content="2017-10-03">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="VideoBitmapDecoder (glide API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/TransformationUtils.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html" target="_top">Frames</a></li>
<li><a href="VideoBitmapDecoder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.bumptech.glide.load.resource.bitmap</div>
<h2 title="Class VideoBitmapDecoder" class="title">Class VideoBitmapDecoder</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>com.bumptech.glide.load.resource.bitmap.VideoBitmapDecoder</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html" title="interface in com.bumptech.glide.load">ResourceDecoder</a><<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a>,<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">VideoBitmapDecoder</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>
implements <a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html" title="interface in com.bumptech.glide.load">ResourceDecoder</a><<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a>,<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>></pre>
<div class="block">An <a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html" title="interface in com.bumptech.glide.load"><code>ResourceDecoder</code></a> that can decode a thumbnail frame
<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics"><code>Bitmap</code></a> from a <a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os"><code>ParcelFileDescriptor</code></a> containing a
video.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://d.android.com/reference/android/media/MediaMetadataRetriever.html?is-external=true" title="class or interface in android.media"><code>MediaMetadataRetriever</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#DEFAULT_FRAME">DEFAULT_FRAME</a></span></code>
<div class="block">A constant indicating we should use whatever frame we consider best, frequently not the first
frame.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../../../com/bumptech/glide/load/Option.html" title="class in com.bumptech.glide.load">Option</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#FRAME_OPTION">FRAME_OPTION</a></span></code>
<div class="block">An integer indicating the frame option used to retrieve a target frame.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../../../com/bumptech/glide/load/Option.html" title="class in com.bumptech.glide.load">Option</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#TARGET_FRAME">TARGET_FRAME</a></span></code>
<div class="block">A long indicating the time position (in microseconds) of the target frame which will be
retrieved.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#VideoBitmapDecoder-com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool-">VideoBitmapDecoder</a></span>(<a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/BitmapPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">BitmapPool</a> bitmapPool)</code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#VideoBitmapDecoder-android.content.Context-">VideoBitmapDecoder</a></span>(<a href="http://d.android.com/reference/android/content/Context.html?is-external=true" title="class or interface in android.content">Context</a> context)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/bumptech/glide/load/engine/Resource.html" title="interface in com.bumptech.glide.load.engine">Resource</a><<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#decode-android.os.ParcelFileDescriptor-int-int-com.bumptech.glide.load.Options-">decode</a></span>(<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a> resource,
int outWidth,
int outHeight,
<a href="../../../../../../com/bumptech/glide/load/Options.html" title="class in com.bumptech.glide.load">Options</a> options)</code>
<div class="block">Returns a decoded resource from the given data or null if no resource could be decoded.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#handles-android.os.ParcelFileDescriptor-com.bumptech.glide.load.Options-">handles</a></span>(<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a> data,
<a href="../../../../../../com/bumptech/glide/load/Options.html" title="class in com.bumptech.glide.load">Options</a> options)</code>
<div class="block">Returns <code>true</code> if this decoder is capable of decoding the given source with the given
options, and <code>false</code> otherwise.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="DEFAULT_FRAME">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_FRAME</h4>
<pre>public static final long DEFAULT_FRAME</pre>
<div class="block">A constant indicating we should use whatever frame we consider best, frequently not the first
frame.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../constant-values.html#com.bumptech.glide.load.resource.bitmap.VideoBitmapDecoder.DEFAULT_FRAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="TARGET_FRAME">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TARGET_FRAME</h4>
<pre>public static final <a href="../../../../../../com/bumptech/glide/load/Option.html" title="class in com.bumptech.glide.load">Option</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html?is-external=true" title="class or interface in java.lang">Long</a>> TARGET_FRAME</pre>
<div class="block">A long indicating the time position (in microseconds) of the target frame which will be
retrieved. <a href="http://d.android.com/reference/android/media/MediaMetadataRetriever.html?is-external=true#getFrameAtTime-long-" title="class or interface in android.media"><code>MediaMetadataRetriever.getFrameAtTime(long)</code></a> is used to
extract the video frame.
<p>When retrieving the frame at the given time position, there is no guarantee that the data
source has a frame located at the position. When this happens, a frame nearby will be returned.
If the long is negative, time position and option will ignored, and any frame that the
implementation considers as representative may be returned.</div>
</li>
</ul>
<a name="FRAME_OPTION">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>FRAME_OPTION</h4>
<pre>public static final <a href="../../../../../../com/bumptech/glide/load/Option.html" title="class in com.bumptech.glide.load">Option</a><<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html?is-external=true" title="class or interface in java.lang">Integer</a>> FRAME_OPTION</pre>
<div class="block">An integer indicating the frame option used to retrieve a target frame.
<p>This option will be ignored if <a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#TARGET_FRAME"><code>TARGET_FRAME</code></a> is not set or is set to
<a href="../../../../../../com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html#DEFAULT_FRAME"><code>DEFAULT_FRAME</code></a>.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="http://d.android.com/reference/android/media/MediaMetadataRetriever.html?is-external=true#getFrameAtTime-long-int-" title="class or interface in android.media"><code>MediaMetadataRetriever.getFrameAtTime(long, int)</code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="VideoBitmapDecoder-android.content.Context-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>VideoBitmapDecoder</h4>
<pre>public VideoBitmapDecoder(<a href="http://d.android.com/reference/android/content/Context.html?is-external=true" title="class or interface in android.content">Context</a> context)</pre>
</li>
</ul>
<a name="VideoBitmapDecoder-com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>VideoBitmapDecoder</h4>
<pre>public VideoBitmapDecoder(<a href="../../../../../../com/bumptech/glide/load/engine/bitmap_recycle/BitmapPool.html" title="interface in com.bumptech.glide.load.engine.bitmap_recycle">BitmapPool</a> bitmapPool)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="handles-android.os.ParcelFileDescriptor-com.bumptech.glide.load.Options-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>handles</h4>
<pre>public boolean handles(<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a> data,
<a href="../../../../../../com/bumptech/glide/load/Options.html" title="class in com.bumptech.glide.load">Options</a> options)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#handles-T-com.bumptech.glide.load.Options-">ResourceDecoder</a></code></span></div>
<div class="block">Returns <code>true</code> if this decoder is capable of decoding the given source with the given
options, and <code>false</code> otherwise.
<p> Decoders should make a best effort attempt to quickly determine if they are likely to be
able to decode data, but should not attempt to completely read the given data. A typical
implementation would check the file headers verify they match content the decoder expects to
handle (i.e. a GIF decoder should verify that the image contains the GIF header block. </p>
<p> Decoders that return <code>true</code> from <a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#handles-T-com.bumptech.glide.load.Options-"><code>ResourceDecoder.handles(Object, Options)</code></a> may still
return <code>null</code> from <a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#decode-T-int-int-com.bumptech.glide.load.Options-"><code>ResourceDecoder.decode(Object, int, int, Options)</code></a> if the data is
partial or formatted incorrectly. </p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#handles-T-com.bumptech.glide.load.Options-">handles</a></code> in interface <code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html" title="interface in com.bumptech.glide.load">ResourceDecoder</a><<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a>,<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>></code></dd>
</dl>
</li>
</ul>
<a name="decode-android.os.ParcelFileDescriptor-int-int-com.bumptech.glide.load.Options-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>decode</h4>
<pre>public <a href="../../../../../../com/bumptech/glide/load/engine/Resource.html" title="interface in com.bumptech.glide.load.engine">Resource</a><<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>> decode(<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a> resource,
int outWidth,
int outHeight,
<a href="../../../../../../com/bumptech/glide/load/Options.html" title="class in com.bumptech.glide.load">Options</a> options)
throws <a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#decode-T-int-int-com.bumptech.glide.load.Options-">ResourceDecoder</a></code></span></div>
<div class="block">Returns a decoded resource from the given data or null if no resource could be decoded.
<p> The <code>source</code> is managed by the caller, there's no need to close it. The returned
<a href="../../../../../../com/bumptech/glide/load/engine/Resource.html" title="interface in com.bumptech.glide.load.engine"><code>Resource</code></a> will be <a href="../../../../../../com/bumptech/glide/load/engine/Resource.html#recycle--"><code>released</code></a> when the engine sees fit. </p>
<p> Note - The <code>width</code> and <code>height</code> arguments are hints only, there is no
requirement that the decoded resource exactly match the given dimensions. A typical use case
would be to use the target dimensions to determine how much to downsample Bitmaps by to avoid
overly large allocations. </p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html#decode-T-int-int-com.bumptech.glide.load.Options-">decode</a></code> in interface <code><a href="../../../../../../com/bumptech/glide/load/ResourceDecoder.html" title="interface in com.bumptech.glide.load">ResourceDecoder</a><<a href="http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true" title="class or interface in android.os">ParcelFileDescriptor</a>,<a href="http://d.android.com/reference/android/graphics/Bitmap.html?is-external=true" title="class or interface in android.graphics">Bitmap</a>></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>resource</code> - The data the resource should be decoded from.</dd>
<dd><code>outWidth</code> - The ideal width in pixels of the decoded resource, or <a href="../../../../../../com/bumptech/glide/request/target/Target.html#SIZE_ORIGINAL"><code>Target.SIZE_ORIGINAL</code></a> to indicate the original
resource width.</dd>
<dd><code>outHeight</code> - The ideal height in pixels of the decoded resource, or <a href="../../../../../../com/bumptech/glide/request/target/Target.html#SIZE_ORIGINAL"><code>Target.SIZE_ORIGINAL</code></a> to indicate the original
resource height.</dd>
<dd><code>options</code> - A map of string keys to objects that may or may not contain options available to
this particular implementation. Implementations should not assume that any or
all of their option keys are present. However, implementations may assume that
if one of their option keys is present, it's value is non-null and is of the
expected type.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/bumptech/glide/load/resource/bitmap/TransformationUtils.html" title="class in com.bumptech.glide.load.resource.bitmap"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/bumptech/glide/load/resource/bitmap/VideoBitmapDecoder.html" target="_top">Frames</a></li>
<li><a href="VideoBitmapDecoder.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*
* SteVe - SteckdosenVerwaltung - https://github.com/RWTH-i5-IDSG/steve
* Copyright (C) 2013-2020 RWTH Aachen University - Information Systems - Intelligent Distributed Systems Group (IDSG).
* All Rights Reserved.
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
package de.rwth.idsg.steve.repository;
import de.rwth.idsg.steve.repository.dto.DbVersion;
import de.rwth.idsg.steve.web.dto.Statistics;
/**
* @author Sevket Goekay <[email protected]>
* @since 19.08.2014
*/
public interface GenericRepository {
Statistics getStats();
/**
* Returns database version of SteVe and last database update timestamp
*
*/
DbVersion getDBVersion();
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="50dp"
tools:parentTag="RelativeLayout">
<TextView
android:id="@+id/mRabbitSwitchBtnTvDesc"
android:layout_marginStart="16dp"
android:text="选项一"
android:textSize="@dimen/rabbit_font_big"
android:textColor="@color/rabbit_black"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<Switch
android:id="@+id/mRabbitSwitchBtnSc"
android:theme="@style/MySwitchTheme"
android:layout_centerVertical="true"
android:layout_marginEnd="16dp"
android:layout_alignParentEnd="true"
android:layout_width="60dp"
android:layout_height="30dp"/>
<View
android:layout_marginStart="16dp"
android:layout_alignParentBottom="true"
android:background="@color/rabbit_divider_line"
android:layout_width="match_parent"
android:layout_height="1px"/>
</merge> | {
"pile_set_name": "Github"
} |
/**
*
* Copyright 2020 Aditya Borikar
*
* 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.
*/
/**
* Form class needed for <a href="https://xmpp.org/extensions/xep-0232.html"> XEP-0232: Software Information</a>.
*/
package org.jivesoftware.smackx.softwareinfo.form;
| {
"pile_set_name": "Github"
} |
## Work with WKT
{toc}
### Description
The following is an example of working with WKT.
For more information go to the <a href="/doc/maps/en/manual/dg-wkt">WKT</a> section of documentation.
### Display of simple vector layers
<script src="https://maps.api.2gis.ru/2.0/loader.js"></script>
<div id="map" style="width: 100%; height: 400px;"></div>
<script>
DG.then(function() {
var map,
coord1 = 'POLYGON((82.91699 55.042136, 82.917522 55.040187, 82.918063 55.040235, 82.917540 55.042184,82.91699 55.042136))',
coord2 = 'LINESTRING(82.91799 55.043136, 82.918522 55.041187, 82.919063 55.041235)',
coord3 = 'POINT(82.914 55.042136)';
map = DG.map('map', {
center: [55.042136, 82.91699],
zoom: 16
});
DG.Wkt.geoJsonLayer(coord1).addTo(map);
DG.Wkt.geoJsonLayer(coord2).addTo(map);
DG.Wkt.geoJsonLayer(coord3).addTo(map);
})
</script>
<!DOCTYPE html>
<html>
<head>
<title>Display of simple vector layers</title>
<script src="https://maps.api.2gis.ru/2.0/loader.js"></script>
</head>
<body>
<div id="map" style="width: 100%; height: 400px;"></div>
<script>
DG.then(function() {
var map,
coord1 = 'POLYGON((82.91699 55.042136, 82.917522 55.040187, 82.918063 55.040235, 82.917540 55.042184,82.91699 55.042136))',
coord2 = 'LINESTRING(82.91799 55.043136, 82.918522 55.041187, 82.919063 55.041235)',
coord3 = 'POINT(82.914 55.042136)';
map = DG.map('map', {
center: [55.042136, 82.91699],
zoom: 16
});
DG.Wkt.geoJsonLayer(coord1).addTo(map);
DG.Wkt.geoJsonLayer(coord2).addTo(map);
DG.Wkt.geoJsonLayer(coord3).addTo(map);
})
</script>
</body>
</html>
### Display of complex vector layers
<div id="map1" style="width: 100%; height: 400px;"></div>
<script>
DG.then(function() {
var map = DG.map('map1', {
center: [55.041836, 82.91699],
zoom: 16
});
DG.Wkt.geoJsonLayer('MULTIPOLYGON(((82.91699 55.042136, 82.917522 55.040187, 82.918063 55.040235, 82.917540 55.042184,82.91699 55.042136)), ((82.91599 55.041136, 82.916522 55.039187, 82.917063 55.039235, 82.916540 55.041184,82.91599 55.041136)))').addTo(map);
DG.Wkt.geoJsonLayer('MULTILINESTRING((82.91799 55.043136, 82.918522 55.041187, 82.919063 55.041235), (82.91899 55.044136, 82.919522 55.042187, 82.920063 55.042235))').addTo(map);
DG.Wkt.geoJsonLayer('MULTIPOINT(82.914 55.042136, 82.915 55.043136, 82.915 55.042136, 82.914 55.043136)').addTo(map);
});
</script>
<!DOCTYPE html>
<html>
<head>
<title>Display of compound vector layers</title>
<script src="https://maps.api.2gis.ru/2.0/loader.js"></script>
</head>
<body>
<div id="map" style="width: 100%; height: 400px;"></div>
<script>
DG.then(function() {
var map,
coord1 = 'MULTIPOLYGON(((82.91699 55.042136, 82.917522 55.040187, 82.918063 55.040235, 82.917540 55.042184,82.91699 55.042136)), ((82.91599 55.041136, 82.916522 55.039187, 82.917063 55.039235, 82.916540 55.041184,82.91599 55.041136)))',
coord2 = 'MULTILINESTRING((82.91799 55.043136, 82.918522 55.041187, 82.919063 55.041235), (82.91899 55.044136, 82.919522 55.042187, 82.920063 55.042235))',
coord3 = 'MULTIPOINT(82.914 55.042136, 82.915 55.043136, 82.915 55.042136, 82.914 55.043136)';
map = DG.map('map', {
center: [55.041836, 82.91699],
zoom: 16
});
DG.Wkt.geoJsonLayer(coord1).addTo(map);
DG.Wkt.geoJsonLayer(coord2).addTo(map);
DG.Wkt.geoJsonLayer(coord3).addTo(map);
});
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* Contributor(s): YetiForce.com
*************************************************************************************/
'use strict';
class CustomView {
constructor(url) {
let progressIndicatorElement = $.progressIndicator();
app.showModalWindow(null, url, () => {
this.contentsCotainer = $('.js-filter-modal__container');
this.advanceFilterInstance = new Vtiger_ConditionBuilder_Js(
this.contentsCotainer.find('.js-condition-builder'),
this.contentsCotainer.find('#sourceModule').val()
);
this.advanceFilterInstance.registerEvents();
//This will store the columns selection container
this.columnSelectElement = false;
this.registerEvents();
progressIndicatorElement.progressIndicator({ mode: 'hide' });
});
}
loadDateFilterValues() {
let selectedDateFilter = $('#standardDateFilter option:selected');
let currentDate = selectedDateFilter.data('currentdate');
let endDate = selectedDateFilter.data('enddate');
$('#standardFilterCurrentDate').val(currentDate);
$('#standardFilterEndDate').val(endDate);
}
/**
* Function to get the contents container
* @return : jQuery object of contents container
*/
getContentsContainer() {
if (this.contentsCotainer == false) {
this.contentsCotainer = $('.js-filter-modal__container');
}
return this.contentsCotainer;
}
/**
* Function to get the view columns selection element
* @return : jQuery object of view columns selection element
*/
getColumnSelectElement() {
if (this.columnSelectElement == false) {
this.columnSelectElement = $('#viewColumnsSelect');
}
return this.columnSelectElement;
}
/**
* Function which will get the selected columns
* @return : array of selected values
*/
getSelectedColumns() {
let columnListSelectElement = this.getColumnSelectElement();
return columnListSelectElement.val();
}
saveFilter() {
let aDeferred = $.Deferred();
let formData = $('#CustomView').serializeFormData();
AppConnector.request(formData, true)
.done(function (data) {
aDeferred.resolve(data);
})
.fail(function (error) {
aDeferred.reject(error);
});
return aDeferred.promise();
}
saveAndViewFilter() {
this.saveFilter().done(function (data) {
let response = data.result;
if (response && response.success) {
let url;
if (app.getParentModuleName() == 'Settings') {
url =
'index.php?module=CustomView&parent=Settings&view=Index&sourceModule=' +
$('#sourceModule').val();
} else {
url = response.listviewurl;
}
window.location.href = url;
} else {
$.unblockUI();
app.showNotify({
title: app.vtranslate('JS_DUPLICATE_RECORD'),
text: response.message,
type: 'error'
});
}
});
}
registerIconEvents() {
this.getContentsContainer()
.find('.js-filter-preferences')
.on('change', '.js-filter-preference', (e) => {
let currentTarget = $(e.currentTarget);
let iconElement = currentTarget.next();
if (currentTarget.prop('checked')) {
iconElement
.removeClass(iconElement.data('unchecked'))
.addClass(iconElement.data('check'));
} else {
iconElement
.removeClass(iconElement.data('check'))
.addClass(iconElement.data('unchecked'));
}
});
}
registerBlockToggleEvent() {
const container = this.getContentsContainer();
container.on('click', '.blockHeader', function (e) {
const target = $(e.target);
if (
target.is('input') ||
target.is('button') ||
target.parents().is('button') ||
target.hasClass('js-stop-propagation') ||
target.parents().hasClass('js-stop-propagation')
) {
return false;
}
const blockHeader = $(e.currentTarget);
const blockContents = blockHeader.next();
const iconToggle = blockHeader.find('.iconToggle');
if (blockContents.hasClass('d-none')) {
blockContents.removeClass('d-none');
iconToggle.removeClass(iconToggle.data('hide')).addClass(iconToggle.data('show'));
} else {
blockContents.addClass('d-none');
iconToggle.removeClass(iconToggle.data('show')).addClass(iconToggle.data('hide'));
}
});
}
registerColorEvent() {
const container = this.getContentsContainer();
let picker = container.find('.js-color-picker');
let pickerField = picker.find('.js-color-picker__field');
let showPicker = () => {
App.Fields.Colors.showPicker({
color: pickerField.val(),
bgToUpdate: picker.find('.js-color-picker__color'),
fieldToUpdate: pickerField
});
};
picker.on('click', showPicker);
}
/**
* Get list of fields to duplicates
* @returns {Array}
*/
getDuplicateFields() {
let fields = [];
const container = this.getContentsContainer();
container.find('.js-duplicates-container .js-duplicates-row').each(function () {
fields.push({
fieldid: $(this).find('.js-duplicates-field').val(),
ignore: $(this).find('.js-duplicates-ignore').is(':checked')
});
});
return fields;
}
/**
* Register events for block "Find duplicates"
*/
registerDuplicatesEvents() {
const container = this.getContentsContainer();
App.Fields.Picklist.showSelect2ElementView(
container.find('.js-duplicates-container .js-duplicates-field')
);
container.on('click', '.js-duplicates-remove', function (e) {
$(this).closest('.js-duplicates-row').remove();
});
container.find('.js-duplicate-add-field').on('click', function () {
let template = container.find('.js-duplicates-field-template').clone();
template.removeClass('d-none');
template.removeClass('js-duplicates-field-template');
App.Fields.Picklist.showSelect2ElementView(template.find('.js-duplicates-field'));
container.find('.js-duplicates-container').append(template);
});
}
registerSubmitEvent(select2Element) {
$('#CustomView').on('submit', (e) => {
let selectElement = this.getColumnSelectElement();
if ($('#viewname').val().length > 100) {
app.showNotify({
title: app.vtranslate('JS_MESSAGE'),
text: app.vtranslate('JS_VIEWNAME_ALERT'),
type: 'error'
});
e.preventDefault();
return;
}
//Mandatory Fields selection validation
//Any one Mandatory Field should select while creating custom view.
let mandatoryFieldsList = JSON.parse($('#mandatoryFieldsList').val());
let selectedOptions = selectElement.val();
let mandatoryFieldsMissing = true;
if (selectedOptions) {
for (let i = 0; i < selectedOptions.length; i++) {
if ($.inArray(selectedOptions[i], mandatoryFieldsList) >= 0) {
mandatoryFieldsMissing = false;
break;
}
}
}
if (mandatoryFieldsMissing) {
selectElement.validationEngine(
'showPrompt',
app.vtranslate('JS_PLEASE_SELECT_ATLEAST_ONE_MANDATORY_FIELD'),
'error',
'topLeft',
true
);
e.preventDefault();
return;
} else {
select2Element.validationEngine('hide');
}
//Mandatory Fields validation ends
let result = $(e.currentTarget).validationEngine('validate');
if (result == true) {
//handled standard filters saved values.
let stdfilterlist = {};
if (
$('#standardFilterCurrentDate').val() != '' &&
$('#standardFilterEndDate').val() != '' &&
$('select.standardFilterColumn option:selected').val() != 'none'
) {
stdfilterlist['columnname'] = $('select.standardFilterColumn option:selected').val();
stdfilterlist['stdfilter'] = $('select#standardDateFilter option:selected').val();
stdfilterlist['startdate'] = $('#standardFilterCurrentDate').val();
stdfilterlist['enddate'] = $('#standardFilterEndDate').val();
$('#stdfilterlist').val(JSON.stringify(stdfilterlist));
}
//handled advanced filters saved values.
let advfilterlist = this.advanceFilterInstance.getConditions();
$('#advfilterlist').val(JSON.stringify(advfilterlist));
$('[name="duplicatefields"]').val(JSON.stringify(this.getDuplicateFields()));
$('input[name="columnslist"]', this.getContentsContainer()).val(
JSON.stringify(this.getSelectedColumns())
);
this.saveAndViewFilter();
return false;
} else {
app.formAlignmentAfterValidation($(e.currentTarget));
}
});
}
/**
* Block submit on press enter key
*/
registerDisableSubmitOnEnter() {
this.getContentsContainer()
.find('#viewname, [name="color"]')
.keydown(function (e) {
if (e.keyCode === 13) {
e.preventDefault();
}
});
}
registerEvents() {
this.registerIconEvents();
App.Fields.Text.Editor.register(this.getContentsContainer().find('.js-editor'));
App.Fields.Tree.register(this.getContentsContainer());
this.registerBlockToggleEvent();
this.registerColorEvent();
this.registerDuplicatesEvents();
let select2Element = App.Fields.Picklist.showSelect2ElementView(this.getColumnSelectElement());
this.registerSubmitEvent(select2Element);
$('.stndrdFilterDateSelect').datepicker();
$('#standardDateFilter').on('change', () => {
this.loadDateFilterValues();
});
$('#CustomView').validationEngine(app.validationEngineOptions);
this.registerDisableSubmitOnEnter();
}
}
| {
"pile_set_name": "Github"
} |
/* $OpenBSD: sshlogin.h,v 1.8 2006/08/03 03:34:42 deraadt Exp $ */
/*
* Author: Tatu Ylonen <[email protected]>
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
* All rights reserved
*
* As far as I am concerned, the code I have written for this software
* can be used freely for any purpose. Any derived versions of this
* software must be clearly marked as such, and if the derived work is
* incompatible with the protocol description in the RFC file, it must be
* called by a name other than "ssh" or "Secure Shell".
*/
void record_login(pid_t, const char *, const char *, uid_t,
const char *, struct sockaddr *, socklen_t);
void record_logout(pid_t, const char *, const char *);
time_t get_last_login_time(uid_t, const char *, char *, size_t);
#ifdef LOGIN_NEEDS_UTMPX
void record_utmp_only(pid_t, const char *, const char *, const char *,
struct sockaddr *, socklen_t);
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package pkg;
public abstract class C4<E extends C4<E>> {
}
| {
"pile_set_name": "Github"
} |
package org.jzy3d.maths;
import java.util.ArrayList;
import java.util.Collection;
public class Polygon2d extends ArrayList<Coord2d>{
public Polygon2d() {
super();
}
public Polygon2d(Collection<? extends Coord2d> c) {
super(c);
}
public Polygon2d(int initialCapacity) {
super(initialCapacity);
}
private static final long serialVersionUID = 7096041682981860291L;
}
| {
"pile_set_name": "Github"
} |
tokenize \
'TokenNgram("report_source_location", true, \
"include_removed_source_location", false, \
"loose_symbol", true)' \
"090(1234)56−78" \
'NormalizerNFKC100("include_removed_source_location", false, \
"report_source_offset", true)'
| {
"pile_set_name": "Github"
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* Operator uses GetValue
*
* @path ch11/11.13/11.13.2/S11.13.2_A2.1_T3.5.js
* @description If GetBase(LeftHandSideExpression) is null, throw ReferenceError. Check operator is "x -= y"
*/
//CHECK#1
try {
var z = (x -= 1);
$ERROR('#1.1: x -= 1 throw ReferenceError. Actual: ' + (z));
}
catch (e) {
if ((e instanceof ReferenceError) !== true) {
$ERROR('#1.2: x -= 1 throw ReferenceError. Actual: ' + (e));
}
}
| {
"pile_set_name": "Github"
} |
/*
PatchTimers.c for Nintendont (Kernel)
Copyright (C) 2014 - 2019 FIX94
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 version 2.
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.
*/
#include "debug.h"
#include "common.h"
#include "string.h"
#include "PatchTimers.h"
extern u32 isKirby;
static bool write64A( u32 Offset, u64 Value, u64 CurrentValue )
{
if( read64(Offset) != CurrentValue )
return false;
write64( Offset, Value );
return true;
}
//arithmetic high for addi calls
static void W16AH(u32 Address, u32 Data)
{
//see if high bit of lower 16bits are set
bool needsAdd = !!(Data&(1<<15));
Data>>=16; //shift out lower 16bits
if(needsAdd) Data++; //add 1 if high bit was set
W16(Address, Data); //write parsed value
}
//logical high for ori calls
#define W16H(Address, Data) W16(Address, (Data)>>16)
//low for addi and ori calls
#define W16L(Address, Data) W16(Address, (Data)&0xFFFF)
static u32 CheckFor( u32 Buf, u32 Val )
{
u32 i = 4;
while(1)
{
u32 CurVal = read32(Buf+i);
if(CurVal == 0x4E800020)
break;
if((CurVal & 0xFC00FFFF) == Val)
return Buf+i;
i += 4;
//kirby has 1 far pattern
if(i > (isKirby ? 0x80 : 0x40))
break;
}
return 0;
}
//Bus speed
#define U32_TIMER_CLOCK_BUS_GC 0x09a7ec80
#define U32_TIMER_CLOCK_BUS_WII 0x0e7be2c0
#define FLT_TIMER_CLOCK_BUS_GC 0x4d1a7ec8
#define FLT_TIMER_CLOCK_BUS_WII 0x4d67be2c
//Processor speed
#define U32_TIMER_CLOCK_CPU_GC 0x1cf7c580
#define U32_TIMER_CLOCK_CPU_WII 0x2b73a840
//WiiU with 5x CPU Multi
#define U32_TIMER_CLOCK_CPU_FAST 0x486b6dc0
#define FLT_TIMER_CLOCK_CPU_GC 0x4de7be2c
#define FLT_TIMER_CLOCK_CPU_WII 0x4e2dcea1
//WiiU with 5x CPU Multi
#define FLT_TIMER_CLOCK_CPU_FAST 0x4e90d6dc
//Ticks per second
#define U32_TIMER_CLOCK_SECS_GC 0x0269fb20
#define U32_TIMER_CLOCK_SECS_WII 0x039ef8b0
#define FLT_TIMER_CLOCK_SECS_GC 0x4c1a7ec8
#define FLT_TIMER_CLOCK_SECS_WII 0x4c67be2c
//Ticks per second divided by 60
#define U32_TIMER_CLOCK_60HZ_GC 0x000a4cb8
#define U32_TIMER_CLOCK_60HZ_WII 0x000f7314
//1 divided by Ticks per second
#define FLT_ONE_DIV_CLOCK_SECS_GC 0x32d418df
#define FLT_ONE_DIV_CLOCK_SECS_WII 0x328d65ea
//Ticks per millisecond
#define U32_TIMER_CLOCK_MSECS_GC 0x00009e34
#define U32_TIMER_CLOCK_MSECS_WII 0x0000ed4e
#define FLT_TIMER_CLOCK_MSECS_GC 0x471e3400
#define FLT_TIMER_CLOCK_MSECS_WII 0x476d4e00
//1 divided by Ticks per millisecond
#define FLT_ONE_DIV_CLOCK_MSECS_GC 0x37cf204a
#define FLT_ONE_DIV_CLOCK_MSECS_WII 0x378a1586
//RADTimerRead, Multiplier so (GC / 1.5)
#define U32_TIMER_CLOCK_RAD_GC 0xcf2049a1
#define U32_TIMER_CLOCK_RAD_WII 0x8a15866c
//1 divided by one 1200th of a second
#define FLT_ONE_DIV_CLOCK_1200_GC 0x37f88d25
#define FLT_ONE_DIV_CLOCK_1200_WII 0x37a5b36e
//osGetCount, Multiplier so (GC / 1.5f)
#define DBL_1_1574 0x3ff284b5dcc63f14ull
#define DBL_0_7716 0x3fe8b0f27bb2fec5ull
bool PatchTimers(u32 FirstVal, u32 Buffer, bool checkFloats)
{
/* The floats in the data sections */
if(checkFloats)
{
if( FirstVal == FLT_TIMER_CLOCK_BUS_GC )
{
write32(Buffer, FLT_TIMER_CLOCK_BUS_WII);
dbgprintf("PatchTimers:[Timer Clock float Bus] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_TIMER_CLOCK_CPU_GC )
{
if(IsWiiUFastCPU())
write32(Buffer, FLT_TIMER_CLOCK_CPU_FAST);
else
write32(Buffer, FLT_TIMER_CLOCK_CPU_WII);
dbgprintf("PatchTimers:[Timer Clock float CPU] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_TIMER_CLOCK_SECS_GC )
{
write32(Buffer, FLT_TIMER_CLOCK_SECS_WII);
dbgprintf("PatchTimers:[Timer Clock float s] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_TIMER_CLOCK_MSECS_GC )
{
write32(Buffer, FLT_TIMER_CLOCK_MSECS_WII);
dbgprintf("PatchTimers:[Timer Clock float ms] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_ONE_DIV_CLOCK_SECS_GC )
{
write32(Buffer, FLT_ONE_DIV_CLOCK_SECS_WII);
dbgprintf("PatchTimers:[Timer Clock float 1/s] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_ONE_DIV_CLOCK_MSECS_GC )
{
write32(Buffer, FLT_ONE_DIV_CLOCK_MSECS_WII);
dbgprintf("PatchTimers:[Timer Clock float 1/ms] applied (0x%08X)\r\n", Buffer );
return true;
}
if( FirstVal == FLT_ONE_DIV_CLOCK_1200_GC )
{
write32(Buffer, FLT_ONE_DIV_CLOCK_1200_WII);
dbgprintf("PatchTimers:[Timer Clock float 1/1200] applied (0x%08X)\r\n", Buffer );
return true;
}
}
/* For Nintendo Puzzle Collection */
if( FirstVal == 0x38C00BB8 && (u32)Buffer == 0x770528 )
{ //it IS a smooth 1.5 BUT the game is actually not properly timed, good job devs
write32(Buffer, 0x38C01194);
dbgprintf("PatchTimers:[Timer Clock Panel de Pon] applied (0x%08X)\r\n", Buffer );
return true;
}
/* Coded in values */
FirstVal &= 0xFC00FFFF;
if( FirstVal == 0x3C0009A7 )
{
u32 NextP = CheckFor(Buffer, 0x6000EC80);
if(NextP > 0)
{
W16H(Buffer + 2, U32_TIMER_CLOCK_BUS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_BUS_WII);
dbgprintf("PatchTimers:[Timer Clock ori Bus] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C0009A8 )
{
u32 NextP = CheckFor(Buffer, 0x3800EC80);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_BUS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_BUS_WII);
dbgprintf("PatchTimers:[Timer Clock addi Bus] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C001CF7 )
{
u32 NextP = CheckFor(Buffer, 0x6000C580);
if(NextP > 0)
{
if(IsWiiUFastCPU())
{
W16H(Buffer + 2, U32_TIMER_CLOCK_CPU_FAST);
W16L(NextP + 2, U32_TIMER_CLOCK_CPU_FAST);
}
else
{
W16H(Buffer + 2, U32_TIMER_CLOCK_CPU_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_CPU_WII);
}
dbgprintf("PatchTimers:[Timer Clock ori CPU] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C001CF8 )
{
u32 NextP = CheckFor(Buffer, 0x3800C580);
if(NextP > 0)
{
if(IsWiiUFastCPU())
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_CPU_FAST);
W16L(NextP + 2, U32_TIMER_CLOCK_CPU_FAST);
}
else
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_CPU_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_CPU_WII);
}
dbgprintf("PatchTimers:[Timer Clock addi CPU] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C000269 )
{
u32 NextP = CheckFor(Buffer, 0x6000FB20);
if(NextP > 0)
{
W16H(Buffer + 2, U32_TIMER_CLOCK_SECS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII);
dbgprintf("PatchTimers:[Timer Clock ori s] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00026A )
{
u32 NextP = CheckFor(Buffer, 0x3800FB20);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_SECS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII);
dbgprintf("PatchTimers:[Timer Clock addi s] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00000A )
{
u32 NextP = CheckFor(Buffer, 0x60004CB8);
if(NextP > 0)
{
W16H(Buffer + 2, U32_TIMER_CLOCK_60HZ_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_60HZ_WII);
dbgprintf("PatchTimers:[Timer Clock ori 60Hz] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00000A )
{
u32 NextP = CheckFor(Buffer, 0x38004CB8);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_60HZ_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_60HZ_WII);
dbgprintf("PatchTimers:[Timer Clock addi 60Hz] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x38000000 )
{
u32 NextP = CheckFor(Buffer, 0x60009E34);
if(NextP > 0)
{
W16H(Buffer + 2, U32_TIMER_CLOCK_MSECS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_MSECS_WII);
dbgprintf("PatchTimers:[Timer Clock ori ms] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C000001 )
{
u32 NextP = CheckFor(Buffer, 0x38009E34);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_MSECS_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_MSECS_WII);
dbgprintf("PatchTimers:[Timer Clock addi ms] applied (0x%08X)\r\n", Buffer );
return true;
}
}
/* RADTimerRead split into subparts */
if( FirstVal == 0x3C000001 )
{
u32 NextP = CheckFor(Buffer, 0x60009E40);
if(NextP > 0)
{
u32 smallTimer = U32_TIMER_CLOCK_RAD_WII >> 15;
W16H(Buffer + 2, smallTimer);
W16L(NextP + 2, smallTimer);
dbgprintf("PatchTimers:[RADTimerRead ori shift] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00CF20 )
{
u32 NextP = CheckFor(Buffer, 0x600049A1);
if(NextP > 0)
{
W16H(Buffer + 2, U32_TIMER_CLOCK_RAD_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_RAD_WII);
dbgprintf("PatchTimers:[RADTimerRead ori full] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00CF20 )
{
u32 NextP = CheckFor(Buffer, 0x380049A1);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_RAD_WII);
W16L(NextP + 2, U32_TIMER_CLOCK_RAD_WII);
dbgprintf("PatchTimers:[RADTimerRead addi full] applied (0x%08X)\r\n", Buffer );
return true;
}
}
//kirby has many hardcoded timers, heres some dynamic ones,
//there is also an 80 second timeout I cant patch because its
//result is literally out of range for a 32bit integer
if(isKirby)
{
if( FirstVal == 0x3C00003E)
{
u32 NextP = CheckFor(Buffer, 0x3800CC50);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_SECS_WII/10);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII/10);
dbgprintf("PatchTimers:[Kirby addi 10Hz] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00001F)
{
u32 NextP = CheckFor(Buffer, 0x3800E628);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_SECS_WII/20);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII/20);
dbgprintf("PatchTimers:[Kirby addi 20Hz] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C00073E)
{
u32 NextP = CheckFor(Buffer, 0x3800F160);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_SECS_WII*3);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII*3);
dbgprintf("PatchTimers:[Kirby addi 3 secs] applied (0x%08X)\r\n", Buffer );
return true;
}
}
if( FirstVal == 0x3C000C12)
{
u32 NextP = CheckFor(Buffer, 0x3800E7A0);
if(NextP > 0)
{
W16AH(Buffer + 2, U32_TIMER_CLOCK_SECS_WII*5);
W16L(NextP + 2, U32_TIMER_CLOCK_SECS_WII*5);
dbgprintf("PatchTimers:[Kirby addi 5 secs] applied (0x%08X)\r\n", Buffer );
return true;
}
}
}
return false;
}
//Audio sample rate differs from GC to Wii, affects some emus
//Sonic Mega Collection
//GC Original, (44100(emu audio)/60(emu video)) / (32029(gc audio)/59.94(gc video)) = 1.3755
static u32 smc_arr_gc[11] =
{
0x3FB00B44, 0x3FB00C4A, 0x3FB00D50, 0x3FB00E56, 0x3FB00F5C,
0x3FB01062, //base value of 1.3755, rest goes up/down in 0.00003125 steps
0x3FB01168, 0x3FB0126F, 0x3FB01375, 0x3FB0147B, 0x3FB01581,
};
//Wii Modified, (44100(emu audio)/60(emu video)) / (32000(wii audio)/59.94(wii video)) = 1.3767469
static u32 smc_arr_wii[11] =
{
0x3FB0341F, 0x3FB03525, 0x3FB0362C, 0x3FB03732, 0x3FB03838,
0x3FB0393E, //base value of 1.3767469, rest goes up/down in 0.00003125 steps
0x3FB03A44, 0x3FB03B4A, 0x3FB03C50, 0x3FB03D57, 0x3FB03E5D,
};
//Wii Modified PAL50, (44100(emu audio)/50(emu video)) / (32000(wii audio)/50(wii video)) = 1.378125
static u32 smc_pal50_arr_wii[11] =
{
0x3FB05C29, 0x3FB05E35, 0x3FB06042, 0x3FB0624E, 0x3FB0645A,
0x3FB06666, //base value of 1.378125, rest goes up/down in 0.0000625 steps
0x3FB06873, 0x3FB06A7F, 0x3FB06C8B, 0x3FB06E98, 0x3FB070A4,
};
void PatchStaticTimers()
{
sync_before_read((void*)0xE0, 0x20);
write32(0xF8, U32_TIMER_CLOCK_BUS_WII);
if(IsWiiUFastCPU())
write32(0xFC, U32_TIMER_CLOCK_CPU_FAST);
else
write32(0xFC, U32_TIMER_CLOCK_CPU_WII);
sync_after_write((void*)0xE0, 0x20);
if(write64A(0x001463E0, DBL_0_7716, DBL_1_1574))
{
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Majoras Mask NTSC-J] applied\r\n");
#endif
}
else if(write64A(0x00141C00, DBL_0_7716, DBL_1_1574))
{
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Majoras Mask NTSC-U] applied\r\n");
#endif
}
else if(write64A(0x00130860, DBL_0_7716, DBL_1_1574))
{
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Majoras Mask PAL] applied\r\n");
#endif
}
else if(read32(0x55A0) == 0x3C60000A && read32(0x55A4) == 0x38036000
&& read32(0x55B0) == 0x380000FF)
{ /* The game uses 2 different timers */
write32(0x55A0, 0x3C60000F); //lis r3, 0xF
write32(0x55A4, 0x60609060); //ori r0, r3, 0x9060
write32(0x55B0, 0x38000180); //li r0, 0x180
/* Values get set twice */
write32(0x5ECC, 0x3C60000F); //lis r3, 0xF
write32(0x5ED4, 0x60609060); //ori r0, r3, 0x9060
write32(0x5ED8, 0x38600180); //li r3, 0x180
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[GT Cube NTSC-J] applied\r\n");
#endif
}
else if(memcmp((void*)0x263130, smc_arr_gc, sizeof(smc_arr_gc)) == 0)
{
memcpy((void*)0x263130, smc_arr_wii, sizeof(smc_arr_wii));
write32(0x3FF368, 0x3FB0393E); //base value of 1.3767469 again
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Sonic Mega Collection NTSC-U] applied\r\n");
#endif
}
else if(memcmp((void*)0x264B08, smc_arr_gc, sizeof(smc_arr_gc)) == 0)
{
memcpy((void*)0x264B08, smc_arr_wii, sizeof(smc_arr_wii));
write32(0x401388, 0x3FB0393E); //base value of 1.3767469 again
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Sonic Mega Collection NTSC-J] applied\r\n");
#endif
}
else if(memcmp((void*)0x281508, smc_arr_gc, sizeof(smc_arr_gc)) == 0)
{
memcpy((void*)0x281508, smc_arr_wii, sizeof(smc_arr_wii));
memcpy((void*)0x281534, smc_pal50_arr_wii, sizeof(smc_pal50_arr_wii));
write32(0x41FCE0, 0x3FB0393E); //base value of 1.3767469 again
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Sonic Mega Collection PAL] applied\r\n");
#endif
}
else if(read32(0x3F2DE0) == 0x3FB0147B)
{
//proto didnt have dynamic resample yet
write32(0x3F2DE0, 0x3FB0393E); //base value of 1.3767469
#ifdef DEBUG_PATCH
dbgprintf("PatchTimers:[Sonic Mega Collection Proto NTSC-U] applied\r\n");
#endif
}
}
| {
"pile_set_name": "Github"
} |
package com.fsck.k9.activity.setup;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.TextKeyListener;
import android.text.method.TextKeyListener.Capitalize;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import com.fsck.k9.Account;
import com.fsck.k9.Preferences;
import com.fsck.k9.ui.base.K9Activity;
import com.fsck.k9.activity.MessageList;
import com.fsck.k9.ui.R;
import com.fsck.k9.helper.Utility;
public class AccountSetupNames extends K9Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private EditText mDescription;
private EditText mName;
private Account mAccount;
private Button mDoneButton;
public static void actionSetNames(Context context, Account account) {
Intent i = new Intent(context, AccountSetupNames.class);
i.putExtra(EXTRA_ACCOUNT, account.getUuid());
context.startActivity(i);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLayout(R.layout.account_setup_names);
mDescription = findViewById(R.id.account_description);
mName = findViewById(R.id.account_name);
mDoneButton = findViewById(R.id.done);
mDoneButton.setOnClickListener(this);
TextWatcher validationTextWatcher = new TextWatcher() {
public void afterTextChanged(Editable s) {
validateFields();
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
};
mName.addTextChangedListener(validationTextWatcher);
mName.setKeyListener(TextKeyListener.getInstance(false, Capitalize.WORDS));
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
/*
* Since this field is considered optional, we don't set this here. If
* the user fills in a value we'll reset the current value, otherwise we
* just leave the saved value alone.
*/
// mDescription.setText(mAccount.getDescription());
if (mAccount.getName() != null) {
mName.setText(mAccount.getName());
}
if (!Utility.requiredFieldValid(mName)) {
mDoneButton.setEnabled(false);
}
}
private void validateFields() {
mDoneButton.setEnabled(Utility.requiredFieldValid(mName));
Utility.setCompoundDrawablesAlpha(mDoneButton, mDoneButton.isEnabled() ? 255 : 128);
}
protected void onNext() {
if (Utility.requiredFieldValid(mDescription)) {
mAccount.setDescription(mDescription.getText().toString());
}
mAccount.setName(mName.getText().toString());
Preferences.getPreferences(getApplicationContext()).saveAccount(mAccount);
MessageList.launch(this, mAccount);
finish();
}
public void onClick(View v) {
if (v.getId() == R.id.done) {
onNext();
}
}
}
| {
"pile_set_name": "Github"
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_ncpy_01.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.string.label.xml
Template File: sources-sink-01.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sink: ncpy
* BadSink : Copy string to data using strncpy
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_ncpy_01_bad()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FLAW: Set a pointer to a "small" buffer. This buffer will be used in the sinks as a destination
* buffer in various memory copying functions using a "large" source buffer. */
data = dataBadBuffer;
data[0] = '\0'; /* null terminate */
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
strncpy(data, source, 100-1);
data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
char * data;
char dataBadBuffer[50];
char dataGoodBuffer[100];
/* FIX: Set a pointer to a "large" buffer, thus avoiding buffer overflows in the sinks. */
data = dataGoodBuffer;
data[0] = '\0'; /* null terminate */
{
char source[100];
memset(source, 'C', 100-1); /* fill with 'C's */
source[100-1] = '\0'; /* null terminate */
/* POTENTIAL FLAW: Possible buffer overflow if the size of data is less than the length of source */
strncpy(data, source, 100-1);
data[100-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
}
}
void CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_ncpy_01_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_ncpy_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_declare_ncpy_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"pile_set_name": "Github"
} |
confighelper
============
Configuration Helper + HTML5 placeholder for CKEditor.
See docs/install.html for full details and install instructions
| {
"pile_set_name": "Github"
} |
tests:
-
description: "Default"
valid: true
readConcern: {}
readConcernDocument: {}
isServerDefault: true
-
description: "Majority"
valid: true
readConcern: { level: "majority" }
readConcernDocument: { level: "majority" }
isServerDefault: false
-
description: "Local"
valid: true
readConcern: { level: "local" }
readConcernDocument: { level: "local" }
isServerDefault: false
-
description: "Linearizable"
valid: true
readConcern: { level: "linearizable" }
readConcernDocument: { level: "linearizable" }
isServerDefault: false
-
description: "Snapshot"
valid: true
readConcern: { level: "snapshot" }
readConcernDocument: {level: "snapshot" }
isServerDefault: false
-
description: "Available"
valid: true
readConcern: { level: "available" }
readConcernDocument: { level: "available" }
isServerDefault: false
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 21e41d478ab977b40b3bf8b95b0cdf6d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
// This is a generated file. Not intended for manual editing.
package com.haskforce.psi.impl;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import static com.haskforce.psi.HaskellTypes.*;
import com.haskforce.psi.*;
public class HaskellFunorpatdeclImpl extends HaskellCompositeElementImpl implements HaskellFunorpatdecl {
public HaskellFunorpatdeclImpl(ASTNode node) {
super(node);
}
public void accept(@NotNull HaskellVisitor visitor) {
visitor.visitFunorpatdecl(this);
}
public void accept(@NotNull PsiElementVisitor visitor) {
if (visitor instanceof HaskellVisitor) accept((HaskellVisitor)visitor);
else super.accept(visitor);
}
@Override
@NotNull
public List<HaskellExp> getExpList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellExp.class);
}
@Override
@NotNull
public List<HaskellPat> getPatList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellPat.class);
}
@Override
@NotNull
public List<HaskellPstringtoken> getPstringtokenList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellPstringtoken.class);
}
@Override
@NotNull
public List<HaskellQcon> getQconList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQcon.class);
}
@Override
@NotNull
public List<HaskellQvar> getQvarList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellQvar.class);
}
@Override
@NotNull
public HaskellRhs getRhs() {
return notNullChild(PsiTreeUtil.getChildOfType(this, HaskellRhs.class));
}
@Override
@NotNull
public List<HaskellVarid> getVaridList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellVarid.class);
}
@Override
@Nullable
public HaskellVarop getVarop() {
return PsiTreeUtil.getChildOfType(this, HaskellVarop.class);
}
@Override
@NotNull
public List<HaskellVarsym> getVarsymList() {
return PsiTreeUtil.getChildrenOfTypeAsList(this, HaskellVarsym.class);
}
}
| {
"pile_set_name": "Github"
} |
#ifndef HACTOOL_PFS0_H
#define HACTOOL_PFS0_H
#include "types.h"
#include "utils.h"
#include "npdm.h"
#define MAGIC_PFS0 0x30534650
typedef struct {
uint32_t magic;
uint32_t num_files;
uint32_t string_table_size;
uint32_t reserved;
} pfs0_header_t;
typedef struct {
uint64_t offset;
uint64_t size;
uint32_t string_table_offset;
uint32_t reserved;
} pfs0_file_entry_t;
typedef struct {
uint8_t master_hash[0x20]; /* SHA-256 hash of the hash table. */
uint32_t block_size; /* In bytes. */
uint32_t always_2;
uint64_t hash_table_offset; /* Normally zero. */
uint64_t hash_table_size;
uint64_t pfs0_offset;
uint64_t pfs0_size;
uint8_t _0x48[0xF0];
} pfs0_superblock_t;
typedef struct {
pfs0_superblock_t *superblock;
FILE *file;
hactool_ctx_t *tool_ctx;
validity_t superblock_hash_validity;
validity_t hash_table_validity;
int is_exefs;
npdm_t *npdm;
pfs0_header_t *header;
} pfs0_ctx_t;
static inline pfs0_file_entry_t *pfs0_get_file_entry(pfs0_header_t *hdr, uint32_t i) {
if (i >= hdr->num_files) return NULL;
return (pfs0_file_entry_t *)((char *)(hdr) + sizeof(*hdr) + i * sizeof(pfs0_file_entry_t));
}
static inline char *pfs0_get_string_table(pfs0_header_t *hdr) {
return (char *)(hdr) + sizeof(*hdr) + hdr->num_files * sizeof(pfs0_file_entry_t);
}
static inline uint64_t pfs0_get_header_size(pfs0_header_t *hdr) {
return sizeof(*hdr) + hdr->num_files * sizeof(pfs0_file_entry_t) + hdr->string_table_size;
}
static inline char *pfs0_get_file_name(pfs0_header_t *hdr, uint32_t i) {
return pfs0_get_string_table(hdr) + pfs0_get_file_entry(hdr, i)->string_table_offset;
}
void pfs0_process(pfs0_ctx_t *ctx);
void pfs0_save(pfs0_ctx_t *ctx);
void pfs0_print(pfs0_ctx_t *ctx);
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2004-2016 Apple 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 _OSATOMICQUEUE_H_
#define _OSATOMICQUEUE_H_
#include <stddef.h>
#include <sys/cdefs.h>
#include <stdint.h>
#include <stdbool.h>
#include <Availability.h>
/*! @header Lockless atomic enqueue and dequeue
* These routines manipulate singly-linked LIFO lists.
*/
__BEGIN_DECLS
/*! @abstract The data structure for a queue head.
@discussion
You should always initialize a queue head structure with the
initialization vector {@link OS_ATOMIC_QUEUE_INIT} before use.
*/
#if defined(__x86_64__)
typedef volatile struct {
void *opaque1;
long opaque2;
} __attribute__ ((aligned (16))) OSQueueHead;
#else
typedef volatile struct {
void *opaque1;
long opaque2;
} OSQueueHead;
#endif
/*! @abstract The initialization vector for a queue head. */
#define OS_ATOMIC_QUEUE_INIT { NULL, 0 }
/*! @abstract Enqueue an element onto a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list on which you want to enqueue the element.
@param __new
The element to add.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being queued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
void OSAtomicEnqueue( OSQueueHead *__list, void *__new, size_t __offset);
/*! @abstract Dequeue an element from a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list from which you want to dequeue an element.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being dequeued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
IMPORTANT: the memory backing the link field of a queue element must not be
unmapped after OSAtomicDequeue() returns until all concurrent calls to
OSAtomicDequeue() for the same list on other threads have also returned,
as they may still be accessing that memory location.
@result
Returns the most recently enqueued element, or <code>NULL</code> if the
list is empty.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_4_0)
void* OSAtomicDequeue( OSQueueHead *__list, size_t __offset);
#if defined(__x86_64__) || defined(__i386__)
/*! @group Lockless atomic fifo enqueue and dequeue
* These routines manipulate singly-linked FIFO lists.
*/
/*! @abstract The data structure for a fifo queue head.
@discussion
You should always initialize a fifo queue head structure with the
initialization vector {@link OS_ATOMIC_FIFO_QUEUE_INIT} before use.
*/
#if defined(__x86_64__)
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} __attribute__ ((aligned (16))) OSFifoQueueHead;
#else
typedef volatile struct {
void *opaque1;
void *opaque2;
int opaque3;
} OSFifoQueueHead;
#endif
/*! @abstract The initialization vector for a fifo queue head. */
#define OS_ATOMIC_FIFO_QUEUE_INIT { NULL, NULL, 0 }
/*! @abstract Enqueue an element onto a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list on which you want to enqueue the element.
@param __new
The element to add.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being queued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA)
void OSAtomicFifoEnqueue( OSFifoQueueHead *__list, void *__new, size_t __offset);
/*! @abstract Dequeue an element from a list.
@discussion
Memory barriers are incorporated as needed to permit thread-safe access
to the queue element.
@param __list
The list from which you want to dequeue an element.
@param __offset
The "offset" parameter is the offset (in bytes) of the link field
from the beginning of the data structure being dequeued (<code>__new</code>).
The link field should be a pointer type.
The <code>__offset</code> value needs to be same for all enqueuing and
dequeuing operations on the same list, even if different structure types
are enqueued on that list. The use of <code>offsetset()</code>, defined in
<code>stddef.h</code> is the common way to specify the <code>__offset</code>
value.
@result
Returns the oldest enqueued element, or <code>NULL</code> if the
list is empty.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA)
void* OSAtomicFifoDequeue( OSFifoQueueHead *__list, size_t __offset);
#endif /* __i386__ || __x86_64__ */
__END_DECLS
#endif /* _OSATOMICQUEUE_H_ */
| {
"pile_set_name": "Github"
} |
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/hasegawa/Applications/android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
| {
"pile_set_name": "Github"
} |
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2020, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library 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 Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.]
*
* ----------------------------
* BoxAndWhiskerCalculator.java
* ----------------------------
* (C) Copyright 2003-2020, by Object Refinery Limited and Contributors.
*
* Original Author: David Gilbert (for Object Refinery Limited);
* Contributor(s): -;
*
*/
package org.jfree.data.statistics;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jfree.chart.util.Args;
/**
* A utility class that calculates the mean, median, quartiles Q1 and Q3, plus
* a list of outlier values...all from an arbitrary list of
* {@code Number} objects.
*/
public abstract class BoxAndWhiskerCalculator {
/**
* Calculates the statistics required for a {@link BoxAndWhiskerItem}
* from a list of {@code Number} objects. Any items in the list
* that are {@code null}, not an instance of {@code Number}, or
* equivalent to {@code Double.NaN}, will be ignored.
*
* @param values a list of numbers (a {@code null} list is not
* permitted).
*
* @return A box-and-whisker item.
*/
public static BoxAndWhiskerItem calculateBoxAndWhiskerStatistics(
List<? extends Number> values) {
return calculateBoxAndWhiskerStatistics(values, true);
}
/**
* Calculates the statistics required for a {@link BoxAndWhiskerItem}
* from a list of {@code Number} objects. Any items in the list
* that are {@code null}, not an instance of {@code Number}, or
* equivalent to {@code Double.NaN}, will be ignored.
*
* @param values a list of numbers (a {@code null} list is not
* permitted).
* @param stripNullAndNaNItems a flag that controls the handling of null
* and NaN items.
*
* @return A box-and-whisker item.
*
* @since 1.0.3
*/
public static BoxAndWhiskerItem calculateBoxAndWhiskerStatistics(
List<? extends Number> values, boolean stripNullAndNaNItems) {
Args.nullNotPermitted(values, "values");
List vlist;
if (stripNullAndNaNItems) {
vlist = new ArrayList(values.size());
Iterator iterator = values.listIterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof Number) {
Number n = (Number) obj;
double v = n.doubleValue();
if (!Double.isNaN(v)) {
vlist.add(n);
}
}
}
}
else {
vlist = values;
}
Collections.sort(vlist);
double mean = Statistics.calculateMean(vlist, false);
double median = Statistics.calculateMedian(vlist, false);
double q1 = calculateQ1(vlist);
double q3 = calculateQ3(vlist);
double interQuartileRange = q3 - q1;
double upperOutlierThreshold = q3 + (interQuartileRange * 1.5);
double lowerOutlierThreshold = q1 - (interQuartileRange * 1.5);
double upperFaroutThreshold = q3 + (interQuartileRange * 2.0);
double lowerFaroutThreshold = q1 - (interQuartileRange * 2.0);
double minRegularValue = Double.POSITIVE_INFINITY;
double maxRegularValue = Double.NEGATIVE_INFINITY;
double minOutlier = Double.POSITIVE_INFINITY;
double maxOutlier = Double.NEGATIVE_INFINITY;
List<Number> outliers = new ArrayList<>();
Iterator iterator = vlist.iterator();
while (iterator.hasNext()) {
Number number = (Number) iterator.next();
double value = number.doubleValue();
if (value > upperOutlierThreshold) {
outliers.add(number);
if (value > maxOutlier && value <= upperFaroutThreshold) {
maxOutlier = value;
}
}
else if (value < lowerOutlierThreshold) {
outliers.add(number);
if (value < minOutlier && value >= lowerFaroutThreshold) {
minOutlier = value;
}
}
else {
minRegularValue = Math.min(minRegularValue, value);
maxRegularValue = Math.max(maxRegularValue, value);
}
minOutlier = Math.min(minOutlier, minRegularValue);
maxOutlier = Math.max(maxOutlier, maxRegularValue);
}
return new BoxAndWhiskerItem(mean, median, q1, q3, minRegularValue,
maxRegularValue, minOutlier, maxOutlier, outliers);
}
/**
* Calculates the first quartile for a list of numbers in ascending order.
* If the items in the list are not in ascending order, the result is
* unspecified. If the list contains items that are {@code null}, not
* an instance of {@code Number}, or equivalent to
* {@code Double.NaN}, the result is unspecified.
*
* @param values the numbers in ascending order ({@code null} not
* permitted).
*
* @return The first quartile.
*/
public static double calculateQ1(List values) {
Args.nullNotPermitted(values, "values");
double result = Double.NaN;
int count = values.size();
if (count > 0) {
if (count % 2 == 1) {
if (count > 1) {
result = Statistics.calculateMedian(values, 0, count / 2);
}
else {
result = Statistics.calculateMedian(values, 0, 0);
}
}
else {
result = Statistics.calculateMedian(values, 0, count / 2 - 1);
}
}
return result;
}
/**
* Calculates the third quartile for a list of numbers in ascending order.
* If the items in the list are not in ascending order, the result is
* unspecified. If the list contains items that are {@code null}, not
* an instance of {@code Number}, or equivalent to
* {@code Double.NaN}, the result is unspecified.
*
* @param values the list of values ({@code null} not permitted).
*
* @return The third quartile.
*/
public static double calculateQ3(List values) {
Args.nullNotPermitted(values, "values");
double result = Double.NaN;
int count = values.size();
if (count > 0) {
if (count % 2 == 1) {
if (count > 1) {
result = Statistics.calculateMedian(values, count / 2,
count - 1);
}
else {
result = Statistics.calculateMedian(values, 0, 0);
}
}
else {
result = Statistics.calculateMedian(values, count / 2,
count - 1);
}
}
return result;
}
}
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
//
// soc-io.c -- ASoC register I/O helpers
//
// Copyright 2009-2011 Wolfson Microelectronics PLC.
//
// Author: Mark Brown <[email protected]>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>
#include <linux/export.h>
#include <sound/soc.h>
/**
* snd_soc_component_read() - Read register value
* @component: Component to read from
* @reg: Register to read
* @val: Pointer to where the read value is stored
*
* Return: 0 on success, a negative error code otherwise.
*/
int snd_soc_component_read(struct snd_soc_component *component,
unsigned int reg, unsigned int *val)
{
int ret;
if (component->regmap)
ret = regmap_read(component->regmap, reg, val);
else if (component->driver->read) {
*val = component->driver->read(component, reg);
ret = 0;
}
else
ret = -EIO;
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_component_read);
unsigned int snd_soc_component_read32(struct snd_soc_component *component,
unsigned int reg)
{
unsigned int val;
int ret;
ret = snd_soc_component_read(component, reg, &val);
if (ret < 0)
return -1;
return val;
}
EXPORT_SYMBOL_GPL(snd_soc_component_read32);
/**
* snd_soc_component_write() - Write register value
* @component: Component to write to
* @reg: Register to write
* @val: Value to write to the register
*
* Return: 0 on success, a negative error code otherwise.
*/
int snd_soc_component_write(struct snd_soc_component *component,
unsigned int reg, unsigned int val)
{
if (component->regmap)
return regmap_write(component->regmap, reg, val);
else if (component->driver->write)
return component->driver->write(component, reg, val);
else
return -EIO;
}
EXPORT_SYMBOL_GPL(snd_soc_component_write);
static int snd_soc_component_update_bits_legacy(
struct snd_soc_component *component, unsigned int reg,
unsigned int mask, unsigned int val, bool *change)
{
unsigned int old, new;
int ret;
mutex_lock(&component->io_mutex);
ret = snd_soc_component_read(component, reg, &old);
if (ret < 0)
goto out_unlock;
new = (old & ~mask) | (val & mask);
*change = old != new;
if (*change)
ret = snd_soc_component_write(component, reg, new);
out_unlock:
mutex_unlock(&component->io_mutex);
return ret;
}
/**
* snd_soc_component_update_bits() - Perform read/modify/write cycle
* @component: Component to update
* @reg: Register to update
* @mask: Mask that specifies which bits to update
* @val: New value for the bits specified by mask
*
* Return: 1 if the operation was successful and the value of the register
* changed, 0 if the operation was successful, but the value did not change.
* Returns a negative error code otherwise.
*/
int snd_soc_component_update_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int val)
{
bool change;
int ret;
if (component->regmap)
ret = regmap_update_bits_check(component->regmap, reg, mask,
val, &change);
else
ret = snd_soc_component_update_bits_legacy(component, reg,
mask, val, &change);
if (ret < 0)
return ret;
return change;
}
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits);
/**
* snd_soc_component_update_bits_async() - Perform asynchronous
* read/modify/write cycle
* @component: Component to update
* @reg: Register to update
* @mask: Mask that specifies which bits to update
* @val: New value for the bits specified by mask
*
* This function is similar to snd_soc_component_update_bits(), but the update
* operation is scheduled asynchronously. This means it may not be completed
* when the function returns. To make sure that all scheduled updates have been
* completed snd_soc_component_async_complete() must be called.
*
* Return: 1 if the operation was successful and the value of the register
* changed, 0 if the operation was successful, but the value did not change.
* Returns a negative error code otherwise.
*/
int snd_soc_component_update_bits_async(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int val)
{
bool change;
int ret;
if (component->regmap)
ret = regmap_update_bits_check_async(component->regmap, reg,
mask, val, &change);
else
ret = snd_soc_component_update_bits_legacy(component, reg,
mask, val, &change);
if (ret < 0)
return ret;
return change;
}
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits_async);
/**
* snd_soc_component_async_complete() - Ensure asynchronous I/O has completed
* @component: Component for which to wait
*
* This function blocks until all asynchronous I/O which has previously been
* scheduled using snd_soc_component_update_bits_async() has completed.
*/
void snd_soc_component_async_complete(struct snd_soc_component *component)
{
if (component->regmap)
regmap_async_complete(component->regmap);
}
EXPORT_SYMBOL_GPL(snd_soc_component_async_complete);
/**
* snd_soc_component_test_bits - Test register for change
* @component: component
* @reg: Register to test
* @mask: Mask that specifies which bits to test
* @value: Value to test against
*
* Tests a register with a new value and checks if the new value is
* different from the old value.
*
* Return: 1 for change, otherwise 0.
*/
int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask, unsigned int value)
{
unsigned int old, new;
int ret;
ret = snd_soc_component_read(component, reg, &old);
if (ret < 0)
return ret;
new = (old & ~mask) | value;
return old != new;
}
EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
| {
"pile_set_name": "Github"
} |
/*
* #%L
* %%
* Copyright (C) 2011 - 2017 BMW Car IT GmbH
* %%
* 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.
* #L%
*/
package system
typeCollection RoutingTypes {
<** @description: Generic Address **>
struct Address polymorphic {}
<** @description: Channel Address **>
struct ChannelAddress extends Address {
<** @description: Url of HTTP-based message receiver **>
String messagingEndpointUrl
<** @description: Channel identification **>
String channelId
}
<** @description: Mqtt Address **>
struct MqttAddress extends Address {
<** @description: Mqtt broker uri **>
String brokerUri
<** @description: MQTT topic identification **>
String topic
}
<** @description: Browser address **>
struct BrowserAddress extends Address {
<** @description: the ID of the browser window **>
String windowId
}
<** @description: Websocket protocol type **>
enumeration WebSocketProtocol {
<** @description: Websocket (non-secure) **>
WS
<** @description: Websocket (secure) **>
WSS
}
<** @description: Websocket address **>
struct WebSocketAddress extends Address {
<** @description: Websocket protocol type **>
WebSocketProtocol protocol
<** @description: Websocket host **>
String host
<** @description: Websocket port **>
Int32 port
<** @description: Websocket path **>
String path
}
<** @description: Unix domain socket server address **>
struct UdsAddress extends Address {
<** @description: Unix domain socket server path **>
String path
}
<** @description: MQTT protocol type **>
enumeration MqttProtocol {
<** @description: TCP (non-secure) **>
TCP
<** @description: MQTT (non-secure) **>
MQTT
<** @description: MQTT (secure) **>
MQTTS
}
<** @description: Unix domain socket client address **>
struct UdsClientAddress extends Address {
<** @description: Unix domain socket client ID **>
String id
}
<** @description: Websocket client address **>
struct WebSocketClientAddress extends Address {
<** @description: Websocket client ID **>
String id
}
<** @description: BinderAddress client address **>
struct BinderAddress extends Address {
<** @description: BinderAddress package name **>
String packageName
<** @description: BinderAddress process user ID **>
Int32 userId
}
}
<**
@description: The <code>Routing</code> interface is a joynr internal
interface. joynr uses a hierarchy of <code>MessageRouter</code>s to
route messages from source to destination. The <code>Routing</code>
interface is used to update routing information between parent and
child <code>MessageRouter</code>s.
#noVersionGeneration
**>
interface Routing {
version {major 0 minor 1}
<**
@description: global address of cluster-controller
used for provider registration. Messages from global
to these providers have to be sent to this address.
**>
attribute String globalAddress readonly // NOTIFYREADONLY
<**
@description: global address of cluster-controller
used as replyTo address for outgoing requests.
Replies from other cluster controllers have to be sent
to this address.
**>
attribute String replyToAddress readonly // NOTIFYREADONLY
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.ChannelAddress channelAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.MqttAddress mqttAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.BrowserAddress browserAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.WebSocketAddress webSocketAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging unix domain socket server address of the next hop
towards the corresponding participant ID
**>
RoutingTypes.UdsAddress udsAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.BinderAddress binderAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.WebSocketClientAddress webSocketClientAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<**
@description: Adds a hop to the parent routing table.
<br/>
The overloaded methods (one for each concrete Address type) is
needed since polymorphism is currently not supported by joynr.
**>
method addNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
<**
@description: the messaging unix domain client address of the next hop towards
the corresponding participant ID
**>
RoutingTypes.UdsClientAddress udsClientAddress
<** @description: true, participant is globally visible
false, otherwise
**>
Boolean isGloballyVisible
}
}
<** @description: Removes a hop from the parent routing table. **>
method removeNextHop {
in {
<** @description: the ID of the target participant **>
String participantId
}
}
<**
@description: Asks the parent routing table whether it is able to
resolve the destination participant ID.
**>
method resolveNextHop {
in {
<** @description: the ID of the target participant to resolve **>
String participantId
}
out {
<** @description: true, if the participant ID could be resolved **>
Boolean resolved
}
}
<**
@description: Adds a new receiver via their participant ID to for the
identified multicasts.
**>
method addMulticastReceiver {
in {
<** @description: the multicast ID the receiver is interested in. **>
String multicastId
<** @description: the participant ID of the receiver. **>
String subscriberParticipantId
<** @description: the participant ID of the provider. **>
String providerParticipantId
}
}
<**
@description: Removes a new receiver via their participant ID to for the
identified multicasts which was previously added via addMulticastReceiver.
**>
method removeMulticastReceiver {
in {
<** @description: the multicast ID the receiver registered for. **>
String multicastId
<** @description: the participant ID of the receiver. **>
String subscriberParticipantId
<** @description: the participant ID of the provider. **>
String providerParticipantId
}
}
}
| {
"pile_set_name": "Github"
} |
from django.conf.urls import patterns, url
from symposion.social_auth.views import SocialAuths
urlpatterns = patterns("",
url(r"^$", SocialAuths.as_view(), name="social_auth_associations"),
)
| {
"pile_set_name": "Github"
} |
package mount
import (
"os"
)
// Type represents the type of a mount.
type Type string
// Type constants
const (
// TypeBind is the type for mounting host dir
TypeBind Type = "bind"
// TypeVolume is the type for remote storage volumes
TypeVolume Type = "volume"
// TypeTmpfs is the type for mounting tmpfs
TypeTmpfs Type = "tmpfs"
)
// Mount represents a mount (volume).
type Mount struct {
Type Type `json:",omitempty"`
// Source specifies the name of the mount. Depending on mount type, this
// may be a volume name or a host path, or even ignored.
// Source is not supported for tmpfs (must be an empty value)
Source string `json:",omitempty"`
Target string `json:",omitempty"`
ReadOnly bool `json:",omitempty"`
BindOptions *BindOptions `json:",omitempty"`
VolumeOptions *VolumeOptions `json:",omitempty"`
TmpfsOptions *TmpfsOptions `json:",omitempty"`
}
// Propagation represents the propagation of a mount.
type Propagation string
const (
// PropagationRPrivate RPRIVATE
PropagationRPrivate Propagation = "rprivate"
// PropagationPrivate PRIVATE
PropagationPrivate Propagation = "private"
// PropagationRShared RSHARED
PropagationRShared Propagation = "rshared"
// PropagationShared SHARED
PropagationShared Propagation = "shared"
// PropagationRSlave RSLAVE
PropagationRSlave Propagation = "rslave"
// PropagationSlave SLAVE
PropagationSlave Propagation = "slave"
)
// Propagations is the list of all valid mount propagations
var Propagations = []Propagation{
PropagationRPrivate,
PropagationPrivate,
PropagationRShared,
PropagationShared,
PropagationRSlave,
PropagationSlave,
}
// BindOptions defines options specific to mounts of type "bind".
type BindOptions struct {
Propagation Propagation `json:",omitempty"`
}
// VolumeOptions represents the options for a mount of type volume.
type VolumeOptions struct {
NoCopy bool `json:",omitempty"`
Labels map[string]string `json:",omitempty"`
DriverConfig *Driver `json:",omitempty"`
}
// Driver represents a volume driver.
type Driver struct {
Name string `json:",omitempty"`
Options map[string]string `json:",omitempty"`
}
// TmpfsOptions defines options specific to mounts of type "tmpfs".
type TmpfsOptions struct {
// Size sets the size of the tmpfs, in bytes.
//
// This will be converted to an operating system specific value
// depending on the host. For example, on linux, it will be convered to
// use a 'k', 'm' or 'g' syntax. BSD, though not widely supported with
// docker, uses a straight byte value.
//
// Percentages are not supported.
SizeBytes int64 `json:",omitempty"`
// Mode of the tmpfs upon creation
Mode os.FileMode `json:",omitempty"`
// TODO(stevvooe): There are several more tmpfs flags, specified in the
// daemon, that are accepted. Only the most basic are added for now.
//
// From docker/docker/pkg/mount/flags.go:
//
// var validFlags = map[string]bool{
// "": true,
// "size": true, X
// "mode": true, X
// "uid": true,
// "gid": true,
// "nr_inodes": true,
// "nr_blocks": true,
// "mpol": true,
// }
//
// Some of these may be straightforward to add, but others, such as
// uid/gid have implications in a clustered system.
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Workflow xmlns="urn:wexflow-schema" id="101" name="Workflow_HttpPut" description="Workflow_HttpPut">
<Settings>
<Setting name="launchType" value="trigger" />
<Setting name="enabled" value="true" />
</Settings>
<Tasks>
<Task id="1" name="HttpPut" description="Executing PUT request" enabled="true">
<Setting name="url" value="http://localhost:8000/wexflow/start/2" />
</Task>
</Tasks>
</Workflow> | {
"pile_set_name": "Github"
} |
*** Sent via Email - DMCA Notice of Copyright Infringement ***
Dear Sir/Madam,
I certify under penalty of perjury, that I am an agent authorized to act on behalf of the owner of the intellectual property rights and that the information contained in this notice is accurate.
I have a good faith belief that the page or material listed below is not authorized by law for use by the individual(s) associated with the identified page listed below or their agents and therefore infringes the copyright owner's rights.
I HEREBY DEMAND THAT YOU ACT EXPEDITIOUSLY TO REMOVE OR DISABLE ACCESS TO THE PAGE OR MATERIAL CLAIMED TO BE INFRINGING.
This notice is sent pursuant to the Digital Millennium Copyright Act (DMCA), the European Union's Directive on the Harmonisation of Certain Aspects of Copyright and Related Rights in the Information Society (2001/29/EC), and/or other laws and regulations relevant in European Union member states or other jurisdictions.
My contact information is as follows:
Organization name: Attributor Corporation as agent for the rights holders listed below
Email: [private]
Phone: [private]
Mailing address:
1825 S. Grant Street
Suite 600
San Mateo, CA 94402
My electronic signature follows:
Sincerely,
/[private]/
[private]
Attributor, Inc.
*** INFRINGING PAGE OR MATERIAL ***
Infringing page/material that I demand be disabled or removed in consideration of the above:
Rights Holder: DK US
Original Work: The Way Science Works
Infringing URL: https://need-vital.github.io/read-author/07-matteo-davis-6/-the-way-science-works-hardback.pdf
Infringing URL: https://technical-stall.github.io/paper-maysville/06-cristian-swift-i-2/the-way-science-works-hardback-0789485621.pdf
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* 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 "WXSimulatorShortcutManager.h"
#import "WXUtility.h"
#import <objc/message.h>
#if TARGET_OS_SIMULATOR
@interface UIEvent (WXSimulatorShortcutManager)
@property (nonatomic, strong) NSString *_modifiedInput;
@property (nonatomic, strong) NSString *_unmodifiedInput;
@property (nonatomic, assign) UIKeyModifierFlags _modifierFlags;
@property (nonatomic, assign) BOOL _isKeyDown;
@property (nonatomic, assign) long _keyCode;
@end
@interface WXKeyInput : NSObject
@property (nonatomic, strong) NSString *key;
@property (nonatomic, assign) UIKeyModifierFlags flags;
@end
@implementation WXKeyInput
+ (instancetype)keyInputForKey:(NSString *)key flags:(UIKeyModifierFlags)flags
{
WXKeyInput *keyInput = [[self alloc] init];
if (keyInput) {
keyInput.key = key;
keyInput.flags = flags;
}
return keyInput;
}
- (BOOL)isEqual:(id)object
{
BOOL isEqual = NO;
if ([object isKindOfClass:[WXKeyInput class]]) {
WXKeyInput *keyInput = (WXKeyInput *)object;
isEqual = [self.key isEqualToString:keyInput.key] && self.flags == keyInput.flags;
}
return isEqual;
}
@end
@implementation WXSimulatorShortcutManager
{
NSCache *_actions;
}
+ (instancetype)sharedManager
{
static WXSimulatorShortcutManager *_sharedInstance = nil;
static dispatch_once_t oncePredicate;
dispatch_once(&oncePredicate, ^{
_sharedInstance = [[self alloc] init];
_sharedInstance->_actions = [[NSCache alloc] init];
SEL handleKeyEventSelector = NSSelectorFromString(@"handleKeyUIEvent:");
SEL replacedSelector = WXSwizzledSelectorForSelector(handleKeyEventSelector);
WXSwizzleInstanceMethodWithBlock([UIApplication class], handleKeyEventSelector, ^(UIApplication *application, UIEvent *event) {
[[[self class] sharedManager] handleKeyUIEvent:event];
((void(*)(id, SEL, id))objc_msgSend)(application, replacedSelector, event);
}, replacedSelector);
});
return _sharedInstance;
}
+ (void)registerSimulatorShortcutWithKey:(NSString *)key modifierFlags:(UIKeyModifierFlags)flags action:(dispatch_block_t)action
{
WXKeyInput *keyInput = [WXKeyInput keyInputForKey:key flags:flags];
[[WXSimulatorShortcutManager sharedManager]->_actions setObject:action forKey:keyInput];
}
- (void)handleKeyUIEvent:(UIEvent *)event
{
BOOL isKeyDown = NO;
NSString *modifiedInput = nil;
NSString *unmodifiedInput = nil;
UIKeyModifierFlags flags = 0;
if ([event respondsToSelector:NSSelectorFromString(@"_isKeyDown")]) {
isKeyDown = [event _isKeyDown];
}
if ([event respondsToSelector:NSSelectorFromString(@"_modifiedInput")]) {
modifiedInput = [event _modifiedInput];
}
if ([event respondsToSelector:NSSelectorFromString(@"_unmodifiedInput")]) {
unmodifiedInput = [event _unmodifiedInput];
}
if ([event respondsToSelector:NSSelectorFromString(@"_modifierFlags")]) {
flags = [event _modifierFlags];
}
if (isKeyDown && [modifiedInput length] > 0) {
WXKeyInput *keyInput = [WXKeyInput keyInputForKey:unmodifiedInput flags:flags];
dispatch_block_t block = [_actions objectForKey:keyInput];
if (block) {
block();
}
}
}
@end
#endif
| {
"pile_set_name": "Github"
} |
""" Elliptic integrals. """
from __future__ import print_function, division
from sympy.core import S, pi, I, Rational
from sympy.core.function import Function, ArgumentIndexError
from sympy.functions.elementary.complexes import sign
from sympy.functions.elementary.hyperbolic import atanh
from sympy.functions.elementary.miscellaneous import sqrt
from sympy.functions.elementary.trigonometric import sin, tan
from sympy.functions.special.gamma_functions import gamma
from sympy.functions.special.hyper import hyper, meijerg
class elliptic_k(Function):
r"""
The complete elliptic integral of the first kind, defined by
.. math:: K(m) = F\left(\tfrac{\pi}{2}\middle| m\right)
where `F\left(z\middle| m\right)` is the Legendre incomplete
elliptic integral of the first kind.
The function `K(m)` is a single-valued function on the complex
plane with branch cut along the interval `(1, \infty)`.
Note that our notation defines the incomplete elliptic integral
in terms of the parameter `m` instead of the elliptic modulus
(eccentricity) `k`.
In this case, the parameter `m` is defined as `m=k^2`.
Examples
========
>>> from sympy import elliptic_k, I, pi
>>> from sympy.abc import m
>>> elliptic_k(0)
pi/2
>>> elliptic_k(1.0 + I)
1.50923695405127 + 0.625146415202697*I
>>> elliptic_k(m).series(n=3)
pi/2 + pi*m/8 + 9*pi*m**2/128 + O(m**3)
See Also
========
elliptic_f
References
==========
.. [1] https://en.wikipedia.org/wiki/Elliptic_integrals
.. [2] http://functions.wolfram.com/EllipticIntegrals/EllipticK
"""
@classmethod
def eval(cls, m):
if m.is_zero:
return pi/2
elif m is S.Half:
return 8*pi**Rational(3, 2)/gamma(Rational(-1, 4))**2
elif m is S.One:
return S.ComplexInfinity
elif m is S.NegativeOne:
return gamma(Rational(1, 4))**2/(4*sqrt(2*pi))
elif m in (S.Infinity, S.NegativeInfinity, I*S.Infinity,
I*S.NegativeInfinity, S.ComplexInfinity):
return S.Zero
if m.is_zero:
return pi*S.Half
def fdiff(self, argindex=1):
m = self.args[0]
return (elliptic_e(m) - (1 - m)*elliptic_k(m))/(2*m*(1 - m))
def _eval_conjugate(self):
m = self.args[0]
if (m.is_real and (m - 1).is_positive) is False:
return self.func(m.conjugate())
def _eval_nseries(self, x, n, logx):
from sympy.simplify import hyperexpand
return hyperexpand(self.rewrite(hyper)._eval_nseries(x, n=n, logx=logx))
def _eval_rewrite_as_hyper(self, m, **kwargs):
return pi*S.Half*hyper((S.Half, S.Half), (S.One,), m)
def _eval_rewrite_as_meijerg(self, m, **kwargs):
return meijerg(((S.Half, S.Half), []), ((S.Zero,), (S.Zero,)), -m)/2
def _eval_is_zero(self):
m = self.args[0]
if m.is_infinite:
return True
def _eval_rewrite_as_Integral(self, *args):
from sympy import Integral, Dummy
t = Dummy('t')
m = self.args[0]
return Integral(1/sqrt(1 - m*sin(t)**2), (t, 0, pi/2))
def _sage_(self):
import sage.all as sage
return sage.elliptic_kc(self.args[0]._sage_())
class elliptic_f(Function):
r"""
The Legendre incomplete elliptic integral of the first
kind, defined by
.. math:: F\left(z\middle| m\right) =
\int_0^z \frac{dt}{\sqrt{1 - m \sin^2 t}}
This function reduces to a complete elliptic integral of
the first kind, `K(m)`, when `z = \pi/2`.
Note that our notation defines the incomplete elliptic integral
in terms of the parameter `m` instead of the elliptic modulus
(eccentricity) `k`.
In this case, the parameter `m` is defined as `m=k^2`.
Examples
========
>>> from sympy import elliptic_f, I, O
>>> from sympy.abc import z, m
>>> elliptic_f(z, m).series(z)
z + z**5*(3*m**2/40 - m/30) + m*z**3/6 + O(z**6)
>>> elliptic_f(3.0 + I/2, 1.0 + I)
2.909449841483 + 1.74720545502474*I
See Also
========
elliptic_k
References
==========
.. [1] https://en.wikipedia.org/wiki/Elliptic_integrals
.. [2] http://functions.wolfram.com/EllipticIntegrals/EllipticF
"""
@classmethod
def eval(cls, z, m):
if z.is_zero:
return S.Zero
if m.is_zero:
return z
k = 2*z/pi
if k.is_integer:
return k*elliptic_k(m)
elif m in (S.Infinity, S.NegativeInfinity):
return S.Zero
elif z.could_extract_minus_sign():
return -elliptic_f(-z, m)
def fdiff(self, argindex=1):
z, m = self.args
fm = sqrt(1 - m*sin(z)**2)
if argindex == 1:
return 1/fm
elif argindex == 2:
return (elliptic_e(z, m)/(2*m*(1 - m)) - elliptic_f(z, m)/(2*m) -
sin(2*z)/(4*(1 - m)*fm))
raise ArgumentIndexError(self, argindex)
def _eval_conjugate(self):
z, m = self.args
if (m.is_real and (m - 1).is_positive) is False:
return self.func(z.conjugate(), m.conjugate())
def _eval_rewrite_as_Integral(self, *args):
from sympy import Integral, Dummy
t = Dummy('t')
z, m = self.args[0], self.args[1]
return Integral(1/(sqrt(1 - m*sin(t)**2)), (t, 0, z))
def _eval_is_zero(self):
z, m = self.args
if z.is_zero:
return True
if m.is_extended_real and m.is_infinite:
return True
class elliptic_e(Function):
r"""
Called with two arguments `z` and `m`, evaluates the
incomplete elliptic integral of the second kind, defined by
.. math:: E\left(z\middle| m\right) = \int_0^z \sqrt{1 - m \sin^2 t} dt
Called with a single argument `m`, evaluates the Legendre complete
elliptic integral of the second kind
.. math:: E(m) = E\left(\tfrac{\pi}{2}\middle| m\right)
The function `E(m)` is a single-valued function on the complex
plane with branch cut along the interval `(1, \infty)`.
Note that our notation defines the incomplete elliptic integral
in terms of the parameter `m` instead of the elliptic modulus
(eccentricity) `k`.
In this case, the parameter `m` is defined as `m=k^2`.
Examples
========
>>> from sympy import elliptic_e, I, pi, O
>>> from sympy.abc import z, m
>>> elliptic_e(z, m).series(z)
z + z**5*(-m**2/40 + m/30) - m*z**3/6 + O(z**6)
>>> elliptic_e(m).series(n=4)
pi/2 - pi*m/8 - 3*pi*m**2/128 - 5*pi*m**3/512 + O(m**4)
>>> elliptic_e(1 + I, 2 - I/2).n()
1.55203744279187 + 0.290764986058437*I
>>> elliptic_e(0)
pi/2
>>> elliptic_e(2.0 - I)
0.991052601328069 + 0.81879421395609*I
References
==========
.. [1] https://en.wikipedia.org/wiki/Elliptic_integrals
.. [2] http://functions.wolfram.com/EllipticIntegrals/EllipticE2
.. [3] http://functions.wolfram.com/EllipticIntegrals/EllipticE
"""
@classmethod
def eval(cls, m, z=None):
if z is not None:
z, m = m, z
k = 2*z/pi
if m.is_zero:
return z
if z.is_zero:
return S.Zero
elif k.is_integer:
return k*elliptic_e(m)
elif m in (S.Infinity, S.NegativeInfinity):
return S.ComplexInfinity
elif z.could_extract_minus_sign():
return -elliptic_e(-z, m)
else:
if m.is_zero:
return pi/2
elif m is S.One:
return S.One
elif m is S.Infinity:
return I*S.Infinity
elif m is S.NegativeInfinity:
return S.Infinity
elif m is S.ComplexInfinity:
return S.ComplexInfinity
def fdiff(self, argindex=1):
if len(self.args) == 2:
z, m = self.args
if argindex == 1:
return sqrt(1 - m*sin(z)**2)
elif argindex == 2:
return (elliptic_e(z, m) - elliptic_f(z, m))/(2*m)
else:
m = self.args[0]
if argindex == 1:
return (elliptic_e(m) - elliptic_k(m))/(2*m)
raise ArgumentIndexError(self, argindex)
def _eval_conjugate(self):
if len(self.args) == 2:
z, m = self.args
if (m.is_real and (m - 1).is_positive) is False:
return self.func(z.conjugate(), m.conjugate())
else:
m = self.args[0]
if (m.is_real and (m - 1).is_positive) is False:
return self.func(m.conjugate())
def _eval_nseries(self, x, n, logx):
from sympy.simplify import hyperexpand
if len(self.args) == 1:
return hyperexpand(self.rewrite(hyper)._eval_nseries(x, n=n, logx=logx))
return super(elliptic_e, self)._eval_nseries(x, n=n, logx=logx)
def _eval_rewrite_as_hyper(self, *args, **kwargs):
if len(args) == 1:
m = args[0]
return (pi/2)*hyper((Rational(-1, 2), S.Half), (S.One,), m)
def _eval_rewrite_as_meijerg(self, *args, **kwargs):
if len(args) == 1:
m = args[0]
return -meijerg(((S.Half, Rational(3, 2)), []), \
((S.Zero,), (S.Zero,)), -m)/4
def _eval_rewrite_as_Integral(self, *args):
from sympy import Integral, Dummy
z, m = (pi/2, self.args[0]) if len(self.args) == 1 else self.args
t = Dummy('t')
return Integral(sqrt(1 - m*sin(t)**2), (t, 0, z))
class elliptic_pi(Function):
r"""
Called with three arguments `n`, `z` and `m`, evaluates the
Legendre incomplete elliptic integral of the third kind, defined by
.. math:: \Pi\left(n; z\middle| m\right) = \int_0^z \frac{dt}
{\left(1 - n \sin^2 t\right) \sqrt{1 - m \sin^2 t}}
Called with two arguments `n` and `m`, evaluates the complete
elliptic integral of the third kind:
.. math:: \Pi\left(n\middle| m\right) =
\Pi\left(n; \tfrac{\pi}{2}\middle| m\right)
Note that our notation defines the incomplete elliptic integral
in terms of the parameter `m` instead of the elliptic modulus
(eccentricity) `k`.
In this case, the parameter `m` is defined as `m=k^2`.
Examples
========
>>> from sympy import elliptic_pi, I, pi, O, S
>>> from sympy.abc import z, n, m
>>> elliptic_pi(n, z, m).series(z, n=4)
z + z**3*(m/6 + n/3) + O(z**4)
>>> elliptic_pi(0.5 + I, 1.0 - I, 1.2)
2.50232379629182 - 0.760939574180767*I
>>> elliptic_pi(0, 0)
pi/2
>>> elliptic_pi(1.0 - I/3, 2.0 + I)
3.29136443417283 + 0.32555634906645*I
References
==========
.. [1] https://en.wikipedia.org/wiki/Elliptic_integrals
.. [2] http://functions.wolfram.com/EllipticIntegrals/EllipticPi3
.. [3] http://functions.wolfram.com/EllipticIntegrals/EllipticPi
"""
@classmethod
def eval(cls, n, m, z=None):
if z is not None:
n, z, m = n, m, z
if n.is_zero:
return elliptic_f(z, m)
elif n is S.One:
return (elliptic_f(z, m) +
(sqrt(1 - m*sin(z)**2)*tan(z) -
elliptic_e(z, m))/(1 - m))
k = 2*z/pi
if k.is_integer:
return k*elliptic_pi(n, m)
elif m.is_zero:
return atanh(sqrt(n - 1)*tan(z))/sqrt(n - 1)
elif n == m:
return (elliptic_f(z, n) - elliptic_pi(1, z, n) +
tan(z)/sqrt(1 - n*sin(z)**2))
elif n in (S.Infinity, S.NegativeInfinity):
return S.Zero
elif m in (S.Infinity, S.NegativeInfinity):
return S.Zero
elif z.could_extract_minus_sign():
return -elliptic_pi(n, -z, m)
if n.is_zero:
return elliptic_f(z, m)
if m.is_extended_real and m.is_infinite or \
n.is_extended_real and n.is_infinite:
return S.Zero
else:
if n.is_zero:
return elliptic_k(m)
elif n is S.One:
return S.ComplexInfinity
elif m.is_zero:
return pi/(2*sqrt(1 - n))
elif m == S.One:
return S.NegativeInfinity/sign(n - 1)
elif n == m:
return elliptic_e(n)/(1 - n)
elif n in (S.Infinity, S.NegativeInfinity):
return S.Zero
elif m in (S.Infinity, S.NegativeInfinity):
return S.Zero
if n.is_zero:
return elliptic_k(m)
if m.is_extended_real and m.is_infinite or \
n.is_extended_real and n.is_infinite:
return S.Zero
def _eval_conjugate(self):
if len(self.args) == 3:
n, z, m = self.args
if (n.is_real and (n - 1).is_positive) is False and \
(m.is_real and (m - 1).is_positive) is False:
return self.func(n.conjugate(), z.conjugate(), m.conjugate())
else:
n, m = self.args
return self.func(n.conjugate(), m.conjugate())
def fdiff(self, argindex=1):
if len(self.args) == 3:
n, z, m = self.args
fm, fn = sqrt(1 - m*sin(z)**2), 1 - n*sin(z)**2
if argindex == 1:
return (elliptic_e(z, m) + (m - n)*elliptic_f(z, m)/n +
(n**2 - m)*elliptic_pi(n, z, m)/n -
n*fm*sin(2*z)/(2*fn))/(2*(m - n)*(n - 1))
elif argindex == 2:
return 1/(fm*fn)
elif argindex == 3:
return (elliptic_e(z, m)/(m - 1) +
elliptic_pi(n, z, m) -
m*sin(2*z)/(2*(m - 1)*fm))/(2*(n - m))
else:
n, m = self.args
if argindex == 1:
return (elliptic_e(m) + (m - n)*elliptic_k(m)/n +
(n**2 - m)*elliptic_pi(n, m)/n)/(2*(m - n)*(n - 1))
elif argindex == 2:
return (elliptic_e(m)/(m - 1) + elliptic_pi(n, m))/(2*(n - m))
raise ArgumentIndexError(self, argindex)
def _eval_rewrite_as_Integral(self, *args):
from sympy import Integral, Dummy
if len(self.args) == 2:
n, m, z = self.args[0], self.args[1], pi/2
else:
n, z, m = self.args
t = Dummy('t')
return Integral(1/((1 - n*sin(t)**2)*sqrt(1 - m*sin(t)**2)), (t, 0, z))
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2015 Nuxi, https://nuxi.nl/
//
// SPDX-License-Identifier: BSD-2-Clause
#include <sys/uio.h>
#include <fcntl.h>
#include <unistd.h>
#include "gtest/gtest.h"
#include "src/gtest_with_tmpdir/gtest_with_tmpdir.h"
TEST(preadv, example) {
int fd_tmp = gtest_with_tmpdir::CreateTemporaryDirectory();
// Prepare example file.
int fd = openat(fd_tmp, "file", O_CREAT | O_RDWR);
ASSERT_NE(-1, fd);
ASSERT_EQ(12, write(fd, "Hello, world", 12));
// Perform a preadv().
char data1[6];
char data2[4];
struct iovec iov[2] = {{.iov_base = data1, .iov_len = sizeof(data1) - 1},
{.iov_base = data2, .iov_len = sizeof(data2) - 1}};
ASSERT_EQ(sizeof(data1) + sizeof(data2) - 2, preadv(fd, iov, 2, 2));
data1[5] = '\0';
ASSERT_STREQ("llo, ", data1);
data1[3] = '\0';
ASSERT_STREQ("wor", data2);
// Close example file.
ASSERT_EQ(0, close(fd));
}
| {
"pile_set_name": "Github"
} |
/* manli.h - Keytable for manli Remote Controller
*
* keymap imported from ir-keymaps.c
*
* Copyright (c) 2010 by Mauro Carvalho Chehab <[email protected]>
*
* 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.
*/
#include <media/rc-map.h>
#include <linux/module.h>
/* Michael Tokarev <[email protected]>
keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at
least, and probably other cards too.
The "ascii-art picture" below (in comments, first row
is the keycode in hex, and subsequent row(s) shows
the button labels (several variants when appropriate)
helps to descide which keycodes to assign to the buttons.
*/
static struct rc_map_table manli[] = {
/* 0x1c 0x12 *
* FUNCTION POWER *
* FM (|) *
* */
{ 0x1c, KEY_RADIO }, /*XXX*/
{ 0x12, KEY_POWER },
/* 0x01 0x02 0x03 *
* 1 2 3 *
* *
* 0x04 0x05 0x06 *
* 4 5 6 *
* *
* 0x07 0x08 0x09 *
* 7 8 9 *
* */
{ 0x01, KEY_1 },
{ 0x02, KEY_2 },
{ 0x03, KEY_3 },
{ 0x04, KEY_4 },
{ 0x05, KEY_5 },
{ 0x06, KEY_6 },
{ 0x07, KEY_7 },
{ 0x08, KEY_8 },
{ 0x09, KEY_9 },
/* 0x0a 0x00 0x17 *
* RECALL 0 +100 *
* PLUS *
* */
{ 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */
{ 0x00, KEY_0 },
{ 0x17, KEY_DIGITS }, /*XXX*/
/* 0x14 0x10 *
* MENU INFO *
* OSD */
{ 0x14, KEY_MENU },
{ 0x10, KEY_INFO },
/* 0x0b *
* Up *
* *
* 0x18 0x16 0x0c *
* Left Ok Right *
* *
* 0x015 *
* Down *
* */
{ 0x0b, KEY_UP },
{ 0x18, KEY_LEFT },
{ 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */
{ 0x0c, KEY_RIGHT },
{ 0x15, KEY_DOWN },
/* 0x11 0x0d *
* TV/AV MODE *
* SOURCE STEREO *
* */
{ 0x11, KEY_TV }, /*XXX*/
{ 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */
/* 0x0f 0x1b 0x1a *
* AUDIO Vol+ Chan+ *
* TIMESHIFT??? *
* *
* 0x0e 0x1f 0x1e *
* SLEEP Vol- Chan- *
* */
{ 0x0f, KEY_AUDIO },
{ 0x1b, KEY_VOLUMEUP },
{ 0x1a, KEY_CHANNELUP },
{ 0x0e, KEY_TIME },
{ 0x1f, KEY_VOLUMEDOWN },
{ 0x1e, KEY_CHANNELDOWN },
/* 0x13 0x19 *
* MUTE SNAPSHOT*
* */
{ 0x13, KEY_MUTE },
{ 0x19, KEY_CAMERA },
/* 0x1d unused ? */
};
static struct rc_map_list manli_map = {
.map = {
.scan = manli,
.size = ARRAY_SIZE(manli),
.rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
.name = RC_MAP_MANLI,
}
};
static int __init init_rc_map_manli(void)
{
return rc_map_register(&manli_map);
}
static void __exit exit_rc_map_manli(void)
{
rc_map_unregister(&manli_map);
}
module_init(init_rc_map_manli)
module_exit(exit_rc_map_manli)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mauro Carvalho Chehab <[email protected]>");
| {
"pile_set_name": "Github"
} |
<label text="AccountUserRating"></label>
| {
"pile_set_name": "Github"
} |
;Segment Spec
;Header
partmax = 16
lastmeshmax = 16
;Segment Parts
partmode0 = 0
meshname0 = meshbank\ww2\france\rooms\chateau_cellar\floor_b.x
offx0 = 0
offy0 = -50
offz0 = 0
rotx0 = 0
roty0 = 0
rotz0 = 0
texture0 = texturebank\ww2\floors\concrete\f_g_01_d2.tga
textured0 = texturebank\ww2\floors\concrete\f_g_01_D.tga
texturen0 = texturebank\ww2\floors\concrete\f_g_01_N.tga
textures0 = texturebank\ww2\floors\concrete\f_g_01_S.tga
transparency0 = 0
effect0 =
colmode0 = 1
csgmesh0 =
csgmode0 = 0
csgimmune0 = 1
lightmode0 = 0
multimeshmode0 = 1
materialindex0 = 2
partmode1 = 0
meshname1 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a.x
offx1 = 0
offy1 = 0
offz1 = 50
rotx1 = 0
roty1 = 0
rotz1 = 0
texture1 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured1 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen1 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures1 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency1 = 0
effect1 =
colmode1 = 1
csgmesh1 =
csgmode1 = 0
csgimmune1 = 0
lightmode1 = 0
multimeshmode1 = 1
materialindex1 = 2
partmode2 = 0
meshname2 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a.x
offx2 = -50
offy2 = 0
offz2 = 50
rotx2 = 0
roty2 = 0
rotz2 = 0
texture2 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured2 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen2 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures2 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency2 = 0
effect2 =
colmode2 = 1
csgmesh2 =
csgmode2 = 0
csgimmune2 = 0
lightmode2 = 0
multimeshmode2 = 0
materialindex2 = 2
partmode3 = 0
meshname3 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a.x
offx3 = 50
offy3 = 0
offz3 = 50
rotx3 = 0
roty3 = 90
rotz3 = 0
texture3 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured3 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen3 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures3 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency3 = 0
effect3 =
colmode3 = 1
csgmesh3 =
csgmode3 = 0
csgimmune3 = 0
lightmode3 = 0
multimeshmode3 = 0
materialindex3 = 2
partmode4 = 0
meshname4 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a.x
offx4 = 50
offy4 = 0
offz4 = 0
rotx4 = 0
roty4 = 90
rotz4 = 0
texture4 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured4 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen4 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures4 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency4 = 0
effect4 =
colmode4 = 1
csgmesh4 =
csgmode4 = 0
csgimmune4 = 0
lightmode4 = 0
multimeshmode4 = 1
materialindex4 = 2
partmode5 = 0
meshname5 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a.x
offx5 = 0
offy5 = 0
offz5 = -50
rotx5 = 0
roty5 = 180
rotz5 = 0
texture5 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured5 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen5 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures5 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency5 = 0
effect5 =
colmode5 = 1
csgmesh5 =
csgmode5 = 0
csgimmune5 = 0
lightmode5 = 0
multimeshmode5 = 1
materialindex5 = 2
partmode6 = 0
meshname6 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a.x
offx6 = -50
offy6 = 0
offz6 = 0
rotx6 = 0
roty6 = 270
rotz6 = 0
texture6 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured6 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen6 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures6 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency6 = 0
effect6 =
colmode6 = 1
csgmesh6 =
csgmode6 = 0
csgimmune6 = 0
lightmode6 = 0
multimeshmode6 = 1
materialindex6 = 2
partmode7 = 0
meshname7 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a.x
offx7 = 50
offy7 = 0
offz7 = -50
rotx7 = 0
roty7 = 180
rotz7 = 0
texture7 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.tga
textured7 = texturebank\ww2\walls\concrete\w_g_dn_01_D.tga
texturen7 = texturebank\ww2\walls\concrete\w_g_dn_01_N.tga
textures7 = texturebank\ww2\walls\concrete\w_g_dn_01_S.tga
transparency7 = 0
effect7 =
colmode7 = 1
csgmesh7 =
csgmode7 = 0
csgimmune7 = 0
lightmode7 = 0
multimeshmode7 = 0
materialindex7 = 2
partmode8 = 0
meshname8 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a.x
offx8 = -50
offy8 = 0
offz8 = -50
rotx8 = 0
roty8 = 270
rotz8 = 0
texture8 = texturebank\ww2\walls\concrete\w_g_dn_01_d2.dds
textured8 =
texturen8 =
textures8 =
transparency8 = 0
effect8 =
colmode8 = 1
csgmesh8 =
csgmode8 = 0
csgimmune8 = 0
lightmode8 = 0
multimeshmode8 = 0
materialindex8 = 2
partmode9 = 0
meshname9 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a_e.x
offx9 = 0
offy9 = 0
offz9 = 50
rotx9 = 0
roty9 = 180
rotz9 = 0
texture9 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured9 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen9 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures9 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency9 = 0
effect9 =
colmode9 = 1
csgmesh9 =
csgmode9 = 0
csgimmune9 = 0
lightmode9 = 0
multimeshmode9 = 0
materialindex9 = 2
partmode10 = 0
meshname10 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a_e.x
offx10 = 50
offy10 = 0
offz10 = 0
rotx10 = 0
roty10 = 270
rotz10 = 0
texture10 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured10 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen10 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures10 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency10 = 0
effect10 =
colmode10 = 1
csgmesh10 =
csgmode10 = 0
csgimmune10 = 0
lightmode10 = 0
multimeshmode10 = 0
materialindex10 = 2
partmode11 = 0
meshname11 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a_e.x
offx11 = 0
offy11 = 0
offz11 = -50
rotx11 = 0
roty11 = 0
rotz11 = 0
texture11 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured11 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen11 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures11 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency11 = 0
effect11 =
colmode11 = 1
csgmesh11 =
csgmode11 = 0
csgimmune11 = 0
lightmode11 = 0
multimeshmode11 = 0
materialindex11 = 2
partmode12 = 0
meshname12 = meshbank\ww2\france\rooms\chateau_cellar\wall_dn_a_e.x
offx12 = -50
offy12 = 0
offz12 = 0
rotx12 = 0
roty12 = 90
rotz12 = 0
texture12 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured12 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen12 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures12 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency12 = 0
effect12 =
colmode12 = 1
csgmesh12 =
csgmode12 = 0
csgimmune12 = 0
lightmode12 = 0
multimeshmode12 = 0
materialindex12 = 2
partmode13 = 0
meshname13 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a_e.x
offx13 = 50
offy13 = 0
offz13 = -50
rotx13 = 0
roty13 = 0
rotz13 = 0
texture13 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured13 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen13 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures13 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency13 = 0
effect13 =
colmode13 = 1
csgmesh13 =
csgmode13 = 0
csgimmune13 = 0
lightmode13 = 0
multimeshmode13 = 0
materialindex13 = 2
partmode14 = 0
meshname14 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a_e.x
offx14 = -50
offy14 = 0
offz14 = -50
rotx14 = 0
roty14 = 90
rotz14 = 0
texture14 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured14 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen14 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures14 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency14 = 0
effect14 =
colmode14 = 1
csgmesh14 =
csgmode14 = 0
csgimmune14 = 0
lightmode14 = 0
multimeshmode14 = 0
materialindex14 = 2
partmode15 = 0
meshname15 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a_e.x
offx15 = -50
offy15 = 0
offz15 = 50
rotx15 = 0
roty15 = 180
rotz15 = 0
texture15 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured15 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen15 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures15 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency15 = 0
effect15 =
colmode15 = 1
csgmesh15 =
csgmode15 = 0
csgimmune15 = 0
lightmode15 = 0
multimeshmode15 = 0
materialindex15 = 2
partmode16 = 0
meshname16 = meshbank\ww2\france\rooms\chateau_cellar\corner_dn_a_e.x
offx16 = 50
offy16 = 0
offz16 = 50
rotx16 = 0
roty16 = 270
rotz16 = 0
texture16 = texturebank\ww2\walls\concrete\w_h_dn_01_d2.tga
textured16 = texturebank\ww2\walls\concrete\w_h_dn_01_D.tga
texturen16 = texturebank\ww2\walls\concrete\w_h_dn_01_N.tga
textures16 = texturebank\ww2\walls\concrete\w_h_dn_01_S.tga
transparency16 = 0
effect16 =
colmode16 = 1
csgmesh16 =
csgmode16 = 0
csgimmune16 = 0
lightmode16 = 0
multimeshmode16 = 0
materialindex16 = 2
;Segment Visibility
visoverlay = 0
visfloor = 0
visroof = -1
viswallb = 5,11
viswallr = 4,10
viswallf = 1,9
viswalll = 6,12
viscornertl = 2,15
viscornertr = 3,16
viscornerbr = 7,13
viscornerbl = 8,14
;Segment Blueprint
mode = 0
symbol = 0
floorsizey = 0
sidesizex = 100
sidesizey = 100
sidesizez = 100
groundmode = 0
kindof = 0
;end
| {
"pile_set_name": "Github"
} |
{
"RepetitionTime": 2.0,
"TaskName": "mixed-gambles task",
"SliceTiming": [0.0, 0.0571, 0.1143, 0.1714, 0.2286, 0.2857]
}
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package network
import (
"fmt"
"math/rand"
"time"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/swarm/storage"
)
const requesterCount = 3
/*
forwarder implements the CloudStore interface (use by storage.NetStore)
and serves as the cloud store backend orchestrating storage/retrieval/delivery
via the native bzz protocol
which uses an MSB logarithmic distance-based semi-permanent Kademlia table for
* recursive forwarding style routing for retrieval
* smart syncronisation
*/
type forwarder struct {
hive *Hive
}
func NewForwarder(hive *Hive) *forwarder {
return &forwarder{hive: hive}
}
// generate a unique id uint64
func generateId() uint64 {
r := rand.New(rand.NewSource(time.Now().UnixNano()))
return uint64(r.Int63())
}
var searchTimeout = 3 * time.Second
// forwarding logic
// logic propagating retrieve requests to peers given by the kademlia hive
func (self *forwarder) Retrieve(chunk *storage.Chunk) {
peers := self.hive.getPeers(chunk.Key, 0)
log.Trace(fmt.Sprintf("forwarder.Retrieve: %v - received %d peers from KΛÐΞMLIΛ...", chunk.Key.Log(), len(peers)))
OUT:
for _, p := range peers {
log.Trace(fmt.Sprintf("forwarder.Retrieve: sending retrieveRequest %v to peer [%v]", chunk.Key.Log(), p))
for _, recipients := range chunk.Req.Requesters {
for _, recipient := range recipients {
req := recipient.(*retrieveRequestMsgData)
if req.from.Addr() == p.Addr() {
continue OUT
}
}
}
req := &retrieveRequestMsgData{
Key: chunk.Key,
Id: generateId(),
}
var err error
if p.swap != nil {
err = p.swap.Add(-1)
}
if err == nil {
p.retrieve(req)
break OUT
}
log.Warn(fmt.Sprintf("forwarder.Retrieve: unable to send retrieveRequest to peer [%v]: %v", chunk.Key.Log(), err))
}
}
// requests to specific peers given by the kademlia hive
// except for peers that the store request came from (if any)
// delivery queueing taken care of by syncer
func (self *forwarder) Store(chunk *storage.Chunk) {
var n int
msg := &storeRequestMsgData{
Key: chunk.Key,
SData: chunk.SData,
}
var source *peer
if chunk.Source != nil {
source = chunk.Source.(*peer)
}
for _, p := range self.hive.getPeers(chunk.Key, 0) {
log.Trace(fmt.Sprintf("forwarder.Store: %v %v", p, chunk))
if p.syncer != nil && (source == nil || p.Addr() != source.Addr()) {
n++
Deliver(p, msg, PropagateReq)
}
}
log.Trace(fmt.Sprintf("forwarder.Store: sent to %v peers (chunk = %v)", n, chunk))
}
// once a chunk is found deliver it to its requesters unless timed out
func (self *forwarder) Deliver(chunk *storage.Chunk) {
// iterate over request entries
for id, requesters := range chunk.Req.Requesters {
counter := requesterCount
msg := &storeRequestMsgData{
Key: chunk.Key,
SData: chunk.SData,
}
var n int
var req *retrieveRequestMsgData
// iterate over requesters with the same id
for id, r := range requesters {
req = r.(*retrieveRequestMsgData)
if req.timeout == nil || req.timeout.After(time.Now()) {
log.Trace(fmt.Sprintf("forwarder.Deliver: %v -> %v", req.Id, req.from))
msg.Id = uint64(id)
Deliver(req.from, msg, DeliverReq)
n++
counter--
if counter <= 0 {
break
}
}
}
log.Trace(fmt.Sprintf("forwarder.Deliver: submit chunk %v (request id %v) for delivery to %v peers", chunk.Key.Log(), id, n))
}
}
// initiate delivery of a chunk to a particular peer via syncer#addRequest
// depending on syncer mode and priority settings and sync request type
// this either goes via confirmation roundtrip or queued or pushed directly
func Deliver(p *peer, req interface{}, ty int) {
p.syncer.addRequest(req, ty)
}
// push chunk over to peer
func Push(p *peer, key storage.Key, priority uint) {
p.syncer.doDelivery(key, priority, p.syncer.quit)
}
| {
"pile_set_name": "Github"
} |
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do not translate or localize
Xamarin Components for Square Retrofit
third party material from the projects listed below. The original copyright
notice and the license under which Microsoft received such third party
material are set forth below. Microsoft reserves all other rights not
expressly granted, whether by implication, estoppel or otherwise.
########################################
# Square Retrofit
# https://github.com/square/retrofit
########################################
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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. | {
"pile_set_name": "Github"
} |
"""
A module that implements tooling to enable easy warnings about deprecations.
"""
from __future__ import absolute_import
import logging
import warnings
from pip._vendor.packaging.version import parse
from pip import __version__ as current_version
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from typing import Any, Optional
DEPRECATION_MSG_PREFIX = "DEPRECATION: "
class PipDeprecationWarning(Warning):
pass
_original_showwarning = None # type: Any
# Warnings <-> Logging Integration
def _showwarning(message, category, filename, lineno, file=None, line=None):
if file is not None:
if _original_showwarning is not None:
_original_showwarning(
message, category, filename, lineno, file, line,
)
elif issubclass(category, PipDeprecationWarning):
# We use a specially named logger which will handle all of the
# deprecation messages for pip.
logger = logging.getLogger("pip._internal.deprecations")
logger.warning(message)
else:
_original_showwarning(
message, category, filename, lineno, file, line,
)
def install_warning_logger():
# type: () -> None
# Enable our Deprecation Warnings
warnings.simplefilter("default", PipDeprecationWarning, append=True)
global _original_showwarning
if _original_showwarning is None:
_original_showwarning = warnings.showwarning
warnings.showwarning = _showwarning
def deprecated(reason, replacement, gone_in, issue=None):
# type: (str, Optional[str], Optional[str], Optional[int]) -> None
"""Helper to deprecate existing functionality.
reason:
Textual reason shown to the user about why this functionality has
been deprecated.
replacement:
Textual suggestion shown to the user about what alternative
functionality they can use.
gone_in:
The version of pip does this functionality should get removed in.
Raises errors if pip's current version is greater than or equal to
this.
issue:
Issue number on the tracker that would serve as a useful place for
users to find related discussion and provide feedback.
Always pass replacement, gone_in and issue as keyword arguments for clarity
at the call site.
"""
# Construct a nice message.
# This is purposely eagerly formatted as we want it to appear as if someone
# typed this entire message out.
message = DEPRECATION_MSG_PREFIX + reason
if replacement is not None:
message += " A possible replacement is {}.".format(replacement)
if issue is not None:
url = "https://github.com/pypa/pip/issues/" + str(issue)
message += " You can find discussion regarding this at {}.".format(url)
# Raise as an error if it has to be removed.
if gone_in is not None and parse(current_version) >= parse(gone_in):
raise PipDeprecationWarning(message)
warnings.warn(message, category=PipDeprecationWarning, stacklevel=2)
| {
"pile_set_name": "Github"
} |
package com.orientechnologies.orient.core.storage.ridbag.sbtree;
import com.orientechnologies.common.serialization.types.OBinarySerializer;
import com.orientechnologies.common.serialization.types.OByteSerializer;
import com.orientechnologies.common.serialization.types.OIntegerSerializer;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.id.ORecordId;
import com.orientechnologies.orient.core.serialization.serializer.binary.impl.OLinkSerializer;
import java.util.HashMap;
import java.util.Map;
/** Created by tglman on 15/06/17. */
public class ChangeSerializationHelper {
public static final ChangeSerializationHelper INSTANCE = new ChangeSerializationHelper();
public static Change createChangeInstance(byte type, int value) {
switch (type) {
case AbsoluteChange.TYPE:
return new AbsoluteChange(value);
case DiffChange.TYPE:
return new DiffChange(value);
default:
throw new IllegalArgumentException("Change type is incorrect");
}
}
public Change deserializeChange(final byte[] stream, final int offset) {
int value =
OIntegerSerializer.INSTANCE.deserializeLiteral(stream, offset + OByteSerializer.BYTE_SIZE);
return createChangeInstance(OByteSerializer.INSTANCE.deserializeLiteral(stream, offset), value);
}
public Map<OIdentifiable, Change> deserializeChanges(final byte[] stream, int offset) {
final int count = OIntegerSerializer.INSTANCE.deserializeLiteral(stream, offset);
offset += OIntegerSerializer.INT_SIZE;
final HashMap<OIdentifiable, Change> res = new HashMap<>();
for (int i = 0; i < count; i++) {
ORecordId rid = OLinkSerializer.INSTANCE.deserialize(stream, offset);
offset += OLinkSerializer.RID_SIZE;
Change change = ChangeSerializationHelper.INSTANCE.deserializeChange(stream, offset);
offset += Change.SIZE;
final OIdentifiable identifiable;
if (rid.isTemporary() && rid.getRecord() != null) identifiable = rid.getRecord();
else identifiable = rid;
res.put(identifiable, change);
}
return res;
}
public <K extends OIdentifiable> void serializeChanges(
Map<K, Change> changes, OBinarySerializer<K> keySerializer, byte[] stream, int offset) {
OIntegerSerializer.INSTANCE.serializeLiteral(changes.size(), stream, offset);
offset += OIntegerSerializer.INT_SIZE;
for (Map.Entry<K, Change> entry : changes.entrySet()) {
K key = entry.getKey();
if (key.getIdentity().isTemporary())
//noinspection unchecked
key = key.getRecord();
keySerializer.serialize(key, stream, offset);
offset += keySerializer.getObjectSize(key);
offset += entry.getValue().serialize(stream, offset);
}
}
public int getChangesSerializedSize(int changesCount) {
return changesCount * (OLinkSerializer.RID_SIZE + Change.SIZE);
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="NavAuthentication" xml:space="preserve">
<value>Authentification/Déconnexion</value>
</data>
<data name="NavBasics" xml:space="preserve">
<value>Notions de base</value>
</data>
<data name="NavConsent" xml:space="preserve">
<value>Écran de consentement</value>
</data>
<data name="NavDeviceFlow" xml:space="preserve">
<value>Device Flow</value>
<comment>Flux de périphériques, Flux d'appareils</comment>
</data>
<data name="NavName" xml:space="preserve">
<value>Nom</value>
</data>
<data name="NavToken" xml:space="preserve">
<value>Jeton</value>
</data>
<data name="Title" xml:space="preserve">
<value>Réglages</value>
<comment>Paramètres</comment>
</data>
</root> | {
"pile_set_name": "Github"
} |
/**
Address editable input.
Internally value stored as {city: "Moscow", street: "Lenina", building: "15"}
@class address
@extends abstractinput
@final
@example
<a href="#" id="address" data-type="address" data-pk="1">awesome</a>
<script>
$(function(){
$('#address').editable({
url: '/post',
title: 'Enter city, street and building #',
value: {
city: "Moscow",
street: "Lenina",
building: "15"
}
});
});
</script>
**/
(function ($) {
"use strict";
var Address = function (options) {
this.init('address', options, Address.defaults);
};
//inherit from Abstract input
$.fn.editableutils.inherit(Address, $.fn.editabletypes.abstractinput);
$.extend(Address.prototype, {
/**
Renders input from tpl
@method render()
**/
render: function() {
this.$input = this.$tpl.find('input');
},
/**
Default method to show value in element. Can be overwritten by display option.
@method value2html(value, element)
**/
value2html: function(value, element) {
if(!value) {
$(element).empty();
return;
}
var html = $('<div>').text(value.city).html() + ', ' + $('<div>').text(value.street).html() + ' st., bld. ' + $('<div>').text(value.building).html();
$(element).html(html);
},
/**
Gets value from element's html
@method html2value(html)
**/
html2value: function(html) {
/*
you may write parsing method to get value by element's html
e.g. "Moscow, st. Lenina, bld. 15" => {city: "Moscow", street: "Lenina", building: "15"}
but for complex structures it's not recommended.
Better set value directly via javascript, e.g.
editable({
value: {
city: "Moscow",
street: "Lenina",
building: "15"
}
});
*/
return null;
},
/**
Converts value to string.
It is used in internal comparing (not for sending to server).
@method value2str(value)
**/
value2str: function(value) {
var str = '';
if(value) {
for(var k in value) {
str = str + k + ':' + value[k] + ';';
}
}
return str;
},
/*
Converts string to value. Used for reading value from 'data-value' attribute.
@method str2value(str)
*/
str2value: function(str) {
/*
this is mainly for parsing value defined in data-value attribute.
If you will always set value by javascript, no need to overwrite it
*/
return str;
},
/**
Sets value of input.
@method value2input(value)
@param {mixed} value
**/
value2input: function(value) {
if(!value) {
return;
}
this.$input.filter('[name="city"]').val(value.city);
this.$input.filter('[name="street"]').val(value.street);
this.$input.filter('[name="building"]').val(value.building);
},
/**
Returns value of input.
@method input2value()
**/
input2value: function() {
return {
city: this.$input.filter('[name="city"]').val(),
street: this.$input.filter('[name="street"]').val(),
building: this.$input.filter('[name="building"]').val()
};
},
/**
Activates input: sets focus on the first field.
@method activate()
**/
activate: function() {
this.$input.filter('[name="city"]').focus();
},
/**
Attaches handler to submit form in case of 'showbuttons=false' mode
@method autosubmit()
**/
autosubmit: function() {
this.$input.keydown(function (e) {
if (e.which === 13) {
$(this).closest('form').submit();
}
});
}
});
Address.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
tpl: '<div class="editable-address"><label><span>City: </span><input type="text" name="city" class="input-small"></label></div>'+
'<div class="editable-address"><label><span>Street: </span><input type="text" name="street" class="input-small"></label></div>'+
'<div class="editable-address"><label><span>Building: </span><input type="text" name="building" class="input-mini"></label></div>',
inputclass: ''
});
$.fn.editabletypes.address = Address;
}(window.jQuery)); | {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NVKM_FB_REGS_04_H__
#define __NVKM_FB_REGS_04_H__
#define NV04_PFB_BOOT_0 0x00100000
# define NV04_PFB_BOOT_0_RAM_AMOUNT 0x00000003
# define NV04_PFB_BOOT_0_RAM_AMOUNT_32MB 0x00000000
# define NV04_PFB_BOOT_0_RAM_AMOUNT_4MB 0x00000001
# define NV04_PFB_BOOT_0_RAM_AMOUNT_8MB 0x00000002
# define NV04_PFB_BOOT_0_RAM_AMOUNT_16MB 0x00000003
# define NV04_PFB_BOOT_0_RAM_WIDTH_128 0x00000004
# define NV04_PFB_BOOT_0_RAM_TYPE 0x00000028
# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_8MBIT 0x00000000
# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT 0x00000008
# define NV04_PFB_BOOT_0_RAM_TYPE_SGRAM_16MBIT_4BANK 0x00000010
# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_16MBIT 0x00000018
# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBIT 0x00000020
# define NV04_PFB_BOOT_0_RAM_TYPE_SDRAM_64MBITX16 0x00000028
# define NV04_PFB_BOOT_0_UMA_ENABLE 0x00000100
# define NV04_PFB_BOOT_0_UMA_SIZE 0x0000f000
#define NV04_PFB_CFG0 0x00100200
#endif
| {
"pile_set_name": "Github"
} |
package com.twitter.util
import scala.util.control.NonFatal
import scala.util.{Success, Failure}
/**
* The Try type represents a computation that may either result in an exception
* or return a success value. It is analogous to the Either type but encodes
* common idioms for handling exceptional cases (such as rescue/ensure which
* is analogous to try/finally).
*/
object Try {
case class PredicateDoesNotObtain() extends Exception()
/**
* A constant `Try` that returns `Unit`.
*/
val Unit: Try[Unit] = Try(())
/**
* A constant `Try` that returns `Void`.
*/
val Void: Try[Void] = Try(null: Void)
def apply[R](r: => R): Try[R] = {
try { Return(r) } catch {
case NonFatal(e) => Throw(e)
}
}
/**
* Build a Try from a scala.util.Try. This does nothing
* more than pattern match and translate Success and Failure
* to Return and Throw respectively.
*/
def fromScala[R](tr: scala.util.Try[R]): Try[R] =
tr match {
case Success(r) => Return(r)
case Failure(e) => Throw(e)
}
/**
* Like [[Try.apply]] but allows the caller to specify a handler for fatal
* errors.
*/
def withFatals[R](r: => R)(f: PartialFunction[Throwable, Try[R]]): Try[R] =
try Try(r)
catch {
case e: Throwable if f.isDefinedAt(e) => f(e)
}
/**
* Collect the results from the given Trys into a new Try. The result will be a Throw if any of
* the argument Trys are Throws. The first Throw in the Seq is the one which is surfaced.
*/
def collect[A](ts: Seq[Try[A]]): Try[Seq[A]] = {
if (ts.isEmpty) Return(Seq.empty[A])
else
Try {
ts map { t =>
t()
}
}
}
/**
* Convert an [[scala.Option]] to a [[Try]].
*
* For users from scala, there's also the implicit class [[OrThrow]] which
* allows
*
* {{{
* import Try._
* Option(null).orThrow { new Exception("boom!") }
* }}}
*
* @param o the Option to convert to a Try
* @param failure a function that returns the Throwable that should be
* returned if the option is None
*/
def orThrow[A](o: Option[A])(failure: () => Throwable): Try[A] =
try {
o match {
case Some(item) => Return(item)
case None => Throw(failure())
}
} catch {
case NonFatal(e) => Throw(e)
}
implicit class OrThrow[A](val option: Option[A]) extends AnyVal {
def orThrow(failure: => Throwable): Try[A] = Try.orThrow(option)(() => failure)
}
}
/**
* This class represents a computation that can succeed or fail. It has two
* concrete implementations, Return (for success) and Throw (for failure)
*/
sealed abstract class Try[+R] {
/**
* Convert to a scala.util.Try
*/
def asScala: scala.util.Try[R]
/**
* Returns true if the Try is a Throw, false otherwise.
*/
def isThrow: Boolean
/**
* Returns true if the Try is a Return, false otherwise.
*/
def isReturn: Boolean
/**
* Returns the throwable if this is a Throw, else raises IllegalStateException.
*
* Callers should consult isThrow() prior to calling this method to determine whether
* or not this is a Throw.
*
* This method is intended for Java compatibility. Scala consumers are encouraged to
* pattern match for Throw(t).
*/
def throwable: Throwable
/**
* Returns the value from this Return or the given argument if this is a Throw.
*/
def getOrElse[R2 >: R](default: => R2): R2 = if (isReturn) apply() else default
/**
* Returns the value from this Return or throws the exception if this is a Throw
*/
def apply(): R
/**
* Returns the value from this Return or throws the exception if this is a Throw.
* Alias for apply()
*/
def get(): R = apply()
/**
* Applies the given function f if this is a Result.
*/
def foreach(f: R => Unit): Unit = { onSuccess(f) }
/**
* Returns the given function applied to the value from this Return or returns this if this is a Throw.
*
* ''Note'' The gnarly type parameterization is there for Java compatibility, since Java
* does not support higher-kinded types.
*/
def flatMap[R2](f: R => Try[R2]): Try[R2]
/**
* Maps the given function to the value from this Return or returns this if this is a Throw
*/
def map[X](f: R => X): Try[X]
/**
* Returns true if this Try is a Return and the predicate p returns true when
* applied to its value.
*/
def exists(p: R => Boolean): Boolean
/**
* Converts this to a Throw if the predicate does not obtain.
*/
def filter(p: R => Boolean): Try[R]
/**
* Converts this to a Throw if the predicate does not obtain.
*/
def withFilter(p: R => Boolean): Try[R]
/**
* Calls the exceptionHandler with the exception if this is a Throw. This is like flatMap for the exception.
*
* ''Note'' The gnarly type parameterization is there for Java compatibility, since Java
* does not support higher-kinded types.
*/
def rescue[R2 >: R](rescueException: PartialFunction[Throwable, Try[R2]]): Try[R2]
/**
* Calls the exceptionHandler with the exception if this is a Throw. This is like map for the exception.
*/
def handle[R2 >: R](rescueException: PartialFunction[Throwable, R2]): Try[R2]
/**
* Invoked only if the computation was successful. Returns a
* chained `this` as in `respond`.
*/
def onSuccess(f: R => Unit): Try[R]
/**
* Invoke the function on the error, if the computation was
* unsuccessful. Returns a chained `this` as in `respond`.
*/
def onFailure(rescueException: Throwable => Unit): Try[R]
/**
* Invoked regardless of whether the computation completed
* successfully or unsuccessfully. Implemented in terms of
* `respond` so that subclasses control evaluation order. Returns a
* chained `this` as in `respond`.
*/
def ensure(f: => Unit): Try[R] =
respond { _ =>
f
}
/**
* Returns None if this is a Throw or a Some containing the value if this is a Return
*/
def toOption: Option[R] = if (isReturn) Some(apply()) else None
/**
* Invokes the given closure when the value is available. Returns
* another 'This[R]' that is guaranteed to be available only *after*
* 'k' has run. This enables the enforcement of invocation ordering.
*/
def respond(k: Try[R] => Unit): Try[R] = { k(this); this }
/**
* Invokes the given transformation when the value is available,
* returning the transformed value. This method is like a combination
* of flatMap and rescue. This method is typically used for more
* imperative control-flow than flatMap/rescue which often exploits
* the Null Object Pattern.
*/
def transform[R2](f: Try[R] => Try[R2]): Try[R2] = f(this)
/**
* Returns the given function applied to the value from this Return or returns this if this is a Throw.
* Alias for flatMap
*/
def andThen[R2](f: R => Try[R2]): Try[R2] = flatMap(f)
def flatten[T](implicit ev: R <:< Try[T]): Try[T]
}
object Throw {
private val NotApplied: Throw[Nothing] = Throw[Nothing](null)
private val AlwaysNotApplied: Any => Throw[Nothing] = scala.Function.const(NotApplied) _
}
final case class Throw[+R](e: Throwable) extends Try[R] {
def asScala: scala.util.Try[R] = Failure(e)
def isThrow: Boolean = true
def isReturn: Boolean = false
def throwable: Throwable = e
def rescue[R2 >: R](rescueException: PartialFunction[Throwable, Try[R2]]): Try[R2] = {
try {
val result = rescueException.applyOrElse(e, Throw.AlwaysNotApplied)
if (result eq Throw.NotApplied) this else result
} catch {
case NonFatal(e2) => Throw(e2)
}
}
def apply(): R = throw e
def flatMap[R2](f: R => Try[R2]): Throw[R2] = this.asInstanceOf[Throw[R2]]
def flatten[T](implicit ev: R <:< Try[T]): Try[T] = this.asInstanceOf[Throw[T]]
def map[X](f: R => X): Try[X] = this.asInstanceOf[Throw[X]]
def cast[X]: Try[X] = this.asInstanceOf[Throw[X]]
def exists(p: R => Boolean): Boolean = false
def filter(p: R => Boolean): Throw[R] = this
def withFilter(p: R => Boolean): Throw[R] = this
def onFailure(rescueException: Throwable => Unit): Throw[R] = { rescueException(e); this }
def onSuccess(f: R => Unit): Throw[R] = this
def handle[R2 >: R](rescueException: PartialFunction[Throwable, R2]): Try[R2] =
if (rescueException.isDefinedAt(e)) {
Try(rescueException(e))
} else {
this
}
}
object Return {
val Unit: Return[Unit] = Return(())
val Void: Return[Void] = Return[Void](null)
val None: Return[Option[Nothing]] = Return(Option.empty)
val Nil: Return[Seq[Nothing]] = Return(Seq.empty)
val True: Return[Boolean] = Return(true)
val False: Return[Boolean] = Return(false)
}
final case class Return[+R](r: R) extends Try[R] {
def asScala: scala.util.Try[R] = Success(r)
def isThrow: Boolean = false
def isReturn: Boolean = true
def throwable: Throwable =
throw new IllegalStateException("this Try is not a Throw; did you fail to check isThrow?")
def rescue[R2 >: R](rescueException: PartialFunction[Throwable, Try[R2]]): Try[R2] =
this
def apply(): R = r
def flatMap[R2](f: R => Try[R2]): Try[R2] =
try f(r)
catch { case NonFatal(e) => Throw(e) }
def flatten[T](implicit ev: R <:< Try[T]): Try[T] = r
def map[X](f: R => X): Try[X] =
try Return(f(r))
catch { case NonFatal(e) => Throw(e) }
def exists(p: R => Boolean): Boolean = p(r)
def filter(p: R => Boolean): Try[R] =
if (p(apply())) this else Throw(new Try.PredicateDoesNotObtain)
def withFilter(p: R => Boolean): Try[R] = filter(p)
def onFailure(rescueException: Throwable => Unit): Try[R] = this
def onSuccess(f: R => Unit): Try[R] = { f(r); this }
def handle[R2 >: R](rescueException: PartialFunction[Throwable, R2]): Try[R2] = this
}
| {
"pile_set_name": "Github"
} |
/*
Copyright 2014 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.
*/
package recognizer
import (
"bufio"
"bytes"
"fmt"
"io"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
type RecognizingDecoder interface {
runtime.Decoder
// RecognizesData should return true if the input provided in the provided reader
// belongs to this decoder, or an error if the data could not be read or is ambiguous.
// Unknown is true if the data could not be determined to match the decoder type.
// Decoders should assume that they can read as much of peek as they need (as the caller
// provides) and may return unknown if the data provided is not sufficient to make a
// a determination. When peek returns EOF that may mean the end of the input or the
// end of buffered input - recognizers should return the best guess at that time.
RecognizesData(peek io.Reader) (ok, unknown bool, err error)
}
// NewDecoder creates a decoder that will attempt multiple decoders in an order defined
// by:
//
// 1. The decoder implements RecognizingDecoder and identifies the data
// 2. All other decoders, and any decoder that returned true for unknown.
//
// The order passed to the constructor is preserved within those priorities.
func NewDecoder(decoders ...runtime.Decoder) runtime.Decoder {
return &decoder{
decoders: decoders,
}
}
type decoder struct {
decoders []runtime.Decoder
}
var _ RecognizingDecoder = &decoder{}
func (d *decoder) RecognizesData(peek io.Reader) (bool, bool, error) {
var (
lastErr error
anyUnknown bool
)
data, _ := bufio.NewReaderSize(peek, 1024).Peek(1024)
for _, r := range d.decoders {
switch t := r.(type) {
case RecognizingDecoder:
ok, unknown, err := t.RecognizesData(bytes.NewBuffer(data))
if err != nil {
lastErr = err
continue
}
anyUnknown = anyUnknown || unknown
if !ok {
continue
}
return true, false, nil
}
}
return false, anyUnknown, lastErr
}
func (d *decoder) Decode(data []byte, gvk *schema.GroupVersionKind, into runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
var (
lastErr error
skipped []runtime.Decoder
)
// try recognizers, record any decoders we need to give a chance later
for _, r := range d.decoders {
switch t := r.(type) {
case RecognizingDecoder:
buf := bytes.NewBuffer(data)
ok, unknown, err := t.RecognizesData(buf)
if err != nil {
lastErr = err
continue
}
if unknown {
skipped = append(skipped, t)
continue
}
if !ok {
continue
}
return r.Decode(data, gvk, into)
default:
skipped = append(skipped, t)
}
}
// try recognizers that returned unknown or didn't recognize their data
for _, r := range skipped {
out, actual, err := r.Decode(data, gvk, into)
if err != nil {
lastErr = err
continue
}
return out, actual, nil
}
if lastErr == nil {
lastErr = fmt.Errorf("no serialization format matched the provided data")
}
return nil, nil, lastErr
}
| {
"pile_set_name": "Github"
} |
// RUN: %dafny /compile:0 "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
class Queue<T(0)> {
var head: Node<T>;
var tail: Node<T>;
ghost var contents: seq<T>;
ghost var footprint: set<object>;
ghost var spine: set<Node<T>>;
function Valid(): bool
reads this, footprint;
{
this in footprint && spine <= footprint &&
head in spine &&
tail in spine &&
tail.next == null &&
(forall n ::
n in spine ==>
n.footprint <= footprint && this !in n.footprint &&
n.Valid() &&
(n.next == null ==> n == tail)) &&
(forall n ::
n in spine ==>
n.next != null ==> n.next in spine) &&
contents == head.tailContents
}
constructor Init()
ensures Valid() && fresh(footprint - {this});
ensures |contents| == 0;
{
var n := new Node<T>.Init();
head := n;
tail := n;
contents := n.tailContents;
footprint := {this} + n.footprint;
spine := {n};
}
method IsEmpty() returns (isEmpty: bool)
requires Valid();
ensures isEmpty <==> |contents| == 0;
{
isEmpty := head == tail;
}
method Enqueue(t: T)
requires Valid();
modifies footprint;
ensures Valid() && fresh(footprint - old(footprint));
ensures contents == old(contents) + [t];
{
var n := new Node<T>.Init();
n.data := t;
tail.next := n;
tail := n;
forall m | m in spine {
m.tailContents := m.tailContents + [t];
}
contents := head.tailContents;
forall m | m in spine {
m.footprint := m.footprint + n.footprint;
}
footprint := footprint + n.footprint;
spine := spine + {n};
}
method Front() returns (t: T)
requires Valid();
requires 0 < |contents|;
ensures t == contents[0];
{
t := head.next.data;
}
method Dequeue()
requires Valid();
requires 0 < |contents|;
modifies footprint;
ensures Valid() && fresh(footprint - old(footprint));
ensures contents == old(contents)[1..];
{
var n := head.next;
head := n;
contents := n.tailContents;
}
method Rotate()
requires Valid();
requires 0 < |contents|;
modifies footprint;
ensures Valid() && fresh(footprint - old(footprint));
ensures contents == old(contents)[1..] + old(contents)[..1];
{
var t := Front();
Dequeue();
Enqueue(t);
}
method RotateAny()
requires Valid();
requires 0 < |contents|;
modifies footprint;
ensures Valid() && fresh(footprint - old(footprint));
ensures |contents| == |old(contents)|;
ensures (exists i :: 0 <= i && i <= |contents| &&
contents == old(contents)[i..] + old(contents)[..i]);
{
var t := Front();
Dequeue();
Enqueue(t);
}
}
class Node<T(0)> {
var data: T;
var next: Node?<T>;
ghost var tailContents: seq<T>;
ghost var footprint: set<object>;
function Valid(): bool
reads this, footprint;
{
this in footprint &&
(next != null ==> next in footprint && next.footprint <= footprint) &&
(next == null ==> tailContents == []) &&
(next != null ==> tailContents == [next.data] + next.tailContents)
}
constructor Init()
ensures Valid() && fresh(footprint - {this});
ensures next == null;
{
next := null;
tailContents := [];
footprint := {this};
}
}
class Main<U(0)> {
method A<T(0)>(t: T, u: T, v: T)
{
var q0 := new Queue<T>.Init();
var q1 := new Queue<T>.Init();
q0.Enqueue(t);
q0.Enqueue(u);
q1.Enqueue(v);
assert |q0.contents| == 2;
var w := q0.Front();
assert w == t;
q0.Dequeue();
w := q0.Front();
assert w == u;
assert |q0.contents| == 1;
assert |q1.contents| == 1;
}
method Main2(t: U, u: U, v: U, q0: Queue<U>, q1: Queue<U>)
requires q0.Valid();
requires q1.Valid();
requires q0.footprint !! q1.footprint;
requires |q0.contents| == 0;
modifies q0.footprint, q1.footprint;
ensures fresh(q0.footprint - old(q0.footprint));
ensures fresh(q1.footprint - old(q1.footprint));
{
q0.Enqueue(t);
q0.Enqueue(u);
q1.Enqueue(v);
assert |q0.contents| == 2;
var w := q0.Front();
assert w == t;
q0.Dequeue();
w := q0.Front();
assert w == u;
assert |q0.contents| == 1;
assert |q1.contents| == old(|q1.contents|) + 1;
}
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* Locale data for 'bem_ZM'.
*
* This file is automatically generated by yiic cldr command.
*
* Copyright © 1991-2013 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
*
* @copyright 2008-2014 Yii Software LLC (http://www.yiiframework.com/license/)
*/
return array (
'version' => '8245',
'numberSymbols' =>
array (
'decimal' => '.',
'group' => ',',
'list' => ';',
'percentSign' => '%',
'plusSign' => '+',
'minusSign' => '-',
'exponential' => 'E',
'perMille' => '‰',
'infinity' => '∞',
'nan' => 'NaN',
),
'decimalFormat' => '#,##0.###',
'scientificFormat' => '#E0',
'percentFormat' => '#,##0%',
'currencyFormat' => '¤#,##0.00;(¤#,##0.00)',
'currencySymbols' =>
array (
'AUD' => 'A$',
'BRL' => 'R$',
'CAD' => 'CA$',
'CNY' => 'CN¥',
'EUR' => '€',
'GBP' => '£',
'HKD' => 'HK$',
'ILS' => '₪',
'INR' => '₹',
'JPY' => 'JP¥',
'KRW' => '₩',
'MXN' => 'MX$',
'NZD' => 'NZ$',
'THB' => '฿',
'TWD' => 'NT$',
'USD' => 'US$',
'VND' => '₫',
'XAF' => 'FCFA',
'XCD' => 'EC$',
'XOF' => 'CFA',
'XPF' => 'CFPF',
'ZMK' => 'K',
'ZMW' => 'KR',
),
'monthNames' =>
array (
'wide' =>
array (
1 => 'Januari',
2 => 'Februari',
3 => 'Machi',
4 => 'Epreo',
5 => 'Mei',
6 => 'Juni',
7 => 'Julai',
8 => 'Ogasti',
9 => 'Septemba',
10 => 'Oktoba',
11 => 'Novemba',
12 => 'Disemba',
),
'abbreviated' =>
array (
1 => 'Jan',
2 => 'Feb',
3 => 'Mac',
4 => 'Epr',
5 => 'Mei',
6 => 'Jun',
7 => 'Jul',
8 => 'Oga',
9 => 'Sep',
10 => 'Okt',
11 => 'Nov',
12 => 'Dis',
),
),
'monthNamesSA' =>
array (
'narrow' =>
array (
1 => 'J',
2 => 'F',
3 => 'M',
4 => 'E',
5 => 'M',
6 => 'J',
7 => 'J',
8 => 'O',
9 => 'S',
10 => 'O',
11 => 'N',
12 => 'D',
),
),
'weekDayNames' =>
array (
'wide' =>
array (
0 => 'Pa Mulungu',
1 => 'Palichimo',
2 => 'Palichibuli',
3 => 'Palichitatu',
4 => 'Palichine',
5 => 'Palichisano',
6 => 'Pachibelushi',
),
'abbreviated' =>
array (
0 => 'Sun',
1 => 'Mon',
2 => 'Tue',
3 => 'Wed',
4 => 'Thu',
5 => 'Fri',
6 => 'Sat',
),
),
'weekDayNamesSA' =>
array (
'narrow' =>
array (
0 => 'S',
1 => 'M',
2 => 'T',
3 => 'W',
4 => 'T',
5 => 'F',
6 => 'S',
),
),
'eraNames' =>
array (
'abbreviated' =>
array (
0 => 'BC',
1 => 'AD',
),
'wide' =>
array (
0 => 'Before Yesu',
1 => 'After Yesu',
),
'narrow' =>
array (
0 => 'BC',
1 => 'AD',
),
),
'dateFormats' =>
array (
'full' => 'EEEE, d MMMM y',
'long' => 'd MMMM y',
'medium' => 'd MMM y',
'short' => 'dd/MM/y',
),
'timeFormats' =>
array (
'full' => 'h:mm:ss a zzzz',
'long' => 'h:mm:ss a z',
'medium' => 'h:mm:ss a',
'short' => 'h:mm a',
),
'dateTimeFormat' => '{1} {0}',
'amName' => 'uluchelo',
'pmName' => 'akasuba',
'orientation' => 'ltr',
'languages' =>
array (
'ak' => 'Ichi Akan',
'am' => 'Ichi Amhari',
'ar' => 'Ichi Arab',
'be' => 'Ichi Belarus',
'bem' => 'Ichibemba',
'bg' => 'Ichi Bulgariani',
'bn' => 'Ichi Bengali',
'cs' => 'Ichi Cheki',
'de' => 'Ichi Jemani',
'el' => 'Ichi Griki',
'en' => 'Ichi Sungu',
'es' => 'Ichi Spanishi',
'fa' => 'Ichi Pesia',
'fr' => 'Ichi Frenchi',
'ha' => 'Ichi Hausa',
'hi' => 'Ichi Hindu',
'hu' => 'Ichi Hangarian',
'id' => 'Ichi Indonesiani',
'ig' => 'Ichi Ibo',
'it' => 'Ichi Italiani',
'ja' => 'Ichi Japanisi',
'jv' => 'Ichi Javanisi',
'km' => 'Ichi Khmer',
'ko' => 'Ichi Koriani',
'ms' => 'Ichi Maleshani',
'my' => 'Ichi Burma',
'ne' => 'Ichi Nepali',
'nl' => 'Ichi Dachi',
'pa' => 'Ichi Punjabi',
'pl' => 'Ichi Polishi',
'pt' => 'Ichi Potogisi',
'ro' => 'Ichi Romaniani',
'ru' => 'Ichi Rusiani',
'rw' => 'Ichi Rwanda',
'so' => 'Ichi Somalia',
'sv' => 'Ichi Swideni',
'ta' => 'Ichi Tamil',
'th' => 'Ichi Thai',
'tr' => 'Ichi Takishi',
'uk' => 'Ichi Ukraniani',
'ur' => 'Ichi Urudu',
'vi' => 'Ichi Vietinamu',
'yo' => 'Ichi Yoruba',
'zh' => 'Ichi Chainisi',
'zu' => 'Ichi Zulu',
),
'territories' =>
array (
'zm' => 'Zambia',
),
'pluralRules' =>
array (
0 => 'n==1',
1 => 'true',
),
);
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2020 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.
*/
/**
* External dependencies
*/
import { useCallback, useMemo, useReducer } from 'react';
import queryString from 'query-string';
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import settingsReducer, {
defaultSettingsState,
ACTION_TYPES as SETTINGS_ACTION_TYPES,
} from '../reducer/settings';
export default function useSettingsApi(
dataAdapter,
{ globalStoriesSettingsApi }
) {
const [state, dispatch] = useReducer(settingsReducer, defaultSettingsState);
const fetchSettings = useCallback(async () => {
if (!globalStoriesSettingsApi) {
dispatch({
type: SETTINGS_ACTION_TYPES.FETCH_SETTINGS_FAILURE,
payload: {
message: {
body: __('Cannot connect to data source', 'web-stories'),
title: __('Unable to find settings data', 'web-stories'),
},
},
});
}
try {
const response = await dataAdapter.get(
queryString.stringifyUrl({
url: globalStoriesSettingsApi,
})
);
dispatch({
type: SETTINGS_ACTION_TYPES.FETCH_SETTINGS_SUCCESS,
payload: {
googleAnalyticsId: response.web_stories_ga_tracking_id,
activePublisherLogoId: response.web_stories_active_publisher_logo,
publisherLogoIds: response.web_stories_publisher_logos,
},
});
} catch (err) {
dispatch({
type: SETTINGS_ACTION_TYPES.FETCH_SETTINGS_FAILURE,
payload: {
message: {
body: err.message,
title: __('Unable to find settings data', 'web-stories'),
},
},
});
}
}, [dataAdapter, globalStoriesSettingsApi]);
const updateSettings = useCallback(
async ({
googleAnalyticsId,
publisherLogoIds,
publisherLogoIdToRemove,
publisherLogoToMakeDefault,
}) => {
try {
const query = {};
if (googleAnalyticsId !== undefined) {
query.web_stories_ga_tracking_id = googleAnalyticsId;
}
if (publisherLogoIds) {
query.web_stories_publisher_logos = [
...new Set([...state.publisherLogoIds, ...publisherLogoIds]),
];
}
if (publisherLogoIdToRemove) {
query.web_stories_publisher_logos = state.publisherLogoIds.filter(
(logoId) => logoId !== publisherLogoIdToRemove
);
}
if (publisherLogoToMakeDefault) {
query.web_stories_active_publisher_logo = publisherLogoToMakeDefault;
}
const response = await dataAdapter.post(
queryString.stringifyUrl({
url: globalStoriesSettingsApi,
query,
})
);
dispatch({
type: SETTINGS_ACTION_TYPES.UPDATE_SETTINGS_SUCCESS,
payload: {
googleAnalyticsId: response.web_stories_ga_tracking_id,
activePublisherLogoId: response.web_stories_active_publisher_logo,
publisherLogoIds: response.web_stories_publisher_logos,
},
});
} catch (err) {
dispatch({
type: SETTINGS_ACTION_TYPES.UPDATE_SETTINGS_FAILURE,
payload: {
message: {
body: err.message,
title: __('Unable to update settings data', 'web-stories'),
},
},
});
}
},
[dataAdapter, globalStoriesSettingsApi, state.publisherLogoIds]
);
const api = useMemo(
() => ({
fetchSettings,
updateSettings,
}),
[fetchSettings, updateSettings]
);
return { settings: state, api };
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en" target-language="ru" original="../ProgressDialog.resx">
<body>
<trans-unit id="$this.Text">
<source>ProgressDialog</source>
<target state="translated">ProgressDialog</target>
<note />
</trans-unit>
<trans-unit id="ButtonCloseDialog.Text">
<source>&Cancel</source>
<target state="translated">&Отмена</target>
<note />
</trans-unit>
<trans-unit id="LabelInfo.Text">
<source>Progress Dialog</source>
<target state="translated">Индикатор выполнения</target>
<note />
</trans-unit>
</body>
</file>
</xliff> | {
"pile_set_name": "Github"
} |
require_relative '../../spec_helper'
describe "Range" do
it "includes Enumerable" do
Range.include?(Enumerable).should == true
end
end
| {
"pile_set_name": "Github"
} |
fn main() {
// Statements here are executed when the compiled binary is called
// Print text to the console
println!("Hello World!");
let mut a;
let mut b=1;
let mut vec = Vec::new();
vec.push(1);
vec.push(2);
for x in 5..10 - 5 {
a = x;
}
}
| {
"pile_set_name": "Github"
} |
# sphere on glossy floor
options
{
width 512
height 512
clamp 4.0
}
camera
{
position 0.0 1.0 15.0
target 0.0 0.0 0.0
}
material light
{
emission 30.0 30.0 30.0
color 0 0 0
specular 0
roughness 1
metallic 0
}
material gloss
{
color 0.1 0.1 0.1
specular 0.5
roughness 0.01
metallic 0.9
}
material red
{
color 0.9 0.1 0.1
specular 0
roughness 0.8
metallic 0
}
material green
{
color 0.1 0.9 0.1
specular 0
roughness 0.8
metallic 0
}
material blue
{
color 0.1 0.1 0.9
specular 0
roughness 0.8
metallic 0
}
primitive
{
type plane
plane 0 1 0 0
material gloss
}
primitive
{
type sphere
radius 1.0
position -2.5 1.0 0
material red
}
primitive
{
type sphere
radius 1.0
position 0 1.0 0
material green
}
primitive
{
type sphere
radius 1.0
position 2.5 1.0 0
material blue
}
primitive
{
type sphere
radius 1.0
position 0 6.0 5
lightSamples 1
material light
}
| {
"pile_set_name": "Github"
} |
import { OnDestroy, OnInit } from '@angular/core';
import { BreadcrumbService } from '../../client/v1/breadcrumb.service';
import { ActivatedRoute } from '@angular/router';
import { ClrDatagridStateInterface } from '@clr/angular';
import { ConfirmationDialogService } from '../../confirmation-dialog/confirmation-dialog.service';
import { ConfirmationMessage } from '../../confirmation-dialog/confirmation-message';
import { ConfirmationButtons, ConfirmationState, ConfirmationTargets } from '../../shared.const';
import { Subscription } from 'rxjs/Subscription';
import { MessageHandlerService } from '../../message-handler/message-handler.service';
import { PageState } from '../../page/page-state';
import { CreateEditResourceTemplateComponent } from './create-edit-resource-template';
import { ListResourceTemplateComponent } from './list-resource-template';
import { isNotEmpty } from '../../utils';
export class ResourceTemplateComponent implements OnInit, OnDestroy {
// @ViewChild(CreateEditResourceTemplateComponent)
listResourceTemplateComponent: ListResourceTemplateComponent;
// @ViewChild(CreateEditResourceTemplateComponent)
createEditResourceTemplateComponent: CreateEditResourceTemplateComponent;
pageState: PageState = new PageState({pageSize: 10});
templates: any[];
resourceId: string;
// componentName = 'Ingress 模板';
subscription: Subscription;
constructor(
public breadcrumbService: BreadcrumbService,
public route: ActivatedRoute,
public resourceTemplateService: any,
public messageHandlerService: MessageHandlerService,
public deletionDialogService: ConfirmationDialogService,
public componentName: string,
public resourceType: string,
public confirmationTargets: ConfirmationTargets) {
this.subscription = deletionDialogService.confirmationConfirm$.subscribe(message => {
if (message &&
message.state === ConfirmationState.CONFIRMED &&
message.source === confirmationTargets) {
const id = message.data;
this.resourceTemplateService.deleteById(id, 0)
.subscribe(
response => {
this.messageHandlerService.showSuccess(`${this.componentName}删除成功!`);
this.retrieve();
},
error => {
this.messageHandlerService.handleError(error);
}
);
}
});
}
ngOnInit() {
this.route.params.subscribe(params => {
this.resourceId = params['gid'];
if (typeof (this.resourceId) === 'undefined') {
this.resourceId = '';
}
});
}
ngOnDestroy(): void {
if (this.subscription) {
this.subscription.unsubscribe();
}
}
retrieve(state?: ClrDatagridStateInterface): void {
if (state) {
this.pageState =
PageState.fromState(state, {pageSize: 10, totalPage: this.pageState.page.totalPage, totalCount: this.pageState.page.totalCount});
}
this.pageState.params['deleted'] = false;
if (this.route.snapshot.queryParams) {
Object.getOwnPropertyNames(this.route.snapshot.queryParams).map(key => {
const value = this.route.snapshot.queryParams[key];
if (isNotEmpty(value)) {
this.pageState.filters[key] = value;
}
});
}
this.resourceTemplateService.listPage(this.pageState, 0, this.resourceId)
.subscribe(
response => {
const data = response.data;
this.pageState.page.totalPage = data.totalPage;
this.pageState.page.totalCount = data.totalCount;
this.templates = data.list;
},
error => this.messageHandlerService.handleError(error)
);
}
createResourceTemplate(created: boolean) {
if (created) {
this.retrieve();
}
}
openModal(): void {
this.createEditResourceTemplateComponent.newOrEditResourceTemplate();
}
deleteResourceTemplate(template: any) {
const deletionMessage = new ConfirmationMessage(
`删除 ${this.componentName}确认`,
`你确认删除 ${this.componentName}` + template.name + ' ?',
template.id,
this.confirmationTargets,
ConfirmationButtons.DELETE_CANCEL
);
this.deletionDialogService.openComfirmDialog(deletionMessage);
}
editResourceTemplate(template: any) {
this.createEditResourceTemplateComponent.newOrEditResourceTemplate(template.id);
}
}
| {
"pile_set_name": "Github"
} |
reviewers:
- brendandburns
- smarterclayton
- thockin
approvers:
- brendandburns
- smarterclayton
- thockin
- pwittrock | {
"pile_set_name": "Github"
} |
.modal.fade#description-edit{ 'tabindex': '-1', role: 'dialog' }
.modal-dialog{ role: 'document' }
.modal-content
.modal-header
%h5.modal-title Edit Kiwi Details
#flash-messages
%p.ui-state-error.alert-danger.p-3.mb-0.d-none
Kiwi Image name cannot be empty!
.modal-body
.dialog
= f.label :name
= f.text_field :name, data: { default: f.object.name }, class: 'form-control'
= f.fields_for :description, f.object.description do |description_fields|
= description_fields.label :author
= description_fields.text_field :author, data: { default: description_fields.object.author }, class: 'form-control'
= description_fields.label :contact
= description_fields.text_field :contact, data: { default: description_fields.object.contact }, class: 'form-control'
= description_fields.label :specification
= description_fields.text_field :specification, data: { default: description_fields.object.specification }, class: 'form-control'
.modal-footer
%a.btn.btn-sm.btn-outline-danger.px-4{ data: { dismiss: 'modal' } }
Cancel
= link_to('Continue', '#', title: 'Continue', class: 'btn btn-sm btn-primary px-4 close-description-dialog')
| {
"pile_set_name": "Github"
} |
#ifndef LE_SPECS_H
#define LE_SPECS_H
#include <r_types.h>
typedef enum {
UNUSED_ENTRY = 0,
ENTRY16,
CALLGATE,
ENTRY32,
FORWARDER,
} LE_entry_bundle_type;
typedef enum {
LE_RT_POINTER = 1, /* mouse pointer shape */
LE_RT_BITMAP = 2, /* bitmap */
LE_RT_MENU = 3, /* menu template */
LE_RT_DIALOG = 4, /* dialog template */
LE_RT_STRING = 5, /* string tables */
LE_RT_FONTDIR = 6, /* font directory */
LE_RT_FONT = 7, /* font */
LE_RT_ACCELTABLE = 8, /* accelerator tables */
LE_RT_RCDATA = 9, /* binary data */
LE_RT_MESSAGE = 10, /* error msg tables */
LE_RT_DLGINCLUDE = 11, /* dialog include file name */
LE_RT_VKEYTBL = 12, /* key to vkey tables */
LE_RT_KEYTBL = 13, /* key to UGL tables */
LE_RT_CHARTBL = 14, /* glyph to character tables */
LE_RT_DISPLAYINFO = 15, /* screen display information */
LE_RT_FKASHORT = 16, /* function key area short form */
LE_RT_FKALONG = 17, /* function key area long form */
LE_RT_HELPTABLE = 18, /* Help table for Cary Help manager */
LE_RT_HELPSUBTABLE = 19, /* Help subtable for Cary Help manager */
LE_RT_FDDIR = 20, /* DBCS uniq/font driver directory */
LE_RT_FD = 21, /* DBCS uniq/font driver */
} LE_resource_type;
// This bit signifies that additional information is contained in the linear EXE module
// and will be used in the future for parameter type checking.
#define ENTRY_PARAMETER_TYPING_PRESENT 0x80
typedef struct LE_entry_bundle_header_s {
ut8 count;
ut8 type; /* LE_entry_bundle_type */
ut16 objnum; // This is the object number for the entries in this bundle.
} LE_entry_bundle_header;
#define ENTRY_EXPORTED 0x01
#define ENTRY_PARAM_COUNT_MASK 0xF8
R_PACKED (typedef union LE_entry_bundle_entry_u {
R_PACKED (struct {
ut8 flags; // First bit set if exported, mask with 0xF8 to get parameters count
ut16 offset; // This is the offset in the object for the entry point defined at this ordinal number.
}) entry_16;
R_PACKED (struct {
ut8 flags; // First bit set if exported, mask with 0xF8 to get parameters count
ut16 offset; // This is the offset in the object for the entry point defined at this ordinal number.
ut16 callgate_sel; // The callgate selector for references to ring 2 entry points.
}) callgate;
R_PACKED (struct {
ut8 flags; // First bit set if exported, mask with 0xF8 to get parameters count
ut32 offset; // This is the offset in the object for the entry point defined at this ordinal number.
}) entry_32;
R_PACKED (struct {
ut8 flags; // First bit set if import by ordinal
ut16 import_ord; // This is the index into the Import Module Name Table for this forwarder.
ut32 offset; // If import by ordinal, is the ordinal number into the Entry Table of the target module, else is the offset into the Procedure Names Table of the target module.
}) forwarder;
}) LE_entry_bundle_entry;
#define F_SOURCE_TYPE_MASK 0xF
#define F_SOURCE_ALIAS 0x10
#define F_SOURCE_LIST 0x20
typedef enum {
BYTEFIXUP,
UNDEFINED1,
SELECTOR16,
POINTER32, // 16:16
UNDEFINED2,
OFFSET16,
POINTER48, // 16:32
OFFSET32,
SELFOFFSET32,
} LE_fixup_source_type;
#define F_TARGET_TYPE_MASK 0x3
#define F_TARGET_ADDITIVE 0x4
#define F_TARGET_CHAIN 0x8
#define F_TARGET_OFF32 0x10 // Else 16
#define F_TARGET_ADD32 0x20 // Else 16
#define F_TARGET_ORD16 0x40 // Else 8
#define F_TARGET_ORD8 0x80 // Else 16
typedef enum {
INTERNAL,
IMPORTORD,
IMPORTNAME,
INTERNALENTRY
} LE_fixup_record_type;
typedef struct LE_fixup_record_header_s {
ut8 source;
ut8 target;
} LE_fixup_record_header;
#define O_READABLE 1
#define O_WRITABLE 1 << 1
#define O_EXECUTABLE 1 << 2
#define O_RESOURCE 1 << 3
#define O_DISCARTABLE 1 << 4
#define O_SHARED 1 << 5
#define O_PRELOAD 1 << 6
#define O_INVALID 1 << 7
#define O_ZEROED 1 << 8
#define O_RESIDENT 1 << 9
#define O_CONTIGUOUS O_RESIDENT | O_ZEROED
#define O_LOCKABLE 1 << 10
#define O_RESERVED 1 << 11
#define O_ALIASED 1 << 12
#define O_BIG_BIT 1 << 13
#define O_CODE 1 << 14
#define O_IO_PRIV 1 << 15
typedef struct LE_object_entry_s {
ut32 virtual_size;
ut32 reloc_base_addr;
ut32 flags;
ut32 page_tbl_idx; // This specifies the number of the first object page table entry for this object
ut32 page_tbl_entries;
ut32 reserved;
} LE_object_entry;
#define P_LEGAL 0
#define P_ITERATED 1
#define P_INVALID 2
#define P_ZEROED 3
#define P_RANGE 4
#define P_COMPRESSED 5
typedef struct LE_object_page_entry_s {
ut32 offset; // 0 if zero-filled/invalid page (check flags)
ut16 size;
ut16 flags;
} LE_object_page_entry;
#define M_PP_LIB_INIT 1 << 2
#define M_SYS_DLL 1 << 3 // No internal fixups
#define M_INTERNAL_FIXUP 1 << 4
#define M_EXTERNAL_FIXUP 1 << 5
#define M_PM_WINDOWING_INCOMP 1 << 8 // Fullscreen only
#define M_PM_WINDOWING_COMPAT 1 << 9
#define M_USES_PM_WINDOWING M_PM_WINDOWING_INCOMP | M_PM_WINDOWING_COMPAT
#define M_NOT_LOADABLE 1 << 13
#define M_TYPE_MASK 0x38000
#define M_TYPE_EXE 0
#define M_TYPE_DLL 0x08000
#define M_TYPE_PM_DLL 0x10000
#define M_TYPE_PDD 0x20000 // Physical Device Driver
#define M_TYPE_VDD 0x28000 // Virtual Device Driver
#define M_MP_UNSAFE 1 << 19
#define M_PP_LIB_TERM 1 << 30
typedef struct LE_image_header_s { /* New 32-bit .EXE header */
ut8 magic[2]; /* Magic number MAGIC */
ut8 border; /* The byte ordering for the .EXE */
ut8 worder; /* The word ordering for the .EXE */
ut32 level; /* The EXE format level for now = 0 */
ut16 cpu; /* The CPU type */
ut16 os; /* The OS type */
ut32 ver; /* Module version */
ut32 mflags; /* Module flags */
ut32 mpages; /* Module # pages */
ut32 startobj; /* Object # for instruction pointer */
ut32 eip; /* Extended instruction pointer */
ut32 stackobj; /* Object # for stack pointer */
ut32 esp; /* Extended stack pointer */
ut32 pagesize; /* .EXE page size */
ut32 pageshift; /* Page alignment shift in .EXE or Last Page Size (on LE only)*/
ut32 fixupsize; /* Fixup section size */
ut32 fixupsum; /* Fixup section checksum */
ut32 ldrsize; /* Loader section size */
ut32 ldrsum; /* Loader section checksum */
ut32 objtab; /* Object table offset */
ut32 objcnt; /* Number of objects in module */
ut32 objmap; /* Object page map offset */
ut32 itermap; /* Object iterated data map offset (File Relative) */
ut32 rsrctab; /* Offset of Resource Table */
ut32 rsrccnt; /* Number of resource entries */
ut32 restab; /* Offset of resident name table */
ut32 enttab; /* Offset of Entry Table */
ut32 dirtab; /* Offset of Module Directive Table */
ut32 dircnt; /* Number of module directives */
ut32 fpagetab; /* Offset of Fixup Page Table */
ut32 frectab; /* Offset of Fixup Record Table */
ut32 impmod; /* Offset of Import Module Name Table */
ut32 impmodcnt; /* Number of entries in Import Module Name Table */
ut32 impproc; /* Offset of Import Procedure Name Table */
ut32 pagesum; /* Offset of Per-Page Checksum Table */
ut32 datapage; /* Offset of Enumerated Data Pages (File Relative) */
ut32 preload; /* Number of preload pages */
ut32 nrestab; /* Offset of Non-resident Names Table (File Relative) */
ut32 cbnrestab; /* Size of Non-resident Name Table */
ut32 nressum; /* Non-resident Name Table Checksum */
ut32 autodata; /* Object # for automatic data object */
ut32 debuginfo; /* Offset of the debugging information */
ut32 debuglen; /* The length of the debugging info. in bytes */
ut32 instpreload; /* Number of instance pages in preload section of .EXE file */
ut32 instdemand; /* Number of instance pages in demand load section of EXE file */
ut32 heapsize; /* Size of heap - for 16-bit apps */
ut32 stacksize; /* Size of stack */
} LE_image_header;
#endif
| {
"pile_set_name": "Github"
} |
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2019, Daniel Stenberg, <[email protected]>, 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 https://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.
*
***************************************************************************/
#include "tool_setup.h"
#include "slist_wc.h"
#ifndef CURL_DISABLE_LIBCURL_OPTION
#define ENABLE_CURLX_PRINTF
/* use our own printf() functions */
#include "curlx.h"
#include "tool_cfgable.h"
#include "tool_easysrc.h"
#include "tool_msgs.h"
#include "memdebug.h" /* keep this as LAST include */
/* global variable definitions, for easy-interface source code generation */
struct slist_wc *easysrc_decl = NULL; /* Variable declarations */
struct slist_wc *easysrc_data = NULL; /* Build slists, forms etc. */
struct slist_wc *easysrc_code = NULL; /* Setopt calls */
struct slist_wc *easysrc_toohard = NULL; /* Unconvertible setopt */
struct slist_wc *easysrc_clean = NULL; /* Clean up allocated data */
int easysrc_mime_count = 0;
int easysrc_slist_count = 0;
static const char *const srchead[]={
"/********* Sample code generated by the curl command line tool **********",
" * All curl_easy_setopt() options are documented at:",
" * https://curl.haxx.se/libcurl/c/curl_easy_setopt.html",
" ************************************************************************/",
"#include <curl/curl.h>",
"",
"int main(int argc, char *argv[])",
"{",
" CURLcode ret;",
" CURL *hnd;",
NULL
};
/* easysrc_decl declarations come here */
/* easysrc_data initialisations come here */
/* easysrc_code statements come here */
static const char *const srchard[]={
"/* Here is a list of options the curl code used that cannot get generated",
" as source easily. You may select to either not use them or implement",
" them yourself.",
"",
NULL
};
static const char *const srcend[]={
"",
" return (int)ret;",
"}",
"/**** End of sample code ****/",
NULL
};
/* Clean up all source code if we run out of memory */
static void easysrc_free(void)
{
slist_wc_free_all(easysrc_decl);
easysrc_decl = NULL;
slist_wc_free_all(easysrc_data);
easysrc_data = NULL;
slist_wc_free_all(easysrc_code);
easysrc_code = NULL;
slist_wc_free_all(easysrc_toohard);
easysrc_toohard = NULL;
slist_wc_free_all(easysrc_clean);
easysrc_clean = NULL;
}
/* Add a source line to the main code or remarks */
CURLcode easysrc_add(struct slist_wc **plist, const char *line)
{
CURLcode ret = CURLE_OK;
struct slist_wc *list = slist_wc_append(*plist, line);
if(!list) {
easysrc_free();
ret = CURLE_OUT_OF_MEMORY;
}
else
*plist = list;
return ret;
}
CURLcode easysrc_addf(struct slist_wc **plist, const char *fmt, ...)
{
CURLcode ret;
char *bufp;
va_list ap;
va_start(ap, fmt);
bufp = curlx_mvaprintf(fmt, ap);
va_end(ap);
if(! bufp) {
ret = CURLE_OUT_OF_MEMORY;
}
else {
ret = easysrc_add(plist, bufp);
curl_free(bufp);
}
return ret;
}
#define CHKRET(v) do {CURLcode ret = (v); if(ret) return ret;} while(0)
CURLcode easysrc_init(void)
{
CHKRET(easysrc_add(&easysrc_code,
"hnd = curl_easy_init();"));
return CURLE_OK;
}
CURLcode easysrc_perform(void)
{
/* Note any setopt calls which we could not convert */
if(easysrc_toohard) {
int i;
struct curl_slist *ptr;
const char *c;
CHKRET(easysrc_add(&easysrc_code, ""));
/* Preamble comment */
for(i = 0; ((c = srchard[i]) != NULL); i++)
CHKRET(easysrc_add(&easysrc_code, c));
/* Each unconverted option */
if(easysrc_toohard) {
for(ptr = easysrc_toohard->first; ptr; ptr = ptr->next)
CHKRET(easysrc_add(&easysrc_code, ptr->data));
}
CHKRET(easysrc_add(&easysrc_code, ""));
CHKRET(easysrc_add(&easysrc_code, "*/"));
slist_wc_free_all(easysrc_toohard);
easysrc_toohard = NULL;
}
CHKRET(easysrc_add(&easysrc_code, ""));
CHKRET(easysrc_add(&easysrc_code, "ret = curl_easy_perform(hnd);"));
CHKRET(easysrc_add(&easysrc_code, ""));
return CURLE_OK;
}
CURLcode easysrc_cleanup(void)
{
CHKRET(easysrc_add(&easysrc_code, "curl_easy_cleanup(hnd);"));
CHKRET(easysrc_add(&easysrc_code, "hnd = NULL;"));
return CURLE_OK;
}
void dumpeasysrc(struct GlobalConfig *config)
{
struct curl_slist *ptr;
char *o = config->libcurl;
FILE *out;
bool fopened = FALSE;
if(strcmp(o, "-")) {
out = fopen(o, FOPEN_WRITETEXT);
fopened = TRUE;
}
else
out = stdout;
if(!out)
warnf(config, "Failed to open %s to write libcurl code!\n", o);
else {
int i;
const char *c;
for(i = 0; ((c = srchead[i]) != NULL); i++)
fprintf(out, "%s\n", c);
/* Declare variables used for complex setopt values */
if(easysrc_decl) {
for(ptr = easysrc_decl->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
/* Set up complex values for setopt calls */
if(easysrc_data) {
fprintf(out, "\n");
for(ptr = easysrc_data->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
fprintf(out, "\n");
if(easysrc_code) {
for(ptr = easysrc_code->first; ptr; ptr = ptr->next) {
if(ptr->data[0]) {
fprintf(out, " %s\n", ptr->data);
}
else {
fprintf(out, "\n");
}
}
}
if(easysrc_clean) {
for(ptr = easysrc_clean->first; ptr; ptr = ptr->next)
fprintf(out, " %s\n", ptr->data);
}
for(i = 0; ((c = srcend[i]) != NULL); i++)
fprintf(out, "%s\n", c);
if(fopened)
fclose(out);
}
easysrc_free();
}
#endif /* CURL_DISABLE_LIBCURL_OPTION */
| {
"pile_set_name": "Github"
} |
{
"id": "pineapple-bed",
"name": "Pineapple Bed",
"category": "Furniture",
"games": {
"nl": {
"orderable": true,
"interiorThemes": [
"Rustic"
],
"sellPrice": {
"currency": "bells",
"value": 498
},
"sources": [
"Nookling stores"
],
"buyPrices": [
{
"currency": "bells",
"value": 1992
}
]
}
}
} | {
"pile_set_name": "Github"
} |
#!/bin/sh
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
local source="${BUILT_PRODUCTS_DIR}/$1"
elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
elif [ -r "$1" ]; then
local source="$1"
fi
local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
strip_invalid_archs "$binary"
fi
# Resign the code if required by the build settings to avoid unstable apps
code_sign_if_enabled "${destination}/$(basename "$1")"
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
code_sign_if_enabled "${destination}/${lib}"
done
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
fi
}
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-AlamoFireDemo/Alamofire.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-AlamoFireDemo/Alamofire.framework"
fi
| {
"pile_set_name": "Github"
} |
微信小程序集成Redux实现的Todo list
======================
在微信小程序中使用[Redux](https://github.com/reactjs/redux)实现Todo list,同时集成了redux-devtools

使用了我自己写的小程序的Redux绑定库:[wechat-weapp-redux](https://github.com/charleyw/wechat-weapp-redux)
### 使用
导入到微信的开发工具运行就可以了。
### 开启redux-devtools
1. 本地安装remotedev-server并启动
```shell
npm install -g remotedev-server
remotedev --hostname=localhost --port=5678
```
2. 浏览器中访问**localhost:5678**
如果不能访问,可以尝试使用**http://remotedev.io/local/**,打开后点击下面的setting,设置使用本地的server。
### Todos
* 集成redux-undo
* 集成redux-persist
## Liscense
© 2016 Wang Chao. This code is distributed under the MIT license.
| {
"pile_set_name": "Github"
} |
EXTRA_DIST = example.c
if HAVE_GLIB
noinst_PROGRAMS = uberopt
else
noinst_PROGRAMS =
endif
uberopt_SOURCES = uberopt.c
uberopt_CFLAGS = $(LIBOIL_CFLAGS) $(GLIB_CFLAGS)
uberopt_LDADD = $(LIBOIL_LIBS) $(GLIB_LIBS)
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2004-2006 The Trustees of Indiana University.
// Use, modification and distribution is subject to 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)
// Authors: Douglas Gregor
// Andrew Lumsdaine
// The placement of this #include probably looks very odd relative to
// the #ifndef/#define pair below. However, this placement is
// extremely important to allow the various property map headers to be
// included in any order.
#include <boost/property_map/property_map.hpp>
#ifndef BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP
#define BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP
#include <boost/assert.hpp>
namespace boost {
/** Property map that accesses an underlying, local property map
* using a subset of the global keys.
*/
template<typename ProcessGroup, typename GlobalMap, typename StorageMap>
class local_property_map
{
typedef typename property_traits<GlobalMap>::value_type owner_local_pair;
public:
typedef ProcessGroup process_group_type;
typedef typename property_traits<StorageMap>::value_type value_type;
typedef typename property_traits<GlobalMap>::key_type key_type;
typedef typename property_traits<StorageMap>::reference reference;
typedef typename property_traits<StorageMap>::category category;
local_property_map() { }
local_property_map(const ProcessGroup& process_group,
const GlobalMap& global, const StorageMap& storage)
: process_group_(process_group), global_(global), storage(storage) { }
reference operator[](const key_type& key)
{
owner_local_pair p = get(global_, key);
BOOST_ASSERT(p.first == process_id(process_group_));
return storage[p.second];
}
GlobalMap& global() const { return global_; }
StorageMap& base() const { return storage; }
ProcessGroup& process_group() { return process_group_; }
const ProcessGroup& process_group() const { return process_group_; }
private:
ProcessGroup process_group_;
mutable GlobalMap global_;
mutable StorageMap storage;
};
template<typename ProcessGroup, typename GlobalMap, typename StorageMap>
inline
typename local_property_map<ProcessGroup, GlobalMap, StorageMap>::reference
get(const local_property_map<ProcessGroup, GlobalMap, StorageMap>& pm,
typename local_property_map<ProcessGroup, GlobalMap, StorageMap>::key_type
const & key)
{
typename property_traits<GlobalMap>::value_type p = get(pm.global(), key);
return get(pm.base(), p.second);
}
template<typename ProcessGroup, typename GlobalMap, typename StorageMap>
inline void
put(const local_property_map<ProcessGroup, GlobalMap, StorageMap>& pm,
typename local_property_map<ProcessGroup, GlobalMap, StorageMap>
::key_type const & key,
typename local_property_map<ProcessGroup, GlobalMap, StorageMap>
::value_type const& v)
{
typename property_traits<GlobalMap>::value_type p = get(pm.global(), key);
BOOST_ASSERT(p.first == process_id(pm.process_group()));
put(pm.base(), p.second, v);
}
} // end namespace boost
#endif // BOOST_PARALLEL_LOCAL_PROPERTY_MAP_HPP
| {
"pile_set_name": "Github"
} |
//! moment.js locale configuration
//! locale : Kyrgyz [ky]
//! author : Chyngyz Arystan uulu : https://github.com/chyngyz
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
&& typeof require === 'function' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
//! moment.js locale configuration
var suffixes = {
0: '-чү',
1: '-чи',
2: '-чи',
3: '-чү',
4: '-чү',
5: '-чи',
6: '-чы',
7: '-чи',
8: '-чи',
9: '-чу',
10: '-чу',
20: '-чы',
30: '-чу',
40: '-чы',
50: '-чү',
60: '-чы',
70: '-чи',
80: '-чи',
90: '-чу',
100: '-чү',
};
var ky = moment.defineLocale('ky', {
months: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split(
'_'
),
monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split(
'_'
),
weekdays: 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split(
'_'
),
weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'),
weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'),
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD.MM.YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm',
},
calendar: {
sameDay: '[Бүгүн саат] LT',
nextDay: '[Эртең саат] LT',
nextWeek: 'dddd [саат] LT',
lastDay: '[Кечээ саат] LT',
lastWeek: '[Өткөн аптанын] dddd [күнү] [саат] LT',
sameElse: 'L',
},
relativeTime: {
future: '%s ичинде',
past: '%s мурун',
s: 'бирнече секунд',
ss: '%d секунд',
m: 'бир мүнөт',
mm: '%d мүнөт',
h: 'бир саат',
hh: '%d саат',
d: 'бир күн',
dd: '%d күн',
M: 'бир ай',
MM: '%d ай',
y: 'бир жыл',
yy: '%d жыл',
},
dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/,
ordinal: function (number) {
var a = number % 10,
b = number >= 100 ? 100 : null;
return number + (suffixes[number] || suffixes[a] || suffixes[b]);
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 7, // The week that contains Jan 7th is the first week of the year.
},
});
return ky;
})));
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: f21dc22f48ff48e458d1ecef974265ed
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
<table>
<thead>
<tr>
<th><em>header</em> 1</th>
<th>header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td><em>cell</em> 1.1</td>
<td><del>cell</del> 1.2</td>
</tr>
<tr>
<td><code>|</code> 2.1</td>
<td>| 2.2</td>
</tr>
<tr>
<td><code>\|</code> 2.1</td>
<td><a href="/">link</a></td>
</tr>
</tbody>
</table> | {
"pile_set_name": "Github"
} |
opam-version: "2.0"
maintainer: "[email protected]"
authors: "The Merlin team"
homepage: "https://github.com/ocaml/merlin"
bug-reports: "https://github.com/ocaml/merlin/issues"
dev-repo: "git+https://github.com/ocaml/merlin.git"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" "1"] {with-test & os != "macos" & ocaml:version >= "4.03"}
]
depends: [
"ocaml" {>= "4.02.3" & < "4.12"}
"dune" {>= "1.8.0"}
"ocamlfind" {>= "1.5.2"}
"yojson" {>= "1.6.0"}
"mdx" {with-test & >= "1.3.0"}
"conf-jq" {with-test}
]
synopsis:
"Editor helper, provides completion, typing and source browsing in Vim and Emacs"
description:
"Merlin is an assistant for editing OCaml code. It aims to provide the features available in modern IDEs: error reporting, auto completion, source browsing and much more."
post-messages: [
"merlin installed.
Quick setup for VIM
-------------------
Append this to your .vimrc to add merlin to vim's runtime-path:
let g:opamshare = substitute(system('opam config var share'),'\\n$','','''')
execute \"set rtp+=\" . g:opamshare . \"/merlin/vim\"
Also run the following line in vim to index the documentation:
:execute \"helptags \" . g:opamshare . \"/merlin/vim/doc\"
Quick setup for EMACS
-------------------
Add opam emacs directory to your load-path by appending this to your .emacs:
(let ((opam-share (ignore-errors (car (process-lines \"opam\" \"config\" \"var\" \"share\")))))
(when (and opam-share (file-directory-p opam-share))
;; Register Merlin
(add-to-list 'load-path (expand-file-name \"emacs/site-lisp\" opam-share))
(autoload 'merlin-mode \"merlin\" nil t nil)
;; Automatically start it in OCaml buffers
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)
;; Use opam switch to lookup ocamlmerlin binary
(setq merlin-command 'opam)))
Take a look at https://github.com/ocaml/merlin for more information
Quick setup with opam-user-setup
--------------------------------
Opam-user-setup support Merlin.
$ opam user-setup install
should take care of basic setup.
See https://github.com/OCamlPro/opam-user-setup
"
{success & !user-setup:installed}
]
url {
src:
"https://github.com/ocaml/merlin/releases/download/v3.3.9/merlin-v3.3.9.tbz"
checksum: [
"sha256=a3170f1a993d810d552a21a4baa328dff0fe9ac9bf4b8aa6ba3f179a9240cf02"
"sha512=63034766c7dc7de21e3ce8624ed760a9d76b79cacbee8c17ecef2c62df00438ebd84f43a0d558cf8d9c4a800dac99e4b2f25c324f363a590cc294e46420f46aa"
]
}
| {
"pile_set_name": "Github"
} |
# click 7.0
`__init__.pyi` is almost a copy of `click/__init__.py`. It's a shortcut module
anyway in the actual sources so it works well with minimal changes.
The types are pretty complete but they were created mostly for public API use
so some internal modules (`_compat`) or functions (`core._bashcomplete`) are
deliberately missing. If you feel the need to add those, pull requests accepted.
Speaking of pull requests, it would be great if the option decorators informed
the type checker on what types the command callback should accept.
| {
"pile_set_name": "Github"
} |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2015-2017 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://oss.oracle.com/licenses/CDDL+GPL-1.1
* or LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
package org.glassfish.jersey.tests.e2e.entity.filtering.domain;
/**
* @author Michal Gajdos
*/
public class NonEmptyEntity {
public static final NonEmptyEntity INSTANCE;
static {
INSTANCE = new NonEmptyEntity();
INSTANCE.setValue("foo");
}
private String value;
public String getValue() {
return value;
}
public void setValue(final String value) {
this.value = value;
}
public EmptyEntity getEmptyEntity() {
return null;
}
}
| {
"pile_set_name": "Github"
} |
---
-api-id: M:Windows.Storage.AppDataPaths.GetDefault
-api-type: winrt method
---
<!-- Method syntax.
public AppDataPaths AppDataPaths.GetDefault()
-->
# Windows.Storage.AppDataPaths.GetDefault
## -description
Gets the paths to a user's various app data folders. Use this method in single user apps.
## -returns
The app data paths associated with the user.
## -remarks
## -see-also
## -examples
| {
"pile_set_name": "Github"
} |
# SPDX-License-Identifier: GPL-2.0
# The loops are all 64-bit code
CFLAGS += -m64
CFLAGS += -I$(CURDIR)
CFLAGS += -D SELFTEST
CFLAGS += -maltivec
# Use our CFLAGS for the implicit .S rule & set the asm machine type
ASFLAGS = $(CFLAGS) -Wa,-mpower4
TEST_GEN_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
EXTRA_SOURCES := validate.c ../harness.c
include ../../lib.mk
$(OUTPUT)/copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
$(OUTPUT)/copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
$(OUTPUT)/memcpy_64: CPPFLAGS += -D COPY_LOOP=test_memcpy
$(OUTPUT)/memcpy_power7: CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
| {
"pile_set_name": "Github"
} |
// 2004-10-20 Benjamin Kosnik <[email protected]>
//
// Copyright (C) 2004-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library 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 3, or (at your option)
// any later version.
//
// This library 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 library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// 6.2.2 Class template array
#include <tr1/array>
#include <testsuite_hooks.h>
void
test01()
{
const size_t len = 5;
typedef std::tr1::array<int, len> array_type;
bool test __attribute__((unused)) = true;
array_type a = { { 0, 1, 2, 3, 4 } };
// &a[n] == &a[0] + n for all 0 <= n < N.
for (size_t i = 0; i < len; ++i)
{
VERIFY( &a[i] == &a[0] + i );
}
}
int main()
{
test01();
return 0;
}
| {
"pile_set_name": "Github"
} |
package reflect2
import (
"reflect"
"runtime"
"strings"
"sync"
"unsafe"
)
// typelinks1 for 1.5 ~ 1.6
//go:linkname typelinks1 reflect.typelinks
func typelinks1() [][]unsafe.Pointer
// typelinks2 for 1.7 ~
//go:linkname typelinks2 reflect.typelinks
func typelinks2() (sections []unsafe.Pointer, offset [][]int32)
// initOnce guards initialization of types and packages
var initOnce sync.Once
var types map[string]reflect.Type
var packages map[string]map[string]reflect.Type
// discoverTypes initializes types and packages
func discoverTypes() {
types = make(map[string]reflect.Type)
packages = make(map[string]map[string]reflect.Type)
ver := runtime.Version()
if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") {
loadGo15Types()
} else if ver == "go1.6" || strings.HasPrefix(ver, "go1.6.") {
loadGo15Types()
} else {
loadGo17Types()
}
}
func loadGo15Types() {
var obj interface{} = reflect.TypeOf(0)
typePtrss := typelinks1()
for _, typePtrs := range typePtrss {
for _, typePtr := range typePtrs {
(*emptyInterface)(unsafe.Pointer(&obj)).word = typePtr
typ := obj.(reflect.Type)
if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct {
loadedType := typ.Elem()
pkgTypes := packages[loadedType.PkgPath()]
if pkgTypes == nil {
pkgTypes = map[string]reflect.Type{}
packages[loadedType.PkgPath()] = pkgTypes
}
types[loadedType.String()] = loadedType
pkgTypes[loadedType.Name()] = loadedType
}
if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Ptr &&
typ.Elem().Elem().Kind() == reflect.Struct {
loadedType := typ.Elem().Elem()
pkgTypes := packages[loadedType.PkgPath()]
if pkgTypes == nil {
pkgTypes = map[string]reflect.Type{}
packages[loadedType.PkgPath()] = pkgTypes
}
types[loadedType.String()] = loadedType
pkgTypes[loadedType.Name()] = loadedType
}
}
}
}
func loadGo17Types() {
var obj interface{} = reflect.TypeOf(0)
sections, offset := typelinks2()
for i, offs := range offset {
rodata := sections[i]
for _, off := range offs {
(*emptyInterface)(unsafe.Pointer(&obj)).word = resolveTypeOff(unsafe.Pointer(rodata), off)
typ := obj.(reflect.Type)
if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct {
loadedType := typ.Elem()
pkgTypes := packages[loadedType.PkgPath()]
if pkgTypes == nil {
pkgTypes = map[string]reflect.Type{}
packages[loadedType.PkgPath()] = pkgTypes
}
types[loadedType.String()] = loadedType
pkgTypes[loadedType.Name()] = loadedType
}
}
}
}
type emptyInterface struct {
typ unsafe.Pointer
word unsafe.Pointer
}
// TypeByName return the type by its name, just like Class.forName in java
func TypeByName(typeName string) Type {
initOnce.Do(discoverTypes)
return Type2(types[typeName])
}
// TypeByPackageName return the type by its package and name
func TypeByPackageName(pkgPath string, name string) Type {
initOnce.Do(discoverTypes)
pkgTypes := packages[pkgPath]
if pkgTypes == nil {
return nil
}
return Type2(pkgTypes[name])
}
| {
"pile_set_name": "Github"
} |
@page "{id}"
@model PreventingOverPosting.Pages.VulnerableModel
@{
ViewData["Title"] = "Vulnerable";
}
<h2>
Edit user
@if (Model.CurrentUser.IsAdmin)
{
<span class="badge badge-primary">Admin</span>
}
</h2>
<form method="post">
<div class="form-group">
<label asp-for="CurrentUser.Name"></label>
<input asp-for="CurrentUser.Name" class="form-control" />
<span asp-validation-for="CurrentUser.Name" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
| {
"pile_set_name": "Github"
} |
//
// main.m
// MagicCube
//
// Created by lihua liu on 12-9-10.
// Copyright (c) 2012年 yinghuochong. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.