text stringlengths 2 99k | meta dict |
|---|---|
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const GroupName = "client.authentication.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ExecCredential{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="max_imageloading_threads">7</integer>
</resources> | {
"pile_set_name": "Github"
} |
# Patch for a tmp race in cvsbug (in the source package; we don't ship
# the script as part of the package). Closes: #325106
diff -Nur src/cvsbug.in src/cvsbug.in
--- src/cvsbug.in 2003-02-26 05:31:33.000000000 +0800
+++ src/cvsbug.in 2006-02-26 22:07:08.000000000 +0800
@@ -109,14 +109,14 @@
/usr/bin/ypcat passwd 2>/dev/null | cat - /etc/passwd | grep "^$LOGNAME:" |
cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
ORIGINATOR="`cat $TEMP`"
- rm -f $TEMP
+ > $TEMP
fi
fi
if [ "$ORIGINATOR" = "" ]; then
grep "^$LOGNAME:" /etc/passwd | cut -f5 -d':' | sed -e 's/,.*//' > $TEMP
ORIGINATOR="`cat $TEMP`"
- rm -f $TEMP
+ > $TEMP
fi
if [ -n "$ORGANIZATION" ]; then
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for DragonFly from master list
# (for example, /usr/src/sys/kern/syscalls.master).
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
while(<>){
if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
my $num = $1;
my $proto = $2;
my $name = "SYS_$3";
$name =~ y/a-z/A-Z/;
# There are multiple entries for enosys and nosys, so comment them out.
if($name =~ /^SYS_E?NOSYS$/){
$name = "// $name";
}
if($name eq 'SYS_SYS_EXIT'){
$name = 'SYS_EXIT';
}
print " $name = $num; // $proto\n";
}
}
print <<EOF;
)
EOF
| {
"pile_set_name": "Github"
} |
import routes from 'src/boot/routes'
import { createLocalVue } from '@vue/test-utils'
import VueRouter from 'vue-router'
const localVue = createLocalVue()
localVue.use(VueRouter)
describe('routes', () => {
const router = new VueRouter({
mode: 'abstract',
routes: routes({})
})
it('root path', () => {
router.push('/')
expect(router.history.current.path).to.eql('/')
// expect(router.getMatchedComponents('/')[0].name).to.eql('Home')
// const matchedComponents = router.getMatchedComponents()
// expect(matchedComponents[0].components.hasOwnProperty('Home')).to.eql(true)
})
})
| {
"pile_set_name": "Github"
} |
// Copyright 2017-2019 Elias Kosunen
//
// 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.
//
// This file is a part of scnlib:
// https://github.com/eliaskosunen/scnlib
#include <cstdio>
| {
"pile_set_name": "Github"
} |
/*
This is simplest and fastest light shader without path tracking.
It's works like "Light 1 Point", but ignores obstacles at all.
It requires no aditional data to work so it could be used with Particle System.
*/
Shader "Light2D/Light Ignoring Obstacles" {
Properties {
_MainTex ("Light texture", 2D) = "white" {}
_EmissionColorMul ("Emission color mul", Float) = 1
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
Blend OneMinusDstColor One
Cull Off
ZWrite Off
Lighting Off
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile ORTHOGRAPHIC_CAMERA PERSPECTIVE_CAMERA
#pragma multi_compile LIGHT2D_XY_PLANE LIGHT2D_XZ_PLANE
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
fixed4 color : COLOR;
};
struct v2f {
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
fixed4 color : COLOR;
float4 scrPos : TEXCOORD2;
};
sampler2D _ObstacleTex;
sampler2D _MainTex;
half _EmissionColorMul;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
o.texcoord = v.texcoord;
o.scrPos = ComputeScreenPos(o.vertex);
o.color = v.color;
return o;
}
fixed4 frag (v2f i) : COLOR
{
fixed4 tex = tex2D(_MainTex, i.texcoord);
fixed4 col = i.color*tex*tex.a*i.color.a;
col.rgb *= _EmissionColorMul;
return col;
}
ENDCG
}
}
} | {
"pile_set_name": "Github"
} |
using Core2D;
using Xunit;
namespace Core2D.Shapes.UnitTests
{
public class ArcShapeTests
{
private readonly IFactory _factory = new Factory();
[Fact]
[Trait("Core2D.Shapes", "Shapes")]
public void Inherits_From_BaseShape()
{
var style = _factory.CreateShapeStyle();
var target = _factory.CreateArcShape(0, 0, 0, 0, 0, 0, 0, 0, style);
Assert.True(target is BaseShape);
}
}
}
| {
"pile_set_name": "Github"
} |
#%Module1.0
##############################################################################
# Modules Revision 3.0
# Providing a flexible user environment
#
# File: setenv/%M%
# Revision: %I%
# First Edition: 2001/07/06
# Last Mod.: %U%, %G%
#
# Authors: R.K. Owen, rk@owen.sj.ca.us
#
# Description: Testuite modulefile
# Command:
# Sub-Command: use
#
# Invocation: load @M@
# Result: %R{
# setenv _LMFILES_ ${_LMFILES_}:@M@/@V@
# setenv LOADEDMODULES ${LOADEDMODULES}:@P@/@M@/@V@
# }R%
# Comment: %C{
# Check the 'use' command
# This form is for backward compatibility
# }C%
#
##############################################################################
module use -append $env(TESTSUITEDIR)/modulefiles.2
| {
"pile_set_name": "Github"
} |
//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014, John Haddon. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above
// copyright notice, this list of conditions and the following
// disclaimer.
//
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided with
// the distribution.
//
// * Neither the name of John Haddon nor the names of
// any other contributors to this software may be used to endorse or
// promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////
#ifndef GAFFERSCENE_PRIMITIVEVARIABLES_H
#define GAFFERSCENE_PRIMITIVEVARIABLES_H
#include "GafferScene/ObjectProcessor.h"
#include "Gaffer/CompoundDataPlug.h"
namespace GafferScene
{
class GAFFERSCENE_API PrimitiveVariables : public ObjectProcessor
{
public :
PrimitiveVariables( const std::string &name=defaultName<PrimitiveVariables>() );
~PrimitiveVariables() override;
GAFFER_GRAPHCOMPONENT_DECLARE_TYPE( GafferScene::PrimitiveVariables, PrimitiveVariablesTypeId, ObjectProcessor );
Gaffer::CompoundDataPlug *primitiveVariablesPlug();
const Gaffer::CompoundDataPlug *primitiveVariablesPlug() const;
protected :
bool affectsProcessedObject( const Gaffer::Plug *input ) const override;
void hashProcessedObject( const ScenePath &path, const Gaffer::Context *context, IECore::MurmurHash &h ) const override;
IECore::ConstObjectPtr computeProcessedObject( const ScenePath &path, const Gaffer::Context *context, const IECore::Object *inputObject ) const override;
private :
static size_t g_firstPlugIndex;
};
IE_CORE_DECLAREPTR( PrimitiveVariables )
} // namespace GafferScene
#endif // GAFFERSCENE_PRIMITIVEVARIABLES_H
| {
"pile_set_name": "Github"
} |
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doctype("User")
frappe.db.sql("update `tabUser` set last_active=last_login")
| {
"pile_set_name": "Github"
} |
These files are provided only as a functional sample.
For real applications they must be replaced with the files
provided by the vendor.
Extensions to the ARM CMSIS files:
- the assembly startup file was reimplemented in C, and split into
multiple files, portable for the entire Cortex-M family:
src/newlib/_startup.c
src/cortexm/exception_handlers.c
- the chip interrupt handlers must be added to the file
src/cmsis/vectors_$(CMSIS_name).c
Use of assembly files
---------------------
The current version of the Eclipse managed build plug-in does not
process .s, but only .S. If you want to use the assembly startup_Device.s,
you must exclude the _startup.c and exception_handlers.c from build, and
rename the vendor provided assembly file to startup_XXX.S, where XXX is the
actual device name.
| {
"pile_set_name": "Github"
} |
//
// System.Web.Services.Protocols.DiscoveryClientReferenceCollection.cs
//
// Author:
// Dave Bettin (javabettin@yahoo.com)
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Dave Bettin, 2002
// Copyright (C) Tim Coleman, 2002
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
namespace System.Web.Services.Discovery {
public sealed class DiscoveryClientReferenceCollection : DictionaryBase {
#region Constructors
public DiscoveryClientReferenceCollection ()
: base ()
{
}
#endregion // Constructors
#region Properties
public DiscoveryReference this [string url] {
get { return (DiscoveryReference) InnerHashtable [url]; }
set { InnerHashtable [url] = value; }
}
public ICollection Keys {
get { return InnerHashtable.Keys; }
}
public ICollection Values {
get { return InnerHashtable.Values; }
}
#endregion // Properties
#region Methods
public void Add (DiscoveryReference value)
{
Add (value.Url, value);
}
public void Add (string url, DiscoveryReference value)
{
InnerHashtable [url] = value;
}
public bool Contains (string url)
{
return InnerHashtable.Contains (url);
}
public void Remove (string url)
{
InnerHashtable.Remove (url);
}
#endregion // Methods
}
}
| {
"pile_set_name": "Github"
} |
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse SmartHome Configuration mDNS Discovery Tests
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-SymbolicName:
org.eclipse.smarthome.config.discovery.mdns.test;singleton:=true
Bundle-Vendor: Eclipse.org/SmartHome
Bundle-Version: 0.11.0.qualifier
Fragment-Host: org.eclipse.smarthome.config.discovery.mdns
Import-Package:
org.eclipse.jdt.annotation;resolution:=optional,
org.eclipse.smarthome.test.java,
org.hamcrest;core=split,
org.hamcrest.collection,
org.hamcrest.core,
org.junit;version="4.0.0",
org.mockito,
org.mockito.invocation,
org.mockito.stubbing,
org.mockito.verification,
org.osgi.service.cm
Automatic-Module-Name: org.eclipse.smarthome.config.discovery.mdns.test
| {
"pile_set_name": "Github"
} |
package com.funtl.myshop.plus.cloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class CloudUploadApplication {
public static void main(String[] args) {
SpringApplication.run(CloudUploadApplication.class, args);
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# @name: Caddy
# @author: w8ay
from re import search, I, compile, error
def _prepare_pattern(pattern):
"""
Strip out key:value pairs from the pattern and compile the regular
expression.
"""
regex, _, rest = pattern.partition('\;')
try:
return compile(regex, I)
except error as e:
return compile(r'(?!x)x')
def fingerprint(headers, content):
_ = False
if 'server' in headers.keys():
_ |= search(r"^Caddy$", headers["server"], I) is not None
if _: return "Caddy" | {
"pile_set_name": "Github"
} |
"""
Scheme obtained by gluing two other schemes
"""
from __future__ import absolute_import
#*******************************************************************************
# Copyright (C) 2006 William Stein
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#*******************************************************************************
from . import morphism
from . import scheme
class GluedScheme(scheme.Scheme):
r"""
INPUT:
- ``f`` - open immersion from a scheme U to a scheme
X
- ``g`` - open immersion from U to a scheme Y
OUTPUT: The scheme obtained by gluing X and Y along the open set
U.
.. note::
Checking that `f` and `g` are open
immersions is not implemented.
"""
def __init__(self, f, g, check=True):
if check:
if not morphism.is_SchemeMorphism(f):
raise TypeError("f (=%s) must be a scheme morphism"%f)
if not morphism.is_SchemeMorphism(g):
raise TypeError("g (=%s) must be a scheme morphism"%g)
if f.domain() != g.domain():
raise ValueError("f (=%s) and g (=%s) must have the same domain"%(f,g))
self.__f = f
self.__g = g
def gluing_maps(self):
return self.__f, self.__g
def _repr_(self):
return "Scheme obtained by gluing X and Y along U, where\n X: %s\n Y: %s\n U: %s"%(
self.__f.codomain(), self.__g.codomain(), self.__f.domain())
| {
"pile_set_name": "Github"
} |
/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.dubbo.common.extensionloader.ext5.impl;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.extensionloader.ext5.NoAdaptiveMethodExt;
/**
* @author ding.lid
*/
public class Ext5Impl1 implements NoAdaptiveMethodExt {
public String echo(URL url, String s) {
return "Ext5Impl1-echo";
}
} | {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-5001287652784564808
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: TransitionIn
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5956323363325379133}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0.0013260854
m_ExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-1953762402154708695
AnimatorStateMachine:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 2742000478554667794}
m_Position: {x: 288.60522, y: 110.312256, z: 0}
- serializedVersion: 1
m_State: {fileID: 5956323363325379133}
m_Position: {x: 297.2138, y: 250.91873, z: 0}
- serializedVersion: 1
m_State: {fileID: -230541312509980372}
m_Position: {x: 550, y: 180, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 50, y: 20, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 2742000478554667794}
--- !u!1102 &-230541312509980372
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UploadPatternTransitionOut
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 4511587910798550748}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: f3a6f944e8a3d5b4e808f11c0d0fafcb, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-133123853160072504
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: TransitionOut
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -230541312509980372}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0.0013260854
m_ExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UploadPattern
serializedVersion: 5
m_AnimatorParameters:
- m_Name: TransitionIn
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: TransitionOut
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: -1953762402154708695}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &2742000478554667794
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UploadPatternEmpty
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -5001287652784564808}
- {fileID: -133123853160072504}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 0d780c7f1f8f0ec4cb263cd2f3d83a89, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &4511587910798550748
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: TransitionIn
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 5956323363325379133}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0.003314851
m_ExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &5956323363325379133
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: UploadPatternTransitionIn
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 7904400513683534629}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: 9011f53861fe727409f82c8a0385276c, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &7904400513683534629
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: TransitionOut
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -230541312509980372}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
| {
"pile_set_name": "Github"
} |
"""
```
estimate(m, data; verbose=:low, proposal_covariance=Matrix(), method=:SMC)
```
Estimate the DSGE parameter posterior distribution.
### Arguments:
- `m::AbstractDSGEModel` or `m::AbstractVARModel`: model object
### Optional Arguments:
- `data`: well-formed data as `Matrix` or `DataFrame`. If this is not provided, the `load_data` routine will be executed.
### Keyword Arguments:
- `verbose::Symbol`: The desired frequency of function progress messages printed to standard out.
- `:none`: No status updates will be reported.
- `:low`: Status updates will be provided in csminwel and at each block in
Metropolis-Hastings.
- `:high`: Status updates provided at each iteration in Metropolis-Hastings.
- `proposal_covariance::Matrix`: Used to test the metropolis_hastings algorithm with a precomputed
covariance matrix for the proposal distribution. When the Hessian is singular,
eigenvectors corresponding to zero eigenvectors are not well defined, so eigenvalue
decomposition can cause problems. Passing a precomputed matrix allows us to ensure that
the rest of the routine has not broken.
- `method::Symbol`: The method to use when sampling from the posterior distribution. Can
be either `:MH` for standard Metropolis Hastings Markov Chain Monte Carlo, or `:SMC`
for Sequential Monte Carlo.
- `mle`: Set to true if parameters should be estimated by maximum likelihood directly.
If this is set to true, this function will return after estimating parameters.
- `sampling`: Set to false to disable sampling from the posterior.
- `filestring_addl::Vector{String}`: Additional strings to add to the file name
of estimation output as a way to distinguish output from each other.
- `continue_intermediate::Bool`: set to true if the estimation is starting
from an intermediate stage that has been previously saved.
- `intermediate_stage_start::Int`: number of the stage from which the user wants
to continue the estimation (see `continue_intermediate`)
- `save_intermediate::Bool`: set to true to save intermediate stages when using SMC
- `intermediate_stage_increment::Int`: number of stages that must pass before saving
another intermediate stage.
- `tempered_update_prior_weight::Float64`: when using a tempered update, the user
can create a bridge distribution as a convex combination of the prior and a
previously ran estimation. This keyword is the relative weight on the prior
in the convex combination.
- `run_csminwel::Bool`: by default, csminwel is run after a SMC estimation finishes
to recover the true mode of the posterior. Set to false to avoid this step
(csminwel can take hours for medium-scale DSGE models).
"""
function estimate(m::Union{AbstractDSGEModel,AbstractVARModel}, df::DataFrame;
verbose::Symbol = :low,
proposal_covariance::Matrix = Matrix(undef, 0, 0),
mle::Bool = false,
sampling::Bool = true,
filestring_addl::Vector{String} = Vector{String}(),
continue_intermediate::Bool = false,
intermediate_stage_start::Int = 0,
intermediate_stage_increment::Int = 10,
save_intermediate::Bool = false,
tempered_update_prior_weight::Float64 = 0.,
run_csminwel::Bool = true)
data = df_to_matrix(m, df)
estimate(m, data; verbose = verbose, proposal_covariance = proposal_covariance,
mle = mle, sampling = sampling,
intermediate_stage_increment = intermediate_stage_increment,
save_intermediate = save_intermediate,
tempered_update_prior_weight = tempered_update_prior_weight,
run_csminwel = run_csminwel)
end
function estimate(m::Union{AbstractDSGEModel,AbstractVARModel};
verbose::Symbol = :low,
proposal_covariance::Matrix = Matrix(undef, 0, 0),
mle::Bool = false,
sampling::Bool = true,
filestring_addl::Vector{String} = Vector{String}(),
continue_intermediate::Bool = false,
intermediate_stage_start::Int = 0,
intermediate_stage_increment::Int = 10,
save_intermediate::Bool = false,
tempered_update_prior_weight::Float64 = 0.,
run_csminwel::Bool = true)
# Load data
df = load_data(m; verbose = verbose)
estimate(m, df; verbose = verbose, proposal_covariance = proposal_covariance,
mle = mle, sampling = sampling,
intermediate_stage_increment = intermediate_stage_increment,
save_intermediate = save_intermediate,
tempered_update_prior_weight = tempered_update_prior_weight,
run_csminwel = run_csminwel)
end
function estimate(m::Union{AbstractDSGEModel,AbstractVARModel}, data::AbstractArray;
verbose::Symbol = :low,
proposal_covariance::Matrix = Matrix(undef, 0,0),
mle::Bool = false,
sampling::Bool = true,
filestring_addl::Vector{String} = Vector{String}(),
continue_intermediate::Bool = false,
intermediate_stage_start::Int = 0,
intermediate_stage_increment::Int = 10,
save_intermediate::Bool = false,
tempered_update_prior_weight::Float64 = 0.,
run_csminwel::Bool = true)
if !(get_setting(m, :sampling_method) in [:SMC, :MH])
error("method must be :SMC or :MH")
else
method = get_setting(m, :sampling_method)
end
########################################################################################
### Step 1: Find posterior/likelihood mode (if reoptimizing, run optimization routine)
########################################################################################
# Specify starting mode
vint = get_setting(m, :data_vintage)
if reoptimize(m) && method == :MH
println("Reoptimizing...")
# Inputs to optimization algorithm
n_iterations = get_setting(m, :optimization_iterations)
ftol = get_setting(m, :optimization_ftol)
xtol = get_setting(m, :optimization_xtol)
gtol = get_setting(m, :optimization_gtol)
step_size = get_setting(m, :optimization_step_size)
converged = false
# If the algorithm stops only because we have exceeded the maximum number of
# iterations, continue improving guess of modal parameters
total_iterations = 0
optimization_time = 0
max_attempts = get_setting(m, :optimization_attempts)
attempts = 1
while !converged
begin_time = time_ns()
out, H = optimize!(m, data;
method = get_setting(m, :optimization_method),
ftol = ftol, grtol = gtol, xtol = xtol,
iterations = n_iterations, show_trace = true, step_size = step_size,
verbose = verbose,
mle = mle)
attempts += 1
total_iterations += out.iterations
converged = out.converged || attempts > max_attempts
end_time = (time_ns() - begin_time)/1e9
println(verbose, :low, @sprintf "Total iterations completed: %d\n" total_iterations)
println(verbose, :low, @sprintf "Optimization time elapsed: %5.2f\n" optimization_time += end_time)
# Write params to file after every `n_iterations` iterations
params = map(θ -> θ.value, get_parameters(m))
h5open(rawpath(m, "estimate", "paramsmode.h5"),"w") do file
file["params"] = params
end
end
# write parameters to file one last time so we have the final mode
h5open(rawpath(m, "estimate", "paramsmode.h5"),"w") do file
file["params"] = params
end
end
params = map(θ -> θ.value, get_parameters(m))
# Sampling does not make sense if mle=true
if mle || !sampling
return nothing
end
if get_setting(m,:sampling_method) == :MH
########################################################################################
### Step 2: Compute proposal distribution for Markov Chain Monte Carlo (MCMC)
###
### In Metropolis-Hastings, we draw sample parameter vectors from
### the proposal distribution, which is a degenerate multivariate
### normal centered at the mode. Its variance is the inverse of
### the hessian. We find the inverse via eigenvalue decomposition.
########################################################################################
## Calculate the Hessian at the posterior mode
hessian = if calculate_hessian(m)
println(verbose, :low, "Recalculating Hessian...")
hessian, _ = hessian!(m, params, data; verbose=verbose)
h5open(rawpath(m, "estimate","hessian.h5"),"w") do file
file["hessian"] = hessian
end
hessian
## Read in a pre-calculated Hessian
else
fn = hessian_path(m)
println(verbose, :low, "Using pre-calculated Hessian from $fn")
hessian = h5open(fn,"r") do file
read(file, "hessian")
end
hessian
end
# Compute inverse hessian and create proposal distribution, or
# just create it with the given cov matrix if we have it
propdist = if isempty(proposal_covariance)
# Make sure the mode and hessian have the same number of parameters
n = length(params)
@assert (n, n) == size(hessian)
# Compute the inverse of the Hessian via eigenvalue decomposition
#S_diag, U = eigen(hessian)
F = svd(hessian)
big_eig_vals = findall(x -> x > 1e-6, F.S)
hessian_rank = length(big_eig_vals)
S_inv = zeros(n, n)
#for i = (n-hessian_rank+1):n
for i = 1:hessian_rank
S_inv[i, i] = 1/F.S[i]
end
#hessian_inv = U*sqrt.(S_inv) # this is the inverse of the hessian
hessian_inv = F.V * S_inv * F.U'#sqrt.(S_inv) * F.U'
DegenerateMvNormal(params, hessian_inv, hessian, diag(S_inv))
else
DegenerateMvNormal(params, proposal_covariance, pinv(proposal_covariance),
eigen(proposal_covariance).values)
end
if rank(propdist) != n_parameters_free(m)
println("problem – shutting down dimensions")
end
########################################################################################
### Step 3: Sample from posterior using Metropolis-Hastings algorithm
########################################################################################
# Set the jump size for sampling
cc0 = get_setting(m, :mh_cc0)
cc = get_setting(m, :mh_cc)
metropolis_hastings(propdist, m, data, cc0, cc; verbose = verbose,
filestring_addl = filestring_addl);
elseif get_setting(m, :sampling_method) == :SMC
########################################################################################
### Step 3: Run Sequential Monte Carlo (SMC)
###
### In Sequential Monte Carlo, a large number of Markov Chains
### are simulated iteratively to create a particle approximation
### of the posterior. Portions of this method are executed in
### parallel.
########################################################################################
smc2(m, data; verbose = verbose, filestring_addl = filestring_addl,
continue_intermediate = continue_intermediate,
intermediate_stage_start = intermediate_stage_start,
save_intermediate = save_intermediate,
intermediate_stage_increment = intermediate_stage_increment,
run_csminwel = run_csminwel,
tempered_update_prior_weight = tempered_update_prior_weight)
end
########################################################################################
### Step 4: Calculate and save parameter covariance matrix
########################################################################################
compute_parameter_covariance(m, filestring_addl = filestring_addl)
return nothing
end
"""
```
compute_parameter_covariance(m::Union{AbstractDSGEModel,AbstractVARModel})
```
Calculates the parameter covariance matrix from saved parameter draws, and writes it to the
parameter_covariance.h5 file in the `workpath(m, "estimate")` directory.
### Arguments
* `m::Union{AbstractDSGEModel,AbstractVARModel}`: the model object
"""
function compute_parameter_covariance(m::Union{AbstractDSGEModel,AbstractVARModel};
filestring_addl::Vector{String} = Vector{String}(undef, 0))
sampling_method = get_setting(m, :sampling_method)
if sampling_method ∉ [:MH, :SMC]
throw("Invalid sampling method specified in setting :sampling_method")
end
prefix = sampling_method == :MH ? "mh" : "smc"
param_draws_path = rawpath(m, "estimate", prefix * "save.h5", filestring_addl)
savepath = workpath(m, "estimate", "parameter_covariance.h5", filestring_addl)
return compute_parameter_covariance(param_draws_path, sampling_method; savepath = savepath)
end
"""
```
compute_parameter_covariance(param_draws_path::String, sampling_method::Symbol;
savepath = "parameter_covariance.h5")
```
Generic function calculates the parameter covariance matrix from saved parameter draws,
writes it to the specified savepath.
### Arguments
* `param_draws_path::String`: Path to file where parameter draws are stored.
* `sampling_method::Symbol`: Sampling method used for estimation.
```
- `:MH`: Metropolis-Hastings
- `:SMC`: Sequential Monte Carlo
```
### Optional Arguments
* `savepath::String`: Where parameter covariance matrix is to be saved. Will default
to "parameter_covariance.h5" if unspecified.
"""
function compute_parameter_covariance(param_draws_path::String, sampling_method::Symbol;
savepath::String = "parameter_covariance.h5")
if sampling_method ∉ [:MH, :SMC]
throw("Invalid sampling method specified in setting :sampling_method")
end
prefix = sampling_method == :MH ? "mh" : "smc"
if !isfile(param_draws_path)
@printf stderr "Saved parameter draws not found.\n"
return
end
param_draws = h5open(param_draws_path, "r") do f
read(f, prefix * "params")
end
# Calculate covariance matrix
param_covariance = cov(param_draws)
# Write to file
h5open(savepath, "w") do f
f[prefix * "cov"] = param_covariance
end
end
"""
```
get_estimation_output_files(m)
```
Returns a `Dict{Symbol, String}` with all files created by `estimate(m)`.
"""
function get_estimation_output_files(m::Union{AbstractDSGEModel,AbstractVARModel})
output_files = Dict{Symbol, String}()
for file in [:paramsmode, :hessian, :mhsave]
output_files[file] = rawpath(m, "estimate", "$file.h5")
end
for file in [:paramsmean, :parameter_covariance]
output_files[file] = workpath(m, "estimate", "$file.h5")
end
for file in [:priors, :prior_posterior_means, :moments]
output_files[file] = tablespath(m, "estimate", "$file.tex")
end
return output_files
end
| {
"pile_set_name": "Github"
} |
<footer class="nav-footer" itemscope itemtype="http://schema.org/Organization">
<nav>
<ul class="nav-top-list nav-footer-list">
<li><%= link_to 'Home', '/' %></li>
<li><%= link_to 'Papers', 'https://github.com/papers-we-love/papers-we-love' %></li>
<li><%= link_to 'Chapters', '/chapter' %></li>
<li><%= link_to 'Submission Guidelines', 'https://github.com/papers-we-love/papers-we-love#contributing-guidelines' %></li>
</ul>
</nav>
<h3>© <%= Date.today.year %> <span itemprop="name">Papers We Love<sup>SM</sup></span>, all rights reserved | Watch the videos from <a href="http://pwlconf.org">PWLConf!</a>
</footer>
| {
"pile_set_name": "Github"
} |
//
// _RXDelegateProxy.m
// RxCocoa
//
// Created by Krunoslav Zaher on 7/4/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#import "include/_RXDelegateProxy.h"
#import "include/_RX.h"
#import "include/_RXObjCRuntime.h"
@interface _RXDelegateProxy () {
id __weak __forwardToDelegate;
}
@property (nonatomic, strong) id strongForwardDelegate;
@end
static NSMutableDictionary *voidSelectorsPerClass = nil;
@implementation _RXDelegateProxy
+(NSSet*)collectVoidSelectorsForProtocol:(Protocol *)protocol {
NSMutableSet *selectors = [NSMutableSet set];
unsigned int protocolMethodCount = 0;
struct objc_method_description *pMethods = protocol_copyMethodDescriptionList(protocol, NO, YES, &protocolMethodCount);
for (unsigned int i = 0; i < protocolMethodCount; ++i) {
struct objc_method_description method = pMethods[i];
if (RX_is_method_with_description_void(method)) {
[selectors addObject:SEL_VALUE(method.name)];
}
}
free(pMethods);
unsigned int numberOfBaseProtocols = 0;
Protocol * __unsafe_unretained * pSubprotocols = protocol_copyProtocolList(protocol, &numberOfBaseProtocols);
for (unsigned int i = 0; i < numberOfBaseProtocols; ++i) {
[selectors unionSet:[self collectVoidSelectorsForProtocol:pSubprotocols[i]]];
}
free(pSubprotocols);
return selectors;
}
+(void)initialize {
@synchronized (_RXDelegateProxy.class) {
if (voidSelectorsPerClass == nil) {
voidSelectorsPerClass = [[NSMutableDictionary alloc] init];
}
NSMutableSet *voidSelectors = [NSMutableSet set];
#define CLASS_HIERARCHY_MAX_DEPTH 100
NSInteger classHierarchyDepth = 0;
Class targetClass = NULL;
for (classHierarchyDepth = 0, targetClass = self;
classHierarchyDepth < CLASS_HIERARCHY_MAX_DEPTH && targetClass != nil;
++classHierarchyDepth, targetClass = class_getSuperclass(targetClass)
) {
unsigned int count;
Protocol *__unsafe_unretained *pProtocols = class_copyProtocolList(targetClass, &count);
for (unsigned int i = 0; i < count; i++) {
NSSet *selectorsForProtocol = [self collectVoidSelectorsForProtocol:pProtocols[i]];
[voidSelectors unionSet:selectorsForProtocol];
}
free(pProtocols);
}
if (classHierarchyDepth == CLASS_HIERARCHY_MAX_DEPTH) {
NSLog(@"Detected weird class hierarchy with depth over %d. Starting with this class -> %@", CLASS_HIERARCHY_MAX_DEPTH, self);
#if DEBUG
abort();
#endif
}
voidSelectorsPerClass[CLASS_VALUE(self)] = voidSelectors;
}
}
-(id)_forwardToDelegate {
return __forwardToDelegate;
}
-(void)_setForwardToDelegate:(id __nullable)forwardToDelegate retainDelegate:(BOOL)retainDelegate {
__forwardToDelegate = forwardToDelegate;
if (retainDelegate) {
self.strongForwardDelegate = forwardToDelegate;
}
else {
self.strongForwardDelegate = nil;
}
}
-(BOOL)hasWiredImplementationForSelector:(SEL)selector {
return [super respondsToSelector:selector];
}
-(BOOL)voidDelegateMethodsContain:(SEL)selector {
@synchronized(_RXDelegateProxy.class) {
NSSet *voidSelectors = voidSelectorsPerClass[CLASS_VALUE(self.class)];
NSAssert(voidSelectors != nil, @"Set of allowed methods not initialized");
return [voidSelectors containsObject:SEL_VALUE(selector)];
}
}
-(void)forwardInvocation:(NSInvocation *)anInvocation {
BOOL isVoid = RX_is_method_signature_void(anInvocation.methodSignature);
NSArray *arguments = nil;
if (isVoid) {
arguments = RX_extract_arguments(anInvocation);
[self _sentMessage:anInvocation.selector withArguments:arguments];
}
if (self._forwardToDelegate && [self._forwardToDelegate respondsToSelector:anInvocation.selector]) {
[anInvocation invokeWithTarget:self._forwardToDelegate];
}
if (isVoid) {
[self _methodInvoked:anInvocation.selector withArguments:arguments];
}
}
// abstract method
-(void)_sentMessage:(SEL)selector withArguments:(NSArray *)arguments {
}
// abstract method
-(void)_methodInvoked:(SEL)selector withArguments:(NSArray *)arguments {
}
-(void)dealloc {
}
@end
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.3) on Sat Aug 29 22:02:40 CEST 2020 -->
<title>Uses of Class org.fluentlenium.core.action.MouseActions (FluentLenium 4.5.1 API)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2020-08-29">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.fluentlenium.core.action.MouseActions (FluentLenium 4.5.1 API)";
}
}
catch(err) {
}
//-->
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">Class</a></li>
<li class="navBarCell1Rev">Use</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" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding"> </div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<main role="main">
<div class="header">
<h2 title="Uses of Class org.fluentlenium.core.action.MouseActions" class="title">Uses of Class<br>org.fluentlenium.core.action.MouseActions</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary">
<caption><span>Packages that use <a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<th class="colFirst" scope="row"><a href="#org.fluentlenium.core">org.fluentlenium.core</a></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<th class="colFirst" scope="row"><a href="#org.fluentlenium.core.action">org.fluentlenium.core.action</a></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList">
<section role="region"><a id="org.fluentlenium.core">
<!-- -->
</a>
<h3>Uses of <a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a> in <a href="../../package-summary.html">org.fluentlenium.core</a></h3>
<table class="useSummary">
<caption><span>Methods in <a href="../../package-summary.html">org.fluentlenium.core</a> that return <a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">FluentControlImpl.</span><code><span class="memberNameLink"><a href="../../FluentControlImpl.html#mouse()">mouse</a></span>()</code></th>
<td class="colLast"> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">FluentDriver.</span><code><span class="memberNameLink"><a href="../../FluentDriver.html#mouse()">mouse</a></span>()</code></th>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</section>
</li>
<li class="blockList">
<section role="region"><a id="org.fluentlenium.core.action">
<!-- -->
</a>
<h3>Uses of <a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a> in <a href="../package-summary.html">org.fluentlenium.core.action</a></h3>
<table class="useSummary">
<caption><span>Methods in <a href="../package-summary.html">org.fluentlenium.core.action</a> that return <a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#click()">click</a></span>()</code></th>
<td class="colLast">
<div class="block">Clicks at the current mouse location.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#clickAndHold()">clickAndHold</a></span>()</code></th>
<td class="colLast">
<div class="block">Clicks (without releasing) at the current mouse location.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#contextClick()">contextClick</a></span>()</code></th>
<td class="colLast">
<div class="block">Performs a context-click at the current mouse location.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#doubleClick()">doubleClick</a></span>()</code></th>
<td class="colLast">
<div class="block">Performs a double-click at the current mouse location.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">InputControl.</span><code><span class="memberNameLink"><a href="../InputControl.html#mouse()">mouse</a></span>()</code></th>
<td class="colLast">
<div class="block">Execute mouse actions</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#moveByOffset(int,int)">moveByOffset</a></span>​(int xOffset,
int yOffset)</code></th>
<td class="colLast">
<div class="block">Moves the mouse from its current position (or 0,0) by the given offset.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">MouseActions</a></code></td>
<th class="colSecond" scope="row"><span class="typeNameLabel">MouseActions.</span><code><span class="memberNameLink"><a href="../MouseActions.html#release()">release</a></span>()</code></th>
<td class="colLast">
<div class="block">Releases the depressed left mouse button at the current mouse location.</div>
</td>
</tr>
</tbody>
</table>
</section>
</li>
</ul>
</li>
</ul>
</div>
</main>
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../MouseActions.html" title="class in org.fluentlenium.core.action">Class</a></li>
<li class="navBarCell1Rev">Use</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" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright © 2020 <a href="https://github.com/FluentLenium">FluentLenium</a>. All rights reserved.</small></p>
</footer>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Runtime.InteropServices;
#pragma warning disable 1591
namespace Microsoft.Diagnostics.Runtime.Interop
{
[ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("0690e046-9c23-45ac-a04f-987ac29ad0d3")]
public interface IDebugEventCallbacksWide
{
[PreserveSig]
int GetInterestMask(
[Out] out DEBUG_EVENT Mask);
[PreserveSig]
int Breakpoint(
[In, MarshalAs(UnmanagedType.Interface)] IDebugBreakpoint2 Bp);
[PreserveSig]
int Exception(
[In] ref EXCEPTION_RECORD64 Exception,
[In] UInt32 FirstChance);
[PreserveSig]
int CreateThread(
[In] UInt64 Handle,
[In] UInt64 DataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitThread(
[In] UInt32 ExitCode);
[PreserveSig]
int CreateProcess(
[In] UInt64 ImageFileHandle,
[In] UInt64 Handle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp,
[In] UInt64 InitialThreadHandle,
[In] UInt64 ThreadDataOffset,
[In] UInt64 StartOffset);
[PreserveSig]
int ExitProcess(
[In] UInt32 ExitCode);
[PreserveSig]
int LoadModule(
[In] UInt64 ImageFileHandle,
[In] UInt64 BaseOffset,
[In] UInt32 ModuleSize,
[In, MarshalAs(UnmanagedType.LPWStr)] string ModuleName,
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageName,
[In] UInt32 CheckSum,
[In] UInt32 TimeDateStamp);
[PreserveSig]
int UnloadModule(
[In, MarshalAs(UnmanagedType.LPWStr)] string ImageBaseName,
[In] UInt64 BaseOffset);
[PreserveSig]
int SystemError(
[In] UInt32 Error,
[In] UInt32 Level);
[PreserveSig]
int SessionStatus(
[In] DEBUG_SESSION Status);
[PreserveSig]
int ChangeDebuggeeState(
[In] DEBUG_CDS Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeEngineState(
[In] DEBUG_CES Flags,
[In] UInt64 Argument);
[PreserveSig]
int ChangeSymbolState(
[In] DEBUG_CSS Flags,
[In] UInt64 Argument);
}
} | {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Locale;
/**
* Price locale format.
*/
class Format implements \Magento\Framework\Locale\FormatInterface
{
/**
* Japan locale code
*/
private const JAPAN_LOCALE_CODE = 'ja_JP';
/**
* @var \Magento\Framework\App\ScopeResolverInterface
*/
protected $_scopeResolver;
/**
* @var \Magento\Framework\Locale\ResolverInterface
*/
protected $_localeResolver;
/**
* @var \Magento\Directory\Model\CurrencyFactory
*/
protected $currencyFactory;
/**
* @param \Magento\Framework\App\ScopeResolverInterface $scopeResolver
* @param ResolverInterface $localeResolver
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
*/
public function __construct(
\Magento\Framework\App\ScopeResolverInterface $scopeResolver,
\Magento\Framework\Locale\ResolverInterface $localeResolver,
\Magento\Directory\Model\CurrencyFactory $currencyFactory
) {
$this->_scopeResolver = $scopeResolver;
$this->_localeResolver = $localeResolver;
$this->currencyFactory = $currencyFactory;
}
/**
* Returns the first found number from a string.
*
* Parsing depends on given locale (grouping and decimal)
*
* Examples for input:
* ' 2345.4356,1234' = 23455456.1234
* '+23,3452.123' = 233452.123
* ' 12343 ' = 12343
* '-9456km' = -9456
* '0' = 0
* '2 054,10' = 2054.1
* '2'054.52' = 2054.52
* '2,46 GB' = 2.46
*
* @param string|float|int $value
* @return float|null
*/
public function getNumber($value)
{
if ($value === null) {
return null;
}
if (!is_string($value)) {
return (float)$value;
}
//trim spaces and apostrophes
$value = preg_replace('/[^0-9^\^.,-]/m', '', $value);
$separatorComa = strpos($value, ',');
$separatorDot = strpos($value, '.');
if ($separatorComa !== false && $separatorDot !== false) {
if ($separatorComa > $separatorDot) {
$value = str_replace(['.', ','], ['', '.'], $value);
} else {
$value = str_replace(',', '', $value);
}
} elseif ($separatorComa !== false) {
$locale = $this->_localeResolver->getLocale();
/**
* It's hard code for Japan locale.
* Comma separator uses as group separator: 4,000 saves as 4,000.00
*/
$value = str_replace(
',',
$locale === self::JAPAN_LOCALE_CODE ? '' : '.',
$value
);
}
return (float)$value;
}
/**
* Returns an array with price formatting info
*
* @param string $localeCode Locale code.
* @param string $currencyCode Currency code.
* @return array
*/
public function getPriceFormat($localeCode = null, $currencyCode = null)
{
$localeCode = $localeCode ?: $this->_localeResolver->getLocale();
if ($currencyCode) {
$currency = $this->currencyFactory->create()->load($currencyCode);
} else {
$currency = $this->_scopeResolver->getScope()->getCurrentCurrency();
}
$formatter = new \NumberFormatter(
$currency->getCode() ? $localeCode . '@currency=' . $currency->getCode() : $localeCode,
\NumberFormatter::CURRENCY
);
$format = $formatter->getPattern();
$decimalSymbol = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
$groupSymbol = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
$pos = strpos($format, ';');
if ($pos !== false) {
$format = substr($format, 0, $pos);
}
$format = preg_replace("/[^0\#\.,]/", '', $format);
$totalPrecision = 0;
$decimalPoint = strpos($format, '.');
if ($decimalPoint !== false) {
$totalPrecision = strlen($format) - (strrpos($format, '.') + 1);
} else {
$decimalPoint = strlen($format);
}
$requiredPrecision = $totalPrecision;
$t = substr($format, $decimalPoint);
$pos = strpos($t, '#');
if ($pos !== false) {
$requiredPrecision = strlen($t) - $pos - $totalPrecision;
}
if (strrpos($format, ',') !== false) {
$group = $decimalPoint - strrpos($format, ',') - 1;
} else {
$group = strrpos($format, '.');
}
$result = [
//TODO: change interface
'pattern' => $currency->getOutputFormat(),
'precision' => $totalPrecision,
'requiredPrecision' => $requiredPrecision,
'decimalSymbol' => $decimalSymbol,
'groupSymbol' => $groupSymbol,
'groupLength' => $group,
'integerRequired' => $totalPrecision == 0,
];
return $result;
}
}
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include <sys/dir.h>
//#include <error.h>
#include <tables_dict.h>
#include <print_data.h>
#include <check_data.h>
#include <dirent.h>
#include <decimal.h>
#include <m_ctype.h>
//#include <decimal.c>
//#include <ctype-latin1.c>
//#include <ctype-utf8.c>
//#include <my_strtoll10.c>
//#include <strend.c>
//#include <ctype-simple.c>
//#include <my_vsnprintf.c>
#include <bchange.c>
#include <bcmp.c>
#include <bfill.c>
#include <bmove512.c>
#include <bmove.c>
#include <bmove_upp.c>
#include <ctype-bin.c>
#include <ctype.c>
#include <ctype-latin1.c>
#include <ctype-mb.c>
#include <ctype-simple.c>
#include <ctype-utf8.c>
#include <decimal.c>
#include <int2str.c>
#include <is_prefix.c>
#include <llstr.c>
#include <longlong2str.c>
#include <my_strtoll10.c>
#include <my_vsnprintf.c>
#include <r_strinstr.c>
#include <str2int.c>
#include <str_alloc.c>
#include <strappend.c>
#include <strcend.c>
#include <strcont.c>
#include <strend.c>
#include <strfill.c>
#include <strinstr.c>
#include <strmake.c>
#include <strmov.c>
#include <strnlen.c>
#include <strnmov.c>
#include <strstr.c>
#include <strtod.c>
#include <strtol.c>
#include <strtoll.c>
#include <strtoul.c>
#include <strtoull.c>
#include <strxmov.c>
#include <strxnmov.c>
#include <xml.c>
#define DIG_MASK 100000000
#define DIG_MAX (DIG_BASE-1)
#define DIG_BASE 1000000000
// Global flags from getopt
bool deleted_pages_only = 0;
bool deleted_records_only = 0;
bool undeleted_records_only = 1;
bool debug = 0;
//bool process_redundant = 0;
//bool process_compact = 0;
bool process_56 = 0;
char blob_dir[256] = ".";
char dump_prefix[256] = "default";
char path_ibdata[256];
bool external_in_ibdata = 0;
dulint filter_id;
int use_filter_id = 0;
FILE* f_result;
FILE* f_sql;
extern int load_table(char*);
inline void error(char *msg) {
fprintf(stderr, "Error: %s\n", msg);
exit(1);
}
/* Recovery status counter */
unsigned long records_expected_total = 0;
unsigned long records_dumped_total = 0;
int records_lost = 0;
/*****************************************************************
* Prints the contents of a memory buffer in hex and ascii. */
void
ut_print_buf(
/*=========*/
FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */
ulint len) /* in: length of the buffer */
{
const byte* data;
ulint i;
fprintf(file, " len %lu; hex ", len);
for (data = buf, i = 0; i < len; i++) {
fprintf(file, "%02lx", (ulong)*data++);
}
fputs("; asc ", file);
data = buf;
for (i = 0; i < len; i++) {
int c = (int) *data++;
putc(isprint(c) ? c : ' ', file);
}
putc(';', file);
}
/*******************************************************************/
ulint process_ibrec(page_t *page, rec_t *rec, table_def_t *table, ulint *offsets, bool hex) {
ulint data_size;
int i;
// Print trx_id and rollback pointer
for(i = 0; i < table->fields_count; i++) {
ulint len;
byte *field = rec_get_nth_field(rec, offsets, i, &len);
if (table->fields[i].type == FT_INTERNAL){
if (debug) printf("Field #%i @ %p: length %lu, value: ", i, field, len);
print_field_value(field, len, &(table->fields[i]), hex);
if (i < table->fields_count - 1) fprintf(f_result, "\t");
if (debug) printf("\n");
}
}
// Print table name
if (debug) {
printf("Processing record %p from table '%s'\n", rec, table->name);
rec_print_new(stdout, rec, offsets);
} else {
fprintf(f_result, "%s\t", table->name);
}
data_size = rec_offs_data_size(offsets);
for(i = 0; i < table->fields_count; i++) {
ulint len;
byte *field = rec_get_nth_field(rec, offsets, i, &len);
if (table->fields[i].type == FT_INTERNAL) continue;
if (debug) printf("Field #%i @ %p: length %lu, value: ", i, field, len);
if (len == UNIV_SQL_NULL) {
fprintf(f_result, "NULL");
} else {
if (rec_offs_nth_extern(offsets, i)) {
print_field_value_with_external(field, len, &(table->fields[i]), hex);
} else {
print_field_value(field, len, &(table->fields[i]), hex);
}
}
if (i < table->fields_count - 1) fprintf(f_result, "\t");
if (debug) printf("\n");
}
fprintf(f_result, "\n");
return data_size; // point to the next possible record's start
}
/*******************************************************************/
inline ibool check_constraints(rec_t *rec, table_def_t* table, ulint* offsets) {
int i;
ulint len_sum = 0;
if (debug) {
printf("\nChecking constraints for a row (%s) at %p:", table->name, rec);
ut_print_buf(stdout, rec, 100);
}
// Check every field
for(i = 0; i < table->fields_count; i++) {
// Get field value pointer and field length
ulint len;
byte *field = rec_get_nth_field(rec, offsets, i, &len);
if (debug) printf("\n - field %s(addr = %p, len = %lu):", table->fields[i].name, field, len);
if (len != UNIV_SQL_NULL) {
len_sum += len;
}
else {
if (!rec_offs_comp(offsets)) {
len_sum += rec_get_nth_field_size(rec, i);
}
}
// Skip null fields from type checks and fail if null is not allowed by data limits
if (len == UNIV_SQL_NULL) {
if (table->fields[i].has_limits && !table->fields[i].limits.can_be_null) {
if (debug) printf("data can't be NULL");
return FALSE;
}
continue;
}
// Check limits
if (!table->fields[i].has_limits) continue;
if (!check_field_limits(&(table->fields[i]), field, len)) {
if (debug) printf("LIMITS check failed(field = %p, len = %ld)!\n", field, len);
return FALSE;
}
}
// Why do we need this check?
/*
if (len_sum != rec_offs_data_size(offsets)) {
fprintf(stderr,
"\nInnoDB: Error: record len should be %lu, len %lu\n",
(ulong) len_sum,
(ulong) rec_offs_data_size(offsets));
return FALSE;
}
*/
if (debug) printf("\nRow looks OK!\n");
return TRUE;
}
/*******************************************************************/
inline ibool check_fields_sizes(rec_t *rec, table_def_t *table, ulint *offsets) {
int i;
if (debug) {
printf("\nChecking field lengths for a row (%s): ", table->name);
printf("OFFSETS: ");
unsigned long int prev_offset = 0;
unsigned long int curr_offset = 0;
for(i = 0; i < rec_offs_n_fields(offsets); i++) {
curr_offset = rec_offs_base(offsets)[i];
printf("%lu (+%lu); ", curr_offset, curr_offset - prev_offset);
prev_offset = curr_offset;
}
// printf("\n");
}
// check every field
for(i = 0; i < table->fields_count; i++) {
// Get field size
ulint len = rec_offs_nth_size(offsets, i);
if (debug) printf("\n - field %s(%lu):", table->fields[i].name, len);
// If field is null
if (len == UNIV_SQL_NULL) {
// Check if it can be null and jump to a next field if it is OK
if (table->fields[i].can_be_null) continue;
// Invalid record where non-nullable field is NULL
if (debug) printf("Can't be NULL or zero-length!\n");
return FALSE;
}
// Check size of fixed-length field
if (table->fields[i].fixed_length) {
// Check if size is the same and jump to the next field if it is OK
if (len == table->fields[i].fixed_length || (len == 0 && table->fields[i].can_be_null)) continue;
// Invalid fixed length field
if (debug) printf("Invalid fixed length field size: %lu, but should be %u!\n", len, table->fields[i].fixed_length);
return FALSE;
}
// Check if has externally stored data
if (rec_offs_nth_extern(offsets, i)) {
if (debug) printf("\nEXTERNALLY STORED VALUE FOUND in field %i\n", i);
if (table->fields[i].type == FT_TEXT || table->fields[i].type == FT_BLOB) continue;
if (debug) printf("Invalid external data flag!\n");
return FALSE;
}
// Check size limits for varlen fields
if (len < table->fields[i].min_length || len > table->fields[i].max_length) {
if (debug) printf("Length limits check failed (%lu < %u || %lu > %u)!\n", len, table->fields[i].min_length, len, table->fields[i].max_length);
return FALSE;
}
if (debug) printf("OK!");
}
if (debug) printf("\n");
return TRUE;
}
/*******************************************************************/
inline ibool ibrec_init_offsets_new(page_t *page, rec_t* rec, table_def_t* table, ulint* offsets) {
ulint i = 0;
ulint offs;
const byte* nulls;
const byte* lens;
ulint null_mask;
ulint status = rec_get_status(rec);
// Skip non-ordinary records
if (status != REC_STATUS_ORDINARY) return FALSE;
// First field is 0 bytes from origin point
rec_offs_base(offsets)[0] = 0;
// Init first bytes
rec_offs_set_n_fields(offsets, table->fields_count);
nulls = rec - (REC_N_NEW_EXTRA_BYTES + 1);
lens = nulls - (table->n_nullable + 7) / 8;
offs = 0;
null_mask = 1;
/* read the lengths of fields 0..n */
do {
ulint len;
field_def_t *field = &(table->fields[i]);
/* nullable field => read the null flag */
if (field->can_be_null) {
// if (debug) printf("nullable field => read the null flag\n");
if (!(byte)null_mask) {
nulls--;
null_mask = 1;
}
if (*nulls & null_mask) {
null_mask <<= 1;
/* No length is stored for NULL fields.
We do not advance offs, and we set
the length to zero and enable the
SQL NULL flag in offsets[]. */
len = offs | REC_OFFS_SQL_NULL;
goto resolved;
}
null_mask <<= 1;
}
if (!field->fixed_length) {
// if (debug) printf("Variable-length field: read the length\n");
/* Variable-length field: read the length */
len = *lens--;
if (field->max_length > 255 || field->type == FT_BLOB || field->type == FT_TEXT) {
if (len & 0x80) {
/* 1exxxxxxx xxxxxxxx */
len <<= 8;
len |= *lens--;
offs += len & 0x3fff;
if (len & 0x4000) {
len = offs | REC_OFFS_EXTERNAL;
} else {
len = offs;
}
goto resolved;
}
}
len = offs += len;
} else {
len = offs += field->fixed_length;
}
resolved:
offs &= 0xffff;
if (rec + offs - page > UNIV_PAGE_SIZE) {
if (debug) printf("Invalid offset for field %lu: %lu\n", i, offs);
return FALSE;
}
rec_offs_base(offsets)[i + 1] = len;
} while (++i < table->fields_count);
return TRUE;
}
/*******************************************************************/
inline ibool ibrec_init_offsets_old(page_t *page, rec_t* rec, table_def_t* table, ulint* offsets) {
ulint i = 0;
ulint offs;
// First field is 0 bytes from origin point
rec_offs_base(offsets)[0] = 0;
// Init first bytes
rec_offs_set_n_fields(offsets, table->fields_count);
/* Old-style record: determine extra size and end offsets */
offs = REC_N_OLD_EXTRA_BYTES;
if (rec_get_1byte_offs_flag(rec)) {
offs += rec_offs_n_fields(offsets);
*rec_offs_base(offsets) = offs;
/* Determine offsets to fields */
do {
offs = rec_1_get_field_end_info(rec, i);
if (offs & REC_1BYTE_SQL_NULL_MASK) {
offs &= ~REC_1BYTE_SQL_NULL_MASK;
offs |= REC_OFFS_SQL_NULL;
}
offs &= 0xffff;
if (rec + offs - page > UNIV_PAGE_SIZE) {
if (debug) printf("Invalid offset for field %lu: %lu\n", i, offs);
return FALSE;
}
rec_offs_base(offsets)[1 + i] = offs;
} while (++i < rec_offs_n_fields(offsets));
} else {
offs += 2 * rec_offs_n_fields(offsets);
*rec_offs_base(offsets) = offs;
/* Determine offsets to fields */
do {
offs = rec_2_get_field_end_info(rec, i);
if (offs & REC_2BYTE_SQL_NULL_MASK) {
offs &= ~REC_2BYTE_SQL_NULL_MASK;
offs |= REC_OFFS_SQL_NULL;
}
if (offs & REC_2BYTE_EXTERN_MASK) {
offs &= ~REC_2BYTE_EXTERN_MASK;
offs |= REC_OFFS_EXTERNAL;
}
offs &= 0xffff;
if (rec + offs - page > UNIV_PAGE_SIZE) {
if (debug) printf("Invalid offset for field %lu: %lu\n", i, offs);
return FALSE;
}
rec_offs_base(offsets)[1 + i] = offs;
} while (++i < rec_offs_n_fields(offsets));
}
return TRUE;
}
/*******************************************************************/
inline ibool check_for_a_record(page_t *page, rec_t *rec, table_def_t *table, ulint *offsets) {
ulint offset, data_size;
int flag;
// Check if given origin is valid
offset = rec - page;
if (offset < record_extra_bytes + table->min_rec_header_len) return FALSE;
if (debug) printf("ORIGIN=OK ");
flag = rec_get_deleted_flag(rec, page_is_comp(page));
if (debug) printf("DELETED=0x%X ", flag);
// Skip non-deleted records
if (deleted_records_only && flag == 0) return FALSE;
// Skip deleted records
if (undeleted_records_only && flag != 0) return FALSE;
// Get field offsets for current table
int comp = page_is_comp(page);
if (comp && !ibrec_init_offsets_new(page, rec, table, offsets)) return FALSE;
if (!comp && !ibrec_init_offsets_old(page, rec, table, offsets)) return FALSE;
if (debug) printf("OFFSETS=OK ");
// Check the record's data size
data_size = rec_offs_data_size(offsets);
if (data_size > table->data_max_size) {
if (debug) printf("DATA_SIZE=FAIL(%lu > %ld) ", (long int)data_size, (long int)table->data_max_size);
return FALSE;
}
if (data_size < table->data_min_size) {
if (debug) printf("DATA_SIZE=FAIL(%lu < %lu) ", (long int)data_size, (long int)table->data_min_size);
return FALSE;
}
if (debug) printf("DATA_SIZE=OK ");
// Check fields sizes
if (!check_fields_sizes(rec, table, offsets)) return FALSE;
if (debug) printf("FIELD_SIZES=OK ");
// This record could be valid and useful for us
return TRUE;
}
/*******************************************************************/
int check_page(page_t *page, unsigned int *n_records){
int comp = page_is_comp(page);
int16_t i, s, p, b, p_prev;
int recs = 0;
int max_recs = UNIV_PAGE_SIZE / 5;
*n_records = 0;
i = (comp) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM;
s = (comp) ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM;
if(deleted_records_only == 1){
if (debug) printf("We look for deleted records only. Consider all pages are not valid\n");
return 0;
}
if (debug) printf("Checking a page\nInfimum offset: 0x%X\nSupremum offset: 0x%X\n", i, s);
p_prev = 0;
p = i;
while(p != s){
if(recs > max_recs){
*n_records = 0;
if (debug) printf("Page is bad\n");
return 0;
}
// If a pointer to the next record is negative - the page is bad
if(p < 2){
*n_records = 0;
if (debug) printf("Page is bad\n");
return 0;
}
// If the pointer is bigger than UNIV_PAGE_SIZE, the page is corrupted
if(p > UNIV_PAGE_SIZE){
*n_records = 0;
if (debug) printf("Page is bad\n");
return 0;
}
// If we've already was here, the page is bad
if(p == p_prev){
*n_records = 0;
if (debug) printf("Page is bad\n");
return 0;
}
p_prev = p;
// Get next pointer
if(comp){
b = mach_read_from_2(page + p - 2);
p = p + b;
}
else{
p = mach_read_from_2(page + p - 2);
}
if (debug) printf("Next record at offset: 0x%X (%d) \n", 0x0000FFFF & p, p);
recs++;
}
*n_records = recs -1; // - infinum record
if (debug) printf("Page is good\n");
return 1;
}
/*******************************************************************/
void process_ibpage(page_t *page, bool hex) {
ulint page_id;
rec_t *origin;
ulint offsets[MAX_TABLE_FIELDS + 2];
ulint offset, i;
int is_page_valid = 0;
int comp;
unsigned int expected_records = 0;
unsigned int expected_records_inheader = 0;
unsigned int actual_records = 0;
int16_t b, infimum, supremum;
// Skip tables if filter used
if (use_filter_id) {
dulint index_id = mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID);
if (index_id.low != filter_id.low || index_id.high != filter_id.high) {
if (debug) {
page_id = mach_read_from_4(page + FIL_PAGE_OFFSET);
printf("Skipped using index id filter: %lu!\n", page_id);
}
return;
}
}
// Read page id
page_id = mach_read_from_4(page + FIL_PAGE_OFFSET);
if (debug) printf("Page id: %lu\n", page_id);
fprintf(f_result, "-- Page id: %lu", page_id);
if(table_definitions_cnt == 0){
fprintf(stderr, "There are no table definitions. Please check include/table_defs.h\n");
exit(EXIT_FAILURE);
}
is_page_valid = check_page(page, &expected_records);
// comp == 1 if page in COMPACT format and 0 if REDUNDANT
comp = page_is_comp(page);
fprintf(f_result, ", Format: %s", (comp ) ? "COMPACT": "REDUNDANT");
infimum = (comp) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM;
supremum = (comp) ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM;
// Find possible data area start point (at least 5 bytes of utility data)
if(is_page_valid){
b = mach_read_from_2(page + infimum - 2);
offset = (comp) ? infimum + b : b;
}
else{
offset = 100 + record_extra_bytes;
}
fprintf(f_result, ", Records list: %s", is_page_valid? "Valid": "Invalid");
expected_records_inheader = mach_read_from_2(page + PAGE_HEADER + PAGE_N_RECS);
fprintf(f_result, ", Expected records: (%u %u)", expected_records, expected_records_inheader);
fprintf(f_result, "\n");
if (debug) printf("Starting offset: %lu (%lX). Checking %d table definitions.\n", offset, offset, table_definitions_cnt);
// Walk through all possible positions to the end of page
// (start of directory - extra bytes of the last rec)
//is_page_valid = 0;
while (offset < UNIV_PAGE_SIZE - record_extra_bytes && ( (offset != supremum ) || !is_page_valid) ) {
// Get record pointer
origin = page + offset;
if (debug) printf("\nChecking offset: 0x%lX: ", offset);
// Check all tables
for (i = 0; i < table_definitions_cnt; i++) {
// Get table info
table_def_t *table = &(table_definitions[i]);
if (debug) printf(" (%s) ", table->name);
// Check if origin points to a valid record
if (check_for_a_record(page, origin, table, offsets) && check_constraints(origin, table, offsets)) {
actual_records++;
if (debug) printf("\n---------------------------------------------------\n"
"PAGE%lu: Found a table %s record: %p (offset = %lu)\n", \
page_id, table->name, origin, offset);
if(is_page_valid){
process_ibrec(page, origin, table, offsets, hex);
b = mach_read_from_2(page + offset - 2);
offset = (comp) ? offset + b : b;
}
else{
offset += process_ibrec(page, origin, table, offsets, hex);
}
if (debug) printf("Next offset: 0x%lX", offset);
break;
}
else{
if(is_page_valid){
b = mach_read_from_2(page + offset - 2);
offset = (comp) ? offset + b : b;
}
else{
offset++;
}
if (debug) printf("\nNext offset: %lX", offset);
}
}
}
fflush(f_result);
int leaf_page = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL) == 0;
int lost_records = (actual_records != expected_records) && (actual_records != expected_records_inheader);
fprintf(f_result, "-- Page id: %lu", page_id);
fprintf(f_result, ", Found records: %u", actual_records);
fprintf(f_result, ", Lost records: %s", lost_records ? "YES": "NO");
fprintf(f_result, ", Leaf page: %s", leaf_page ? "YES": "NO");
fprintf(f_result, "\n");
if (leaf_page) {
records_expected_total += expected_records_inheader;
records_dumped_total += actual_records;
if (lost_records) {
records_lost = 1;
}
}
}
/*******************************************************************/
void process_ibfile(int fn, bool hex) {
int read_bytes;
page_t *page = malloc(UNIV_PAGE_SIZE);
struct stat st;
off_t pos;
ulint free_offset;
if (!page) {
fprintf(stderr, "Can't allocate page buffer!");
exit(EXIT_FAILURE);
}
if (debug) printf("Read data from fn=%d...\n", fn);
// Get file info
fstat(fn, &st);
// Read pages to the end of file
while ((read_bytes = read(fn, page, UNIV_PAGE_SIZE)) == UNIV_PAGE_SIZE) {
pos = lseek(fn, 0, SEEK_CUR);
if (pos % (UNIV_PAGE_SIZE * 512) == 0) {
fprintf(f_sql, "-- %.2f%% done\n", 100.0 * pos / st.st_size);
}
if (deleted_pages_only) {
free_offset = page_header_get_field(page, PAGE_FREE);
if (page_header_get_field(page, PAGE_N_RECS) == 0 && free_offset == 0) continue;
if (free_offset > 0 && page_header_get_field(page, PAGE_GARBAGE) == 0) continue;
if (free_offset > UNIV_PAGE_SIZE) continue;
}
// Initialize table definitions (count nullable fields, data sizes, etc)
init_table_defs(page_is_comp(page));
process_ibpage(page, hex);
}
free(page);
}
/*******************************************************************/
int open_ibfile(char *fname) {
struct stat fstat;
int fn;
// Skip non-regular files
if (debug) printf("Opening file: %s\n", fname);
if (stat(fname, &fstat) != 0 || (fstat.st_mode & S_IFREG) != S_IFREG){
fprintf(stderr, "Invalid file specified!");
exit(EXIT_FAILURE);
}
fn = open(fname, O_RDONLY, 0);
if (!fn) {
fprintf(stderr, "Can't open file!");
exit(EXIT_FAILURE);
}
return fn;
}
/*******************************************************************/
void set_filter_id(char *id) {
int cnt = sscanf(id, "%lu:%lu", &filter_id.high, &filter_id.low);
if (cnt < 2) {
fprintf(stderr, "Invalid index id provided! It should be in N:M format, where N and M are unsigned integers");
exit(EXIT_FAILURE);
}
use_filter_id = 1;
}
/*******************************************************************/
void usage() {
error(
"Usage: ./c_parser [-4|-5|-6] [-dDV] -f <InnoDB page or dir> -t table.sql [-T N:M] [-b <external pages directory>]\n"
" Where\n"
" -f <InnoDB page(s)> -- InnoDB page or directory with pages(all pages should have same index_id)\n"
" -t <table.sql> -- CREATE statement of a table\n"
" -o <file> -- Save dump in this file. Otherwise print to stdout\n"
" -l <file> -- Save SQL statements in this file. Otherwise print to stderr\n"
" -h -- Print this help\n"
" -d -- Process only those pages which potentially could have deleted records (default = NO)\n"
" -D -- Recover deleted rows only (default = NO)\n"
" -U -- Recover UNdeleted rows only (default = YES)\n"
" -V -- Verbose mode (lots of debug information)\n"
" -4 -- innodb_datafile is in REDUNDANT format\n"
" -5 -- innodb_datafile is in COMPACT format\n"
" -6 -- innodb_datafile is in MySQL 5.6 format\n"
" c_parser can detect REDUNDANT or COMPACT, so -4 and -5 are optional. If you use MySQL 5.6+ however, -6 is necessary\n"
" -T -- retrieves only pages with index id = NM (N - high word, M - low word of id)\n"
" -b <dir> -- Directory where external pages can be found. Usually it is pages-XXX/FIL_PAGE_TYPE_BLOB/\n"
" -i <file> -- Read external pages at their offsets from <file>.\n"
" -p prefix -- Use prefix for a directory name in LOAD DATA INFILE command\n"
" -x -- Print text values in hexadecimal format.\n"
"\n"
);
}
/*******************************************************************/
int main(int argc, char **argv) {
int fn = 0, ch;
int is_dir = 0;
struct stat st;
char src[256] = "";
char table_schema[256] = "";
char buffer[BUFSIZ];
setvbuf(stdout, buffer, _IOFBF, sizeof(buffer));
f_result = stdout;
f_sql = stderr;
char result_file[1024];
char sql_file[1024];
bool hex = 0;
while ((ch = getopt(argc, argv, "t:456hdDUVf:T:b:p:o:i:l:x")) != -1) {
switch (ch) {
case 'd':
deleted_pages_only = 1;
break;
case 'D':
deleted_records_only = 1;
undeleted_records_only = 0;
break;
case 'U':
undeleted_records_only = 1;
break;
case 'o':
strncpy(result_file, optarg, sizeof(result_file));
if(NULL == (f_result = fopen(result_file, "w"))){
fprintf(stderr, "Can't open file %s for writing\n", result_file);
exit(-1);
}
break;
case 'i':
strncpy(path_ibdata, optarg, sizeof(path_ibdata));
external_in_ibdata = 1;
break;
case 'l':
strncpy(sql_file, optarg, sizeof(sql_file));
if(NULL == (f_sql = fopen(sql_file, "w"))){
fprintf(stderr, "Can't open file %s for writing\n", sql_file);
exit(-1);
}
break;
case 't':
strncpy(table_schema, optarg, sizeof(table_schema));
break;
case 'f':
strncpy(src, optarg, sizeof(src));
if(stat(src, &st) == 0){
if(S_ISDIR(st.st_mode)){
is_dir = 1;
}
}
else{
perror("stat");
fprintf(stderr, "Can't stat %s\n", src);
exit(-1);
}
break;
case 'V':
debug = 1;
break;
case '4':
case '5':
break;
case '6':
process_56 = 1;
break;
case 'T':
set_filter_id(optarg);
break;
case 'b':
strncpy(blob_dir, optarg, sizeof(blob_dir));
break;
case 'p':
strncpy(dump_prefix, optarg, sizeof(dump_prefix));
break;
case 'x':
hex = 1;
break;
default:
case '?':
case 'h':
usage();
}
}
if(src[0] == 0){
usage();
}
if(load_table(table_schema) != 0){
fprintf(stderr, "Failed to parse table structure\n");
usage();
exit(EXIT_FAILURE);
}
if(is_dir){
DIR *src_dir;
char src_file[256];
struct dirent *de;
src_dir = opendir(src);
while(NULL != (de = readdir(src_dir))){
if(!strncmp(de->d_name, ".", sizeof(de->d_name))) continue;
if(!strncmp(de->d_name, "..", sizeof(de->d_name))) continue;
snprintf(src_file, sizeof(src_file), "%s/%s", src, de->d_name);
if(debug) { fprintf(stderr, "Processing %s\n", src_file); }
if(0 == (fn = open_ibfile(src_file))){
fprintf(stderr, "Can't open %s\n", src_file);
perror("open_ibfile");
exit(-1);
}
process_ibfile(fn, hex);
close(fn);
}
closedir(src_dir);
}
else{
if(0 == (fn = open_ibfile(src))){
fprintf(stderr, "Can't open %s\n", src);
perror("open_ibfile");
exit(-1);
}
process_ibfile(fn, hex);
close(fn);
}
table_def_t *table = &(table_definitions[0]);
fprintf(f_sql, "SET FOREIGN_KEY_CHECKS=0;\n");
fprintf(f_sql, "LOAD DATA LOCAL INFILE '");
if(f_result == stdout){
fprintf(f_sql, "%s/dumps/%s/%s", getenv("PWD"), dump_prefix, table->name);
}
else{
fprintf(f_sql, "%s", result_file);
}
fprintf(f_sql, "' REPLACE INTO TABLE `%s` CHARACTER SET UTF8 FIELDS TERMINATED BY '\\t' OPTIONALLY ENCLOSED BY '\"' LINES STARTING BY '%s\\t' ", table->name, table->name);
int i = 0;
int comma = 0;
int has_set = 0;
fprintf(f_sql, "(");
for(i = 0; i < table->fields_count; i++) {
if(table->fields[i].type == FT_INTERNAL) continue;
if(comma) fprintf(f_sql, ", ");
switch(table->fields[i].type){
case FT_CHAR:
case FT_TEXT:
if (hex) {
fprintf(f_sql, "@var_%s", table->fields[i].name);
has_set = 1;
} else {
fprintf(f_sql, "`%s`", table->fields[i].name);
}
break;
case FT_BIN:
case FT_BLOB:
fprintf(f_sql, "@var_%s", table->fields[i].name);
has_set = 1;
break;
case FT_BIT:
fprintf(f_sql, "@var_%s", table->fields[i].name);
has_set = 1;
break;
default:
fprintf(f_sql, "`%s`", table->fields[i].name);
}
comma = 1;
}
fprintf(f_sql, ")");
comma = 0;
if(has_set){
fprintf(f_sql, "\nSET\n");
for(i = 0; i < table->fields_count; i++) {
if(table->fields[i].type == FT_INTERNAL) continue;
switch(table->fields[i].type){
case FT_CHAR:
case FT_TEXT:
if (hex) {
if(comma) fprintf(f_sql, ",\n");
fprintf(f_sql, " `%s` = UNHEX(@var_%s)", table->fields[i].name, table->fields[i].name);
comma = 1;
}
break;
case FT_BIN:
case FT_BLOB:
if(comma) fprintf(f_sql, ",\n");
fprintf(f_sql, " `%s` = UNHEX(@var_%s)", table->fields[i].name, table->fields[i].name);
comma = 1;
break;
case FT_BIT:
if(comma) fprintf(f_sql, ",\n");
fprintf(f_sql, " `%s` = CAST(@var_%s AS UNSIGNED)", table->fields[i].name, table->fields[i].name);
comma = 1;
break;
default: break;
}
}
}
fprintf(f_sql, ";\n");
fprintf(f_sql, "-- STATUS {\"records_expected\": %lu, \"records_dumped\": %lu, \"records_lost\": %s} STATUS END\n",
records_expected_total, records_dumped_total, records_lost ? "true": "false");
return 0;
}
| {
"pile_set_name": "Github"
} |
[uwsgi]
# uWSGI core
# ----------
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#uwsgi-core
# Who will run the code
uid = ${SERVICE_USER}
gid = ${SERVICE_GROUP}
# set (python) default encoding UTF-8
env = LANG=C.UTF-8
env = LANGUAGE=C.UTF-8
env = LC_ALL=C.UTF-8
# chdir to specified directory before apps loading
chdir = ${SEARX_SRC}/searx
# searx configuration (settings.yml)
env = SEARX_SETTINGS_PATH=${SEARX_SETTINGS_PATH}
# disable logging for privacy
logger = systemd
disable-logging = true
# The right granted on the created socket
chmod-socket = 666
# Plugin to use and interpretor config
single-interpreter = true
# enable master process
master = true
# load apps in each worker instead of the master
lazy-apps = true
# load uWSGI plugins
plugin = python
# By default the Python plugin does not initialize the GIL. This means your
# app-generated threads will not run. If you need threads, remember to enable
# them with enable-threads. Running uWSGI in multithreading mode (with the
# threads options) will automatically enable threading support. This *strange*
# default behaviour is for performance reasons.
enable-threads = true
# plugin: python
# --------------
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-python
# load a WSGI module
module = searx.webapp
# set PYTHONHOME/virtualenv
virtualenv = ${SEARX_PYENV}
# add directory (or glob) to pythonpath
pythonpath = ${SEARX_SRC}
# speak to upstream
# -----------------
#
# Activate the 'http' configuration for filtron or activate the 'socket'
# configuration if you setup your HTTP server to use uWSGI protocol via sockets.
# using IP:
#
# https://uwsgi-docs.readthedocs.io/en/latest/Options.html#plugin-http
# Native HTTP support: https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
# http = ${SEARX_INTERNAL_HTTP}
# using unix-sockets:
#
# On some distributions you need to create the app folder for the sockets::
#
# mkdir -p /run/uwsgi/app/searx
# chown -R ${SERVICE_USER}:${SERVICE_GROUP} /run/uwsgi/app/searx
#
socket = /run/uwsgi/app/searx/socket | {
"pile_set_name": "Github"
} |
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.apache.ecs.xhtml;
import org.apache.ecs.Element;
import org.apache.ecs.FocusEvents;
import org.apache.ecs.KeyEvents;
import org.apache.ecs.MouseEvents;
import org.apache.ecs.Printable;
import org.apache.ecs.SinglePartElement;
/**
* This class creates a <area> tag.
*
* @version $Id: area.java,v 1.2 2006/07/30 00:54:02 jjanke Exp $
* @author <a href="mailto:snagy@servletapi.com">Stephan Nagy</a>
* @author <a href="mailto:jon@clearink.com">Jon S. Stevens</a>
* @author <a href="mailto:bojan@binarix.com">Bojan Smojver</a>
*/
public class area extends SinglePartElement
implements Printable, FocusEvents, MouseEvents, KeyEvents
{
/**
*
*/
private static final long serialVersionUID = -3902415084288774961L;
public static final String DEFAULT = "default";
public static final String rect = "rect";
public static final String circle = "circle";
public static final String poly = "poly";
/**
* Private initialization routine.
*/
{
setElementType ("area");
setCase (LOWERCASE);
setAttributeQuote (true);
setBeginEndModifier ('/');
setNoHref (true);
}
/**
* Basic constructor. Use the set* methods to set the values of the
* attributes.
*/
public area ()
{
}
/**
* Use the set* methods to set the values of the attributes.
*
* @param shape
* the shape="" attribute
*/
public area (String shape)
{
setShape (shape);
}
/**
* Use the set* methods to set the values of the attributes.
*
* @param shape
* the shape="" attribute
* @param coords
* the coords="" attribute
*/
public area (String shape, String coords)
{
setShape (shape);
setCoords (coords);
}
/**
* Use the set* methods to set the values of the attributes.
*
* @param shape
* the shape="" attribute
* @param coords
* the coords="" attribute
*/
public area (String shape, int[] coords)
{
setShape (shape);
setCoords (coords);
}
/**
* Use the set* methods to set the values of the attributes.
*
* @param shape
* the shape="" attribute
* @param coords
* the coords="" attribute
* @param href
* the href="" attribute
*/
public area (String shape, String coords, String href)
{
setShape (shape);
setCoords (coords);
setHref (href);
}
/**
* Use the set* methods to set the values of the attributes.
*
* @param shape
* the shape="" attribute
* @param coords
* the coords="" attribute
* @param href
* the href="" attribute
*/
public area (String shape, int[] coords, String href)
{
setShape (shape);
setCoords (coords);
setHref (href);
}
/**
* Sets the shape="" attribute
*
* @param shape
* the shape="" attribute
*/
public area setShape (String shape)
{
addAttribute ("shape", shape);
return this;
}
/**
* Sets the coords="" attribute
*
* @param coords
* the coords="" attribute
*/
public area setCoords (String coords)
{
addAttribute ("coords", coords);
return this;
}
/**
* Sets the coords="" attribute
*
* @param coords
* the coords="" attribute
*/
public area setCoords (int[] coords)
{
addAttribute ("coords", coords[0] + "," + coords[1] + "," + coords[2]
+ "," + coords[3]);
return this;
}
/**
* Sets the href="" attribute
*
* @param href
* the href="" attribute
*/
public area setHref (String href)
{
addAttribute ("href", href);
setNoHref (false);
return this;
}
/**
* Sets the alt="" attribute
*
* @param alt
* the alt="" attribute
*/
public area setAlt (String alt)
{
addAttribute ("alt", alt);
return this;
}
/**
* Sets the tabindex="" attribute
*
* @param index
* the tabindex="" attribute
*/
public area setTabindex (String index)
{
addAttribute ("tabindex", index);
return this;
}
/**
* Sets the tabindex="" attribute
*
* @param index
* the tabindex="" attribute
*/
public area setTabindex (int index)
{
setTabindex (Integer.toString (index));
return this;
}
/**
* Sets the nohref
*
* @param href
* true or false
*/
public area setNoHref (boolean href)
{
if (href == true)
addAttribute ("nohref", "nohref");
else
removeAttribute ("nohref");
return (this);
}
/**
* Sets the lang="" and xml:lang="" attributes
*
* @param lang
* the lang="" and xml:lang="" attributes
*/
public Element setLang (String lang)
{
addAttribute ("lang", lang);
addAttribute ("xml:lang", lang);
return this;
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public area addElement (String hashcode, Element element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Adds an Element to the element.
*
* @param hashcode
* name of element for hash table
* @param element
* Adds an Element to the element.
*/
public area addElement (String hashcode, String element)
{
addElementToRegistry (hashcode, element);
return (this);
}
/**
* Add an element to the element
*
* @param element
* a string representation of the element
*/
public area addElement (String element)
{
addElementToRegistry (element);
return (this);
}
/**
* Add an element to the element
*
* @param element
* an element to add
*/
public area addElement (Element element)
{
addElementToRegistry (element);
return (this);
}
/**
* Removes an Element from the element.
*
* @param hashcode
* the name of the element to be removed.
*/
public area removeElement (String hashcode)
{
removeElementFromRegistry (hashcode);
return (this);
}
/**
* The onfocus event occurs when an element receives focus either by the
* pointing device or by tabbing navigation. This attribute may be used with
* the following elements: LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.
*
* @param script The script
*/
public void setOnFocus (String script)
{
addAttribute ("onfocus", script);
}
/**
* The onblur event occurs when an element loses focus either by the
* pointing device or by tabbing navigation. It may be used with the same
* elements as onfocus.
*
* @param script The script
*/
public void setOnBlur (String script)
{
addAttribute ("onblur", script);
}
/**
* The onclick event occurs when the pointing device button is clicked over
* an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnClick (String script)
{
addAttribute ("onclick", script);
}
/**
* The ondblclick event occurs when the pointing device button is double
* clicked over an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnDblClick (String script)
{
addAttribute ("ondblclick", script);
}
/**
* The onmousedown event occurs when the pointing device button is pressed
* over an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnMouseDown (String script)
{
addAttribute ("onmousedown", script);
}
/**
* The onmouseup event occurs when the pointing device button is released
* over an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnMouseUp (String script)
{
addAttribute ("onmouseup", script);
}
/**
* The onmouseover event occurs when the pointing device is moved onto an
* element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnMouseOver (String script)
{
addAttribute ("onmouseover", script);
}
/**
* The onmousemove event occurs when the pointing device is moved while it
* is over an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnMouseMove (String script)
{
addAttribute ("onmousemove", script);
}
/**
* The onmouseout event occurs when the pointing device is moved away from
* an element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnMouseOut (String script)
{
addAttribute ("onmouseout", script);
}
/**
* The onkeypress event occurs when a key is pressed and released over an
* element. This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnKeyPress (String script)
{
addAttribute ("onkeypress", script);
}
/**
* The onkeydown event occurs when a key is pressed down over an element.
* This attribute may be used with most elements.
*
* @param script The script
*/
public void setOnKeyDown (String script)
{
addAttribute ("onkeydown", script);
}
/**
* The onkeyup event occurs when a key is released over an element. This
* attribute may be used with most elements.
*
* @param script The script
*/
public void setOnKeyUp (String script)
{
addAttribute ("onkeyup", script);
}
}
| {
"pile_set_name": "Github"
} |
#ifndef EXEC_H
#define EXEC_H
#include <stdint.h>
int execve(const char *filename, char *const argv[], char *const envp[]);
#endif
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr"><head><table cellpadding=0 cellspacing=0><tr><td><img src="icon:///24/funnel.png" /></td><td width="5"></td><td><h2 class="firstHeading" id="firstHeading">Sample (Bootstrapping)</h4></td></tr></table><hr noshade="true"></head>
<body class="mediawiki ltr ns-0 ns-subject page-Sample_Bootstrapping skin-monobook">
<div id="content">
<div id="bodyContent">
<div id="synopsis">
<h4>
<span class="mw-headline" id="Synopsis">Synopsis</span>
</h4>
<p>
Creates a bootstrapped sample by sampling with replacement.
</p>
</div><br/><h4> <span class="mw-headline" id="Description"> Description </span>
</h4>
<p>This operator constructs a bootstrapped sample from the given example set. That means that a sampling with replacement will be performed. The usual sample size is the number of original examples. This operator also offers the possibility to create the inverse example set, i.e. an example set containing all examples which are not part of the bootstrapped example set. This inverse example set might be used for a bootstrapped validation (together with an <i>IteratingPerformanceAverage</i> operator.
</p><br/><h4> <span class="mw-headline" id="Input"> Input </span>
</h4>
<ul class="ports">
<li> <b>example set input</b>: <i>expects:</i> ExampleSetMetaData: #examples: = 0; #attributes: 0
</li>
</ul><br/><h4> <span class="mw-headline" id="Output"> Output </span>
</h4>
<ul class="ports">
<li> <b>example set output</b>:
</li>
<li> <b>original</b>:
</li>
</ul><br/><h4> <span class="mw-headline" id="Parameters"> Parameters </span>
</h4>
<ul class="ports">
<li> <b>sample</b>: Determines how the amount of data is specified.
</li>
<li> <b>sample size</b>: The number of examples which should be sampled
</li>
<li> <b>sample ratio</b>: This ratio determines the size of the new example set.
</li>
<li> <b>use weights</b>: If checked, example weights will be considered during the bootstrapping if such weights are present.
</li>
<li> <b>use local random seed</b>: Indicates if a local random seed should be used.
</li>
<li> <b>local random seed</b>: Specifies the local random seed
</li>
</ul><br/><h4> <span class="mw-headline" id="ExampleProcess"> ExampleProcess </span>
</h4><br/><div>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// RACBlockTrampoline.m
// ReactiveCocoa
//
// Created by Josh Abernathy on 10/21/12.
// Copyright (c) 2012 GitHub, Inc. All rights reserved.
//
#import "RACBlockTrampoline.h"
#import "RACTuple.h"
@interface RACBlockTrampoline ()
@property (nonatomic, readonly, copy) id block;
@end
@implementation RACBlockTrampoline
#pragma mark API
- (id)initWithBlock:(id)block {
self = [super init];
if (self == nil) return nil;
_block = [block copy];
return self;
}
+ (id)invokeBlock:(id)block withArguments:(RACTuple *)arguments {
NSCParameterAssert(block != NULL);
RACBlockTrampoline *trampoline = [[self alloc] initWithBlock:block];
return [trampoline invokeWithArguments:arguments];
}
- (id)invokeWithArguments:(RACTuple *)arguments {
SEL selector = [self selectorForArgumentCount:arguments.count];
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[self methodSignatureForSelector:selector]];
invocation.selector = selector;
invocation.target = self;
for (NSUInteger i = 0; i < arguments.count; i++) {
id arg = arguments[i];
NSInteger argIndex = (NSInteger)(i + 2);
[invocation setArgument:&arg atIndex:argIndex];
}
[invocation invoke];
__unsafe_unretained id returnVal;
[invocation getReturnValue:&returnVal];
return returnVal;
}
- (SEL)selectorForArgumentCount:(NSUInteger)count {
NSCParameterAssert(count > 0);
switch (count) {
case 0: return NULL;
case 1: return @selector(performWith:);
case 2: return @selector(performWith::);
case 3: return @selector(performWith:::);
case 4: return @selector(performWith::::);
case 5: return @selector(performWith:::::);
case 6: return @selector(performWith::::::);
case 7: return @selector(performWith:::::::);
case 8: return @selector(performWith::::::::);
case 9: return @selector(performWith:::::::::);
case 10: return @selector(performWith::::::::::);
case 11: return @selector(performWith:::::::::::);
case 12: return @selector(performWith::::::::::::);
case 13: return @selector(performWith:::::::::::::);
case 14: return @selector(performWith::::::::::::::);
case 15: return @selector(performWith:::::::::::::::);
}
NSCAssert(NO, @"The argument count is too damn high! Only blocks of up to 15 arguments are currently supported.");
return NULL;
}
- (id)performWith:(id)obj1 {
id (^block)(id) = self.block;
return block(obj1);
}
- (id)performWith:(id)obj1 :(id)obj2 {
id (^block)(id, id) = self.block;
return block(obj1, obj2);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 {
id (^block)(id, id, id) = self.block;
return block(obj1, obj2, obj3);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 {
id (^block)(id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 {
id (^block)(id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 {
id (^block)(id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 {
id (^block)(id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 {
id (^block)(id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 {
id (^block)(id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 {
id (^block)(id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 :(id)obj11 {
id (^block)(id, id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 :(id)obj11 :(id)obj12 {
id (^block)(id, id, id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11, obj12);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 :(id)obj11 :(id)obj12 :(id)obj13 {
id (^block)(id, id, id, id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11, obj12, obj13);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 :(id)obj11 :(id)obj12 :(id)obj13 :(id)obj14 {
id (^block)(id, id, id, id, id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11, obj12, obj13, obj14);
}
- (id)performWith:(id)obj1 :(id)obj2 :(id)obj3 :(id)obj4 :(id)obj5 :(id)obj6 :(id)obj7 :(id)obj8 :(id)obj9 :(id)obj10 :(id)obj11 :(id)obj12 :(id)obj13 :(id)obj14 :(id)obj15 {
id (^block)(id, id, id, id, id, id, id, id, id, id, id, id, id, id, id) = self.block;
return block(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9, obj10, obj11, obj12, obj13, obj14, obj15);
}
@end
| {
"pile_set_name": "Github"
} |
echo Generating .fnts...
../../font_generator/a.out
python ../scripts/font_converter.py default*.fnt
| {
"pile_set_name": "Github"
} |
package
{
import flash.utils.ByteArray
public class ExploitByteArray
{
private const MAX_STRING_LENGTH:uint = 100
public var ba:ByteArray
public var original_length:uint
private var platform:String
public function ExploitByteArray(p:String, l:uint = 1024)
{
ba = new ByteArray()
ba.length = l
ba.endian = "littleEndian"
ba.writeUnsignedInt(0)
platform = p
original_length = l
}
public function set_length(length:uint):void
{
ba.length = length
}
public function get_length():uint
{
return ba.length
}
public function lets_ready():void
{
ba.endian = "littleEndian"
if (platform == "linux") {
ba.length = 0xffffffff
}
}
public function is_ready():Boolean
{
if (ba.length == 0xffffffff)
return true
return false
}
public function read(addr:uint, type:String = "dword"):uint
{
ba.position = addr
switch(type) {
case "dword":
return ba.readUnsignedInt()
case "word":
return ba.readUnsignedShort()
case "byte":
return ba.readUnsignedByte()
}
return 0
}
public function read_string(addr:uint, length:uint = 0):String
{
ba.position = addr
if (length == 0)
return ba.readUTFBytes(MAX_STRING_LENGTH)
else
return ba.readUTFBytes(length)
}
public function write(addr:uint, value:* = 0, zero:Boolean = true):void
{
var i:uint
if (addr) ba.position = addr
if (value is String) {
for (i = 0; i < value.length; i++) ba.writeByte(value.charCodeAt(i))
if (zero) ba.writeByte(0)
} else if (value is ByteArray) {
var value_length:uint = value.length
for (i = 0; i < value_length; i++) ba.writeByte(value.readByte())
} else ba.writeUnsignedInt(value)
}
}
}
| {
"pile_set_name": "Github"
} |
/**
* X509Certificate
*
* A representation for a X509 Certificate, with
* methods to parse, verify and sign it.
* Copyright (c) 2007 Henri Torgemane
*
* See LICENSE.txt for full license information.
*/
package com.hurlant.crypto.cert {
import com.hurlant.crypto.hash.IHash;
import com.hurlant.crypto.hash.MD2;
import com.hurlant.crypto.hash.MD5;
import com.hurlant.crypto.hash.SHA1;
import com.hurlant.crypto.rsa.RSAKey;
import com.hurlant.util.ArrayUtil;
import com.hurlant.util.Base64;
import com.hurlant.util.der.ByteString;
import com.hurlant.util.der.DER;
import com.hurlant.util.der.OID;
import com.hurlant.util.der.ObjectIdentifier;
import com.hurlant.util.der.PEM;
import com.hurlant.util.der.PrintableString;
import com.hurlant.util.der.Sequence;
import com.hurlant.util.der.Type;
import flash.utils.ByteArray;
public class X509Certificate {
private var _loaded:Boolean;
private var _param:*;
private var _obj:Object;
public function X509Certificate(p:*) {
_loaded = false;
_param = p;
// lazy initialization, to avoid unnecessary parsing of every builtin CA at start-up.
}
private function load():void {
if (_loaded) return;
var p:* = _param;
var b:ByteArray;
if (p is String) {
b = PEM.readCertIntoArray(p as String);
} else if (p is ByteArray) {
b = p;
}
if (b!=null) {
_obj = DER.parse(b, Type.TLS_CERT);
_loaded = true;
} else {
throw new Error("Invalid x509 Certificate parameter: "+p);
}
}
public function isSigned(store:X509CertificateCollection, CAs:X509CertificateCollection, time:Date=null):Boolean {
load();
// check timestamps first. cheapest.
if (time==null) {
time = new Date;
}
var notBefore:Date = getNotBefore();
var notAfter:Date = getNotAfter();
if (time.getTime()<notBefore.getTime()) return false; // cert isn't born yet.
if (time.getTime()>notAfter.getTime()) return false; // cert died of old age.
// check signature.
var subject:String = getIssuerPrincipal();
// try from CA first, since they're treated better.
var parent:X509Certificate = CAs.getCertificate(subject);
var parentIsAuthoritative:Boolean = false;
if (parent == null) {
parent = store.getCertificate(subject);
if (parent == null) {
return false; // issuer not found
}
} else {
parentIsAuthoritative = true;
}
if (parent == this) { // pathological case. avoid infinite loop
return false; // isSigned() returns false if we're self-signed.
}
if (!(parentIsAuthoritative&&parent.isSelfSigned(time)) &&
!parent.isSigned(store, CAs, time)) {
return false;
}
var key:RSAKey = parent.getPublicKey();
return verifyCertificate(key);
}
public function isSelfSigned(time:Date):Boolean {
load();
var key:RSAKey = getPublicKey();
return verifyCertificate(key);
}
private function verifyCertificate(key:RSAKey):Boolean {
var algo:String = getAlgorithmIdentifier();
var hash:IHash;
var oid:String;
switch (algo) {
case OID.SHA1_WITH_RSA_ENCRYPTION:
hash = new SHA1;
oid = OID.SHA1_ALGORITHM;
break;
case OID.MD2_WITH_RSA_ENCRYPTION:
hash = new MD2;
oid = OID.MD2_ALGORITHM;
break;
case OID.MD5_WITH_RSA_ENCRYPTION:
hash = new MD5;
oid = OID.MD5_ALGORITHM;
break;
default:
return false;
}
var data:ByteArray = _obj.signedCertificate_bin;
var buf:ByteArray = new ByteArray;
key.verify(_obj.encrypted, buf, _obj.encrypted.length);
buf.position=0;
data = hash.hash(data);
var obj:Object = DER.parse(buf, Type.RSA_SIGNATURE);
if (obj.algorithm.algorithmId.toString() != oid) {
return false; // wrong algorithm
}
if (!ArrayUtil.equals(obj.hash, data)) {
return false; // hashes don't match
}
return true;
}
/**
* This isn't used anywhere so far.
* It would become useful if we started to offer facilities
* to generate and sign X509 certificates.
*
* @param key
* @param algo
* @return
*
*/
private function signCertificate(key:RSAKey, algo:String):ByteArray {
var hash:IHash;
var oid:String;
switch (algo) {
case OID.SHA1_WITH_RSA_ENCRYPTION:
hash = new SHA1;
oid = OID.SHA1_ALGORITHM;
break;
case OID.MD2_WITH_RSA_ENCRYPTION:
hash = new MD2;
oid = OID.MD2_ALGORITHM;
break;
case OID.MD5_WITH_RSA_ENCRYPTION:
hash = new MD5;
oid = OID.MD5_ALGORITHM;
break;
default:
return null
}
var data:ByteArray = _obj.signedCertificate_bin;
data = hash.hash(data);
var seq1:Sequence = new Sequence;
seq1[0] = new Sequence;
seq1[0][0] = new ObjectIdentifier(0,0, oid);
seq1[0][1] = null;
seq1[1] = new ByteString;
seq1[1].writeBytes(data);
data = seq1.toDER();
var buf:ByteArray = new ByteArray;
key.sign(data, buf, data.length);
return buf;
}
public function getPublicKey():RSAKey {
load();
var pk:ByteArray = _obj.signedCertificate.subjectPublicKeyInfo.subjectPublicKey as ByteArray;
pk.position = 0;
var rsaKey:Object = DER.parse(pk, [{name:"N"},{name:"E"}]);
return new RSAKey(rsaKey.N, rsaKey.E.valueOf());
}
/**
* Returns a subject principal, as an opaque base64 string.
* This is only used as a hash key for known certificates.
*
* Note that this assumes X509 DER-encoded certificates are uniquely encoded,
* as we look for exact matches between Issuer and Subject fields.
*
*/
public function getSubjectPrincipal():String {
load();
return Base64.encodeByteArray(_obj.signedCertificate.subject_bin);
}
/**
* Returns an issuer principal, as an opaque base64 string.
* This is only used to quickly find matching parent certificates.
*
* Note that this assumes X509 DER-encoded certificates are uniquely encoded,
* as we look for exact matches between Issuer and Subject fields.
*
*/
public function getIssuerPrincipal():String {
load();
return Base64.encodeByteArray(_obj.signedCertificate.issuer_bin);
}
public function getAlgorithmIdentifier():String {
return _obj.algorithmIdentifier.algorithmId.toString();
}
public function getNotBefore():Date {
return _obj.signedCertificate.validity.notBefore.date;
}
public function getNotAfter():Date {
return _obj.signedCertificate.validity.notAfter.date;
}
public function getCommonName():String {
var subject:Sequence = _obj.signedCertificate.subject;
return (subject.findAttributeValue(OID.COMMON_NAME) as PrintableString).getString();
}
}
} | {
"pile_set_name": "Github"
} |
/*PLEASE DO NOT EDIT THIS CODE*/
/*This code was generated using the UMPLE ${last.version} modeling language!*/
////---- Tests for GenericTestCase_attribute_suffix ----/////
test GenericTestCase_attribute_suffix {
generate JUnit;
depend Student ;
GIVEN:
GenericTestCase_attribute_suffix.ump;
THEN:
/*-------------------------*/
/* Association Test */
/*-------------------------*/
/*-------------------------*/
/* Class Student */
/*-------------------------*/
} | {
"pile_set_name": "Github"
} |
END
| {
"pile_set_name": "Github"
} |
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_SOLVER_CONSTRAINT_H
#define BT_SOLVER_CONSTRAINT_H
class btRigidBody;
#include "LinearMath/btVector3.h"
#include "LinearMath/btMatrix3x3.h"
#include "btJacobianEntry.h"
#include "LinearMath/btAlignedObjectArray.h"
//#define NO_FRICTION_TANGENTIALS 1
#include "btSolverBody.h"
///1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and friction constraints.
ATTRIBUTE_ALIGNED16 (struct) btSolverConstraint
{
BT_DECLARE_ALIGNED_ALLOCATOR();
btVector3 m_relpos1CrossNormal;
btVector3 m_contactNormal1;
btVector3 m_relpos2CrossNormal;
btVector3 m_contactNormal2; //usually m_contactNormal2 == -m_contactNormal1, but not always
btVector3 m_angularComponentA;
btVector3 m_angularComponentB;
mutable btSimdScalar m_appliedPushImpulse;
mutable btSimdScalar m_appliedImpulse;
btScalar m_friction;
btScalar m_jacDiagABInv;
btScalar m_rhs;
btScalar m_cfm;
btScalar m_lowerLimit;
btScalar m_upperLimit;
btScalar m_rhsPenetration;
union
{
void* m_originalContactPoint;
btScalar m_unusedPadding4;
int m_numRowsForNonContactConstraint;
};
int m_overrideNumSolverIterations;
int m_frictionIndex;
int m_solverBodyIdA;
int m_solverBodyIdB;
enum btSolverConstraintType
{
BT_SOLVER_CONTACT_1D = 0,
BT_SOLVER_FRICTION_1D
};
};
typedef btAlignedObjectArray<btSolverConstraint> btConstraintArray;
#endif //BT_SOLVER_CONSTRAINT_H
| {
"pile_set_name": "Github"
} |
#include "schematic_rules.hpp"
#include "schematic.hpp"
#include "util/util.hpp"
#include "rules/cache.hpp"
#include "nlohmann/json.hpp"
namespace horizon {
SchematicRules::SchematicRules()
{
}
void SchematicRules::load_from_json(const json &j)
{
if (j.count("single_pin_net")) {
const json &o = j["single_pin_net"];
rule_single_pin_net = RuleSinglePinNet(o);
}
}
void SchematicRules::apply(RuleID id, Schematic *sch)
{
}
json SchematicRules::serialize() const
{
json j;
j["single_pin_net"] = rule_single_pin_net.serialize();
return j;
}
std::set<RuleID> SchematicRules::get_rule_ids() const
{
return {RuleID::SINGLE_PIN_NET};
}
const Rule *SchematicRules::get_rule(RuleID id) const
{
if (id == RuleID::SINGLE_PIN_NET) {
return &rule_single_pin_net;
}
return nullptr;
}
const Rule *SchematicRules::get_rule(RuleID id, const UUID &uu) const
{
return nullptr;
}
std::map<UUID, const Rule *> SchematicRules::get_rules(RuleID id) const
{
std::map<UUID, const Rule *> r;
switch (id) {
default:;
}
return r;
}
void SchematicRules::remove_rule(RuleID id, const UUID &uu)
{
switch (id) {
default:;
}
fix_order(id);
}
Rule *SchematicRules::add_rule(RuleID id)
{
Rule *r = nullptr;
switch (id) {
default:
return nullptr;
}
return r;
}
} // namespace horizon
| {
"pile_set_name": "Github"
} |
<domain type='qemu'>
<name>QEMUGuest2</name>
<uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
<memory unit='KiB'>219100</memory>
<currentMemory unit='KiB'>219100</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='i686' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-i386</emulator>
<disk type='block' device='disk'>
<source dev='/dev/HostVG/QEMUGuest2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0' model='virtio-scsi'/>
<controller type='usb' index='0'/>
<controller type='ide' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source>
<adapter name='scsi_host0'/>
<address bus='0' target='0' unit='0'/>
</source>
<address type='drive' controller='0' bus='0' target='4' unit='8'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source>
<adapter name='scsi_host0'/>
<address bus='0' target='0' unit='1'/>
</source>
<readonly/>
<address type='drive' controller='0' bus='0' target='4' unit='7'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='no'>
<source>
<adapter name='scsi_host0'/>
<address bus='0' target='0' unit='2'/>
</source>
<alias name='ua-7996c8dc-a4fa-4012-b76f-043d20144263'/>
<address type='drive' controller='0' bus='0' target='4' unit='6'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source protocol='iscsi' name='iqn.1992-01.com.example'>
<host name='example.org' port='3260'/>
</source>
<address type='drive' controller='0' bus='0' target='2' unit='4'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source protocol='iscsi' name='iqn.1992-01.com.example/1'>
<host name='example.org' port='3260'/>
</source>
<readonly/>
<address type='drive' controller='0' bus='0' target='2' unit='5'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source protocol='iscsi' name='iqn.1992-01.com.example:storage/1'>
<host name='example.org' port='3260'/>
<auth username='myname'>
<secret type='iscsi' usage='mycluster_myname'/>
</auth>
</source>
<address type='drive' controller='0' bus='0' target='3' unit='4'/>
</hostdev>
<hostdev mode='subsystem' type='scsi' managed='yes'>
<source protocol='iscsi' name='iqn.1992-01.com.example:storage/2'>
<host name='example.org' port='3260'/>
<auth username='myname'>
<secret type='iscsi' usage='mycluster_myname'/>
</auth>
<initiator>
<iqn name='iqn.2020-07.com.example:test'/>
</initiator>
</source>
<address type='drive' controller='0' bus='0' target='3' unit='5'/>
</hostdev>
<memballoon model='virtio'/>
</devices>
</domain>
| {
"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.
*/
#include "logging/LogOutputThread.h"
#include "logging/LogItemQueue.h"
#include "logging/IOStreamManager.h"
namespace hurricane {
namespace logging {
static LogItemThread LogItemThreadInstance;
LogItemThread::LogItemThread() : _needToStop(false)
{
_workThread = std::thread(&LogItemThread::ThreadEntry, this);
_workThread.detach();
}
LogItemThread::~LogItemThread()
{
_needToStop = true;
}
void LogItemThread::ThreadEntry()
{
LogItemQueue& logItemQueue = LogItemQueue::GetInstance();
while ( !_needToStop ) {
LogItem logItem;
logItemQueue.Pop(logItem);
std::vector<std::ostream*> outputStreams =
hurricane::logging::IOStreamManager::GetInstance().GetDefaultOutputStreams(
logItem.GetSeverity());
for ( std::ostream* outputStream : outputStreams ) {
*outputStream << logItem.GetContent();
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
peaks2amp peaks.mif - | testing_diff_image - peaks2amp/out.mif -frac 1e-5
| {
"pile_set_name": "Github"
} |
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-d-1",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-d-1.js",
description: "Object literal - SyntaxError for duplicate property name (get,get)",
test: function testcase() {
try
{
eval("({get foo(){}, get foo(){}});");
return false;
}
catch(e)
{
return e instanceof SyntaxError;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
| {
"pile_set_name": "Github"
} |
require('../../modules/es7.array.flatten');
module.exports = require('../../modules/_core').Array.flatten;
| {
"pile_set_name": "Github"
} |
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QPIESERIES_H
#define QPIESERIES_H
#include <QtCharts/QAbstractSeries>
#include <QtCharts/QPieSlice>
QT_CHARTS_BEGIN_NAMESPACE
class QPieSeriesPrivate;
class Q_CHARTS_EXPORT QPieSeries : public QAbstractSeries
{
Q_OBJECT
Q_PROPERTY(qreal horizontalPosition READ horizontalPosition WRITE setHorizontalPosition)
Q_PROPERTY(qreal verticalPosition READ verticalPosition WRITE setVerticalPosition)
Q_PROPERTY(qreal size READ pieSize WRITE setPieSize)
Q_PROPERTY(qreal startAngle READ pieStartAngle WRITE setPieStartAngle)
Q_PROPERTY(qreal endAngle READ pieEndAngle WRITE setPieEndAngle)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(qreal sum READ sum NOTIFY sumChanged)
Q_PROPERTY(qreal holeSize READ holeSize WRITE setHoleSize)
public:
explicit QPieSeries(QObject *parent = nullptr);
virtual ~QPieSeries();
QAbstractSeries::SeriesType type() const override;
bool append(QPieSlice *slice);
bool append(const QList<QPieSlice *> &slices);
QPieSeries &operator << (QPieSlice *slice);
QPieSlice *append(const QString &label, qreal value);
bool insert(int index, QPieSlice *slice);
bool remove(QPieSlice *slice);
bool take(QPieSlice *slice);
void clear();
QList<QPieSlice *> slices() const;
int count() const;
bool isEmpty() const;
qreal sum() const;
void setHoleSize(qreal holeSize);
qreal holeSize() const;
void setHorizontalPosition(qreal relativePosition);
qreal horizontalPosition() const;
void setVerticalPosition(qreal relativePosition);
qreal verticalPosition() const;
void setPieSize(qreal relativeSize);
qreal pieSize() const;
void setPieStartAngle(qreal startAngle);
qreal pieStartAngle() const;
void setPieEndAngle(qreal endAngle);
qreal pieEndAngle() const;
void setLabelsVisible(bool visible = true);
void setLabelsPosition(QPieSlice::LabelPosition position);
Q_SIGNALS:
void added(const QList<QPieSlice *> &slices);
void removed(const QList<QPieSlice *> &slices);
void clicked(QPieSlice *slice);
void hovered(QPieSlice *slice, bool state);
void pressed(QPieSlice *slice);
void released(QPieSlice *slice);
void doubleClicked(QPieSlice *slice);
void countChanged();
void sumChanged();
private:
Q_DECLARE_PRIVATE(QPieSeries)
Q_DISABLE_COPY(QPieSeries)
friend class PieChartItem;
};
QT_CHARTS_END_NAMESPACE
#endif // QPIESERIES_H
| {
"pile_set_name": "Github"
} |
/*
* Waxeye Parser Generator
* www.waxeye.org
* Copyright (C) 2008-2010 Orlando Hill
* Licensed under the MIT license. See 'LICENSE' for details.
*/
#include <assert.h>
#include <stdlib.h>
#define WPARSER_C_
#include <waxeye/wparser.h>
#include "cache.h"
#include "lt.h"
struct inner_parser_t {
size_t start;
struct fa_t *automata;
size_t num_automata;
bool eof_check;
struct input_t *input;
size_t line;
size_t column;
bool last_cr;
size_t error_pos;
size_t error_line;
size_t error_col;
size_t error_nt;
struct ht_t *cache;
struct vector_t *cache_contents;
struct vector_t *fa_stack;
struct vector_t *to_free;
};
struct vector_t* match_state(struct inner_parser_t *ip, size_t index);
struct ast_t* match_automaton(struct inner_parser_t *ip, size_t index);
void parser_init(struct parser_t *a, size_t start, struct fa_t *automata, size_t num_automata, bool eof_check) {
a->start = start;
a->automata = automata;
a->num_automata = num_automata;
a->eof_check = eof_check;
}
struct parser_t* wparser_new(size_t start, struct fa_t *automata, size_t num_automata, bool eof_check) {
struct parser_t *a = malloc(sizeof(struct parser_t));
assert(a != NULL);
parser_init(a, start, automata, num_automata, eof_check);
return a;
}
void parser_clear(struct parser_t *a) {
size_t i;
for (i = 0; i < a->num_automata; i++) {
fa_clear(&a->automata[i]);
}
free(a->automata);
a->automata = NULL;
}
void parser_delete(struct parser_t *a) {
parser_clear(a);
free(a);
}
void inner_parser_init(struct inner_parser_t *a, size_t start,
struct fa_t *automata, size_t num_automata,
bool eof_check, struct input_t *input,
size_t line, size_t column, bool last_cr,
size_t error_pos, size_t error_line, size_t error_col, size_t error_nt,
struct ht_t *cache, struct vector_t *cache_contents,
struct vector_t *fa_stack, struct vector_t *to_free) {
a->start = start;
a->automata = automata;
a->num_automata = num_automata;
a->eof_check = eof_check;
a->input = input;
a->line = line;
a->column = column;
a->last_cr = last_cr;
a->error_pos = error_pos;
a->error_line = error_line;
a->error_col = error_col;
a->error_nt = error_nt;
a->cache = cache;
a->cache_contents = cache_contents;
a->fa_stack = fa_stack;
a->to_free = to_free;
}
struct inner_parser_t* inner_parser_new(size_t start, struct fa_t *automata,
size_t num_automata, bool eof_check,
struct input_t *input, size_t line,
size_t column, bool last_cr, size_t error_pos,
size_t error_line, size_t error_col, size_t error_nt,
struct ht_t *cache, struct vector_t *cache_contents,
struct vector_t *fa_stack, struct vector_t *to_free) {
struct inner_parser_t *a = malloc(sizeof(struct inner_parser_t));
assert(a != NULL);
inner_parser_init(a, start, automata, num_automata, eof_check,
input, line, column, last_cr, error_pos, error_line,
error_col, error_nt, cache, cache_contents, fa_stack, to_free);
return a;
}
void inner_parser_clear(struct inner_parser_t *a) {
ht_delete(a->cache, true);
a->cache = NULL;
vector_delete(a->cache_contents);
a->cache_contents = NULL;
vector_delete(a->fa_stack);
a->fa_stack = NULL;
vector_delete(a->to_free);
a->to_free = NULL;
}
void inner_parser_delete(struct inner_parser_t *a) {
inner_parser_clear(a);
free(a);
}
void restore_pos(struct inner_parser_t *ip, size_t pos, size_t line,
size_t col, bool last_cr) {
ip->input->pos = pos;
ip->line = line;
ip->column = col;
ip->last_cr = last_cr;
}
struct ast_t* update_error(struct inner_parser_t *ip) {
if (ip->error_pos < ip->input->pos) {
ip->error_pos = ip->input->pos;
ip->error_line = ip->line;
ip->error_col = ip->column;
ip->error_nt = ((struct fa_t *) vector_peek(ip->fa_stack))->type;
}
return NULL;
}
struct ast_t* mv(struct inner_parser_t *ip) {
char ch = input_consume(ip->input);
union ast_data d;
if (ch == '\r') {
ip->line++;
ip->column = 0;
ip->last_cr = true;
}
else {
if (ch == '\n') {
if (ip->last_cr == false) {
ip->line++;
ip->column = 0;
}
}
else {
ip->column++;
}
ip->last_cr = false;
}
d.c = ch;
return ast_new(AST_CHAR, d);
}
struct vector_t* match_edge(struct inner_parser_t *ip, struct edge_t *edge) {
size_t start_pos = ip->input->pos;
size_t start_line = ip->line;
size_t start_col = ip->column;
bool start_cr = ip->last_cr;
struct trans_t *t = &edge->t;
struct ast_t *res;
switch (t->type) {
case TRANS_WILD: {
res = (input_eof(ip->input) ? update_error(ip) : mv(ip));
break;
}
case TRANS_CHAR: {
res = ((input_eof(ip->input) || t->data.c != input_peek(ip->input)) ? update_error(ip) : mv(ip));
break;
}
case TRANS_SET: {
res = ((input_eof(ip->input) || !set_within_set(t->data.set, input_peek(ip->input))) ? update_error(ip) : mv(ip));
break;
}
case TRANS_FA: {
res = match_automaton(ip, t->data.fa);
break;
}
default: {
res = NULL;
break;
}
}
if (res == NULL) {
return NULL;
}
else {
struct vector_t *tran_res = match_state(ip, edge->s);
if (tran_res != NULL) {
if (edge->v || res->type == AST_EMPTY) {
vector_add(ip->to_free, res);
return tran_res;
}
else {
vector_add(tran_res, res);
return tran_res;
}
}
else {
restore_pos(ip, start_pos, start_line, start_col, start_cr);
vector_add(ip->to_free, res);
return NULL;
}
}
}
/*
* index - The index of the next edge to match.
*/
struct vector_t* match_edges(struct inner_parser_t *ip, struct edge_t *edges,
size_t num_edges, size_t index) {
/* If we have no more edges to try to match */
if (index == num_edges) {
return NULL;
}
else {
struct vector_t *res = match_edge(ip, &edges[index]);
if (res != NULL) {
return res;
}
else {
return match_edges(ip, edges, num_edges, index + 1);
}
}
}
struct vector_t* match_state(struct inner_parser_t *ip, size_t index) {
struct fa_t *automaton = vector_peek(ip->fa_stack);
struct state_t *state = &(automaton->states[index]);
struct vector_t *res = match_edges(ip, state->edges, state->num_edges, 0);
if (res != NULL) {
return res;
}
else {
if (state->match) {
return vector_new(INIT_CHILDREN);
}
else {
return NULL;
}
}
}
/*
* Adds the contents of the given vector to the to_free list of the inner parser.
* Deletes the given vector afterwards.
*/
void add_to_free_list(struct inner_parser_t *ip, struct vector_t *to_add) {
size_t i;
for (i = 0; i < to_add->size; i++) {
vector_add(ip->to_free, vector_get(to_add, i));
}
vector_delete(to_add);
}
struct ast_t* match_automaton(struct inner_parser_t *ip, size_t index) {
size_t start_pos = ip->input->pos;
struct cache_key_t key;
struct cache_value_t *cache_value;
size_t start_line;
size_t start_col;
bool start_cr;
struct fa_t *automaton;
struct vector_t *res;
struct ast_t *value;
key.index = index;
key.pos = start_pos;
cache_value = cache_get(ip->cache, &key);
if (cache_value != NULL) {
restore_pos(ip, cache_value->pos, cache_value->line,
cache_value->column, cache_value->last_cr);
return cache_value->result;
}
start_line = ip->line;
start_col = ip->column;
start_cr = ip->last_cr;
automaton = &ip->automata[index];
vector_push(ip->fa_stack, automaton);
res = match_state(ip, 0);
vector_pop(ip->fa_stack);
value = NULL;
switch (automaton->mode) {
case MODE_POS: {
restore_pos(ip, start_pos, start_line, start_col, start_cr);
if (res == NULL) {
value = update_error(ip);
}
else {
union ast_data d;
d.c = '\0';
value = ast_new(AST_EMPTY, d);
add_to_free_list(ip, res);
}
break;
}
case MODE_NEG: {
restore_pos(ip, start_pos, start_line, start_col, start_cr);
if (res == NULL) {
union ast_data d;
d.c = '\0';
value = ast_new(AST_EMPTY, d);
}
else {
value = update_error(ip);
add_to_free_list(ip, res);
}
break;
}
case MODE_VOID: {
if (res == NULL) {
value = update_error(ip);
}
else {
union ast_data d;
d.c = '\0';
value = ast_new(AST_EMPTY, d);
add_to_free_list(ip, res);
}
break;
}
case MODE_PRUNE: {
if (res == NULL) {
value = update_error(ip);
}
else {
switch (res->size) {
case 0: {
union ast_data d;
d.c = '\0';
value = ast_new(AST_EMPTY, d);
add_to_free_list(ip, res);
break;
}
case 1: {
/* get the only child */
value = vector_get(res, 0);
vector_delete(res);
break;
}
default: {
struct ast_tree_t *t;
union ast_data d;
vector_reverse(res); /* Correct the order of children */
t = ast_tree_new(automaton->type, res, start_pos, ip->input->pos);
d.tree = t;
value = ast_new(AST_TREE, d);
break;
}
}
}
break;
}
case MODE_LEFT: {
if (res == NULL) {
value = update_error(ip);
}
else {
struct ast_tree_t *t;
union ast_data d;
vector_reverse(res); /* Correct the order of children */
t = ast_tree_new(automaton->type, res, start_pos, ip->input->pos);
d.tree = t;
value = ast_new(AST_TREE, d);
}
break;
}
default: {
if (res != NULL) {
add_to_free_list(ip, res);
}
break;
}
}
cache_value = cache_value_new(value, ip->input->pos, ip->line,
ip->column, ip->last_cr);
cache_put(ip->cache, &key, cache_value);
vector_add(ip->cache_contents, cache_value);
return value;
}
struct ast_t* create_parse_error(struct inner_parser_t *ip) {
struct ast_error_t *e = malloc(sizeof(struct ast_error_t));
union ast_data d;
e->pos = ip->error_pos;
e->line = ip->error_line;
e->col = ip->error_col;
e->nt = ip->error_nt;
d.error = e;
return ast_new(AST_ERROR, d);
}
struct ast_t* eof_check(struct inner_parser_t *ip, struct ast_t *res) {
if (res != NULL) {
if (ip->eof_check && ip->input->pos < ip->input->size) {
/* Create a parse error - not all input consumed */
return create_parse_error(ip);
}
else {
return res;
}
}
else {
/* Create a parse error */
return create_parse_error(ip);
}
}
void free_ast_once(struct ht_t *freed_table, struct ast_t *a) {
/* if the ast hasn't been freed */
if (lt_get(freed_table, (size_t) a) == false) {
/* free the children */
if (a->type == AST_TREE) {
struct vector_t *children = a->data.tree->children;
size_t i, len = children->size;
for (i = 0; i < len; i++) {
free_ast_once(freed_table, vector_get(children, i));
}
}
/* free the ast */
lt_put(freed_table, (size_t) a, (void*) true);
ast_delete(a);
}
}
void keep_ast(struct ht_t *freed_table, struct ast_t *a) {
/* keep the children */
if (a->type == AST_TREE) {
struct vector_t *children = a->data.tree->children;
size_t i, len = children->size;
for (i = 0; i < len; i++) {
keep_ast(freed_table, vector_get(children, i));
}
}
/* keep the ast */
lt_put(freed_table, (size_t) a, (void*) true);
}
struct ast_t* inner_parser_parse(struct inner_parser_t *ip) {
struct ast_t *res = eof_check(ip, match_automaton(ip, ip->start));
struct ht_t *freed_table = ht_new(2048);
size_t i, len;
/* keep the ASTs of our result */
keep_ast(freed_table, res);
len = ip->cache_contents->size;
for (i = 0; i < len; i++) {
struct cache_value_t *value = vector_get(ip->cache_contents, i);
if (value->result != NULL) {
/* free the asts in the cache that aren't in our result */
free_ast_once(freed_table, value->result);
}
/* free the cache_value_t's */
free(value);
}
/* free the contents of the to_free list */
len = ip->to_free->size;
for (i = 0; i < len; i++) {
free_ast_once(freed_table, vector_get(ip->to_free, i));
}
/* delete our freed table */
ht_delete(freed_table, false);
return res;
}
struct ast_t* parse(struct parser_t *parser, struct input_t *input) {
struct ht_t *cache = ht_new(1024);
struct vector_t *cache_contents = vector_new(512);
struct vector_t *to_free = vector_new(256);
struct vector_t *fa_stack = vector_new(64);
struct inner_parser_t *inner_parser =
inner_parser_new(parser->start, parser->automata,
parser->num_automata, parser->eof_check,
input, 1, 0, false, 0, 1, 0,
parser->automata[parser->start].type,
cache, cache_contents, fa_stack, to_free);
struct ast_t *res = inner_parser_parse(inner_parser);
inner_parser_delete(inner_parser);
return res;
}
| {
"pile_set_name": "Github"
} |
//
// ACEView.m
// ACEView
//
// Created by Michael Robinson on 26/08/12.
// Copyright (c) 2012 Code of Interest. All rights reserved.
//
#import <ACEView/ACEView.h>
#import <ACEView/ACEModeNames.h>
#import <ACEView/ACEThemeNames.h>
#import <ACEView/ACEKeyboardHandlerNames.h>
#import <ACEView/ACERange.h>
#import <ACEView/ACEStringFromBool.h>
#import <ACEView/ACESearchItem.h>
#import <ACEView/NSString+EscapeForJavaScript.h>
#import <ACEView/NSInvocation+MainThread.h>
#import "ACEWebView.h"
#define ACE_JAVASCRIPT_DIRECTORY @"___ACE_VIEW_JAVASCRIPT_DIRECTORY___"
#pragma mark - ACEViewDelegate
NSString *const ACETextDidEndEditingNotification = @"ACETextDidEndEditingNotification";
#pragma mark - ACEView private
static NSArray *allowedSelectorNamesForJavaScript;
@interface ACEView() {
WebView * printingView;
NSPrintOperation * printOperation;
}
- (void) initWebView;
- (NSString *) aceJavascriptDirectoryPath;
- (NSString *) htmlPageFilePath;
- (NSString *) stringByEvaluatingJavaScriptOnMainThreadFromString:(NSString *)script;
- (void) executeScriptsWhenLoaded:(NSArray *)scripts;
- (void) executeScriptWhenLoaded:(NSString *)script;
- (void) resizeWebView;
- (void) showFindInterface;
- (void) showReplaceInterface;
+ (NSArray *) allowedSelectorNamesForJavaScript;
- (void) aceTextDidChange;
@end
#pragma mark - ACEView implementation
@implementation ACEView
@synthesize firstSelectedRange, delegate;
#pragma mark - Internal
- (void) initWebView
{
webView = [[ACEWebView alloc] init];
[webView setFrameLoadDelegate:self];
printingView = [[WebView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300.0, 1.0)];
[printingView.mainFrame.frameView setAllowsScrolling:NO];
[printingView setUIDelegate:self];
}
- (id) initWithFrame:(NSRect)frame {
if ((self = [super initWithFrame:frame])) {
[self initWebView];
}
return self;
}
- (id) initWithCoder:(NSCoder *)coder {
if ((self = [super initWithCoder:coder])) {
[self initWebView];
}
return self;
}
- (void) awakeFromNib {
[self addSubview:webView];
[self setBorderType:NSBezelBorder];
[self resizeWebView];
textFinder = [[NSTextFinder alloc] init];
[textFinder setClient:self];
[textFinder setFindBarContainer:self];
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *javascriptDirectory = [self aceJavascriptDirectoryPath];
NSString *htmlPath = [self htmlPageFilePath];
NSString *html = [NSString stringWithContentsOfFile:htmlPath encoding:NSUTF8StringEncoding error:nil];
html = [html stringByReplacingOccurrencesOfString:ACE_JAVASCRIPT_DIRECTORY withString:javascriptDirectory];
[[webView mainFrame] loadHTMLString:html baseURL:[bundle bundleURL]];
}
- (void) setBorderType:(NSBorderType)borderType {
[super setBorderType:borderType];
padding = (borderType == NSNoBorder) ? 0 : 1;
[self resizeWebView];
}
- (NSString *) aceJavascriptDirectoryPath {
// Unable to use pretty resource paths with CocoaPods
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
return [[bundle pathForResource:@"ace" ofType:@"js"] stringByDeletingLastPathComponent];
}
- (NSString *) htmlPageFilePath{
// Unable to use pretty resource paths with CocoaPods
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
return [bundle pathForResource:@"index" ofType:@"html"];
}
+ (BOOL) isSelectorExcludedFromWebScript:(SEL)aSelector {
return ![[ACEView allowedSelectorNamesForJavaScript] containsObject:NSStringFromSelector(aSelector)];
}
#pragma mark - NSView overrides
- (void) drawRect:(NSRect)dirtyRect {
[self resizeWebView];
[super drawRect:dirtyRect];
}
- (void) resizeSubviewsWithOldSize:(NSSize)oldSize {
[self resizeWebView];
}
#pragma mark - WebView delegate methods
- (void) webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
[[webView windowScriptObject] setValue:self forKey:@"ACEView"];
}
- (float) webViewHeaderHeight:(WebView *)sender
{
if ([delegate respondsToSelector:@selector(printHeaderHeight)])
return [delegate printHeaderHeight];
else
return 0.0f;
}
- (float) webViewFooterHeight:(WebView *)sender
{
if ([delegate respondsToSelector:@selector(printFooterHeight)])
return [delegate printFooterHeight];
else
return 0.0f;
}
- (void) webView:(WebView *)sender drawHeaderInRect:(NSRect)rect
{
if ([delegate respondsToSelector:@selector(drawPrintHeaderForPage:inRect:)]) {
int page = (int)[printOperation currentPage];
NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
if ([ctx isFlipped]) {
NSGraphicsContext *unflipped =
[NSGraphicsContext graphicsContextWithCGContext:[ctx CGContext] flipped:NO];
[NSGraphicsContext setCurrentContext:unflipped];
}
[delegate drawPrintHeaderForPage:page inRect:rect];
[NSGraphicsContext setCurrentContext:ctx];
}
}
- (void) webView:(WebView *)sender drawFooterInRect:(NSRect)rect
{
if ([delegate respondsToSelector:@selector(drawPrintFooterForPage:inRect:)]) {
int page = (int)[printOperation currentPage];
NSGraphicsContext *ctx = [NSGraphicsContext currentContext];
if ([ctx isFlipped]) {
NSGraphicsContext *unflipped =
[NSGraphicsContext graphicsContextWithCGContext:[ctx CGContext] flipped:NO];
[NSGraphicsContext setCurrentContext:unflipped];
}
[delegate drawPrintFooterForPage:page inRect:rect];
[NSGraphicsContext setCurrentContext:ctx];
}
}
#pragma mark - NSTextFinderClient methods
- (void) performTextFinderAction:(id)sender {
[textFinder performAction:[sender tag]];
}
- (void) scrollRangeToVisible:(NSRange)range {
firstSelectedRange = range;
[self executeScriptWhenLoaded:[NSString stringWithFormat:
@"editor.session.selection.clearSelection();"
@"editor.session.selection.setRange(new Range(%@));"
@"editor.centerSelection()",
ACEStringFromRangeAndString(range, [self string])]];
}
- (void) replaceCharactersInRange:(NSRange)range withString:(NSString *)string {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.session.replace(new Range(%@), \"%@\");",
ACEStringFromRangeAndString(range, [self string]), [string stringByEscapingForJavaScript]]];
}
- (BOOL) isEditable {
return YES;
}
#pragma mark - Private
- (NSString *) stringByEvaluatingJavaScriptOnMainThreadFromString:(NSString *)script {
SEL stringByEvaluatingJavascriptFromString = @selector(stringByEvaluatingJavaScriptFromString:);
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
[[webView class] instanceMethodSignatureForSelector:stringByEvaluatingJavascriptFromString]];
[invocation setSelector:stringByEvaluatingJavascriptFromString];
[invocation setArgument:&script atIndex:2];
[invocation setTarget:webView];
[invocation invokeOnMainThread];
NSString *contentString;
[invocation getReturnValue:&contentString];
return contentString;
}
- (void) executeScriptsWhenLoaded:(NSArray *)scripts {
if ([webView isLoading]) {
[self performSelector:@selector(executeScriptsWhenLoaded:) withObject:scripts afterDelay:0.2];
return;
}
[scripts enumerateObjectsUsingBlock:^(id script, NSUInteger index, BOOL *stop) {
[webView stringByEvaluatingJavaScriptFromString:script];
}];
}
- (void) executeScriptWhenLoaded:(NSString *)script {
[self executeScriptsWhenLoaded:@[script]];
}
- (void) resizeWebView {
NSRect bounds = [self bounds];
id<NSTextFinderBarContainer> findBarContainer = [textFinder findBarContainer];
if ([findBarContainer isFindBarVisible]) {
CGFloat findBarHeight = [[findBarContainer findBarView] frame].size.height;
bounds.origin.y += findBarHeight;
bounds.size.height -= findBarHeight;
}
[webView setFrame:NSMakeRect(bounds.origin.x + padding, bounds.origin.y + padding,
bounds.size.width - (2 * padding), bounds.size.height - (2 * padding))];
}
- (void) showFindInterface {
[textFinder performAction:NSTextFinderActionShowFindInterface];
[self resizeWebView];
}
- (void) showReplaceInterface {
[textFinder performAction:NSTextFinderActionShowReplaceInterface];
[self resizeWebView];
}
+ (NSArray *) allowedSelectorNamesForJavaScript {
if (allowedSelectorNamesForJavaScript == nil) {
allowedSelectorNamesForJavaScript = @[
@"showFindInterface",
@"showReplaceInterface",
@"aceTextDidChange",
@"printHTML:"
];
}
return [allowedSelectorNamesForJavaScript retain];
}
- (void) aceTextDidChange {
NSNotification *textDidChangeNotification = [NSNotification notificationWithName:ACETextDidEndEditingNotification
object:self];
[[NSNotificationCenter defaultCenter] postNotification:textDidChangeNotification];
if (self.delegate == nil) {
return;
}
if ([self.delegate respondsToSelector:@selector(textDidChange:)]) {
[self.delegate performSelector:@selector(textDidChange:) withObject:textDidChangeNotification];
}
}
- (NSString*) getSearchOptions:(NSDictionary*)options {
NSError *error = nil;
NSData *json = [NSJSONSerialization dataWithJSONObject:options options:0 error:&error];
if (error || !json) {
return nil;
}
return [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
}
#pragma mark - Public
- (NSString *) string {
return [self stringByEvaluatingJavaScriptOnMainThreadFromString:@"editor.getValue();"];
}
- (void) setString:(id)string {
[self executeScriptsWhenLoaded:@[
@"reportChanges = false;",
[NSString stringWithFormat:@"editor.setValue(\"%@\");", [string stringByEscapingForJavaScript]],
@"editor.clearSelection();",
@"editor.moveCursorTo(0, 0);",
@"reportChanges = true;",
@"ACEView.aceTextDidChange();"
]];
}
- (void) setMode:(ACEMode)mode {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setMode(\"ace/mode/%@\");", [ACEModeNames nameForMode:mode]]];
}
- (void) focus {
[self executeScriptWhenLoaded:@"focusEditor();"];
}
- (void) setTheme:(ACETheme)theme {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setTheme(\"ace/theme/%@\");", [ACEThemeNames nameForTheme:theme]]];
}
- (void) setWrappingBehavioursEnabled:(BOOL)wrap {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setWrapBehavioursEnabled(%@);", ACEStringFromBool(wrap)]];
}
- (void) setUseSoftWrap:(BOOL)wrap {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setUseWrapMode(%@);", ACEStringFromBool(wrap)]];
}
- (void) setWrapLimitRange:(NSRange)range {
[self setUseSoftWrap:YES];
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setWrapLimitRange(%ld, %ld);", range.location, range.length]];
}
- (void) setNewLineMode:(NSString*)mode {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setNewLineMode(\"%@\");", mode]];
}
- (NSString*) getNewLineMode {
return [self stringByEvaluatingJavaScriptOnMainThreadFromString:@"editor.getSession().getNewLineMode();"];
}
- (void) setUseSoftTabs:(BOOL)tabs {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setUseSoftTabs(%@);", ACEStringFromBool(tabs)]];
}
- (void) setTabSize:(NSInteger)size {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.getSession().setTabSize(%ld);", (long)size]];
}
- (void) setShowInvisibles:(BOOL)show {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setShowInvisibles(%@);", ACEStringFromBool(show)]];
}
- (void) setReadOnly:(BOOL)readOnly {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setReadOnly(%@);", ACEStringFromBool(readOnly)]];
}
- (void) setShowFoldWidgets:(BOOL)show {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setShowFoldWidgets(%@);", ACEStringFromBool(show)]];
}
- (void) setFadeFoldWidgets:(BOOL)fade {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setFadeFoldWidgets(%@);", ACEStringFromBool(fade)]];
}
- (void) setHighlightActiveLine:(BOOL)highlight {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setHighlightActiveLine(%@);", ACEStringFromBool(highlight)]];
}
- (void) setHighlightGutterLine:(BOOL)highlight {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setHighlightGutterLine(%@);", ACEStringFromBool(highlight)]];
}
- (void) setHighlightSelectedWord:(BOOL)highlight {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setHighlightSelectedWord(%@);", ACEStringFromBool(highlight)]];
}
- (void) setDisplayIndentGuides:(BOOL)display {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setDisplayIndentGuides(%@);", ACEStringFromBool(display)]];
}
- (void) setAnimatedScroll:(BOOL)animate {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setAnimatedScroll(%@);", ACEStringFromBool(animate)]];
}
- (void) setScrollSpeed:(NSUInteger)speed {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setScrollSpeed(%ld);", speed]];
}
- (void) setBasicAutoCompletion:(BOOL)autocomplete {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('enableBasicAutocompletion', %@);", ACEStringFromBool(autocomplete)]];
}
- (void) setSnippets:(BOOL)snippets {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('enableSnippets', %@);", ACEStringFromBool(snippets)]];
}
- (void) setLiveAutocompletion:(BOOL)liveAutocompletion {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('enableLiveAutocompletion', %@);", ACEStringFromBool(liveAutocompletion)]];
}
- (void) setEmmet:(BOOL)emmet {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('enableEmmet', %@);", ACEStringFromBool(emmet)]];
}
- (void) setKeyboardHandler:(ACEKeyboardHandler)keyboardHandler {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setKeyboardHandler(%@);", [ACEKeyboardHandlerNames commandForKeyboardHandler:keyboardHandler]]];
}
- (void) setPrintMarginColumn:(NSUInteger)column {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setPrintMarginColumn(%ld);", column]];
}
- (void) setShowPrintMargin:(BOOL)show {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setShowPrintMargin(%@);", ACEStringFromBool(show)]];
}
- (void)setAnnotations:(NSArray *)annotations {
NSError *err;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:annotations
options:kNilOptions
error:&err];
if (!jsonData) {
NSLog(@"JSON encoding error: %@", [err localizedDescription]);
return;
}
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSString *js = [NSString stringWithFormat:@"editor.getSession().setAnnotations(%@);", jsonString];
[self executeScriptWhenLoaded:js];
}
- (void) setFontSize:(NSUInteger)size {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setFontSize('%ldpx');", size]];
}
- (void) gotoLine:(NSInteger)lineNumber column:(NSInteger)columnNumber animated:(BOOL)animate {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.gotoLine(%ld, %ld, %@);", lineNumber, columnNumber, ACEStringFromBool(animate)]];
}
- (void) setFontFamily:(NSString *)fontFamily {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOptions({ fontFamily: '%@'});", fontFamily]];
}
- (void) setShowLineNumbers:(BOOL)show {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('showLineNumbers', %@);", ACEStringFromBool(show)]];
}
- (void) setShowGutter:(BOOL)show {
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.setOption('showGutter', %@);", ACEStringFromBool(show)]];
}
- (NSUInteger) getLength {
return [self stringByEvaluatingJavaScriptOnMainThreadFromString:@"editor.getSession().getLength();"].integerValue;
}
- (NSString*) getLine:(NSInteger)line {
return [self stringByEvaluatingJavaScriptOnMainThreadFromString:[NSString stringWithFormat:@"editor.getSession().getLine(%ld);", line]];
}
- (NSArray*) findAll:(NSDictionary*) options {
NSString* stringOptions = [self getSearchOptions:options];
NSString* script = [NSString stringWithFormat:@"JSON.stringify(new Search().set(%@).findAll(editor.getSession()));", stringOptions];
return [ACESearchItem fromString:[self stringByEvaluatingJavaScriptOnMainThreadFromString:script]];
}
- (void) replaceAll:(NSString*) replacement options:(NSDictionary*)options {
NSString* stringOptions = [self getSearchOptions:options];
[self executeScriptWhenLoaded:[NSString stringWithFormat:@"editor.replaceAll(\"%@\", %@);", replacement, stringOptions]];
}
#pragma mark - Printing
- (void) print:(id)sender
{
int printFontSize = 10;
if ([delegate respondsToSelector:@selector(printFontSize)])
printFontSize = [delegate printFontSize];
NSString * staticRender = [NSString stringWithFormat:
@"ace.require(\"ace/config\").loadModule(\"ace/ext/static_highlight\", function(static) {"
"var session = editor.getSession();"
"var printable = static.renderSync(session.getValue(), session.getMode(), editor.renderer.theme);"
"var css = \"<style>body {white-space:pre-wrap;}\" + printable.css + \"</style>\";"
"var doc = css.replace(/(font-size:)\\s*\\d+(px)/g, '$1 %d$2') + printable.html;"
"ACEView.printHTML_(doc);"
"});", printFontSize];
[self executeScriptWhenLoaded: staticRender];
}
- (void) printHTML:(NSString *)html
{
//
// Obtain print info and customize it
//
NSPrintInfo * printInfo = nil;
if ([delegate respondsToSelector:@selector(printInformation)])
printInfo = [delegate printInformation];
if (!printInfo)
printInfo = [NSPrintInfo sharedPrintInfo];
printInfo = [printInfo copy];
printInfo.verticallyCentered = NO;
//
// Compute width
//
NSRect frame = printingView.frame;
frame.size.height = 1;
frame.size.width = printInfo.paperSize.width-printInfo.leftMargin-printInfo.rightMargin;
printingView.frame = frame;
//
// Non-breaking spaces prevent line wrapping, so we replace them with regular spaces and set the
// pre-wrap property instead.
//
html = [html stringByReplacingOccurrencesOfString:@"\u00A0" withString:@" "];
[printingView.mainFrame loadHTMLString:html baseURL:nil];
void (^__block print)(void) = ^{
if (printingView.isLoading) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), print);
} else {
//
// Get the height for the rendered frame
//
NSRect webFrameRect = [[[printingView.mainFrame frameView] documentView] frame];
NSRect frame = printingView.frame;
frame.size.height = webFrameRect.size.height;
printingView.frame = frame;
NSView * viewToPrint = [[[printingView mainFrame] frameView] documentView];
printOperation = [NSPrintOperation printOperationWithView:viewToPrint printInfo:printInfo];
printOperation.jobTitle = [self printJobTitle];
if ([delegate respondsToSelector:@selector(startPrintOperation:)])
[delegate startPrintOperation:printOperation];
[printOperation runOperationModalForWindow:[self window] delegate:self didRunSelector:@selector(finishedPrinting:) contextInfo:NULL];
}
};
print();
}
- (void)finishedPrinting:(void *)context
{
printOperation = nil;
if ([delegate respondsToSelector:@selector(endPrintOperation)])
[delegate endPrintOperation];
}
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2012, 2017, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
/*
* COPYRIGHT AND PERMISSION NOTICE
*
* Copyright (C) 1991-2016 Unicode, Inc. All rights reserved.
* Distributed under the Terms of Use in
* http://www.unicode.org/copyright.html.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of the Unicode data files and any associated documentation
* (the "Data Files") or Unicode software and any associated documentation
* (the "Software") to deal in the Data Files or Software
* without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, and/or sell copies of
* the Data Files or Software, and to permit persons to whom the Data Files
* or Software are furnished to do so, provided that
* (a) this copyright and permission notice appear with all copies
* of the Data Files or Software,
* (b) this copyright and permission notice appear in associated
* documentation, and
* (c) there is clear notice in each modified Data File or in the Software
* as well as in the documentation associated with the Data File(s) or
* Software that the data or software has been modified.
*
* THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
* ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT OF THIRD PARTY RIGHTS.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
* NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
* DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THE DATA FILES OR SOFTWARE.
*
* Except as contained in this notice, the name of a copyright holder
* shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in these Data Files or Software without prior
* written authorization of the copyright holder.
*/
package sun.util.resources.cldr.ext;
import sun.util.resources.OpenListResourceBundle;
public class CurrencyNames_ug extends OpenListResourceBundle {
@Override
protected final Object[][] getContents() {
final Object[][] data = new Object[][] {
{ "CNY", "\uffe5" },
{ "USD", "$" },
{ "adp", "\u0626\u0627\u0646\u062f\u0648\u0631\u0631\u0627\u0646 \u067e\u06d0\u0633\u06d0\u062a\u0627\u0633\u0649" },
{ "aed", "\u0626\u06d5\u0631\u06d5\u0628 \u0628\u0649\u0631\u0644\u06d5\u0634\u0645\u06d5 \u062e\u06d5\u0644\u0649\u067e\u0649\u0644\u0649\u0643\u0649 \u062f\u06d5\u0631\u06be\u06d5\u0645\u0649" },
{ "afa", "\u0626\u0627\u0641\u063a\u0627\u0646 \u0626\u0627\u0641\u063a\u0627\u0646\u0649 (1927\u20132002)" },
{ "afn", "\u0626\u0627\u0641\u063a\u0627\u0646 \u0626\u0627\u0641\u063a\u0627\u0646\u0649" },
{ "alk", "\u0626\u0627\u0644\u0628\u0627\u0646\u0649\u064a\u06d5 \u0644\u06d0\u0643\u0649 (1946\u20131965)" },
{ "all", "\u0626\u0627\u0644\u0628\u0627\u0646\u0649\u064a\u06d5 \u0644\u06d0\u0643\u0649" },
{ "amd", "\u0626\u06d5\u0631\u0645\u06d0\u0646\u0649\u064a\u06d5 \u062f\u0649\u0631\u0627\u0645\u0649" },
{ "ang", "\u06af\u0648\u0644\u0644\u0627\u0646\u062f\u0649\u064a\u06d5\u06af\u06d5 \u0642\u0627\u0631\u0627\u0634\u0644\u0649\u0642 \u0626\u0627\u0646\u062a\u0649\u0644\u0644\u06d0\u0646 \u06af\u06c7\u0644\u062f\u06d0\u0646\u0649" },
{ "aoa", "\u0626\u0627\u0646\u06af\u0648\u0644\u0627 \u0643\u06c7\u06cb\u0627\u0646\u0632\u0627\u0633\u0649" },
{ "aok", "\u0626\u0627\u0646\u06af\u0648\u0644\u0627 \u0643\u06c7\u06cb\u0627\u0646\u0632\u0627\u0633\u0649 (1977\u20131991)" },
{ "aon", "\u0626\u0627\u0646\u06af\u0648\u0644\u0627 \u064a\u06d0\u06ad\u0649 \u0643\u06c7\u06cb\u0627\u0646\u0632\u0627\u0633\u0649 (1990\u20132000)" },
{ "aor", "\u0626\u0627\u0646\u06af\u0648\u0644\u0627 \u0642\u0627\u064a\u062a\u0627 \u062a\u06d5\u06ad\u0634\u06d5\u0644\u06af\u06d5\u0646 \u0643\u06c7\u06cb\u0627\u0646\u0632\u0627\u0633\u0649 (1995\u20131999)" },
{ "ara", "\u0626\u0627\u0631\u06af\u06d0\u0646\u062a\u0649\u0646\u0627 \u0626\u0627\u06cb\u0633\u062a\u0631\u0627\u0644\u0649" },
{ "arl", "\u0626\u0627\u0631\u06af\u06d0\u0646\u062a\u0649\u0646\u0627 \u067e\u06d0\u0633\u0648 \u0644\u06d0\u064a\u0649 (1970\u20131983)" },
{ "arm", "\u0626\u0627\u0631\u06af\u06d0\u0646\u062a\u0649\u0646\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649 (1881\u20131970)" },
{ "arp", "\u0626\u0627\u0631\u06af\u06d0\u0646\u062a\u0649\u0646\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649 (1983\u20131985)" },
{ "ars", "\u0626\u0627\u0631\u06af\u06d0\u0646\u062a\u0649\u0646\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "ats", "\u0626\u0627\u06cb\u0633\u062a\u0631\u0649\u064a\u06d5 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649" },
{ "aud", "\u0626\u0627\u06cb\u0633\u062a\u0631\u0627\u0644\u0649\u064a\u06d5 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "awg", "\u0626\u0627\u0631\u06c7\u0628\u0627\u0646 \u0641\u0649\u0644\u0648\u0631\u06c7\u0646\u0649" },
{ "azm", "\u0626\u06d5\u0632\u06d5\u0631\u0628\u06d5\u064a\u062c\u0627\u0646 \u0645\u0627\u0646\u0627\u062a\u0649 (1993\u20132006)" },
{ "azn", "\u0626\u06d5\u0632\u06d5\u0631\u0628\u06d5\u064a\u062c\u0627\u0646 \u0645\u0627\u0646\u0627\u062a\u0649" },
{ "bad", "\u0628\u0648\u0633\u0646\u0649\u064a\u06d5-\u062e\u06d0\u0631\u062a\u0633\u06d0\u06af\u0648\u06cb\u0649\u0646\u0627 \u062f\u0649\u0646\u0627\u0631\u0649 (1992\u20131994)" },
{ "bam", "\u0628\u0648\u0633\u0646\u0649\u064a\u06d5-\u062e\u06d0\u0631\u062a\u0633\u06d0\u06af\u0648\u06cb\u0649\u0646\u0627 \u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634\u0686\u0627\u0646 \u0645\u0627\u0631\u0643\u0649" },
{ "ban", "\u0628\u0648\u0633\u0646\u0649\u064a\u06d5-\u062e\u06d0\u0631\u062a\u0633\u06d0\u06af\u0648\u06cb\u0649\u0646\u0627 \u064a\u06d0\u06ad\u0649 \u062f\u0649\u0646\u0627\u0631\u0649 (1994\u20131997)" },
{ "bbd", "\u0628\u0627\u0631\u0628\u0627\u062f\u0648\u0633 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "bdt", "\u0628\u0627\u06ad\u0644\u0627\u062f\u0649\u0634 \u062a\u0627\u0643\u0627\u0633\u0649" },
{ "bec", "\u0628\u06d0\u0644\u06af\u0649\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649 (\u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634\u0686\u0627\u0646)" },
{ "bef", "\u0628\u06d0\u0644\u06af\u0649\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "bel", "\u0628\u06d0\u0644\u06af\u0649\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649 (\u067e\u06c7\u0644\u2013\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5)" },
{ "bgl", "\u0628\u06c7\u0644\u063a\u0627\u0631\u0649\u064a\u06d5 \u0642\u0627\u062a\u062a\u0649\u0642 \u0644\u06d0\u06cb\u0627\u0633\u0649" },
{ "bgm", "\u0628\u06c7\u0644\u063a\u0627\u0631\u0649\u064a\u06d5 \u0626\u0649\u062c\u062a\u0649\u0645\u0627\u0626\u0649\u064a \u0644\u06d0\u06cb\u0627\u0633\u0649" },
{ "bgn", "\u0628\u06c7\u0644\u063a\u0627\u0631\u0649\u064a\u06d5 \u0644\u06d0\u06cb\u0627\u0633\u0649" },
{ "bgo", "\u0628\u06c7\u0644\u063a\u0627\u0631\u0649\u064a\u06d5 \u0644\u06d0\u06cb\u0627\u0633\u0649 (1879\u20131952)" },
{ "bhd", "\u0628\u06d5\u06be\u0631\u06d5\u064a\u0646 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "bif", "\u0628\u06c7\u0631\u06c7\u0646\u062f\u0649 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "bmd", "\u0628\u06d0\u0631\u0645\u06c7\u062f\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "bnd", "\u0628\u0649\u0631\u06c7\u0646\u06d0\u064a \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "bob", "\u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u06d5 \u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u0627\u0646\u0648\u0633\u0649" },
{ "bol", "\u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u06d5 \u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u0627\u0646\u0648\u0633\u0649 (1863\u20131963)" },
{ "bop", "\u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u06d5 \u067e\u0649\u0633\u0648\u0633\u0649" },
{ "bov", "\u0628\u0648\u0644\u0649\u06cb\u0649\u064a\u06d5 \u0645\u06c7\u062f\u0648\u0644\u0649" },
{ "brb", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u064a\u06d0\u06ad\u0649 \u0643\u0631\u06c7\u0632\u06d0\u0631\u0648\u0633\u0649 (1967\u20131986)" },
{ "brc", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u0643\u0631\u06c7\u0632\u0627\u062f\u0648\u0633\u0649 (1986\u20131989)" },
{ "bre", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u064a\u06d0\u06ad\u0649 \u0643\u0631\u06c7\u0632\u06d0\u0631\u0648\u0633\u0649 (1990\u20131993)" },
{ "brl", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "brn", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u064a\u06d0\u06ad\u0649 \u0643\u0631\u06c7\u0632\u0627\u062f\u0648\u0633\u0649 (1989\u20131990)" },
{ "brr", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u0643\u0631\u06c7\u0632\u06d0\u0631\u0648\u0633\u0649 (1993\u20131994)" },
{ "brz", "\u0628\u0649\u0631\u0627\u0632\u0649\u0644\u0649\u064a\u06d5 \u0643\u0631\u06c7\u0632\u06d0\u0631\u0648\u0633\u0649 (1942\u20131967)" },
{ "bsd", "\u0628\u0627\u06be\u0627\u0645\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "btn", "\u0628\u06c7\u062a\u0627\u0646 \u0646\u06af\u06c7\u0644\u062a\u0631\u06c7\u0645\u0649" },
{ "buk", "\u0628\u0649\u0631\u0645\u0627 \u0643\u0649\u064a\u0627\u062a\u0649" },
{ "bwp", "\u0628\u0648\u062a\u0633\u06cb\u0627\u0646\u0627 \u067e\u06c7\u0644\u0627\u0633\u0649" },
{ "byb", "\u0628\u06d0\u0644\u0627\u0631\u06c7\u0633\u0649\u064a\u06d5 \u064a\u06d0\u06ad\u0649 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649 (1994\u20131999)" },
{ "byr", "\u0628\u06d0\u0644\u0627\u0631\u06c7\u0633\u0649\u064a\u06d5 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649" },
{ "bzd", "\u0628\u06d0\u0644\u0649\u0632 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "cad", "\u0643\u0627\u0646\u0627\u062f\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "cdf", "\u0643\u0648\u0646\u06af\u0648 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "che", "WIR \u064a\u0627\u06cb\u0631\u0648" },
{ "chf", "\u0634\u0649\u06cb\u06d0\u062a\u0633\u0649\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "chw", "WIR \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "cle", "\u0686\u0649\u0644\u0649 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "clf", "\u0686\u0649\u0644\u0649 \u06be\u06d0\u0633\u0627\u0628\u0627\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649 (UF)" },
{ "clp", "\u0686\u0649\u0644\u0649 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "cnx", "\u062c\u06c7\u06ad\u06af\u0648 \u062e\u06d5\u0644\u0642 \u0628\u0627\u0646\u0643\u0649\u0633\u0649 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "cny", "\u062c\u06c7\u06ad\u06af\u0648 \u064a\u06c8\u06d5\u0646\u0649" },
{ "cop", "\u0643\u0648\u0644\u0648\u0645\u0628\u0649\u064a\u06d5 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "cou", "\u0643\u0648\u0644\u0648\u0645\u0628\u0649\u064a\u06d5 \u06be\u06d5\u0642\u0649\u0642\u0649\u064a \u0642\u0649\u0645\u0645\u06d5\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "crc", "\u0643\u0648\u0633\u062a\u0627\u0631\u0649\u0643\u0627 \u0643\u0648\u0644\u0648\u0646\u0649" },
{ "csd", "\u0633\u06d0\u0631\u0628\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649 (2002\u20132006)" },
{ "csk", "\u0686\u06d0\u062e\u0633\u0649\u0644\u0648\u06cb\u0627\u0643\u0649\u064a\u06d5 \u0642\u0627\u062a\u062a\u0649\u0642 \u0643\u0648\u0631\u06c7\u0646\u0627\u0633\u0649" },
{ "cuc", "\u0643\u06c7\u0628\u0627 \u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634\u0686\u0627\u0646 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "cup", "\u0643\u06c7\u0628\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "cve", "\u064a\u06d0\u0634\u0649\u0644 \u062a\u06c7\u0645\u0634\u06c7\u0642 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "cyp", "\u0633\u0649\u067e\u0631\u06c7\u0633 \u0641\u0648\u0646\u062f \u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "czk", "\u0686\u06d0\u062e \u062c\u06c7\u0645\u06be\u06c7\u0631\u0649\u064a\u0649\u062a\u0649 \u0643\u0648\u0631\u06c7\u0646\u0627\u0633\u0649" },
{ "ddm", "\u0634\u06d5\u0631\u0642\u0649\u064a \u06af\u06d0\u0631\u0645\u0627\u0646\u0649\u064a\u06d5 \u0645\u0627\u0631\u0643\u0649" },
{ "dem", "\u06af\u06d0\u0631\u0645\u0627\u0646\u0649\u064a\u06d5 \u0645\u0627\u0631\u0643\u0649" },
{ "djf", "\u062c\u0649\u0628\u06c7\u062a\u0649 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "dkk", "\u062f\u0627\u0646\u0649\u064a\u06d5 \u0643\u0631\u0648\u0646\u0649" },
{ "dop", "\u062f\u0648\u0645\u0649\u0646\u0649\u0643\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "dzd", "\u0626\u0627\u0644\u062c\u0649\u0631\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "ecs", "\u0626\u06d0\u0643\u06cb\u0627\u062f\u0648\u0631 \u0633\u06c7\u0643\u0631\u06d0\u0633\u0649" },
{ "ecv", "\u0626\u06d0\u0643\u06cb\u0627\u062f\u0648\u0631 \u062a\u06c7\u0631\u0627\u0642\u0644\u0649\u0642 \u0642\u0649\u0645\u0645\u06d5\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "eek", "\u0626\u06d0\u0633\u062a\u0648\u0646\u0649\u064a\u06d5 \u0643\u0631\u06c7\u0646\u0649" },
{ "egp", "\u0645\u0649\u0633\u0649\u0631 \u0641\u0648\u0646\u062f \u0633\u0649\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "ern", "\u0626\u06d0\u0631\u0649\u062a\u0631\u06d0\u064a\u06d5 \u0646\u0627\u0643\u0641\u0627\u0633\u0649" },
{ "esa", "\u0626\u0649\u0633\u067e\u0627\u0646\u0649\u064a\u06d5 \u067e\u06d0\u0633\u06d0\u062a\u0627\u0633\u0649 (A \u06be\u06d0\u0633\u0627\u0628\u0627\u062a)" },
{ "esb", "\u0626\u0649\u0633\u067e\u0627\u0646\u0649\u064a\u06d5 \u067e\u06d0\u0633\u06d0\u062a\u0627\u0633\u0649 (\u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634 \u06be\u06d0\u0633\u0627\u0628\u0627\u062a\u0649)" },
{ "esp", "\u0626\u0649\u0633\u067e\u0627\u0646\u0649\u064a\u06d5 \u067e\u06d0\u0633\u06d0\u062a\u0627\u0633\u0649" },
{ "etb", "\u0626\u06d0\u0641\u0649\u064a\u0648\u067e\u0649\u064a\u06d5 \u0628\u0649\u0631\u0631\u0649" },
{ "eur", "\u064a\u0627\u06cb\u0631\u0648" },
{ "fim", "\u0641\u0649\u0646\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u0645\u0627\u0631\u0643\u0643\u0627\u0633\u0649" },
{ "fjd", "\u0641\u0649\u062c\u0649 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "fkp", "\u0641\u0627\u0644\u0643\u0644\u0627\u0646\u062f \u0626\u0627\u0631\u0627\u0644\u0644\u0649\u0631\u0649 \u0641\u0648\u0646\u062f \u0633\u0649\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "frf", "\u0641\u0649\u0631\u0627\u0646\u0633\u0649\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "gbp", "\u0626\u06d5\u0646\u06af\u0644\u0649\u064a\u06d5 \u0641\u0648\u0646\u062f \u0633\u0649\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "gek", "\u06af\u0649\u0631\u06c7\u0632\u0649\u064a\u06d5 \u0643\u06c7\u067e\u0648\u0646 \u0644\u0627\u0631\u0649\u062a\u0649" },
{ "gel", "\u06af\u0649\u0631\u06c7\u0632\u0649\u064a\u06d5 \u0644\u0627\u0631\u0649\u0633\u0649" },
{ "ghc", "\u06af\u0627\u0646\u0627 \u0633\u06d0\u062f\u0649\u0633\u0649 (1979\u20132007)" },
{ "ghs", "\u06af\u0627\u0646\u0627 \u0633\u06d0\u062f\u0649\u0633\u0649" },
{ "gip", "\u062c\u06d5\u0628\u0649\u0644\u062a\u0627\u0631\u0649\u0642 \u0641\u0648\u0646\u062f \u0633\u0649\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "gmd", "\u06af\u0627\u0645\u0628\u0649\u064a\u06d5 \u062f\u0627\u0644\u0627\u0633\u0649" },
{ "gnf", "\u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "gns", "\u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5 \u0633\u0649\u0644\u0649\u0633\u0649" },
{ "gqe", "\u0626\u06d0\u0643\u06cb\u0627\u062a\u0648\u0631 \u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5 \u0626\u06d0\u0643\u06cb\u06d0\u0644\u06d0\u0633\u0649" },
{ "grd", "\u06af\u0649\u0631\u06d0\u062a\u0633\u0649\u064a\u06d5 \u062f\u0631\u0627\u062e\u0645\u0627\u0633\u0649" },
{ "gtq", "\u06af\u0649\u06cb\u0627\u062a\u06d0\u0645\u0627\u0644\u0627 \u0643\u06c7\u06cb\u06d0\u062a\u0632\u0627\u0644\u0649" },
{ "gwe", "\u067e\u0648\u0631\u062a\u06c7\u06af\u0627\u0644\u0649\u064a\u06d5 \u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "gwp", "\u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5-\u0628\u0649\u0633\u0633\u0627\u0626\u06c7 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "gyd", "\u06af\u0649\u06cb\u0649\u0626\u0627\u0646\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "hkd", "\u0634\u064a\u0627\u06ad\u06af\u0627\u06ad \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "hnl", "\u06be\u0648\u0646\u062f\u06c7\u0631\u0627\u0633 \u0644\u06d0\u0645\u067e\u0649\u0631\u0627\u0633\u0649" },
{ "hrd", "\u0643\u0649\u0631\u0648\u062f\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "hrk", "\u0643\u0649\u0631\u0648\u062f\u0649\u064a\u06d5 \u0643\u06c7\u0646\u0627\u0633\u0649" },
{ "htg", "\u06be\u0627\u064a\u062a\u0649 \u06af\u06c7\u0631\u062f\u06d0\u0633\u0649" },
{ "huf", "\u06cb\u06d0\u0646\u06af\u0649\u0631\u0649\u064a\u06d5 \u0641\u0648\u0631\u06d0\u0646\u062a\u0649" },
{ "idr", "\u06be\u0649\u0646\u062f\u0648\u0646\u06d0\u0632\u0649\u064a\u06d5 \u0631\u06c7\u067e\u0649\u064a\u06d5\u0633\u0649" },
{ "iep", "\u0626\u0649\u0631\u06d0\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "ilp", "\u0626\u0649\u0633\u0631\u0627\u0626\u0649\u0644\u0649\u064a\u06d5 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "ilr", "\u0626\u0649\u0633\u0631\u0627\u0626\u0649\u0644 \u0634\u06d0\u0643\u06d0\u0644\u0649 (1980\u20131985)" },
{ "ils", "\u0626\u0649\u0633\u0631\u0627\u0626\u0649\u0644 \u064a\u06d0\u06ad\u0649 \u0634\u06d0\u0643\u06d0\u0644\u0649" },
{ "inr", "\u06be\u0649\u0646\u062f\u0649\u0633\u062a\u0627\u0646 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "iqd", "\u0626\u0649\u0631\u0627\u0642 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "irr", "\u0626\u0649\u0631\u0627\u0646 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "isj", "\u0626\u0649\u0633\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u0643\u0631\u0648\u0646\u0627\u0633\u0649 (1918\u20131981)" },
{ "isk", "\u0626\u0649\u0633\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u0643\u0631\u0648\u0646\u0627\u0633\u0649" },
{ "itl", "\u0626\u0649\u062a\u0627\u0644\u0649\u064a\u06d5 \u0644\u0649\u0631\u0627\u0633\u0649" },
{ "jmd", "\u064a\u0627\u0645\u0627\u064a\u0643\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "jod", "\u0626\u0649\u064a\u0648\u0631\u062f\u0627\u0646\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "jpy", "\u064a\u0627\u067e\u0648\u0646\u0649\u064a\u06d5 \u064a\u06d0\u0646\u0649" },
{ "kes", "\u0643\u06d0\u0646\u0649\u064a\u06d5 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649" },
{ "kgs", "\u0642\u0649\u0631\u063a\u0649\u0632\u0649\u0633\u062a\u0627\u0646 \u0633\u0648\u0645\u0649" },
{ "khr", "\u0643\u0627\u0645\u0628\u0648\u062f\u0698\u0627 \u0631\u0649\u0626\u06d0\u0644\u0649" },
{ "kmf", "\u0643\u0648\u0645\u0648\u0631\u0648 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "kpw", "\u0634\u0649\u0645\u0627\u0644\u0649\u064a \u0643\u0648\u0631\u06d0\u064a\u06d5 \u06cb\u0648\u0646\u0649" },
{ "krh", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0643\u0648\u0631\u06d0\u064a\u06d5 \u062e\u06cb\u0627\u0646\u0649 (1953\u20131962)" },
{ "kro", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0643\u0648\u0631\u06d0\u064a\u06d5 \u06cb\u0648\u0646\u0649 (1945\u20131953)" },
{ "krw", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0643\u0648\u0631\u06d0\u064a\u06d5 \u06cb\u0648\u0646\u0649" },
{ "kwd", "\u0643\u06c7\u06cb\u06d5\u064a\u062a \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "kyd", "\u0643\u0627\u064a\u0645\u0627\u0646 \u0626\u0627\u0631\u0627\u0644\u0644\u0649\u0631\u0649 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "kzt", "\u0642\u0627\u0632\u0627\u0642\u0649\u0633\u062a\u0627\u0646 \u062a\u06d5\u06ad\u06af\u0649\u0633\u0649" },
{ "lak", "\u0644\u0627\u0626\u0648\u0633 \u0643\u0649\u067e\u0649" },
{ "lbp", "\u0644\u0649\u06cb\u0627\u0646 \u0641\u0648\u0646\u062f \u0633\u0649\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "lkr", "\u0633\u0649\u0631\u0649\u0644\u0627\u0646\u0643\u0627 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "lrd", "\u0644\u0649\u0628\u06d0\u0631\u0649\u064a\u06d5 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "lsl", "\u0644\u06d0\u0633\u0648\u062a\u0648 \u0644\u0648\u062a\u0649\u0633\u0649" },
{ "ltl", "\u0644\u0649\u062a\u06cb\u0627 \u0644\u0649\u062a\u0627\u0633\u0649" },
{ "ltt", "\u0644\u0649\u062a\u06cb\u0627 \u062a\u0627\u0644\u0648\u0646\u0627\u0633\u0649" },
{ "luc", "\u0644\u064a\u06c7\u0643\u0633\u06d0\u0645\u0628\u06c7\u0631\u06af \u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634\u0686\u0627\u0646 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "luf", "\u0644\u064a\u06c7\u0643\u0633\u06d0\u0645\u0628\u06c7\u0631\u06af \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "lul", "\u0644\u0649\u064a\u06c7\u0643\u0633\u06d0\u0645\u0628\u06c7\u0631\u06af \u067e\u06c7\u0644-\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "lvl", "\u0644\u0627\u062a\u06cb\u0649\u064a\u06d5 \u0644\u0627\u062a\u0649" },
{ "lvr", "\u0644\u0627\u062a\u06cb\u0649\u064a\u06d5 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649" },
{ "lyd", "\u0644\u0649\u06cb\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "mad", "\u0645\u0627\u0631\u0627\u0643\u06d5\u0634 \u062f\u0649\u0631\u06be\u06d5\u0645\u0649" },
{ "maf", "\u0645\u0627\u0631\u0627\u0643\u06d5\u0634 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "mcf", "\u0645\u0648\u0646\u0627\u0643\u0648 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "mdc", "\u0645\u0648\u0644\u062f\u0648\u06cb\u0627 \u0643\u06c7\u067e\u0648\u0646\u0649" },
{ "mdl", "\u0645\u0648\u0644\u062f\u0648\u06cb\u0627 \u0644\u06d0\u06cb\u0649" },
{ "mga", "\u0645\u0627\u062f\u0627\u063a\u0627\u0633\u0642\u0627\u0631 \u0626\u0627\u0631\u0649\u0626\u0627\u0631\u0649\u0633\u0649" },
{ "mgf", "\u0645\u0627\u062f\u0627\u063a\u0627\u0633\u0642\u0627\u0631 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "mkd", "\u0645\u0627\u0643\u06d0\u062f\u0648\u0646\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "mkn", "\u0645\u0627\u0643\u06d0\u062f\u0648\u0646\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649 (1992\u20131993)" },
{ "mlf", "\u0645\u0627\u0644\u0649 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "mmk", "\u0645\u0649\u064a\u0627\u0646\u0645\u0627\u0631 \u0643\u0649\u064a\u0627\u062a\u0649" },
{ "mnt", "\u0645\u0648\u06ad\u063a\u06c7\u0644\u0649\u064a\u06d5 \u062a\u06c8\u06af\u0631\u0649\u0643\u0649" },
{ "mop", "\u0626\u0627\u06cb\u0645\u06d0\u0646 \u067e\u0627\u062a\u0627\u0643\u0627\u0633\u0649" },
{ "mro", "\u0645\u0627\u06cb\u0631\u0649\u062a\u0627\u0646\u0649\u064a\u06d5 \u0626\u06c7\u06af\u0649\u064a\u06d5\u0633\u0649" },
{ "mtl", "\u0645\u0627\u0644\u062a\u0627 \u0644\u0649\u0631\u0627\u0633\u0649" },
{ "mtp", "\u0645\u0627\u0644\u062a\u0627 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "mur", "\u0645\u0627\u06cb\u0631\u0649\u062a\u0649\u0626\u06c7\u0633 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "mvp", "\u0645\u0627\u0644\u062f\u0649\u06cb\u0649 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "mvr", "\u0645\u0627\u0644\u062f\u0649\u06cb\u0649 \u0631\u06c7\u0641\u0649\u064a\u0627\u0633\u0649" },
{ "mwk", "\u0645\u0627\u0644\u0627\u06cb\u0649 \u0643\u06cb\u0627\u0686\u0627\u0633\u0649" },
{ "mxn", "\u0645\u06d0\u0643\u0633\u0649\u0643\u0627 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "mxp", "\u0645\u06d0\u0643\u0633\u0649\u0643\u0627 \u0643\u06c8\u0645\u06c8\u0634 \u067e\u06d0\u0633\u0648\u0633\u0649 (1861\u20131992)" },
{ "mxv", "\u0645\u06d0\u0643\u0633\u0649\u0643\u0627 \u0645\u06d5\u0628\u0644\u06d5\u063a \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "myr", "\u0645\u0627\u0644\u0627\u064a\u0634\u0649\u064a\u0627 \u0631\u0649\u06ad\u06af\u0649\u062a\u0649" },
{ "mze", "\u0645\u0648\u0632\u0627\u0645\u0628\u0649\u0643 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "mzm", "\u0645\u0648\u0632\u0627\u0645\u0628\u0649\u0643 \u0645\u06d0\u062a\u0649\u0643\u0627\u0644\u0649 (1980\u20132006)" },
{ "mzn", "\u0645\u0648\u0632\u0627\u0645\u0628\u0649\u0643 \u0645\u06d0\u062a\u0649\u0643\u0627\u0644\u0649" },
{ "nad", "\u0646\u0627\u0645\u0649\u0628\u0649\u064a\u06d5 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "ngn", "\u0646\u0649\u06af\u06d0\u0631\u0649\u064a\u06d5 \u0646\u0627\u064a\u0631\u0627\u0633\u0649" },
{ "nic", "\u0646\u0649\u06af\u06d0\u0631\u0649\u064a\u06d5 \u0643\u0648\u0631\u062f\u0648\u0628\u0627\u0633\u0649 (1988\u20131991)" },
{ "nio", "\u0646\u0649\u06af\u06d0\u0631\u0649\u064a\u06d5 \u0643\u0648\u0631\u062f\u0648\u0628\u0627\u0633\u0649" },
{ "nlg", "\u06af\u0648\u0644\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u06af\u06c8\u0644\u062f\u0649\u0646\u0649" },
{ "nok", "\u0646\u0648\u0631\u06cb\u06d0\u06af\u0649\u064a\u06d5 \u0643\u0631\u0648\u0646\u0649" },
{ "npr", "\u0646\u06d0\u067e\u0627\u0644 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "nzd", "\u064a\u06d0\u06ad\u0649 \u0632\u06d0\u0644\u0627\u0646\u062f\u0649\u064a\u06d5 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "omr", "\u0626\u0648\u0645\u0627\u0646 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "pab", "\u067e\u0627\u0646\u0627\u0645\u0627 \u0628\u0627\u0644\u0628\u0648\u0626\u0627\u0633\u0649" },
{ "pei", "\u067e\u06d0\u0631\u06c7 \u0626\u0649\u0646\u062a\u0649\u0633\u0649" },
{ "pen", "\u067e\u06d0\u0631\u06c7 \u064a\u06d0\u06ad\u0649 \u0633\u0648\u0644\u0649" },
{ "pes", "\u067e\u06d0\u0631\u06c7 \u0633\u0648\u0644\u0649 (1863\u20131965)" },
{ "pgk", "\u067e\u0627\u067e\u06c7\u0626\u0627 \u064a\u06d0\u06ad\u0649 \u06af\u0649\u06cb\u0649\u0646\u06d0\u064a\u06d5 \u0643\u0649\u0646\u0627\u0633\u0649" },
{ "php", "\u0641\u0649\u0644\u0649\u067e\u067e\u0649\u0646 \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "pkr", "\u067e\u0627\u0643\u0649\u0633\u062a\u0627\u0646 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "pln", "\u067e\u0648\u0644\u0634\u0627 \u0632\u0649\u0644\u0648\u062a\u0649" },
{ "plz", "\u067e\u0648\u0644\u0634\u0627 \u0632\u0649\u0644\u0648\u062a\u0649 (1950\u20131995)" },
{ "pte", "\u067e\u0648\u0631\u062a\u06c7\u06af\u0627\u0644\u0649\u064a\u06d5 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "pyg", "\u067e\u0627\u0631\u0627\u06af\u06cb\u0627\u064a \u06af\u06c7\u0626\u0627\u0631\u0627\u0646\u0649\u0633\u0649" },
{ "qar", "\u0642\u0627\u062a\u0627\u0631 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "rhd", "\u0631\u0648\u062f\u06d0\u0632\u0649\u064a\u06d5 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "rol", "\u0631\u06c7\u0645\u0649\u0646\u0649\u064a\u06d5 \u0644\u06d0\u064a\u0649 (1952\u20132006)" },
{ "ron", "\u0631\u06c7\u0645\u0649\u0646\u0649\u064a\u06d5 \u0644\u06d0\u064a\u0649" },
{ "rsd", "\u0633\u06d0\u0631\u0628\u0649\u064a\u06d5 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "rub", "\u0631\u06c7\u0633\u0649\u064a\u06d5 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649" },
{ "rur", "\u0631\u06c7\u0633\u0649\u064a\u06d5 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649 (1991\u20131998)" },
{ "rwf", "\u0631\u06cb\u0627\u0646\u062f\u0627 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "sar", "\u0633\u06d5\u0626\u06c7\u062f\u0649 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "sbd", "\u0633\u0648\u0644\u0648\u0645\u0648\u0646 \u0626\u0627\u0631\u0627\u0644\u0644\u0649\u0631\u0649 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "scr", "\u0633\u06d0\u064a\u0634\u06d0\u0644 \u0631\u06c7\u067e\u0649\u0633\u0649" },
{ "sdd", "\u0633\u06c7\u062f\u0627\u0646 \u062f\u0649\u0646\u0627\u0631\u0649 (1992\u20132007)" },
{ "sdg", "\u0633\u06c7\u062f\u0627\u0646 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "sdp", "\u0633\u06c7\u062f\u0627\u0646 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649 (1957\u20131998)" },
{ "sek", "\u0634\u0649\u06cb\u06d0\u062a\u0633\u0649\u064a\u06d5 \u0643\u0631\u0648\u0646\u0627\u0633\u0649" },
{ "sgd", "\u0633\u0649\u0646\u06af\u0627\u067e\u0648\u0631 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "shp", "\u0633\u0627\u064a\u0646\u0649\u062a-\u06be\u06d0\u0644\u06d0\u0646\u0627 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "sit", "\u0633\u0649\u0644\u0648\u06cb\u06d0\u0646\u0649\u064a\u06d5 \u062a\u0648\u0644\u0627\u0631\u0649" },
{ "skk", "\u0633\u0649\u0644\u0648\u06cb\u0627\u0643\u0649\u064a\u06d5 \u0643\u0648\u0631\u06c7\u0646\u0627\u0633\u0649" },
{ "sll", "\u0633\u06d0\u0631\u0631\u0627\u0644\u06d0\u0626\u0648\u0646 \u0644\u06d0\u0626\u0648\u0646\u06d0\u0633\u0649" },
{ "sos", "\u0633\u0648\u0645\u0627\u0644\u0649 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649" },
{ "srd", "\u0633\u06c7\u0631\u0649\u0646\u0627\u0645 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "srg", "\u0633\u06c7\u0631\u0649\u0646\u0627\u0645 \u06af\u06c8\u0644\u062f\u0649\u0646\u0649" },
{ "ssp", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0633\u06c7\u062f\u0627\u0646 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "std", "\u0633\u0627\u0646-\u062a\u0648\u0645\u06d0 \u06cb\u06d5 \u067e\u0649\u0631\u0649\u0646\u0633\u0649\u067e\u0649 \u062f\u0648\u0628\u0631\u0627\u0633\u0649" },
{ "sur", "\u0633\u0648\u06cb\u0649\u062a \u0631\u06c7\u0628\u0644\u0649\u0633\u0649" },
{ "svc", "\u0633\u0627\u0644\u06cb\u0627\u062f\u0648\u0631 \u0643\u0648\u0644\u0648\u0646\u0649" },
{ "syp", "\u0633\u06c8\u0631\u0649\u064a\u06d5 \u0641\u0648\u0646\u062f\u0633\u062a\u06d0\u0631\u0644\u0649\u06ad\u0649" },
{ "szl", "\u0633\u0649\u06cb\u06d0\u0632\u0649\u0644\u0627\u0646\u062f \u0644\u0649\u0644\u0627\u0646\u06af\u06d0\u0646\u0649" },
{ "thb", "\u062a\u0627\u064a\u0644\u0627\u0646\u062f \u0628\u0627\u062e\u062a\u0649" },
{ "tjr", "\u062a\u0627\u062c\u0649\u0643\u0649\u0633\u062a\u0627\u0646 \u0631\u06c7\u0628\u0644\u0649\u0633\u0649" },
{ "tjs", "\u062a\u0627\u062c\u0649\u0643\u0649\u0633\u062a\u0627\u0646 \u0633\u0648\u0645\u0648\u0646\u0649\u0633\u0649" },
{ "tmm", "\u062a\u06c8\u0631\u0643\u0645\u06d5\u0646\u0649\u0633\u062a\u0627\u0646 \u0645\u0627\u0646\u0627\u062a\u0649 (1993\u20132009)" },
{ "tmt", "\u062a\u06c8\u0631\u0643\u0645\u06d5\u0646\u0649\u0633\u062a\u0627\u0646 \u0645\u0627\u0646\u0627\u062a\u0649" },
{ "tnd", "\u062a\u06c7\u0646\u0649\u0633 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "top", "\u062a\u0648\u0646\u06af\u0627 \u067e\u0627\u0626\u0627\u0646\u06af\u0627\u0633\u0649" },
{ "tpe", "\u062a\u0649\u0645\u0648\u0631 \u0626\u06d0\u0633\u0643\u06c7\u062f\u0648\u0633\u0649" },
{ "trl", "\u062a\u06c8\u0631\u0643\u0649\u064a\u06d5 \u0644\u0649\u0631\u0627\u0633\u0649 (1922\u20132005)" },
{ "try", "\u062a\u06c8\u0631\u0643\u0649\u064a\u06d5 \u0644\u0649\u0631\u0627\u0633\u0649" },
{ "ttd", "\u062a\u0649\u0631\u0649\u0646\u0649\u062f\u0627\u062f \u06cb\u06d5 \u062a\u0648\u0628\u0627\u06af\u0648 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "twd", "\u064a\u06d0\u06ad\u0649 \u062a\u06d5\u064a\u06cb\u06d5\u0646 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "tzs", "\u062a\u0627\u0646\u0632\u0627\u0646\u0649\u064a\u06d5 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649" },
{ "uah", "\u0626\u06c7\u0643\u0631\u0627\u0626\u0649\u0646\u0627 \u062e\u0631\u0649\u06cb\u0646\u0627\u0633\u0649" },
{ "uak", "\u0626\u06c7\u0643\u0631\u0627\u0626\u0649\u0646\u0627 \u0643\u0627\u0631\u0628\u0648\u06cb\u0627\u0646\u06d0\u062a\u0633\u0649" },
{ "ugs", "\u0626\u06c7\u06af\u0627\u0646\u062f\u0627 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649 (1966\u20131987)" },
{ "ugx", "\u0626\u06c7\u06af\u0627\u0646\u062f\u0627 \u0634\u0649\u0644\u0644\u0649\u06ad\u0649" },
{ "usd", "\u0626\u0627\u0645\u06d0\u0631\u0649\u0643\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "usn", "\u0626\u0627\u0645\u06d0\u0631\u0649\u0643\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649 (\u0643\u06d0\u064a\u0649\u0646\u0643\u0649 \u0643\u06c8\u0646)" },
{ "uss", "\u0626\u0627\u0645\u06d0\u0631\u0649\u0643\u0627 \u062f\u0648\u0644\u0644\u0649\u0631\u0649 (\u0626\u0648\u062e\u0634\u0627\u0634 \u0643\u06c8\u0646)" },
{ "uyi", "\u0626\u06c7\u0631\u06c7\u06af\u06cb\u0627\u064a \u067e\u06d0\u0633\u0648\u0633\u0649 (\u0626\u0649\u0646\u062f\u06d0\u0643\u0649\u0633\u0644\u0627\u0634 \u0628\u0649\u0631\u0644\u0649\u0643\u0649)" },
{ "uyp", "\u0626\u06c7\u0631\u06c7\u06af\u06cb\u0627\u064a \u067e\u06d0\u0633\u0648\u0633\u0649 (1975\u20131993)" },
{ "uyu", "\u0626\u06c7\u0631\u06c7\u06af\u06cb\u0627\u064a \u067e\u06d0\u0633\u0648\u0633\u0649" },
{ "uzs", "\u0626\u06c6\u0632\u0628\u06d0\u0643\u0649\u0633\u062a\u0627\u0646 \u0633\u0648\u0645\u0649" },
{ "veb", "\u06cb\u06d0\u0646\u06d0\u0632\u06c7\u0626\u06d0\u0644\u0627 \u0628\u0648\u0644\u0649\u06cb\u0627\u0631\u0649 (1871\u20132008)" },
{ "vef", "\u06cb\u06d0\u0646\u06d0\u0632\u06c7\u0626\u06d0\u0644\u0627 \u0628\u0648\u0644\u0649\u06cb\u0627\u0631\u0649" },
{ "vnd", "\u06cb\u0649\u064a\u06d0\u062a\u0646\u0627\u0645 \u062f\u0648\u06ad\u0649" },
{ "vnn", "\u06cb\u0649\u064a\u06d0\u062a\u0646\u0627\u0645 \u062f\u0648\u06ad\u0649 (1978\u20131985)" },
{ "vuv", "\u06cb\u0627\u0646\u06c7\u0626\u0627\u062a\u06c7 \u06cb\u0627\u062a\u06c7\u0633\u0649" },
{ "wst", "\u0633\u0627\u0645\u0648\u0626\u0627 \u062a\u0627\u0644\u0627\u0633\u0649" },
{ "xaf", "\u0626\u0627\u0641\u0631\u0649\u0642\u0627 \u0642\u0649\u062a\u0626\u06d5\u0633\u0649 \u067e\u06c7\u0644-\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5 \u0626\u0649\u062a\u062a\u0649\u067e\u0627\u0642\u0649 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "xag", "\u0643\u06c8\u0645\u06c8\u0634" },
{ "xau", "\u0626\u0627\u0644\u062a\u06c7\u0646" },
{ "xba", "\u064a\u0627\u06cb\u0631\u0648\u067e\u0627 \u0645\u06c7\u0631\u06d5\u0643\u0643\u06d5\u067e \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "xbb", "\u064a\u0627\u06cb\u0631\u0648\u067e\u0627 \u067e\u06c7\u0644 \u0628\u0649\u0631\u0644\u0649\u0643\u0649 (XBB)" },
{ "xbc", "\u064a\u0627\u06cb\u0631\u0648\u067e\u0627 \u06be\u06d0\u0633\u0627\u0628\u0627\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649 (XBC)" },
{ "xbd", "\u064a\u0627\u06cb\u0631\u0648\u067e\u0627 \u06be\u06d0\u0633\u0627\u0628\u0627\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649 (XBD)" },
{ "xcd", "\u0634\u06d5\u0631\u0642\u0649\u064a \u0643\u0627\u0631\u0649\u0628 \u062f\u0648\u0644\u0644\u0649\u0631\u0649" },
{ "xdr", "\u0626\u0627\u0644\u0627\u06be\u0649\u062f\u06d5 \u067e\u06c7\u0644 \u0626\u06d0\u0644\u0649\u0634 \u06be\u0648\u0642\u06c7\u0642\u0649" },
{ "xeu", "\u064a\u0627\u06cb\u0631\u0648\u067e\u0627 \u067e\u06c7\u0644 \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "xfo", "\u0641\u0649\u0631\u0627\u0646\u0633\u0649\u064a\u06d5 \u0626\u0627\u0644\u062a\u06c7\u0646 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "xfu", "\u0641\u0649\u0631\u0627\u0646\u0633\u0649\u064a\u06d5 UIC \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "xof", "\u0626\u0627\u0641\u0631\u0649\u0642\u0627 \u0642\u0649\u062a\u0626\u06d5\u0633\u0649 \u067e\u06c7\u0644-\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5 \u0626\u0649\u062a\u062a\u0649\u067e\u0627\u0642\u0649 \u0641\u0631\u0627\u0646\u0643\u0649 (BCEAO)" },
{ "xpd", "\u067e\u0627\u0644\u0644\u0627\u062f\u0649\u064a" },
{ "xpf", "\u062a\u0649\u0646\u0686 \u0626\u0648\u0643\u064a\u0627\u0646 \u067e\u06c7\u0644-\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5 \u0626\u0648\u0631\u062a\u0627\u0642 \u06af\u06d5\u06cb\u062f\u0649\u0633\u0649 \u0641\u0631\u0627\u0646\u0643\u0649" },
{ "xpt", "\u067e\u0649\u0644\u0627\u062a\u0649\u0646\u0627" },
{ "xre", "RINET \u0641\u0648\u0646\u062f\u0649" },
{ "xsu", "\u0633\u06c7\u0643\u0631\u06d0" },
{ "xts", "\u067e\u06c7\u0644 \u0633\u0649\u0646\u0627\u0634 \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "xua", "\u0626\u0627\u0633\u0649\u064a\u0627 \u062a\u06d5\u0631\u06d5\u0642\u0642\u0649\u064a\u0627\u062a \u0628\u0627\u0646\u0643\u0649\u0633\u0649 \u06be\u06d0\u0633\u0627\u0628\u0627\u062a \u0628\u0649\u0631\u0644\u0649\u0643\u0649" },
{ "xxx", "\u064a\u0648\u0686\u06c7\u0646 \u067e\u06c7\u0644" },
{ "ydd", "\u064a\u06d5\u0645\u06d5\u0646 \u062f\u0649\u0646\u0627\u0631\u0649" },
{ "yer", "\u064a\u06d5\u0645\u06d5\u0646 \u0631\u0649\u064a\u0627\u0644\u0649" },
{ "yud", "\u064a\u06c7\u06af\u0648\u0633\u0644\u0627\u06cb\u0649\u064a\u06d5 \u0642\u0627\u062a\u062a\u0649\u0642 \u062f\u0649\u0646\u0627\u0631\u0649 (1966\u20131990)" },
{ "yum", "\u064a\u06c7\u06af\u0648\u0633\u0644\u0627\u06cb\u0649\u064a\u06d5 \u064a\u06d0\u06ad\u0649 \u062f\u0649\u0646\u0627\u0631\u0649 (1994\u20132002)" },
{ "yun", "\u064a\u06c7\u06af\u0648\u0633\u0644\u0627\u06cb\u0649\u064a\u06d5 \u0626\u0627\u0644\u0645\u0627\u0634\u062a\u06c7\u0631\u06c7\u0634\u0686\u0627\u0646 \u062f\u0649\u0646\u0627\u0631\u0649 (1990\u20131992)" },
{ "yur", "\u064a\u06c7\u06af\u0648\u0633\u0644\u0627\u06cb\u0649\u064a\u06d5 \u0626\u0649\u0633\u0644\u0627\u06be\u0627\u062a \u062f\u0649\u0646\u0627\u0631\u0649 (1992\u20131993)" },
{ "zal", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0626\u0627\u0641\u0631\u0649\u0642\u0627 \u0631\u0627\u0646\u062f\u0649 (\u067e\u06c7\u0644\u2013\u0645\u06c7\u0626\u0627\u0645\u0649\u0644\u06d5)" },
{ "zar", "\u062c\u06d5\u0646\u06c7\u0628\u0649\u064a \u0626\u0627\u0641\u0631\u0649\u0642\u0627 \u0631\u0627\u0646\u062f\u0649" },
{ "zmk", "\u0632\u0627\u0645\u0628\u0649\u064a\u06d5 \u0643\u06cb\u0627\u0686\u0627\u0633\u0649 (1968\u20132012)" },
{ "zmw", "\u0632\u0627\u0645\u0628\u0649\u064a\u06d5 \u0643\u06cb\u0627\u0686\u0627\u0633\u0649" },
{ "zrn", "\u0632\u0627\u064a\u0649\u0631 \u064a\u06d0\u06ad\u0649 \u0632\u0627\u064a\u0649\u0631\u0649 (1993\u20131998)" },
{ "zrz", "\u0632\u0627\u064a\u0649\u0631 \u0632\u0627\u064a\u0649\u0631\u0649 (1971\u20131993)" },
{ "zwd", "\u0632\u0649\u0645\u0628\u0627\u0628\u06cb\u06d0 \u062f\u0648\u0644\u0644\u0649\u0631\u0649 (1980\u20132008)" },
{ "zwl", "\u0632\u0649\u0645\u0628\u0627\u0628\u06cb\u06d0 \u062f\u0648\u0644\u0644\u0649\u0631\u0649 (2009)" },
{ "zwr", "\u0632\u0649\u0645\u0628\u0627\u0628\u06cb\u06d0 \u062f\u0648\u0644\u0644\u0649\u0631\u0649 (2008)" },
};
return data;
}
}
| {
"pile_set_name": "Github"
} |
/*
* JFFS2 -- Journalling Flash File System, Version 2.
*
* Copyright © 2006 NEC Corporation
*
* Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
*
* For licensing information, see the file 'LICENCE' in this directory.
*
*/
struct jffs2_acl_entry {
jint16_t e_tag;
jint16_t e_perm;
jint32_t e_id;
};
struct jffs2_acl_entry_short {
jint16_t e_tag;
jint16_t e_perm;
};
struct jffs2_acl_header {
jint32_t a_version;
};
#ifdef CONFIG_JFFS2_FS_POSIX_ACL
struct posix_acl *jffs2_get_acl(struct inode *inode, int type);
int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *);
extern int jffs2_init_acl_post(struct inode *);
#else
#define jffs2_get_acl (NULL)
#define jffs2_set_acl (NULL)
#define jffs2_init_acl_pre(dir_i,inode,mode) (0)
#define jffs2_init_acl_post(inode) (0)
#endif /* CONFIG_JFFS2_FS_POSIX_ACL */
| {
"pile_set_name": "Github"
} |
@comment $NetBSD: PLIST,v 1.2 2017/07/04 14:14:46 fhajny Exp $
bin/connect-distributed.sh
bin/connect-standalone.sh
bin/kafka-acls.sh
bin/kafka-broker-api-versions.sh
bin/kafka-configs.sh
bin/kafka-console-consumer.sh
bin/kafka-console-producer.sh
bin/kafka-consumer-groups.sh
bin/kafka-consumer-offset-checker.sh
bin/kafka-consumer-perf-test.sh
bin/kafka-delete-records.sh
bin/kafka-mirror-maker.sh
bin/kafka-preferred-replica-election.sh
bin/kafka-producer-perf-test.sh
bin/kafka-reassign-partitions.sh
bin/kafka-replay-log-producer.sh
bin/kafka-replica-verification.sh
bin/kafka-run-class.sh
bin/kafka-server-start.sh
bin/kafka-server-stop.sh
bin/kafka-simple-consumer-shell.sh
bin/kafka-streams-application-reset.sh
bin/kafka-topics.sh
bin/kafka-verifiable-consumer.sh
bin/kafka-verifiable-producer.sh
lib/java/kafka/libs/aopalliance-repackaged-2.5.0-b05.jar
lib/java/kafka/libs/argparse4j-0.7.0.jar
lib/java/kafka/libs/commons-lang3-3.5.jar
lib/java/kafka/libs/connect-api-${PKGVERSION}.jar
lib/java/kafka/libs/connect-file-${PKGVERSION}.jar
lib/java/kafka/libs/connect-json-${PKGVERSION}.jar
lib/java/kafka/libs/connect-runtime-${PKGVERSION}.jar
lib/java/kafka/libs/connect-transforms-${PKGVERSION}.jar
lib/java/kafka/libs/guava-20.0.jar
lib/java/kafka/libs/hk2-api-2.5.0-b05.jar
lib/java/kafka/libs/hk2-locator-2.5.0-b05.jar
lib/java/kafka/libs/hk2-utils-2.5.0-b05.jar
lib/java/kafka/libs/jackson-annotations-2.8.5.jar
lib/java/kafka/libs/jackson-core-2.8.5.jar
lib/java/kafka/libs/jackson-databind-2.8.5.jar
lib/java/kafka/libs/jackson-jaxrs-base-2.8.5.jar
lib/java/kafka/libs/jackson-jaxrs-json-provider-2.8.5.jar
lib/java/kafka/libs/jackson-module-jaxb-annotations-2.8.5.jar
lib/java/kafka/libs/javassist-3.21.0-GA.jar
lib/java/kafka/libs/javax.annotation-api-1.2.jar
lib/java/kafka/libs/javax.inject-1.jar
lib/java/kafka/libs/javax.inject-2.5.0-b05.jar
lib/java/kafka/libs/javax.servlet-api-3.1.0.jar
lib/java/kafka/libs/javax.ws.rs-api-2.0.1.jar
lib/java/kafka/libs/jersey-client-2.24.jar
lib/java/kafka/libs/jersey-common-2.24.jar
lib/java/kafka/libs/jersey-container-servlet-2.24.jar
lib/java/kafka/libs/jersey-container-servlet-core-2.24.jar
lib/java/kafka/libs/jersey-guava-2.24.jar
lib/java/kafka/libs/jersey-media-jaxb-2.24.jar
lib/java/kafka/libs/jersey-server-2.24.jar
lib/java/kafka/libs/jetty-continuation-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-http-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-io-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-security-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-server-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-servlet-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-servlets-9.2.15.v20160210.jar
lib/java/kafka/libs/jetty-util-9.2.15.v20160210.jar
lib/java/kafka/libs/jopt-simple-5.0.3.jar
lib/java/kafka/libs/kafka-clients-${PKGVERSION}.jar
lib/java/kafka/libs/kafka-log4j-appender-${PKGVERSION}.jar
lib/java/kafka/libs/kafka-streams-${PKGVERSION}.jar
lib/java/kafka/libs/kafka-streams-examples-${PKGVERSION}.jar
lib/java/kafka/libs/kafka-tools-${PKGVERSION}.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}-javadoc.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}-scaladoc.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}-sources.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}-test-sources.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}-test.jar
lib/java/kafka/libs/kafka_2.12-${PKGVERSION}.jar
lib/java/kafka/libs/log4j-1.2.17.jar
lib/java/kafka/libs/lz4-1.3.0.jar
lib/java/kafka/libs/maven-artifact-3.5.0.jar
lib/java/kafka/libs/metrics-core-2.2.0.jar
lib/java/kafka/libs/osgi-resource-locator-1.0.1.jar
lib/java/kafka/libs/plexus-utils-3.0.24.jar
lib/java/kafka/libs/reflections-0.9.11.jar
lib/java/kafka/libs/rocksdbjni-5.0.1.jar
lib/java/kafka/libs/scala-library-2.12.2.jar
lib/java/kafka/libs/scala-parser-combinators_2.12-1.0.4.jar
lib/java/kafka/libs/slf4j-api-1.7.25.jar
lib/java/kafka/libs/slf4j-log4j12-1.7.25.jar
lib/java/kafka/libs/snappy-java-1.1.2.6.jar
lib/java/kafka/libs/validation-api-1.1.0.Final.jar
lib/java/kafka/libs/zkclient-0.10.jar
lib/java/kafka/libs/zookeeper-3.4.10.jar
share/examples/kafka/connect-console-sink.properties
share/examples/kafka/connect-console-source.properties
share/examples/kafka/connect-distributed.properties
share/examples/kafka/connect-file-sink.properties
share/examples/kafka/connect-file-source.properties
share/examples/kafka/connect-log4j.properties
share/examples/kafka/connect-standalone.properties
share/examples/kafka/consumer.properties
share/examples/kafka/log4j.properties
share/examples/kafka/producer.properties
share/examples/kafka/server.properties
share/examples/kafka/tools-log4j.properties
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" default-locale="en-US">
<!-- Elsevier, generated from "elsevier" metadata at https://github.com/citation-style-language/journals -->
<info>
<title>Neuropharmacology</title>
<id>http://www.zotero.org/styles/neuropharmacology</id>
<link href="http://www.zotero.org/styles/neuropharmacology" rel="self"/>
<link href="http://www.zotero.org/styles/elsevier-harvard" rel="independent-parent"/>
<category citation-format="author-date"/>
<issn>0028-3908</issn>
<updated>2018-02-16T12:00:00+00:00</updated>
<rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
</style>
| {
"pile_set_name": "Github"
} |
{
"tests": [
{
"description": "should use the default source and mechanism",
"uri": "mongodb://user:password@localhost",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified",
"uri": "mongodb://user:password@localhost/foo",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified",
"uri": "mongodb://user:password@localhost/foo?authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": null,
"mechanism_properties": null
}
},
{
"description": "should recognise the mechanism (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should ignore the database (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/foo?authMechanism=GSSAPI",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should accept valid authSource (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authSource=$external",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "should accept generic mechanism property (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:other,CANONICALIZE_HOST_NAME:true",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": null,
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "other",
"CANONICALIZE_HOST_NAME": true
}
}
},
{
"description": "should accept the password (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM:password@localhost/?authMechanism=GSSAPI&authSource=$external",
"valid": true,
"credential": {
"username": "user@DOMAIN.COM",
"password": "password",
"source": "$external",
"mechanism": "GSSAPI",
"mechanism_properties": {
"SERVICE_NAME": "mongodb"
}
}
},
{
"description": "must raise an error when the authSource is empty",
"uri": "mongodb://user:password@localhost/foo?authSource=",
"valid": false
},
{
"description": "must raise an error when the authSource is empty without credentials",
"uri": "mongodb://localhost/admin?authSource=",
"valid": false
},
{
"description": "should throw an exception if authSource is invalid (GSSAPI)",
"uri": "mongodb://user%40DOMAIN.COM@localhost/?authMechanism=GSSAPI&authSource=foo",
"valid": false
},
{
"description": "should throw an exception if no username (GSSAPI)",
"uri": "mongodb://localhost/?authMechanism=GSSAPI",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username is supplied (MONGODB-CR)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-CR",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should ignore the database (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509&authSource=$external",
"valid": true,
"credential": {
"username": "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry",
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should recognize the mechanism with no username (MONGODB-X509)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-X509",
"valid": true,
"credential": {
"username": null,
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should recognize the mechanism with no username when auth source is explicitly specified (MONGODB-X509)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-X509&authSource=$external",
"valid": true,
"credential": {
"username": null,
"password": null,
"source": "$external",
"mechanism": "MONGODB-X509",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if supplied a password (MONGODB-X509)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-X509",
"valid": false
},
{
"description": "should throw an exception if authSource is invalid (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/foo?authMechanism=MONGODB-X509&authSource=bar",
"valid": false
},
{
"description": "should recognize the mechanism (PLAIN)",
"uri": "mongodb://user:password@localhost/?authMechanism=PLAIN",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "$external",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (PLAIN)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=PLAIN",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified (PLAIN)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=PLAIN&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "PLAIN",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (PLAIN)",
"uri": "mongodb://localhost/?authMechanism=PLAIN",
"valid": false
},
{
"description": "should recognize the mechanism (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-1",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-1",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (SCRAM-SHA-1)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-1&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "SCRAM-SHA-1",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (SCRAM-SHA-1)",
"uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-1",
"valid": false
},
{
"description": "should recognize the mechanism (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/?authMechanism=SCRAM-SHA-256",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-256",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should accept valid authSource (SCRAM-SHA-256)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=SCRAM-SHA-256&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "SCRAM-SHA-256",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username (SCRAM-SHA-256)",
"uri": "mongodb://localhost/?authMechanism=SCRAM-SHA-256",
"valid": false
},
{
"description": "URI with no auth-related info doesn't create credential",
"uri": "mongodb://localhost/",
"valid": true,
"credential": null
},
{
"description": "database in URI path doesn't create credentials",
"uri": "mongodb://localhost/foo",
"valid": true,
"credential": null
},
{
"description": "authSource without username doesn't create credential (default mechanism)",
"uri": "mongodb://localhost/?authSource=foo",
"valid": true,
"credential": null
},
{
"description": "should throw an exception if no username provided (userinfo implies default mechanism)",
"uri": "mongodb://@localhost.com/",
"valid": false
},
{
"description": "should throw an exception if no username/password provided (userinfo implies default mechanism)",
"uri": "mongodb://:@localhost.com/",
"valid": false
},
{
"description": "should recognise the mechanism (MONGODB-AWS)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-AWS",
"valid": true,
"credential": {
"username": null,
"password": null,
"source": "$external",
"mechanism": "MONGODB-AWS",
"mechanism_properties": null
}
},
{
"description": "should recognise the mechanism when auth source is explicitly specified (MONGODB-AWS)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-AWS&authSource=$external",
"valid": true,
"credential": {
"username": null,
"password": null,
"source": "$external",
"mechanism": "MONGODB-AWS",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if username and no password (MONGODB-AWS)",
"uri": "mongodb://user@localhost/?authMechanism=MONGODB-AWS",
"valid": false,
"credential": null
},
{
"description": "should use username and password if specified (MONGODB-AWS)",
"uri": "mongodb://user%21%40%23%24%25%5E%26%2A%28%29_%2B:pass%21%40%23%24%25%5E%26%2A%28%29_%2B@localhost/?authMechanism=MONGODB-AWS",
"valid": true,
"credential": {
"username": "user!@#$%^&*()_+",
"password": "pass!@#$%^&*()_+",
"source": "$external",
"mechanism": "MONGODB-AWS",
"mechanism_properties": null
}
},
{
"description": "should use username, password and session token if specified (MONGODB-AWS)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:token%21%40%23%24%25%5E%26%2A%28%29_%2B",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "$external",
"mechanism": "MONGODB-AWS",
"mechanism_properties": {
"AWS_SESSION_TOKEN": "token!@#$%^&*()_+"
}
}
}
]
}
| {
"pile_set_name": "Github"
} |
//
#pragma once
#include "UIEditBox.h"
class CUICDkey : public CUIEditBox
{
private:
typedef CUIEditBox inherited;
public:
CUICDkey ();
virtual void SetText (LPCSTR str) {}
virtual LPCSTR GetText ();
// CUIOptionsItem
virtual void SetCurrentValue ();
virtual void SaveValue ();
virtual bool IsChanged ();
void CreateCDKeyEntry();
virtual void Show (bool status);
virtual void Draw ();
virtual void OnFocusLost ();
private:
bool m_view_access;
}; // class CUICDkey
class CUIMPPlayerName : public CUIEditBox
{
private:
typedef CUIEditBox inherited;
public:
CUIMPPlayerName () {};
virtual ~CUIMPPlayerName() {};
// virtual void SetText (LPCSTR str) {}
// virtual void SetCurrentValue();
// virtual void SaveValue();
// virtual bool IsChanged();
virtual void OnFocusLost ();
}; // class CUIMPPlayerName
extern void GetCDKey_FromRegistry (char* cdkey);
extern void WriteCDKey_ToRegistry (LPSTR cdkey);
extern void GetPlayerName_FromRegistry (char* name, u32 const name_size);
extern void WritePlayerName_ToRegistry (LPSTR name);
| {
"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 (version 1.7.0_71) on Tue Dec 16 10:59:45 NZDT 2014 -->
<title>MultilayerPerceptron</title>
<meta name="date" content="2014-12-16">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MultilayerPerceptron";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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="../../../weka/classifiers/functions/Logistic.html" title="class in weka.classifiers.functions"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../weka/classifiers/functions/PaceRegression.html" title="class in weka.classifiers.functions"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?weka/classifiers/functions/MultilayerPerceptron.html" target="_top">Frames</a></li>
<li><a href="MultilayerPerceptron.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>Field | </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>Field | </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">weka.classifiers.functions</div>
<h2 title="Class MultilayerPerceptron" class="title">Class MultilayerPerceptron</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">weka.classifiers.Classifier</a></li>
<li>
<ul class="inheritance">
<li>weka.classifiers.functions.MultilayerPerceptron</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, java.lang.Cloneable, <a href="../../../weka/core/CapabilitiesHandler.html" title="interface in weka.core">CapabilitiesHandler</a>, <a href="../../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</a>, <a href="../../../weka/core/Randomizable.html" title="interface in weka.core">Randomizable</a>, <a href="../../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</a>, <a href="../../../weka/core/WeightedInstancesHandler.html" title="interface in weka.core">WeightedInstancesHandler</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">MultilayerPerceptron</span>
extends <a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a>
implements <a href="../../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</a>, <a href="../../../weka/core/WeightedInstancesHandler.html" title="interface in weka.core">WeightedInstancesHandler</a>, <a href="../../../weka/core/Randomizable.html" title="interface in weka.core">Randomizable</a></pre>
<div class="block"><!-- globalinfo-start -->
A Classifier that uses backpropagation to classify instances.<br/>
This network can be built by hand, created by an algorithm or both. The network can also be monitored and modified during training time. The nodes in this network are all sigmoid (except for when the class is numeric in which case the the output nodes become unthresholded linear units).
<p/>
<!-- globalinfo-end -->
<!-- options-start -->
Valid options are: <p/>
<pre> -L <learning rate>
Learning Rate for the backpropagation algorithm.
(Value should be between 0 - 1, Default = 0.3).</pre>
<pre> -M <momentum>
Momentum Rate for the backpropagation algorithm.
(Value should be between 0 - 1, Default = 0.2).</pre>
<pre> -N <number of epochs>
Number of epochs to train through.
(Default = 500).</pre>
<pre> -V <percentage size of validation set>
Percentage size of validation set to use to terminate
training (if this is non zero it can pre-empt num of epochs.
(Value should be between 0 - 100, Default = 0).</pre>
<pre> -S <seed>
The value used to seed the random number generator
(Value should be >= 0 and and a long, Default = 0).</pre>
<pre> -E <threshold for number of consequetive errors>
The consequetive number of errors allowed for validation
testing before the netwrok terminates.
(Value should be > 0, Default = 20).</pre>
<pre> -G
GUI will be opened.
(Use this to bring up a GUI).</pre>
<pre> -A
Autocreation of the network connections will NOT be done.
(This will be ignored if -G is NOT set)</pre>
<pre> -B
A NominalToBinary filter will NOT automatically be used.
(Set this to not use a NominalToBinary filter).</pre>
<pre> -H <comma seperated numbers for nodes on each layer>
The hidden layers to be created for the network.
(Value should be a list of comma separated Natural
numbers or the letters 'a' = (attribs + classes) / 2,
'i' = attribs, 'o' = classes, 't' = attribs .+ classes)
for wildcard values, Default = a).</pre>
<pre> -C
Normalizing a numeric class will NOT be done.
(Set this to not normalize the class if it's numeric).</pre>
<pre> -I
Normalizing the attributes will NOT be done.
(Set this to not normalize the attributes).</pre>
<pre> -R
Reseting the network will NOT be allowed.
(Set this to not allow the network to reset).</pre>
<pre> -D
Learning rate decay will occur.
(Set this to cause the learning rate to decay).</pre>
<!-- options-end --></div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Revision: 10073 $</dd>
<dt><span class="strong">Author:</span></dt>
<dd>Malcolm Ware (mfw4@cs.waikato.ac.nz)</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../serialized-form.html#weka.classifiers.functions.MultilayerPerceptron">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" 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><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#MultilayerPerceptron()">MultilayerPerceptron</a></strong>()</code>
<div class="block">The constructor.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#autoBuildTipText()">autoBuildTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#blocker(boolean)">blocker</a></strong>(boolean tf)</code>
<div class="block">A function used to stop the code that called buildclassifier
from continuing on before the user has finished the decision tree.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#buildClassifier(weka.core.Instances)">buildClassifier</a></strong>(<a href="../../../weka/core/Instances.html" title="class in weka.core">Instances</a> i)</code>
<div class="block">Call this function to build and train a neural network for the training
data provided.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#decayTipText()">decayTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#distributionForInstance(weka.core.Instance)">distributionForInstance</a></strong>(<a href="../../../weka/core/Instance.html" title="class in weka.core">Instance</a> i)</code>
<div class="block">Call this function to predict the class of an instance once a
classification model has been built with the buildClassifier call.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getAutoBuild()">getAutoBuild</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../weka/core/Capabilities.html" title="class in weka.core">Capabilities</a></code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getCapabilities()">getCapabilities</a></strong>()</code>
<div class="block">Returns default capabilities of the classifier.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getDecay()">getDecay</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getGUI()">getGUI</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getHiddenLayers()">getHiddenLayers</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getLearningRate()">getLearningRate</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getMomentum()">getMomentum</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getNominalToBinaryFilter()">getNominalToBinaryFilter</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getNormalizeAttributes()">getNormalizeAttributes</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getNormalizeNumericClass()">getNormalizeNumericClass</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String[]</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getOptions()">getOptions</a></strong>()</code>
<div class="block">Gets the current settings of NeuralNet.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getReset()">getReset</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getRevision()">getRevision</a></strong>()</code>
<div class="block">Returns the revision string.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getSeed()">getSeed</a></strong>()</code>
<div class="block">Gets the seed for the random number generations</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getTrainingTime()">getTrainingTime</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getValidationSetSize()">getValidationSetSize</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#getValidationThreshold()">getValidationThreshold</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#globalInfo()">globalInfo</a></strong>()</code>
<div class="block">This will return a string describing the classifier.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#GUITipText()">GUITipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#hiddenLayersTipText()">hiddenLayersTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#learningRateTipText()">learningRateTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.util.Enumeration</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#listOptions()">listOptions</a></strong>()</code>
<div class="block">Returns an enumeration describing the available options.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#main(java.lang.String[])">main</a></strong>(java.lang.String[] argv)</code>
<div class="block">Main method for testing this class.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#momentumTipText()">momentumTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#nominalToBinaryFilterTipText()">nominalToBinaryFilterTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#normalizeAttributesTipText()">normalizeAttributesTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#normalizeNumericClassTipText()">normalizeNumericClassTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#resetTipText()">resetTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#seedTipText()">seedTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setAutoBuild(boolean)">setAutoBuild</a></strong>(boolean a)</code>
<div class="block">This will set whether the network is automatically built
or if it is left up to the user.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setDecay(boolean)">setDecay</a></strong>(boolean d)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setGUI(boolean)">setGUI</a></strong>(boolean a)</code>
<div class="block">This will set whether A GUI is brought up to allow interaction by the user
with the neural network during training.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setHiddenLayers(java.lang.String)">setHiddenLayers</a></strong>(java.lang.String h)</code>
<div class="block">This will set what the hidden layers are made up of when auto build is
enabled.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setLearningRate(double)">setLearningRate</a></strong>(double l)</code>
<div class="block">The learning rate can be set using this command.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setMomentum(double)">setMomentum</a></strong>(double m)</code>
<div class="block">The momentum can be set using this command.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setNominalToBinaryFilter(boolean)">setNominalToBinaryFilter</a></strong>(boolean f)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setNormalizeAttributes(boolean)">setNormalizeAttributes</a></strong>(boolean a)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setNormalizeNumericClass(boolean)">setNormalizeNumericClass</a></strong>(boolean c)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setOptions(java.lang.String[])">setOptions</a></strong>(java.lang.String[] options)</code>
<div class="block">Parses a given list of options.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setReset(boolean)">setReset</a></strong>(boolean r)</code>
<div class="block">This sets the network up to be able to reset itself with the current
settings and the learning rate at half of what it is currently.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setSeed(int)">setSeed</a></strong>(int l)</code>
<div class="block">This seeds the random number generator, that is used when a random
number is needed for the network.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setTrainingTime(int)">setTrainingTime</a></strong>(int n)</code>
<div class="block">Set the number of training epochs to perform.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setValidationSetSize(int)">setValidationSetSize</a></strong>(int a)</code>
<div class="block">This will set the size of the validation set.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#setValidationThreshold(int)">setValidationThreshold</a></strong>(int t)</code>
<div class="block">This sets the threshold to use for when validation testing is being done.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#toString()">toString</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#trainingTimeTipText()">trainingTimeTipText</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#validationSetSizeTipText()">validationSetSizeTipText</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../weka/classifiers/functions/MultilayerPerceptron.html#validationThresholdTipText()">validationThresholdTipText</a></strong>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_weka.classifiers.Classifier">
<!-- -->
</a>
<h3>Methods inherited from class weka.classifiers.<a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></h3>
<code><a href="../../../weka/classifiers/Classifier.html#classifyInstance(weka.core.Instance)">classifyInstance</a>, <a href="../../../weka/classifiers/Classifier.html#debugTipText()">debugTipText</a>, <a href="../../../weka/classifiers/Classifier.html#forName(java.lang.String,%20java.lang.String[])">forName</a>, <a href="../../../weka/classifiers/Classifier.html#getDebug()">getDebug</a>, <a href="../../../weka/classifiers/Classifier.html#makeCopies(weka.classifiers.Classifier,%20int)">makeCopies</a>, <a href="../../../weka/classifiers/Classifier.html#makeCopy(weka.classifiers.Classifier)">makeCopy</a>, <a href="../../../weka/classifiers/Classifier.html#setDebug(boolean)">setDebug</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="MultilayerPerceptron()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>MultilayerPerceptron</h4>
<pre>public MultilayerPerceptron()</pre>
<div class="block">The constructor.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="main(java.lang.String[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>main</h4>
<pre>public static void main(java.lang.String[] argv)</pre>
<div class="block">Main method for testing this class.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>argv</code> - should contain command line options (see setOptions)</dd></dl>
</li>
</ul>
<a name="setDecay(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDecay</h4>
<pre>public void setDecay(boolean d)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>d</code> - True if the learning rate should decay.</dd></dl>
</li>
</ul>
<a name="getDecay()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDecay</h4>
<pre>public boolean getDecay()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>the flag for having the learning rate decay.</dd></dl>
</li>
</ul>
<a name="setReset(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setReset</h4>
<pre>public void setReset(boolean r)</pre>
<div class="block">This sets the network up to be able to reset itself with the current
settings and the learning rate at half of what it is currently. This
will only happen if the network creates NaN or infinite errors. Also this
will continue to happen until the network is trained properly. The
learning rate will also get set back to it's original value at the end of
this. This can only be set to true if the GUI is not brought up.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>r</code> - True if the network should restart with it's current options
and set the learning rate to half what it currently is.</dd></dl>
</li>
</ul>
<a name="getReset()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getReset</h4>
<pre>public boolean getReset()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The flag for reseting the network.</dd></dl>
</li>
</ul>
<a name="setNormalizeNumericClass(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setNormalizeNumericClass</h4>
<pre>public void setNormalizeNumericClass(boolean c)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>c</code> - True if the class should be normalized (the class will only ever
be normalized if it is numeric). (Normalization puts the range between
-1 - 1).</dd></dl>
</li>
</ul>
<a name="getNormalizeNumericClass()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizeNumericClass</h4>
<pre>public boolean getNormalizeNumericClass()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The flag for normalizing a numeric class.</dd></dl>
</li>
</ul>
<a name="setNormalizeAttributes(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setNormalizeAttributes</h4>
<pre>public void setNormalizeAttributes(boolean a)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - True if the attributes should be normalized (even nominal
attributes will get normalized here) (range goes between -1 - 1).</dd></dl>
</li>
</ul>
<a name="getNormalizeAttributes()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizeAttributes</h4>
<pre>public boolean getNormalizeAttributes()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The flag for normalizing attributes.</dd></dl>
</li>
</ul>
<a name="setNominalToBinaryFilter(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setNominalToBinaryFilter</h4>
<pre>public void setNominalToBinaryFilter(boolean f)</pre>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>f</code> - True if a nominalToBinary filter should be used on the
data.</dd></dl>
</li>
</ul>
<a name="getNominalToBinaryFilter()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNominalToBinaryFilter</h4>
<pre>public boolean getNominalToBinaryFilter()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The flag for nominal to binary filter use.</dd></dl>
</li>
</ul>
<a name="setSeed(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSeed</h4>
<pre>public void setSeed(int l)</pre>
<div class="block">This seeds the random number generator, that is used when a random
number is needed for the network.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/Randomizable.html#setSeed(int)">setSeed</a></code> in interface <code><a href="../../../weka/core/Randomizable.html" title="interface in weka.core">Randomizable</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>l</code> - The seed.</dd></dl>
</li>
</ul>
<a name="getSeed()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSeed</h4>
<pre>public int getSeed()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../weka/core/Randomizable.html#getSeed()">Randomizable</a></code></strong></div>
<div class="block">Gets the seed for the random number generations</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/Randomizable.html#getSeed()">getSeed</a></code> in interface <code><a href="../../../weka/core/Randomizable.html" title="interface in weka.core">Randomizable</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>The seed for the random number generator.</dd></dl>
</li>
</ul>
<a name="setValidationThreshold(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setValidationThreshold</h4>
<pre>public void setValidationThreshold(int t)</pre>
<div class="block">This sets the threshold to use for when validation testing is being done.
It works by ending testing once the error on the validation set has
consecutively increased a certain number of times.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>t</code> - The threshold to use for this.</dd></dl>
</li>
</ul>
<a name="getValidationThreshold()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValidationThreshold</h4>
<pre>public int getValidationThreshold()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The threshold used for validation testing.</dd></dl>
</li>
</ul>
<a name="setLearningRate(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setLearningRate</h4>
<pre>public void setLearningRate(double l)</pre>
<div class="block">The learning rate can be set using this command.
NOTE That this is a static variable so it affect all networks that are
running.
Must be greater than 0 and no more than 1.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>l</code> - The New learning rate.</dd></dl>
</li>
</ul>
<a name="getLearningRate()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLearningRate</h4>
<pre>public double getLearningRate()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The learning rate for the nodes.</dd></dl>
</li>
</ul>
<a name="setMomentum(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMomentum</h4>
<pre>public void setMomentum(double m)</pre>
<div class="block">The momentum can be set using this command.
THE same conditions apply to this as to the learning rate.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>m</code> - The new Momentum.</dd></dl>
</li>
</ul>
<a name="getMomentum()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMomentum</h4>
<pre>public double getMomentum()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The momentum for the nodes.</dd></dl>
</li>
</ul>
<a name="setAutoBuild(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAutoBuild</h4>
<pre>public void setAutoBuild(boolean a)</pre>
<div class="block">This will set whether the network is automatically built
or if it is left up to the user. (there is nothing to stop a user
from altering an autobuilt network however).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - True if the network should be auto built.</dd></dl>
</li>
</ul>
<a name="getAutoBuild()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAutoBuild</h4>
<pre>public boolean getAutoBuild()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The auto build state.</dd></dl>
</li>
</ul>
<a name="setHiddenLayers(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHiddenLayers</h4>
<pre>public void setHiddenLayers(java.lang.String h)</pre>
<div class="block">This will set what the hidden layers are made up of when auto build is
enabled. Note to have no hidden units, just put a single 0, Any more
0's will indicate that the string is badly formed and make it unaccepted.
Negative numbers, and floats will do the same. There are also some
wildcards. These are 'a' = (number of attributes + number of classes) / 2,
'i' = number of attributes, 'o' = number of classes, and 't' = number of
attributes + number of classes.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>h</code> - A string with a comma seperated list of numbers. Each number is
the number of nodes to be on a hidden layer.</dd></dl>
</li>
</ul>
<a name="getHiddenLayers()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHiddenLayers</h4>
<pre>public java.lang.String getHiddenLayers()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>A string representing the hidden layers, each number is the number
of nodes on a hidden layer.</dd></dl>
</li>
</ul>
<a name="setGUI(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setGUI</h4>
<pre>public void setGUI(boolean a)</pre>
<div class="block">This will set whether A GUI is brought up to allow interaction by the user
with the neural network during training.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - True if gui should be created.</dd></dl>
</li>
</ul>
<a name="getGUI()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGUI</h4>
<pre>public boolean getGUI()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The true if should show gui.</dd></dl>
</li>
</ul>
<a name="setValidationSetSize(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setValidationSetSize</h4>
<pre>public void setValidationSetSize(int a)</pre>
<div class="block">This will set the size of the validation set.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>a</code> - The size of the validation set, as a percentage of the whole.</dd></dl>
</li>
</ul>
<a name="getValidationSetSize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValidationSetSize</h4>
<pre>public int getValidationSetSize()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The percentage size of the validation set.</dd></dl>
</li>
</ul>
<a name="setTrainingTime(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTrainingTime</h4>
<pre>public void setTrainingTime(int n)</pre>
<div class="block">Set the number of training epochs to perform.
Must be greater than 0.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>n</code> - The number of epochs to train through.</dd></dl>
</li>
</ul>
<a name="getTrainingTime()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTrainingTime</h4>
<pre>public int getTrainingTime()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>The number of epochs to train through.</dd></dl>
</li>
</ul>
<a name="blocker(boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>blocker</h4>
<pre>public void blocker(boolean tf)</pre>
<div class="block">A function used to stop the code that called buildclassifier
from continuing on before the user has finished the decision tree.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>tf</code> - True to stop the thread, False to release the thread that is
waiting there (if one).</dd></dl>
</li>
</ul>
<a name="getCapabilities()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCapabilities</h4>
<pre>public <a href="../../../weka/core/Capabilities.html" title="class in weka.core">Capabilities</a> getCapabilities()</pre>
<div class="block">Returns default capabilities of the classifier.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/CapabilitiesHandler.html#getCapabilities()">getCapabilities</a></code> in interface <code><a href="../../../weka/core/CapabilitiesHandler.html" title="interface in weka.core">CapabilitiesHandler</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#getCapabilities()">getCapabilities</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the capabilities of this classifier</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../weka/core/Capabilities.html" title="class in weka.core"><code>Capabilities</code></a></dd></dl>
</li>
</ul>
<a name="buildClassifier(weka.core.Instances)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>buildClassifier</h4>
<pre>public void buildClassifier(<a href="../../../weka/core/Instances.html" title="class in weka.core">Instances</a> i)
throws java.lang.Exception</pre>
<div class="block">Call this function to build and train a neural network for the training
data provided.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#buildClassifier(weka.core.Instances)">buildClassifier</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - The training data.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if can't build classification properly.</dd></dl>
</li>
</ul>
<a name="distributionForInstance(weka.core.Instance)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>distributionForInstance</h4>
<pre>public double[] distributionForInstance(<a href="../../../weka/core/Instance.html" title="class in weka.core">Instance</a> i)
throws java.lang.Exception</pre>
<div class="block">Call this function to predict the class of an instance once a
classification model has been built with the buildClassifier call.</div>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#distributionForInstance(weka.core.Instance)">distributionForInstance</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>i</code> - The instance to classify.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A double array filled with the probabilities of each class type.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if can't classify instance.</dd></dl>
</li>
</ul>
<a name="listOptions()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>listOptions</h4>
<pre>public java.util.Enumeration listOptions()</pre>
<div class="block">Returns an enumeration describing the available options.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/OptionHandler.html#listOptions()">listOptions</a></code> in interface <code><a href="../../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#listOptions()">listOptions</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>an enumeration of all the available options.</dd></dl>
</li>
</ul>
<a name="setOptions(java.lang.String[])">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setOptions</h4>
<pre>public void setOptions(java.lang.String[] options)
throws java.lang.Exception</pre>
<div class="block">Parses a given list of options. <p/>
<!-- options-start -->
Valid options are: <p/>
<pre> -L <learning rate>
Learning Rate for the backpropagation algorithm.
(Value should be between 0 - 1, Default = 0.3).</pre>
<pre> -M <momentum>
Momentum Rate for the backpropagation algorithm.
(Value should be between 0 - 1, Default = 0.2).</pre>
<pre> -N <number of epochs>
Number of epochs to train through.
(Default = 500).</pre>
<pre> -V <percentage size of validation set>
Percentage size of validation set to use to terminate
training (if this is non zero it can pre-empt num of epochs.
(Value should be between 0 - 100, Default = 0).</pre>
<pre> -S <seed>
The value used to seed the random number generator
(Value should be >= 0 and and a long, Default = 0).</pre>
<pre> -E <threshold for number of consequetive errors>
The consequetive number of errors allowed for validation
testing before the netwrok terminates.
(Value should be > 0, Default = 20).</pre>
<pre> -G
GUI will be opened.
(Use this to bring up a GUI).</pre>
<pre> -A
Autocreation of the network connections will NOT be done.
(This will be ignored if -G is NOT set)</pre>
<pre> -B
A NominalToBinary filter will NOT automatically be used.
(Set this to not use a NominalToBinary filter).</pre>
<pre> -H <comma seperated numbers for nodes on each layer>
The hidden layers to be created for the network.
(Value should be a list of comma separated Natural
numbers or the letters 'a' = (attribs + classes) / 2,
'i' = attribs, 'o' = classes, 't' = attribs .+ classes)
for wildcard values, Default = a).</pre>
<pre> -C
Normalizing a numeric class will NOT be done.
(Set this to not normalize the class if it's numeric).</pre>
<pre> -I
Normalizing the attributes will NOT be done.
(Set this to not normalize the attributes).</pre>
<pre> -R
Reseting the network will NOT be allowed.
(Set this to not allow the network to reset).</pre>
<pre> -D
Learning rate decay will occur.
(Set this to cause the learning rate to decay).</pre>
<!-- options-end --></div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/OptionHandler.html#setOptions(java.lang.String[])">setOptions</a></code> in interface <code><a href="../../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#setOptions(java.lang.String[])">setOptions</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>options</code> - the list of options as an array of strings</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - if an option is not supported</dd></dl>
</li>
</ul>
<a name="getOptions()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getOptions</h4>
<pre>public java.lang.String[] getOptions()</pre>
<div class="block">Gets the current settings of NeuralNet.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/OptionHandler.html#getOptions()">getOptions</a></code> in interface <code><a href="../../../weka/core/OptionHandler.html" title="interface in weka.core">OptionHandler</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#getOptions()">getOptions</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>an array of strings suitable for passing to setOptions()</dd></dl>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public java.lang.String toString()</pre>
<dl>
<dt><strong>Overrides:</strong></dt>
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
<dt><span class="strong">Returns:</span></dt><dd>string describing the model.</dd></dl>
</li>
</ul>
<a name="globalInfo()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>globalInfo</h4>
<pre>public java.lang.String globalInfo()</pre>
<div class="block">This will return a string describing the classifier.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The string.</dd></dl>
</li>
</ul>
<a name="learningRateTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>learningRateTipText</h4>
<pre>public java.lang.String learningRateTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the learning rate option.</dd></dl>
</li>
</ul>
<a name="momentumTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>momentumTipText</h4>
<pre>public java.lang.String momentumTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the momentum option.</dd></dl>
</li>
</ul>
<a name="autoBuildTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>autoBuildTipText</h4>
<pre>public java.lang.String autoBuildTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the AutoBuild option.</dd></dl>
</li>
</ul>
<a name="seedTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>seedTipText</h4>
<pre>public java.lang.String seedTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the random seed option.</dd></dl>
</li>
</ul>
<a name="validationThresholdTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validationThresholdTipText</h4>
<pre>public java.lang.String validationThresholdTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the validation threshold option.</dd></dl>
</li>
</ul>
<a name="GUITipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GUITipText</h4>
<pre>public java.lang.String GUITipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the GUI option.</dd></dl>
</li>
</ul>
<a name="validationSetSizeTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>validationSetSizeTipText</h4>
<pre>public java.lang.String validationSetSizeTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the validation size option.</dd></dl>
</li>
</ul>
<a name="trainingTimeTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>trainingTimeTipText</h4>
<pre>public java.lang.String trainingTimeTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the learning rate option.</dd></dl>
</li>
</ul>
<a name="nominalToBinaryFilterTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nominalToBinaryFilterTipText</h4>
<pre>public java.lang.String nominalToBinaryFilterTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the nominal to binary option.</dd></dl>
</li>
</ul>
<a name="hiddenLayersTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hiddenLayersTipText</h4>
<pre>public java.lang.String hiddenLayersTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the hidden layers in the network.</dd></dl>
</li>
</ul>
<a name="normalizeNumericClassTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>normalizeNumericClassTipText</h4>
<pre>public java.lang.String normalizeNumericClassTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the nominal to binary option.</dd></dl>
</li>
</ul>
<a name="normalizeAttributesTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>normalizeAttributesTipText</h4>
<pre>public java.lang.String normalizeAttributesTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the nominal to binary option.</dd></dl>
</li>
</ul>
<a name="resetTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetTipText</h4>
<pre>public java.lang.String resetTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the Reset option.</dd></dl>
</li>
</ul>
<a name="decayTipText()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>decayTipText</h4>
<pre>public java.lang.String decayTipText()</pre>
<dl><dt><span class="strong">Returns:</span></dt><dd>a string to describe the Decay option.</dd></dl>
</li>
</ul>
<a name="getRevision()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getRevision</h4>
<pre>public java.lang.String getRevision()</pre>
<div class="block">Returns the revision string.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../weka/core/RevisionHandler.html#getRevision()">getRevision</a></code> in interface <code><a href="../../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</a></code></dd>
<dt><strong>Overrides:</strong></dt>
<dd><code><a href="../../../weka/classifiers/Classifier.html#getRevision()">getRevision</a></code> in class <code><a href="../../../weka/classifiers/Classifier.html" title="class in weka.classifiers">Classifier</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the revision</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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="../../../weka/classifiers/functions/Logistic.html" title="class in weka.classifiers.functions"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../weka/classifiers/functions/PaceRegression.html" title="class in weka.classifiers.functions"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?weka/classifiers/functions/MultilayerPerceptron.html" target="_top">Frames</a></li>
<li><a href="MultilayerPerceptron.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>Field | </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>Field | </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"
} |
{% extends 'app_doc/manage_base.html' %}
{% load staticfiles %}
{% block title %}图片素材管理{% endblock %}
{% block custom_link %}
<link href="{% static 'viewerjs/viewer.css' %}?version={{mrdoc_version}}" rel="stylesheet">
{% endblock %}
{% block content %}
<div class="layui-card-header" style="margin-bottom: 10px;">
<div class="layui-row">
<span style="font-size:18px;">图片素材管理
</span>
</div>
</div>
<div class="layui-row">
<form action="" method="get">
<div class="layui-form-item">
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" id="upload_img"><i class="layui-icon layui-icon-upload"></i>上传图片</button>
<button class="layui-btn layui-btn-normal layui-btn-sm" type="button" onclick="createImgGroup()"><i class="layui-icon layui-icon-addition"></i>新建分组</button>
<a class="layui-btn layui-btn-normal layui-btn-sm" href="{% url 'manage_img_group' %}">分组管理</a>
</div>
</form>
</div>
<div class="layui-row">
<span class="layui-breadcrumb doc_status_condition" lay-separator="|">
{% load project_filter %}
<a href="{% url 'manage_image' %}?group=0" class="{% if g_id == 0 %}current{% endif %}">全部图片({{all_img_cnt}})</a>
<a href="{% url 'manage_image' %}?group=-1" class="{% if g_id == -1 %}current{% endif %}">未分组({{no_group_cnt}})</a>
{% for group in groups %}
<a href="{% url 'manage_image' %}?group={{group.id}}" class="{% if g_id == group.id %}current{% endif %}">{{group.group_name}}({{group.id | img_group_cnt}})</a>
{% endfor %}
</span>
</div>
<div class="layui-row" lay-skin="line">
<ul style="padding: 20px;" id="images">
{% for img in images %}
<li class="image-list">
<img class="image-list-i" src="{{img.file_path}}" title="{{img.file_name}}">
<div class="opera-img-btn">
<a href="javascript:void(0);" class="move-img" title="移动分组" data-src="{{img.file_path}}" data-id="{{img.id}}"><i class="layui-icon layui-icon-transfer"></i></a>
<a href="javascript:void(0);" class="del-img" title="删除图片" data-src="{{img.file_path}}" data-id="{{img.id}}"><i class="layui-icon layui-icon-delete"></i></a>
</div>
</li>
{% endfor %}
</ul>
</div>
<hr>
<!-- 分页 -->
<div class="layui-row">
<div class="layui-box layui-laypage layui-laypage-default">
<!-- 上一页 -->
{% if images.has_previous %}
<a href="?page={{ images.previous_page_number }}&group={{images.group}}" class="layui-btn layui-btn-xs layui-btn-normal">上一页</a>
{% else %}
<a href="javascript:;" class="layui-btn layui-btn-xs layui-btn-disabled">上一页</a>
{% endif %}
<!-- 当前页 -->
<span class="layui-laypage-curr">
<em class="layui-laypage-em"></em>
<em>{{ images.number }}/{{ images.paginator.num_pages }}</em>
</span>
<!-- 下一页 -->
{% if images.has_next %}
<a href="?page={{ images.next_page_number }}&group={{images.group}}" class="layui-btn layui-btn-xs layui-btn-normal">下一页</a>
{% else %}
<a class="layui-btn layui-btn-xs layui-btn-disabled">下一页</a>
{% endif %}
</div>
</div>
{% endblock %}
{% block custom_script %}
<script src="{% static 'viewerjs/viewer.js' %}"></script>
<script>
var form = layui.form;
var flow = layui.flow;
// 懒加载图片
flow.lazyimg({elem:'img.image-list-i'});
//悬浮显示图片按钮
$(".image-list").mouseover(function(){
$(this).find(".opera-img-btn").show();
});
$(".image-list").mouseleave(function(){
$(this).find(".opera-img-btn").hide();
});
//删除图片
$(".del-img").click(function(){
var img_id = $(this).data("id");
var img_src = $(this).data("src");
layer.open({
type:1,
title:'删除图片',
area:'300px;',
id:'delImg',//配置ID
content:'<div style="margin:10px;"><img src="'+ img_src +'" style="width:50px;height:50px;margin:10px;"/><span>删除此图片后,文档中添加的该图片将不再显示!</span></div>',
btn:['确定','取消'], //添加按钮
btnAlign:'c', //按钮居中
yes:function (index,layero) {
layer.load(1);
data = {
'img_id':img_id,
'types':0
}
$.post("{% url 'manage_image' %}",data,function(r){
layer.closeAll('loading')
if(r.status){
//删除成功
window.location.reload();
//layer.close(index)
}else{
//删除失败,提示
// console.log(r)
layer.msg(r.data)
}
})
},
})
});
//移动分组
$(".move-img").click(function(){
var img_id = $(this).data("id");
var img_src = $(this).data("src");
layer.open({
type:1,
title:'移动图片分组',
area:['300px','300px'],
id:'moveImg',//配置ID
content:$("#move-group-layer"),
btn:['确定','取消'], //添加按钮
btnAlign:'c', //按钮居中
yes:function (index,layero) {
layer.load(1);
data = {
'types':1,
'img_id':img_id,
'group_id':$("#group_id").val()
}
console.log(data)
$.post("{% url 'manage_image' %}",data,function(r){
layer.closeAll('loading')
if(r.status){
//移动成功
window.location.reload();
//layer.close(index)
}else{
//移动失败,提示
// console.log(r)
layer.msg(r.data)
}
})
},
success:function(){
form.render();
}
})
});
//查看图片
var options = {
//inline: true,
url: 'data-original',
fullscreen:false,//全屏
rotatable:false,//旋转
scalable:false,//翻转
//zoomable:false,//缩放
button:false,//关闭按钮
};
var viewer = new Viewer(document.getElementById('images'), options);
//创建图片分组
createImgGroup = function(){
layer.open({
type:1,
title:'新建图片分组',
area:'300px;',
id:'createImgGroup',//配置ID
content:'<div style="margin:10px;"><input type="text" id="img_group_name" class="layui-input" /></div>',
btn:['确定','取消'], //添加按钮
btnAlign:'c', //按钮居中
yes:function (index,layero) {
layer.load(1); //上传loading
data = {
'types':0,
'group_name':$("#img_group_name").val(),
}
$.post("{% url 'manage_img_group' %}",data,function(r){
layer.closeAll('loading');
if(r.status){
//新建成功
window.location.reload();
}else{
//新建失败,提示
// console.log(r)
layer.msg(r.data)
}
})
},
})
};
//上传图片
var upload = layui.upload;
upload.render({
elem: '#upload_img',
url: '{% url "upload_doc_img" %}',
data:{group_id:"{{g_id}}"},
before: function(obj){ //obj参数包含的信息,跟 choose回调完全一致,可参见上文。
layer.load(); //上传loading
},
done: function(res, index, upload){ //上传后的回调
layer.closeAll('loading'); //关闭loading
//上传成功,刷新页面
if(res.success == 1){
window.location.reload();
}else{
layer.msg("上传出错,请重试!")
}
},
error:function(){
layer.closeAll('loading'); //关闭loading
layer.msg("系统异常,请稍后再试!")
},
accept: 'images', //允许上传的文件类型
acceptMime:'image/*',
field:'manage_upload',
size: 5000, //最大允许上传的文件大小
})
</script>
<!--移动图片分组DIV块-->
<div style="margin:10px;display:none;" class="layui-form" id="move-group-layer">
<div class="layui-form-item">
<select id="group_id">
{% for group in groups %}
<option value="{{group.id}}">{{group.group_name}}</option>
{% endfor %}
</select>
</div>
</div>
{% endblock %} | {
"pile_set_name": "Github"
} |
id: greatsword
name: Greatsword
kind:
Weapon:
kind: LargeSword
icon: inventory/weapon_greatsword
weight: 600
value: 1000
equippable:
slot: HeldMain
blocks_slot: HeldOff
bonuses:
- kind:
defense: 7
attack:
damage:
min: 22
max: 30
ap: 3
kind: Slashing
kind: # Melee
reach: 1.5
sounds:
miss: sfx/swish_2
graze: sfx/thwack-03
hit: sfx/hit_3
crit: sfx/hit_2
bonuses: {}
image:
HeldMain:
creatures/greatsword
| {
"pile_set_name": "Github"
} |
<?php
namespace Drupal\Core\Extension;
/**
* Provides a list of installation profiles.
*
* @internal
* This class is not yet stable and therefore there are no guarantees that the
* internal implementations including constructor signature and protected
* properties / methods will not change over time. This will be reviewed after
* https://www.drupal.org/project/drupal/issues/2940481
*/
class ProfileExtensionList extends ExtensionList {
/**
* {@inheritdoc}
*/
protected $defaults = [
'dependencies' => [],
'install' => [],
'description' => '',
'package' => 'Other',
'version' => NULL,
'php' => DRUPAL_MINIMUM_PHP,
];
/**
* {@inheritdoc}
*/
protected function getInstalledExtensionNames() {
return [$this->installProfile];
}
}
| {
"pile_set_name": "Github"
} |
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <mitkImageReadAccessor.h>
#include "mitkPAInSilicoTissueVolume.h"
#include "mitkPAVector.h"
#include "mitkPAVessel.h"
class mitkPhotoacousticVesselTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkPhotoacousticVesselTestSuite);
MITK_TEST(testEmptyInitializationProperties);
MITK_TEST(testWalkInStraightLine);
MITK_TEST(testBifurcate);
CPPUNIT_TEST_SUITE_END();
private:
mitk::pa::Vessel::Pointer m_TestVessel;
mitk::pa::Vessel::CalculateNewVesselPositionCallback m_StraightLine;
mitk::pa::Vessel::CalculateNewVesselPositionCallback m_Diverging;
mitk::pa::InSilicoTissueVolume::Pointer m_TestInSilicoVolume;
mitk::pa::TissueGeneratorParameters::Pointer m_TestVolumeParameters;
public:
void setUp() override
{
auto params = mitk::pa::VesselProperties::New();
m_TestVessel = mitk::pa::Vessel::New(params);
m_StraightLine = &mitk::pa::VesselMeanderStrategy::CalculateNewDirectionVectorInStraightLine;
m_Diverging = &mitk::pa::VesselMeanderStrategy::CalculateNewRandomlyDivergingDirectionVector;
m_TestVolumeParameters = createTestVolumeParameters();
auto rng = std::mt19937();
m_TestInSilicoVolume = mitk::pa::InSilicoTissueVolume::New(m_TestVolumeParameters, &rng);
}
mitk::pa::TissueGeneratorParameters::Pointer createTestVolumeParameters()
{
auto returnParameters =
mitk::pa::TissueGeneratorParameters::New();
returnParameters->SetXDim(10);
returnParameters->SetYDim(10);
returnParameters->SetZDim(10);
returnParameters->SetMinBackgroundAbsorption(0);
returnParameters->SetMaxBackgroundAbsorption(0);
returnParameters->SetBackgroundScattering(0);
returnParameters->SetBackgroundAnisotropy(0);
return returnParameters;
}
void testEmptyInitializationProperties()
{
CPPUNIT_ASSERT(m_TestVessel->CanBifurcate() == false);
CPPUNIT_ASSERT(m_TestVessel->IsFinished() == true);
}
void testWalkInStraightLine()
{
auto testPosition = mitk::pa::Vector::New();
testPosition->SetElement(0, 0);
testPosition->SetElement(1, 4);
testPosition->SetElement(2, 4);
auto testDirection = mitk::pa::Vector::New();
testDirection->SetElement(0, 1);
testDirection->SetElement(1, 0);
testDirection->SetElement(2, 0);
auto params = mitk::pa::VesselProperties::New();
params->SetDoPartialVolume(false);
params->SetRadiusInVoxel(1);
params->SetBifurcationFrequency(100);
params->SetAbsorptionCoefficient(10);
params->SetScatteringCoefficient(10);
params->SetAnisotopyCoefficient(10);
params->SetPositionVector(testPosition);
params->SetDirectionVector(testDirection);
m_TestVessel = mitk::pa::Vessel::New(params);
CPPUNIT_ASSERT(m_TestVessel->CanBifurcate() == false);
CPPUNIT_ASSERT(m_TestVessel->IsFinished() == false);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4)) <= mitk::eps);
m_TestVessel->ExpandVessel(m_TestInSilicoVolume, m_StraightLine, 0, nullptr);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4) - 10) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 5, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 5, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 6, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 6, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 5)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 5)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 6)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 6)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(2, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(2, 4, 4)) <= mitk::eps);
m_TestVessel->ExpandVessel(m_TestInSilicoVolume, m_StraightLine, 0, nullptr);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4) - 10) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 5, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 5, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 6, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 6, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 5)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 5)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 6)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 6)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4) - 10) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(1, 4, 4) - 10) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(2, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(2, 4, 4)) <= mitk::eps);
CPPUNIT_ASSERT_MESSAGE(std::to_string(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(3, 4, 4)),
std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(3, 4, 4)) <= mitk::eps);
}
void testBifurcate()
{
auto testPosition = mitk::pa::Vector::New();
testPosition->SetElement(0, 0);
testPosition->SetElement(1, 4);
testPosition->SetElement(2, 4);
auto testDirection = mitk::pa::Vector::New();
testDirection->SetElement(0, 1);
testDirection->SetElement(1, 0);
testDirection->SetElement(2, 0);
auto params = mitk::pa::VesselProperties::New();
params->SetRadiusInVoxel(1);
params->SetBifurcationFrequency(1);
params->SetAbsorptionCoefficient(10);
params->SetScatteringCoefficient(10);
params->SetAnisotopyCoefficient(10);
params->SetPositionVector(testPosition);
params->SetDirectionVector(testDirection);
m_TestVessel = mitk::pa::Vessel::New(params);
CPPUNIT_ASSERT(m_TestVessel->CanBifurcate() == false);
CPPUNIT_ASSERT(m_TestVessel->IsFinished() == false);
CPPUNIT_ASSERT(std::abs(m_TestInSilicoVolume->GetAbsorptionVolume()->GetData(0, 4, 4)) <= mitk::eps);
m_TestVessel->ExpandVessel(m_TestInSilicoVolume, m_StraightLine, 0, nullptr);
m_TestVessel->ExpandVessel(m_TestInSilicoVolume, m_StraightLine, 0, nullptr);
CPPUNIT_ASSERT(m_TestVessel->CanBifurcate() == true);
std::mt19937 rng;
auto bifurcationVessel = m_TestVessel->Bifurcate(&rng);
CPPUNIT_ASSERT(m_TestVessel->CanBifurcate() == false);
CPPUNIT_ASSERT(bifurcationVessel->CanBifurcate() == false);
}
void tearDown() override
{
}
};
MITK_TEST_SUITE_REGISTRATION(mitkPhotoacousticVessel)
| {
"pile_set_name": "Github"
} |
{
"name": "Valsts asinsdonoru centrs",
"displayName": "Valsts asinsdonoru centrs",
"properties": [
"vadc.lv"
],
"prevalence": {
"tracking": 0,
"nonTracking": 0.00000735,
"total": 0.00000735
}
} | {
"pile_set_name": "Github"
} |
/*====================================================================*
- Copyright (C) 2001 Leptonica. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials
- provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*====================================================================*/
/*
* otsutest1.c
*/
#include <math.h>
#include "allheaders.h"
static const l_int32 NTests = 5;
static const l_int32 gaussmean1[5] = {20, 40, 60, 80, 60};
static const l_int32 gaussstdev1[5] = {10, 20, 20, 20, 30};
static const l_int32 gaussmean2[5] = {220, 200, 140, 180, 150};
static const l_int32 gaussstdev2[5] = {15, 20, 40, 20, 30};
static const l_float32 gaussfract1[5] = {0.2f, 0.3f, 0.1f, 0.5f, 0.3f};
static char buf[256];
static l_int32 GenerateSplitPlot(l_int32 i);
static NUMA *MakeGaussian(l_int32 mean, l_int32 stdev, l_float32 fract);
int main(int argc,
char **argv)
{
l_int32 i;
PIX *pix;
PIXA *pixa;
setLeptDebugOK(1);
lept_mkdir("lept/otsu");
for (i = 0; i < NTests; i++)
GenerateSplitPlot(i);
/* Read the results back in ... */
pixa = pixaCreate(0);
for (i = 0; i < NTests; i++) {
snprintf(buf, sizeof(buf), "/tmp/lept/otsu/plot.%d.png", i);
pix = pixRead(buf);
pixSaveTiled(pix, pixa, 1.0, 1, 25, 32);
pixDestroy(&pix);
snprintf(buf, sizeof(buf), "/tmp/lept/otsu/plots.%d.png", i);
pix = pixRead(buf);
pixSaveTiled(pix, pixa, 1.0, 0, 25, 32);
pixDestroy(&pix);
}
/* ... and save into a tiled pix */
pix = pixaDisplay(pixa, 0, 0);
pixWrite("/tmp/lept/otsu/plot.png", pix, IFF_PNG);
pixDisplay(pix, 100, 100);
pixaDestroy(&pixa);
pixDestroy(&pix);
return 0;
}
static l_int32
GenerateSplitPlot(l_int32 i)
{
char title[256];
l_int32 split;
l_float32 ave1, ave2, num1, num2, maxnum, maxscore;
GPLOT *gplot;
NUMA *na1, *na2, *nascore, *nax, *nay;
/* Generate a fake histogram composed of 2 gaussians */
na1 = MakeGaussian(gaussmean1[i], gaussstdev1[i], gaussfract1[i]);
na2 = MakeGaussian(gaussmean2[i], gaussstdev1[i], 1.0 - gaussfract1[i]);
numaArithOp(na1, na1, na2, L_ARITH_ADD);
/* Otsu splitting */
numaSplitDistribution(na1, 0.08, &split, &ave1, &ave2, &num1, &num2,
&nascore);
fprintf(stderr, "split = %d, ave1 = %6.1f, ave2 = %6.1f\n",
split, ave1, ave2);
fprintf(stderr, "num1 = %8.0f, num2 = %8.0f\n", num1, num2);
/* Prepare for plotting a vertical line at the split point */
nax = numaMakeConstant(split, 2);
numaGetMax(na1, &maxnum, NULL);
nay = numaMakeConstant(0, 2);
numaReplaceNumber(nay, 1, (l_int32)(0.5 * maxnum));
/* Plot the input histogram with the split location */
snprintf(buf, sizeof(buf), "/tmp/lept/otsu/plot.%d", i);
snprintf(title, sizeof(title), "Plot %d", i);
gplot = gplotCreate(buf, GPLOT_PNG,
"Histogram: mixture of 2 gaussians",
"Grayscale value", "Number of pixels");
gplotAddPlot(gplot, NULL, na1, GPLOT_LINES, title);
gplotAddPlot(gplot, nax, nay, GPLOT_LINES, NULL);
gplotMakeOutput(gplot);
gplotDestroy(&gplot);
numaDestroy(&na1);
numaDestroy(&na2);
/* Plot the score function */
snprintf(buf, sizeof(buf), "/tmp/lept/otsu/plots.%d", i);
snprintf(title, sizeof(title), "Plot %d", i);
gplot = gplotCreate(buf, GPLOT_PNG,
"Otsu score function for splitting",
"Grayscale value", "Score");
gplotAddPlot(gplot, NULL, nascore, GPLOT_LINES, title);
numaGetMax(nascore, &maxscore, NULL);
numaReplaceNumber(nay, 1, maxscore);
gplotAddPlot(gplot, nax, nay, GPLOT_LINES, NULL);
gplotMakeOutput(gplot);
gplotDestroy(&gplot);
numaDestroy(&nax);
numaDestroy(&nay);
numaDestroy(&nascore);
return 0;
}
static NUMA *
MakeGaussian(l_int32 mean, l_int32 stdev, l_float32 fract)
{
l_int32 i, total;
l_float32 norm, val;
NUMA *na;
na = numaMakeConstant(0.0, 256);
norm = fract / ((l_float32)stdev * sqrt(2 * 3.14159));
total = 0;
for (i = 0; i < 256; i++) {
val = norm * 1000000. * exp(-(l_float32)((i - mean) * (i - mean)) /
(l_float32)(2 * stdev * stdev));
total += (l_int32)val;
numaSetValue(na, i, val);
}
fprintf(stderr, "Total = %d\n", total);
return na;
}
| {
"pile_set_name": "Github"
} |
/**
* phantomjs script for printing presentations to PDF.
*
* Example:
* phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf
*
* By Manuel Bieh (https://github.com/manuelbieh)
*/
// html2pdf.js
var page = new WebPage();
var system = require( 'system' );
var slideWidth = system.args[3] ? system.args[3].split( 'x' )[0] : 960;
var slideHeight = system.args[3] ? system.args[3].split( 'x' )[1] : 700;
page.viewportSize = {
width: slideWidth,
height: slideHeight
};
// TODO
// Something is wrong with these config values. An input
// paper width of 1920px actually results in a 756px wide
// PDF.
page.paperSize = {
width: Math.round( slideWidth * 2 ),
height: Math.round( slideHeight * 2 ),
border: 0
};
var inputFile = system.args[1] || 'index.html?print-pdf';
var outputFile = system.args[2] || 'slides.pdf';
if( outputFile.match( /\.pdf$/gi ) === null ) {
outputFile += '.pdf';
}
console.log( 'Printing PDF (Paper size: '+ page.paperSize.width + 'x' + page.paperSize.height +')' );
page.open( inputFile, function( status ) {
window.setTimeout( function() {
console.log( 'Printed succesfully' );
page.render( outputFile );
phantom.exit();
}, 1000 );
} );
| {
"pile_set_name": "Github"
} |
/*
* Flash Compatible Streaming Format
* Copyright (c) 2000 Fabrice Bellard
* Copyright (c) 2003 Tinic Uro
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "internal.h"
const AVCodecTag ff_swf_codec_tags[] = {
{ AV_CODEC_ID_FLV1, 0x02 },
{ AV_CODEC_ID_VP6F, 0x04 },
{ AV_CODEC_ID_NONE, 0 },
};
| {
"pile_set_name": "Github"
} |
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
const createLintingRule = () => ({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
include: [resolve('src'), resolve('test')],
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
})
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'~': resolve('src/components'),
}
},
module: {
rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.svg$/,
loader: 'svg-sprite-loader',
include: [resolve('src/icons')],
options: {
symbolId: 'icon-[name]'
}
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
exclude: [resolve('src/icons')],
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
| {
"pile_set_name": "Github"
} |
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2020 Mozilla Foundation
*
* 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.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ViewHistory = void 0;
const DEFAULT_VIEW_HISTORY_CACHE_SIZE = 20;
class ViewHistory {
constructor(fingerprint, cacheSize = DEFAULT_VIEW_HISTORY_CACHE_SIZE) {
this.fingerprint = fingerprint;
this.cacheSize = cacheSize;
this._initializedPromise = this._readFromStorage().then(databaseStr => {
const database = JSON.parse(databaseStr || "{}");
let index = -1;
if (!Array.isArray(database.files)) {
database.files = [];
} else {
while (database.files.length >= this.cacheSize) {
database.files.shift();
}
for (let i = 0, ii = database.files.length; i < ii; i++) {
const branch = database.files[i];
if (branch.fingerprint === this.fingerprint) {
index = i;
break;
}
}
}
if (index === -1) {
index = database.files.push({
fingerprint: this.fingerprint
}) - 1;
}
this.file = database.files[index];
this.database = database;
});
}
async _writeToStorage() {
const databaseStr = JSON.stringify(this.database);
localStorage.setItem("pdfjs.history", databaseStr);
}
async _readFromStorage() {
return localStorage.getItem("pdfjs.history");
}
async set(name, val) {
await this._initializedPromise;
this.file[name] = val;
return this._writeToStorage();
}
async setMultiple(properties) {
await this._initializedPromise;
for (const name in properties) {
this.file[name] = properties[name];
}
return this._writeToStorage();
}
async get(name, defaultValue) {
await this._initializedPromise;
const val = this.file[name];
return val !== undefined ? val : defaultValue;
}
async getMultiple(properties) {
await this._initializedPromise;
const values = Object.create(null);
for (const name in properties) {
const val = this.file[name];
values[name] = val !== undefined ? val : properties[name];
}
return values;
}
}
exports.ViewHistory = ViewHistory; | {
"pile_set_name": "Github"
} |
define(["require", "exports", 'Application', 'Services/Account', 'Services/Member', 'Services/Service'], function (require, exports, app, account, member, services) {
requirejs(['css!content/User/Index']);
return function (page) {
/// <param name="page" type="chitu.Page"/>
var model = {
groups: [],
showItemPage: function (item) {
if (item.url == 'User_Logout') {
return app.redirect('Home_Index');
}
return app.redirect(item.url);
},
member: {
Score: ko.observable(),
Level: ko.observable(),
UserName: ko.observable(),
Banlance: ko.observable(0)
},
notPaidCount: account.orderInfo.notPaidCount,
toReceiveCount: account.orderInfo.toReceiveCount,
evaluateCount: account.orderInfo.evaluateCount,
username: ko.observable(),
balance: ko.observable(),
headImageUrl: member.currentUserInfo.HeadImageUrl,
nickName: member.currentUserInfo.NickName,
};
var score_menu_item = { name: '我的积分', url: '#User_ScoreList', value: ko.observable() };
var i = 0;
model.groups[i++] = [
{ name: '收货地址', url: '#User_ReceiptList', value: ko.observable() },
{ name: '我的收藏', url: '#User_Favors', value: ko.observable() },
score_menu_item,
{ name: '我的优惠券', url: '#User_Coupon', value: ko.observable() },
];
model.groups[i++] = [
{ name: '账户安全', url: '#User_AccountSecurity_Index', value: '' },
];
if (!services['weixin']) {
model.groups[model.groups.length - 1].push({ name: '退出', url: '#User_Index_Logout', value: ko.observable() });
}
page.load.add(function (sender, args) {
if ((args.type || '') == 'Logout') {
member.logout();
app.redirect('Home_Index');
return;
}
var result = account.userInfo().done(function (result) {
model.notPaidCount(result.NotPaidCount);
model.toReceiveCount(result.SendCount);
model.evaluateCount(result.ToEvaluateCount);
model.username(result.UserName);
model.balance(result.Balance);
score_menu_item.value(result.Score);
});
return result;
});
page.viewChanged.add(function () { return ko.applyBindings(model, page.element); });
};
});
| {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/Espresso.framework/Espresso
*/
@interface EspressoDCNEspressoOverfeatDetector : NSObject {
double _confidenceThreshold;
EspressoFDOverfeatNetwork * _enet;
double _minBoundingBoxThreshold;
struct FaceList { struct list<vision::DCN::boundingbox, std::__1::allocator<vision::DCN::boundingbox> > { struct __list_node_base<vision::DCN::boundingbox, void *> { struct __list_node_base<vision::DCN::boundingbox, void *> {} *x_1_2_1; struct __list_node_base<vision::DCN::boundingbox, void *> {} *x_1_2_2; } x_1_1_1; struct __compressed_pair<unsigned long, std::__1::allocator<std::__1::__list_node<vision::DCN::boundingbox, void *> > > { unsigned long long x_2_2_1; } x_1_1_2; } x1; } * face_list;
int localFaceMerging;
int tileDimension;
int tileSizeScaleFactor;
}
@property (nonatomic) double confidenceThreshold;
@property (nonatomic, retain) EspressoFDOverfeatNetwork *enet;
@property (nonatomic) double minBoundingBoxThreshold;
- (void).cxx_destruct;
- (void)commonInit;
- (double)compareObject:(id)arg1 withObject:(id)arg2 error:(id*)arg3;
- (void)computeBBoxUsingProb:(struct shared_ptr<Espresso::blob<float, 3> > { struct blob<float, 3> {} *x1; struct __shared_weak_count {} *x2; })arg1 box:(struct shared_ptr<Espresso::blob<float, 3> > { struct blob<float, 3> {} *x1; struct __shared_weak_count {} *x2; })arg2 andScalefactor:(float)arg3 padX:(float)arg4 padY:(float)arg5;
- (double)confidenceThreshold;
- (void)dealloc;
- (id)enet;
- (void)fillFaceList;
- (id)getDescription;
- (id)getFacesFromNetworkResultOriginalWidth:(float)arg1 originalHeight:(float)arg2;
- (id)init;
- (id)initWithNetwork:(id)arg1;
- (id)initWithOptions:(id)arg1;
- (void)mergeFaceList;
- (double)minBoundingBoxThreshold;
- (void)setConfidenceThreshold:(double)arg1;
- (void)setEnet:(id)arg1;
- (void)setMinBoundingBoxThreshold:(double)arg1;
@end
| {
"pile_set_name": "Github"
} |
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "go_default_library",
srcs = [
"create.go",
"create_clusterrole.go",
"create_clusterrolebinding.go",
"create_configmap.go",
"create_deployment.go",
"create_job.go",
"create_namespace.go",
"create_pdb.go",
"create_priorityclass.go",
"create_quota.go",
"create_role.go",
"create_rolebinding.go",
"create_secret.go",
"create_service.go",
"create_serviceaccount.go",
],
importpath = "k8s.io/kubernetes/pkg/kubectl/cmd/create",
visibility = ["//build/visible_to:pkg_kubectl_cmd_create_CONSUMERS"],
deps = [
"//pkg/kubectl:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubectl/cmd/util/editor:go_default_library",
"//pkg/kubectl/generate:go_default_library",
"//pkg/kubectl/generate/versioned:go_default_library",
"//pkg/kubectl/scheme:go_default_library",
"//pkg/kubectl/util/i18n:go_default_library",
"//pkg/kubectl/util/templates:go_default_library",
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/flag:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions/printers:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions/resource:go_default_library",
"//staging/src/k8s.io/client-go/dynamic:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/batch/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/rbac/v1:go_default_library",
"//vendor/github.com/spf13/cobra:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
],
)
go_test(
name = "go_default_test",
srcs = [
"create_clusterrole_test.go",
"create_clusterrolebinding_test.go",
"create_configmap_test.go",
"create_deployment_test.go",
"create_job_test.go",
"create_namespace_test.go",
"create_pdb_test.go",
"create_priorityclass_test.go",
"create_quota_test.go",
"create_role_test.go",
"create_rolebinding_test.go",
"create_secret_test.go",
"create_service_test.go",
"create_serviceaccount_test.go",
"create_test.go",
],
data = [
"//test/e2e/testing-manifests:all-srcs",
],
embed = [":go_default_library"],
deps = [
"//pkg/kubectl/cmd/testing:go_default_library",
"//pkg/kubectl/generate/versioned:go_default_library",
"//pkg/kubectl/scheme:go_default_library",
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions:go_default_library",
"//staging/src/k8s.io/cli-runtime/pkg/genericclioptions/resource:go_default_library",
"//staging/src/k8s.io/client-go/rest:go_default_library",
"//staging/src/k8s.io/client-go/rest/fake:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2018-2020 Garden Technologies, Inc. <info@garden.io>
*
* 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/.
*/
import chalk from "chalk"
import { terraform } from "./cli"
import { TerraformProvider } from "./terraform"
import { ConfigurationError, ParameterError } from "../../exceptions"
import { prepareVariables, tfValidate } from "./common"
import { GardenModule } from "../../types/module"
import { findByName } from "../../util/util"
import { TerraformModule } from "./module"
import { PluginCommand, PluginCommandParams } from "../../types/plugin/command"
import { join } from "path"
import { remove } from "fs-extra"
import { getProviderStatusCachePath } from "../../tasks/resolve-provider"
const commandsToWrap = ["apply", "plan", "destroy"]
const initCommand = chalk.bold("terraform init")
export const terraformCommands: PluginCommand[] = commandsToWrap.flatMap((commandName) => [
makeRootCommand(commandName),
makeModuleCommand(commandName),
])
function makeRootCommand(commandName: string) {
const terraformCommand = chalk.bold("terraform " + commandName)
return {
name: commandName + "-root",
description: `Runs ${terraformCommand} for the provider root stack, with the provider variables automatically configured as inputs. Positional arguments are passed to the command. If necessary, ${initCommand} is run first.`,
title: chalk.bold.magenta(`Running ${chalk.white.bold(terraformCommand)} for project root stack`),
async handler({ ctx, args, log }: PluginCommandParams) {
const provider = ctx.provider as TerraformProvider
if (!provider.config.initRoot) {
throw new ConfigurationError(`terraform provider does not have an ${chalk.underline("initRoot")} configured`, {
config: provider.config,
})
}
// Clear the provider status cache, to avoid any user confusion
const cachePath = getProviderStatusCachePath({
gardenDirPath: ctx.gardenDirPath,
pluginName: provider.name,
environmentName: ctx.environmentName,
})
await remove(cachePath)
const root = join(ctx.projectRoot, provider.config.initRoot)
await tfValidate({ log, ctx, provider, root })
args = [commandName, ...(await prepareVariables(root, provider.config.variables)), ...args]
await terraform(ctx, provider).spawnAndWait({
log,
args,
cwd: root,
rawMode: false,
tty: true,
timeoutSec: 999999,
})
return { result: {} }
},
}
}
function makeModuleCommand(commandName: string) {
const terraformCommand = chalk.bold("terraform " + commandName)
return {
name: commandName + "-module",
description: `Runs ${terraformCommand} for the specified module, with the module variables automatically configured as inputs. Use the module name as first argument, followed by any arguments you want to pass to the command. If necessary, ${initCommand} is run first.`,
resolveModules: true,
title: ({ args }) =>
chalk.bold.magenta(`Running ${chalk.white.bold(terraformCommand)} for module ${chalk.white.bold(args[0] || "")}`),
async handler({ ctx, args, log, modules }) {
const module = findModule(modules, args[0])
const root = join(module.path, module.spec.root)
const provider = ctx.provider as TerraformProvider
await tfValidate({ log, ctx, provider, root })
args = [commandName, ...(await prepareVariables(root, module.spec.variables)), ...args.slice(1)]
await terraform(ctx, provider).spawnAndWait({
log,
args,
cwd: root,
rawMode: false,
tty: true,
timeoutSec: 999999,
})
return { result: {} }
},
}
}
function findModule(modules: GardenModule[], name: string): TerraformModule {
if (!name) {
throw new ParameterError(`The first command argument must be a module name.`, { name })
}
const module = findByName(modules, name)
if (!module) {
throw new ParameterError(chalk.red(`Could not find module ${chalk.white(name)}.`), {})
}
if (!module.compatibleTypes.includes("terraform")) {
throw new ParameterError(chalk.red(`Module ${chalk.white(name)} is not a terraform module.`), {
name,
type: module.type,
compatibleTypes: module.compatibleTypes,
})
}
return module
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>IGListMoveIndex Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/objc/Class/IGListMoveIndex" class="dashAnchor"></a>
<a title="IGListMoveIndex Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">IGListKit Docs</a> (98% documented)</p>
<p class="header-right"><a href="https://github.com/Instagram/IGListKit"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">IGListKit Reference</a>
<img id="carat" src="../img/carat.png" />
IGListMoveIndex Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Guides.html">Guides</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../best-practices-and-faq.html">Best Practices and FAQ</a>
</li>
<li class="nav-group-task">
<a href="../getting-started.html">Getting Started</a>
</li>
<li class="nav-group-task">
<a href="../iglistdiffable-and-equality.html">IGListDiffable and Equality</a>
</li>
<li class="nav-group-task">
<a href="../installation.html">Installation</a>
</li>
<li class="nav-group-task">
<a href="../migration.html">Migration</a>
</li>
<li class="nav-group-task">
<a href="../modeling-and-binding.html">Modeling and Binding</a>
</li>
<li class="nav-group-task">
<a href="../vision.html">VISION</a>
</li>
<li class="nav-group-task">
<a href="../working-with-core-data.html">Working with Core Data</a>
</li>
<li class="nav-group-task">
<a href="../working-with-uicollectionview.html">Working with UICollectionView</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/IGListAdapter.html">IGListAdapter</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListAdapterUpdater.html">IGListAdapterUpdater</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListBatchUpdateData.html">IGListBatchUpdateData</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListBindingSectionController.html">IGListBindingSectionController</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListCollectionViewLayout.html">IGListCollectionViewLayout</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListGenericSectionController.html">IGListGenericSectionController</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListIndexPathResult.html">IGListIndexPathResult</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListIndexSetResult.html">IGListIndexSetResult</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListMoveIndex.html">IGListMoveIndex</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListMoveIndexPath.html">IGListMoveIndexPath</a>
</li>
<li class="nav-group-task">
<a href="../Classes.html#/c:objc(cs)IGListReloadDataUpdater">IGListReloadDataUpdater</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListSectionController.html">IGListSectionController</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListSingleSectionController.html">IGListSingleSectionController</a>
</li>
<li class="nav-group-task">
<a href="../Classes/IGListStackedSectionController.html">IGListStackedSectionController</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Constants.html">Constants</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Constants.html#/c:@IGListKitVersionNumber">IGListKitVersionNumber</a>
</li>
<li class="nav-group-task">
<a href="../Constants.html#/c:@IGListKitVersionString">IGListKitVersionString</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enums</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/IGListDiffOption.html">IGListDiffOption</a>
</li>
<li class="nav-group-task">
<a href="../Enums/IGListExperiment.html">IGListExperiment</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/IGListAdapterDataSource.html">IGListAdapterDataSource</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListAdapterDelegate.html">IGListAdapterDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListAdapterUpdaterDelegate.html">IGListAdapterUpdaterDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListBatchContext.html">IGListBatchContext</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListBindable.html">IGListBindable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListBindingSectionControllerDataSource.html">IGListBindingSectionControllerDataSource</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListBindingSectionControllerSelectionDelegate.html">IGListBindingSectionControllerSelectionDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListCollectionContext.html">IGListCollectionContext</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListDiffable.html">IGListDiffable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListDisplayDelegate.html">IGListDisplayDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListScrollDelegate.html">IGListScrollDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListSingleSectionControllerDelegate.html">IGListSingleSectionControllerDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListSupplementaryViewSource.html">IGListSupplementaryViewSource</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListUpdatingDelegate.html">IGListUpdatingDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/IGListWorkingRangeDelegate.html">IGListWorkingRangeDelegate</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Type Definitions.html">Type Definitions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListUpdatingDelegate.h@T@IGListItemUpdateBlock">IGListItemUpdateBlock</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListUpdatingDelegate.h@T@IGListObjectTransitionBlock">IGListObjectTransitionBlock</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListUpdatingDelegate.h@T@IGListReloadUpdateBlock">IGListReloadUpdateBlock</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListSingleSectionController.h@T@IGListSingleSectionCellConfigureBlock">IGListSingleSectionCellConfigureBlock</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListSingleSectionController.h@T@IGListSingleSectionCellSizeBlock">IGListSingleSectionCellSizeBlock</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListAdapter.h@T@IGListUpdaterCompletion">IGListUpdaterCompletion</a>
</li>
<li class="nav-group-task">
<a href="../Type Definitions.html#/c:IGListUpdatingDelegate.h@T@IGListUpdatingCompletion">IGListUpdatingCompletion</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Functions.html">Functions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Functions.html#/c:@F@IGListDiff">IGListDiff</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/c:@F@IGListDiffExperiment">IGListDiffExperiment</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/c:@F@IGListDiffPaths">IGListDiffPaths</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/c:@F@IGListDiffPathsExperiment">IGListDiffPathsExperiment</a>
</li>
<li class="nav-group-task">
<a href="../Functions.html#/c:IGListExperiments.h@F@IGListExperimentEnabled">IGListExperimentEnabled</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>IGListMoveIndex</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code>
<span class="k">@interface</span> <span class="nc">IGListMoveIndex</span> <span class="p">:</span> <span class="nc">NSObject</span></code></pre>
</div>
</div>
<p>An object representing a move between indexes.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)IGListMoveIndex(py)from"></a>
<a name="//apple_ref/objc/Property/from" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)IGListMoveIndex(py)from">from</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>An index in the old collection.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">assign</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">NSInteger</span> <span class="n">from</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">from</span><span class="p">:</span> <span class="kt">Int</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:objc(cs)IGListMoveIndex(py)to"></a>
<a name="//apple_ref/objc/Property/to" class="dashAnchor"></a>
<a class="token" href="#/c:objc(cs)IGListMoveIndex(py)to">to</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>An index in the new collection.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Objective-C</p>
<pre class="highlight"><code><span class="k">@property</span> <span class="p">(</span><span class="n">readonly</span><span class="p">,</span> <span class="n">assign</span><span class="p">,</span> <span class="n">nonatomic</span><span class="p">)</span> <span class="n">NSInteger</span> <span class="n">to</span><span class="p">;</span></code></pre>
</div>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">var</span> <span class="nv">to</span><span class="p">:</span> <span class="kt">Int</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2017 <a class="link" href="https://twitter.com/fbOpenSource" target="_blank" rel="external">Instagram</a>. All rights reserved. (Last updated: 2017-08-31)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.3</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| {
"pile_set_name": "Github"
} |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
import os
from sys import platform, maxsize
import platform as platform_lib
LINUX = platform.startswith("linux")
OPENBSD = platform.startswith("openbsd")
FREEBSD = "freebsd" in platform
NETBSD = platform.startswith("netbsd")
DARWIN = platform.startswith("darwin")
SOLARIS = platform.startswith("sunos")
WINDOWS = platform.startswith("win32")
WINDOWS_XP = platform_lib.release() == "XP"
BSD = DARWIN or FREEBSD or OPENBSD or NETBSD
# See https://docs.python.org/3/library/platform.html#cross-platform
IS_64BITS = maxsize > 2**32
if WINDOWS:
try:
if float(platform_lib.release()) >= 8.1:
LOOPBACK_NAME = "Microsoft KM-TEST Loopback Adapter"
else:
LOOPBACK_NAME = "Microsoft Loopback Adapter"
except ValueError:
LOOPBACK_NAME = "Microsoft Loopback Adapter"
# Will be different on Windows
LOOPBACK_INTERFACE = None
else:
uname = os.uname()
LOOPBACK_NAME = "lo" if LINUX else "lo0"
LOOPBACK_INTERFACE = LOOPBACK_NAME
| {
"pile_set_name": "Github"
} |
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------
namespace think\console\input;
class Definition
{
/**
* @var Argument[]
*/
private $arguments;
private $requiredCount;
private $hasAnArrayArgument = false;
private $hasOptional;
/**
* @var Option[]
*/
private $options;
private $shortcuts;
/**
* 构造方法
* @param array $definition
* @api
*/
public function __construct(array $definition = [])
{
$this->setDefinition($definition);
}
/**
* 设置指令的定义
* @param array $definition 定义的数组
*/
public function setDefinition(array $definition)
{
$arguments = [];
$options = [];
foreach ($definition as $item) {
if ($item instanceof Option) {
$options[] = $item;
} else {
$arguments[] = $item;
}
}
$this->setArguments($arguments);
$this->setOptions($options);
}
/**
* 设置参数
* @param Argument[] $arguments 参数数组
*/
public function setArguments($arguments = [])
{
$this->arguments = [];
$this->requiredCount = 0;
$this->hasOptional = false;
$this->hasAnArrayArgument = false;
$this->addArguments($arguments);
}
/**
* 添加参数
* @param Argument[] $arguments 参数数组
* @api
*/
public function addArguments($arguments = [])
{
if (null !== $arguments) {
foreach ($arguments as $argument) {
$this->addArgument($argument);
}
}
}
/**
* 添加一个参数
* @param Argument $argument 参数
* @throws \LogicException
*/
public function addArgument(Argument $argument)
{
if (isset($this->arguments[$argument->getName()])) {
throw new \LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
}
if ($this->hasAnArrayArgument) {
throw new \LogicException('Cannot add an argument after an array argument.');
}
if ($argument->isRequired() && $this->hasOptional) {
throw new \LogicException('Cannot add a required argument after an optional one.');
}
if ($argument->isArray()) {
$this->hasAnArrayArgument = true;
}
if ($argument->isRequired()) {
++$this->requiredCount;
} else {
$this->hasOptional = true;
}
$this->arguments[$argument->getName()] = $argument;
}
/**
* 根据名称或者位置获取参数
* @param string|int $name 参数名或者位置
* @return Argument 参数
* @throws \InvalidArgumentException
*/
public function getArgument($name)
{
if (!$this->hasArgument($name)) {
throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
}
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
return $arguments[$name];
}
/**
* 根据名称或位置检查是否具有某个参数
* @param string|int $name 参数名或者位置
* @return bool
* @api
*/
public function hasArgument($name)
{
$arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
return isset($arguments[$name]);
}
/**
* 获取所有的参数
* @return Argument[] 参数数组
*/
public function getArguments()
{
return $this->arguments;
}
/**
* 获取参数数量
* @return int
*/
public function getArgumentCount()
{
return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments);
}
/**
* 获取必填的参数的数量
* @return int
*/
public function getArgumentRequiredCount()
{
return $this->requiredCount;
}
/**
* 获取参数默认值
* @return array
*/
public function getArgumentDefaults()
{
$values = [];
foreach ($this->arguments as $argument) {
$values[$argument->getName()] = $argument->getDefault();
}
return $values;
}
/**
* 设置选项
* @param Option[] $options 选项数组
*/
public function setOptions($options = [])
{
$this->options = [];
$this->shortcuts = [];
$this->addOptions($options);
}
/**
* 添加选项
* @param Option[] $options 选项数组
* @api
*/
public function addOptions($options = [])
{
foreach ($options as $option) {
$this->addOption($option);
}
}
/**
* 添加一个选项
* @param Option $option 选项
* @throws \LogicException
* @api
*/
public function addOption(Option $option)
{
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new \LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
}
if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
if (isset($this->shortcuts[$shortcut])
&& !$option->equals($this->options[$this->shortcuts[$shortcut]])
) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
}
}
}
$this->options[$option->getName()] = $option;
if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
$this->shortcuts[$shortcut] = $option->getName();
}
}
}
/**
* 根据名称获取选项
* @param string $name 选项名
* @return Option
* @throws \InvalidArgumentException
* @api
*/
public function getOption($name)
{
if (!$this->hasOption($name)) {
throw new \InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
}
return $this->options[$name];
}
/**
* 根据名称检查是否有这个选项
* @param string $name 选项名
* @return bool
* @api
*/
public function hasOption($name)
{
return isset($this->options[$name]);
}
/**
* 获取所有选项
* @return Option[]
* @api
*/
public function getOptions()
{
return $this->options;
}
/**
* 根据名称检查某个选项是否有短名称
* @param string $name 短名称
* @return bool
*/
public function hasShortcut($name)
{
return isset($this->shortcuts[$name]);
}
/**
* 根据短名称获取选项
* @param string $shortcut 短名称
* @return Option
*/
public function getOptionForShortcut($shortcut)
{
return $this->getOption($this->shortcutToName($shortcut));
}
/**
* 获取所有选项的默认值
* @return array
*/
public function getOptionDefaults()
{
$values = [];
foreach ($this->options as $option) {
$values[$option->getName()] = $option->getDefault();
}
return $values;
}
/**
* 根据短名称获取选项名
* @param string $shortcut 短名称
* @return string
* @throws \InvalidArgumentException
*/
private function shortcutToName($shortcut)
{
if (!isset($this->shortcuts[$shortcut])) {
throw new \InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
}
return $this->shortcuts[$shortcut];
}
/**
* 获取该指令的介绍
* @param bool $short 是否简洁介绍
* @return string
*/
public function getSynopsis($short = false)
{
$elements = [];
if ($short && $this->getOptions()) {
$elements[] = '[options]';
} elseif (!$short) {
foreach ($this->getOptions() as $option) {
$value = '';
if ($option->acceptValue()) {
$value = sprintf(' %s%s%s', $option->isValueOptional() ? '[' : '', strtoupper($option->getName()), $option->isValueOptional() ? ']' : '');
}
$shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
$elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
}
}
if (count($elements) && $this->getArguments()) {
$elements[] = '[--]';
}
foreach ($this->getArguments() as $argument) {
$element = '<' . $argument->getName() . '>';
if (!$argument->isRequired()) {
$element = '[' . $element . ']';
} elseif ($argument->isArray()) {
$element .= ' (' . $element . ')';
}
if ($argument->isArray()) {
$element .= '...';
}
$elements[] = $element;
}
return implode(' ', $elements);
}
}
| {
"pile_set_name": "Github"
} |
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined( AFX_BRUSHCHECKDIALOG_H__4BF2C701_D9EF_11D4_ACF6_004095A18133__INCLUDED_ )
#define AFX_BRUSHCHECKDIALOG_H__4BF2C701_D9EF_11D4_ACF6_004095A18133__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// BrushCheckDialog.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CBrushCheckDialog dialog
class CBrushCheckDialog : public CDialog
{
// Construction
public:
CBrushCheckDialog( CWnd* pParent = NULL ); // standard constructor
// Dialog Data
//{{AFX_DATA(CBrushCheckDialog)
enum { IDD = IDD_BRUSHCHECKER_DIALOG };
CProgressCtrl m_prog1;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CBrushCheckDialog)
protected:
virtual void DoDataExchange( CDataExchange* pDX ); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CBrushCheckDialog)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_BRUSHCHECKDIALOG_H__4BF2C701_D9EF_11D4_ACF6_004095A18133__INCLUDED_)
| {
"pile_set_name": "Github"
} |
Pod::Spec.new do |s|
s.name = "Shopify"
s.author = "Shoutem"
s.version = "2.2.1"
s.summary = "Shopify extension by Shoutem."
s.homepage = "http://new.shoutem.com"
s.license = { :type => "BSD" }
s.source = { :git => "https://github.com/shoutem/extensions", :branch => "master" }
s.source_files = "Classes", "Classes/**/*.{h,m,swift}"
s.exclude_files = "Classes/Exclude"
s.dependency "Mobile-Buy-SDK"
def s.post_install(target)
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
config.build_settings['SWIFT_OBJC_BRIDGING_HEADER'] = 'Classes/Bridging-Header.h'
end
end
end
| {
"pile_set_name": "Github"
} |
package api
import (
"context"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models"
)
func getLogLevel(logType string) models.LogLevel {
if logType == "progress" {
return models.LogLevelProgress
} else if logType == "debug" {
return models.LogLevelDebug
} else if logType == "info" {
return models.LogLevelInfo
} else if logType == "warn" {
return models.LogLevelWarning
} else if logType == "error" {
return models.LogLevelError
}
// default to debug
return models.LogLevelDebug
}
func logEntriesFromLogItems(logItems []logger.LogItem) []*models.LogEntry {
ret := make([]*models.LogEntry, len(logItems))
for i, entry := range logItems {
ret[i] = &models.LogEntry{
Time: entry.Time,
Level: getLogLevel(entry.Type),
Message: entry.Message,
}
}
return ret
}
func (r *subscriptionResolver) LoggingSubscribe(ctx context.Context) (<-chan []*models.LogEntry, error) {
ret := make(chan []*models.LogEntry, 100)
stop := make(chan int, 1)
logSub := logger.SubscribeToLog(stop)
go func() {
for {
select {
case logEntries := <-logSub:
ret <- logEntriesFromLogItems(logEntries)
case <-ctx.Done():
stop <- 0
close(ret)
return
}
}
}()
return ret, nil
}
| {
"pile_set_name": "Github"
} |
(*
Copyright 2008-2018 Microsoft Research
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.
*)
module StringPrinter.Base
(* Ghost Specifications *)
module S = FStar.Seq
module U8 = FStar.UInt8
(* Prims.c_or is not supported by KreMLin, so let's use ours. *)
type c_or (p:Type) (q:Type) =
| Left : p -> c_or p q
| Right : q -> c_or p q
type string = S.seq U8.t
type m t = (unit -> GTot (t * string))
let ret (#t: Type0) (x: t) : Tot (m t) =
(fun () -> (x, Seq.empty))
let s_append (#a: Type) (s1 s2: S.seq a) : Tot (s: S.seq a { S.length s == S.length s1 + S.length s2 } ) =
S.append s1 s2
let bind (#t1 #t2: Type0) (x: m t1) (y: t1 -> Tot (m t2)) : Tot (m t2) =
(fun () ->
match x () with
(x1, accu1) ->
match y x1 () with
(x2, accu2) ->
(x2, s_append accu1 accu2))
let seq (#t2: Type0) (x: m unit) (y: m t2) : Tot (m t2) =
bind #unit #t2 x (fun () -> y)
let print_char (c: U8.t) : Tot (m unit) =
fun () -> ((), S.create 1 c)
let log (#t: Type0) (x: m t) : GTot string =
let (_, log) = x () in
log
(* Pure and Stateful Implementations *)
(* 1: compute the size *)
module U32 = FStar.UInt32
let m_sz_res_pred
#t (f: m t) (x: t) (r: U32.t) : GTot Type0 =
match f () with
(x', log) ->
x' == x /\
S.length log == U32.v r
let m_sz_correct
#t (f: m t) (t' : Type)
(g: (x: t) -> (r: U32.t) -> (u: unit { m_sz_res_pred f x r }) -> Tot t')
(g' : (u: unit { S.length (log f) > 4294967295 } ) -> Tot t')
(y: t')
: GTot Type0
= match f () with
| (r, log) ->
let l = S.length log in
if l > 4294967295
then y == g' ()
else y == g r (U32.uint_to_t l) ()
type m_sz #t (f: m t) = (
(t' : Type) ->
(g: ((x: t) -> (r: U32.t) -> (u: unit { m_sz_res_pred f x r } ) -> Tot t')) ->
(g' : ((u: unit { S.length (log f) > 4294967295 } ) -> Tot t')) ->
Tot (y: t' {
m_sz_correct f t' g g' y
}))
inline_for_extraction
let add_overflow (u v: U32.t) : Tot (y: option U32.t {
if U32.v u + U32.v v < 4294967296
then (
Some? y /\ (
let (Some sz) = y in
U32.v sz == U32.v u + U32.v v
))
else None? y
})
= if U32.lt (U32.sub 4294967295ul v) u
then None
else Some (U32.add u v)
inline_for_extraction
let ret_sz (#t: Type0) (x: t) : Tot (m_sz (ret x)) =
(fun _ g _ -> g x 0ul ())
let m_sz_res_pred_bind
(#t1 #t2: Type0)
(x: m t1)
(rx: t1)
(sx: U32.t)
(y: t1 -> Tot (m t2))
(ry: t2)
(sy: U32.t)
: Lemma
(requires (
m_sz_res_pred x rx sx /\
m_sz_res_pred (y rx) ry sy /\
U32.lt (U32.sub 4294967295ul sy) sx == false
))
(ensures (
U32.v sx + U32.v sy < 4294967296 /\
m_sz_res_pred (bind x y) ry (U32.add sx sy)
))
= let (rx', logx) = x () in
let (ry', logy) = y rx () in
()
inline_for_extraction
let bind_sz
(#t1 #t2: Type0)
(#x: m t1)
(x_sz: m_sz x)
(#y: t1 -> Tot (m t2))
(y_sz: (r: t1) -> Tot (m_sz (y r)))
: Tot (m_sz (bind x y))
= (fun t' g g' ->
[@@inline_let]
let gx (rx: t1) (sx: U32.t) (u: unit { m_sz_res_pred x rx sx } ) : Tot (res: t' { m_sz_correct (bind x y) t' g g' res } ) =
[@@inline_let]
let gy (ry: t2) (sy: U32.t) (u: unit { m_sz_res_pred (y rx) ry sy } ) : Tot (res: t' { m_sz_correct (bind x y) t' g g' res } ) =
[@@inline_let]
let su = U32.sub 4294967295ul sy in
[@@inline_let]
let c = U32.lt su sx in
[@@inline_let]
let res =
if c
then
[@@inline_let]
let _ = assert (
let (rx', logx) = x () in
let (ry', logy) = y rx () in
True
)
in
g' ()
else
[@@inline_let]
let r = U32.add sx sy in
[@@inline_let]
let _ = m_sz_res_pred_bind x rx sx y ry sy in
g ry r ()
in
[@@inline_let]
let _ = assert (m_sz_correct (bind x y) t' g g' res) in
res
in
[@@inline_let]
let res = y_sz rx t' gy g' in
[@@inline_let]
let _ = assert (
let (_, _) = x () in
let (_, _) = y rx () in
m_sz_correct (bind x y) t' g g' res
) in
res
in
[@@inline_let]
let res : t' = x_sz t' gx g' in
[@@inline_let]
let _ = assert (
let (rx, _) = x () in
let (_, _) = y rx () in
m_sz_correct (bind x y) t' g g' res
)
in
res
)
inline_for_extraction
let seq_sz
(t2: Type0)
(x: m unit)
(x_sz: m_sz x)
(y: m t2)
(y_sz: m_sz y)
: Tot (m_sz (seq x y))
= bind_sz x_sz (fun _ -> y_sz)
inline_for_extraction
let print_char_sz
(c: U8.t)
: Tot (m_sz (print_char c))
= fun _ g _ -> g () 1ul ()
let cond_eq (#t: Type) (lhs rhs: t) : Tot Type0 =
(u: unit { lhs == rhs } )
inline_for_extraction
let ifthenelse_sz
(t: Type0)
(c: bool)
(ft: (cond_eq true c -> Tot (m t)))
(ft_sz: ((u: cond_eq true c) -> m_sz (ft u)))
(ff: (cond_eq false c -> Tot (m t)))
(ff_sz: (u: cond_eq false c ) -> m_sz (ff u))
: Tot (m_sz (if c then ft () else ff ()))
= fun _ g g' ->
if c
then ft_sz () _ g g'
else ff_sz () _ g g'
inline_for_extraction
let destruct_pair_sz
(t1: Type0)
(t2: Type0)
(t: Type0)
(x: t1 * t2)
(f: ((x1: t1) -> (x2: t2) -> cond_eq x (x1, x2) -> Tot (m t)))
(f_sz: ((x1: t1) -> (x2: t2) -> cond_eq x (x1, x2) -> Tot (m_sz (f x1 x2 ()))))
: Tot (m_sz (let (x1, x2) = x in f x1 x2 ()))
= fun _ g ->
let (x1, x2) = x in
f_sz x1 x2 () _ g
inline_for_extraction
let log_size
(#t: Type0)
(#f: m t)
(f_sz: m_sz f)
: Pure (option U32.t)
(requires True)
(ensures (fun y ->
let sz = S.length (log f) in
if sz > 4294967295
then y == None
else (
Some? y /\ (
let (Some sz') = y in
U32.v sz' == sz
))))
= f_sz _ (fun _ r _ -> Some r) (fun _ -> None)
module T = FStar.Tactics
let tfail (#a: Type) (s: Prims.string) : T.Tac a =
T.debug ("Tactic failure: " ^ s);
T.fail s
let unfold_fv (t: T.fv) : T.Tac T.term =
let env = T.cur_env () in
let n = T.inspect_fv t in
match T.lookup_typ env n with
| Some s ->
begin match T.inspect_sigelt s with
| T.Sg_Let false _ _ _ def -> def
| _ -> tfail "Not a non-recursive let definition"
end
| _ -> tfail "Definition not found"
module L = FStar.List.Tot
let rec app_head_rev_tail (t: T.term) :
T.Tac (T.term * list T.argv)
=
let ins = T.inspect t in
if T.Tv_App? ins
then
let (T.Tv_App u v) = ins in
let (x, l) = app_head_rev_tail u in
(x, v :: l)
else
(t, [])
let app_head_tail (t: T.term) :
T.Tac (T.term * list T.argv)
= let (x, l) = app_head_rev_tail t in
(x, L.rev l)
// GM: This is cool!
let tassert (x: bool) : T.Tac (y: unit { x == true } ) =
if x then () else (
let y = quote x in
tfail ("Tactic assert failure: " ^ T.term_to_string y)
)
let tm_eq_fvar (t1 t2: T.term) : T.Tac bool =
match T.inspect t1, T.inspect t2 with
| T.Tv_FVar f1, T.Tv_FVar f2 ->
(T.inspect_fv f1 = T.inspect_fv f2)
| _ -> false
let ret_tm () : T.Tac T.term =
quote ret
let bind_tm () : T.Tac T.term =
quote bind
let seq_tm () : T.Tac T.term =
quote seq
let print_char_tm () : T.Tac T.term =
quote print_char
inline_for_extraction
let coerce_sz
(t: Type0)
(ft1: m t)
(ft1_sz: m_sz ft1)
(ft2: m t)
(u: cond_eq (ft1 ()) (ft2 ()))
: Tot (m_sz ft2)
= fun t' -> ft1_sz t'
let compile_ret
(ret_sz_tm: T.term)
(t: T.term)
: T.Tac T.term
= T.debug "compile_ret";
let (f, ar) = app_head_tail t in
let test = tm_eq_fvar f (ret_tm ()) in
tassert test;
let res = T.mk_app ret_sz_tm ar in
T.debug (T.term_to_string res);
res
let compile_bind
(bind_sz_tm: T.term)
(env: T.env)
(ty: T.term)
(t: T.term)
(compile: (env' : T.env) -> (ty' : T.term) -> (t' : T.term) -> T.Tac T.term)
: T.Tac T.term
= T.debug "compile_bind";
let (f, ar) = app_head_tail t in
let test = tm_eq_fvar f (bind_tm ()) in
tassert test;
match ar with
| [ (t1, _); (t2, _); (x, _); (y, _) ] ->
begin match T.inspect y with
| T.Tv_Abs v y' ->
let x_ = compile env t1 x in
let (v_, _) = T.inspect_binder v in
let v' = T.pack (T.Tv_Var v_) in
let env' = T.push_binder env v in
let y_ = compile env' t2 y' in
let res = T.mk_app bind_sz_tm [
(t1, T.Q_Implicit);
(t2, T.Q_Implicit);
(x, T.Q_Implicit);
(x_, T.Q_Explicit);
(y, T.Q_Implicit);
(T.pack (T.Tv_Abs v y_), T.Q_Explicit);
]
in
T.debug (T.term_to_string res);
res
| _ -> tfail ("compile: Not an abstraction: " ^ T.term_to_string y)
end
| _ -> tfail ("compile_bind: 4 arguments expected")
let compile_print_char
(print_char_sz_tm: T.term)
(t: T.term)
: T.Tac T.term
= T.debug "compile_print_char";
let (f, ar) = app_head_tail t in
let test = tm_eq_fvar f (print_char_tm ()) in
tassert test;
let res = T.mk_app print_char_sz_tm ar in
T.debug (T.term_to_string res);
res
let compile_fvar
(coerce_sz_tm: T.term)
(env: T.env)
(compile: (ty' : T.term) -> (t' : T.term) -> T.Tac T.term)
(ty: T.term)
(t: T.term)
: T.Tac T.term
= T.debug ("compile_fvar: " ^ T.term_to_string t);
let (f, ar) = app_head_tail t in
T.debug "after app_head_tail";
let ins = T.inspect f in
T.debug "after inspect";
let test = T.Tv_FVar? ins in
// GM: If we use a semicolon, the refinement is lost!!
// Another option is to just use `guard`, which has a WP instead
// of a refinement on the result, and thus works fine.
let _ = tassert test in
let (T.Tv_FVar v) = ins in
let v' = unfold_fv v in
let t' = T.mk_app v' ar in
// unfolding might have introduced a redex,
// so we find an opportunity to reduce it here
T.debug ("before norm_term: " ^ T.term_to_string t');
let t' = T.norm_term_env env [iota] t' in // beta implicit
T.debug "after norm_term";
let res' = compile ty t' in
let u = quote () in
let res = T.mk_app coerce_sz_tm [
ty, T.Q_Explicit;
t', T.Q_Explicit;
res', T.Q_Explicit;
t, T.Q_Explicit;
u, T.Q_Explicit;
]
in
res
let compile_ifthenelse
(ifthenelse_sz_tm: T.term)
(ty: T.term)
(t: T.term)
(compile: (ty' : T.term) -> (t' : T.term) -> T.Tac T.term)
: T.Tac T.term
= T.debug "compile_ifthenelse";
let (f, ar) = app_head_tail t in
let ins = T.inspect f in
match ins with
| T.Tv_Match cond [T.Pat_Constant T.C_True, tt; _, tf] ->
(* ifthenelse: the second branch can be a wildcard or false *)
let ct = quote (cond_eq true) in
let ut = T.mk_app ct [cond, T.Q_Explicit] in
let vt = T.fresh_binder_named "name1eman" ut in
let ft = T.pack (T.Tv_Abs vt tt) in
let ft_sz_body = compile ty tt in
let ft_sz = T.pack (T.Tv_Abs vt ft_sz_body) in
let cf = quote (cond_eq false) in
let uf = T.mk_app cf [cond, T.Q_Explicit] in
let vf = T.fresh_binder_named "name2eman" uf in
let ff = T.pack (T.Tv_Abs vf tf) in
let ff_sz_body = compile ty tf in
let ff_sz = T.pack (T.Tv_Abs vf ff_sz_body) in
T.mk_app ifthenelse_sz_tm [
ty, T.Q_Explicit;
cond, T.Q_Explicit;
ft, T.Q_Explicit;
ft_sz, T.Q_Explicit;
ff, T.Q_Explicit;
ff_sz, T.Q_Explicit;
]
| _ -> tfail "Not an ifthenelse"
let rec first (#t: Type) (l: list (unit -> T.Tac t)) : T.Tac t =
match l with
| [] -> tfail "All tactics failed"
| a :: q ->
T.or_else a (fun () -> T.debug "failed"; first q)
let rec compile
(
ret_sz_tm
bind_sz_tm
print_char_sz_tm
coerce_sz_tm
ifthenelse_sz_tm
: T.term)
(env: T.env)
(ty: T.term) (t: T.term)
: T.Tac T.term
= T.debug "BEGIN compile";
let compile' = compile ret_sz_tm bind_sz_tm print_char_sz_tm coerce_sz_tm ifthenelse_sz_tm in
let res = first [
(fun () -> compile_ret ret_sz_tm t);
(fun () -> compile_bind bind_sz_tm env ty t compile');
(fun () -> compile_print_char print_char_sz_tm t);
(fun () -> compile_fvar coerce_sz_tm env (compile' env) ty t);
(fun () -> compile_ifthenelse ifthenelse_sz_tm ty t (compile' env));
]
in
T.debug ("END compile, result: " ^ T.term_to_string res);
res
let mk_sz'
(env: T.env)
(ty: T.term) (t: T.term)
: T.Tac T.term
= compile
(quote ret_sz)
(quote bind_sz)
(quote print_char_sz)
(quote coerce_sz)
(quote ifthenelse_sz)
env
ty
t
let unfold_ (#t: Type) (x: t) : T.Tac T.term =
let open T in
let u = quote x in
match inspect u with
| Tv_FVar v -> unfold_fv v
| _ -> fail ("unfold_def: Not a free variable: " ^ term_to_string u)
let mk_sz (#ty: Type0) (m: m ty) : T.Tac unit =
let open T in
let x = quote m in
let ty' = quote ty in
let t = mk_sz' (T.cur_env ()) ty' x in
exact_guard t
module B = FStar.Buffer
module HST = FStar.HyperStack.ST
module HS = FStar.HyperStack
let m_st_post (#t: Type) (f: m t) (b: B.buffer U8.t) (h: HS.mem) (rb': t * B.buffer U8.t) (h': HS.mem) : GTot Type0 =
B.live h b /\
S.length (log f) <= B.length b /\ (
let (r, b') = rb' in
let (r', log) = f () in
let sz = U32.uint_to_t (S.length log) in
let bl = B.sub b 0ul sz in
r' == r /\
B.modifies_1 bl h h' /\
B.as_seq h' bl == log /\
b' == B.sub b sz (U32.uint_to_t (B.length b - S.length log))
)
type m_st #t (f: m t) =
(b: B.buffer U8.t) ->
HST.Stack (t * B.buffer U8.t)
(requires (fun h ->
B.live h b /\
S.length (log f) <= B.length b
))
(ensures (fun h rb' h' ->
m_st_post f b h rb' h'
))
inline_for_extraction
let ret_st (#t: Type0) (x: t) : Tot (m_st (ret x)) =
fun b -> (x, b)
module G = FStar.Ghost
#reset-options "--z3rlimit 32 --using_facts_from '* -FStar.Tactics -FStar.Reflection'"
inline_for_extraction
let bind_st
(#t1 #t2: Type0)
(#x: m t1)
(x_st: m_st x)
(#y: t1 -> Tot (m t2))
(y_st: (r: t1) -> Tot (m_st (y r)))
: Tot (m_st (bind x y))
= fun b ->
let h = HST.get () in
let (rx, br_x) = x_st b in
let hx = HST.get () in
let (ry, br) = y_st rx br_x in
let h' = HST.get () in
let len_bl : G.erased U32.t = G.hide (U32.uint_to_t (B.length b - B.length br)) in
let len_bl_x : G.erased U32.t = G.hide (U32.uint_to_t (B.length b - B.length br_x)) in
let bl : G.erased (B.buffer U8.t) = G.hide (B.sub b 0ul (G.reveal len_bl)) in
let bl_x : G.erased (B.buffer U8.t) = G.hide (B.sub b 0ul (G.reveal len_bl_x)) in
assert (B.modifies_1 (G.reveal bl_x) h hx);
assert (G.reveal bl_x == B.sub (G.reveal bl) 0ul (G.reveal len_bl_x));
assert (B.modifies_1 (G.reveal bl) h hx);
let len_bl_y : G.erased U32.t = G.hide (U32.uint_to_t (B.length br_x - B.length br)) in
let bl_y : G.erased (B.buffer U8.t) = G.hide (B.sub br_x 0ul (G.reveal len_bl_y)) in
assert (B.modifies_1 (G.reveal bl_y) hx h');
assert (G.reveal bl_y == B.sub (G.reveal bl) (G.reveal len_bl_x) (G.reveal len_bl_y));
assert (B.modifies_1 (G.reveal bl) hx h');
assert (B.as_seq h' (G.reveal bl_x) == log x);
assert (B.as_seq h' (G.reveal bl_y) == log (y (fst (x ()))));
assert (S.equal (B.as_seq h' (G.reveal bl)) (S.append (B.as_seq h' (G.reveal bl_x)) (B.as_seq h' (G.reveal bl_y))));
(ry, br)
#reset-options
inline_for_extraction
let seq_st
(t2: Type0)
(x: m unit)
(x_st: m_st x)
(y: m t2)
(y_st: m_st y)
: Tot (m_st (seq x y))
= bind_st x_st (fun _ -> y_st)
inline_for_extraction
let print_char_st (c: U8.t) : Tot (m_st (print_char c)) =
fun b ->
[@@inline_let]
let b0 = B.sub b 0ul 1ul in
B.upd b0 0ul c ;
let b' = B.offset b 1ul in
let h' = HST.get () in
assert (Seq.equal (B.as_seq h' b0) (Seq.create 1 c));
((), b')
inline_for_extraction
let ifthenelse_st
(t: Type0)
(c: bool)
(ft: (cond_eq true c -> Tot (m t)))
(ft_st: ((u: cond_eq true c) -> m_st (ft u)))
(ff: (cond_eq false c -> Tot (m t)))
(ff_st: (u: cond_eq false c ) -> m_st (ff u))
: Tot (m_st (if c then ft () else ff ()))
= fun b ->
if c
then ft_st () b
else ff_st () b
inline_for_extraction
let coerce_st
(t: Type0)
(ft1: m t)
(ft1_st: m_st ft1)
(ft2: m t)
(u: unit { ft1 () == ft2 () } )
: Tot (m_st ft2)
= fun b -> ft1_st b
let mk_st'
(env: T.env)
(ty: T.term) (t: T.term)
: T.Tac T.term
= compile
(quote ret_st)
(quote bind_st)
(quote print_char_st)
(quote coerce_st)
(quote ifthenelse_st)
env
ty
t
let mk_st (#ty: Type0) (m: m ty) : T.Tac unit =
let open T in
let x = quote m in
let ty' = quote ty in
let t = mk_st' (T.cur_env ()) ty' x in
exact_guard t
// unfold // FAILS if set
let buffer_is_mm (#t: Type) (b: B.buffer t) : GTot bool = HS.is_mm (B.content b)
let buffer_create_mm_post
(#t: Type)
(r: HS.rid)
(h h' : HS.mem)
(b: B.buffer t)
: GTot Type0
= b `B.unused_in` h /\
B.live h' b /\
B.idx b == 0 /\
Map.domain (HS.get_hmap h') == Map.domain (HS.get_hmap h) /\
(HS.get_tip h') == (HS.get_tip h) /\
HS.modifies (Set.singleton r) h h' /\
HS.modifies_ref r Set.empty h h' /\
buffer_is_mm b
let alloc_and_fill_in_post
(#t: Type0)
(x: m t)
(resb: t * B.buffer U8.t)
(h h' : HS.mem)
: GTot Type0
= let (res, b) = resb in
let (res', log) = x () in
res == res' /\
buffer_create_mm_post HS.root h h' b /\
log == B.as_seq h' b
inline_for_extraction
let alloc_and_fill_in
(#t: Type0)
(x: m t)
(x_sz: U32.t)
(x_st: m_st x)
: HST.ST (t * B.buffer U8.t)
(requires (fun _ ->
U32.v x_sz == S.length (log x)
))
(ensures (fun h resb h' ->
alloc_and_fill_in_post x resb h h'
))
= let b = B.rcreate_mm HS.root 42uy x_sz in
let h1 = HST.get () in
let (r, _) = x_st b in
let h2 = HST.get () in
B.lemma_reveal_modifies_1 b h1 h2;
(r, b)
let phi_post
(#t: Type0)
(x: m t)
(h: HS.mem)
(res: option (t * B.buffer U8.t))
(h' : HS.mem)
: GTot Type0
= if S.length (log x) > 4294967295
then (res == None /\ h' == h)
else (Some? res /\ (let (Some rb) = res in alloc_and_fill_in_post x rb h h'))
let phi_t (#t: Type0) (x: m t) : Type =
unit ->
HST.ST (option (t * B.buffer U8.t))
(requires (fun _ -> True))
(ensures (fun h res h' ->
phi_post x h res h'
))
unfold
let phi_t_internal
(#t: Type0)
(x: m t)
(h0: HS.mem)
: Tot Type
= (unit -> HST.ST (option (t * B.buffer U8.t)) (requires (fun h -> h == h0)) (ensures (fun _ res h' -> phi_post x h0 res h')))
(* FIXME: the following does not extract to KreMLin. This was an attempt to push the CPS-style down to the effectful code as well, but does not work.
inline_for_extraction
let phi
(#t: Type0)
(x: m t)
(x_sz: m_sz x)
(x_st: m_st x)
: Tot (phi_t x)
= fun () ->
let h0 = HST.get () in
x_sz
// (phi_t_internal x h0) // does not typecheck
(unit -> HST.ST (option (t * B.buffer U8.t)) (requires (fun h -> h == h0)) (ensures (fun _ res h' -> phi_post x h0 res h')))
(fun _ sz u () -> Some (alloc_and_fill_in x sz x_st))
(fun _ () -> None)
()
*)
inline_for_extraction
let phi
(#t: Type0)
(x: m t)
(x_sz: m_sz x)
(x_st: m_st x)
: Tot (phi_t x)
= fun () ->
match log_size x_sz with
| Some sz ->
Some (alloc_and_fill_in x sz x_st)
| None -> None
let phi_tac (#ty: Type0) (m: m ty) : T.Tac unit =
let open T in
let x = quote m in
let ty' = quote ty in
let t_sz = mk_sz' (T.cur_env ()) ty' x in
let t_st = mk_st' (T.cur_env ()) ty' x in
let q = quote phi in
let t = mk_app q [
ty', Q_Implicit;
x, Q_Explicit;
t_sz, Q_Explicit;
t_st, Q_Explicit;
]
in
exact_guard t
| {
"pile_set_name": "Github"
} |
// Copyright 2011-2012 Norbert Lindenberg. All rights reserved.
// Copyright 2012 Mozilla Corporation. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @description Tests that Intl.DateTimeFormat can be subclassed.
* @author Norbert Lindenberg
*/
$INCLUDE("testIntl.js");
// get a date-time format and have it format an array of dates for comparison with the subclass
var locales = ["tlh", "id", "en"];
var a = [new Date(0), Date.now(), new Date(Date.parse("1989-11-09T17:57:00Z"))];
var referenceDateTimeFormat = new Intl.DateTimeFormat(locales);
var referenceFormatted = a.map(referenceDateTimeFormat.format);
function MyDateTimeFormat(locales, options) {
Intl.DateTimeFormat.call(this, locales, options);
// could initialize MyDateTimeFormat properties
}
MyDateTimeFormat.prototype = Object.create(Intl.DateTimeFormat.prototype);
MyDateTimeFormat.prototype.constructor = MyDateTimeFormat;
// could add methods to MyDateTimeFormat.prototype
var format = new MyDateTimeFormat(locales);
var actual = a.map(format.format);
testArraysAreSame(referenceFormatted, actual);
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
namespace TencentCloud.Cpdp.V20190820.Models
{
using Newtonsoft.Json;
using System.Collections.Generic;
using TencentCloud.Common;
public class QueryMerchantBalanceData : AbstractModel
{
/// <summary>
/// 余额币种
/// </summary>
[JsonProperty("Currency")]
public string Currency{ get; set; }
/// <summary>
/// 账户余额
/// </summary>
[JsonProperty("Balance")]
public string Balance{ get; set; }
/// <summary>
/// 商户ID
/// </summary>
[JsonProperty("MerchantId")]
public string MerchantId{ get; set; }
/// <summary>
/// For internal usage only. DO NOT USE IT.
/// </summary>
internal override void ToMap(Dictionary<string, string> map, string prefix)
{
this.SetParamSimple(map, prefix + "Currency", this.Currency);
this.SetParamSimple(map, prefix + "Balance", this.Balance);
this.SetParamSimple(map, prefix + "MerchantId", this.MerchantId);
}
}
}
| {
"pile_set_name": "Github"
} |
list_of_objects = [
{
key1 = "value1"
key2 = "value2"
},
{
key3 = "value3"
key4 = "value4"
},
]
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="struct.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="DDE.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="main.cpp">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="x64.asm">
<Filter>源文件</Filter>
</CustomBuild>
</ItemGroup>
</Project> | {
"pile_set_name": "Github"
} |
/*
* intel_scu_ipc.c: Driver for the Intel SCU IPC mechanism
*
* (C) Copyright 2008-2010 Intel Corporation
* Author: Sreedhara DS (sreedhara.ds@intel.com)
*
* 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
* of the License.
*
* This driver provides ioctl interfaces to call intel scu ipc driver api
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/fcntl.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <asm/intel_scu_ipc.h>
static int major;
/* ioctl commnds */
#define INTE_SCU_IPC_REGISTER_READ 0
#define INTE_SCU_IPC_REGISTER_WRITE 1
#define INTE_SCU_IPC_REGISTER_UPDATE 2
struct scu_ipc_data {
u32 count; /* No. of registers */
u16 addr[5]; /* Register addresses */
u8 data[5]; /* Register data */
u8 mask; /* Valid for read-modify-write */
};
/**
* scu_reg_access - implement register access ioctls
* @cmd: command we are doing (read/write/update)
* @data: kernel copy of ioctl data
*
* Allow the user to perform register accesses on the SCU via the
* kernel interface
*/
static int scu_reg_access(u32 cmd, struct scu_ipc_data *data)
{
unsigned int count = data->count;
if (count == 0 || count == 3 || count > 4)
return -EINVAL;
switch (cmd) {
case INTE_SCU_IPC_REGISTER_READ:
return intel_scu_ipc_readv(data->addr, data->data, count);
case INTE_SCU_IPC_REGISTER_WRITE:
return intel_scu_ipc_writev(data->addr, data->data, count);
case INTE_SCU_IPC_REGISTER_UPDATE:
return intel_scu_ipc_update_register(data->addr[0],
data->data[0], data->mask);
default:
return -ENOTTY;
}
}
/**
* scu_ipc_ioctl - control ioctls for the SCU
* @fp: file handle of the SCU device
* @cmd: ioctl coce
* @arg: pointer to user passed structure
*
* Support the I/O and firmware flashing interfaces of the SCU
*/
static long scu_ipc_ioctl(struct file *fp, unsigned int cmd,
unsigned long arg)
{
int ret;
struct scu_ipc_data data;
void __user *argp = (void __user *)arg;
if (!capable(CAP_SYS_RAWIO))
return -EPERM;
if (copy_from_user(&data, argp, sizeof(struct scu_ipc_data)))
return -EFAULT;
ret = scu_reg_access(cmd, &data);
if (ret < 0)
return ret;
if (copy_to_user(argp, &data, sizeof(struct scu_ipc_data)))
return -EFAULT;
return 0;
}
static const struct file_operations scu_ipc_fops = {
.unlocked_ioctl = scu_ipc_ioctl,
};
static int __init ipc_module_init(void)
{
major = register_chrdev(0, "intel_mid_scu", &scu_ipc_fops);
if (major < 0)
return major;
return 0;
}
static void __exit ipc_module_exit(void)
{
unregister_chrdev(major, "intel_mid_scu");
}
module_init(ipc_module_init);
module_exit(ipc_module_exit);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("Utility driver for intel scu ipc");
MODULE_AUTHOR("Sreedhara <sreedhara.ds@intel.com>");
| {
"pile_set_name": "Github"
} |
/*
* @file
*
* @date Sep 7, 2012
* @author: Anton Bondarev
*/
#ifndef PCI_DRIVER_H_
#define PCI_DRIVER_H_
#include <stdint.h>
#include <framework/mod/api.h>
#include <framework/mod/self.h>
#include <util/array.h>
struct pci_slot_dev;
struct pci_id {
uint16_t ven_id;
uint16_t dev_id;
};
struct pci_driver {
const struct mod mod;
int (*init)(struct pci_slot_dev *pci_dev);
const char *name;
const struct pci_id *id_table;
unsigned int id_table_n;
};
#define PCI_DRIVER_TABLE(_drv_name, _init_func, _id_table) \
MOD_SELF_INIT_DECLS(__EMBUILD_MOD__); \
static int _init_func(struct pci_slot_dev *pci_dev); \
extern const struct mod_ops __pci_mod_ops; \
const struct pci_driver mod_self = { \
.mod = MOD_SELF_INIT(__EMBUILD_MOD__, &__pci_mod_ops), \
.init = _init_func, \
.name = "" _drv_name, \
.id_table = _id_table, \
.id_table_n = ARRAY_SIZE(_id_table), \
}
#define __PCI_DRIVER(_drv_name, _init_func, _id_table, _vid, _did) \
static const struct pci_id _id_table[] = { { _vid, _did } }; \
PCI_DRIVER_TABLE(_drv_name, _init_func, _id_table)
#define PCI_DRIVER(_drv_name, _init_func, _vid, _did) \
__PCI_DRIVER(_drv_name, _init_func, __EMBUILD_MOD__ ## __pci_id_table, _vid, _did)
#endif /* PCI_DRIVER_H_ */
| {
"pile_set_name": "Github"
} |
{
"animatedParts" : {
"stateTypes" : {
"body" : {
"priority" : 0,
"default" : "idle",
"states" : {
"idle" : {
"frames" : 1
},
"jump" : {
"frames" : 2,
"cycle" : 0.2
},
"fall" : {
"frames" : 2,
"cycle" : 0.2
},
"walk" : {
"frames" : 8,
"cycle" : 1.0,
"mode" : "loop"
},
"run" : {
"frames" : 8,
"cycle" : 0.6,
"mode" : "loop"
},
"charge" : {
"frames" : 7,
"cycle" : 0.7
},
"windup" : {
"frames" : 5,
"cycle" : 0.9
},
"fire" : {
"frames" : 1,
"cycle" : 1.2
}
}
},
"damage" : {
"priority" : 3,
"default" : "none",
"states" : {
"none" : {
"frames" : 1
},
"stunned" : {
"frames" : 1
}
}
},
"releaseParticles" : {
"default" : "off",
"states" : {
"off" : {
"frames" : 1,
"properties" : {
"particleEmittersOff" : [ "releaseParticles" ]
}
},
"on" : {
"frames" : 1,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "off",
"properties" : {
"particleEmittersOn" : [ "releaseParticles" ]
}
}
}
}
},
"parts" : {
"body" : {
"properties" : {
"transformationGroups" : [ "body" ],
"zLevel" : 2
},
"partStates" : {
"body" : {
"idle" : {
"properties" : {
"image" : "<partImage>:idle.<frame>"
}
},
"walk" : {
"properties" : {
"image" : "<partImage>:walk.<frame>"
}
},
"run" : {
"properties" : {
"image" : "<partImage>:walk.<frame>"
}
},
"jump" : {
"properties" : {
"image" : "<partImage>:jump.<frame>"
}
},
"fall" : {
"properties" : {
"image" : "<partImage>:fall.<frame>"
}
},
"charge" : {
"properties" : {
"image" : "<partImage>:melee.<frame>"
}
},
"windup" : {
"properties" : {
"image" : "<partImage>:ranged.<frame>"
}
},
"fire" : {
"properties" : {
"image" : "<partImage>:ranged.4"
}
}
},
"damage" : {
"stunned" : {
"properties" : {
"image" : "<partImage>:hurt.<frame>"
}
}
}
}
},
"head" : {
"properties" : {
"transformationGroups" : [ "body" ],
"zLevel" : 3
},
"partStates" : {
"body" : {
"idle" : {
"properties" : {
"image" : "<partImage>:idle.<frame>"
}
},
"walk" : {
"properties" : {
"image" : "<partImage>:walk.<frame>"
}
},
"run" : {
"properties" : {
"image" : "<partImage>:walk.<frame>"
}
},
"jump" : {
"properties" : {
"image" : "<partImage>:jump.<frame>"
}
},
"fall" : {
"properties" : {
"image" : "<partImage>:fall.<frame>"
}
},
"charge" : {
"properties" : {
"image" : "<partImage>:melee.<frame>"
}
},
"windup" : {
"properties" : {
"image" : "<partImage>:ranged.<frame>"
}
},
"fire" : {
"properties" : {
"image" : "<partImage>:ranged.4"
}
}
},
"damage" : {
"stunned" : {
"properties" : {
"image" : "<partImage>:hurt.<frame>"
}
}
}
}
}
}
},
"transformationGroups" : {
"body" : { "interpolated" : true }
},
"particleEmitters" : {
"captureParticles" : {
"particles" : [
{ "particle" : "monstercapture" }
]
},
"releaseParticles" : {
"particles" : [
{ "particle" : "monsterrelease" }
]
},
"teleportOut" : {
"particles" : [
{ "particle" : "monstercapture" }
]
},
"teleportIn" : {
"particles" : [
{ "particle" : "monsterrelease" }
]
},
"deathPoof" : {
"particles" : [
{ "particle" : "monstersplosion" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathember" },
{ "particle" : "deathfizz1left" },
{ "particle" : "deathfizz1right" },
{ "particle" : "deathfizz2left" },
{ "particle" : "deathfizz2right" },
{ "particle" : "deathfizz3left" },
{ "particle" : "deathfizz3right" },
{ "particle" : "deathfizz4left" },
{ "particle" : "deathfizz4right" }
]
}
},
"sounds" : {
"aggroHop" : [ "/sfx/npc/monsters/monster_surprise.ogg" ],
"deathPuff" : [ "/sfx/melee/axe_kill_organic1.ogg" ],
"fire" : [ "/sfx/projectiles/bloodvomit1.ogg", "/sfx/projectiles/bloodvomit2.ogg", "/sfx/projectiles/bloodvomit3.ogg", "/sfx/projectiles/bloodvomit4.ogg", "/sfx/projectiles/bloodvomit5.ogg", "/sfx/projectiles/bloodvomit6.ogg", "/sfx/projectiles/bloodvomit7.ogg" ]
},
"effects" : {
"blink" : {
"type" : "flash",
"time" : 0.25,
"directives" : "fade=ffffff;0.5"
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2016 Coffee Stain Studios. All Rights Reserved.
#pragma once
#include "../../Plugins/Wwise/Source/AkAudio/Classes/AkAudioEvent.h"
#include "Array.h"
#include "SubclassOf.h"
#include "UObject/Class.h"
#include "GameFramework/Actor.h"
#include "FGEquipment.h"
#include "FGEquipmentAttachment.h"
#include "FGWeapon.generated.h"
/**
* Base class for a weapon in the game, this provides basic firing logic only and does not specify if it's a instant hit or projectile weapon.
*/
UCLASS()
class FACTORYGAME_API AFGWeapon : public AFGEquipment
{
GENERATED_BODY()
public:
/** Replication. */
virtual void GetLifetimeReplicatedProps( TArray< FLifetimeProperty >& OutLifetimeProps ) const override;
/** Ctor */
AFGWeapon();
// Begin AFGEquipment interface
virtual bool ShouldSaveState() const override;
// End
/**
* Put the weapon away.
*/
virtual void UnEquip();
/**
* bring up weapon and assign hud if local player
*/
virtual void Equip( class AFGCharacterPlayer* character ) override;
/**to be called when equipping a weapon on a local player. Enabling weapons to affect the hud. */
void AssignHud( AFGHUD * assoiatedHud = nullptr );
/** Called on the owner, client or server but not both. */
virtual void OnPrimaryFirePressed();
/** Called by client to start fire on server. */
UFUNCTION( Server, Reliable, WithValidation )
void Server_StartPrimaryFire();
/** Called on both client and server when firing. */
virtual void BeginPrimaryFire();
/** Called on the owner, client or server but not both. */
virtual void OnPrimaryFireReleased();
/** Called by client to start fire on server. */
UFUNCTION( Server, Reliable, WithValidation )
void Server_EndPrimaryFire();
/** Called on both client and server when firing. */
virtual void EndPrimaryFire();
/** Called when reload button is pressed */
void OnReloadPressed();
/** Actual reload implementation */
void Reload();
/** Return true if we currently can reload with the weapon */
UFUNCTION( BlueprintPure, Category = "Weapon" )
bool CanReload() const;
/** Returns -1 if not reloading, else, returns the time left on our reload */
UFUNCTION( BlueprintPure, Category = "Weapon" )
float GetReloadTimeLeft() const;
/** Returns true if we have ammunition loaded */
UFUNCTION( BlueprintPure, Category = "Weapon" )
bool HasAmmunition() const;
/** How much ammunition do our owner have in their inventory */
UFUNCTION( BlueprintPure, Category = "Weapon" )
int32 GetSpareAmmunition() const;
/** Checks what type of fire modes and call corresponding fire function */
UFUNCTION( BlueprintNativeEvent, Category = "Weapon" )
void FireAmmunition();
virtual void FireAmmunition_Implementation();
/** Returns whether we are reloading or not */
UFUNCTION( BlueprintPure, Category = "Weapon" )
FORCEINLINE bool GetIsReloading() const { return mIsReloading; }
/** Returns how much ammo we have in current clip */
UFUNCTION( BlueprintPure, Category = "Weapon" )
FORCEINLINE int32 GetCurrentAmmo() { return mCurrentAmmo; }
/** Returns mIsFiring */
UFUNCTION( BlueprintPure, Category = "Weapon" )
FORCEINLINE bool GetIsFiring() const { return mIsFiring; }
/** Returns mMagSize */
UFUNCTION( BlueprintPure, Category = "Weapon" )
FORCEINLINE int32 GetMagSize() const { return mMagSize; }
/** Called when you tried to fire and CanFire returned false. You will have to check the reason yourself and play effects accordingly */
UFUNCTION( BlueprintImplementableEvent, Category = "Projectile" )
void PlayFailedToFireEffects();
/** Called when the player releases the primary fire so that special animations can be triggered from this. The neccesity is rare, use PlayFireEffect() in most cases */
UFUNCTION( BlueprintImplementableEvent, Category = "Weapon" )
void PlayFireReleasedEffects();
protected:
// Begin AFGEquipment interface
virtual void AddEquipmentActionBindings();
// End AFGEquipment interface
/** Try to refire */
void RefireCheckTimer();
/** Handles playing of effects both on server and on client. */
UFUNCTION( BlueprintNativeEvent, Category = "Weapon" )
void PlayFireEffect();
/** Consumes our current ammo */
void ConsumeAmmunition();
/** Return true if we can fire */
bool CanFire() const;
/** When we "actually" has reloaded (reload logic goes here), need to be UFUNCTION as it used as a delegate */
UFUNCTION()
void ActualReload();
UFUNCTION( BlueprintNativeEvent, Category = "Weapon" )
void PlayReloadEffects();
/** Client tells server to reload */
UFUNCTION( Server, Unreliable, WithValidation )
void Server_Reload();
/** Ability for different classes to get ammo from different places */
virtual class UFGInventoryComponent* GetOwnersInventoryComponent() const;
/** Returns the assosiated hud object if there is one assigned */
UFUNCTION( BlueprintPure, Category = "Hud" )
FORCEINLINE AFGHUD* GetAssosiatedHud() const { return mAssosiatedHud; }
protected:
UPROPERTY()
AFGHUD* mAssosiatedHud = nullptr; //[DavalliusA:Wed/20-03-2019] the base hud object will never get invalid during use, so we can use anormal pointer here to access it.
/** Refire timer */
FTimerHandle mRefireCheckHandle;
/** Reload timer */
FTimerHandle mReloadHandle;
/** How much ammo does a magazine cover */
UPROPERTY( EditDefaultsOnly )
int32 mMagSize;
/** How much ammo is loaded into the weapon */
UPROPERTY( SaveGame, Replicated )
int32 mCurrentAmmo;
/** The item we shoot */
UPROPERTY( EditDefaultsOnly, BlueprintReadOnly )
TSubclassOf< class UFGItemDescriptor > mAmmunitionClass;
/** Damage type to use when hitting others */
UPROPERTY( EditDefaultsOnly, BlueprintReadOnly )
TSubclassOf< class UFGDamageType > mDamageTypeClass;
/** In seconds, how long time does it take to reload the weapon */
UPROPERTY( EditDefaultsOnly, BlueprintReadOnly )
float mReloadTime;
/** How many seconds between between shots */
UPROPERTY( EditDefaultsOnly, BlueprintReadOnly )
float mFireRate;
/** Are we firing? */
UPROPERTY( BlueprintReadOnly, meta = (NoAutoJson = true) )
bool mIsFiring;
/** The player wants to shoot */
UPROPERTY( BlueprintReadOnly, meta = (NoAutoJson = true) )
bool mIsPendingFire;
/** True if we are currently reloading */
UPROPERTY( meta = (NoAutoJson = true) )
bool mIsReloading;
/** Sound played when reloading */
UPROPERTY( EditDefaultsOnly, BlueprintReadWrite, Category = "Sound" )
UAkAudioEvent* mReloadSound;
/** A cast reference to the spawned child equipment, if it exists*/
class AFGWeaponChild* mChildWeapon;
public:
FORCEINLINE ~AFGWeapon() = default;
};
| {
"pile_set_name": "Github"
} |
1
00:00:19.620 --> 00:00:25.993
<c.magenta>Apple File System介绍</c>
<c.magenta>下一代存储的快照</c>
2
00:00:26.927 --> 00:00:28.428
<c.magenta>好了 欢迎各位</c>
3
00:00:28.495 --> 00:00:32.198
<c.magenta>我叫Eric Tamura</c>
<c.magenta>旁边是Dominic Giampaolo</c>
4
00:00:32.266 --> 00:00:35.135
<c.magenta>我们会向各位讲一下</c>
<c.magenta>Apple File System</c>
5
00:00:42.743 --> 00:00:47.181
<c.magenta>这是关于今天展示内容的</c>
<c.magenta>一些流程图</c>
6
00:00:47.447 --> 00:00:50.484
<c.magenta>我会稍微讲一下</c>
<c.magenta>介绍与动机</c>
7
00:00:50.584 --> 00:00:52.152
<c.magenta>为什么我们决定去构建它</c>
8
00:00:52.553 --> 00:00:55.689
<c.magenta>我们添加了一些新功能</c>
<c.magenta>作为Apple File System的一部分</c>
9
00:00:55.756 --> 00:00:57.791
<c.magenta>我们简短地展示这些新功能</c>
10
00:00:57.858 --> 00:00:59.026
<c.magenta>然后在结尾我们会</c>
11
00:00:59.092 --> 00:01:02.396
<c.magenta>谈谈你可以在应用中</c>
<c.magenta>使用的一些新API</c>
12
00:01:04.431 --> 00:01:06.133
<c.magenta>我们开始吧</c>
13
00:01:06.533 --> 00:01:08.302
<c.magenta>就像Sebastian提过的</c>
14
00:01:08.368 --> 00:01:12.072
<c.magenta>Apple File System可用在</c>
<c.magenta>macOS Sierra的 WWDC 版本</c>
15
00:01:12.139 --> 00:01:13.807
<c.magenta>你们昨天都得到了</c>
16
00:01:14.174 --> 00:01:17.244
<c.magenta>并且它会作为</c>
<c.magenta>开发者预览版技术</c>
17
00:01:17.311 --> 00:01:21.682
<c.magenta>于秋季macOS Sierra的</c>
<c.magenta>发布之后 在其上面使用</c>
18
00:01:22.950 --> 00:01:24.818
<c.magenta>什么是Apple File System?</c>
19
00:01:25.085 --> 00:01:28.989
<c.magenta>它是我们下一代文件系统</c>
<c.magenta>是我们为Apple产品所构建的</c>
20
00:01:29.356 --> 00:01:30.657
<c.magenta>你可能会关心这个</c>
21
00:01:30.724 --> 00:01:36.029
<c.magenta>因为它会在watchOS</c>
<c.magenta>iOS tvOS和macOS上运行</c>
22
00:01:36.630 --> 00:01:38.232
<c.magenta>对于预期的受众</c>
23
00:01:38.298 --> 00:01:41.668
<c.magenta>我们预计你们要么</c>
<c.magenta>在这些平台上是初来乍到</c>
24
00:01:41.735 --> 00:01:43.170
<c.magenta>或者是一位长期开发者</c>
25
00:01:43.604 --> 00:01:45.072
<c.magenta>但我们打算涵盖</c>
26
00:01:45.138 --> 00:01:48.609
<c.magenta>新文件系统中</c>
<c.magenta>所有高级功能的足够细节</c>
27
00:01:48.675 --> 00:01:49.977
<c.magenta>这样你能跟得上</c>
28
00:01:51.011 --> 00:01:54.314
<c.magenta>该产品的一个特点是</c>
<c.magenta>我们想从</c>
29
00:01:54.381 --> 00:01:57.150
<c.magenta>从Apple Watch</c>
<c.magenta>一路扩展到Mac Pro</c>
30
00:01:58.452 --> 00:02:01.555
<c.magenta>我们也想利用闪存和SSD存储</c>
31
00:02:01.622 --> 00:02:04.725
<c.magenta>因为几乎我们所有的产品</c>
<c.magenta>都使用SSD</c>
32
00:02:06.159 --> 00:02:09.496
<c.magenta>最后 其构建有加密</c>
<c.magenta>作为主要功能</c>
33
00:02:09.562 --> 00:02:13.133
<c.magenta>从最开始到现在</c>
<c.magenta>我们将这个想法变为现实</c>
34
00:02:14.501 --> 00:02:17.070
<c.magenta>你可能会想那HFS+怎么办</c>
35
00:02:17.137 --> 00:02:21.708
<c.magenta>我们目前把HFS+</c>
<c.magenta>作为主文件系统发布</c>
36
00:02:22.843 --> 00:02:25.612
<c.magenta>但其最初设计</c>
<c.magenta>到目前几乎有30年之久</c>
37
00:02:25.679 --> 00:02:28.815
<c.magenta>你们当中有多少人希望</c>
<c.magenta>我们再发布30年的HFS+?</c>
38
00:02:30.384 --> 00:02:34.688
<c.magenta>很好 所以HFS+设计于</c>
39
00:02:34.755 --> 00:02:37.658
<c.magenta>软盘和硬盘代表</c>
<c.magenta>最新技术水平的时代</c>
40
00:02:38.392 --> 00:02:39.626
<c.magenta>自此世界改变了很多</c>
41
00:02:39.693 --> 00:02:44.698
<c.magenta>现在我们使用SSD 而且</c>
<c.magenta>其它下一代存储技术也不断发展</c>
42
00:02:45.699 --> 00:02:48.936
<c.magenta>HFS+的数据结构</c>
<c.magenta>相对来说也是单线程的</c>
43
00:02:49.002 --> 00:02:53.807
<c.magenta>所以B-trees要依靠</c>
<c.magenta>大分块来访问或改变它们</c>
44
00:02:56.610 --> 00:02:59.079
<c.magenta>并且数据结构也相对死板</c>
45
00:02:59.146 --> 00:03:03.317
<c.magenta>我们的意思是 像是</c>
<c.magenta>HFS+中的文件记录或目录记录</c>
46
00:03:03.383 --> 00:03:06.687
<c.magenta>差不多相当于其他</c>
<c.magenta>文件系统的索引节点</c>
47
00:03:06.753 --> 00:03:09.990
<c.magenta>是固定的 这是为了添加</c>
<c.magenta>新的字段来扩展文件系统</c>
48
00:03:10.057 --> 00:03:12.359
<c.magenta>加入新的功能</c>
<c.magenta>我们必须付出代价</c>
49
00:03:12.426 --> 00:03:15.229
<c.magenta>那就是向后不兼容的卷格式改变</c>
50
00:03:15.295 --> 00:03:18.398
<c.magenta>我们的意思是</c>
<c.magenta>如果我们给HFS+添加新功能</c>
51
00:03:18.465 --> 00:03:22.936
<c.magenta>回到10.5版本 然后</c>
<c.magenta>附加那个相同的文件系统</c>
52
00:03:23.136 --> 00:03:24.238
<c.magenta>这会发生什么?</c>
53
00:03:24.671 --> 00:03:27.107
<c.magenta>所以如果我们关心向后兼容</c>
54
00:03:27.174 --> 00:03:30.644
<c.magenta>以及向前兼容</c>
<c.magenta>我们开始考虑</c>
55
00:03:30.711 --> 00:03:34.515
<c.magenta>也许打造完全</c>
<c.magenta>崭新的东西是有意义的</c>
56
00:03:35.849 --> 00:03:37.784
<c.magenta>所以我们考虑出新的东西</c>
57
00:03:38.719 --> 00:03:43.257
<c.magenta>我们想要的是为Apple产品</c>
<c.magenta>专门设计和优化的东西</c>
58
00:03:43.524 --> 00:03:46.960
<c.magenta>其他文件系统良好地</c>
<c.magenta>执行着其他目的</c>
59
00:03:47.394 --> 00:03:53.500
<c.magenta>尤其 文件管理器或者企业级别</c>
<c.magenta>存储服务器有很多的功能</c>
60
00:03:53.567 --> 00:03:55.636
<c.magenta>对于Apple产品没有太大意义</c>
61
00:03:55.702 --> 00:03:58.939
<c.magenta>我们通常在所有产品上</c>
<c.magenta>使用单个存储设备</c>
62
00:03:59.139 --> 00:04:02.042
<c.magenta>而且我们的规模广泛</c>
63
00:04:02.109 --> 00:04:07.347
<c.magenta>在Apple Watch上</c>
<c.magenta>你有更少的DRAM和存储空间</c>
64
00:04:07.414 --> 00:04:10.050
<c.magenta>与Mac Pro相比</c>
<c.magenta>Mac Pro有数十GB的</c>
65
00:04:10.117 --> 00:04:12.953
<c.magenta>潜在DRAM</c>
<c.magenta>以及数TB的存储空间</c>
66
00:04:13.086 --> 00:04:15.389
<c.magenta>所以我们想要</c>
<c.magenta>灵活动态的东西</c>
67
00:04:15.489 --> 00:04:18.492
<c.magenta>而且在那些平台上运行</c>
68
00:04:20.894 --> 00:04:22.162
<c.magenta>我们想打造的其它东西</c>
69
00:04:22.229 --> 00:04:24.965
<c.magenta>我们想新加并增强安全功能</c>
70
00:04:25.032 --> 00:04:29.269
<c.magenta>我们现在已经在iOS上</c>
<c.magenta>发布了HFS+的一个版本</c>
71
00:04:29.469 --> 00:04:31.572
<c.magenta>使用每文件加密</c>
72
00:04:31.638 --> 00:04:34.341
<c.magenta>所以在存储空间上</c>
<c.magenta>每个文件都是不同加密的</c>
73
00:04:34.408 --> 00:04:37.110
<c.magenta>不同于这个文件系统</c>
<c.magenta>上的其它任何文件</c>
74
00:04:37.845 --> 00:04:39.413
<c.magenta>我们想更进一步</c>
75
00:04:39.479 --> 00:04:43.183
<c.magenta>我们会在稍后的展示中</c>
<c.magenta>深入谈谈这些功能</c>
76
00:04:44.384 --> 00:04:47.821
<c.magenta>最后 我们想加入一些</c>
<c.magenta>新的通用文件系统功能</c>
77
00:04:48.455 --> 00:04:51.925
<c.magenta>是应大家要求</c>
<c.magenta>而且我们认为是十分重要的</c>
78
00:04:51.992 --> 00:04:54.161
<c.magenta>对于我们平台的未来</c>
79
00:04:55.429 --> 00:04:56.997
<c.magenta>在我们讲这些新功能之前</c>
80
00:04:57.064 --> 00:05:00.133
<c.magenta>我想给大家简短介绍一下</c>
81
00:05:00.200 --> 00:05:02.769
<c.magenta>Apple存储软件的样子</c>
82
00:05:03.170 --> 00:05:07.808
<c.magenta>在文件系统和存储方面</c>
<c.magenta>我们会谈论HFS+</c>
83
00:05:08.375 --> 00:05:12.112
<c.magenta>但我们涉及的范围</c>
<c.magenta>不止是HFS+</c>
84
00:05:12.179 --> 00:05:14.381
<c.magenta>这里实际上有很多辅助技术</c>
85
00:05:14.448 --> 00:05:16.617
<c.magenta>构成了我们的存储软件</c>
86
00:05:17.518 --> 00:05:18.952
<c.magenta>在一开始</c>
<c.magenta>我们有HFS标准</c>
87
00:05:19.019 --> 00:05:21.421
<c.magenta>这几乎</c>
<c.magenta>至今有30年之久</c>
88
00:05:21.655 --> 00:05:25.492
<c.magenta>若干年后</c>
<c.magenta>我们添加了HFS+</c>
89
00:05:25.659 --> 00:05:27.261
<c.magenta>不过我们加入了死机防护</c>
90
00:05:27.327 --> 00:05:30.664
<c.magenta>我们还加入了</c>
<c.magenta>区分大小写变体的日志</c>
91
00:05:32.065 --> 00:05:35.502
<c.magenta>我们还增加了CoreStorage</c>
<c.magenta>这给了我们全盘加密</c>
92
00:05:35.569 --> 00:05:39.206
<c.magenta>以及Fusion Drive</c>
<c.magenta>这将SSD的速度与</c>
93
00:05:39.273 --> 00:05:41.441
<c.magenta>硬盘的容量相组合</c>
94
00:05:42.075 --> 00:05:44.745
<c.magenta>我们不能忘记</c>
<c.magenta>所有针对iOS的变体</c>
95
00:05:44.811 --> 00:05:49.383
<c.magenta>我们有针对iOS的HFS+变体</c>
<c.magenta>以及支持</c>
96
00:05:49.449 --> 00:05:51.885
<c.magenta>刚才谈到的每文件加密的变体</c>
97
00:05:52.653 --> 00:05:55.355
<c.magenta>所以我们的目的是</c>
<c.magenta>所有这些技术</c>
98
00:05:55.422 --> 00:05:59.560
<c.magenta>都被一样东西所取代</c>
<c.magenta>那就是Apple File System</c>
99
00:06:02.329 --> 00:06:05.966
<c.magenta>我来稍微谈谈Apple File</c>
<c.magenta>System中的一些新功能</c>
100
00:06:09.136 --> 00:06:13.207
<c.magenta>这个简明的视图</c>
<c.magenta>囊括了我们现有内容</c>
101
00:06:13.273 --> 00:06:15.876
<c.magenta>我们有一些</c>
<c.magenta>改进的文件系统底层技术</c>
102
00:06:16.176 --> 00:06:21.381
<c.magenta>HFS兼容性 空间分享</c>
<c.magenta>克隆文件和目录</c>
103
00:06:21.448 --> 00:06:24.418
<c.magenta>快照和快照恢复</c>
104
00:06:24.852 --> 00:06:27.354
<c.magenta>一项我们称之为</c>
<c.magenta>目录大小快速调整的功能</c>
105
00:06:27.688 --> 00:06:30.324
<c.magenta>原子级安全存储基元</c>
<c.magenta>以及加密</c>
106
00:06:30.390 --> 00:06:31.859
<c.magenta>你不必把它们都记下来</c>
107
00:06:31.925 --> 00:06:35.529
<c.magenta>我们会在下面的幻灯片中</c>
<c.magenta>进行深入讲解的</c>
108
00:06:37.664 --> 00:06:40.667
<c.magenta>首先来谈谈</c>
<c.magenta>一些改进的底层技术</c>
109
00:06:40.734 --> 00:06:42.936
<c.magenta>改进的文件系统底层技术</c>
110
00:06:43.003 --> 00:06:45.839
<c.magenta>首先闪存和SSD优化</c>
111
00:06:46.540 --> 00:06:49.877
<c.magenta>在我们所有的设备上</c>
<c.magenta>在我们所有的iOS设备上</c>
112
00:06:49.943 --> 00:06:52.779
<c.magenta>而且很多Mac上</c>
<c.magenta>是内置有SSD的</c>
113
00:06:52.946 --> 00:06:55.949
<c.magenta>我们想尽可能地</c>
<c.magenta>对固态硬盘进行优化</c>
114
00:06:56.950 --> 00:06:59.987
<c.magenta>其还有死机防护功能</c>
<c.magenta>APFS或Apple File System</c>
115
00:07:00.053 --> 00:07:02.923
<c.magenta>采用崭新的</c>
<c.magenta>写入时复制元数据方案</c>
116
00:07:02.990 --> 00:07:07.661
<c.magenta>所以每个元数据写入都</c>
<c.magenta>写入到稳态存储上的新位置</c>
117
00:07:07.828 --> 00:07:10.898
<c.magenta>我们将其与</c>
<c.magenta>事务处理子系统相组合</c>
118
00:07:10.964 --> 00:07:13.967
<c.magenta>这保证了如果断电</c>
<c.magenta>如果机器死机</c>
119
00:07:14.034 --> 00:07:16.770
<c.magenta>或糟糕的事情发生</c>
<c.magenta>你会看到一致视图</c>
120
00:07:16.837 --> 00:07:20.807
<c.magenta>关于之前的磁盘内容</c>
<c.magenta>或者什么变更都看不到</c>
121
00:07:23.477 --> 00:07:25.879
<c.magenta>我们有现代64位原生字段</c>
122
00:07:25.946 --> 00:07:29.049
<c.magenta>所以索引节点号</c>
<c.magenta>扩展成了64位</c>
123
00:07:29.316 --> 00:07:32.486
<c.magenta>我们有时间戳现在也是64位</c>
124
00:07:32.553 --> 00:07:34.988
<c.magenta>我们支持纳秒时间戳粒度</c>
125
00:07:35.255 --> 00:07:38.692
<c.magenta>我们也支持Sparks Files</c>
<c.magenta>在Apple File System上是首次</c>
126
00:07:39.893 --> 00:07:43.830
<c.magenta>所有指向磁盘上</c>
<c.magenta>分块实际位置的</c>
127
00:07:43.897 --> 00:07:47.100
<c.magenta>文件和目录记录</c>
<c.magenta>也扩展成了64位</c>
128
00:07:48.368 --> 00:07:51.471
<c.magenta>我们的数据结构也是可扩展的</c>
<c.magenta>而且允许未来扩展</c>
129
00:07:51.772 --> 00:07:54.374
<c.magenta>所以我们讨论</c>
<c.magenta>HFS+的一件事是</c>
130
00:07:54.441 --> 00:07:57.244
<c.magenta>其数据结构相对死板</c>
131
00:07:57.711 --> 00:07:59.913
<c.magenta>在APFS或Apple</c>
<c.magenta>File System上</c>
132
00:08:00.347 --> 00:08:04.718
<c.magenta>代表核心索引节点的</c>
<c.magenta>数据结构现在是灵活的</c>
133
00:08:05.018 --> 00:08:07.921
<c.magenta>所以字段是可选的</c>
<c.magenta>或我们可能尚未将其创造出来</c>
134
00:08:07.988 --> 00:08:10.757
<c.magenta>所以我们在过程中</c>
<c.magenta>可能选择添加的新字段</c>
135
00:08:11.124 --> 00:08:13.427
<c.magenta>会被正确识别成不支持</c>
136
00:08:13.493 --> 00:08:16.763
<c.magenta>或是我不清楚</c>
<c.magenta>你是否将那个存储</c>
137
00:08:16.830 --> 00:08:20.200
<c.magenta>附加到当前版本的</c>
<c.magenta>macOS Sierra</c>
138
00:08:20.667 --> 00:08:22.469
<c.magenta>这样我们可以添加新功能</c>
139
00:08:22.536 --> 00:08:26.006
<c.magenta>不需要担心</c>
<c.magenta>会破坏掉向后兼容</c>
140
00:08:26.573 --> 00:08:28.775
<c.magenta>这还允许我们</c>
<c.magenta>拥有可选字段</c>
141
00:08:28.842 --> 00:08:32.578
<c.magenta>在一些系统上</c>
<c.magenta>单是文件的存在</c>
142
00:08:32.645 --> 00:08:34.982
<c.magenta>就足够传递出一些信息</c>
143
00:08:35.349 --> 00:08:38.619
<c.magenta>如果你有0字节的文件</c>
<c.magenta>你不一定需要</c>
144
00:08:38.684 --> 00:08:41.121
<c.magenta>所有机器指向</c>
<c.magenta>哪个分块在磁盘上</c>
145
00:08:41.188 --> 00:08:43.857
<c.magenta>因为它们不需要</c>
<c.magenta>所以这些字段是可选的</c>
146
00:08:45.592 --> 00:08:48.262
<c.magenta>这也优化于Apple</c>
<c.magenta>Software生态系统</c>
147
00:08:48.328 --> 00:08:52.165
<c.magenta>我们想添加功能</c>
<c.magenta>并优化API</c>
148
00:08:52.232 --> 00:08:55.569
<c.magenta>这对我们平台的</c>
<c.magenta>向前发展极其重要</c>
149
00:08:58.639 --> 00:09:00.607
<c.magenta>我们也有低延迟设计</c>
150
00:09:00.674 --> 00:09:04.945
<c.magenta>在文件系统中 延迟</c>
<c.magenta>通常是延迟与吞吐量之间的折衷</c>
151
00:09:05.012 --> 00:09:08.081
<c.magenta>我们选择倾向延迟这一边</c>
152
00:09:08.549 --> 00:09:10.584
<c.magenta>这么做是因为</c>
<c.magenta>我们想让你的应用</c>
153
00:09:10.651 --> 00:09:15.489
<c.magenta>当用户在桌面上点击应用</c>
<c.magenta>或在手机上按下应用时</c>
154
00:09:15.556 --> 00:09:17.624
<c.magenta>你想让应用快速出现</c>
<c.magenta>响应迅速</c>
155
00:09:17.691 --> 00:09:19.426
<c.magenta>而且有非常明快的动画</c>
156
00:09:19.760 --> 00:09:21.828
<c.magenta>这个的原因是</c>
<c.magenta>当你进入文件系统</c>
157
00:09:21.895 --> 00:09:25.933
<c.magenta>我们想确保</c>
<c.magenta>你会尽快得到你想要的回答</c>
158
00:09:27.501 --> 00:09:30.771
<c.magenta>最后我们有原生加密支持</c>
<c.magenta>内置于系统内部</c>
159
00:09:31.138 --> 00:09:34.575
<c.magenta>我们提过了 在HFS+上</c>
<c.magenta>使用的是每文件加密</c>
160
00:09:34.641 --> 00:09:37.244
<c.magenta>不过它们是通过</c>
<c.magenta>扩展属性存储在磁盘上的</c>
161
00:09:37.578 --> 00:09:40.981
<c.magenta>在Apple File System上并非如此</c>
<c.magenta>它们现在就如头等公民一般</c>
162
00:09:41.048 --> 00:09:44.184
<c.magenta>是文件系统内部的一级对象</c>
163
00:09:45.819 --> 00:09:47.421
<c.magenta>这就是底层技术的略微介绍</c>
164
00:09:47.721 --> 00:09:48.956
<c.magenta>HFS兼容性</c>
165
00:09:49.022 --> 00:09:52.326
<c.magenta>如果你们的应用</c>
<c.magenta>在HFS+上运行良好</c>
166
00:09:52.659 --> 00:09:54.828
<c.magenta>我们打算让它们继续运行</c>
167
00:09:54.895 --> 00:09:57.865
<c.magenta>不需要你那边</c>
<c.magenta>进行任何更改</c>
168
00:09:58.265 --> 00:10:02.236
<c.magenta>Apple File System会支持</c>
<c.magenta>并替换HFS+的功能</c>
169
00:10:02.302 --> 00:10:03.303
<c.magenta>这里有个星号</c>
170
00:10:03.370 --> 00:10:06.874
<c.magenta>因为有三个功能</c>
<c.magenta>我们不会继续支持</c>
171
00:10:07.207 --> 00:10:10.811
<c.magenta>一个是交换数据</c>
<c.magenta>另一个是Search FS</c>
172
00:10:10.878 --> 00:10:14.781
<c.magenta>然后第三个是</c>
<c.magenta>“时间机器”的目录硬链接</c>
173
00:10:15.749 --> 00:10:21.388
<c.magenta>不过其他剩下的API和行为</c>
<c.magenta>都会得到支持 和HFS+一样</c>
174
00:10:23.056 --> 00:10:24.958
<c.magenta>现在我想稍微讲讲</c>
<c.magenta>空间分享</c>
175
00:10:25.025 --> 00:10:28.428
<c.magenta>这是Apple File System上</c>
<c.magenta>新添加的一项功能</c>
176
00:10:29.196 --> 00:10:32.099
<c.magenta>我快速调查一下</c>
<c.magenta>在座的有多少人</c>
177
00:10:32.165 --> 00:10:35.669
<c.magenta>有Mac或者在Mac上</c>
<c.magenta>使用一个以上的分区?</c>
178
00:10:36.870 --> 00:10:41.842
<c.magenta>非常好 我们也是</c>
<c.magenta>在内部我们做的一件事</c>
179
00:10:41.909 --> 00:10:45.279
<c.magenta>是我们想让开发版本的OS</c>
<c.magenta>在一个分区上</c>
180
00:10:45.345 --> 00:10:48.615
<c.magenta>我们想让稳定发布版本</c>
<c.magenta>在另一个分区上</c>
181
00:10:48.815 --> 00:10:50.851
<c.magenta>或你可能选择将主目录放在一个分区上</c>
182
00:10:50.918 --> 00:10:54.154
<c.magenta>其他你不在意的不同数据</c>
<c.magenta>放在另一个上面</c>
183
00:10:54.621 --> 00:10:57.891
<c.magenta>不过我们得知了一件事</c>
<c.magenta>通过分析</c>
184
00:10:57.958 --> 00:10:59.960
<c.magenta>来自用户选择性输入的</c>
<c.magenta>数据收集</c>
185
00:11:00.027 --> 00:11:02.429
<c.magenta>以及向Apple设备</c>
<c.magenta>报告的统计数据</c>
186
00:11:02.496 --> 00:11:07.167
<c.magenta>大多数终端用户不这样做</c>
<c.magenta>他们只有一个分区</c>
187
00:11:07.734 --> 00:11:10.137
<c.magenta>他们不做的原因是这很困难</c>
188
00:11:10.370 --> 00:11:13.040
<c.magenta>你必须清楚知道</c>
<c.magenta>如何给磁盘布局</c>
189
00:11:13.106 --> 00:11:16.777
<c.magenta>在你设置的时候</c>
<c.magenta>而且更换它是比较昂贵的</c>
190
00:11:17.211 --> 00:11:19.847
<c.magenta>此外 一个分区上的空闲空间</c>
<c.magenta>如你所知</c>
191
00:11:19.913 --> 00:11:23.650
<c.magenta>不会转换成</c>
<c.magenta>另一分区上的可用空闲空间</c>
192
00:11:24.151 --> 00:11:27.254
<c.magenta>所以我们使用名为</c>
<c.magenta>空间分享的功能来解决该问题</c>
193
00:11:27.654 --> 00:11:28.889
<c.magenta>我们看看这个例子</c>
194
00:11:28.956 --> 00:11:32.159
<c.magenta>我们会在流程中</c>
<c.magenta>说明这项功能</c>
195
00:11:32.226 --> 00:11:35.362
<c.magenta>假设你在下载</c>
<c.magenta>最新最棒的猫咪视频</c>
196
00:11:35.429 --> 00:11:38.498
<c.magenta>从朋友那里得来的</c>
<c.magenta>在网络上用AirDrop下载</c>
197
00:11:39.266 --> 00:11:42.402
<c.magenta>假设文件变大</c>
<c.magenta>越来越大</c>
198
00:11:42.469 --> 00:11:45.973
<c.magenta>事实上</c>
<c.magenta>大到你的空间都被占满了</c>
199
00:11:46.039 --> 00:11:48.008
<c.magenta>在你运行的那个分区上</c>
200
00:11:48.509 --> 00:11:50.244
<c.magenta>这种情况下</c>
<c.magenta>你做不了多少事情</c>
201
00:11:50.310 --> 00:11:51.545
<c.magenta>若空间占满</c>
<c.magenta>那就是占满了</c>
202
00:11:51.979 --> 00:11:55.916
<c.magenta>你可以做的一件事是</c>
<c.magenta>之后马上完全销毁</c>
203
00:11:55.983 --> 00:11:58.652
<c.magenta>那个分区</c>
<c.magenta>然后扩张分区1</c>
204
00:11:58.719 --> 00:11:59.786
<c.magenta>我们来看看</c>
205
00:12:00.053 --> 00:12:04.758
<c.magenta>我们可以销毁分区2</c>
<c.magenta>分区1扩张</c>
206
00:12:04.825 --> 00:12:08.562
<c.magenta>现在你有足够的空间</c>
<c.magenta>来继续下载猫咪视频了</c>
207
00:12:09.763 --> 00:12:12.999
<c.magenta>但这也很不灵活</c>
<c.magenta>而且会带来一些问题</c>
208
00:12:13.066 --> 00:12:16.570
<c.magenta>如果你下载的文件不在分区1上</c>
209
00:12:16.637 --> 00:12:19.072
<c.magenta>而实际上是在分区0</c>
210
00:12:19.673 --> 00:12:21.942
<c.magenta>这种情况下</c>
<c.magenta>你会下载文件</c>
211
00:12:22.009 --> 00:12:26.246
<c.magenta>越来越大</c>
<c.magenta>就算你有空闲空间</c>
212
00:12:26.313 --> 00:12:29.383
<c.magenta>或者愿意销毁分区2上的内容</c>
213
00:12:29.550 --> 00:12:33.687
<c.magenta>我们可以销毁它</c>
<c.magenta>不过这样分区0不会扩张</c>
214
00:12:33.820 --> 00:12:35.956
<c.magenta>因为它并不靠近任何我们刚才</c>
215
00:12:36.023 --> 00:12:37.391
<c.magenta>腾出来的空闲空间</c>
216
00:12:37.524 --> 00:12:40.727
<c.magenta>所以我们认为这是可以</c>
<c.magenta>使用空间分享解决的问题</c>
217
00:12:41.128 --> 00:12:43.764
<c.magenta>在Apple File System中</c>
<c.magenta>我们想出了这一基本概念</c>
218
00:12:43.830 --> 00:12:46.033
<c.magenta>我们称其为容器</c>
<c.magenta>很合适的名字</c>
219
00:12:46.099 --> 00:12:49.736
<c.magenta>因为它包含了卷或单个文件系统</c>
220
00:12:50.571 --> 00:12:53.607
<c.magenta>在这个实例中</c>
<c.magenta>Apple File System的容器</c>
221
00:12:53.674 --> 00:12:55.609
<c.magenta>代表了最低级别的功能</c>
222
00:12:55.676 --> 00:12:58.579
<c.magenta>这个封装了我们的块分配器</c>
223
00:12:58.645 --> 00:13:00.981
<c.magenta>以及我们的死机防护子系统</c>
224
00:13:01.715 --> 00:13:04.718
<c.magenta>假如说我们有分区0</c>
<c.magenta>在分区中占有一定</c>
225
00:13:04.785 --> 00:13:07.921
<c.magenta>数量的空闲空间</c>
226
00:13:08.989 --> 00:13:11.925
<c.magenta>卷可以扩张或缩小</c>
227
00:13:12.860 --> 00:13:15.429
<c.magenta>但在所有这些情况下</c>
<c.magenta>空闲空间会动态地调整成</c>
228
00:13:15.495 --> 00:13:18.565
<c.magenta>在你进行请求时</c>
<c.magenta>可用的大小</c>
229
00:13:18.932 --> 00:13:21.335
<c.magenta>还可在容器中</c>
<c.magenta>创建一个以上的卷</c>
230
00:13:21.401 --> 00:13:23.570
<c.magenta>这会逐渐占用更多空间</c>
231
00:13:24.104 --> 00:13:26.807
<c.magenta>如果你想在这个时候</c>
232
00:13:26.874 --> 00:13:28.375
<c.magenta>扩张卷0</c>
<c.magenta>你就能做到</c>
233
00:13:28.442 --> 00:13:31.812
<c.magenta>如果你询问</c>
<c.magenta>系统中还剩多少空间可用</c>
234
00:13:31.879 --> 00:13:35.015
<c.magenta>绿色长方形底部的区域就是</c>
235
00:13:35.249 --> 00:13:36.250
<c.magenta>开发者们 要注意</c>
236
00:13:36.316 --> 00:13:38.452
<c.magenta>这个东西稍微不同于</c>
237
00:13:38.519 --> 00:13:40.988
<c.magenta>你之前计算空闲空间的方法</c>
238
00:13:41.054 --> 00:13:44.491
<c.magenta>如果你使用一些范例</c>
<c.magenta>例如使用总共存储大小</c>
239
00:13:44.558 --> 00:13:47.027
<c.magenta>减去已用空间</c>
<c.magenta>来得出空闲空间</c>
240
00:13:47.094 --> 00:13:50.030
<c.magenta>这不会再起作用了</c>
<c.magenta>因为容器上的</c>
241
00:13:50.097 --> 00:13:52.999
<c.magenta>其他卷</c>
<c.magenta>也在参与空间分享</c>
242
00:13:53.433 --> 00:13:58.438
<c.magenta>此外 你也没有必要</c>
<c.magenta>将所有已用空间加起来</c>
243
00:14:00.140 --> 00:14:02.142
<c.magenta>接下来 我请Dominic上台</c>
244
00:14:02.209 --> 00:14:05.045
<c.magenta>它会给大家讲讲</c>
<c.magenta>克隆文件和目录</c>
245
00:14:10.918 --> 00:14:13.353
<c.magenta>嗨 我叫Dominic</c>
<c.magenta>我将讲解一些</c>
246
00:14:13.420 --> 00:14:16.156
<c.magenta>我们在APFS中有的</c>
<c.magenta>其他高级功能</c>
247
00:14:16.657 --> 00:14:19.793
<c.magenta>首先 我们来谈谈</c>
<c.magenta>克隆文件和目录</c>
248
00:14:19.860 --> 00:14:23.096
<c.magenta>这里我们有一个文件</c>
<c.magenta>TOP_SECRET_APFS.key</c>
249
00:14:23.397 --> 00:14:24.831
<c.magenta>这在Eric的主目录中</c>
250
00:14:24.898 --> 00:14:27.234
<c.magenta>它引用了两个数据快</c>
251
00:14:27.467 --> 00:14:30.504
<c.magenta>现在如果Eric</c>
<c.magenta>想做这次展示的档案</c>
252
00:14:30.737 --> 00:14:33.373
<c.magenta>它在这一时刻中存在着</c>
<c.magenta>他可以复制数据</c>
253
00:14:33.440 --> 00:14:36.143
<c.magenta>通过全部读取</c>
<c.magenta>然后再写出来</c>
254
00:14:36.410 --> 00:14:41.582
<c.magenta>这很明显会消耗CPU</c>
<c.magenta>电力以及磁盘空间使用</c>
255
00:14:41.682 --> 00:14:44.585
<c.magenta>相反 在APFS上</c>
<c.magenta>你可以克隆文件</c>
256
00:14:44.751 --> 00:14:47.721
<c.magenta>通过克隆文件</c>
<c.magenta>你复制了数据的引用</c>
257
00:14:47.788 --> 00:14:49.389
<c.magenta>而不是实际数据</c>
258
00:14:49.456 --> 00:14:53.493
<c.magenta>所以很明显会更快</c>
<c.magenta>而且如果是大文件</c>
259
00:14:53.594 --> 00:14:55.629
<c.magenta>你不会使用两倍的空间</c>
260
00:14:55.696 --> 00:14:57.631
<c.magenta>你使用的是</c>
<c.magenta>大小完全一样的空间</c>
261
00:14:57.698 --> 00:15:02.035
<c.magenta>外加用于数据额外引用</c>
<c.magenta>少量递增空间</c>
262
00:15:02.336 --> 00:15:04.805
<c.magenta>克隆在文件系统中能保证</c>
263
00:15:04.872 --> 00:15:08.575
<c.magenta>如果在原件或克隆</c>
<c.magenta>上进行修改</c>
264
00:15:08.742 --> 00:15:11.545
<c.magenta>文件系统会将</c>
<c.magenta>那个数据写入新的位置</c>
265
00:15:11.612 --> 00:15:13.647
<c.magenta>所以克隆原封不动</c>
266
00:15:14.815 --> 00:15:16.850
<c.magenta>所以这一点要着重记住</c>
267
00:15:16.917 --> 00:15:20.787
<c.magenta>当你有克隆时</c>
<c.magenta>你在克隆的时候</c>
268
00:15:20.854 --> 00:15:22.289
<c.magenta>你没在使用任何额外空间</c>
269
00:15:22.356 --> 00:15:26.660
<c.magenta>随着你继续进行修改</c>
<c.magenta>你会开始使用越来越多的空间</c>
270
00:15:27.895 --> 00:15:31.465
<c.magenta>此外 因为APFS</c>
<c.magenta>iOS和macOS</c>
271
00:15:31.532 --> 00:15:34.735
<c.magenta>支持应用程序捆绑包中的文档</c>
272
00:15:34.801 --> 00:15:38.739
<c.magenta>APFS还会允许你克隆</c>
<c.magenta>整个目录层级</c>
273
00:15:38.805 --> 00:15:40.607
<c.magenta>文档捆绑包是一个目录</c>
274
00:15:40.674 --> 00:15:43.076
<c.magenta>其内部包含着一套文件</c>
275
00:15:43.143 --> 00:15:46.113
<c.magenta>APFS可以原子级别地克隆它</c>
276
00:15:47.114 --> 00:15:49.183
<c.magenta>接下来我们谈谈快照</c>
277
00:15:49.716 --> 00:15:53.520
<c.magenta>这里我们有文件系统的</c>
<c.magenta>另一个代表 其中有两个文件</c>
278
00:15:53.587 --> 00:15:55.856
<c.magenta>BikeRacing和</c>
<c.magenta>CoffeeOrigins</c>
279
00:15:55.989 --> 00:15:59.660
<c.magenta>BikeRacing有两个数据块</c>
<c.magenta>CoffeeOrigins是一个</c>
280
00:15:59.860 --> 00:16:03.597
<c.magenta>如果我们捕获文件系统的快照</c>
<c.magenta>我们现在有一个分离的</c>
281
00:16:03.664 --> 00:16:07.568
<c.magenta>可独立挂载的</c>
<c.magenta>只读的文件系统副本</c>
282
00:16:07.634 --> 00:16:12.806
<c.magenta>这代表在捕获快照的那一时刻</c>
<c.magenta>文件系统中的数据</c>
283
00:16:12.940 --> 00:16:16.910
<c.magenta>跟克隆很相似 如果在</c>
<c.magenta>活动的文件系统中进行写入</c>
284
00:16:16.977 --> 00:16:19.646
<c.magenta>文件系统会将</c>
<c.magenta>那个数据放入新的位置</c>
285
00:16:19.713 --> 00:16:21.915
<c.magenta>保留快照的完整性</c>
286
00:16:22.850 --> 00:16:26.887
<c.magenta>同样的 如果我们删除</c>
<c.magenta>CoffeeOrigins.key</c>
287
00:16:26.954 --> 00:16:30.991
<c.magenta>尝试清空一些空间</c>
<c.magenta>文件系统无法回收那些数据块</c>
288
00:16:31.058 --> 00:16:33.927
<c.magenta>因为如你所见</c>
<c.magenta>快照的文件系统</c>
289
00:16:33.994 --> 00:16:35.896
<c.magenta>继续引用这那些数据块</c>
290
00:16:36.029 --> 00:16:37.631
<c.magenta>这是一个很重要的考虑</c>
291
00:16:37.698 --> 00:16:40.434
<c.magenta>开发者在快照上工作时需要留意</c>
292
00:16:40.501 --> 00:16:43.971
<c.magenta>因为当一个文件被删除</c>
<c.magenta>如果它存在于</c>
293
00:16:44.037 --> 00:16:46.840
<c.magenta>快照捕获的时刻</c>
<c.magenta>那数据块就无法回收</c>
294
00:16:46.907 --> 00:16:49.710
<c.magenta>所以快照可以致使你</c>
<c.magenta>使用所有的磁盘空间</c>
295
00:16:49.776 --> 00:16:52.913
<c.magenta>如果你不定期回收它们</c>
296
00:16:53.580 --> 00:16:56.316
<c.magenta>我们预计开发者</c>
<c.magenta>可能会将快照</c>
297
00:16:56.383 --> 00:16:59.486
<c.magenta>用于获取稳定只读的数据副本</c>
298
00:16:59.553 --> 00:17:02.856
<c.magenta>将其用于备份</c>
<c.magenta>不过我们也想知道来自</c>
299
00:17:02.923 --> 00:17:05.791
<c.magenta>开发者的其他反馈</c>
<c.magenta>关于快照的其他可能用途</c>
300
00:17:05.858 --> 00:17:08.228
<c.magenta>所以请在12:30</c>
<c.magenta>到实验室和我们见面</c>
301
00:17:08.694 --> 00:17:11.031
<c.magenta>让我们知道</c>
<c.magenta>你会如何使用快照</c>
302
00:17:12.833 --> 00:17:14.902
<c.magenta>现在我们谈谈</c>
<c.magenta>快照恢复</c>
303
00:17:14.968 --> 00:17:17.069
<c.magenta>这是APFS支持的</c>
<c.magenta>另一项功能</c>
304
00:17:17.137 --> 00:17:19.306
<c.magenta>我们有相同的文件系统状态</c>
305
00:17:19.373 --> 00:17:22.009
<c.magenta>不过我们决定</c>
<c.magenta>不要这样</c>
306
00:17:22.075 --> 00:17:25.412
<c.magenta>我们想恢复</c>
<c.magenta>这基本上是全局撤销</c>
307
00:17:25.479 --> 00:17:28.248
<c.magenta>我们想回到之前捕获这个快照</c>
308
00:17:28.315 --> 00:17:30.651
<c.magenta>那一时刻的文件系统</c>
309
00:17:30.951 --> 00:17:35.088
<c.magenta>你可以标记文件系统</c>
<c.magenta>恢复到快照状态</c>
310
00:17:35.155 --> 00:17:36.657
<c.magenta>下一次挂载的时候</c>
311
00:17:36.990 --> 00:17:42.496
<c.magenta>文件系统会返回到</c>
<c.magenta>捕获这个快照的那一时刻</c>
312
00:17:42.563 --> 00:17:45.732
<c.magenta>之后允许你继续</c>
<c.magenta>从那时开始进行更改</c>
313
00:17:45.799 --> 00:17:48.836
<c.magenta>你能看到</c>
<c.magenta>CoffeeOrigins.key回来了</c>
314
00:17:48.902 --> 00:17:51.972
<c.magenta>而且在其他文件上</c>
<c.magenta>做出的更改也被丢弃了</c>
315
00:17:52.039 --> 00:17:54.041
<c.magenta>快照会继续存在</c>
316
00:17:54.107 --> 00:17:56.844
<c.magenta>而且你可以无限次数进行恢复</c>
317
00:17:59.146 --> 00:18:01.982
<c.magenta>好了 我们来谈谈</c>
<c.magenta>目录大小快速调整</c>
318
00:18:02.249 --> 00:18:03.750
<c.magenta>这项功能回答了一个问题</c>
319
00:18:03.817 --> 00:18:06.553
<c.magenta>那就是目录层级</c>
<c.magenta>会使用多少的空间</c>
320
00:18:06.620 --> 00:18:09.690
<c.magenta>应用程序会经常</c>
<c.magenta>需要计算这个大小</c>
321
00:18:09.756 --> 00:18:13.327
<c.magenta>用于操作大小调整</c>
<c.magenta>给用户提供进程</c>
322
00:18:13.393 --> 00:18:16.363
<c.magenta>这样做的一个明显方式</c>
<c.magenta>是打开目录层级</c>
323
00:18:16.430 --> 00:18:18.665
<c.magenta>递归性地迭代所有的内容</c>
324
00:18:18.732 --> 00:18:22.269
<c.magenta>然后查看所有项目的大小</c>
<c.magenta>加在一起</c>
325
00:18:22.703 --> 00:18:26.473
<c.magenta>当然 用户会非常乐意</c>
<c.magenta>更快一点得知那个答案</c>
326
00:18:26.540 --> 00:18:27.741
<c.magenta>在下一张幻灯片上</c>
327
00:18:27.808 --> 00:18:30.477
<c.magenta>如果你把注意力</c>
<c.magenta>集中在屏幕的左边</c>
328
00:18:30.544 --> 00:18:34.615
<c.magenta>当Get Info面板显示出来</c>
<c.magenta>你会看到上面写着 计算大小</c>
329
00:18:36.817 --> 00:18:39.586
<c.magenta>几秒钟之后</c>
<c.magenta>就会填充上大小</c>
330
00:18:39.653 --> 00:18:41.522
<c.magenta>这是我们想提升的地方</c>
331
00:18:42.089 --> 00:18:44.358
<c.magenta>文件系统可以跟踪它</c>
332
00:18:44.458 --> 00:18:47.227
<c.magenta>很明显 你可以保存</c>
<c.magenta>目录层级的大小</c>
333
00:18:47.294 --> 00:18:50.998
<c.magenta>外加目录本身</c>
<c.magenta>不过这有一个主要问题</c>
334
00:18:51.231 --> 00:18:55.302
<c.magenta>如果安全地在链上更新</c>
<c.magenta>父目录以及父目录的上级?</c>
335
00:18:55.769 --> 00:18:58.438
<c.magenta>我们深入到了文件系统的内部</c>
336
00:18:58.505 --> 00:19:02.309
<c.magenta>不过当你在修改时</c>
<c.magenta>锁定了子目录</c>
337
00:19:02.376 --> 00:19:05.946
<c.magenta>你无法再锁定父目录</c>
<c.magenta>应为这会违反锁定顺序</c>
338
00:19:06.113 --> 00:19:09.149
<c.magenta>文件系统总是会</c>
<c.magenta>从父目录向子目录锁定</c>
339
00:19:09.216 --> 00:19:10.918
<c.magenta>从来不是从子目录到父目录</c>
340
00:19:10.984 --> 00:19:14.021
<c.magenta>如果你反着来做</c>
<c.magenta>就会出现死锁</c>
341
00:19:14.855 --> 00:19:17.724
<c.magenta>而APFS绕过了这个问题</c>
342
00:19:17.958 --> 00:19:20.327
<c.magenta>如果问题是将</c>
<c.magenta>大小和目录一起保存</c>
343
00:19:20.394 --> 00:19:22.396
<c.magenta>那我们将大小保存到别的地方</c>
344
00:19:22.796 --> 00:19:24.698
<c.magenta>所以通过分隔保存大小</c>
345
00:19:24.765 --> 00:19:27.568
<c.magenta>我们可以使用</c>
<c.magenta>原子级操作来将大小更新在</c>
346
00:19:27.634 --> 00:19:30.704
<c.magenta>由文件系统</c>
<c.magenta>所维护的单独记录中</c>
347
00:19:30.904 --> 00:19:33.473
<c.magenta>而且不会违反任何锁定顺序</c>
348
00:19:34.041 --> 00:19:37.678
<c.magenta>额外的大小记录</c>
<c.magenta>会带来少量增量成本</c>
349
00:19:37.744 --> 00:19:40.848
<c.magenta>不过这基本与IO一起</c>
<c.magenta>可忽略不计</c>
350
00:19:43.016 --> 00:19:46.420
<c.magenta>好了 接下来我们要谈谈</c>
<c.magenta>原子级安全存储基元</c>
351
00:19:46.687 --> 00:19:48.822
<c.magenta>第一个例子</c>
<c.magenta>只是一个基本文件</c>
352
00:19:48.889 --> 00:19:52.659
<c.magenta>这是当今安全存储</c>
<c.magenta>怎样在普通文件上起作用的</c>
353
00:19:52.893 --> 00:19:55.128
<c.magenta>这里我有</c>
<c.magenta>MakeMoneyFast.key</c>
354
00:19:55.462 --> 00:19:57.231
<c.magenta>我想出了一些</c>
<c.magenta>聪明绝顶的新方案</c>
355
00:19:57.297 --> 00:19:58.699
<c.magenta>能快速赚钱</c>
356
00:19:58.799 --> 00:20:00.901
<c.magenta>当应用程序保存那个数据时</c>
357
00:20:00.968 --> 00:20:04.071
<c.magenta>它会被写入边下的</c>
<c.magenta>一个临时位置</c>
358
00:20:04.304 --> 00:20:07.107
<c.magenta>当应用程序得知一切都写好</c>
359
00:20:07.174 --> 00:20:11.111
<c.magenta>并安全存在磁盘上</c>
<c.magenta>它会请求文件系统进行重命名</c>
360
00:20:11.278 --> 00:20:14.047
<c.magenta>文件重命名</c>
<c.magenta>一直都是原子级的</c>
361
00:20:14.214 --> 00:20:16.783
<c.magenta>文件系统保证</c>
<c.magenta>要么完全发生</c>
362
00:20:16.850 --> 00:20:19.353
<c.magenta>而且是安全的</c>
<c.magenta>要么根本不发生</c>
363
00:20:19.720 --> 00:20:22.089
<c.magenta>此外 文件系统会负责删除</c>
364
00:20:22.155 --> 00:20:24.124
<c.magenta>文档先前的版本</c>
365
00:20:24.291 --> 00:20:26.760
<c.magenta>这对普通文件来说非常好</c>
<c.magenta>但如果你有</c>
366
00:20:26.827 --> 00:20:28.395
<c.magenta>文档捆绑包该怎么办?</c>
367
00:20:28.662 --> 00:20:32.566
<c.magenta>我们这里有一个文档捆绑包</c>
<c.magenta>ClutchConcertReview.rtfd</c>
368
00:20:32.633 --> 00:20:37.237
<c.magenta>这是一个目录</c>
<c.magenta>其中包含着文档的资源</c>
369
00:20:37.571 --> 00:20:40.307
<c.magenta>今天会发生的是</c>
<c.magenta>假如我去看Clutch表演</c>
370
00:20:40.374 --> 00:20:43.610
<c.magenta>他们的表演十分出色</c>
<c.magenta>然后我更新我的评论</c>
371
00:20:43.944 --> 00:20:48.815
<c.magenta>这个改变写出来了</c>
<c.magenta>但现在发生的是无法</c>
372
00:20:48.882 --> 00:20:51.985
<c.magenta>将一个目录在另一个目录</c>
<c.magenta>上面进行原子级重命名</c>
373
00:20:52.052 --> 00:20:54.922
<c.magenta>因为POSIX语义不允许这样</c>
374
00:20:54.988 --> 00:20:57.257
<c.magenta>如果有东西在目的地内部</c>
375
00:20:57.424 --> 00:20:59.359
<c.magenta>我们开始玩一个脱壳游戏</c>
376
00:20:59.960 --> 00:21:02.829
<c.magenta>首先 将文档移动开</c>
<c.magenta>活动的文档</c>
377
00:21:02.896 --> 00:21:06.500
<c.magenta>这时如果出现什么差错</c>
<c.magenta>然后应用程序崩溃</c>
378
00:21:06.567 --> 00:21:09.536
<c.magenta>或者系统断电</c>
<c.magenta>用户数据就消失了</c>
379
00:21:10.070 --> 00:21:13.040
<c.magenta>之后 应用程序将数据移动到位</c>
380
00:21:13.106 --> 00:21:17.144
<c.magenta>最后 它要负责删除</c>
<c.magenta>目录的先前版本</c>
381
00:21:17.477 --> 00:21:18.645
<c.magenta>文档捆绑包</c>
382
00:21:18.712 --> 00:21:20.781
<c.magenta>所以这不是原子级</c>
<c.magenta>而且不安全</c>
383
00:21:20.848 --> 00:21:22.749
<c.magenta>这个问题困扰我们</c>
384
00:21:22.816 --> 00:21:25.319
<c.magenta>很长时间</c>
<c.magenta>而且我们想改进它</c>
385
00:21:25.519 --> 00:21:29.423
<c.magenta>在APFS上我们推出了</c>
<c.magenta>新的系统 叫做renamex_np</c>
386
00:21:29.489 --> 00:21:33.961
<c.magenta>用于非POSIX 这允许</c>
<c.magenta>目录的原子级安全存储</c>
387
00:21:34.027 --> 00:21:38.298
<c.magenta>现在当应用程序将数据</c>
<c.magenta>写入其临时位置时</c>
388
00:21:38.498 --> 00:21:43.971
<c.magenta>并请求执行重命名操作</c>
<c.magenta>APFS会原子级地负责交换</c>
389
00:21:44.338 --> 00:21:46.707
<c.magenta>并删除文档的先前版本</c>
390
00:21:46.773 --> 00:21:48.876
<c.magenta>所以现在是原子级的并且安全</c>
391
00:21:49.142 --> 00:21:51.378
<c.magenta>当然 作为开发者</c>
<c.magenta>你可能不会借助于</c>
392
00:21:51.445 --> 00:21:53.981
<c.magenta>这种低级的系统调用</c>
393
00:21:54.081 --> 00:21:56.683
<c.magenta>因为已经为大家</c>
<c.magenta>在Foundation中采用好了</c>
394
00:21:56.750 --> 00:22:01.355
<c.magenta>所以你会在APFS上</c>
<c.magenta>享受到这个改进行为的益处</c>
395
00:22:08.295 --> 00:22:10.297
<c.magenta>接下来 我将谈谈加密</c>
396
00:22:11.131 --> 00:22:13.400
<c.magenta>就如Eric所说</c>
<c.magenta>有了HFS+</c>
397
00:22:13.634 --> 00:22:19.840
<c.magenta>在Mac上 我们使用叫做Core</c>
<c.magenta>Storage的层 位于HFS下层</c>
398
00:22:20.007 --> 00:22:22.442
<c.magenta>提供全盘加密</c>
<c.magenta>以及其他内容</c>
399
00:22:22.509 --> 00:22:25.546
<c.magenta>这是一个相当复杂的层</c>
<c.magenta>而且功能很多</c>
400
00:22:25.946 --> 00:22:28.015
<c.magenta>在iOS上</c>
<c.magenta>我们有不同的变体</c>
401
00:22:28.081 --> 00:22:31.685
<c.magenta>保存加密密钥</c>
<c.magenta>和有效扩展属性</c>
402
00:22:31.752 --> 00:22:33.620
<c.magenta>这些加密密钥会与</c>
403
00:22:33.687 --> 00:22:37.424
<c.magenta>iOS设备上的</c>
<c.magenta>加速AES硬件一同协作</c>
404
00:22:37.491 --> 00:22:39.226
<c.magenta>来提供每文件加密</c>
405
00:22:39.426 --> 00:22:43.197
<c.magenta>这是个有点复杂故事</c>
<c.magenta>有两个非常不同的代码库</c>
406
00:22:43.263 --> 00:22:47.568
<c.magenta>在APFS上 我们想尝试</c>
<c.magenta>提供更完成的故事</c>
407
00:22:47.634 --> 00:22:49.203
<c.magenta>在我们所有的产品上</c>
408
00:22:49.903 --> 00:22:53.540
<c.magenta>APFS支持多种级别的</c>
<c.magenta>文件系统加密</c>
409
00:22:53.974 --> 00:22:55.209
<c.magenta>不过首先</c>
<c.magenta>最简单的级别</c>
410
00:22:55.275 --> 00:22:57.578
<c.magenta>我们一开始就做好了</c>
<c.magenta>那就是没有加密</c>
411
00:22:57.711 --> 00:22:59.446
<c.magenta>所有的数据</c>
<c.magenta>都是以纯文本写成</c>
412
00:22:59.513 --> 00:23:02.616
<c.magenta>所有数据和元数据都是</c>
<c.magenta>以纯文本写入磁盘中的</c>
413
00:23:03.016 --> 00:23:05.853
<c.magenta>下一级别是</c>
<c.magenta>每个卷配有一个密钥</c>
414
00:23:06.420 --> 00:23:11.058
<c.magenta>所有敏感的元数据和数据</c>
<c.magenta>都是使用相同的密钥加密</c>
415
00:23:11.124 --> 00:23:14.194
<c.magenta>这基本上相当于全盘加密</c>
416
00:23:14.494 --> 00:23:18.031
<c.magenta>我们支持的最复杂级别</c>
<c.magenta>是多密钥加密</c>
417
00:23:18.398 --> 00:23:21.535
<c.magenta>这里 所有敏感的元数据是由</c>
418
00:23:22.135 --> 00:23:26.240
<c.magenta>单个密钥加密</c>
<c.magenta>密钥不同于用于加密</c>
419
00:23:26.306 --> 00:23:30.277
<c.magenta>单个文件的每文件密钥</c>
420
00:23:30.577 --> 00:23:33.547
<c.magenta>此外 由于快照和</c>
<c.magenta>克隆的工作原理</c>
421
00:23:33.714 --> 00:23:36.350
<c.magenta>APFS支持每盘区加密</c>
422
00:23:36.416 --> 00:23:40.053
<c.magenta>所以文件的每个区域</c>
<c.magenta>都可以使用自己的密钥加密</c>
423
00:23:40.487 --> 00:23:44.625
<c.magenta>这是独一无二的 而且没有</c>
<c.magenta>其他文件系统支持此类功能</c>
424
00:23:44.892 --> 00:23:47.661
<c.magenta>此外 这允许我们</c>
<c.magenta>统一我们的加密故事</c>
425
00:23:47.728 --> 00:23:49.596
<c.magenta>在我们所有的平台之间</c>
426
00:23:49.897 --> 00:23:52.432
<c.magenta>好了 之后我将交给Eric</c>
427
00:23:59.806 --> 00:24:01.708
<c.magenta>好了 现在我将快速展示</c>
428
00:24:01.775 --> 00:24:06.914
<c.magenta>WWDC 版macOS Sierra上的</c>
<c.magenta>Apple File System</c>
429
00:24:09.950 --> 00:24:14.221
<c.magenta>可能最简单最快速的试验</c>
<c.magenta>Apple File System的方法就是</c>
430
00:24:14.288 --> 00:24:16.790
<c.magenta>使用磁盘镜像</c>
<c.magenta>我们首先那样做</c>
431
00:24:17.824 --> 00:24:22.563
<c.magenta>你能看到在命令行上</c>
<c.magenta>输入了hdiutil create-fs APFS</c>
432
00:24:22.629 --> 00:24:25.666
<c.magenta>这会指定 给我创建</c>
<c.magenta>APFS类型的磁盘镜像</c>
433
00:24:26.033 --> 00:24:28.569
<c.magenta>我们指定大小</c>
<c.magenta>然后进行稀疏束</c>
434
00:24:28.802 --> 00:24:32.172
<c.magenta>这会出现警告</c>
<c.magenta>因为这是尚在开发中的项目</c>
435
00:24:32.239 --> 00:24:34.541
<c.magenta>我们希望你清楚</c>
436
00:24:34.608 --> 00:24:39.279
<c.magenta>你使用的东西目前</c>
<c.magenta>并非是100%完成的</c>
437
00:24:39.813 --> 00:24:42.816
<c.magenta>这时它会提醒我</c>
<c.magenta>我说是</c>
438
00:24:44.518 --> 00:24:47.654
<c.magenta>你这就创建出磁盘镜像了</c>
<c.magenta>如果我附加</c>
439
00:24:52.259 --> 00:24:55.395
<c.magenta>你可以在桌面上检查它</c>
<c.magenta>进行Get Info</c>
440
00:24:56.196 --> 00:24:59.366
<c.magenta>你能看到文件系统的类型</c>
<c.magenta>确实是APFS</c>
441
00:24:59.433 --> 00:25:01.502
<c.magenta>这可能是最简单的方式</c>
<c.magenta>如果你只想</c>
442
00:25:01.568 --> 00:25:04.137
<c.magenta>得出某个东西来尝试</c>
443
00:25:06.273 --> 00:25:08.775
<c.magenta>接下来 我想展示一些其他</c>
444
00:25:09.176 --> 00:25:12.379
<c.magenta>我们加入的更高级功能</c>
445
00:25:13.313 --> 00:25:14.314
<c.magenta>关上它</c>
446
00:25:15.082 --> 00:25:20.521
<c.magenta>这里我有两个优盘</c>
<c.magenta>它们只是普通的优盘</c>
447
00:25:20.587 --> 00:25:23.257
<c.magenta>你可以从任何</c>
<c.magenta>标准办公用品商店买到</c>
448
00:25:23.624 --> 00:25:24.625
<c.magenta>我插入一个</c>
449
00:25:24.691 --> 00:25:29.196
<c.magenta>其中一个是HFS+格式</c>
<c.magenta>另一个是Apple File System格式</c>
450
00:25:39.006 --> 00:25:41.708
<c.magenta>在这两个上面</c>
<c.magenta>都进行Get Info</c>
451
00:25:41.775 --> 00:25:44.945
<c.magenta>这样在操作过程中</c>
<c.magenta>你能看到空闲空间</c>
452
00:25:45.913 --> 00:25:51.718
<c.magenta>这个时候我有</c>
<c.magenta>意大利旅行的一些演示照片</c>
453
00:25:51.818 --> 00:25:57.024
<c.magenta>这两个的目录层级中</c>
<c.magenta>都有不少存储空间</c>
454
00:25:57.324 --> 00:26:00.527
<c.magenta>首先我们开始</c>
<c.magenta>复制HFS卷中的</c>
455
00:26:00.594 --> 00:26:04.731
<c.magenta>最新版iTunes</c>
<c.magenta>然后在APFS中也是同样</c>
456
00:26:04.798 --> 00:26:08.235
<c.magenta>开始复制 进行中</c>
457
00:26:08.635 --> 00:26:11.839
<c.magenta>你能看到这里的进程条</c>
<c.magenta>不过APFS已经完成了</c>
458
00:26:11.905 --> 00:26:13.574
<c.magenta>因为它在后台使用克隆</c>
459
00:26:13.640 --> 00:26:17.010
<c.magenta>Finder已经采用了</c>
<c.magenta>所有新的克隆行为</c>
460
00:26:17.077 --> 00:26:19.646
<c.magenta>所以如果你进行复制</c>
<c.magenta>Finder会自动替你</c>
461
00:26:19.713 --> 00:26:21.181
<c.magenta>在后台进行克隆</c>
462
00:26:21.515 --> 00:26:22.983
<c.magenta>然而HFS还没有完成</c>
463
00:26:27.621 --> 00:26:30.991
<c.magenta>好了 我可以用</c>
<c.magenta>演示照片做同样的事</c>
464
00:26:31.058 --> 00:26:33.727
<c.magenta>你在这里能看到</c>
<c.magenta>这里有几张照片</c>
465
00:26:33.794 --> 00:26:36.363
<c.magenta>它们全是几MB的大小</c>
466
00:26:37.764 --> 00:26:43.003
<c.magenta>注意这里的空闲空间</c>
<c.magenta>3.35GB空闲</c>
467
00:26:43.070 --> 00:26:47.040
<c.magenta>如果我进行复制</c>
<c.magenta>这实际上会替我克隆</c>
468
00:26:47.107 --> 00:26:50.677
<c.magenta>你会看到空闲空间</c>
<c.magenta>根本没有减小</c>
469
00:26:53.280 --> 00:26:56.984
<c.magenta>接下来</c>
<c.magenta>我将展示捕获快照</c>
470
00:26:59.086 --> 00:27:01.054
<c.magenta>这用叫做</c>
<c.magenta>SnapshotUtil的工具</c>
471
00:27:01.121 --> 00:27:05.692
<c.magenta>这会在公测版发布之后</c>
<c.magenta>供大家使用</c>
472
00:27:06.560 --> 00:27:08.362
<c.magenta>抱歉 这个要作为根运行</c>
473
00:27:11.932 --> 00:27:17.804
<c.magenta>好了 现在我创建了一个快照</c>
<c.magenta>我能用SnapshotUtil-s检查它</c>
474
00:27:23.544 --> 00:27:26.747
<c.magenta>你能看到</c>
<c.magenta>它现在识别出APFS_Snap</c>
475
00:27:27.047 --> 00:27:32.519
<c.magenta>我在这次演讲之前</c>
<c.magenta>创建了一个挂载点</c>
476
00:27:32.920 --> 00:27:36.857
<c.magenta>我会挂载这个时候的快照</c>
477
00:27:37.624 --> 00:27:40.460
<c.magenta>你能看到这个快照</c>
<c.magenta>出现在桌面上了</c>
478
00:27:40.527 --> 00:27:43.463
<c.magenta>这包含系统文件的只读视图</c>
479
00:27:43.530 --> 00:27:47.434
<c.magenta>与捕获快照时候的样子相同</c>
480
00:27:53.907 --> 00:27:57.511
<c.magenta>现在 在APFS卷中</c>
<c.magenta>我将创建一个临时文件</c>
481
00:27:59.346 --> 00:28:02.115
<c.magenta>大家好 我是临时文件</c>
482
00:28:03.016 --> 00:28:05.953
<c.magenta>保存 关闭</c>
<c.magenta>你能看到它在这里显示</c>
483
00:28:06.019 --> 00:28:09.456
<c.magenta>在APFS卷中</c>
<c.magenta>这是挂载的读写</c>
484
00:28:09.990 --> 00:28:11.892
<c.magenta>但在快照中不存在</c>
485
00:28:14.795 --> 00:28:19.600
<c.magenta>相应地 我还能删除</c>
<c.magenta>一些演示照片</c>
486
00:28:19.666 --> 00:28:22.669
<c.magenta>将它们移到垃圾箱 然后删除</c>
487
00:28:24.104 --> 00:28:26.473
<c.magenta>空闲空间实际上还是没有减小</c>
488
00:28:26.540 --> 00:28:31.044
<c.magenta>因为现在它们被</c>
<c.magenta>快照的存在所固定</c>
489
00:28:31.111 --> 00:28:36.116
<c.magenta>如果我想删除它们</c>
<c.magenta>我还要删除快照</c>
490
00:28:38.452 --> 00:28:43.257
<c.magenta>好了 这简短展示了Apple</c>
<c.magenta>File System的实际效果</c>
491
00:28:50.964 --> 00:28:53.100
<c.magenta>好了 我们来谈谈</c>
<c.magenta>一些新的API</c>
492
00:28:53.166 --> 00:28:55.502
<c.magenta>我们为支持Apple</c>
<c.magenta>File System而添加</c>
493
00:28:56.436 --> 00:28:59.873
<c.magenta>首先 我们预计可能</c>
<c.magenta>大家会熟悉这一个</c>
494
00:28:59.940 --> 00:29:02.676
<c.magenta>如果你使用Foundation</c>
<c.magenta>或FileManager</c>
495
00:29:02.743 --> 00:29:08.015
<c.magenta>这两者都得到Swift增强</c>
<c.magenta>如果你用copyItem或replaceItem</c>
496
00:29:08.148 --> 00:29:11.051
<c.magenta>它们会采用克隆或</c>
<c.magenta>安全存储语义</c>
497
00:29:11.118 --> 00:29:13.287
<c.magenta>我们刚才自动给你描述了</c>
498
00:29:13.353 --> 00:29:15.689
<c.magenta>你不需要做任何事</c>
<c.magenta>不费任何功夫</c>
499
00:29:15.756 --> 00:29:19.393
<c.magenta>它会自动弄清你使用的</c>
<c.magenta>文件系统是HFS+</c>
500
00:29:19.459 --> 00:29:23.230
<c.magenta>还是Apple File System</c>
<c.magenta>而且只有在合适时使用行为</c>
501
00:29:24.464 --> 00:29:27.901
<c.magenta>但是 如果你断定</c>
<c.magenta>Foundation或FileManager</c>
502
00:29:27.968 --> 00:29:29.403
<c.magenta>无法提供你所要的确切内容</c>
503
00:29:29.469 --> 00:29:33.340
<c.magenta>你可以到下面 我们有一个</c>
<c.magenta>叫做libcopyfile的库</c>
504
00:29:33.407 --> 00:29:36.376
<c.magenta>这个支持深层级的复制</c>
505
00:29:36.443 --> 00:29:38.111
<c.magenta>我们在有克隆功能之前</c>
506
00:29:38.178 --> 00:29:39.646
<c.magenta>已经用它很多年了</c>
507
00:29:40.047 --> 00:29:43.283
<c.magenta>复制文件支持新的位</c>
<c.magenta>叫做COPYFILE CLONE</c>
508
00:29:43.350 --> 00:29:46.987
<c.magenta>这与其下方的</c>
<c.magenta>5或6个位相同</c>
509
00:29:47.254 --> 00:29:48.655
<c.magenta>我们决定将其选择性加入</c>
510
00:29:48.722 --> 00:29:51.458
<c.magenta>因为如果你使用</c>
<c.magenta>像这样的专门库</c>
511
00:29:51.825 --> 00:29:54.695
<c.magenta>你未必想要ACL和扩展属性</c>
512
00:29:54.761 --> 00:29:57.931
<c.magenta>以及剩下的内容</c>
<c.magenta>完完全全地复制过来</c>
513
00:29:58.699 --> 00:30:01.568
<c.magenta>而克隆会隐式地</c>
<c.magenta>复制所有那些东西</c>
514
00:30:01.635 --> 00:30:05.572
<c.magenta>这个库也会自动</c>
<c.magenta>为你调用克隆</c>
515
00:30:05.639 --> 00:30:07.508
<c.magenta>如果后端文件系统支持</c>
516
00:30:07.574 --> 00:30:09.943
<c.magenta>如果不支持 那它就会</c>
<c.magenta>继续像往常一样运行</c>
517
00:30:11.411 --> 00:30:13.347
<c.magenta>这些就是新的安全存储API</c>
518
00:30:13.413 --> 00:30:17.584
<c.magenta>renamex Np和renameatx Np</c>
<c.magenta>是新的系统调用</c>
519
00:30:17.651 --> 00:30:20.254
<c.magenta>支持安全存储基元</c>
520
00:30:20.787 --> 00:30:24.224
<c.magenta>你可以在Man Pages上使用</c>
<c.magenta>在macOS Sierra版本中</c>
521
00:30:24.291 --> 00:30:26.994
<c.magenta>如果你想去看一下Man Page</c>
<c.magenta>它们就在这里</c>
522
00:30:27.561 --> 00:30:29.663
<c.magenta>这些也是克隆API</c>
523
00:30:29.730 --> 00:30:34.234
<c.magenta>所以克隆文件及其变体</c>
<c.magenta>支持克隆文件和目录</c>
524
00:30:35.836 --> 00:30:38.972
<c.magenta>说一下兼容性</c>
<c.magenta>我们认为最简单的方式</c>
525
00:30:39.039 --> 00:30:44.278
<c.magenta>访问Apple File System镜像</c>
<c.magenta>就是使用我给你展示的hdiutil</c>
526
00:30:44.411 --> 00:30:45.913
<c.magenta>目前只在macOS Sierra上的</c>
527
00:30:45.979 --> 00:30:49.316
<c.magenta>命令行中可用</c>
<c.magenta>作为开发者预览版技术</c>
528
00:30:49.383 --> 00:30:53.353
<c.magenta>还并未特意地完全</c>
<c.magenta>为Disk Utility做优化</c>
529
00:30:54.054 --> 00:30:58.358
<c.magenta>所以最快的方法是使用</c>
<c.magenta>hdiutil create-fs APFS</c>
530
00:30:58.425 --> 00:31:00.627
<c.magenta>你可以得到磁盘镜像</c>
<c.magenta>然后附加它</c>
531
00:31:01.461 --> 00:31:05.699
<c.magenta>你还可用diskutil APFS</c>
<c.magenta>增加容器</c>
532
00:31:05.766 --> 00:31:08.268
<c.magenta>创建容器</c>
<c.magenta>添加卷 删除卷</c>
533
00:31:09.002 --> 00:31:13.006
<c.magenta>任何你想对容器</c>
<c.magenta>本身进行的低级操作</c>
534
00:31:13.640 --> 00:31:17.211
<c.magenta>最后 我们还有FS检查</c>
<c.magenta>这是我们在研发的功能</c>
535
00:31:17.277 --> 00:31:20.280
<c.magenta>这个能够验证文件系统</c>
536
00:31:20.347 --> 00:31:21.815
<c.magenta>也可以进行修复</c>
537
00:31:21.982 --> 00:31:24.251
<c.magenta>所以还会继续开发该功能</c>
538
00:31:25.853 --> 00:31:30.224
<c.magenta>macOS Sierra中</c>
<c.magenta>APFS上目前的一些限制</c>
539
00:31:31.124 --> 00:31:32.860
<c.magenta>这只会在数据卷上支持</c>
540
00:31:32.926 --> 00:31:35.829
<c.magenta>现在不支持从Apple</c>
<c.magenta>File System启动</c>
541
00:31:36.997 --> 00:31:41.201
<c.magenta>现在Apple File</c>
<c.magenta>System不支持“时间机器”备份</c>
542
00:31:42.569 --> 00:31:45.572
<c.magenta>FileVault和Fusion Drive</c>
<c.magenta>支持还尚需等待</c>
543
00:31:47.074 --> 00:31:50.177
<c.magenta>当前的卷格式</c>
<c.magenta>只能是区分大小写的</c>
544
00:31:50.244 --> 00:31:53.547
<c.magenta>如果你不确定你的程序</c>
<c.magenta>是否需要不区分大小写</c>
545
00:31:53.814 --> 00:31:57.050
<c.magenta>请试一下</c>
<c.magenta>创建磁盘镜像或设置在</c>
546
00:31:57.117 --> 00:32:01.522
<c.magenta>Mac上的分区里</c>
<c.magenta>试着证实它并将你的应用</c>
547
00:32:01.588 --> 00:32:05.359
<c.magenta>在Apple File System中运行</c>
<c.magenta>然后告诉我们它的效果</c>
548
00:32:07.461 --> 00:32:09.229
<c.magenta>其他对兼容性的备注</c>
549
00:32:09.596 --> 00:32:12.999
<c.magenta>Apple File System</c>
<c.magenta>无法通过AFP分享</c>
550
00:32:13.066 --> 00:32:17.871
<c.magenta>如果你想使用文件分享</c>
<c.magenta>我们建议你使用SMB代替</c>
551
00:32:18.705 --> 00:32:21.808
<c.magenta>作为未来首选的文件分享机制</c>
552
00:32:22.342 --> 00:32:24.478
<c.magenta>OS X Yosemite</c>
<c.magenta>或更早版本</c>
553
00:32:24.545 --> 00:32:26.680
<c.magenta>将无法识别Apple</c>
<c.magenta>File System卷</c>
554
00:32:26.747 --> 00:32:29.082
<c.magenta>所以请不要把Apple</c>
<c.magenta>File System实例</c>
555
00:32:29.149 --> 00:32:31.952
<c.magenta>带回到OS X Yosemite</c>
<c.magenta>或更早版本</c>
556
00:32:32.019 --> 00:32:36.690
<c.magenta>你必定会碰到</c>
<c.magenta>你不想回应的对话</c>
557
00:32:37.824 --> 00:32:43.397
<c.magenta>所以macOS Sierra</c>
<c.magenta>会有开发者预览版的</c>
558
00:32:43.463 --> 00:32:45.165
<c.magenta>Apple File System</c>
559
00:32:45.566 --> 00:32:47.935
<c.magenta>这会是开发者预览版技术</c>
560
00:32:48.001 --> 00:32:52.472
<c.magenta>一旦macOS Sierra</c>
<c.magenta>于今秋发布</c>
561
00:32:53.307 --> 00:32:55.909
<c.magenta>现在你可能会好奇</c>
<c.magenta>我们有什么样的推出计划</c>
562
00:32:55.976 --> 00:32:59.980
<c.magenta>各位如何在你们设备上获取Apple</c>
<c.magenta>File System?</c>
563
00:33:01.315 --> 00:33:02.416
<c.magenta>我们会讨论这个的</c>
564
00:33:03.517 --> 00:33:04.952
<c.magenta>升级到Apple File System</c>
565
00:33:05.018 --> 00:33:07.354
<c.magenta>你想要这些我们展示过的</c>
<c.magenta>出色的新功能</c>
566
00:33:07.421 --> 00:33:08.388
<c.magenta>那你怎样获得它们?</c>
567
00:33:08.822 --> 00:33:11.758
<c.magenta>一个可能方法是</c>
<c.magenta>要求所有人</c>
568
00:33:11.825 --> 00:33:14.628
<c.magenta>所有用户备份系统</c>
<c.magenta>保存起来</c>
569
00:33:14.695 --> 00:33:16.563
<c.magenta>确保所有东西都绝对安全</c>
570
00:33:16.630 --> 00:33:18.799
<c.magenta>然后擦除卷</c>
<c.magenta>擦除设备</c>
571
00:33:18.866 --> 00:33:21.969
<c.magenta>还原 放入新的OS</c>
<c.magenta>然后从备份中还原</c>
572
00:33:22.035 --> 00:33:23.904
<c.magenta>这个过程会花数小时</c>
573
00:33:23.971 --> 00:33:25.806
<c.magenta>然后期盼所有东西</c>
<c.magenta>在还原后</c>
574
00:33:25.873 --> 00:33:27.140
<c.magenta>都完好如初</c>
575
00:33:27.541 --> 00:33:28.709
<c.magenta>我们不会这样做</c>
576
00:33:29.276 --> 00:33:32.579
<c.magenta>相反 Apple会提供</c>
<c.magenta>就地升级路径</c>
577
00:33:32.646 --> 00:33:35.649
<c.magenta>从HFS+</c>
<c.magenta>到Apple File System</c>
578
00:33:41.355 --> 00:33:44.958
<c.magenta>在此期间 用户数据</c>
<c.magenta>仍保持在其原来位置</c>
579
00:33:45.259 --> 00:33:49.062
<c.magenta>Apple会将崭新的APFS元数据</c>
580
00:33:49.129 --> 00:33:54.668
<c.magenta>写入HPF+空闲空间</c>
<c.magenta>我们这么做是为了死机防护</c>
581
00:33:55.269 --> 00:33:59.239
<c.magenta>这个操作可能会耗时</c>
<c.magenta>几秒或者几分钟</c>
582
00:33:59.806 --> 00:34:02.809
<c.magenta>在这段期间</c>
<c.magenta>如果设备断电 死机</c>
583
00:34:02.876 --> 00:34:05.479
<c.magenta>任何发生的糟糕事情</c>
<c.magenta>我们想要设备上的数据</c>
584
00:34:05.546 --> 00:34:08.114
<c.magenta>安然无恙</c>
<c.magenta>仿佛什么都未发生过一样</c>
585
00:34:08.482 --> 00:34:13.120
<c.magenta>所以Apple File System Converter</c>
<c.magenta>会尽可能以原子级别执行操作</c>
586
00:34:13.187 --> 00:34:14.855
<c.magenta>这不是完全瞬时完成的</c>
587
00:34:14.922 --> 00:34:16.822
<c.magenta>但随着操作持续进行</c>
588
00:34:16.889 --> 00:34:17.958
<c.magenta>如果设备死机</c>
589
00:34:18.225 --> 00:34:23.429
<c.magenta>我们的打算是</c>
<c.magenta>使其完好如初 归于原样</c>
590
00:34:24.231 --> 00:34:29.735
<c.magenta>Apple File System 将于2017年</c>
<c.magenta>在所有设备上以默认程序发布</c>
591
00:34:37.311 --> 00:34:38.411
<c.magenta>总而言之</c>
592
00:34:40.047 --> 00:34:42.081
<c.magenta>Apple File System</c>
<c.magenta>会是默认的文件系统</c>
593
00:34:42.149 --> 00:34:44.384
<c.magenta>用于2017年的</c>
<c.magenta>所有Apple产品</c>
594
00:34:45.118 --> 00:34:49.188
<c.magenta>它超现代 有死机防护</c>
<c.magenta>支持空间分享</c>
595
00:34:50.224 --> 00:34:53.793
<c.magenta>我们支持克隆和快照</c>
<c.magenta>增强的数据安全功能</c>
596
00:34:53.860 --> 00:34:57.197
<c.magenta>像我们刚刚讨论的</c>
<c.magenta>多密钥加密</c>
597
00:34:59.132 --> 00:35:01.201
<c.magenta>它也专门优化和设计</c>
598
00:35:01.268 --> 00:35:03.804
<c.magenta>用于我们所有设备里的</c>
<c.magenta>Apple生态系统</c>
599
00:35:05.439 --> 00:35:07.975
<c.magenta>你可以得到更多关于</c>
<c.magenta>Apple File System的信息</c>
600
00:35:08.041 --> 00:35:09.776
<c.magenta>在我身后的URL中</c>
601
00:35:10.344 --> 00:35:13.514
<c.magenta>那里会有开发者指南</c>
<c.magenta>以及一些示例代码</c>
602
00:35:13.580 --> 00:35:17.784
<c.magenta>这样你可以看到</c>
<c.magenta>克隆文件和目录的实际演示</c>
603
00:35:19.653 --> 00:35:22.189
<c.magenta>给在座各位说一些要点</c>
604
00:35:22.256 --> 00:35:26.093
<c.magenta>Apple File System</c>
<c.magenta>即将到来 2017年将在转眼间来临</c>
605
00:35:26.994 --> 00:35:29.763
<c.magenta>我想请大家将你们的应用</c>
<c.magenta>在Apple File System上测试</c>
606
00:35:29.830 --> 00:35:32.599
<c.magenta>用你们昨天获得的macOS版本</c>
607
00:35:32.999 --> 00:35:35.068
<c.magenta>试着在Apple File System上</c>
<c.magenta>运行你们的应用</c>
608
00:35:35.135 --> 00:35:38.305
<c.magenta>请告诉我们这一过程的进展如何</c>
609
00:35:38.972 --> 00:35:41.875
<c.magenta>如果你要报告任何错误</c>
<c.magenta>请使用Bug Reporter报告</c>
610
00:35:41.942 --> 00:35:44.178
<c.magenta>通过传统的手段</c>
<c.magenta>这样我们可以调查</c>
611
00:35:44.244 --> 00:35:47.281
<c.magenta>我们都希望大家会</c>
<c.magenta>像我们一样喜欢它</c>
612
00:35:49.283 --> 00:35:52.019
<c.magenta>还有一些相关演讲</c>
613
00:35:52.085 --> 00:35:54.888
<c.magenta>如果你有兴趣学习</c>
<c.magenta>更多关于安全功能的内容</c>
614
00:35:54.955 --> 00:35:57.024
<c.magenta>在我们的平台上</c>
<c.magenta>特别是iOS</c>
615
00:35:57.758 --> 00:36:01.428
<c.magenta>我们建议你可以看看</c>
<c.magenta>iOS Security实际工作原理</c>
616
00:36:01.495 --> 00:36:04.331
<c.magenta>将于今天4点钟</c>
<c.magenta>在本会议厅开始</c>
617
00:36:04.731 --> 00:36:06.700
<c.magenta>至此 这就是</c>
<c.magenta>Apple File System</c>
618
00:36:06.767 --> 00:36:08.635
<c.magenta>我们迫不及待想知道</c>
<c.magenta>各位会如何使用它</c>
| {
"pile_set_name": "Github"
} |
log4j.rootLogger=debug, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n | {
"pile_set_name": "Github"
} |
package simpleipsvcd
import (
"net"
"time"
"github.com/HouzuoGuo/laitos/lalog"
"github.com/HouzuoGuo/laitos/misc"
)
// TCPService implements common.TCPApp interface for a simple IP service.
type TCPService struct {
// ResponseFun is a function returning a string as the entire response to a simple IP service request.
ResponseFun func() string
}
// GetTCPStatsCollector returns the stats collector that counts and times client connections for the TCP application.
func (svc *TCPService) GetTCPStatsCollector() *misc.Stats {
return misc.SimpleIPStatsTCP
}
// HandleTCPConnection
func (svc *TCPService) HandleTCPConnection(logger lalog.Logger, _ string, client *net.TCPConn) {
logger.MaybeMinorError(client.SetWriteDeadline(time.Now().Add(IOTimeoutSec * time.Second)))
_, err := client.Write([]byte(svc.ResponseFun() + "\r\n"))
logger.MaybeMinorError(err)
}
// UDPService implements common.UDPApp interface for a simple IP service.
type UDPService struct {
// ResponseFun is a function returning a string as the entire response to a simple IP service request.
ResponseFun func() string
}
// GetUDPStatsCollector returns the stats collector that counts and times client connections for the TCP application.
func (svc *UDPService) GetUDPStatsCollector() *misc.Stats {
return misc.SimpleIPStatsUDP
}
// HandleTCPConnection
func (svc *UDPService) HandleUDPClient(logger lalog.Logger, _ string, client *net.UDPAddr, _ []byte, srv *net.UDPConn) {
logger.MaybeMinorError(srv.SetWriteDeadline(time.Now().Add(IOTimeoutSec * time.Second)))
_, err := srv.WriteToUDP([]byte(svc.ResponseFun()+"\r\n"), client)
logger.MaybeMinorError(err)
}
| {
"pile_set_name": "Github"
} |
from .base import SimpleService
class OpenVPNServerService(SimpleService):
name = "openvpn_server"
etc = ["ssl", "openvpn_server"]
freebsd_rc = "openvpn_server"
freebsd_pidfile = "/var/run/openvpn_server.pid"
freebsd_procname = "openvpn"
systemd_unit = "openvpn@server"
| {
"pile_set_name": "Github"
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#FFF" android:pathData="M8,5.14V19.14L19,12.14L8,5.14Z" />
</vector> | {
"pile_set_name": "Github"
} |
{
"nome": "San Pier d'Isonzo",
"codice": "031021",
"zona": {
"codice": "2",
"nome": "Nord-est"
},
"regione": {
"codice": "06",
"nome": "Friuli-Venezia Giulia"
},
"provincia": {
"codice": "031",
"nome": "Gorizia"
},
"sigla": "GO",
"codiceCatastale": "I082",
"cap": [
"34070"
],
"popolazione": 2019
}
| {
"pile_set_name": "Github"
} |
import { should } from 'chai';
import { expect } from 'chai';
should();
import {
random,
radians,
degrees,
clamp,
normalizedRandom,
lerp
} from '../src/Utils';
describe('Utils', function () {
describe('random()', function () {
it('should return a random value', function () {
random().should.be.a('number');
});
it('should return a random value between 1 and 10', function () {
for (let i = 0; i < 5; i++) {
expect(random(1, 10)).to.below(10).above(1);
}
});
it('should return a random value between negative -100 and 100', function () {
for (let i = 0; i < 5; i++) {
expect(random(-100, 100)).to.below(100).above(-100);
}
});
});
describe('radians()', function () {
it('should return a number', function () {
radians(10).should.be.a('number');
});
it('should convert degrees to radians', function () {
expect(radians(30)).to.be.closeTo(0.523599, 0.1);
expect(radians(90)).to.be.closeTo(1.5708, 0.1);
expect(radians(180)).to.be.closeTo(3.14159, 0.1);
});
});
describe('degrees()', function () {
it('should return a number', function () {
degrees(10).should.be.a('number');
});
it('should convert radians to degrees', function () {
expect(degrees(0.523599)).to.be.closeTo(30, 0.1);
expect(degrees(1.5708)).to.be.closeTo(90, 0.1);
expect(degrees(3.14159)).to.be.closeTo(180, 0.1);
});
});
describe('clamp()', function () {
it('should return a number', function () {
clamp(10).should.be.a('number');
});
it('should clamp the value between some limits', function () {
expect(clamp(0, 100, 1000)).to.below(999).above(99);
expect(clamp(0, -1000, 100)).to.below(99).above(-999);
expect(clamp(0, 150, 650)).to.below(649).above(149);
});
});
}); | {
"pile_set_name": "Github"
} |
// Copyright 2018 The Chubao 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 cmd
import (
"fmt"
"github.com/chubaofs/chubaofs/proto"
"github.com/chubaofs/chubaofs/sdk/master"
"github.com/spf13/cobra"
"sort"
"strconv"
)
const (
cmdDataPartitionUse = "datapartition [COMMAND]"
cmdDataPartitionShort = "Manage data partition"
)
func newDataPartitionCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: cmdDataPartitionUse,
Short: cmdDataPartitionShort,
}
cmd.AddCommand(
newDataPartitionGetCmd(client),
newListCorruptDataPartitionCmd(client),
newDataPartitionDecommissionCmd(client),
newDataPartitionReplicateCmd(client),
newDataPartitionDeleteReplicaCmd(client),
)
return cmd
}
const (
cmdDataPartitionGetShort = "Display detail information of a data partition"
cmdCheckCorruptDataPartitionShort = "Check and list unhealthy data partitions"
cmdDataPartitionDecommissionShort = "Decommission a replication of the data partition to a new address"
cmdDataPartitionReplicateShort = "Add a replication of the data partition on a new address"
cmdDataPartitionDeleteReplicaShort = "Delete a replication of the data partition on a fixed address"
)
func newDataPartitionGetCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: CliOpInfo + " [DATA PARTITION ID]",
Short: cmdDataPartitionGetShort,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
var (
err error
partitionID uint64
partition *proto.DataPartitionInfo
)
defer func() {
if err != nil {
errout("Error: %v", err)
}
}()
if partitionID, err = strconv.ParseUint(args[0], 10, 64); err != nil {
return
}
if partition, err = client.AdminAPI().GetDataPartition("", partitionID); err != nil {
return
}
stdout(formatDataPartitionInfo(partition))
},
}
return cmd
}
func newListCorruptDataPartitionCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: CliOpCheck,
Short: cmdCheckCorruptDataPartitionShort,
Long: `If the data nodes are marked as "Inactive", it means the nodes has been not available for a time. It is suggested to
eliminate the network, disk or other problems first. Once the bad nodes can never be "active", they are called corrupt
nodes. The "decommission" command can be used to discard the corrupt nodes. However, if more than half replicas of
a partition are on the corrupt nodes, the few remaining replicas can not reach an agreement with one leader. In this case,
you can use the "reset" command to fix the problem.The "reset" command may lead to data loss, be careful to do this.
The "reset" command will be released in next version`,
Run: func(cmd *cobra.Command, args []string) {
var (
diagnosis *proto.DataPartitionDiagnosis
dataNodes []*proto.DataNodeInfo
err error
)
defer func() {
if err != nil {
errout("Error: %v", err)
}
}()
if diagnosis, err = client.AdminAPI().DiagnoseDataPartition(); err != nil {
return
}
stdout("[Inactive Data nodes]:\n")
stdout("%v\n", formatDataNodeDetailTableHeader())
for _, addr := range diagnosis.InactiveDataNodes {
var node *proto.DataNodeInfo
if node, err = client.NodeAPI().GetDataNode(addr); err != nil {
return
}
dataNodes = append(dataNodes, node)
}
sort.SliceStable(dataNodes, func(i, j int) bool {
return dataNodes[i].ID < dataNodes[j].ID
})
for _, node := range dataNodes {
stdout("%v\n", formatDataNodeDetail(node, true))
}
stdout("\n")
stdout("[Corrupt data partitions](no leader):\n")
stdout("%v\n", partitionInfoTableHeader)
sort.SliceStable(diagnosis.CorruptDataPartitionIDs, func(i, j int) bool {
return diagnosis.CorruptDataPartitionIDs[i] < diagnosis.CorruptDataPartitionIDs[j]
})
for _, pid := range diagnosis.CorruptDataPartitionIDs {
var partition *proto.DataPartitionInfo
if partition, err = client.AdminAPI().GetDataPartition("", pid); err != nil {
err = fmt.Errorf("Partition not found, err:[%v] ", err)
return
}
stdout("%v\n", formatDataPartitionInfoRow(partition))
}
stdout("\n")
stdout("%v\n", "[Partition lack replicas]:")
stdout("%v\n", partitionInfoTableHeader)
sort.SliceStable(diagnosis.LackReplicaDataPartitionIDs, func(i, j int) bool {
return diagnosis.LackReplicaDataPartitionIDs[i] < diagnosis.LackReplicaDataPartitionIDs[j]
})
for _, pid := range diagnosis.LackReplicaDataPartitionIDs {
var partition *proto.DataPartitionInfo
if partition, err = client.AdminAPI().GetDataPartition("", pid); err != nil {
err = fmt.Errorf("Partition not found, err:[%v] ", err)
return
}
if partition != nil {
stdout("%v\n", formatDataPartitionInfoRow(partition))
}
}
stdout("\n")
stdout("%v\n", "[Bad data partitions(decommission not completed)]:")
badPartitionTablePattern := "%-8v %-10v\n"
stdout(badPartitionTablePattern, "PATH", "PARTITION ID")
for _, bdpv := range diagnosis.BadDataPartitionIDs {
sort.SliceStable(bdpv.PartitionIDs, func(i, j int) bool {
return bdpv.PartitionIDs[i] < bdpv.PartitionIDs[j]
})
for _, pid := range bdpv.PartitionIDs {
stdout(badPartitionTablePattern, bdpv.Path, pid)
}
}
return
},
}
return cmd
}
func newDataPartitionDecommissionCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: CliOpDecommission + " [ADDRESS] [DATA PARTITION ID]",
Short: cmdDataPartitionDecommissionShort,
Args: cobra.MinimumNArgs(2),
Run: func(cmd *cobra.Command, args []string) {
var (
err error
partitionID uint64
)
defer func() {
if err != nil {
errout("Error: %v", err)
}
}()
address := args[0]
partitionID, err = strconv.ParseUint(args[1], 10, 64)
if err != nil {
return
}
if err = client.AdminAPI().DecommissionDataPartition(partitionID, address); err != nil {
return
}
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return validDataNodes(client, toComplete), cobra.ShellCompDirectiveNoFileComp
},
}
return cmd
}
func newDataPartitionReplicateCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: CliOpReplicate + " [ADDRESS] [DATA PARTITION ID]",
Short: cmdDataPartitionReplicateShort,
Args: cobra.MinimumNArgs(2),
Run: func(cmd *cobra.Command, args []string) {
var (
err error
partitionID uint64
)
defer func() {
if err != nil {
errout("Error: %v", err)
}
}()
address := args[0]
if partitionID, err = strconv.ParseUint(args[1], 10, 64); err != nil {
return
}
if err = client.AdminAPI().AddDataReplica(partitionID, address); err != nil {
return
}
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return validDataNodes(client, toComplete), cobra.ShellCompDirectiveNoFileComp
},
}
return cmd
}
func newDataPartitionDeleteReplicaCmd(client *master.MasterClient) *cobra.Command {
var cmd = &cobra.Command{
Use: CliOpDelReplica + " [ADDRESS] [DATA PARTITION ID]",
Short: cmdDataPartitionDeleteReplicaShort,
Args: cobra.MinimumNArgs(2),
Run: func(cmd *cobra.Command, args []string) {
var (
err error
partitionID uint64
)
defer func() {
if err != nil {
errout("Error: %v", err)
}
}()
address := args[0]
if partitionID, err = strconv.ParseUint(args[1], 10, 64); err != nil {
return
}
if err = client.AdminAPI().DeleteDataReplica(partitionID, address); err != nil {
return
}
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return nil, cobra.ShellCompDirectiveNoFileComp
}
return validDataNodes(client, toComplete), cobra.ShellCompDirectiveNoFileComp
},
}
return cmd
}
| {
"pile_set_name": "Github"
} |
/**********************************************************************************************************************
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# * Redistributions of code must retain the copyright notice, this list of conditions and the following disclaimer.
# * Neither the name of NVIDIA CORPORATION nor the names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
# SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************************************************************/
#include "SimpleToneMappingPass.h"
SimpleToneMappingPass::SimpleToneMappingPass(const std::string &inBuf, const std::string &outBuf)
: mInChannel(inBuf), mOutChannel(outBuf), ::RenderPass("Simple Tone Mapping", "Tone Mapping Options")
{
}
bool SimpleToneMappingPass::initialize(RenderContext* pRenderContext, ResourceManager::SharedPtr pResManager)
{
if (!pResManager) return false;
// Stash our resource manager; ask for the texture the developer asked us to accumulate
mpResManager = pResManager;
mpResManager->requestTextureResource(mInChannel);
mpResManager->requestTextureResource(mOutChannel);
// The Falcor tonemapper can screw with DX pipeline state, so we'll want to create a disposible state object.
mpGfxState = GraphicsState::create();
// Falcor has a built-in utility for tonemapping. Initialize that
mpToneMapper = ToneMapping::create(ToneMapping::Operator::Clamp);
return true;
}
void SimpleToneMappingPass::renderGui(Gui* pGui)
{
// Let the Falcor tonemapper put it's UI in an appropriate spot
mpToneMapper->renderUI(pGui, nullptr);
}
void SimpleToneMappingPass::execute(RenderContext* pRenderContext)
{
if (!mpResManager) return;
// Probably should do this once outside the main render loop.
Texture::SharedPtr srcTex = mpResManager->getTexture( mInChannel );
Fbo::SharedPtr dstFbo = mpResManager->createManagedFbo({ mOutChannel });
// Execute our tone mapping pass
pRenderContext->pushGraphicsState(mpGfxState);
mpToneMapper->execute(pRenderContext, srcTex, dstFbo);
pRenderContext->popGraphicsState();
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/ruby
x,y=gets.split.map(&:to_i)
w=[0,3,16,34,55,80,108,139,172,208,245,285,327].take_while{|e|(y+3)/6>=e}.size-1
puts (w==0?'C':['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW'][(x+112)%3600/225])+" #{w}" | {
"pile_set_name": "Github"
} |
/* tslint:disable */
import { ConcreteRequest } from "relay-runtime";
import { FragmentRefs } from "relay-runtime";
export type RequestConditionReportQueryVariables = {
artworkID: string;
};
export type RequestConditionReportQueryResponse = {
readonly me: {
readonly " $fragmentRefs": FragmentRefs<"RequestConditionReport_me">;
} | null;
readonly artwork: {
readonly " $fragmentRefs": FragmentRefs<"RequestConditionReport_artwork">;
} | null;
};
export type RequestConditionReportQuery = {
readonly response: RequestConditionReportQueryResponse;
readonly variables: RequestConditionReportQueryVariables;
};
/*
query RequestConditionReportQuery(
$artworkID: String!
) {
me {
...RequestConditionReport_me
id
}
artwork(id: $artworkID) {
...RequestConditionReport_artwork
id
}
}
fragment RequestConditionReport_me on Me {
email
internalID
}
fragment RequestConditionReport_artwork on Artwork {
internalID
slug
saleArtwork {
internalID
id
}
}
*/
const node: ConcreteRequest = (function(){
var v0 = [
{
"kind": "LocalArgument",
"name": "artworkID",
"type": "String!",
"defaultValue": null
}
],
v1 = [
{
"kind": "Variable",
"name": "id",
"variableName": "artworkID"
}
],
v2 = {
"kind": "ScalarField",
"alias": null,
"name": "internalID",
"args": null,
"storageKey": null
},
v3 = {
"kind": "ScalarField",
"alias": null,
"name": "id",
"args": null,
"storageKey": null
};
return {
"kind": "Request",
"fragment": {
"kind": "Fragment",
"name": "RequestConditionReportQuery",
"type": "Query",
"metadata": null,
"argumentDefinitions": (v0/*: any*/),
"selections": [
{
"kind": "LinkedField",
"alias": null,
"name": "me",
"storageKey": null,
"args": null,
"concreteType": "Me",
"plural": false,
"selections": [
{
"kind": "FragmentSpread",
"name": "RequestConditionReport_me",
"args": null
}
]
},
{
"kind": "LinkedField",
"alias": null,
"name": "artwork",
"storageKey": null,
"args": (v1/*: any*/),
"concreteType": "Artwork",
"plural": false,
"selections": [
{
"kind": "FragmentSpread",
"name": "RequestConditionReport_artwork",
"args": null
}
]
}
]
},
"operation": {
"kind": "Operation",
"name": "RequestConditionReportQuery",
"argumentDefinitions": (v0/*: any*/),
"selections": [
{
"kind": "LinkedField",
"alias": null,
"name": "me",
"storageKey": null,
"args": null,
"concreteType": "Me",
"plural": false,
"selections": [
{
"kind": "ScalarField",
"alias": null,
"name": "email",
"args": null,
"storageKey": null
},
(v2/*: any*/),
(v3/*: any*/)
]
},
{
"kind": "LinkedField",
"alias": null,
"name": "artwork",
"storageKey": null,
"args": (v1/*: any*/),
"concreteType": "Artwork",
"plural": false,
"selections": [
(v2/*: any*/),
{
"kind": "ScalarField",
"alias": null,
"name": "slug",
"args": null,
"storageKey": null
},
{
"kind": "LinkedField",
"alias": null,
"name": "saleArtwork",
"storageKey": null,
"args": null,
"concreteType": "SaleArtwork",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/)
]
},
(v3/*: any*/)
]
}
]
},
"params": {
"operationKind": "query",
"name": "RequestConditionReportQuery",
"id": "c4071a0d7c31ccc4a1c6ceba9bda34ce",
"text": null,
"metadata": {}
}
};
})();
(node as any).hash = '0d2ee5d88aac80c1d2e6a2b1fd592924';
export default node;
| {
"pile_set_name": "Github"
} |
class Solution(object):
def maxNumber(self, nums1, nums2, k):
"""
:type nums1: List[int]
:type nums2: List[int]
:type k: int
:rtype: List[int]
"""
if k==0: return []
triples = []
if len(nums2)>=k-1:
candidates1 = nums1
else:
reserve = k-1-len(nums2)
candidates1 = nums1[:-reserve]
for i,c in enumerate(candidates1):
triples.append((0, i, c))
if len(nums1)>=k-1:
candidates2 = nums2
else:
reserve = k-1-len(nums1)
candidates2 = nums2[:-reserve]
for i,c in enumerate(candidates2):
triples.append((1, i, c))
maxitems = []
maxv = -1
for tag, idx, v in triples:
if v>maxv:
maxv = v
maxitems = [(tag, idx, v)]
elif v==maxv:
maxitems.append((tag, idx, v))
maxresult = None
for tag, idx, v in maxitems:
if tag==0:
result = self.maxNumber(nums1[idx+1:], nums2, k-1)
else:
result = self.maxNumber(nums1, nums2[idx+1:], k-1)
if maxresult is None:
maxresult = result
elif len(maxresult)>0:
i = 0
while i<len(maxresult) and maxresult[i]==result[i]:
i+=1
if i<len(maxresult) and maxresult[i]<result[i]:
maxresult = result
return [maxv] + maxresult
| {
"pile_set_name": "Github"
} |
#!/usr/bin/perl
#
# read each line from each HTML file on command-line
# looking for table of contents. print only the ToC
# with substitutions for an external outline jump table.
$intoc = 0;
$title = "";
while (<>) {
if ($intoc) {
s/<a href="\#/<a href="$ARGV\#/g;
print;
if (m:^ </ul>:o) {
$intoc = 0;
}
}
else {
if (/^ <p class="title">([^<]*)</o) {
$title = $1;
}
elsif (/<a href="#rfc\.toc">Table of Contents/o) {
print "\n<h2><a href=\"$ARGV\">$title</a></h2>\n";
$intoc = 1;
$title = "";
}
}
}
| {
"pile_set_name": "Github"
} |
config BR2_PACKAGE_QT5MULTIMEDIA
bool "qt5multimedia"
select BR2_PACKAGE_QT5BASE
select BR2_PACKAGE_QT5BASE_GUI
select BR2_PACKAGE_QT5BASE_NETWORK
select BR2_PACKAGE_QT5BASE_OPENGL_LIB if BR2_PACKAGE_QT5BASE_OPENGL
help
Qt is a cross-platform application and UI framework for
developers using C++.
The Qt Multimedia module provides a rich feature set that
enables you to easily take advantage of a platform's
multimedia capabilities such as media playback and the use
of camera and radio devices.
http://doc.qt.io/qt-5/multimediaoverview.html
| {
"pile_set_name": "Github"
} |
//! Functions and structures for defining and activating function hooks
use crate::backend::Backend;
use crate::demangling;
use crate::error::*;
use crate::hooks;
use crate::return_value::*;
use crate::state::State;
use either::Either;
use llvm_ir::function::{CallingConvention, FunctionAttribute, ParameterAttribute};
use llvm_ir::types::Typed;
use llvm_ir::{instruction::InlineAssembly, Name, Operand, Type};
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
use std::rc::Rc;
/// A set of function hooks, which will be executed instead of their respective
/// hooked functions if/when the symbolic execution engine encounters a call to
/// one of those hooked functions.
///
/// You can hook internal functions (which are defined in some available LLVM
/// `Module`), external functions (e.g., calls to external libraries), LLVM
/// intrinsics, or any other kind of function.
///
/// The function resolution process is as follows:
///
/// (1) If the function is hooked, then the hook will be used instead of any
/// other option. That is, the hook has the highest precedence.
///
/// (2) Haybale provides default hooks for certain LLVM intrinsics like
/// `memcpy`, which have specially reserved names; it will apply these hooks
/// unless a different hook was defined for the intrinsic in (1).
///
/// (3) Else, if the function is not hooked but is defined in an available
/// LLVM `Module`, the function will be symbolically executed (called).
///
/// (4) Else, if a default function hook was supplied with `add_default_hook()`,
/// that hook will be used.
///
/// (5) If none of the above options apply, an error will be raised.
/// Note that this means that calls to external functions will always
/// error unless a hook for them is provided, either by name or via the default
/// hook.
#[derive(Clone)]
pub struct FunctionHooks<'p, B: Backend + 'p> {
/// `hooks`, `cpp_demangled_hooks`, and `rust_demangled_hooks` are each maps
/// from function names to the hook to use. In `hooks`, the function names
/// are exactly as they appear in the LLVM IR. In `cpp_demangled_hooks` and
/// `rust_demangled_hooks`, the function names are demangled versions (using
/// the C++ and Rust demanglers respectively) of the names that appear in the
/// LLVM IR.
///
/// It's intended that a function should only be hooked in one of these maps;
/// but if both the mangled and demangled function names are hooked, the hook
/// in `hooks` (that is, for the mangled name) takes priority.
///
/// If a function name isn't in any of these maps, the function isn't hooked.
hooks: HashMap<String, FunctionHook<'p, B>>,
cpp_demangled_hooks: HashMap<String, FunctionHook<'p, B>>,
rust_demangled_hooks: HashMap<String, FunctionHook<'p, B>>,
/// Hook (if any) to use for calls to inline assembly.
/// This one hook will handle all calls to any inline assembly, regardless of
/// the contents; it is responsible for inspecting the contents and acting
/// appropriately.
///
/// Note that as of this writing, due to a limitation of the LLVM C API (see
/// the 'Limitations' section of the
/// [`llvm-ir` README](https://github.com/cdisselkoen/llvm-ir/blob/master/README.md)),
/// the hook will actually have no way of obtaining the contents of the asm
/// string itself, although it can still inspect function parameters etc.
/// For now, this is the best we can do.
///
/// If no hook is provided here, then all calls to inline assembly will
/// result in errors.
inline_asm_hook: Option<FunctionHook<'p, B>>,
/// Hook (if any) to use for functions which are neither defined in the LLVM
/// IR nor specifically hooked by name.
///
/// If no hook is provided here, then calls to functions which are neither
/// defined nor hooked will result in `Error::FunctionNotFound` errors.
default_hook: Option<FunctionHook<'p, B>>,
/// For internal use in creating unique `id`s for `FunctionHook`s
cur_id: usize,
}
/// An `Argument` represents a single argument to a called function, together
/// with zero or more attributes which apply to it
pub type Argument = (Operand, Vec<ParameterAttribute>);
/// `IsCall` exists to unify the commonalities between LLVM `Call` and `Invoke`
/// instructions
pub trait IsCall: Typed {
fn get_called_func(&self) -> &Either<InlineAssembly, Operand>;
fn get_arguments(&self) -> &Vec<Argument>;
fn get_return_attrs(&self) -> &Vec<ParameterAttribute>;
fn get_fn_attrs(&self) -> &Vec<FunctionAttribute>;
fn get_calling_convention(&self) -> CallingConvention;
}
impl IsCall for llvm_ir::instruction::Call {
fn get_called_func(&self) -> &Either<InlineAssembly, Operand> {
&self.function
}
fn get_arguments(&self) -> &Vec<Argument> {
&self.arguments
}
fn get_return_attrs(&self) -> &Vec<ParameterAttribute> {
&self.return_attributes
}
fn get_fn_attrs(&self) -> &Vec<FunctionAttribute> {
&self.function_attributes
}
fn get_calling_convention(&self) -> CallingConvention {
self.calling_convention
}
}
impl IsCall for llvm_ir::terminator::Invoke {
fn get_called_func(&self) -> &Either<InlineAssembly, Operand> {
&self.function
}
fn get_arguments(&self) -> &Vec<Argument> {
&self.arguments
}
fn get_return_attrs(&self) -> &Vec<ParameterAttribute> {
&self.return_attributes
}
fn get_fn_attrs(&self) -> &Vec<FunctionAttribute> {
&self.function_attributes
}
fn get_calling_convention(&self) -> CallingConvention {
self.calling_convention
}
}
impl<'p, B: Backend + 'p> FunctionHooks<'p, B> {
/// Create a blank `FunctionHooks` instance with no function hooks.
///
/// You may want to consider
/// [`FunctionHooks::default()`](struct.FunctionHooks.html#method.default),
/// which provides predefined hooks for common functions.
pub fn new() -> Self {
Self {
hooks: HashMap::new(),
cpp_demangled_hooks: HashMap::new(),
rust_demangled_hooks: HashMap::new(),
inline_asm_hook: None,
default_hook: None,
cur_id: 0,
}
}
/// Adds a function hook. The `hook` will be executed instead of the body of
/// the `hooked_function`.
pub fn add<H>(&mut self, hooked_function: impl Into<String>, hook: &'p H)
where
H: Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
{
self.hooks
.insert(hooked_function.into(), FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
}
/// Exactly like `add()`, but takes the (C++) _demangled_ name of the function
/// to hook, so you can use a function name like "namespace::function".
pub fn add_cpp_demangled<H>(&mut self, hooked_function: impl Into<String>, hook: &'p H)
where
H: Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
{
self.cpp_demangled_hooks
.insert(hooked_function.into(), FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
}
/// Exactly like `add()`, but takes the (Rust) _demangled_ name of the function
/// to hook, so you can use a function name like "module::function".
pub fn add_rust_demangled<H>(&mut self, hooked_function: impl Into<String>, hook: &'p H)
where
H: Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
{
self.rust_demangled_hooks
.insert(hooked_function.into(), FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
}
/// Add a hook to be used for calls to inline assembly.
/// This one hook will handle all calls to any inline assembly, regardless of
/// the contents; it is responsible for inspecting the contents and acting
/// appropriately.
/// If another inline assembly hook is added, it will replace any inline
/// assembly hook which was previously present.
///
/// Returns `true` if an inline assembly hook was previously present, or
/// `false` if no inline assembly hook was present.
///
/// Note that as of this writing, due to a limitation of the LLVM C API (see
/// the 'Limitations' section of the
/// [`llvm-ir` README](https://github.com/cdisselkoen/llvm-ir/blob/master/README.md)),
/// the hook will actually have no way of obtaining the contents of the asm
/// string itself, although it can still inspect function parameters etc.
/// For now, this is the best we can do.
pub fn add_inline_asm_hook<H>(&mut self, hook: &'p H) -> bool
where
H: Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
{
match &mut self.inline_asm_hook {
h @ Some(_) => {
*h = Some(FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
true
},
h @ None => {
*h = Some(FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
false
},
}
}
/// Add a hook to be used if no other definition or hook is found for the
/// call.
/// If another default hook is added, it will replace any default hook which
/// was previously present.
///
/// Returns `true` if a default hook was previously present, or `false` if no
/// default hook was present.
pub fn add_default_hook<H>(&mut self, hook: &'p H) -> bool
where
H: Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
{
match &mut self.default_hook {
h @ Some(_) => {
*h = Some(FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
true
},
h @ None => {
*h = Some(FunctionHook::new(self.cur_id, hook));
self.cur_id += 1;
false
},
}
}
/// Removes the function hook for the given function, which was added with
/// `add()`. That function will no longer be hooked.
pub fn remove(&mut self, hooked_function: &str) {
self.hooks.remove(hooked_function);
}
/// Removes the function hook for the given function, which was added with
/// [`add_cpp_demangled()`](struct.FunctionHooks.html#method.add_cpp_demangled).
/// That function will no longer be hooked.
pub fn remove_cpp_demangled(&mut self, hooked_function: &str) {
self.cpp_demangled_hooks.remove(hooked_function);
}
/// Removes the function hook for the given function, which was added with
/// [`add_rust_demangled()`](struct.FunctionHooks.html#method.add_rust_demangled).
/// That function will no longer be hooked.
pub fn remove_rust_demangled(&mut self, hooked_function: &str) {
self.rust_demangled_hooks.remove(hooked_function);
}
/// Removes the function hook used for calls to inline assembly, which was
/// added with [`add_inline_asm_hook()`]. Calls to inline assembly will no
/// longer be hooked, and thus will result in errors, until the next call to
/// [`add_inline_asm_hook()`].
///
/// [`add_inline_asm_hook()`]: struct.FunctionHooks.html#method.add_inline_asm_hook
pub fn remove_inline_asm_hook(&mut self) {
self.inline_asm_hook = None;
}
/// Removes the default function hook which was added with
/// [`add_default_hook()`]. Calls to functions which are neither defined in
/// the `Project` nor specifically hooked will thus result in
/// `Error::FunctionNotFound` errors, until the next call to
/// [`add_default_hook()`].
///
/// [`add_default_hook()`]: struct.FunctionHooks.html#method.add_default_hook
pub fn remove_default_hook(&mut self) {
self.default_hook = None;
}
/// Iterate over all function hooks, as (function name, hook) pairs.
/// Function names may include both mangled and demangled names.
pub(crate) fn get_all_hooks(&self) -> impl Iterator<Item = (&String, &FunctionHook<'p, B>)> {
self.hooks
.iter()
.chain(self.cpp_demangled_hooks.iter())
.chain(self.rust_demangled_hooks.iter())
}
/// Get the `FunctionHook` active for the given `funcname`, or `None` if
/// there is no hook active for the function. `funcname` may be either a
/// mangled or a demangled function name.
pub(crate) fn get_hook_for(&self, funcname: &str) -> Option<&FunctionHook<'p, B>> {
self.hooks
.get(funcname)
.or_else(|| {
demangling::try_rust_demangle(funcname)
.and_then(|demangled| self.rust_demangled_hooks.get(&demangled))
})
.or_else(|| {
demangling::try_cpp_demangle(funcname)
.and_then(|demangled| self.cpp_demangled_hooks.get(&demangled))
})
}
/// Get the `FunctionHook` used for calls to inline assembly, if there is one.
///
/// See docs on `add_inline_asm_hook()` above
pub(crate) fn get_inline_asm_hook(&self) -> Option<&FunctionHook<'p, B>> {
self.inline_asm_hook.as_ref()
}
/// Get the default `FunctionHook` (used when no LLVM definition or hook is
/// found), if there is one.
///
/// See docs on `add_default_hook()` above
pub(crate) fn get_default_hook(&self) -> Option<&FunctionHook<'p, B>> {
self.default_hook.as_ref()
}
/// Determine whether there is an active hook for the given `funcname`
pub fn is_hooked(&self, funcname: &str) -> bool {
self.get_hook_for(funcname).is_some()
}
/// Is there currently an inline asm hook active?
/// (See `add_inline_asm_hook()` for more info)
pub fn has_inline_asm_hook(&self) -> bool {
self.inline_asm_hook.is_some()
}
/// Is there currently a default hook active?
/// (See `add_default_hook()` for more info)
pub fn has_default_hook(&self) -> bool {
self.default_hook.is_some()
}
}
impl<'p, B: Backend + 'p> Default for FunctionHooks<'p, B> {
/// Provides predefined hooks for common functions. (At the time of this
/// writing, this includes malloc-related functions `malloc()`, `calloc()`,
/// `realloc()`, and `free()`, as well as some C++ exception-handling
/// functions such as `__cxa_throw()` and `__cxa_allocate_exception()`,
/// and a few other C and Rust standard library functions.)
///
/// If you don't want these hooks, you can use
/// [`FunctionHooks::remove_function_hook()`](struct.FunctionHooks.html#method.remove_function_hook)
/// to remove individual hooks, or you can use
/// [`FunctionHooks::new()`](struct.FunctionHooks.html#method.new), which
/// comes with no predefined hooks.
fn default() -> Self {
let mut fhooks = Self::new();
fhooks.add("malloc", &hooks::allocation::malloc_hook);
fhooks.add("calloc", &hooks::allocation::calloc_hook);
fhooks.add("realloc", &hooks::allocation::realloc_hook);
fhooks.add("free", &hooks::allocation::free_hook);
fhooks.add(
"__cxa_allocate_exception",
&hooks::exceptions::cxa_allocate_exception,
);
fhooks.add("__cxa_throw", &hooks::exceptions::cxa_throw);
fhooks.add("__cxa_begin_catch", &hooks::exceptions::cxa_begin_catch);
fhooks.add("__cxa_end_catch", &hooks::exceptions::cxa_end_catch);
fhooks.add("llvm.eh.typeid.for", &hooks::exceptions::llvm_eh_typeid_for);
fhooks.add("exit", &abort_hook);
fhooks.add_rust_demangled("std::panicking::begin_panic", &abort_hook);
fhooks.add_rust_demangled("std::panicking::begin_panic_fmt", &abort_hook);
fhooks.add_rust_demangled("std::panicking::begin_panic_handler", &abort_hook);
fhooks.add_rust_demangled("core::panicking::panic", &abort_hook);
fhooks.add_rust_demangled("core::panicking::panic_bounds_check", &abort_hook);
fhooks.add_rust_demangled("core::result::unwrap_failed", &abort_hook);
fhooks.add_rust_demangled("core::slice::slice_index_len_fail", &abort_hook);
fhooks.add_rust_demangled("core::slice::slice_index_order_fail", &abort_hook);
fhooks.add_rust_demangled("core::slice::slice_index_overflow_fail", &abort_hook);
fhooks
}
}
/// Function hooks are given mutable access to the `State`, and read-only access
/// to the `Call` they are hooking (which includes arguments etc).
///
/// They should return the [`ReturnValue`](enum.ReturnValue.html) representing
/// the return value of the call, or an appropriate [`Error`](enum.Error.html) if
/// they cannot.
pub(crate) struct FunctionHook<'p, B: Backend> {
/// The actual hook to be executed
#[allow(clippy::type_complexity)]
hook: Rc<dyn Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>> + 'p>,
/// A unique id, used for nothing except equality comparisons between `FunctionHook`s.
/// This `id` should be globally unique across all created `FunctionHook`s.
id: usize,
}
impl<'p, B: Backend> Clone for FunctionHook<'p, B> {
fn clone(&self) -> Self {
Self {
hook: self.hook.clone(),
id: self.id,
}
}
}
impl<'p, B: Backend> PartialEq for FunctionHook<'p, B> {
fn eq(&self, other: &Self) -> bool {
self.id == other.id
}
}
impl<'p, B: Backend> Eq for FunctionHook<'p, B> {}
impl<'p, B: Backend> Hash for FunctionHook<'p, B> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.id.hash(state);
}
}
impl<'p, B: Backend> FunctionHook<'p, B> {
/// `id`: A unique id, used for nothing except equality comparisons between `FunctionHook`s.
/// This `id` should be globally unique across all created `FunctionHook`s.
pub fn new(
id: usize,
f: &'p dyn Fn(&mut State<'p, B>, &'p dyn IsCall) -> Result<ReturnValue<B::BV>>,
) -> Self {
Self {
hook: Rc::new(f),
id,
}
}
pub fn call_hook(
&self,
state: &mut State<'p, B>,
call: &'p dyn IsCall,
) -> Result<ReturnValue<B::BV>> {
(self.hook)(state, call)
}
}
/// This hook ignores the function arguments and returns an unconstrained value
/// of the appropriate size for the function's return value (or void for
/// void-typed functions).
///
/// May be used for functions taking any number and type of arguments, and with
/// any return type.
pub fn generic_stub_hook<B: Backend>(
state: &mut State<B>,
call: &dyn IsCall,
) -> Result<ReturnValue<B::BV>> {
match state.type_of(call).as_ref() {
Type::VoidType => Ok(ReturnValue::ReturnVoid),
ty => {
let width = state.size_in_bits(ty).ok_or_else(|| {
Error::OtherError("Call return type is an opaque named struct".into())
})?;
assert_ne!(width, 0, "Call return type has size 0 bits but isn't void type"); // void type was handled above
let bv = state.new_bv_with_name(Name::from("generic_stub_hook_retval"), width)?;
Ok(ReturnValue::Return(bv))
},
}
}
/// This hook ignores the function arguments and returns `ReturnValue::Abort`.
/// It is suitable for hooking functions such as C's `exit()` which abort the
/// program and never return.
pub fn abort_hook<B: Backend>(
_state: &mut State<B>,
_call: &dyn IsCall,
) -> Result<ReturnValue<B::BV>> {
Ok(ReturnValue::Abort)
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Alipay.AopSdk.Core.Domain
{
/// <summary>
/// AlipayOpenPublicGroupCreateModel Data Structure.
/// </summary>
[Serializable]
public class AlipayOpenPublicGroupCreateModel : AopObject
{
/// <summary>
/// 标签规则,满足该规则的粉丝将被圈定,标签id不能重复
/// </summary>
[JsonProperty("label_rule")]
public List<ComplexLabelRule> LabelRule { get; set; }
/// <summary>
/// 分组名称,仅支持中文、字母、数字、下划线的组合。
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
}
} | {
"pile_set_name": "Github"
} |
From b1a4a23406727f112b9a296b0231ec4d1b99d6e0 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
Date: Wed, 31 Oct 2018 14:57:56 +0000
Subject: [PATCH] media: adv7180: Add YPrPb support for ADV7282M
The ADV7282M can support YPbPr on AIN1-3, but this was
not selectable from the driver. Add it to the list of
supported input modes.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
---
drivers/media/i2c/adv7180.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -1235,6 +1235,7 @@ static const struct adv7180_chip_info ad
BIT(ADV7182_INPUT_SVIDEO_AIN1_AIN2) |
BIT(ADV7182_INPUT_SVIDEO_AIN3_AIN4) |
BIT(ADV7182_INPUT_SVIDEO_AIN7_AIN8) |
+ BIT(ADV7182_INPUT_YPRPB_AIN1_AIN2_AIN3) |
BIT(ADV7182_INPUT_DIFF_CVBS_AIN1_AIN2) |
BIT(ADV7182_INPUT_DIFF_CVBS_AIN3_AIN4) |
BIT(ADV7182_INPUT_DIFF_CVBS_AIN7_AIN8),
| {
"pile_set_name": "Github"
} |
import * as React from 'react';
import styled from 'styled-components';
const _Row = styled.div`
display: flex;
flex-direction: row;
width: 100%;
`;
export default class Row extends React.PureComponent {
render() {
const { children } = this.props;
return (
<_Row>
{children}
</_Row>
);
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.