text
stringlengths 2
100k
| meta
dict |
---|---|
version https://git-lfs.github.com/spec/v1
oid sha256:4b74ee42e4f076554b56c415b8415c2467248de4f7486879d38196af3c6a2b95
size 2573
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="PersistedGrantDoesNotExist" xml:space="preserve">
<value>La concesión persistida con ID {0} no existe</value>
</data>
<data name="PersistedGrantWithSubjectIdDoesNotExist" xml:space="preserve">
<value>La concesión persistida para este ID de sujeto {0} no existe</value>
</data>
</root>
| {
"pile_set_name": "Github"
} |
/*
Copyright 2015 OpenMarket Ltd
Copyright 2018 New Vector 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.
*/
#import "MXCallManager.h"
#import "MXCall.h"
#import "MXCallKitAdapter.h"
#import "MXCallStack.h"
#import "MXJSONModels.h"
#import "MXRoom.h"
#import "MXSession.h"
#import "MXTools.h"
#pragma mark - Constants definitions
NSString *const kMXCallManagerNewCall = @"kMXCallManagerNewCall";
NSString *const kMXCallManagerConferenceStarted = @"kMXCallManagerConferenceStarted";
NSString *const kMXCallManagerConferenceFinished = @"kMXCallManagerConferenceFinished";
@interface MXCallManager ()
{
/**
Calls being handled.
*/
NSMutableArray<MXCall *> *calls;
/**
Listener to Matrix call-related events.
*/
id callEventsListener;
/**
Timer to periodically refresh the TURN server config.
*/
NSTimer *refreshTURNServerTimer;
/**
Observer for changes of MXSession's state
*/
id sessionStateObserver;
}
@end
@implementation MXCallManager
- (instancetype)initWithMatrixSession:(MXSession *)mxSession andCallStack:(id<MXCallStack>)callstack
{
self = [super init];
if (self)
{
_mxSession = mxSession;
calls = [NSMutableArray array];
_inviteLifetime = 30000;
_callStack = callstack;
// Listen to call events
callEventsListener = [mxSession listenToEventsOfTypes:@[
kMXEventTypeStringCallInvite,
kMXEventTypeStringCallCandidates,
kMXEventTypeStringCallAnswer,
kMXEventTypeStringCallHangup
]
onEvent:^(MXEvent *event, MXTimelineDirection direction, id customObject) {
if (MXTimelineDirectionForwards == direction)
{
switch (event.eventType)
{
case MXEventTypeCallInvite:
[self handleCallInvite:event];
break;
case MXEventTypeCallAnswer:
[self handleCallAnswer:event];
break;
case MXEventTypeCallHangup:
[self handleCallHangup:event];
break;
case MXEventTypeCallCandidates:
[self handleCallCandidates:event];
break;
default:
break;
}
}
}];
// Listen to call state changes
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleCallStateDidChangeNotification:)
name:kMXCallStateDidChange
object:nil];
[self refreshTURNServer];
}
return self;
}
- (void)dealloc
{
[self unregisterFromNotifications];
}
- (void)close
{
[_mxSession removeListener:callEventsListener];
callEventsListener = nil;
// Hang up all calls
for (MXCall *call in calls)
{
[call hangup];
}
[calls removeAllObjects];
calls = nil;
// Do not refresh TURN servers config anymore
[refreshTURNServerTimer invalidate];
refreshTURNServerTimer = nil;
// Unregister from any possible notifications
[self unregisterFromNotifications];
}
- (MXCall *)callWithCallId:(NSString *)callId
{
MXCall *theCall;
for (MXCall *call in calls)
{
if ([call.callId isEqualToString:callId])
{
theCall = call;
break;
}
}
return theCall;
}
- (MXCall *)callInRoom:(NSString *)roomId
{
MXCall *theCall;
for (MXCall *call in calls)
{
if ([call.room.roomId isEqualToString:roomId])
{
theCall = call;
break;
}
}
return theCall;
}
- (void)placeCallInRoom:(NSString *)roomId withVideo:(BOOL)video
success:(void (^)(MXCall *call))success
failure:(void (^)(NSError * _Nullable error))failure
{
// If consumers of our API decide to use SiriKit or CallKit, they will face with application:continueUserActivity:restorationHandler:
// and since the state of MXSession can be different from MXSessionStateRunning for the moment when this method will be executing
// we must track session's state to become MXSessionStateRunning for performing outgoing call
if (_mxSession.state != MXSessionStateRunning)
{
MXWeakify(self);
__weak NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
sessionStateObserver = [center addObserverForName:kMXSessionStateDidChangeNotification
object:_mxSession
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification * _Nonnull note) {
MXStrongifyAndReturnIfNil(self);
if (self.mxSession.state == MXSessionStateRunning)
{
[self placeCallInRoom:roomId
withVideo:video
success:success
failure:failure];
[center removeObserver:self->sessionStateObserver];
self->sessionStateObserver = nil;
}
}];
return;
}
MXRoom *room = [_mxSession roomWithRoomId:roomId];
if (room && 1 < room.summary.membersCount.joined)
{
if (2 == room.summary.membersCount.joined)
{
// Do a peer to peer, one to one call
MXCall *call = [[MXCall alloc] initWithRoomId:roomId andCallManager:self];
if (call)
{
[calls addObject:call];
[call callWithVideo:video];
// Broadcast the new outgoing call
[[NSNotificationCenter defaultCenter] postNotificationName:kMXCallManagerNewCall object:call userInfo:nil];
if (success)
{
success(call);
}
}
else
{
if (failure)
{
failure(nil);
}
}
}
else
{
// Use the conference server bot to manage the conf call
// There are 2 steps:
// - invite the conference user (the bot) into the room
// - set up a separated private room with the conference user to manage
// the conf call in 'room'
MXWeakify(self);
[self inviteConferenceUserToRoom:room success:^{
MXStrongifyAndReturnIfNil(self);
MXWeakify(self);
[self conferenceUserRoomForRoom:roomId success:^(MXRoom *conferenceUserRoom) {
MXStrongifyAndReturnIfNil(self);
// The call can now be created
MXCall *call = [[MXCall alloc] initWithRoomId:roomId callSignalingRoomId:conferenceUserRoom.roomId andCallManager:self];
if (call)
{
[self->calls addObject:call];
[call callWithVideo:video];
// Broadcast the new outgoing call
[[NSNotificationCenter defaultCenter] postNotificationName:kMXCallManagerNewCall object:call userInfo:nil];
}
if (success)
{
success(call);
}
} failure:failure];
} failure:failure];
}
}
else
{
NSLog(@"[MXCallManager] placeCallInRoom: ERROR: Cannot place call in %@. Members count: %tu", roomId, room.summary.membersCount.joined);
if (failure)
{
// @TODO: Provide an error
failure(nil);
}
}
}
- (void)removeCall:(MXCall *)call
{
[calls removeObject:call];
}
#pragma mark - Private methods
- (void)refreshTURNServer
{
MXWeakify(self);
[_mxSession.matrixRestClient turnServer:^(MXTurnServerResponse *turnServerResponse) {
MXStrongifyAndReturnIfNil(self);
NSLog(@"[MXCallManager] refreshTURNServer: TTL:%tu URIs: %@", turnServerResponse.ttl, turnServerResponse.uris);
if (turnServerResponse.uris)
{
self->_turnServers = turnServerResponse;
// Re-new when we're about to reach the TTL
self->refreshTURNServerTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:turnServerResponse.ttl * 0.9]
interval:0
target:self
selector:@selector(refreshTURNServer)
userInfo:nil
repeats:NO];
[[NSRunLoop mainRunLoop] addTimer:self->refreshTURNServerTimer forMode:NSDefaultRunLoopMode];
}
else
{
NSLog(@"No TURN server: using fallback STUN server: %@", self->_fallbackSTUNServer);
self->_turnServers = nil;
}
} failure:^(NSError *error) {
MXStrongifyAndReturnIfNil(self);
NSLog(@"[MXCallManager] refreshTURNServer: Failed to get TURN URIs.\n");
NSLog(@"Retry in 60s");
self->refreshTURNServerTimer = [NSTimer timerWithTimeInterval:60 target:self selector:@selector(refreshTURNServer) userInfo:nil repeats:NO];
[[NSRunLoop mainRunLoop] addTimer:self->refreshTURNServerTimer forMode:NSDefaultRunLoopMode];
}];
}
- (void)handleCallInvite:(MXEvent *)event
{
MXCallInviteEventContent *content = [MXCallInviteEventContent modelFromJSON:event.content];
// Check expiration (usefull filter when receiving load of events when resuming the event stream)
if (event.age < content.lifetime)
{
// If it is an invite from the peer, we need to create the MXCall
if (![event.sender isEqualToString:_mxSession.myUserId])
{
MXCall *call = [self callWithCallId:content.callId];
if (!call)
{
call = [[MXCall alloc] initWithRoomId:event.roomId andCallManager:self];
if (call)
{
[calls addObject:call];
[call handleCallEvent:event];
// Broadcast the incoming call
[self notifyCallInvite:call.callId];
}
}
else
{
[call handleCallEvent:event];
}
}
}
}
- (void)notifyCallInvite:(NSString *)callId
{
MXCall *call = [self callWithCallId:callId];
if (call)
{
// If the app is resuming, wait for the complete end of the session resume in order
// to check if the invite is still valid
if (_mxSession.state == MXSessionStateSyncInProgress || _mxSession.state == MXSessionStateBackgroundSyncInProgress)
{
// The dispatch on the main thread should be enough.
// It means that the sync response that contained the invite (and possibly its end
// of validity) has been fully parsed.
MXWeakify(self);
dispatch_async(dispatch_get_main_queue(), ^{
MXStrongifyAndReturnIfNil(self);
[self notifyCallInvite:callId];
});
}
else if (call.state < MXCallStateConnected)
{
// If the call is still in ringing state, notify the app
[[NSNotificationCenter defaultCenter] postNotificationName:kMXCallManagerNewCall object:call userInfo:nil];
}
}
}
- (void)handleCallAnswer:(MXEvent *)event
{
MXCallAnswerEventContent *content = [MXCallAnswerEventContent modelFromJSON:event.content];
MXCall *call = [self callWithCallId:content.callId];
if (call)
{
[call handleCallEvent:event];
}
}
- (void)handleCallHangup:(MXEvent *)event
{
MXCallHangupEventContent *content = [MXCallHangupEventContent modelFromJSON:event.content];
// Forward the event to the MXCall object
MXCall *call = [self callWithCallId:content.callId];
if (call)
{
[call handleCallEvent:event];
}
// Forget this call. It is no more in progress
[calls removeObject:call];
}
- (void)handleCallCandidates:(MXEvent *)event
{
MXCallCandidatesEventContent *content = [MXCallCandidatesEventContent modelFromJSON:event.content];
// Forward the event to the MXCall object
MXCall *call = [self callWithCallId:content.callId];
if (call)
{
[call handleCallEvent:event];
}
}
- (void)handleCallStateDidChangeNotification:(NSNotification *)notification
{
#if TARGET_OS_IPHONE
MXCall *call = notification.object;
switch (call.state) {
case MXCallStateCreateOffer:
[self.callKitAdapter startCall:call];
break;
case MXCallStateRinging:
[self.callKitAdapter reportIncomingCall:call];
break;
case MXCallStateConnecting:
[self.callKitAdapter reportCall:call startedConnectingAtDate:nil];
break;
case MXCallStateConnected:
[self.callKitAdapter reportCall:call connectedAtDate:nil];
break;
case MXCallStateEnded:
[self.callKitAdapter endCall:call];
break;
default:
break;
}
#endif
}
- (void)unregisterFromNotifications
{
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
// Do not handle any call state change notifications
[notificationCenter removeObserver:self name:kMXCallStateDidChange object:nil];
// Don't track MXSession's state
if (sessionStateObserver)
{
[notificationCenter removeObserver:sessionStateObserver name:kMXSessionStateDidChangeNotification object:_mxSession];
sessionStateObserver = nil;
}
}
#pragma mark - Conference call
// Copied from vector-web:
// FIXME: This currently forces Vector to try to hit the matrix.org AS for conferencing.
// This is bad because it prevents people running their own ASes from being used.
// This isn't permanent and will be customisable in the future: see the proposal
// at docs/conferencing.md for more info.
NSString *const kMXCallManagerConferenceUserPrefix = @"@fs_";
NSString *const kMXCallManagerConferenceUserDomain = @"matrix.org";
- (void)handleConferenceUserUpdate:(MXRoomMember *)conferenceUserMember inRoom:(NSString *)roomId
{
if (_mxSession.state == MXSessionStateRunning)
{
if (conferenceUserMember.membership == MXMembershipJoin)
{
// Broadcast the ongoing conference call
[[NSNotificationCenter defaultCenter] postNotificationName:kMXCallManagerConferenceStarted object:roomId userInfo:nil];
}
else if (conferenceUserMember.membership == MXMembershipLeave)
{
// Broadcast the end of the ongoing conference call
[[NSNotificationCenter defaultCenter] postNotificationName:kMXCallManagerConferenceFinished object:roomId userInfo:nil];
}
}
}
+ (NSString *)conferenceUserIdForRoom:(NSString *)roomId
{
// Apply the same algo as other matrix clients
NSString *base64RoomId = [[roomId dataUsingEncoding:NSUTF8StringEncoding] base64EncodedStringWithOptions:0];
base64RoomId = [base64RoomId stringByReplacingOccurrencesOfString:@"=" withString:@""];
return [NSString stringWithFormat:@"%@%@:%@", kMXCallManagerConferenceUserPrefix, base64RoomId, kMXCallManagerConferenceUserDomain];
}
+ (BOOL)isConferenceUser:(NSString *)userId
{
BOOL isConferenceUser = NO;
if ([userId hasPrefix:kMXCallManagerConferenceUserPrefix])
{
NSString *base64part = [userId substringWithRange:NSMakeRange(4, [userId rangeOfString:@":"].location - 4)];
if (base64part)
{
NSData *decodedData = [[NSData alloc] initWithBase64EncodedString:base64part options:0];
if (decodedData)
{
NSString *decoded = [[NSString alloc] initWithData:decodedData encoding:NSUTF8StringEncoding];
if (decoded)
{
isConferenceUser = [MXTools isMatrixRoomIdentifier:decoded];
}
}
}
}
return isConferenceUser;
}
+ (BOOL)canPlaceConferenceCallInRoom:(MXRoom *)room roomState:(MXRoomState *)roomState
{
BOOL canPlaceConferenceCallInRoom = NO;
if (roomState.isOngoingConferenceCall)
{
// All room members can join an existing conference call
canPlaceConferenceCallInRoom = YES;
}
else
{
MXRoomPowerLevels *powerLevels = roomState.powerLevels;
NSInteger oneSelfPowerLevel = [powerLevels powerLevelOfUserWithUserID:room.mxSession.myUserId];
// Only member with invite power level can create a conference call
if (oneSelfPowerLevel >= powerLevels.invite)
{
canPlaceConferenceCallInRoom = YES;
}
}
return canPlaceConferenceCallInRoom;
}
/**
Make sure the conference user is in the passed room.
It is mandatory before starting the conference call.
@param room the room.
@param success A block object called when the operation succeeds.
@param failure A block object called when the operation fails.
*/
- (void)inviteConferenceUserToRoom:(MXRoom *)room
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
NSString *conferenceUserId = [MXCallManager conferenceUserIdForRoom:room.roomId];
[room members:^(MXRoomMembers *roomMembers) {
MXRoomMember *conferenceUserMember = [roomMembers memberWithUserId:conferenceUserId];
if (conferenceUserMember && conferenceUserMember.membership == MXMembershipJoin)
{
success();
}
else
{
[room inviteUser:conferenceUserId success:success failure:failure];
}
} failure:failure];
}
/**
Get the room with the conference user dedicated for the passed room.
@param roomId the room id.
@param success A block object called when the operation succeeds.
It returns the private room with conference user.
@param failure A block object called when the operation fails.
*/
- (void)conferenceUserRoomForRoom:(NSString*)roomId
success:(void (^)(MXRoom *conferenceUserRoom))success
failure:(void (^)(NSError *error))failure
{
NSString *conferenceUserId = [MXCallManager conferenceUserIdForRoom:roomId];
// Use an existing 1:1 with the conference user; else make one
__block MXRoom *conferenceUserRoom;
dispatch_group_t group = dispatch_group_create();
for (MXRoomSummary *roomSummary in _mxSession.roomsSummaries)
{
if (roomSummary.isConferenceUserRoom)
{
dispatch_group_enter(group);
MXRoom *room = [_mxSession roomWithRoomId:roomSummary.roomId];
[room state:^(MXRoomState *roomState) {
if ([roomState.members memberWithUserId:conferenceUserId])
{
conferenceUserRoom = room;
}
dispatch_group_leave(group);
}];
}
}
MXWeakify(self);
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
MXStrongifyAndReturnIfNil(self);
if (conferenceUserRoom)
{
success(conferenceUserRoom);
}
else
{
[self.mxSession createRoom:@{
@"preset": @"private_chat",
@"invite": @[conferenceUserId]
} success:^(MXRoom *room) {
success(room);
} failure:failure];
}
});
}
@end
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (c) 2012, 2017 Liviu Ionescu.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
Liviu Ionescu
-->
<plugin>
<extension point="org.eclipse.cdt.core.templates">
<template
filterPattern=".*g[c\+][c\+]"
id="ilg.gnumcueclipse.templates.sifive.exe.c.project"
location="$nl$/templates/sifive_exe_c_project/template.xml"
projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
</template>
</extension>
<extension point="org.eclipse.cdt.core.templateAssociations">
<template id="ilg.gnumcueclipse.templates.sifive.exe.c.project">
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.base">
</toolChain>
</template>
</extension>
</plugin>
| {
"pile_set_name": "Github"
} |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MultipleFileProperty, FileAction, WorkspaceProperty
from mantid.kernel import Direction, UnitConversion, Elastic, Property, IntArrayProperty, StringListValidator
from mantid.simpleapi import (mtd, SetGoniometer, AddSampleLog, MaskBTP, RenameWorkspace, GroupWorkspaces,
CreateWorkspace, LoadNexusLogs, LoadInstrument)
import numpy as np
import h5py
class LoadWAND(DataProcessorAlgorithm):
def name(self):
return 'LoadWAND'
def category(self):
return 'DataHandling\\Nexus'
def summary(self):
return 'Loads Event Nexus file, integrates events, sets wavelength, mask, and goniometer, and sets proton charge to monitor counts'
def PyInit(self):
self.declareProperty(MultipleFileProperty(name="Filename", action=FileAction.OptionalLoad, extensions=[".nxs.h5"]), "Files to Load")
self.declareProperty('IPTS', Property.EMPTY_INT, "IPTS number to load from")
self.declareProperty(IntArrayProperty("RunNumbers", []), 'Run numbers to load')
self.declareProperty("Wavelength", 1.488, doc="Wavelength to set the workspace")
self.declareProperty("ApplyMask", True, "If True standard masking will be applied to the workspace")
self.declareProperty("Grouping", 'None', StringListValidator(['None', '2x2', '4x4']), "Group pixels")
self.declareProperty(WorkspaceProperty(name="OutputWorkspace", defaultValue="", direction=Direction.Output))
def validateInputs(self):
issues = dict()
if not self.getProperty("Filename").value:
if (self.getProperty("IPTS").value == Property.EMPTY_INT) or len(self.getProperty("RunNumbers").value) == 0:
issues["Filename"] = 'Must specify either Filename or IPTS AND RunNumbers'
return issues
def PyExec(self):
runs = self.getProperty("Filename").value
if not runs:
ipts = self.getProperty("IPTS").value
runs = ['/HFIR/HB2C/IPTS-{}/nexus/HB2C_{}.nxs.h5'.format(ipts, run) for run in self.getProperty("RunNumbers").value]
wavelength = self.getProperty("wavelength").value
outWS = self.getPropertyValue("OutputWorkspace")
group_names = []
grouping = self.getProperty("Grouping").value
if grouping == 'None':
grouping = 1
else:
grouping = 2 if grouping == '2x2' else 4
for i, run in enumerate(runs):
data = np.zeros((512*480*8),dtype=np.int64)
with h5py.File(run, 'r') as f:
monitor_count = f['/entry/monitor1/total_counts'].value[0]
duration = f['/entry/duration'].value[0]
run_number = f['/entry/run_number'].value[0]
for b in range(8):
data += np.bincount(f['/entry/bank'+str(b+1)+'_events/event_id'].value,minlength=512*480*8)
data = data.reshape((480*8, 512))
if grouping == 2:
data = data[::2,::2] + data[1::2,::2] + data[::2,1::2] + data[1::2,1::2]
elif grouping == 4:
data = (data[::4,::4] + data[1::4,::4] + data[2::4,::4] + data[3::4,::4]
+ data[::4,1::4] + data[1::4,1::4] + data[2::4,1::4] + data[3::4,1::4]
+ data[::4,2::4] + data[1::4,2::4] + data[2::4,2::4] + data[3::4,2::4]
+ data[::4,3::4] + data[1::4,3::4] + data[2::4,3::4] + data[3::4,3::4])
CreateWorkspace(DataX=[wavelength-0.001, wavelength+0.001],
DataY=data,
DataE=np.sqrt(data),
UnitX='Wavelength',
YUnitLabel='Counts',
NSpec=1966080//grouping**2,
OutputWorkspace='__tmp_load', EnableLogging=False)
LoadNexusLogs('__tmp_load', Filename=run, EnableLogging=False)
AddSampleLog('__tmp_load', LogName="monitor_count", LogType='Number', NumberType='Double',
LogText=str(monitor_count), EnableLogging=False)
AddSampleLog('__tmp_load', LogName="gd_prtn_chrg", LogType='Number', NumberType='Double',
LogText=str(monitor_count), EnableLogging=False)
AddSampleLog('__tmp_load', LogName="Wavelength", LogType='Number', NumberType='Double',
LogText=str(wavelength), EnableLogging=False)
AddSampleLog('__tmp_load', LogName="Ei", LogType='Number', NumberType='Double',
LogText=str(UnitConversion.run('Wavelength', 'Energy', wavelength, 0, 0, 0, Elastic, 0)), EnableLogging=False)
AddSampleLog('__tmp_load', LogName="run_number", LogText=run_number, EnableLogging=False)
AddSampleLog('__tmp_load', LogName="duration", LogType='Number',
LogText=str(duration), NumberType='Double', EnableLogging=False)
if grouping > 1: # Fix detector IDs per spectrum before loading instrument
__tmp_load = mtd['__tmp_load']
for n in range(__tmp_load.getNumberHistograms()):
s=__tmp_load.getSpectrum(n)
for i in range(grouping):
for j in range(grouping):
s.addDetectorID(int(n*grouping%512 + n//(512/grouping)*512*grouping + j + i*512))
LoadInstrument('__tmp_load', InstrumentName='WAND', RewriteSpectraMap=False, EnableLogging=False)
else:
LoadInstrument('__tmp_load', InstrumentName='WAND', RewriteSpectraMap=True, EnableLogging=False)
SetGoniometer('__tmp_load', Axis0="HB2C:Mot:s1,0,1,0,1", EnableLogging=False)
if self.getProperty("ApplyMask").value:
MaskBTP('__tmp_load', Pixel='1,2,511,512', EnableLogging=False)
if mtd['__tmp_load'].getRunNumber() > 26600: # They changed pixel mapping and bank name order here
MaskBTP('__tmp_load', Bank='1', Tube='479-480', EnableLogging=False)
MaskBTP('__tmp_load', Bank='8', Tube='1-2', EnableLogging=False)
else:
MaskBTP('__tmp_load', Bank='8', Tube='475-480', EnableLogging=False)
if len(runs) == 1:
RenameWorkspace('__tmp_load', outWS, EnableLogging=False)
else:
outName = outWS+"_"+str(mtd['__tmp_load'].getRunNumber())
group_names.append(outName)
RenameWorkspace('__tmp_load', outName, EnableLogging=False)
if len(runs) > 1:
GroupWorkspaces(group_names, OutputWorkspace=outWS, EnableLogging=False)
self.setProperty('OutputWorkspace', outWS)
AlgorithmFactory.subscribe(LoadWAND)
| {
"pile_set_name": "Github"
} |
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using UnityEngine.Bindings;
namespace UnityEngine
{
internal interface IPlayerEditorConnectionNative
{
void Initialize();
void DisconnectAll();
void SendMessage(Guid messageId, byte[] data, int playerId);
bool TrySendMessage(Guid messageId, byte[] data, int playerId);
void Poll();
void RegisterInternal(Guid messageId);
void UnregisterInternal(Guid messageId);
bool IsConnected();
}
[NativeHeader("Runtime/Export/PlayerConnection/PlayerConnectionInternal.bindings.h")]
internal class PlayerConnectionInternal : IPlayerEditorConnectionNative
{
[Flags]
public enum MulticastFlags
{
kRequestImmediateConnect = 1 << 0,
kSupportsProfile = 1 << 1,
kCustomMessage = 1 << 2,
kUseAlternateIP = 1 << 3,
};
void IPlayerEditorConnectionNative.SendMessage(Guid messageId, byte[] data, int playerId)
{
if (messageId == Guid.Empty)
{
throw new ArgumentException("messageId must not be empty");
}
SendMessage(messageId.ToString("N"), data, playerId);
}
bool IPlayerEditorConnectionNative.TrySendMessage(Guid messageId, byte[] data, int playerId)
{
if (messageId == Guid.Empty)
{
throw new ArgumentException("messageId must not be empty");
}
return TrySendMessage(messageId.ToString("N"), data, playerId);
}
void IPlayerEditorConnectionNative.Poll()
{
PollInternal();
}
void IPlayerEditorConnectionNative.RegisterInternal(Guid messageId)
{
RegisterInternal(messageId.ToString("N"));
}
void IPlayerEditorConnectionNative.UnregisterInternal(Guid messageId)
{
UnregisterInternal(messageId.ToString("N"));
}
void IPlayerEditorConnectionNative.Initialize()
{
Initialize();
}
bool IPlayerEditorConnectionNative.IsConnected()
{
return IsConnected();
}
void IPlayerEditorConnectionNative.DisconnectAll()
{
DisconnectAll();
}
[FreeFunction("PlayerConnection_Bindings::IsConnected")]
extern static bool IsConnected();
[FreeFunction("PlayerConnection_Bindings::Initialize")]
extern static void Initialize();
[FreeFunction("PlayerConnection_Bindings::RegisterInternal")]
extern static void RegisterInternal(string messageId);
[FreeFunction("PlayerConnection_Bindings::UnregisterInternal")]
extern static void UnregisterInternal(string messageId);
//playerId 0 is ANY_PLAYERCONNECTION
[FreeFunction("PlayerConnection_Bindings::SendMessage")]
extern static void SendMessage(string messageId, byte[] data, int playerId);
//playerId 0 is ANY_PLAYERCONNECTION
[FreeFunction("PlayerConnection_Bindings::TrySendMessage")]
extern static bool TrySendMessage(string messageId, byte[] data, int playerId);
[FreeFunction("PlayerConnection_Bindings::PollInternal")]
extern static void PollInternal();
[FreeFunction("PlayerConnection_Bindings::DisconnectAll")]
extern static void DisconnectAll();
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser 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 Lesser Public License for more details.
#
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram InlineKeyboardButton."""
from telegram import TelegramObject
class InlineKeyboardButton(TelegramObject):
"""This object represents one button of an inline keyboard.
Note:
You must use exactly one of the optional fields. Mind that :attr:`callback_game` is not
working as expected. Putting a game short name in it might, but is not guaranteed to work.
Attributes:
text (:obj:`str`): Label text on the button.
url (:obj:`str`): Optional. HTTP or tg:// url to be opened when button is pressed.
login_url (:class:`telegram.LoginUrl`) Optional. An HTTP URL used to automatically
authorize the user. Can be used as a replacement for the Telegram Login Widget.
callback_data (:obj:`str`): Optional. Data to be sent in a callback query to the bot when
button is pressed, UTF-8 1-64 bytes.
switch_inline_query (:obj:`str`): Optional. Will prompt the user to select one of their
chats, open that chat and insert the bot's username and the specified inline query in
the input field. Can be empty, in which case just the bot’s username will be inserted.
switch_inline_query_current_chat (:obj:`str`): Optional. Will insert the bot's username and
the specified inline query in the current chat's input field. Can be empty, in which
case just the bot’s username will be inserted.
callback_game (:class:`telegram.CallbackGame`): Optional. Description of the game that will
be launched when the user presses the button.
pay (:obj:`bool`): Optional. Specify True, to send a Pay button.
Args:
text (:obj:`str`): Label text on the button.
url (:obj:`str`): HTTP or tg:// url to be opened when button is pressed.
login_url (:class:`telegram.LoginUrl`, optional) An HTTP URL used to automatically
authorize the user. Can be used as a replacement for the Telegram Login Widget.
callback_data (:obj:`str`, optional): Data to be sent in a callback query to the bot when
button is pressed, UTF-8 1-64 bytes.
switch_inline_query (:obj:`str`, optional): If set, pressing the button will prompt the
user to select one of their chats, open that chat and insert the bot's username and the
specified inline query in the input field. Can be empty, in which case just the bot's
username will be inserted. This offers an easy way for users to start using your bot
in inline mode when they are currently in a private chat with it. Especially useful
when combined with switch_pm* actions - in this case the user will be automatically
returned to the chat they switched from, skipping the chat selection screen.
switch_inline_query_current_chat (:obj:`str`, optional): If set, pressing the button will
insert the bot's username and the specified inline query in the current chat's input
field. Can be empty, in which case only the bot's username will be inserted. This
offers a quick way for the user to open your bot in inline mode in the same chat - good
for selecting something from multiple options.
callback_game (:class:`telegram.CallbackGame`, optional): Description of the game that will
be launched when the user presses the button. This type of button must always be
the ``first`` button in the first row.
pay (:obj:`bool`, optional): Specify :obj:`True`, to send a Pay button. This type of button
must always be the ``first`` button in the first row.
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
"""
def __init__(self,
text,
url=None,
callback_data=None,
switch_inline_query=None,
switch_inline_query_current_chat=None,
callback_game=None,
pay=None,
login_url=None,
**kwargs):
# Required
self.text = text
# Optionals
self.url = url
self.login_url = login_url
self.callback_data = callback_data
self.switch_inline_query = switch_inline_query
self.switch_inline_query_current_chat = switch_inline_query_current_chat
self.callback_game = callback_game
self.pay = pay
@classmethod
def de_json(cls, data, bot):
if not data:
return None
return cls(**data)
| {
"pile_set_name": "Github"
} |
/***********************************************************************
*
* Copyright (c) 2012-2020 Barbara Geller
* Copyright (c) 2012-2020 Ansel Sermersheim
*
* Copyright (c) 2015 The Qt Company Ltd.
* Copyright (c) 2012-2016 Digia Plc and/or its subsidiary(-ies).
* Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This file is part of CopperSpice.
*
* CopperSpice is free software. You can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* CopperSpice 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.
*
* https://www.gnu.org/licenses/
*
***********************************************************************/
#ifndef QGSTREAMERAVAILABILITYCONTROL_H
#define QGSTREAMERAVAILABILITYCONTROL_H
#include <QObject>
#include <qmediaavailabilitycontrol.h>
class QMediaPlayerResourceSetInterface;
class QGStreamerAvailabilityControl : public QMediaAvailabilityControl
{
CS_OBJECT(QGStreamerAvailabilityControl)
public:
QGStreamerAvailabilityControl(QMediaPlayerResourceSetInterface *resources, QObject *parent = nullptr);
QMultimedia::AvailabilityStatus availability() const override;
private:
QMediaPlayerResourceSetInterface *m_resources;
CS_SLOT_1(Private, void handleAvailabilityChanged())
CS_SLOT_2(handleAvailabilityChanged)
};
#endif
| {
"pile_set_name": "Github"
} |
/*
* Translated default messages for the jQuery validation plugin.
* Locale: FR (French; français)
*/
$.extend($.validator.messages, {
required: "Ce champ est obligatoire.",
remote: "Veuillez corriger ce champ.",
email: "Veuillez fournir une adresse électronique valide.",
url: "Veuillez fournir une adresse URL valide.",
date: "Veuillez fournir une date valide.",
dateISO: "Veuillez fournir une date valide (ISO).",
number: "Veuillez fournir un numéro valide.",
digits: "Veuillez fournir seulement des chiffres.",
creditcard: "Veuillez fournir un numéro de carte de crédit valide.",
equalTo: "Veuillez fournir encore la même valeur.",
extension: "Veuillez fournir une valeur avec une extension valide.",
maxlength: $.validator.format("Veuillez fournir au plus {0} caractères."),
minlength: $.validator.format("Veuillez fournir au moins {0} caractères."),
rangelength: $.validator.format("Veuillez fournir une valeur qui contient entre {0} et {1} caractères."),
range: $.validator.format("Veuillez fournir une valeur entre {0} et {1}."),
max: $.validator.format("Veuillez fournir une valeur inférieure ou égale à {0}."),
min: $.validator.format("Veuillez fournir une valeur supérieure ou égale à {0}."),
maxWords: $.validator.format("Veuillez fournir au plus {0} mots."),
minWords: $.validator.format("Veuillez fournir au moins {0} mots."),
rangeWords: $.validator.format("Veuillez fournir entre {0} et {1} mots."),
letterswithbasicpunc: "Veuillez fournir seulement des lettres et des signes de ponctuation.",
alphanumeric: "Veuillez fournir seulement des lettres, nombres, espaces et soulignages.",
lettersonly: "Veuillez fournir seulement des lettres.",
nowhitespace: "Veuillez ne pas inscrire d'espaces blancs.",
ziprange: "Veuillez fournir un code postal entre 902xx-xxxx et 905-xx-xxxx.",
integer: "Veuillez fournir un nombre non décimal qui est positif ou négatif.",
vinUS: "Veuillez fournir un numéro d'identification du véhicule (VIN).",
dateITA: "Veuillez fournir une date valide.",
time: "Veuillez fournir une heure valide entre 00:00 et 23:59.",
phoneUS: "Veuillez fournir un numéro de téléphone valide.",
phoneUK: "Veuillez fournir un numéro de téléphone valide.",
mobileUK: "Veuillez fournir un numéro de téléphone mobile valide.",
strippedminlength: $.validator.format("Veuillez fournir au moins {0} caractères."),
email2: "Veuillez fournir une adresse électronique valide.",
url2: "Veuillez fournir une adresse URL valide.",
creditcardtypes: "Veuillez fournir un numéro de carte de crédit valide.",
ipv4: "Veuillez fournir une adresse IP v4 valide.",
ipv6: "Veuillez fournir une adresse IP v6 valide.",
require_from_group: "Veuillez fournir au moins {0} de ces champs.",
nifES: "Veuillez fournir un numéro NIF valide.",
nieES: "Veuillez fournir un numéro NIE valide.",
cifES: "Veuillez fournir un numéro CIF valide.",
postalCodeCA: "Veuillez fournir un code postal valide."
});
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
*
* https://www.gz-yami.com/
*
* 未经允许,不可做商业用途!
*
* 版权所有,侵权必究!
*/
package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
* 分组标签引用
*
* @author hzm
* @date 2019-04-18 16:28:01
*/
@Data
@TableName("tz_prod_tag_reference")
public class ProdTagReference implements Serializable{
private static final long serialVersionUID = 1L;
/**
* 分组引用id
*/
@TableId
private Long referenceId;
/**
* 店铺id
*/
private Long shopId;
/**
* 标签id
*/
private Long tagId;
/**
* 商品id
*/
private Long prodId;
/**
* 状态(1:正常,0:删除)
*/
private Integer status;
/**
* 创建时间
*/
private Date createTime;
}
| {
"pile_set_name": "Github"
} |
export class LinePrefix {
static getPrefix(lineNumber, maxDigits) {
let leadingSpaces = getLeadingSpaces(lineNumber, maxDigits);
return `${getSpaces(leadingSpaces)}${lineNumber} | `;
}
}
const DEFAULT_LEADING_SPACE = 2;
const getLeadingSpaces = (number, maxDigits) => {
const numberLength = number.toString().length;
return DEFAULT_LEADING_SPACE + maxDigits - numberLength;
};
const getSpaces = (howMany) => {
return new Array(howMany + 1).join(' ');
};
export class MarkedLinePrefix extends LinePrefix {
static getPrefix() {
const defaultPrefix = LinePrefix.getPrefix(...arguments).substr(1);
return `>${defaultPrefix}`;
}
}
| {
"pile_set_name": "Github"
} |
using System;
namespace PowerArgs
{
/// <summary>
/// Enum used to specify how user errors (ArgExceptions) should be handled by the parser.
/// </summary>
public enum ArgExceptionPolicy
{
/// <summary>
/// The default, PowerArgs will throw these exceptions for your program to handle.
/// </summary>
DontHandleExceptions,
/// <summary>
/// PowerArgs will print the user friendly error message as well as the auto-generated usage documentation
/// for the program.
/// </summary>
StandardExceptionHandling,
}
/// <summary>
/// Use this attrbiute to opt into standard error handling of user input errors.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class ArgExceptionBehavior : Attribute, ICommandLineArgumentsDefinitionMetadata
{
/// <summary>
/// The policy to use, defaults to DontHandleExceptions.
/// </summary>
public ArgExceptionPolicy Policy { get; private set; }
/// <summary>
/// A type that should implement IUsageTemplateProvider. When specified the help hook will use the GenerateUsageFromTemplate function rather than the obsolete GenerateStyledUsage function.
/// </summary>
public Type UsageTemplateProviderType { get; set; }
/// <summary>
/// Creates a new ArgExceptionBehavior attributes with the given policy.
/// </summary>
/// <param name="policy">The policy to use, defaults to DontHandleExceptions.</param>
public ArgExceptionBehavior(ArgExceptionPolicy policy = ArgExceptionPolicy.DontHandleExceptions)
{
this.Policy = policy;
this.UsageTemplateProviderType = typeof(DefaultConsoleUsageTemplateProvider);
}
}
}
| {
"pile_set_name": "Github"
} |
package org.infinispan.persistence.jdbc.configuration;
import static org.infinispan.persistence.jdbc.configuration.Element.CONNECTION_POOL;
import org.infinispan.commons.configuration.BuiltBy;
import org.infinispan.commons.configuration.attributes.Attribute;
import org.infinispan.commons.configuration.attributes.AttributeDefinition;
import org.infinispan.commons.configuration.attributes.AttributeSet;
import org.infinispan.commons.configuration.elements.DefaultElementDefinition;
import org.infinispan.commons.configuration.elements.ElementDefinition;
import org.infinispan.persistence.jdbc.connectionfactory.ConnectionFactory;
import org.infinispan.persistence.jdbc.impl.connectionfactory.PooledConnectionFactory;
@BuiltBy(PooledConnectionFactoryConfigurationBuilder.class)
public class PooledConnectionFactoryConfiguration extends AbstractUnmanagedConnectionFactoryConfiguration {
public static final AttributeDefinition<String> PROPERTY_FILE = AttributeDefinition.builder("propertyFile", null, String.class).immutable().build();
public static AttributeSet attributeSet() {
return new AttributeSet(PooledConnectionFactoryConfiguration.class, AbstractUnmanagedConnectionFactoryConfiguration.attributeSet(), PROPERTY_FILE);
}
static ElementDefinition ELEMENT_DEFINITION = new DefaultElementDefinition(CONNECTION_POOL.getLocalName());
private final Attribute<String> propertyFile;
protected PooledConnectionFactoryConfiguration(AttributeSet attributes) {
super(attributes);
this.propertyFile = attributes.attribute(PROPERTY_FILE);
}
@Override
public ElementDefinition getElementDefinition() {
return ELEMENT_DEFINITION;
}
public String propertyFile() {
return propertyFile.get();
}
@Override
public Class<? extends ConnectionFactory> connectionFactoryClass() {
return PooledConnectionFactory.class;
}
@Override
public AttributeSet attributes() {
return attributes;
}
}
| {
"pile_set_name": "Github"
} |
# Contains Duplicate
`Easy`
Given an array of integers, find if the array contains any duplicates.
Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
## Example 1:
```
Input: [1,2,3,1]
Output: true
```
## Example 2:
```
Input: [1,2,3,4]
Output: false
```
## Example 3:
```
Input: [1,1,1,3,3,4,3,2,4,2]
Output: true
```
## Complexity Analysis (sorting approach):
- **Time complexity** : `O(n log n)`. Sorting is the expensive part. The iteration/sweeping otherwise happens in `O(n)`
- **Space complexity** : **`O(1)`**. If `heapsort` is used, space complexity will be `O(1)`
## Complexity Analysis (HashSet approach):
- **Time complexity** : **`O(n))`**. We do `has()` and `add()` operations on the hash-set for `n` times and each operation takes constant time.
- **Space complexity** : `O(n)`. The space complexity of the Hash-Set with max of `n` items.
## Note
For certain test cases with not very large `n`, the runtime of **HashSet approach can be slower than sorting approach**. The reason is hash table has some overhead in maintaining its property. One should keep in mind that real world performance can be different from what the Big-O notation says. The Big-O notation only tells us that for sufficiently large input, one will be faster than the other. Therefore, when `n` is not sufficiently large, an `O(n)` algorithm can be slower than an `O(n log n)` algorithm.
#### [LeetCode link](https://leetcode.com/problems/add-two-numbers/) | {
"pile_set_name": "Github"
} |
/*
* Copyright 2010 Swiz Framework Contributors
*
* 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. 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.apache.royale.crux.reflection
{
/**
* Simple key/value representation of a metadata tag argument.
*/
public class MetadataArg
{
/**
* Constructor sets initial values of required parameters.
*
* @param key
* @param value
*/
public function MetadataArg( key:String, value:String )
{
this.key = key;
this.value = value;
}
/**
* Name of metadata tag argument, e.g. "source" for [Inject( source="someModel" )]
* @royalesuppresspublicvarwarning
*/
public var key:String;
/**
* Value of metadata tag argument, e.g. "someModel" for [Inject( source="someModel" )]
* @royalesuppresspublicvarwarning
*/
public var value:String;
/**
* @return String representation of this metadata tag argument.
*/
public function toString():String
{
var str:String = "MetadataArg: ";
str += key + " = " + value + "\n";
return str;
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 MovingBlocks
*
* 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 org.terasology.persistence.typeHandling.coreTypes.factories;
import org.terasology.persistence.typeHandling.TypeHandler;
import org.terasology.persistence.typeHandling.TypeHandlerFactory;
import org.terasology.persistence.typeHandling.TypeHandlerContext;
import org.terasology.persistence.typeHandling.coreTypes.ArrayTypeHandler;
import org.terasology.persistence.typeHandling.coreTypes.RuntimeDelegatingTypeHandler;
import org.terasology.reflection.TypeInfo;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.Type;
import java.util.Optional;
/**
* Creates type handlers for arrays.
*/
public class ArrayTypeHandlerFactory implements TypeHandlerFactory {
@Override
public <T> Optional<TypeHandler<T>> create(TypeInfo<T> typeInfo, TypeHandlerContext context) {
Type type = typeInfo.getType();
if (!(type instanceof GenericArrayType || type instanceof Class && ((Class<?>) type).isArray())) {
return Optional.empty();
}
Type elementType = type instanceof GenericArrayType
? ((GenericArrayType) type).getGenericComponentType()
: ((Class<?>) type).getComponentType();
TypeInfo<?> elementTypeInfo = TypeInfo.of(elementType);
Optional<TypeHandler<?>> declaredElementTypeHandler =
context.getTypeHandlerLibrary().getTypeHandler(elementType);
@SuppressWarnings({"unchecked"})
TypeHandler<?> elementTypeHandler = new RuntimeDelegatingTypeHandler(
declaredElementTypeHandler.orElse(null),
elementTypeInfo,
context
);
@SuppressWarnings({"unchecked"})
TypeHandler<T> typeHandler = new ArrayTypeHandler(elementTypeHandler, elementTypeInfo);
return Optional.of(typeHandler);
}
}
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* HellFirePvP / Astral Sorcery 2020
*
* All rights reserved.
* The source code is available on github: https://github.com/HellFirePvP/AstralSorcery
* For further details, see the License file there.
******************************************************************************/
package hellfirepvp.astralsorcery.common.util.block;
import net.minecraft.entity.Entity;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import javax.annotation.Nullable;
/**
* This class is part of the Astral Sorcery Mod
* The complete source code for this mod can be found on github.
* Class: TestBlockUseContext
* Created by HellFirePvP
* Date: 29.02.2020 / 12:07
*/
public class TestBlockUseContext extends BlockItemUseContext {
private final Entity entity;
private TestBlockUseContext(World worldIn, @Nullable Entity usingEntity, Hand hand, ItemStack stack, BlockPos at, Direction side) {
super(worldIn, null, hand, stack, new BlockRayTraceResult(new Vec3d(at).add(0.5, 0.5, 0.5), side, at, false));
this.entity = usingEntity;
}
public static BlockItemUseContext getHandContext(World worldIn, @Nullable Entity usingEntity, Hand usedHand, BlockPos at, Direction side) {
return getHandContextWithItem(worldIn, usingEntity, usedHand, ItemStack.EMPTY, at, side);
}
public static BlockItemUseContext getHandContextWithItem(World worldIn, @Nullable Entity usingEntity, Hand usedHand, ItemStack stack, BlockPos at, Direction side) {
return new TestBlockUseContext(worldIn, usingEntity, usedHand, stack, at, side);
}
@Override
public Direction getPlacementHorizontalFacing() {
return this.entity == null ? Direction.NORTH : Direction.fromAngle(this.entity.rotationYaw);
}
@Override
public Direction getNearestLookingDirection() {
return Direction.getFacingDirections(this.entity)[0];
}
@Override
public Direction[] getNearestLookingDirections() {
Direction[] adirection = Direction.getFacingDirections(this.entity);
if (this.replaceClicked) {
return adirection;
} else {
Direction direction = this.getFace();
int i;
i = 0;
while (i < adirection.length && adirection[i] != direction.getOpposite()) {
++i;
}
if (i > 0) {
System.arraycopy(adirection, 0, adirection, 1, i);
adirection[0] = direction.getOpposite();
}
return adirection;
}
}
@Override
public boolean func_225518_g_() {
return false;
}
@Override
public float getPlacementYaw() {
return 0F;
}
}
| {
"pile_set_name": "Github"
} |
client
dev tun
proto udp
remote 5.157.13.3 443
resolv-retry infinite
nobind
cipher AES-256-CBC
auth SHA512
verb 3
auth-user-pass ../Own_VPN_Config/protonvpnauth.txt
tun-mtu 1500
tun-mtu-extra 32
mssfix 1450
persist-key
persist-tun
ping 15
ping-restart 0
ping-timer-rem
reneg-sec 0
remote-cert-tls server
pull
fast-io
#register-dns
#block-outside-dns
<ca>
-----BEGIN CERTIFICATE-----
MIIFozCCA4ugAwIBAgIBATANBgkqhkiG9w0BAQ0FADBAMQswCQYDVQQGEwJDSDEV
MBMGA1UEChMMUHJvdG9uVlBOIEFHMRowGAYDVQQDExFQcm90b25WUE4gUm9vdCBD
QTAeFw0xNzAyMTUxNDM4MDBaFw0yNzAyMTUxNDM4MDBaMEAxCzAJBgNVBAYTAkNI
MRUwEwYDVQQKEwxQcm90b25WUE4gQUcxGjAYBgNVBAMTEVByb3RvblZQTiBSb290
IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt+BsSsZg7+AuqTq7
vDbPzfygtl9f8fLJqO4amsyOXlI7pquL5IsEZhpWyJIIvYybqS4s1/T7BbvHPLVE
wlrq8A5DBIXcfuXrBbKoYkmpICGc2u1KYVGOZ9A+PH9z4Tr6OXFfXRnsbZToie8t
2Xjv/dZDdUDAqeW89I/mXg3k5x08m2nfGCQDm4gCanN1r5MT7ge56z0MkY3FFGCO
qRwspIEUzu1ZqGSTkG1eQiOYIrdOF5cc7n2APyvBIcfvp/W3cpTOEmEBJ7/14RnX
nHo0fcx61Inx/6ZxzKkW8BMdGGQF3tF6u2M0FjVN0lLH9S0ul1TgoOS56yEJ34hr
JSRTqHuar3t/xdCbKFZjyXFZFNsXVvgJu34CNLrHHTGJj9jiUfFnxWQYMo9UNUd4
a3PPG1HnbG7LAjlvj5JlJ5aqO5gshdnqb9uIQeR2CdzcCJgklwRGCyDT1pm7eoiv
WV19YBd81vKulLzgPavu3kRRe83yl29It2hwQ9FMs5w6ZV/X6ciTKo3etkX9nBD9
ZzJPsGQsBUy7CzO1jK4W01+u3ItmQS+1s4xtcFxdFY8o/q1zoqBlxpe5MQIWN6Qa
lryiET74gMHE/S5WrPlsq/gehxsdgc6GDUXG4dk8vn6OUMa6wb5wRO3VXGEc67IY
m4mDFTYiPvLaFOxtndlUWuCruKcCAwEAAaOBpzCBpDAMBgNVHRMEBTADAQH/MB0G
A1UdDgQWBBSDkIaYhLVZTwyLNTetNB2qV0gkVDBoBgNVHSMEYTBfgBSDkIaYhLVZ
TwyLNTetNB2qV0gkVKFEpEIwQDELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFByb3Rv
blZQTiBBRzEaMBgGA1UEAxMRUHJvdG9uVlBOIFJvb3QgQ0GCAQEwCwYDVR0PBAQD
AgEGMA0GCSqGSIb3DQEBDQUAA4ICAQCYr7LpvnfZXBCxVIVc2ea1fjxQ6vkTj0zM
htFs3qfeXpMRf+g1NAh4vv1UIwLsczilMt87SjpJ25pZPyS3O+/VlI9ceZMvtGXd
MGfXhTDp//zRoL1cbzSHee9tQlmEm1tKFxB0wfWd/inGRjZxpJCTQh8oc7CTziHZ
ufS+Jkfpc4Rasr31fl7mHhJahF1j/ka/OOWmFbiHBNjzmNWPQInJm+0ygFqij5qs
51OEvubR8yh5Mdq4TNuWhFuTxpqoJ87VKaSOx/Aefca44Etwcj4gHb7LThidw/ky
zysZiWjyrbfX/31RX7QanKiMk2RDtgZaWi/lMfsl5O+6E2lJ1vo4xv9pW8225B5X
eAeXHCfjV/vrrCFqeCprNF6a3Tn/LX6VNy3jbeC+167QagBOaoDA01XPOx7Odhsb
Gd7cJ5VkgyycZgLnT9zrChgwjx59JQosFEG1DsaAgHfpEl/N3YPJh68N7fwN41Cj
zsk39v6iZdfuet/sP7oiP5/gLmA/CIPNhdIYxaojbLjFPkftVjVPn49RqwqzJJPR
N8BOyb94yhQ7KO4F3IcLT/y/dsWitY0ZH4lCnAVV/v2YjWAWS3OWyC8BFx/Jmc3W
DK/yPwECUcPgHIeXiRjHnJt0Zcm23O2Q3RphpU+1SO3XixsXpOVOYP6rJIXW9bMZ
A1gTTlpi7A==
-----END CERTIFICATE-----
</ca>
key-direction 1
<tls-auth>
# 2048 bit OpenVPN static key
-----BEGIN OpenVPN Static key V1-----
6acef03f62675b4b1bbd03e53b187727
423cea742242106cb2916a8a4c829756
3d22c7e5cef430b1103c6f66eb1fc5b3
75a672f158e2e2e936c3faa48b035a6d
e17beaac23b5f03b10b868d53d03521d
8ba115059da777a60cbfd7b2c9c57472
78a15b8f6e68a3ef7fd583ec9f398c8b
d4735dab40cbd1e3c62a822e97489186
c30a0b48c7c38ea32ceb056d3fa5a710
e10ccc7a0ddb363b08c3d2777a3395e1
0c0b6080f56309192ab5aacd4b45f55d
a61fc77af39bd81a19218a79762c3386
2df55785075f37d8c71dc8a42097ee43
344739a0dd48d03025b0450cf1fb5e8c
aeb893d9a96d1f15519bb3c4dcb40ee3
16672ea16c012664f8a9f11255518deb
-----END OpenVPN Static key V1-----
</tls-auth>
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2010-2020 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.yeelight.internal.lib.device;
import org.openhab.binding.yeelight.internal.lib.enums.ActiveMode;
import org.openhab.binding.yeelight.internal.lib.enums.DeviceType;
import org.openhab.binding.yeelight.internal.lib.enums.MethodAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
/**
* The {@link CeilingDeviceWithNightDevice} contains methods for handling the ceiling device with ambient light.
*
* @author Nikita Pogudalov - Initial contribution
*/
public class CeilingDeviceWithNightDevice extends CeilingDevice implements DeviceWithNightlight {
private final Logger logger = LoggerFactory.getLogger(CeilingDeviceWithNightDevice.class);
public CeilingDeviceWithNightDevice(String id) {
super(id);
mDeviceType = DeviceType.ceiling1;
}
@Override
public void onNotify(String msg) {
logger.debug("Got state: {}", msg);
JsonObject result = new JsonParser().parse(msg).getAsJsonObject();
if (result.has("id")) {
String id = result.get("id").getAsString();
// for cmd transaction.
if (mQueryList.contains(id)) {
JsonArray status = result.get("result").getAsJsonArray();
final int activeMode = status.get(8).getAsInt();
mDeviceStatus.setActiveMode(ActiveMode.values()[activeMode]);
}
}
super.onNotify(msg);
}
@Override
public void toggleNightlightMode(boolean turnOn) {
if (turnOn) {
mConnection.invoke(
new DeviceMethod(MethodAction.SCENE, new Object[] { "nightlight", mDeviceStatus.getBrightness() }));
} else {
mConnection.invoke(MethodFactory.buildCTMethod(mDeviceStatus.getCt(), DeviceMethod.EFFECT_SMOOTH, 500));
}
}
}
| {
"pile_set_name": "Github"
} |

<h1> HTML5Sortable </h1>
[](https://travis-ci.org/lukasoppermann/html5sortable) [](LICENSE.md) [](https://coveralls.io/github/lukasoppermann/html5sortable) [](https://snyk.io/test/github/lukasoppermann/html5sortable) [](https://www.npmjs.com/package/html5sortable) [](https://www.npmjs.com/package/html5sortable) [](CONTRIBUTING.md) [](CODE_OF_CONDUCT.md)
> **Lightweight vanillajs micro-library for creating sortable lists and grids using native HTML5 drag and drop API.**
# Table of Contents
* [Community maintained](#community-maintained)
* [Looking for Co-Maintainer](#looking-for-co-maintainer)
* [Features](#features)
* [Framework adapters](#framework-adapters)
* [Installation](#installation)
* [Examples](#examples)
* [Docs](#docs)
* [Usage](#usage)
* [Styling](#styling)
* [Nesting](#nesting)
* [Events](#events)
* [Options](#options)
* [Methods](#methods)
* [Sorting table rows](#sorting-table-rows)
* [Contributing](#contributing)
* [Polyfills](#polyfills-facing-towards-the-future-instead-of-the-past)
* [Known Issues](#known-issues)
## Community maintained
A fair **warning:** this repository is currently not being actively developed. It works pretty fine, but if you find any issues you will need to fix them yourself. I try to keep the dependencies up to date and will happily help you fix issues and merge PRs for bugfixes or new features.
## Looking for Co-Maintainer
[](https://twitter.com/lukasoppermann)
If you are interested in actively helping with maintaining & improving this project please send me a message via twitter [@lukasoppermann](https://twitter.com/lukasoppermann) or email [email protected] with a short text of what you would like to do on the project. This may be something small like sorting issues and helping with questions and small bugs (if you have little time or are not that experienced) or something big like tackling big features.
## Features
* Only 2KB (minified and gzipped).
* Built using native HTML5 drag and drop API. No dependencies.
* Supports both list and grid style layouts.
* Supported Browsers: Current versions of all major browsers (Chrome, Firefox, Safari, Opera, Edge), [IE11+ (Polyfill required)](#polyfills-facing-towards-the-future-instead-of-the-past)
* Available as ES6 Module, AMD, CommonJS and iffe with `sortable` global
**Demo:** Check out the **[examples](http://lukasoppermann.github.io/html5sortable/index.html)**
## Framework adapters
If you would like to add an adapter to the list, please [create an issue](https://github.com/lukasoppermann/html5sortable/issues) with the link to your adapter.
- **Polymer:** https://github.com/trofrigo/polymer-html5sortable
## Installation
We recommend installing the package via npm.
```
npm install html5sortable --save
```
Once you install the package using `npm` or [downloading the latest release](https://github.com/lukasoppermann/html5sortable/releases/latest) (don't use the master branch), load file you need **from the `dist/` directory**, e.g. `dist/html.sortable.min.js` for the minified iife version.
- **iffe** (loading file via script tag): `dist/html5sortable.js` or `dist/html5sortable.min.js`
- **ES6 Module**: `dist/html5sortable.es.js`
- **CommonJS Module**: `dist/html5sortable.cjs.js`
- **AMD Module**: `dist/html5sortable.amd.js`
Still using **bower**? `bower install https://github.com/lukasoppermann/html5sortable.git`
## Examples
You can find the **[examples online](https://lukasoppermann.github.io/html5sortable/index.html)** or test locally. **Warning:** the online demo is just to show off the features and is most likely not up to date. Please study this readme file for the current way of implementing and using `html5sortable`.
## Docs
### Usage
Use `sortable` method to create a sortable list:
``` javascript
sortable('.sortable');
```
### Styling
Use `.sortable-placeholder` CSS selectors to change the styles of the placeholder. You may change the class by setting the `placeholderClass` option in the config object.
``` javascript
sortable('.sortable', {
placeholderClass: 'my-placeholder fade'
});
```
### Nesting
You can nest sortables inside each other. However, take care to add a wrapper around the items, a sortable-item can **not** at the same time be a `sortable`.
```html
<div class="list"><!-- Sortable -->
<div class="item"> Item 1
<div class="sublist"><!-- Nested Sortable; Wrapping container needed -->
<div class="subitem">Subitem 1</div>
<div class="subitem">Subitem 2</div>
</div>
</div>
<div class="item"> Item 2 </div>
</div>
```
## Events
NOTE: Events can be listened on any element from the group (when using `connectWith`), since the same event will be dispatched on all of them.
### sortstart
Use `sortstart` event if you want to do something when sorting starts:
``` javascript
sortable('.sortable')[0].addEventListener('sortstart', function(e) {
/*
This event is triggered when the user starts sorting and the DOM position has not yet changed.
e.detail.item - {HTMLElement} dragged element
Origin Container Data
e.detail.origin.index - {Integer} Index of the element within Sortable Items Only
e.detail.origin.elementIndex - {Integer} Index of the element in all elements in the Sortable Container
e.detail.origin.container - {HTMLElement} Sortable Container that element was moved out of (or copied from)
*/
});
```
### sortstop
Use the `sortstop` event if you want to do something when sorting stops:
``` javascript
sortable('.sortable')[0].addEventListener('sortstop', function(e) {
/*
This event is triggered when the user stops sorting and the DOM position has not yet changed.
e.detail.item - {HTMLElement} dragged element
Origin Container Data
e.detail.origin.index - {Integer} Index of the element within Sortable Items Only
e.detail.origin.elementIndex - {Integer} Index of the element in all elements in the Sortable Container
e.detail.origin.container - {HTMLElement} Sortable Container that element was moved out of (or copied from)
*/
});
```
### sortupdate
Use `sortupdate` event if you want to do something when the order changes (e.g. storing the new order):
``` javascript
sortable('.sortable')[0].addEventListener('sortupdate', function(e) {
console.log(e.detail);
/*
This event is triggered when the user stopped sorting and the DOM position has changed.
e.detail.item - {HTMLElement} dragged element
Origin Container Data
e.detail.origin.index - {Integer} Index of the element within Sortable Items Only
e.detail.origin.elementIndex - {Integer} Index of the element in all elements in the Sortable Container
e.detail.origin.container - {HTMLElement} Sortable Container that element was moved out of (or copied from)
e.detail.origin.itemsBeforeUpdate - {Array} Sortable Items before the move
e.detail.origin.items - {Array} Sortable Items after the move
Destination Container Data
e.detail.destination.index - {Integer} Index of the element within Sortable Items Only
e.detail.destination.elementIndex - {Integer} Index of the element in all elements in the Sortable Container
e.detail.destination.container - {HTMLElement} Sortable Container that element is moved into (or copied into)
e.detail.destination.itemsBeforeUpdate - {Array} Sortable Items before the move
e.detail.destination.items - {Array} Sortable Items after the move
*/
});
```
### sortenter
Fired when a dragitem enters a sortable container.
### sortleave
Fired when a dragitem leaves a sortable container.
## Options
### items
Use the `items` option to specify which items inside the element should be sortable:
``` javascript
sortable('.sortable', {
items: ':not(.disabled)'
});
```
### handle
Use the `handle` option to restrict drag start to the specified element:
``` javascript
sortable('.sortable', {
handle: 'h2'
});
```
### forcePlaceholderSize
Setting the `forcePlaceholderSize` option to true, forces the placeholder to have a height:
``` javascript
sortable('.sortable', {
forcePlaceholderSize: true
});
```
### connectWith 
**Use [`acceptFrom`](#acceptFrom) instead.** The `connectWith` option allows you to create a connected lists:
``` javascript
sortable('.js-sortable, .js-second-sortable', {
connectWith: 'connected' // unique string, which is not used for other connectWith sortables
});
```
### acceptFrom
Use the `acceptFrom` option to restrict which sortable's items will be accepted by this sortable. `acceptFrom` accepts a comma separated list of selectors or `false` to disabling accepting items. This is an alternative to the now **deprecated** [connectWith](#connectwith) and should not be used together.
``` javascript
sortable('.sortable', {
acceptFrom: '.sortable, .anotherSortable' // Defaults to null
});
```
***Note:*** Using `acceptFrom` also effects the sortable itself. This means, items will not be sortable within the list itself, if you do not include it in the `acceptFrom` option.
In the example the current list `.sortable` allows items within it to be sorted and accepts elements from `.anotherSortable`.
If you want to be able to move items between to sortables, the `acceptFrom` option must be present on both of them.
### placeholder
Use the `placeholder` option to specify the markup of the placeholder:
``` javascript
sortable('.sortable', {
items: 'tr' ,
placeholder: '<tr><td colspan="7"> </td></tr>'
});
```
### hoverClass
Use the `hoverClass` option to apply css classes to the hovered element rather than relying on `:hover`. This can eliminate some potential drag and drop issues where another element thinks it is being hovered over.
``` javascript
sortable('.sortable', {
hoverClass: 'is-hovered is-hovered-class' // Defaults to false
});
```
### dropTargetContainerClass
Use `dropTargetContainerClass` option to apply a css Class to the container. The class is added when dragged item enters the container and removed when it leaves it (or is dropped).
``` javascript
sortable('.sortable', {
dropTargetContainerClass: 'is-drop-target' // Defaults to false
});
```
### maxItems
Use the `maxItems` option to restrict the number of items that can be added to a sortable from a [connected](#connectwith) sortable. `maxItems` should always be combined with the `items` option. Make sure `items` does not match placeholder and other options, so that they are not counted.
``` javascript
sortable('.sortable', {
maxItems: 3 // Defaults to 0 (no limit)
});
```
### copy
Use the `copy` option to duplicate the element on drag. The original element will remain in the same position.
``` javascript
sortable('.sortable', {
copy: true // Defaults to false
});
```
### orientation
Use the `orientation` option to specify the orientation of your list and fix incorrect hover behaviour. Defaults to `'vertical'`.
``` javascript
sortable('.sortable', {
orientation: 'horizontal' // Defaults to 'vertical'
});
```
### itemSerializer
You can provide a `function` that will be applied to every item in the `items` array ([see serialize](#serialize)). The function receives two arguments: `serializedItem: object`, `sortableContainer: Element`. This function can be used to change the output for the items. Defaults to `undefined`.
``` javascript
sortable('.sortable', {
itemSerializer: (serializedItem, sortableContainer) => {
return {
position: serializedItem.index + 1,
html: serializedItem.html
}
}
});
```
### containerSerializer
You can provide a `function` that will be applied to the `container` object ([see serialize](#serialize)). The function receives one argument: `serializedContainer: object`. This function can be used to change the output for the container. Defaults to `undefined`.
``` javascript
sortable('.sortable', {
containerSerializer: (serializedContainer) => {
return {
length: container.itemCount
}
}
});
```
### customDragImage
You can provide a function as a `customDragImage` property on the options object which will be used to create the item and position of the drag image (the half transparent item you see when dragging an element).
The function gets three parameters, the dragged element, an offset object with the offset values for the offset of the item and the `dragstart` event. The function **MUST** return an object with an `element` property with an html element as well as a `posX` and `posY` property with has the x and y offset for the dragImage.
``` javascript
sortable('.sortable', {
customDragImage: (draggedElement, elementOffset, event) => {
return {
element: draggedElement,
posX: event.pageX - elementOffset.left,
posY: event.pageY - elementOffset.top
}
}
});
// elementOffset object that is received in the customDragImage function
{
left: rect.left + window.scrollX,
right: rect.right + window.scrollX,
top: rect.top + window.scrollY,
bottom: rect.bottom + window.scrollY
}
```
## Methods
### destroy
To remove the sortable functionality completely:
``` javascript
sortable('.sortable', 'destroy');
```
### disable
To disable the sortable temporarily:
``` javascript
sortable('.sortable', 'disable');
```
### enable
To enable a disabled sortable:
``` javascript
sortable('.sortable', 'enable');
```
### serialize
You can easily serialize a sortable using the `serialize` command. If you provided an [`itemSerializer`](#itemSerializer) or [`containerSerializer`](#containerSerializer) function in the options object, they will be applied to the `container` object and the `items` objects before they are returned.
``` javascript
sortable('.sortable', 'serialize');
// You will receive an object in the following format
[{
container: {
node: sortableContainer,
itemCount: items.length
}
items: [{
parent: sortableContainer,
node: item,
html: item.outerHTML,
index: index(item, items)
}, …]
}, …]
```
### reload
When you add a new item to a sortable, it will not automatically be a draggable item, so you will need to reinit the sortable. Your previously added options will be preserved.
``` javascript
sortable('.sortable');
```
## Sorting table rows
* Initialize plugin on `tbody` element (browsers automatically add `tbody` if you don't)
* Keep in mind that different browsers may display different drag images of the row during the drag action. Webkit browsers seem to hide entire contents of `td` cell if there are any inline elements inside the `td`. This may or may not be fixed by setting the `td` to be `position: relative;`
* If you add a custom `placeholder` you must use a `tr` e.g. `placeholder: "<tr><td colspan="3">The row will appear here</td></tr>"`, otherwise you will only be able to drop items when hovering the first column.
## Contributing
This version is maintained by [Lukas Oppermann](https://github.com/lukasoppermann) and [many other contributors](../../contributors). Thanks for your help! :+1:
Contributions are always welcome. Please check out the [contribution guidelines](CONTRIBUTING.md) to make it fast & easy for us to merge your PR.
**Issues:** If you create a [bug report](https://github.com/lukasoppermann/html5sortable/issues/new/choose), please make sure to include a [test case](https://codepen.io/pen/?template=GRoQRxo) showing the issue. The easiest way is to copy the [codepen template](https://codepen.io/pen/?template=GRoQRxo).
## Polyfills: Facing towards the future instead of the past
This project is focusing on modern, evergreen browsers to deliver a fast and small package. While many projects try build features so that it runs in the oldest browser (looking at you IE9), we try to create a fast and pleasant development experience using the language capabilities that the current version of Javascript offers.
### Benefits
#### Small and fast package for modern browsers
While a backwards facing approach penalises modern browsers by making them download huge files, we prefer to ship a small package and have outdated browser bear the penalty of the polyfill. An additional benefit is that you might polyfill those features in any case so you don't have any additional load.
#### Contribution friendly code base
We try to encourage people to help shape the future of this package and contribute in small or big ways. By removing hard to understand hacks we make it easier for people new to the code base or even Javascript to contribute.
#### Helps browser optimisation
Browser try to performance optimise language features as much as possible. Working around the language to make code work in outdated browser may actually work against this.
### Polyfill
We recommend using the [Financial Times Polyfill Service](https://github.com/Financial-Times/polyfill-service) which will polyfill only the necessary features for browsers that need a polyfill. It is basically a no-config, easy solution.
```
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
```
## Known Issues
### Firefox
- **Dragstart not working on buttons**
Dragstart event does not fire on `button` elements. This effectively disables drag and drop for button elements. See https://caniuse.com/#feat=dragndrop in the known issues section.
- **Drag & Drop is not working on iOS**
But works in conjunction with [DragDropTouch](https://github.com/Bernardo-Castilho/dragdroptouch) [#522](https://github.com/lukasoppermann/html5sortable/issues/522).
| {
"pile_set_name": "Github"
} |
framework module E {
umbrella header "E-macOS-umbrella.h"
export *
module * { export * }
}
| {
"pile_set_name": "Github"
} |
#ifndef _ASMARM_STATFS_H
#define _ASMARM_STATFS_H
/*
* With EABI there is 4 bytes of padding added to this structure.
* Let's pack it so the padding goes away to simplify dual ABI support.
* Note that user space does NOT have to pack this structure.
*/
#define ARCH_PACK_STATFS64 __attribute__((packed,aligned(4)))
#include <asm-generic/statfs.h>
#endif
| {
"pile_set_name": "Github"
} |
<?php
/**
* This file is part of GameQ.
*
* GameQ is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* GameQ 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace GameQ\Query;
/**
* Core for the query mechanisms
*
* @author Austin Bischoff <[email protected]>
*/
abstract class Core
{
/**
* The socket used by this resource
*
* @type null|resource
*/
public $socket = null;
/**
* The transport type (udp, tcp, etc...)
* See http://php.net/manual/en/transports.php for the supported list
*
* @type string
*/
protected $transport = null;
/**
* Connection IP address
*
* @type string
*/
protected $ip = null;
/**
* Connection port
*
* @type int
*/
protected $port = null;
/**
* The time in seconds to wait before timing out while connecting to the socket
*
* @type int
*/
protected $timeout = 3; // Seconds
/**
* Socket is blocking?
*
* @type bool
*/
protected $blocking = false;
/**
* Called when the class is cloned
*/
public function __clone()
{
// Reset the properties for this class when cloned
$this->reset();
}
/**
* Set the connection information for the socket
*
* @param string $transport
* @param string $ip
* @param int $port
* @param int $timeout seconds
* @param bool $blocking
*/
public function set($transport, $ip, $port, $timeout = 3, $blocking = false)
{
$this->transport = $transport;
$this->ip = $ip;
$this->port = $port;
$this->timeout = $timeout;
$this->blocking = $blocking;
}
/**
* Reset this instance's properties
*/
public function reset()
{
$this->transport = null;
$this->ip = null;
$this->port = null;
$this->timeout = 3;
$this->blocking = false;
}
/**
* Create a new socket
*
* @return void
*/
abstract protected function create();
/**
* Get the socket
*
* @return mixed
*/
abstract public function get();
/**
* Write data to the socket
*
* @param string $data
*
* @return int The number of bytes written
*/
abstract public function write($data);
/**
* Close the socket
*
* @return void
*/
abstract public function close();
/**
* Read the responses from the socket(s)
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @param array $sockets
* @param int $timeout
* @param int $stream_timeout
*
* @return array
*/
abstract public function getResponses(array $sockets, $timeout, $stream_timeout);
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2019 The GraphicsFuzz Project Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.graphicsfuzz.generator.tool;
import com.graphicsfuzz.common.ast.IParentMap;
import com.graphicsfuzz.common.ast.TranslationUnit;
import com.graphicsfuzz.common.ast.decl.ArrayInfo;
import com.graphicsfuzz.common.ast.decl.DefaultLayout;
import com.graphicsfuzz.common.ast.decl.FunctionDefinition;
import com.graphicsfuzz.common.ast.decl.InterfaceBlock;
import com.graphicsfuzz.common.ast.decl.VariablesDeclaration;
import com.graphicsfuzz.common.ast.expr.ArrayIndexExpr;
import com.graphicsfuzz.common.ast.expr.BinOp;
import com.graphicsfuzz.common.ast.expr.BinaryExpr;
import com.graphicsfuzz.common.ast.expr.Expr;
import com.graphicsfuzz.common.ast.expr.FloatConstantExpr;
import com.graphicsfuzz.common.ast.expr.MemberLookupExpr;
import com.graphicsfuzz.common.ast.expr.TypeConstructorExpr;
import com.graphicsfuzz.common.ast.expr.VariableIdentifierExpr;
import com.graphicsfuzz.common.ast.stmt.BlockStmt;
import com.graphicsfuzz.common.ast.stmt.ExprStmt;
import com.graphicsfuzz.common.ast.stmt.ReturnStmt;
import com.graphicsfuzz.common.ast.stmt.Stmt;
import com.graphicsfuzz.common.ast.type.ArrayType;
import com.graphicsfuzz.common.ast.type.BasicType;
import com.graphicsfuzz.common.ast.type.BindingLayoutQualifier;
import com.graphicsfuzz.common.ast.type.LayoutQualifierSequence;
import com.graphicsfuzz.common.ast.type.LocalSizeLayoutQualifier;
import com.graphicsfuzz.common.ast.type.Std430LayoutQualifier;
import com.graphicsfuzz.common.ast.type.TypeQualifier;
import com.graphicsfuzz.common.ast.visitors.StandardVisitor;
import com.graphicsfuzz.common.transformreduce.GlslShaderJob;
import com.graphicsfuzz.common.transformreduce.ShaderJob;
import com.graphicsfuzz.common.typing.ScopeTrackingVisitor;
import com.graphicsfuzz.common.util.GlslParserException;
import com.graphicsfuzz.common.util.IRandom;
import com.graphicsfuzz.common.util.OpenGlConstants;
import com.graphicsfuzz.common.util.ParseTimeoutException;
import com.graphicsfuzz.common.util.PipelineInfo;
import com.graphicsfuzz.common.util.RandomWrapper;
import com.graphicsfuzz.common.util.ShaderJobFileOperations;
import com.graphicsfuzz.common.util.ShaderKind;
import com.graphicsfuzz.common.util.SsboFieldData;
import com.graphicsfuzz.generator.util.RemoveDiscardStatements;
import com.graphicsfuzz.util.ArgsUtil;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import net.sourceforge.argparse4j.ArgumentParsers;
import net.sourceforge.argparse4j.impl.Arguments;
import net.sourceforge.argparse4j.inf.ArgumentParser;
import net.sourceforge.argparse4j.inf.ArgumentParserException;
import net.sourceforge.argparse4j.inf.Namespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Turns a fragment shader into a compute shader. Intended as a best-effort bootstrapping
* mechanism to get a source of compute shaders.
*/
public class Fragment2Compute {
private static final Logger LOGGER = LoggerFactory.getLogger(Fragment2Compute.class);
private static final String COMPUTE_SHADER_DATA = "_compute_data";
private static Namespace parse(String[] args) throws ArgumentParserException {
ArgumentParser parser = ArgumentParsers.newArgumentParser("Fragment2Compute")
.defaultHelp(true)
.description("Turn a fragment shader into a compute shader.");
// Required arguments
parser.addArgument("fragment-json")
.help("Input fragment shader JSON file.")
.type(File.class);
parser.addArgument("compute-json")
.help("Output compute shader JSON file.")
.type(File.class);
parser.addArgument("--seed")
.help("Seed (unsigned 64 bit long integer) for random number generator.")
.type(String.class);
parser.addArgument("--vulkan")
.help("Put all uniforms in uniform blocks and generate "
+ "bindings; required for Vulkan compatibility. "
+ "Also enables vulkan-specific features and performs "
+ "shader validation as Vulkan target.")
.action(Arguments.storeTrue());
return parser.parseArgs(args);
}
private static ShaderJob transform(ShaderJob fragmentShaderJob, IRandom generator) {
assert fragmentShaderJob.getFragmentShader().isPresent();
assert !fragmentShaderJob.getVertexShader().isPresent();
assert !fragmentShaderJob.getComputeShader().isPresent();
int localSizeX;
int localSizeY;
int localSizeZ;
int numGroupsX;
int numGroupsY;
int numGroupsZ;
int totalSize;
do {
localSizeX = generator.nextInt(40) + 1;
localSizeY = generator.nextInt(40) + 1;
localSizeZ = generator.nextInt(40) + 1;
numGroupsX = generator.nextInt(7) + 1;
numGroupsY = generator.nextInt(7) + 1;
numGroupsZ = generator.nextInt(7) + 1;
totalSize = localSizeX * localSizeY * localSizeZ * numGroupsX * numGroupsY * numGroupsZ;
} while (totalSize >= 20000);
final TranslationUnit computeTu = fragmentShaderJob.getFragmentShader().get().clone();
final PipelineInfo computePipelineInfo = fragmentShaderJob.getPipelineInfo().clone();
computeTu.setShaderKind(ShaderKind.COMPUTE);
final String outputVariableName = demoteOutputVariable(computeTu);
replaceFragCoordWithIdLookup(computeTu);
addWritesToOutputBuffer(computeTu, outputVariableName);
new RemoveDiscardStatements(computeTu); // Remove all discard statements.
addComputeShaderStructures(computeTu, localSizeX, localSizeY, localSizeZ);
final List<Float> zeros = new LinkedList<>();
for (int i = 0; i < totalSize * 4; i++) {
zeros.add(0.0f);
}
computePipelineInfo.addComputeInfo(numGroupsX, numGroupsY, numGroupsZ,
0, Collections.singletonList(new SsboFieldData(BasicType.VEC4, zeros)));
return new GlslShaderJob(fragmentShaderJob.getLicense(), computePipelineInfo, computeTu);
}
/**
* <p>
* Find the single output variable for the fragment shader, demote it to a regular global
* variable, and return its name.
* </p>
* <p>
* Complain if there are multiple or no output variables
* </p>
*/
private static String demoteOutputVariable(TranslationUnit tu) {
List<VariablesDeclaration> outputVariables =
tu.getTopLevelDeclarations().stream()
.filter(item -> item instanceof VariablesDeclaration)
.map(item -> (VariablesDeclaration) item)
.filter(item -> item.getBaseType().hasQualifier(TypeQualifier.SHADER_OUTPUT))
.collect(Collectors.toList());
assert 1 == outputVariables.size();
assert 1 == outputVariables.get(0).getNumDecls();
assert BasicType.VEC4 == outputVariables.get(0).getBaseType().getWithoutQualifiers();
outputVariables.get(0).setBaseType(outputVariables.get(0).getBaseType().getWithoutQualifiers());
return outputVariables.get(0).getDeclInfo(0).getName();
}
/**
* Replace all references to gl_FragCoord with gl_GlobalInvocationID.
*/
private static void replaceFragCoordWithIdLookup(TranslationUnit computeTu) {
new ScopeTrackingVisitor() {
private IParentMap parentMap = IParentMap.createParentMap(computeTu);
@Override
public void visitVariableIdentifierExpr(VariableIdentifierExpr variableIdentifierExpr) {
super.visitVariableIdentifierExpr(variableIdentifierExpr);
if (variableIdentifierExpr.getName().equals(OpenGlConstants.GL_FRAG_COORD)) {
// It has the right name.
if (getCurrentScope().lookupScopeEntry(OpenGlConstants.GL_FRAG_COORD) == null) {
// It has no scope; i.e., it is built-in - so it is the real gl_FragCoord.
// Replace it with something made from gl_GlobalInvocationID.
parentMap.getParent(variableIdentifierExpr).replaceChild(variableIdentifierExpr,
new TypeConstructorExpr(
BasicType.VEC4.toString(),
getGlobalInvocationIdCastToFloat("x"),
getGlobalInvocationIdCastToFloat("y"),
getGlobalInvocationIdCastToFloat("z"),
new FloatConstantExpr("0.0")));
}
}
}
}.visit(computeTu);
}
public static TypeConstructorExpr getGlobalInvocationIdCastToFloat(String dimension) {
return new TypeConstructorExpr(BasicType.FLOAT.toString(),
getGlobalInvocationId(dimension));
}
public static MemberLookupExpr getGlobalInvocationId(String dimension) {
return new MemberLookupExpr(new VariableIdentifierExpr(OpenGlConstants.GL_GLOBAL_INVOCATION_ID),
dimension);
}
/**
* Instrument main so that before each return, the output variable is written to the output
* buffer.
*/
private static void addWritesToOutputBuffer(TranslationUnit computeTu,
String outputVariableName) {
// Get the main function, which is assumed to exist.
final FunctionDefinition mainFunction = computeTu.getMainFunction();
// Make sure there is an explicit return at the end of main.
if (mainFunction.getBody().getNumStmts() == 0
|| !(mainFunction.getBody().getStmt(mainFunction.getBody().getNumStmts() - 1)
instanceof ReturnStmt)) {
mainFunction.getBody().addStmt(new ReturnStmt());
}
new StandardVisitor() {
private IParentMap parentMap = IParentMap.createParentMap(computeTu);
@Override
public void visitReturnStmt(ReturnStmt returnStmt) {
final Expr indexExpr =
new BinaryExpr(
new BinaryExpr(
new BinaryExpr(
getGlobalInvocationId("z"),
new BinaryExpr(getWorkGroupSizeTimesNumWorkGroups("y"),
getWorkGroupSizeTimesNumWorkGroups("x"),
BinOp.MUL),
BinOp.MUL),
new BinaryExpr(
getGlobalInvocationId("y"),
getWorkGroupSizeTimesNumWorkGroups("x"),
BinOp.MUL),
BinOp.ADD),
getGlobalInvocationId("x"),
BinOp.ADD);
final Stmt assignment = new ExprStmt(
new BinaryExpr(
new ArrayIndexExpr(
new VariableIdentifierExpr(COMPUTE_SHADER_DATA),
indexExpr),
new VariableIdentifierExpr(outputVariableName),
BinOp.ASSIGN));
parentMap.getParent(returnStmt).replaceChild(returnStmt,
new BlockStmt(Arrays.asList(assignment, returnStmt), true));
}
}.visit(mainFunction);
}
public static BinaryExpr getWorkGroupSizeTimesNumWorkGroups(String dimension) {
return new BinaryExpr(new MemberLookupExpr(new
VariableIdentifierExpr(OpenGlConstants.GL_WORK_GROUP_SIZE),
dimension),
new MemberLookupExpr(new VariableIdentifierExpr(OpenGlConstants.GL_NUM_WORK_GROUPS), dimension),
BinOp.MUL);
}
/**
* Add SSBO, etc.
*/
private static void addComputeShaderStructures(TranslationUnit computeTu,
int localSizeX,
int localSizeY,
int localSizeZ) {
computeTu.addDeclaration(
new DefaultLayout(new LayoutQualifierSequence(
new LocalSizeLayoutQualifier("x", localSizeX),
new LocalSizeLayoutQualifier("y", localSizeY),
new LocalSizeLayoutQualifier("z", localSizeZ)),
TypeQualifier.SHADER_INPUT)
);
computeTu.addDeclaration(new InterfaceBlock(
Optional.of(new LayoutQualifierSequence(new Std430LayoutQualifier(),
new BindingLayoutQualifier(0))),
TypeQualifier.BUFFER,
"doesNotMatter",
Arrays.asList(COMPUTE_SHADER_DATA),
Arrays.asList(new ArrayType(BasicType.VEC4, new ArrayInfo())),
Optional.empty()));
}
public static void mainHelper(String... args) throws ArgumentParserException,
InterruptedException, GlslParserException, ParseTimeoutException, IOException {
final Namespace ns = parse(args);
final ShaderJobFileOperations fileOps = new ShaderJobFileOperations();
final IRandom generator = new RandomWrapper(ArgsUtil.getSeedArgument(ns));
final ShaderJob transformedShaderJob = transform(
fileOps.readShaderJobFile(ns.get("fragment_json")), generator);
if (ns.getBoolean("vulkan")) {
transformedShaderJob.makeUniformBindings(Optional.empty());
}
fileOps.writeShaderJobFile(transformedShaderJob,
ns.get("compute_json"));
}
public static void main(String[] args) {
try {
mainHelper(args);
} catch (Throwable exception) {
LOGGER.error("", exception);
System.exit(1);
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* !!!!! DO NOT EDIT THIS FILE !!!!!
*
* This file was generated from
* dictionary/structure/v4/content/dict_content.h
*/
#ifndef LATINIME_BACKWARD_V402_DICT_CONTENT_H
#define LATINIME_BACKWARD_V402_DICT_CONTENT_H
#include "defines.h"
namespace latinime {
namespace backward {
namespace v402 {
class DictContent {
public:
virtual ~DictContent() {}
virtual bool isValid() const = 0;
protected:
DictContent() {}
private:
DISALLOW_COPY_AND_ASSIGN(DictContent);
};
} // namespace v402
} // namespace backward
} // namespace latinime
#endif /* LATINIME_BACKWARD_V402_DICT_CONTENT_H */
| {
"pile_set_name": "Github"
} |
/*===================================================================================
*
* Copyright (c) Userware/OpenSilver.net
*
* This file is part of the OpenSilver Runtime (https://opensilver.net), which is
* licensed under the MIT license: https://opensource.org/licenses/MIT
*
* As stated in the MIT license, "the above copyright notice and this permission
* notice shall be included in all copies or substantial portions of the Software."
*
\*====================================================================================*/
using System;
namespace CSHTML5.Internal.Attributes
{
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class OutputRootPathAttribute : Attribute
{
public OutputRootPathAttribute(string outputRootPath)
{
this.OutputRootPath = outputRootPath;
}
public string OutputRootPath { get; private set; }
}
} | {
"pile_set_name": "Github"
} |
@file:Suppress("UNUSED_PARAMETER")
package io.mockk.impl.instantiation
import io.mockk.*
import io.mockk.impl.stub.Stub
import io.mockk.impl.stub.StubGatewayAccess
import io.mockk.impl.stub.StubRepository
import kotlin.reflect.KClass
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertSame
import kotlin.test.assertTrue
class AbstractMockFactoryTest {
lateinit var mockFactory: Factory
lateinit var stubRepo: StubRepository
lateinit var instantiator: AbstractInstantiator
lateinit var gatewayAccess: StubGatewayAccess
lateinit var mock: Mock
@BeforeTest
fun setUp() {
stubRepo = mockk(relaxed = true)
instantiator = mockk(relaxed = true)
gatewayAccess = mockk(relaxed = true)
mockFactory = spyk(Factory())
mock = mockk(relaxed = true)
}
@Test
fun whenRequestingMockkThenMockkCreated() {
every {
mockFactory.publicNewProxy<Mock>(any(), any(), any(), any(), any())
} returns mock
val mockk = mockFactory.mockk(Mock::class, "name", false, arrayOf(), relaxUnitFun = false)
assertSame(mock, mockk)
}
@Test
fun givenNameWhenRequestingMockkThenMockkWithNameCreated() {
every {
mockFactory.publicNewProxy<Mock>(any(), any(), any(), any(), any())
} returns mock
mockFactory.mockk(Mock::class, "name", false, arrayOf(), relaxUnitFun = false)
val stubSlot = CapturingSlot<Stub>()
verify {
mockFactory.publicNewProxy(any(), any(), capture(stubSlot), any(), any())
}
assertTrue(stubSlot.captured.name.startsWith("name"))
}
@Test
fun whenRequestingSpykThenSpykCreated() {
every {
mockFactory.publicNewProxy<Mock>(any(), any(), any(), any(), any())
} returns mock
val spyk = mockFactory.spyk(Mock::class, null, "name", arrayOf(), false)
assertSame(mock, spyk)
}
@Test
fun givenNameWhenRequestingSpykThenSpykWithNameCreated() {
every {
mockFactory.publicNewProxy<Mock>(any(), any(), any(), any(), any())
} returns mock
mockFactory.spyk(Mock::class, null, "name", arrayOf(), false)
val stubSlot = CapturingSlot<Stub>()
verify {
mockFactory.publicNewProxy(any(), any(), capture(stubSlot), any(), any())
}
assertTrue(stubSlot.captured.name.startsWith("name"))
}
@Test
fun whenRequestingChildMockkThenMockCreated() {
every {
mockFactory.publicNewProxy<Mock>(any(), any(), any(), any(), any())
} returns mock
val childMock = mockFactory.temporaryMock(Mock::class)
assertSame(mock, childMock)
}
class Mock
inner class Factory : AbstractMockFactory(stubRepo, instantiator, gatewayAccess) {
fun <T : Any> publicNewProxy(
cls: KClass<out T>,
moreInterfaces: Array<out KClass<*>>,
stub: Stub,
useDefaultConstructor: Boolean,
instantiate: Boolean
): T {
throw AssertionError("fail")
}
override fun <T : Any> newProxy(
cls: KClass<out T>,
moreInterfaces: Array<out KClass<*>>,
stub: Stub,
useDefaultConstructor: Boolean,
instantiate: Boolean
): T = publicNewProxy(cls, moreInterfaces, stub, useDefaultConstructor, instantiate)
}
} | {
"pile_set_name": "Github"
} |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const NullDependency = require("./NullDependency");
class RequireHeaderDependency extends NullDependency {
constructor(range) {
super();
if (!Array.isArray(range)) throw new Error("range must be valid");
this.range = range;
}
}
RequireHeaderDependency.Template = class RequireHeaderDependencyTemplate {
apply(dep, source) {
source.replace(dep.range[0], dep.range[1] - 1, "__webpack_require__");
}
applyAsTemplateArgument(name, dep, source) {
source.replace(dep.range[0], dep.range[1] - 1, "require");
}
};
module.exports = RequireHeaderDependency;
| {
"pile_set_name": "Github"
} |
class AddTypeToScriptReports < ActiveRecord::Migration[5.2]
def change
add_column :script_reports, :report_type, :string, limit: 20
execute 'update script_reports set report_type = "unauthorized_code" where report_type is null'
change_column_null :script_reports, :report_type, false
end
end
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>org.gradle.nativebinaries.language.objectivecpp.tasks (Gradle API 2.0)</title>
<meta name="keywords" content="org.gradle.nativebinaries.language.objectivecpp.tasks package">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" title="Style">
<link href="../../../../../../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../../../../../../groovy.ico" type="image/x-icon" rel="icon">
<script type="text/javascript">
function windowTitle()
{
parent.document.title="org.gradle.nativebinaries.language.objectivecpp.tasks (Gradle API 2.0)";
}
</script>
<noscript>
</noscript>
</head>
<body class="center" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<a name="navbar_top_firstrow"><!-- --></a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../index.html?org/gradle/nativebinaries/language/objectivecpp/tasks/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">Package org.gradle.nativebinaries.language.objectivecpp.tasks</h1>
</div>
<div class="header">
<h2 title=" Tasks for building Objective-C++ projects.
" class="title"> Tasks for building Objective-C++ projects.
</h2>
</div>
<div class="contentContainer">
<div class="summary">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Class Summary">
<caption><span>Class Summary</span><span class="tabEnd"> </span></caption>
<tbody>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colOne">
<strong><a href="ObjectiveCppCompile.html" title="class in org/gradle/nativebinaries/language/objectivecpp/tasks">
ObjectiveCppCompile
</a></strong>
</td>
<td>Compiles Objective-C++ source files into object files.</td>
</tr>
</tbody>
</table>
</li>
</ul>
</div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<div>
<ul class="navList">
<li><a href="index.html?deprecated-list.html" target="_top">Frames</a></li>
<li><a href="deprecated-list.html" target="_top">No Frames</a></li>
</ul>
</div>
<div class="aboutLanguage"><em>Gradle API 2.0</em></div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
1F000: Mahjong Tile East Wind
1F001: Mahjong Tile South Wind
1F002: Mahjong Tile West Wind
1F003: Mahjong Tile North Wind
1F004: Mahjong telha vermelha dragão : Hongzhong, 中
1F005: Mahjong Tile Green Dragon : qingfa
1F006: Mahjong telha branca dragão : Baiban
1F007: Mahjong Tile Um dos Personagens : macilento
1F008: Mahjong Tile Dois dos Personagens
1F009: Telha de Mahjong Três Personagens
1F00A: Mahjong Tile Quatro dos Personagens
1F00B: Telha de Mahjong Cinco de Personagens
1F00C: Mahjong Tile Seis dos Personagens
1F00D: Telha de Mahjong Sete de Personagens
1F00E: Telha de Mahjong Oito de Personagens
1F00F: Telha de Mahjong Nove de Personagens
1F010: Telha de Mahjong Um dos Bambus : tiao
1F011: Telha de Mahjong Dois dos Bambus
1F012: Telha de Mahjong Três dos Bambus
1F013: Telha de Mahjong Quatro dos Bambus
1F014: Telha de Mahjong Cinco dos Bambus
1F015: Mahjong Tile Six dos Bambus
1F016: Telha de Mahjong Sete dos Bambus
1F017: Telha de Mahjong Oito dos Bambus
1F018: Telha de Mahjong Nine of Bamboos
1F019: Mahjong Tile One of Circles : bing
1F01A: Mahjong Tile Two of Circles
1F01B: Telha de Mahjong Três dos Círculos
1F01C: Telha de Mahjong Quatro dos Círculos
1F01D: Telha de Mahjong Cinco dos Círculos
1F01E: Mahjong Tile Six dos Círculos
1F01F: Telha de Mahjong Sete dos Círculos
1F020: Telha de Mahjong Oito dos Círculos
1F021: Telha de Mahjong Nine of Circles
1F022: Ameixa De Telha De Mahjong : mei
1F023: Orquídea da telha de Mahjong : lan
1F024: Mahjong Tile Bamboo : zhu
1F025: Crisântemo da telha de Mahjong : ju
1F026: Mola da telha de Mahjong
1F027: Mahjong Tile Summer
1F028: Outono de telha de Mahjong
1F029: Inverno de telha de Mahjong
1F02A: Mahjong Tile Joker : baida
1F02B: Telha de Mahjong Voltar
1F02C:
1F02D:
1F02E:
1F02F:
1F030: Domino Tile Horizontal Back
1F031: Telha de dominó Horizontal-00-00
1F032: Telha de dominó Horizontal-00-01
1F033: Telha de dominó Horizontal-00-02
1F034: Telha de dominó Horizontal-00-03
1F035: Telha de dominó Horizontal-00-04
1F036: Telha de dominó Horizontal-00-05
1F037: Telha de dominó Horizontal-00-06
1F038: Telha de dominó horizontal-01-00
1F039: Telha de dominó horizontal-01-01
1F03A: Telha de dominó horizontal-01-02
1F03B: Telha de dominó Horizontal-01-03
1F03C: Telha de dominó Horizontal-01-04
1F03D: Telha de dominó Horizontal-01-05
1F03E: Telha de dominó horizontal-01-06
1F03F: Telha de dominó horizontal-02-00
1F040: Telha de dominó horizontal-02-01
1F041: Telha de dominó Horizontal-02-02
1F042: Telha de dominó Horizontal-02-03
1F043: Telha de dominó Horizontal-02-04
1F044: Telha de dominó Horizontal-02-05
1F045: Telha de dominó Horizontal-02-06
1F046: Telha de dominó horizontal-03-00
1F047: Telha de dominó horizontal-03-01
1F048: Telha de dominó horizontal-03-02
1F049: Telha de dominó horizontal-03-03
1F04A: Telha de dominó Horizontal-03-04
1F04B: Telha de dominó horizontal-03-05
1F04C: Telha de dominó horizontal-03-06
1F04D: Telha de dominó horizontal-04-00
1F04E: Telha de dominó horizontal-04-01
1F04F: Telha de dominó horizontal-04-02
1F050: Telha de dominó horizontal-04-03
1F051: Telha de dominó horizontal-04-04
1F052: Telha de dominó horizontal-04-05
1F053: Telha de dominó horizontal-04-06
1F054: Telha de dominó horizontal-05-00
1F055: Telha de dominó Horizontal-05-01
1F056: Telha de dominó Horizontal-05-02
1F057: Telha de dominó horizontal-05-03
1F058: Telha de dominó Horizontal-05-04
1F059: Telha de dominó Horizontal-05-05
1F05A: Telha de dominó Horizontal-05-06
1F05B: Telha de dominó horizontal-06-00
1F05C: Telha de dominó horizontal-06-01
1F05D: Telha de dominó horizontal-06-02
1F05E: Telha de dominó horizontal-06-03
1F05F: Telha de dominó horizontal-06-04
1F060: Telha de dominó horizontal-06-05
1F061: Telha de dominó horizontal-06-06
1F062: Domino Tile Vertical Back
1F063: Telha de dominó vertical-00-00
1F064: Telha de dominó vertical-00-01
1F065: Telha de dominó vertical-00-02
1F066: Telha de dominó vertical-00-03
1F067: Telha de dominó vertical-00-04
1F068: Telha de dominó vertical-00-05
1F069: Telha de dominó vertical-00-06
1F06A: Telha de dominó vertical-01-00
1F06B: Telha de dominó vertical-01-01
1F06C: Telha de dominó vertical-01-02
1F06D: Telha de dominó vertical-01-03
1F06E: Telha de dominó Vertical-01-04
1F06F: Telha de dominó Vertical-01-05
1F070: Telha de dominó Vertical-01-06
1F071: Telha de dominó vertical-02-00
1F072: Telha de dominó vertical-02-01
1F073: Telha de dominó vertical-02-02
1F074: Telha de dominó vertical-02-03
1F075: Telha de dominó vertical-02-04
1F076: Telha de dominó vertical-02-05
1F077: Telha de dominó vertical-02-06
1F078: Telha de dominó vertical-03-00
1F079: Telha de dominó vertical-03-01
1F07A: Telha de dominó vertical-03-02
1F07B: Telha de dominó vertical-03-03
1F07C: Telha de dominó vertical-03-04
1F07D: Telha de dominó vertical-03-05
1F07E: Telha de dominó vertical-03-06
1F07F: Telha de dominó vertical-04-00
1F080: Telha de dominó vertical-04-01
1F081: Telha de dominó vertical-04-02
1F082: Telha de dominó vertical-04-03
1F083: Telha de dominó vertical-04-04
1F084: Telha de dominó vertical-04-05
1F085: Telha de dominó vertical-04-06
1F086: Telha de dominó vertical-05-00
1F087: Telha de dominó vertical-05-01
1F088: Telha de dominó vertical-05-02
1F089: Telha de dominó vertical-05-03
1F08A: Telha de dominó vertical-05-04
1F08B: Telha de dominó vertical-05-05
1F08C: Telha de dominó vertical-05-06
1F08D: Telha de dominó vertical-06-00
1F08E: Telha de dominó vertical-06-01
1F08F: Telha de dominó vertical-06-02
1F090: Telha de dominó vertical-06-03
1F091: Telha de dominó vertical-06-04
1F092: Telha de dominó vertical-06-05
1F093: Telha de dominó vertical-06-06
1F094:
1F095:
1F096:
1F097:
1F098:
1F099:
1F09A:
1F09B:
1F09C:
1F09D:
1F09E:
1F09F:
1F0A0: Cartão de jogo de volta
1F0A1: Cartão de jogo ás de espadas
1F0A2: Cartão de jogo dois de espadas
1F0A3: Carta de Baralho Três de Espadas
1F0A4: Carta de Baralho Quatro de Espadas
1F0A5: Carta de Baralho Cinco de Espadas
1F0A6: Carta de Baralho Six of Spades
1F0A7: Cartão de Jogo Seven of Spades
1F0A8: Carta de Baralho Oito de Espadas
1F0A9: Carta de Baralho Nove de Espadas
1F0AA: Cartão de Jogo Dez de Espadas
1F0AB: Cartão de jogo Jack of Spades : com manobrista, bube, unter, page, fante : página de espadas
1F0AC: Cartão de jogo cavaleiro de espadas : chevalier, ober, ritter, cavallere, cavaliere : cavaleiro de espadas
1F0AD: Rainha das espadas do cartão de jogo : dama, senhora, rainha, regina : rainha das espadas
1F0AE: Rei do baralho de espadas : roi, könig, re : rei das espadas
1F0AF:
1F0B0:
1F0B1: Cartão de jogo ás de copas
1F0B2: Cartão de jogo dois de copas
1F0B3: Cartão de jogo três de copas
1F0B4: Cartão de jogo quatro de copas
1F0B5: Carta de Baralho Cinco de Copas
1F0B6: Cartão de jogo seis de copas
1F0B7: Cartão de Jogo Sete de Copas
1F0B8: Cartão de Jogo Oito de Copas
1F0B9: Cartão de jogo nove de copas
1F0BA: Cartão de jogo dez de copas
1F0BB: Cartão jogando, jaque, de, corações
1F0BC: Cartão de jogo cavaleiro de copas
1F0BD: Rainha dos corações do cartão de jogo
1F0BE: Cartão de jogo rei de copas
1F0BF: Cartão de jogo vermelho coringa
1F0C0:
1F0C1: Carta de baralho Ace of Diamonds
1F0C2: Cartão de jogo dois dos diamantes
1F0C3: Carta de Baralho Três de Diamantes
1F0C4: Carta de Baralho Quatro de Diamantes
1F0C5: Carta de Baralho Cinco de Diamantes
1F0C6: Carta de Baralho Six of Diamonds
1F0C7: Carta de Baralho Sete dos Diamantes
1F0C8: Carta de Baralho Oito de Diamantes
1F0C9: Carta de Baralho Nove de Diamantes
1F0CA: Carta de Baralho Dez dos Diamantes
1F0CB: Cartão de jogo Jack of Diamonds
1F0CC: Carta de baralho Cavaleiro dos diamantes
1F0CD: Rainha dos diamantes do cartão de jogo
1F0CE: Rei do baralho de diamantes
1F0CF: Cartão de jogo coringa preto
1F0D0:
1F0D1: Carta de Baralho Ace of Clubs
1F0D2: Cartão de jogo dois dos clubes
1F0D3: Carta de Baralho Três dos Clubes
1F0D4: Carta de Baralho Quatro dos Clubes
1F0D5: Carta de Baralho Cinco dos Clubes
1F0D6: Carta de Baralho Six of Clubs
1F0D7: Cartão de Jogo Sete dos Clubes
1F0D8: Carta de Baralho Oito dos Clubes
1F0D9: Carta de Baralho Nove de Paus
1F0DA: Carta de Baralho Dez dos Clubes
1F0DB: Cartão de jogo Jack of Clubs
1F0DC: Cartão de jogo Cavaleiro de paus
1F0DD: Rainha dos clubes de baralho
1F0DE: Cartão de jogo King of Clubs
1F0DF: Cartão de jogo coringa coringa
1F0E0: Tolo de baralho
1F0E1: Cartão de jogo Trump-1
1F0E2: Cartão de jogo Trump-2
1F0E3: Cartão de jogo Trump-3
1F0E4: Cartão de jogo Trump-4
1F0E5: Cartão de jogo Trump-5
1F0E6: Cartão de jogo Trump-6
1F0E7: Cartão de jogo Trump-7
1F0E8: Cartão de jogo Trump-8
1F0E9: Cartão de jogo Trump-9
1F0EA: Cartão de jogo Trump-10
1F0EB: Cartão de jogo Trump-11
1F0EC: Cartão de jogo Trump-12
1F0ED: Cartão de jogo Trump-13
1F0EE: Cartão de jogo Trump-14
1F0EF: Cartão de jogo Trump-15
1F0F0: Cartão de jogo Trump-16
1F0F1: Cartão de jogo Trump-17
1F0F2: Cartão de jogo Trump-18
1F0F3: Cartão de jogo Trump-19
1F0F4: Cartão de jogo Trump-20
1F0F5: Cartão de jogo Trump-21
1F0F6:
1F0F7:
1F0F8:
1F0F9:
1F0FA:
1F0FB:
1F0FC:
1F0FD:
1F0FE:
1F0FF:
| {
"pile_set_name": "Github"
} |
Audio Signal Processing in Python
=================================
This repository holds a few [Jupyter][] (formerly known as [IPython][])
notebooks.
You may consume them in different ways:
* Clone this Git repository (or download the [zip file][]) and open the
notebooks locally with Jupyter/IPython
* View a static online version of the notebooks:
[with outputs][],
[without outputs][]
* [![Launch Binder][badge]][binder] for the ultimate interactive online experience
Please note that the `master` branch contains "executed" notebooks,
i.e. the outputs from code cells (e.g. plots) are stored within the notebooks.
The `dev` branch contains the same notebooks, just without those outputs.
If you want to make a pull request,
please create a new branch based on the `dev` branch
and strip all outputs from the notebooks before committing.
The authors waive copyright and related rights in the work through the
[CC0 1.0 Universal public domain dedication][CC0].
[zip file]: https://codeload.github.com/mgeier/python-audio/zip/master
[with outputs]: https://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/index.ipynb
[without outputs]: https://nbviewer.jupyter.org/github/mgeier/python-audio/blob/dev/index.ipynb
[binder]: https://mybinder.org/v2/gh/mgeier/python-audio/dev?filepath=index.ipynb
[Jupyter]: https://jupyter.org/
[IPython]: https://ipython.org/notebook.html
[CC0]: https://creativecommons.org/publicdomain/zero/1.0/
[badge]: https://mybinder.org/badge.svg
| {
"pile_set_name": "Github"
} |
<template>
<div>
<p v-html="regenerateThumbnails.l10n.Home.intro1"></p>
<p v-html="regenerateThumbnails.l10n.Home.intro2"></p>
<p>
<label>
<input
type="checkbox"
id="regenthumbs-regenopt-onlymissing"
:checked="checkboxOnlyMissing"
v-on:change="checkboxChange('checkboxOnlyMissing', $event)"
/>
{{ regenerateThumbnails.l10n.common.onlyRegenerateMissingThumbnails }}
</label>
</p>
<p style="display:none">
<label>
<input
type="checkbox"
id="regenthumbs-regenopt-updateposts"
:checked="checkboxUpdatePosts"
v-on:change="checkboxChange('checkboxUpdatePosts', $event)"
/>
{{ regenerateThumbnails.l10n.Home.updatePostContents }}
</label>
</p>
<p>
<label>
<input
type="checkbox"
id="regenthumbs-regenopt-deleteoldthumbnails"
:checked="checkboxDeleteOld"
v-on:change="checkboxChange('checkboxDeleteOld', $event)"
/>
{{ regenerateThumbnails.l10n.common.deleteOldThumbnails }}
</label>
</p>
<div v-if="regenerateThumbnails.data.thumbnailIDs">
<p>
<button class="button button-primary button-hero" v-on:click="regenerate(regenerateThumbnails.data.thumbnailIDs)">
{{ regenerateThumbnails.l10n.Home.RegenerateThumbnailsForXAttachments }}
</button>
</p>
</div>
<div v-else>
<p>
<button class="button button-primary button-hero" v-on:click="regenerate('all')">
{{ ButtonAllText }}
</button>
</p>
<p v-if="usingFeaturedImages">
<button class="button button-primary button-hero" v-on:click="regenerate('featured-images')">
{{ ButtonFeaturedImagesText }}
</button>
</p>
</div>
<h2 class="title">{{ regenerateThumbnails.l10n.Home.thumbnailSizes }}</h2>
<p>{{ regenerateThumbnails.l10n.Home.thumbnailSizesDescription }}</p>
<ul>
<li
is="thumbnail-size"
v-for="(size, label) in regenerateThumbnails.data.thumbnailSizes"
:key="label"
:size="size"
:text="regenerateThumbnails.l10n.common.thumbnailSizeItemWithCropMethodNoFilename"
:textCropped="regenerateThumbnails.l10n.common.thumbnailSizeItemIsCropped"
:textProportional="regenerateThumbnails.l10n.common.thumbnailSizeItemIsProportional"
></li>
</ul>
<h2>{{ regenerateThumbnails.l10n.Home.alternatives }}</h2>
<p v-html="alternativesText1"></p>
<p v-html="alternativesText2"></p>
</div>
</template>
<script>
require('../../helpers/formatUnicorn.js');
import ThumbnailSize from '../../components/ThumbnailSize.vue'
export default {
data() {
return {
regenerateThumbnails : regenerateThumbnails,
usingFeaturedImages : false,
ButtonAllText : regenerateThumbnails.l10n.Home.RegenerateThumbnailsForAllAttachments,
ButtonFeaturedImagesText: regenerateThumbnails.l10n.Home.RegenerateThumbnailsForFeaturedImagesOnly,
checkboxOnlyMissing : regenerateThumbnails.options.onlyMissingThumbnails,
checkboxUpdatePosts : regenerateThumbnails.options.updatePostContents,
checkboxDeleteOld : regenerateThumbnails.options.deleteOldThumbnails,
}
},
computed : {
alternativesText1() {
return this.regenerateThumbnails.l10n.Home.alternativesText1.formatUnicorn({
'url-cli' : 'https://en.wikipedia.org/wiki/Command-line_interface',
'url-wpcli' : 'https://wp-cli.org/',
'url-wpcli-regenerate': 'https://developer.wordpress.org/cli/commands/media/regenerate/',
});
},
alternativesText2() {
return this.regenerateThumbnails.l10n.Home.alternativesText2.formatUnicorn({
'url-photon' : 'https://jetpack.com/support/photon/',
'url-jetpack': 'https://jetpack.com/',
});
}
},
created() {
if (this.regenerateThumbnails.data.thumbnailIDs) {
return;
}
// Update button with total attachment count
wp.apiRequest({
namespace: 'wp/v2',
endpoint : 'media',
data : {
_fields : 'id',
is_regeneratable : 1,
exclude_site_icons: 1,
per_page : 1,
},
type : 'GET',
dataType : 'json',
cache : false,
context : this
})
.done((data, textStatus, jqXHR) => {
this.ButtonAllText = this.regenerateThumbnails.l10n.Home.RegenerateThumbnailsForAllXAttachments.formatUnicorn({
'attachmentCount': jqXHR.getResponseHeader('x-wp-total').toLocaleString(),
});
})
.fail((jqXHR, textStatus, errorThrown) => {
console.log('Regenerate Thumbnails: Error getting the total attachment count.', jqXHR, textStatus, errorThrown);
});
// Update button with total featured images count
wp.apiRequest({
namespace: 'regenerate-thumbnails/v1',
endpoint : 'featuredimages',
data : {
per_page: 1,
},
type : 'GET',
dataType : 'json',
cache : false,
context : this
})
.done((data, textStatus, jqXHR) => {
this.ButtonAllText = this.regenerateThumbnails.l10n.Home.RegenerateThumbnailsForAllXAttachments.formatUnicorn({
'attachmentCount': jqXHR.getResponseHeader('x-wp-total').toLocaleString(),
});
if (jqXHR.getResponseHeader('x-wp-total') < 1) {
this.usingFeaturedImages = false;
} else {
this.ButtonFeaturedImagesText = this.regenerateThumbnails.l10n.Home.RegenerateThumbnailsForXFeaturedImagesOnly.formatUnicorn({
'attachmentCount': jqXHR.getResponseHeader('x-wp-total').toLocaleString(),
});
this.usingFeaturedImages = true;
}
})
.fail((jqXHR, textStatus, errorThrown) => {
console.log('Regenerate Thumbnails: Error getting the total featured images count.', jqXHR, textStatus, errorThrown);
});
},
methods : {
regenerate(what) {
this.$emit('regenerate', what);
},
checkboxChange(prop, event) {
this[prop] = event.target.checked;
// Check the update posts checkbox when the delete checkbox is checked
if ('checkboxDeleteOld' === prop && this[prop]) {
//this.checkboxUpdatePosts = true;
}
},
},
components: {
ThumbnailSize,
},
}
</script>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2016 InforceComputing
* Author: Vinay Simha BN <[email protected]>
*
* Copyright (C) 2016 Linaro Ltd
* Author: Sumit Semwal <[email protected]>
*
* From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
* JDI model LT070ME05000, and its data sheet is at:
* http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/backlight.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <drm/drmP.h>
#include <drm/drm_crtc.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_panel.h>
#include <video/mipi_display.h>
static const char * const regulator_names[] = {
"vddp",
"iovcc"
};
struct jdi_panel {
struct drm_panel base;
struct mipi_dsi_device *dsi;
struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)];
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
struct gpio_desc *dcdc_en_gpio;
struct backlight_device *backlight;
bool prepared;
bool enabled;
const struct drm_display_mode *mode;
};
static inline struct jdi_panel *to_jdi_panel(struct drm_panel *panel)
{
return container_of(panel, struct jdi_panel, base);
}
static int jdi_panel_init(struct jdi_panel *jdi)
{
struct mipi_dsi_device *dsi = jdi->dsi;
struct device *dev = &jdi->dsi->dev;
int ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_soft_reset(dsi);
if (ret < 0)
return ret;
usleep_range(10000, 20000);
ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT << 4);
if (ret < 0) {
dev_err(dev, "failed to set pixel format: %d\n", ret);
return ret;
}
ret = mipi_dsi_dcs_set_column_address(dsi, 0, jdi->mode->hdisplay - 1);
if (ret < 0) {
dev_err(dev, "failed to set column address: %d\n", ret);
return ret;
}
ret = mipi_dsi_dcs_set_page_address(dsi, 0, jdi->mode->vdisplay - 1);
if (ret < 0) {
dev_err(dev, "failed to set page address: %d\n", ret);
return ret;
}
/*
* BIT(5) BCTRL = 1 Backlight Control Block On, Brightness registers
* are active
* BIT(3) BL = 1 Backlight Control On
* BIT(2) DD = 0 Display Dimming is Off
*/
ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY,
(u8[]){ 0x24 }, 1);
if (ret < 0) {
dev_err(dev, "failed to write control display: %d\n", ret);
return ret;
}
/* CABC off */
ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_POWER_SAVE,
(u8[]){ 0x00 }, 1);
if (ret < 0) {
dev_err(dev, "failed to set cabc off: %d\n", ret);
return ret;
}
ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
if (ret < 0) {
dev_err(dev, "failed to set exit sleep mode: %d\n", ret);
return ret;
}
msleep(120);
ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x00}, 2);
if (ret < 0) {
dev_err(dev, "failed to set mcap: %d\n", ret);
return ret;
}
mdelay(10);
/* Interface setting, video mode */
ret = mipi_dsi_generic_write(dsi, (u8[])
{0xB3, 0x26, 0x08, 0x00, 0x20, 0x00}, 6);
if (ret < 0) {
dev_err(dev, "failed to set display interface setting: %d\n"
, ret);
return ret;
}
mdelay(20);
ret = mipi_dsi_generic_write(dsi, (u8[]){0xB0, 0x03}, 2);
if (ret < 0) {
dev_err(dev, "failed to set default values for mcap: %d\n"
, ret);
return ret;
}
return 0;
}
static int jdi_panel_on(struct jdi_panel *jdi)
{
struct mipi_dsi_device *dsi = jdi->dsi;
struct device *dev = &jdi->dsi->dev;
int ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret < 0)
dev_err(dev, "failed to set display on: %d\n", ret);
return ret;
}
static void jdi_panel_off(struct jdi_panel *jdi)
{
struct mipi_dsi_device *dsi = jdi->dsi;
struct device *dev = &jdi->dsi->dev;
int ret;
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0)
dev_err(dev, "failed to set display off: %d\n", ret);
ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
if (ret < 0)
dev_err(dev, "failed to enter sleep mode: %d\n", ret);
msleep(100);
}
static int jdi_panel_disable(struct drm_panel *panel)
{
struct jdi_panel *jdi = to_jdi_panel(panel);
if (!jdi->enabled)
return 0;
jdi->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(jdi->backlight);
jdi->enabled = false;
return 0;
}
static int jdi_panel_unprepare(struct drm_panel *panel)
{
struct jdi_panel *jdi = to_jdi_panel(panel);
struct device *dev = &jdi->dsi->dev;
int ret;
if (!jdi->prepared)
return 0;
jdi_panel_off(jdi);
ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
if (ret < 0)
dev_err(dev, "regulator disable failed, %d\n", ret);
gpiod_set_value(jdi->enable_gpio, 0);
gpiod_set_value(jdi->reset_gpio, 1);
gpiod_set_value(jdi->dcdc_en_gpio, 0);
jdi->prepared = false;
return 0;
}
static int jdi_panel_prepare(struct drm_panel *panel)
{
struct jdi_panel *jdi = to_jdi_panel(panel);
struct device *dev = &jdi->dsi->dev;
int ret;
if (jdi->prepared)
return 0;
ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
if (ret < 0) {
dev_err(dev, "regulator enable failed, %d\n", ret);
return ret;
}
msleep(20);
gpiod_set_value(jdi->dcdc_en_gpio, 1);
usleep_range(10, 20);
gpiod_set_value(jdi->reset_gpio, 0);
usleep_range(10, 20);
gpiod_set_value(jdi->enable_gpio, 1);
usleep_range(10, 20);
ret = jdi_panel_init(jdi);
if (ret < 0) {
dev_err(dev, "failed to init panel: %d\n", ret);
goto poweroff;
}
ret = jdi_panel_on(jdi);
if (ret < 0) {
dev_err(dev, "failed to set panel on: %d\n", ret);
goto poweroff;
}
jdi->prepared = true;
return 0;
poweroff:
ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
if (ret < 0)
dev_err(dev, "regulator disable failed, %d\n", ret);
gpiod_set_value(jdi->enable_gpio, 0);
gpiod_set_value(jdi->reset_gpio, 1);
gpiod_set_value(jdi->dcdc_en_gpio, 0);
return ret;
}
static int jdi_panel_enable(struct drm_panel *panel)
{
struct jdi_panel *jdi = to_jdi_panel(panel);
if (jdi->enabled)
return 0;
jdi->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(jdi->backlight);
jdi->enabled = true;
return 0;
}
static const struct drm_display_mode default_mode = {
.clock = 155493,
.hdisplay = 1200,
.hsync_start = 1200 + 48,
.hsync_end = 1200 + 48 + 32,
.htotal = 1200 + 48 + 32 + 60,
.vdisplay = 1920,
.vsync_start = 1920 + 3,
.vsync_end = 1920 + 3 + 5,
.vtotal = 1920 + 3 + 5 + 6,
.vrefresh = 60,
.flags = 0,
};
static int jdi_panel_get_modes(struct drm_panel *panel)
{
struct drm_display_mode *mode;
struct jdi_panel *jdi = to_jdi_panel(panel);
struct device *dev = &jdi->dsi->dev;
mode = drm_mode_duplicate(panel->drm, &default_mode);
if (!mode) {
dev_err(dev, "failed to add mode %ux%ux@%u\n",
default_mode.hdisplay, default_mode.vdisplay,
default_mode.vrefresh);
return -ENOMEM;
}
drm_mode_set_name(mode);
drm_mode_probed_add(panel->connector, mode);
panel->connector->display_info.width_mm = 95;
panel->connector->display_info.height_mm = 151;
return 1;
}
static int dsi_dcs_bl_get_brightness(struct backlight_device *bl)
{
struct mipi_dsi_device *dsi = bl_get_data(bl);
int ret;
u16 brightness = bl->props.brightness;
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness);
if (ret < 0)
return ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
return brightness & 0xff;
}
static int dsi_dcs_bl_update_status(struct backlight_device *bl)
{
struct mipi_dsi_device *dsi = bl_get_data(bl);
int ret;
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness);
if (ret < 0)
return ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
return 0;
}
static const struct backlight_ops dsi_bl_ops = {
.update_status = dsi_dcs_bl_update_status,
.get_brightness = dsi_dcs_bl_get_brightness,
};
static struct backlight_device *
drm_panel_create_dsi_backlight(struct mipi_dsi_device *dsi)
{
struct device *dev = &dsi->dev;
struct backlight_properties props;
memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_RAW;
props.brightness = 255;
props.max_brightness = 255;
return devm_backlight_device_register(dev, dev_name(dev), dev, dsi,
&dsi_bl_ops, &props);
}
static const struct drm_panel_funcs jdi_panel_funcs = {
.disable = jdi_panel_disable,
.unprepare = jdi_panel_unprepare,
.prepare = jdi_panel_prepare,
.enable = jdi_panel_enable,
.get_modes = jdi_panel_get_modes,
};
static const struct of_device_id jdi_of_match[] = {
{ .compatible = "jdi,lt070me05000", },
{ }
};
MODULE_DEVICE_TABLE(of, jdi_of_match);
static int jdi_panel_add(struct jdi_panel *jdi)
{
struct device *dev = &jdi->dsi->dev;
int ret;
unsigned int i;
jdi->mode = &default_mode;
for (i = 0; i < ARRAY_SIZE(jdi->supplies); i++)
jdi->supplies[i].supply = regulator_names[i];
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(jdi->supplies),
jdi->supplies);
if (ret < 0) {
dev_err(dev, "failed to init regulator, ret=%d\n", ret);
return ret;
}
jdi->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW);
if (IS_ERR(jdi->enable_gpio)) {
ret = PTR_ERR(jdi->enable_gpio);
dev_err(dev, "cannot get enable-gpio %d\n", ret);
return ret;
}
jdi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(jdi->reset_gpio)) {
ret = PTR_ERR(jdi->reset_gpio);
dev_err(dev, "cannot get reset-gpios %d\n", ret);
return ret;
}
jdi->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
if (IS_ERR(jdi->dcdc_en_gpio)) {
ret = PTR_ERR(jdi->dcdc_en_gpio);
dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
return ret;
}
jdi->backlight = drm_panel_create_dsi_backlight(jdi->dsi);
if (IS_ERR(jdi->backlight)) {
ret = PTR_ERR(jdi->backlight);
dev_err(dev, "failed to register backlight %d\n", ret);
return ret;
}
drm_panel_init(&jdi->base);
jdi->base.funcs = &jdi_panel_funcs;
jdi->base.dev = &jdi->dsi->dev;
ret = drm_panel_add(&jdi->base);
return ret;
}
static void jdi_panel_del(struct jdi_panel *jdi)
{
if (jdi->base.dev)
drm_panel_remove(&jdi->base);
}
static int jdi_panel_probe(struct mipi_dsi_device *dsi)
{
struct jdi_panel *jdi;
int ret;
dsi->lanes = 4;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
MIPI_DSI_CLOCK_NON_CONTINUOUS;
jdi = devm_kzalloc(&dsi->dev, sizeof(*jdi), GFP_KERNEL);
if (!jdi)
return -ENOMEM;
mipi_dsi_set_drvdata(dsi, jdi);
jdi->dsi = dsi;
ret = jdi_panel_add(jdi);
if (ret < 0)
return ret;
return mipi_dsi_attach(dsi);
}
static int jdi_panel_remove(struct mipi_dsi_device *dsi)
{
struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi);
int ret;
ret = jdi_panel_disable(&jdi->base);
if (ret < 0)
dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
ret = mipi_dsi_detach(dsi);
if (ret < 0)
dev_err(&dsi->dev, "failed to detach from DSI host: %d\n",
ret);
drm_panel_detach(&jdi->base);
jdi_panel_del(jdi);
return 0;
}
static void jdi_panel_shutdown(struct mipi_dsi_device *dsi)
{
struct jdi_panel *jdi = mipi_dsi_get_drvdata(dsi);
jdi_panel_disable(&jdi->base);
}
static struct mipi_dsi_driver jdi_panel_driver = {
.driver = {
.name = "panel-jdi-lt070me05000",
.of_match_table = jdi_of_match,
},
.probe = jdi_panel_probe,
.remove = jdi_panel_remove,
.shutdown = jdi_panel_shutdown,
};
module_mipi_dsi_driver(jdi_panel_driver);
MODULE_AUTHOR("Sumit Semwal <[email protected]>");
MODULE_AUTHOR("Vinay Simha BN <[email protected]>");
MODULE_DESCRIPTION("JDI LT070ME05000 WUXGA");
MODULE_LICENSE("GPL v2");
| {
"pile_set_name": "Github"
} |
#include "config.h"
#include "log.h"
#include "globals.h"
#include "torrent/exceptions.h"
#include "torrent/hash_string.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <zlib.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <memory>
#define GROUPFMT (group >= LOG_NON_CASCADING) ? ("%" PRIi32 " ") : ("%" PRIi32 " %c ")
namespace torrent {
struct log_cache_entry {
typedef log_group::outputs_type outputs_type;
bool equal_outputs(const outputs_type& out) const { return out == outputs; }
void allocate(unsigned int count) { cache_first = new log_slot[count]; cache_last = cache_first + count; }
void clear() { delete [] cache_first; cache_first = NULL; cache_last = NULL; }
outputs_type outputs;
log_slot* cache_first;
log_slot* cache_last;
};
struct log_gz_output {
log_gz_output(const char* filename, bool append) { gz_file = gzopen(filename, append ? "a" : "w"); }
~log_gz_output() { if (gz_file != NULL) gzclose(gz_file); }
bool is_valid() { return gz_file != Z_NULL; }
// bool set_buffer(unsigned size) { return gzbuffer(gz_file, size) == 0; }
gzFile gz_file;
};
typedef std::vector<log_cache_entry> log_cache_list;
typedef std::vector<std::pair<int, int> > log_child_list;
typedef std::vector<log_slot> log_slot_list;
typedef std::vector<std::pair<std::string, log_slot> > log_output_list;
log_output_list log_outputs;
log_child_list log_children;
log_cache_list log_cache;
log_group_list log_groups;
pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
const char log_level_char[] = { 'C', 'E', 'W', 'N', 'I', 'D' };
// Removing logs always triggers a check if we got any un-used
// log_output objects.
void
log_update_child_cache(int index) {
log_child_list::const_iterator first =
std::find_if(log_children.begin(), log_children.end(),
std::bind2nd(std::greater_equal<std::pair<int, int> >(), std::make_pair(index, 0)));
if (first == log_children.end())
return;
const log_group::outputs_type& outputs = log_groups[index].cached_outputs();
while (first != log_children.end() && first->first == index) {
if ((outputs & log_groups[first->second].cached_outputs()) != outputs) {
log_groups[first->second].set_cached_outputs(outputs | log_groups[first->second].cached_outputs());
log_update_child_cache(first->second);
}
first++;
}
// If we got any circular connections re-do the update to ensure all
// children have our new outputs.
if (outputs != log_groups[index].cached_outputs())
log_update_child_cache(index);
}
void
log_rebuild_cache() {
std::for_each(log_groups.begin(), log_groups.end(), std::mem_fun_ref(&log_group::clear_cached_outputs));
for (int i = 0; i < LOG_GROUP_MAX_SIZE; i++)
log_update_child_cache(i);
// Clear the cache...
std::for_each(log_cache.begin(), log_cache.end(), std::mem_fun_ref(&log_cache_entry::clear));
log_cache.clear();
for (int idx = 0, last = log_groups.size(); idx != last; idx++) {
const log_group::outputs_type& use_outputs = log_groups[idx].cached_outputs();
if (use_outputs == 0) {
log_groups[idx].set_cached(NULL, NULL);
continue;
}
log_cache_list::iterator cache_itr =
std::find_if(log_cache.begin(), log_cache.end(),
std::bind(&log_cache_entry::equal_outputs, std::placeholders::_1, use_outputs));
if (cache_itr == log_cache.end()) {
cache_itr = log_cache.insert(log_cache.end(), log_cache_entry());
cache_itr->outputs = use_outputs;
cache_itr->allocate(use_outputs.count());
log_slot* dest_itr = cache_itr->cache_first;
for (size_t index = 0; index < log_outputs.size(); index++) {
if (use_outputs[index])
*dest_itr++ = log_outputs[index].second;
}
}
log_groups[idx].set_cached(cache_itr->cache_first, cache_itr->cache_last);
}
}
void
log_group::internal_print(const HashString* hash, const char* subsystem, const void* dump_data, size_t dump_size, const char* fmt, ...) {
va_list ap;
unsigned int buffer_size = 4096;
char buffer[buffer_size];
char* first = buffer;
if (subsystem != NULL) {
if (hash != NULL) {
first = hash_string_to_hex(*hash, first);
first += snprintf(first, 4096 - (first - buffer), "->%s: ", subsystem);
} else {
first += snprintf(first, 4096 - (first - buffer), "%s: ", subsystem);
}
}
va_start(ap, fmt);
int count = vsnprintf(first, 4096 - (first - buffer), fmt, ap);
first += std::min<unsigned int>(count, buffer_size - 1);
va_end(ap);
if (count <= 0)
return;
pthread_mutex_lock(&log_mutex);
std::for_each(m_first, m_last, std::bind(&log_slot::operator(),
std::placeholders::_1,
(const char*)buffer,
std::distance(buffer, first),
std::distance(log_groups.begin(), this)));
if (dump_data != NULL) {
std::for_each(m_first, m_last, std::bind(&log_slot::operator(),
std::placeholders::_1,
(const char*)dump_data,
dump_size,
-1));
}
pthread_mutex_unlock(&log_mutex);
}
#define LOG_CASCADE(parent) LOG_CHILDREN_CASCADE(parent, parent)
#define LOG_LINK(parent, child) log_children.push_back(std::make_pair(parent, child))
#define LOG_CHILDREN_CASCADE(parent, subgroup) \
log_children.push_back(std::make_pair(parent + LOG_ERROR, subgroup + LOG_CRITICAL)); \
log_children.push_back(std::make_pair(parent + LOG_WARN, subgroup + LOG_ERROR)); \
log_children.push_back(std::make_pair(parent + LOG_NOTICE, subgroup + LOG_WARN)); \
log_children.push_back(std::make_pair(parent + LOG_INFO, subgroup + LOG_NOTICE)); \
log_children.push_back(std::make_pair(parent + LOG_DEBUG, subgroup + LOG_INFO));
#define LOG_CHILDREN_SUBGROUP(parent, subgroup) \
log_children.push_back(std::make_pair(parent + LOG_CRITICAL, subgroup + LOG_CRITICAL)); \
log_children.push_back(std::make_pair(parent + LOG_ERROR, subgroup + LOG_ERROR)); \
log_children.push_back(std::make_pair(parent + LOG_WARN, subgroup + LOG_WARN)); \
log_children.push_back(std::make_pair(parent + LOG_NOTICE, subgroup + LOG_NOTICE)); \
log_children.push_back(std::make_pair(parent + LOG_INFO, subgroup + LOG_INFO)); \
log_children.push_back(std::make_pair(parent + LOG_DEBUG, subgroup + LOG_DEBUG));
void
log_initialize() {
pthread_mutex_lock(&log_mutex);
LOG_CASCADE(LOG_CRITICAL);
LOG_CASCADE(LOG_PEER_CRITICAL);
LOG_CASCADE(LOG_SOCKET_CRITICAL);
LOG_CASCADE(LOG_STORAGE_CRITICAL);
LOG_CASCADE(LOG_THREAD_CRITICAL);
LOG_CASCADE(LOG_TRACKER_CRITICAL);
LOG_CASCADE(LOG_TORRENT_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_PEER_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_SOCKET_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_STORAGE_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_THREAD_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_TRACKER_CRITICAL);
LOG_CHILDREN_CASCADE(LOG_CRITICAL, LOG_TORRENT_CRITICAL);
LOG_LINK(LOG_CONNECTION, LOG_CONNECTION_BIND);
LOG_LINK(LOG_CONNECTION, LOG_CONNECTION_FD);
LOG_LINK(LOG_CONNECTION, LOG_CONNECTION_FILTER);
LOG_LINK(LOG_CONNECTION, LOG_CONNECTION_HANDSHAKE);
LOG_LINK(LOG_CONNECTION, LOG_CONNECTION_LISTEN);
LOG_LINK(LOG_DHT_ALL, LOG_DHT_MANAGER);
LOG_LINK(LOG_DHT_ALL, LOG_DHT_NODE);
LOG_LINK(LOG_DHT_ALL, LOG_DHT_ROUTER);
LOG_LINK(LOG_DHT_ALL, LOG_DHT_SERVER);
std::sort(log_children.begin(), log_children.end());
log_rebuild_cache();
pthread_mutex_unlock(&log_mutex);
}
void
log_cleanup() {
pthread_mutex_lock(&log_mutex);
std::fill(log_groups.begin(), log_groups.end(), log_group());
log_outputs.clear();
log_children.clear();
std::for_each(log_cache.begin(), log_cache.end(), std::mem_fun_ref(&log_cache_entry::clear));
log_cache.clear();
pthread_mutex_unlock(&log_mutex);
}
log_output_list::iterator
log_find_output_name(const char* name) {
log_output_list::iterator itr = log_outputs.begin();
log_output_list::iterator last = log_outputs.end();
while (itr != last && itr->first != name)
itr++;
return itr;
}
void
log_open_output(const char* name, log_slot slot) {
pthread_mutex_lock(&log_mutex);
if (log_outputs.size() >= log_group::max_size_outputs()) {
pthread_mutex_unlock(&log_mutex);
throw input_error("Cannot open more than 64 log output handlers.");
}
log_output_list::iterator itr = log_find_output_name(name);
if (itr == log_outputs.end()) {
log_outputs.push_back(std::make_pair(name, slot));
} else {
// by replacing the "write" slot binding, the old file gets closed
// (handles are shared pointers)
itr->second = slot;
}
log_rebuild_cache();
pthread_mutex_unlock(&log_mutex);
}
void
log_close_output(const char* name) {
pthread_mutex_lock(&log_mutex);
log_output_list::iterator itr = log_find_output_name(name);
if (itr != log_outputs.end())
log_outputs.erase(itr);
pthread_mutex_unlock(&log_mutex);
}
void
log_add_group_output(int group, const char* name) {
pthread_mutex_lock(&log_mutex);
log_output_list::iterator itr = log_find_output_name(name);
size_t index = std::distance(log_outputs.begin(), itr);
if (itr == log_outputs.end()) {
pthread_mutex_unlock(&log_mutex);
throw input_error("Log name not found.");
}
if (index >= log_group::max_size_outputs()) {
pthread_mutex_unlock(&log_mutex);
throw input_error("Cannot add more log group outputs.");
}
log_groups[group].set_output_at(index, true);
log_rebuild_cache();
pthread_mutex_unlock(&log_mutex);
}
void
log_remove_group_output(int group, const char* name) {
}
// The log_children list is <child, group> since we build the output
// cache by crawling from child to parent.
void
log_add_child(int group, int child) {
pthread_mutex_lock(&log_mutex);
if (std::find(log_children.begin(), log_children.end(), std::make_pair(group, child)) != log_children.end())
return;
log_children.push_back(std::make_pair(group, child));
std::sort(log_children.begin(), log_children.end());
log_rebuild_cache();
pthread_mutex_unlock(&log_mutex);
}
void
log_remove_child(int group, int child) {
// Remove from all groups, then modify all outputs.
}
void
log_file_write(std::shared_ptr<std::ofstream>& outfile, const char* data, size_t length, int group) {
// Add group name, data, etc as flags.
// Normal groups are nul-terminated strings.
if (group >= LOG_NON_CASCADING) {
*outfile << cachedTime.seconds() << ' ' << data << std::endl;
} else if (group >= 0) {
*outfile << cachedTime.seconds() << ' ' << log_level_char[group % 6] << ' ' << data << std::endl;
} else if (group == -1) {
*outfile << "---DUMP---" << std::endl;
if (length != 0) {
outfile->rdbuf()->sputn(data, length);
*outfile << std::endl;
}
*outfile << "---END---" << std::endl;
}
}
void
log_gz_file_write(std::shared_ptr<log_gz_output>& outfile, const char* data, size_t length, int group) {
char buffer[64];
// Normal groups are nul-terminated strings.
if (group >= 0) {
int buffer_length = snprintf(buffer, 64, GROUPFMT,
cachedTime.seconds(),
log_level_char[group % 6]);
if (buffer_length > 0)
gzwrite(outfile->gz_file, buffer, buffer_length);
gzwrite(outfile->gz_file, data, length);
gzwrite(outfile->gz_file, "\n", 1);
} else if (group == -1) {
gzwrite(outfile->gz_file, "---DUMP---\n", sizeof("---DUMP---\n") - 1);
if (length != 0)
gzwrite(outfile->gz_file, data, length);
gzwrite(outfile->gz_file, "---END---\n", sizeof("---END---\n") - 1);
}
}
void
log_open_file_output(const char* name, const char* filename, bool append) {
std::ios_base::openmode mode = std::ofstream::out;
if (append)
mode |= std::ofstream::app;
std::shared_ptr<std::ofstream> outfile(new std::ofstream(filename, mode));
if (!outfile->good())
throw input_error("Could not open log file '" + std::string(filename) + "'.");
log_open_output(name, std::bind(&log_file_write, outfile,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
}
void
log_open_gz_file_output(const char* name, const char* filename, bool append) {
std::shared_ptr<log_gz_output> outfile(new log_gz_output(filename, append));
if (!outfile->is_valid())
throw input_error("Could not open log gzip file '" + std::string(filename) + "'.");
// if (!outfile->set_buffer(1 << 14))
// throw input_error("Could not set gzip log file buffer size.");
log_open_output(name, std::bind(&log_gz_file_write, outfile,
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3));
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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.
*/
#include "arm_compute/runtime/NEON/functions/NEHOGGradient.h"
#include "arm_compute/core/NEON/kernels/NEMagnitudePhaseKernel.h"
#include "arm_compute/core/Validate.h"
#include "arm_compute/runtime/NEON/NEScheduler.h"
#include "support/MemorySupport.h"
using namespace arm_compute;
NEHOGGradient::NEHOGGradient(std::shared_ptr<IMemoryManager> memory_manager) // NOLINT
: _memory_group(std::move(memory_manager)),
_derivative(),
_mag_phase(nullptr),
_gx(),
_gy()
{
}
void NEHOGGradient::configure(ITensor *input, ITensor *output_magnitude, ITensor *output_phase, PhaseType phase_type, BorderMode border_mode, uint8_t constant_border_value)
{
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output_magnitude, 1, DataType::S16);
ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(output_phase, 1, DataType::U8);
const TensorShape &shape_img = input->info()->tensor_shape();
// Allocate image memory
TensorInfo info(shape_img, Format::S16);
_gx.allocator()->init(info);
_gy.allocator()->init(info);
// Manage intermediate buffers
_memory_group.manage(&_gx);
_memory_group.manage(&_gy);
// Initialise derivate kernel
_derivative.configure(input, &_gx, &_gy, border_mode, constant_border_value);
// Initialise magnitude/phase kernel
if(PhaseType::UNSIGNED == phase_type)
{
auto k = arm_compute::support::cpp14::make_unique<NEMagnitudePhaseKernel<MagnitudeType::L2NORM, PhaseType::UNSIGNED>>();
k->configure(&_gx, &_gy, output_magnitude, output_phase);
_mag_phase = std::move(k);
}
else
{
auto k = arm_compute::support::cpp14::make_unique<NEMagnitudePhaseKernel<MagnitudeType::L2NORM, PhaseType::SIGNED>>();
k->configure(&_gx, &_gy, output_magnitude, output_phase);
_mag_phase = std::move(k);
}
// Allocate intermediate tensors
_gx.allocator()->allocate();
_gy.allocator()->allocate();
}
void NEHOGGradient::run()
{
MemoryGroupResourceScope scope_mg(_memory_group);
// Run derivative
_derivative.run();
// Run magnitude/phase kernel
NEScheduler::get().schedule(_mag_phase.get(), Window::DimY);
}
| {
"pile_set_name": "Github"
} |
# 流
## 响应式编程
响应式是 Cycle.js 的一个重要方面,也是催生此框架诞生的核心原则之一。因为响应式这个词有太多不同的定义,所以在讨论之前,我们先来定义一下我们所讲的响应式。
比如现在有一个模块 Foo 和模块 Bar。一个模块可以被认为是一个 [OOP](https://en.wikipedia.org/wiki/Object-oriented_programming) 类的对象,或其他封装状态的机制。我们假设所有代码都被包装成一些模块。这里我们用一个从 Foo 到 Bar 的箭头,表示 Foo 会因某种原因影响 Bar 的状态。

关于图中的箭头,举一个实际应用的例子:*每当 Foo 执行一次网络请求,Bar 中计数器自增*。如果所有的代码都被包装在一些模块里,**那这个箭头被放置在哪里?** 它是在哪里定义的呢?很典型的做法是在 Foo 中编写代码,来调用 Bar 中的方法使得计数器自增。
> 模块 Foo 内部
```javascript
function onNetworkRequest() {
// ...
Bar.incrementCounter();
// ...
}
```
因为 Foo 拥有“*当网络请求发生时,在 Bar 中的计数器自增*”的能力,所以我们说箭头在箭尾那里,也就是在 Foo 那里。

Bar 本身是 **被动的**,它允许其他模块改变其状态。而 Foo 是主动的,它负责使 Bar 的状态正常工作。被动的模块是不知道影响它的箭头的存在的。
替代方法是逆置箭头的所有权,而不是简单反转其方向。

在这种方法中,Bar 会监听 Foo 中发生的事件,并在该事件发生时管理自己的状态。Bar 是响应式的:它通过对外部事件作出反应来管理自己的状态。另一方面,Foo 感知不到那些源自其网络请求事件的箭头的存在。
> 模块 Bar 内部
```javascript
Foo.addOnNetworkRequestListener(() => {
self.incrementCounter(); // self is Bar
});
```
这种做法有什么优势呢?因为逆置了箭头控制权,使得 Bar 自己负责自己。另外,我们还可以将 Bar 的 `incrementCounter()` 作为私有方法隐藏。在被动模式下,Bar 被要求将 `incrementCounter()` 公开,这就意味着我们向外暴露了 Bar 内部的状态管理。也就是说,如果我们想要知道 Bar 的计数器如何工作,我们需要找到代码库中关于 `incrementCounter()` 的所有的用法。在这方面,响应式和被动似乎是相互的。
| | Passive | Reactive |
|-----------------------|-------------------------|---------------|
| How does Bar work? | *Find usages* | Look inside |
另一方面,在响应模式下,如果想查找哪些模块会被一个可监听模块中事件影响的话,你必须找到这个事件的所有用途。
| | Proactive | Listenable |
|-----------------------------|-------------------------|---------------|
| Which modules are affected? | Look inside | *Find Usages* |
被动/主动编程一直是大多数程序员在命令式语言中工作的默认方式。有时使用响应式模式,但也只是偶尔。响应式编程最大的卖点就是可以建立自主模块,自主模块能专注于自己的功能,而不是改变外部状态。这导致了关注点分离。
在考虑被动/主动模式之前,我们都试图将响应/监听模式作为默认选择。而响应式编程的挑战就是这种编程思想的转变。转变你的思想为“响应式优先”,这会使你学习曲线变得平坦,大部分任务也变得简单明了,尤其是当我们使用诸如 RxJS 或者 *xstream* 这样的响应式库。
## 什么是流?
可以通过以下方式实现响应式编程:事件监听器、[RxJS](http://reactivex.io/rxjs)、[Bacon.js](http://baconjs.github.io/)、[Kefir](https://rpominov.github.io/kefir/)、[most.js](https://github.com/cujojs/most)、[EventEmitter](https://nodejs.org/api/events.html)、[Actors](https://en.wikipedia.org/wiki/Actor_model) 等等。甚至 [spreadsheets](https://en.wikipedia.org/wiki/Reactive_programming) 也利用了箭头所定义的单元格公式实现了相同的想法。上述对响应式编程的定义不仅仅局限于流,并且与以前的响应式编程定义不冲突。Cycle.js 支持多个流库,如 [RxJS](http://reactivex.io/rxjs)、[xstream](http://staltz.com/xstream) 以及 [most.js](https://github.com/cujojs/most)。但默认情况下我们选择 *xstream*,因为它是为 Cycle.js 定制的。
简而言之,*xstream* 中的 *Stream* 是可以触发零个或多个事件的事件流,这个事件流可能完成也可能不完成。如果完成,那么它会触发错误或特殊的 "complete" 事件。
> Stream contract
```
(next)* (complete|error){0,1}
```
举个例子,这里是一个典型的Stream:触发一些事件,然后最终完成。

Streams 可以被监听,就像 EventEmitters 和 DOM 事件一样。注意到有 3 个处理程序:一个用于事件处理,一个用于错误处理,一个用于 "complete"。
```javascript
myStream.addListener({
next: function handleNextEvent(event) {
// do something with `event`
},
error: function handleError(error) {
// do something with `error`
},
complete: function handleCompleted() {
// do something when it completes
},
});
```
当你使用所谓的 *operators* 转换它们时,*xstream* Streams 会变得非常有用,纯函数可以在现有的 Stream 之上创建新的 Streams。给定一个点击事件流,你可以轻松地创建用户点击次数的流。
> Operators
```javascript
const clickCountStream = clickStream
// each click represents "1 amount"
.mapTo(1)
// sum all events `1` over time, starting from 0
.fold((count, x) => count + x, 0);
```
[简洁才是王道](http://www.paulgraham.com/power.html),*xstream* 运算符表明,你可以通过一些适当的运算符完成很多事。只需要约 [26 个运算符](https://github.com/staltz/xstream#methods-and-operators),就可以构建 Cycle.js 应用程序中几乎所有的编程模式。
了解响应式编程的基础知识是使用 Cycle.js 完成工作的先决条件。我们不会在本网站提供 RxJS 或者 *xstream* 相关的教学,如果你需要学习更多,我们会推荐一些很棒的学习资源。*xstream* 和 *RxJS* 很类似,所以下列资源都很适用:
- [The introduction to Reactive Programming you've been missing](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754):Cycle.js 作者 Andre Staltz 对 RxJS 的全面介绍
- [Introduction to Rx](http://introtorx.com/):一本专注 Rx.NET 的在线图书,但大多数概念直接映射到RxJS
- [ReactiveX.io](http://reactivex.io/):ReactiveX 的官方跨语言文档站点
- [Learn Rx](http://reactivex.io/learnrx/):由 Jafar Husain 提供的数组和 Observables 的互动教程
- [RxJS lessons at Egghead.io](https://egghead.io/technologies/rx)
- [RxJS GitBook](http://xgrommx.github.io/rx-book/)
- [RxMarbles](http://rxmarbles.com/):RxJS 运算符的交互图,由 Cycle.js 创建
- [Async JavaScript at Netflix](https://www.youtube.com/watch?v=XRYN2xt11Ek):Jafar Husain 介绍 RxJS 的视频
## Cycle.js 中的 Streams
现在我们能够解释 `senses` 和 `actuators` 的类型,这意味着计算机和人类“相关观察”。
在最简单的情况下,计算机会在屏幕上生成像素,人类会触发鼠标和键盘事件。计算机观察这些用户输入,人们观察计算机生成的屏幕状态。我们可以将其建模为 *Streams*:
- 电脑输出:屏幕图像流。
- 人的输出:鼠标/键盘时间流。
`computer()` 函数将人的输出作为输入,反之亦然。它们相互观察对象的输出。在 JavaScript 中,我们可以将计算机功能写成输入流中的简单的 *xstream* 转换链。
```javascript
function computer(userEventsStream) {
return userEventsStream
.map(event => /* ... */)
.filter(someCondition)
.map(transformItToScreenPixels)
.flatten();
}
```
如果我们能在 `human()` 函数中在做同样的事,这会很优雅。但实际上,我们不能简单地通过串联一些运算符来实现,因为我们需要离开 JavaScript 的环境,去影响外部世界。从概念上来讲,实际上 `human()` 函数是可以存在的,我们会使用 *driver* 去影响外部世界。
[Drivers](drivers.html) 是外部世界的适配器,每个 driver 都代表外部效果的一个方面。例如,DOM Driver 接受计算机生成的“屏幕”流,并返回鼠标和键盘事件的流。在这两者之间,DOM Driver 函数会产生 “*写*” 副作用去渲染 DOM 中的元素,并捕捉 “*读*” 的副作用去监测用户交互。这样,DOM Driver 函数就可以代表用户行为了。"driver" 这个名字基于操作系统驱动程序,并且跟它具有类似的作用:在设备和软件之间架设桥梁。
连接了这两个部分,我们会获得一个叫 `main()` 的运算函数,另外还有一个 driver 函数,其中一个输出是另一个的输入。
```
y = domDriver(x)
x = main(y)
```
如果 `=` 表示赋值的话,上述循环依赖性则无法被求解。因为这将等价于命令 `x = g(f(x))`,并且 `x` 在右侧表达式中未定义。
你只需要指定 `main()` 和 `domDriver()` 来定义 Cycle.js 的入口,并将它们赋给循环连接它们的 Cycle.js `run()` 方法。
```javascript
function main(sources) {
const sinks = {
DOM: // transform sources.DOM through
// a series of xstream operators
};
return sinks;
}
const drivers = {
DOM: makeDOMDriver('#app') // a Cycle.js helper factory
};
run(main, drivers); // solve the circular dependency
```
这就是 "*Cycle.js*" 的由来。它是一个解决人与计算机之间的对话(相互观察)期间出现的流的循环依赖的框架。
接下来,请阅读[基本示例](basic-examples.html),它将我们迄今为止所学习的关于 Cycle.js 的知识付诸实践。 | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2013 Bridgewater Associates, LP
*
* Distributed under the terms of the Modified BSD License. The full license is in
* the file COPYING, distributed as part of this software.
*/
import org.apache.ivy.core.module.id.ModuleRevisionId
import sbt._
import Keys._
import org.apache.ivy.core.install.InstallOptions
import com.untyped.sbtjs.Plugin._
import scala.Some
object NotebookBuild extends Build {
implicit def toRichProject(project: Project) = new RichProject(project)
import Dependencies._
override def settings = super.settings ++ Seq(
organization := "com.bwater",
version := "0.3.0-SNAPSHOT",
scalaVersion in ThisBuild := "2.10.4",
fork in Test in ThisBuild := true,
parallelExecution in Test in ThisBuild := false,
// these java options are for the forked test JVMs
javaOptions in ThisBuild ++= Seq("-Xmx256M", "-XX:MaxPermSize=128M"),
resolvers in ThisBuild ++= Seq(
Resolver.typesafeRepo("releases"),
Resolver.typesafeIvyRepo("releases"),
Resolver.typesafeIvyRepo("snapshots")
),
compileOrder := CompileOrder.Mixed,
publishMavenStyle := false,
javacOptions ++= Seq("-Xlint:deprecation", "-g"),
scalacOptions += "-deprecation",
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v") //Suppress test output unless there is a failure
)
lazy val root = Project(id = "scala-notebook", base = file("."))
.aggregate(subprocess, observable, common, kernel, server)
.settings(
publish := {}, // don't publish an empty jar for the root project
publishLocal := {}
)
lazy val subprocess = Project(id = "subprocess", base = file("subprocess"))
.projectDefaults
.settings(
libraryDependencies ++= Seq(
akkaRemote,
akkaSlf4j,
akkaTestkit,
slf4jLog4j,
scalaTest,
commonsIO,
"org.apache.commons" % "commons-exec" % "1.2"
)
)
lazy val observable = Project(id = "observable", base = file("observable"))
.dependsOn(subprocess)
.projectDefaults
.withWebAssets
.settings(
libraryDependencies ++= Seq(
akkaRemote,
akkaSlf4j,
akkaTestkit,
slf4jLog4j,
unfilteredFilter,
unfilteredWebsockets,
unfilteredJson,
scalaTest,
"com.netflix.rxjava" % "rxjava-scala" % "0.5.3"
)
)
lazy val common = Project(id = "common", base = file("common"))
.dependsOn(observable)
.projectDefaults
.settings(
name := "notebook-common",
libraryDependencies ++= Seq(
akka,
unfilteredJson,
scalaTest,
"log4j" % "log4j" % "1.2.17",
"org.scalaz" %% "scalaz-core" % "7.0.6"
)
)
lazy val kernel = Project(id = "kernel", base = file("kernel"))
.dependsOn(common, subprocess, observable)
.projectDefaults
.settings(
name := "notebook-kernel",
libraryDependencies ++= Seq(
akkaRemote,
akkaSlf4j,
akkaTestkit,
slf4jLog4j,
commonsIO,
scalaTest
),
libraryDependencies ++= Seq(
"org.scala-lang" % "jline" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value
)
)
lazy val server = Project(id = "server", base = file("server"))
.dependsOn(common, kernel)
.projectDefaults
.withWebAssets
.settings(
name := "notebook-server",
mainClass in (Compile, run) := Some("com.bwater.notebook.Server"),
libraryDependencies ++= Seq(
akkaRemote,
akkaSlf4j,
slf4jLog4j,
unfilteredFilter,
unfilteredWebsockets,
akkaTestkit,
unfilteredJson,
commonsIO,
commonsHttp,
scalaTest,
scalaMock,
"org.fusesource.scalate" %% "scalate-core" % "1.6.1"
)
)
object Dependencies {
val unfilteredVersion = "0.6.7"
val akkaVersion = "2.1.4"
val commonsIO = "org.apache.commons" % "commons-io" % "1.3.2"
val commonsHttp = "org.apache.httpcomponents" % "httpclient" % "4.3.4"
val slf4jLog4j = "org.slf4j" % "slf4j-log4j12" % "1.7.7"
val unfilteredFilter = "net.databinder" %% "unfiltered-filter" % unfilteredVersion
val unfilteredWebsockets = "net.databinder" %% "unfiltered-netty-websockets" % unfilteredVersion
val unfilteredJson = "net.databinder" %% "unfiltered-json" % unfilteredVersion
val akka = "com.typesafe.akka" %% "akka-actor" % akkaVersion
val akkaRemote = "com.typesafe.akka" %% "akka-remote" % akkaVersion
val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
val akkaTestkit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test"
val scalaTest = "org.scalatest" %% "scalatest" % "2.2.0" % "test"
val scalaMock = "org.scalamock" %% "scalamock-scalatest-support" % "3.1.RC1" % "test"
}
class RichProject(project: Project) {
def projectDefaults = project.settings(
resourceDirectories in Test <++= resourceDirectories in Compile
)
def withWebAssets = {
project.settings(jsSettings : _*)
.settings(
(sourceDirectory in (Compile, JsKeys.js)) <<= (sourceDirectory in Compile)(_ / "assets"),
(resourceGenerators in Compile) <+= (JsKeys.js in Compile),
// Disable minification
// TODO: make this conditional. Ideally have minification off when running from SBT, on when packaging/publishing.
// Might also be useful to publish debug binaries, maybe in an alternate config/classifier?
(JsKeys.variableRenamingPolicy in (Compile, JsKeys.js)) := VariableRenamingPolicy.OFF,
(JsKeys.prettyPrint in (Compile, JsKeys.js)) := true,
/* Copy all non-compiled assets */
unmanagedResourceDirectories in Compile <+= (sourceDirectory in Compile) (_ / "assets"),
excludeFilter in (Compile, unmanagedResources) ~= (filter => filter || "*.js" || "*.coffee" || "*.jsm")
)
}
}
}
| {
"pile_set_name": "Github"
} |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 网络中的网络(NiN)\n",
"\n",
"前几节介绍的LeNet、AlexNet和VGG在设计上的共同之处是:先以由卷积层构成的模块充分抽取空间特征,再以由全连接层构成的模块来输出分类结果。其中,AlexNet和VGG对LeNet的改进主要在于如何对这两个模块加宽(增加通道数)和加深。本节我们介绍网络中的网络(NiN)[1]。它提出了另外一个思路,即串联多个由卷积层和“全连接”层构成的小网络来构建一个深层网络。\n",
"\n",
"\n",
"## NiN块\n",
"\n",
"我们知道,卷积层的输入和输出通常是四维数组(样本,通道,高,宽),而全连接层的输入和输出则通常是二维数组(样本,特征)。如果想在全连接层后再接上卷积层,则需要将全连接层的输出变换为四维。回忆在[“多输入通道和多输出通道”](channels.ipynb)一节里介绍的$1\\times 1$卷积层。它可以看成全连接层,其中空间维度(高和宽)上的每个元素相当于样本,通道相当于特征。因此,NiN使用$1\\times 1$卷积层来替代全连接层,从而使空间信息能够自然传递到后面的层中去。图5.7对比了NiN同AlexNet和VGG等网络在结构上的主要区别。\n",
"\n",
"\n",
"\n",
"NiN块是NiN中的基础块。它由一个卷积层加两个充当全连接层的$1\\times 1$卷积层串联而成。其中第一个卷积层的超参数可以自行设置,而第二和第三个卷积层的超参数一般是固定的。"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.0.0\n"
]
}
],
"source": [
"import tensorflow as tf\n",
"print(tf.__version__)\n",
"\n",
"for gpu in tf.config.experimental.list_physical_devices('GPU'):\n",
" tf.config.experimental.set_memory_growth(gpu, True)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"def nin_block(num_channels, kernel_size, strides, padding):\n",
" blk = tf.keras.models.Sequential()\n",
" blk.add(tf.keras.layers.Conv2D(num_channels, kernel_size,\n",
" strides=strides, padding=padding, activation='relu')) \n",
" blk.add(tf.keras.layers.Conv2D(num_channels, kernel_size=1,activation='relu')) \n",
" blk.add(tf.keras.layers.Conv2D(num_channels, kernel_size=1,activation='relu')) \n",
" return blk"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NiN模型\n",
"\n",
"NiN是在AlexNet问世不久后提出的。它们的卷积层设定有类似之处。NiN使用卷积窗口形状分别为$11\\times 11$、$5\\times 5$和$3\\times 3$的卷积层,相应的输出通道数也与AlexNet中的一致。每个NiN块后接一个步幅为2、窗口形状为$3\\times 3$的最大池化层。\n",
"\n",
"除使用NiN块以外,NiN还有一个设计与AlexNet显著不同:NiN去掉了AlexNet最后的3个全连接层,取而代之地,NiN使用了输出通道数等于标签类别数的NiN块,然后使用全局平均池化层对每个通道中所有元素求平均并直接用于分类。这里的全局平均池化层即窗口形状等于输入空间维形状的平均池化层。NiN的这个设计的好处是可以显著减小模型参数尺寸,从而缓解过拟合。然而,该设计有时会造成获得有效模型的训练时间的增加。"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"net = tf.keras.models.Sequential()\n",
"net.add(nin_block(96, kernel_size=11, strides=4, padding='valid'))\n",
"net.add(tf.keras.layers.MaxPool2D(pool_size=3, strides=2))\n",
"net.add(nin_block(256, kernel_size=5, strides=1, padding='same'))\n",
"net.add(tf.keras.layers.MaxPool2D(pool_size=3, strides=2))\n",
"net.add(nin_block(384, kernel_size=3, strides=1, padding='same'))\n",
"net.add(tf.keras.layers.MaxPool2D(pool_size=3, strides=2))\n",
"net.add(tf.keras.layers.Dropout(0.5))\n",
"net.add(nin_block(10, kernel_size=3, strides=1, padding='same'))\n",
"net.add(tf.keras.layers.GlobalAveragePooling2D())\n",
"net.add(tf.keras.layers.Flatten())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"下面构造一个高和宽均为224的单通道数据样本来观察每一层的输出形状。"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sequential_1 output shape:\t (1, 54, 54, 96)\n",
"max_pooling2d output shape:\t (1, 26, 26, 96)\n",
"sequential_2 output shape:\t (1, 26, 26, 256)\n",
"max_pooling2d_1 output shape:\t (1, 12, 12, 256)\n",
"sequential_3 output shape:\t (1, 12, 12, 384)\n",
"max_pooling2d_2 output shape:\t (1, 5, 5, 384)\n",
"dropout output shape:\t (1, 5, 5, 384)\n",
"sequential_4 output shape:\t (1, 5, 5, 10)\n",
"global_average_pooling2d output shape:\t (1, 10)\n",
"flatten output shape:\t (1, 10)\n"
]
}
],
"source": [
"X = tf.random.uniform((1,224,224,1))\n",
"for blk in net.layers:\n",
" X = blk(X)\n",
" print(blk.name, 'output shape:\\t', X.shape)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 获取数据和训练模型\n",
"\n",
"我们依然使用Fashion-MNIST数据集来训练模型。NiN的训练与AlexNet和VGG的类似,但这里使用的学习率更大。"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"x_batch shape: (128, 224, 224, 1) y_batch shape: (128,)\n"
]
}
],
"source": [
"import numpy as np\n",
"\n",
"class DataLoader():\n",
" def __init__(self):\n",
" fashion_mnist = tf.keras.datasets.fashion_mnist\n",
" (self.train_images, self.train_labels), (self.test_images, self.test_labels) = fashion_mnist.load_data()\n",
" self.train_images = np.expand_dims(self.train_images.astype(np.float32)/255.0,axis=-1)\n",
" self.test_images = np.expand_dims(self.test_images.astype(np.float32)/255.0,axis=-1)\n",
" self.train_labels = self.train_labels.astype(np.int32)\n",
" self.test_labels = self.test_labels.astype(np.int32)\n",
" self.num_train, self.num_test = self.train_images.shape[0], self.test_images.shape[0]\n",
" \n",
" def get_batch_train(self, batch_size):\n",
" index = np.random.randint(0, np.shape(self.train_images)[0], batch_size)\n",
" #need to resize images to (224,224)\n",
" resized_images = tf.image.resize_with_pad(self.train_images[index],224,224,)\n",
" return resized_images.numpy(), self.train_labels[index]\n",
" \n",
" def get_batch_test(self, batch_size):\n",
" index = np.random.randint(0, np.shape(self.test_images)[0], batch_size)\n",
" #need to resize images to (224,224)\n",
" resized_images = tf.image.resize_with_pad(self.test_images[index],224,224,)\n",
" return resized_images.numpy(), self.test_labels[index]\n",
"\n",
"batch_size = 128\n",
"dataLoader = DataLoader()\n",
"x_batch, y_batch = dataLoader.get_batch_train(batch_size)\n",
"print(\"x_batch shape:\",x_batch.shape,\"y_batch shape:\", y_batch.shape)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 128 samples\n",
"128/128 [==============================] - 2s 15ms/sample - loss: 4.6032 - accuracy: 0.0859\n"
]
},
{
"data": {
"text/plain": [
"<tensorflow.python.keras.callbacks.History at 0x22849547048>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def train_nin():\n",
" net.load_weights(\"5.8_nin_weights.h5\")\n",
" epoch = 5\n",
" num_iter = dataLoader.num_train//batch_size\n",
" for e in range(epoch):\n",
" for n in range(num_iter):\n",
" x_batch, y_batch = dataLoader.get_batch_train(batch_size)\n",
" net.fit(x_batch, y_batch)\n",
" if n%20 == 0:\n",
" net.save_weights(\"5.8_nin_weights.h5\")\n",
" \n",
"# optimizer = tf.keras.optimizers.SGD(learning_rate=0.06, momentum=0.3, nesterov=False)\n",
"optimizer = tf.keras.optimizers.Adam(lr=1e-7)\n",
"net.compile(optimizer=optimizer,\n",
" loss='sparse_categorical_crossentropy',\n",
" metrics=['accuracy'])\n",
"\n",
"x_batch, y_batch = dataLoader.get_batch_train(batch_size)\n",
"net.fit(x_batch, y_batch)\n",
"# train_nin()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"我们将训练好的参数读入,然后取测试数据计算测试准确率"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2000/1 - 2s - loss: 1.2275 - accuracy: 0.6300\n"
]
},
{
"data": {
"text/plain": [
"[0.9028337945938111, 0.63]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"net.load_weights(\"5.8_nin_weights.h5\")\n",
"\n",
"x_test, y_test = dataLoader.get_batch_test(2000)\n",
"net.evaluate(x_test, y_test, verbose=2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 小结\n",
"\n",
"* NiN重复使用由卷积层和代替全连接层的$1\\times 1$卷积层构成的NiN块来构建深层网络。\n",
"* NiN去除了容易造成过拟合的全连接输出层,而是将其替换成输出通道数等于标签类别数的NiN块和全局平均池化层。\n",
"* NiN的以上设计思想影响了后面一系列卷积神经网络的设计。"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "tf2.0-gpu",
"language": "python",
"name": "tf2.0-gpu"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
| {
"pile_set_name": "Github"
} |
noinst_HEADERS = \
assert.hh \
bootstrap-complete-event.hh \
command-line.hh \
connection.hh \
errno_exception.hh \
event.hh \
fault.hh \
fnv_hash.hh \
hash_func.hh \
hash.hh \
hash_map.hh \
hash_set.hh \
network_archive.hh \
network_iarchive.hh \
network_oarchive.hh \
new-connection-event.hh \
packets.h \
shutdown-event.hh \
sigset.hh \
stable_list.hh \
stable_map.hh \
string.hh \
timeval.hh \
type-props.h \
vlog-socket.hh \
vlog.hh \
xtoxll.h \
netinet++/arp.hh \
netinet++/bpdu.hh \
netinet++/cidr.hh \
netinet++/ethernet.hh \
netinet++/datapathid.hh \
netinet++/ethernetaddr.hh \
netinet++/ip.hh \
netinet++/ipaddr.hh \
netinet++/llc.hh \
netinet++/static_lib.hh \
netinet++/tcp.hh \
netinet++/vlan.hh
| {
"pile_set_name": "Github"
} |
TIMESTAMP = 1497163089
SHA256 (PEAR/HTML_Javascript-1.1.2.tgz) = 688124c73bc9528fa503edf4c7089f7fd3b2d7ca28110a360d6c6776d16a8c1d
SIZE (PEAR/HTML_Javascript-1.1.2.tgz) = 8750
| {
"pile_set_name": "Github"
} |
---
layout: post
lang: ja
permalink: /ja/circleci
title: CircleCI
description: ' CircleCI は、プロジェクトの規模にかかわらず、迅速かつ質の高いチーム開発を容易にします。誰もが頭の中で想像した通りに開発を進められるようにする、それが私たちのミッションです。(募集中) '
description_full: '<p>CircleCI は、プロジェクトの規模にかかわらず、迅速かつ質の高いチーム開発を容易にします。誰もが頭の中で想像した通りに開発を進められるようにする、それが私たちのミッションです。<a href="https://circleci.com/jobs/">(募集中)</a></p>'
categories:
link: https://circleci.jp/
---
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2012 Michael Brown <[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 any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <time.h>
/** @file
*
* Date and time
*
* POSIX:2008 section 4.15 defines "seconds since the Epoch" as an
* abstract measure approximating the number of seconds that have
* elapsed since the Epoch, excluding leap seconds. The formula given
* is
*
* tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 +
* (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 -
* ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400
*
* This calculation assumes that leap years occur in each year that is
* either divisible by 4 but not divisible by 100, or is divisible by
* 400.
*/
/** Days of week (for debugging) */
static const char *weekdays[] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
/**
* Determine whether or not year is a leap year
*
* @v tm_year Years since 1900
* @v is_leap_year Year is a leap year
*/
static int is_leap_year ( int tm_year ) {
int leap_year = 0;
if ( ( tm_year % 4 ) == 0 )
leap_year = 1;
if ( ( tm_year % 100 ) == 0 )
leap_year = 0;
if ( ( tm_year % 400 ) == 100 )
leap_year = 1;
return leap_year;
}
/**
* Calculate number of leap years since 1900
*
* @v tm_year Years since 1900
* @v num_leap_years Number of leap years
*/
static int leap_years_to_end ( int tm_year ) {
int leap_years = 0;
leap_years += ( tm_year / 4 );
leap_years -= ( tm_year / 100 );
leap_years += ( ( tm_year + 300 ) / 400 );
return leap_years;
}
/**
* Calculate day of week
*
* @v tm_year Years since 1900
* @v tm_mon Month of year [0,11]
* @v tm_day Day of month [1,31]
*/
static int day_of_week ( int tm_year, int tm_mon, int tm_mday ) {
static const uint8_t offset[12] =
{ 1, 4, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5 };
int pseudo_year = tm_year;
if ( tm_mon < 2 )
pseudo_year--;
return ( ( pseudo_year + leap_years_to_end ( pseudo_year ) +
offset[tm_mon] + tm_mday ) % 7 );
}
/** Days from start of year until start of months (in non-leap years) */
static const uint16_t days_to_month_start[] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
/**
* Calculate seconds since the Epoch
*
* @v tm Broken-down time
* @ret time Seconds since the Epoch
*/
time_t mktime ( struct tm *tm ) {
int days_since_epoch;
int seconds_since_day;
time_t seconds;
/* Calculate day of year */
tm->tm_yday = ( ( tm->tm_mday - 1 ) +
days_to_month_start[ tm->tm_mon ] );
if ( ( tm->tm_mon >= 2 ) && is_leap_year ( tm->tm_year ) )
tm->tm_yday++;
/* Calculate day of week */
tm->tm_wday = day_of_week ( tm->tm_year, tm->tm_mon, tm->tm_mday );
/* Calculate seconds since the Epoch */
days_since_epoch = ( tm->tm_yday + ( 365 * tm->tm_year ) - 25567 +
leap_years_to_end ( tm->tm_year - 1 ) );
seconds_since_day =
( ( ( ( tm->tm_hour * 60 ) + tm->tm_min ) * 60 ) + tm->tm_sec );
seconds = ( ( ( ( time_t ) days_since_epoch ) * ( ( time_t ) 86400 ) ) +
seconds_since_day );
DBGC ( &weekdays, "TIME %04d-%02d-%02d %02d:%02d:%02d => %lld (%s, "
"day %d)\n", ( tm->tm_year + 1900 ), ( tm->tm_mon + 1 ),
tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, seconds,
weekdays[ tm->tm_wday ], tm->tm_yday );
return seconds;
}
| {
"pile_set_name": "Github"
} |
//
// This file is part of the NineAnimator project.
//
// Copyright © 2018-2020 Marcus Zhou. All rights reserved.
//
// NineAnimator 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.
//
// NineAnimator 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 NineAnimator. If not, see <http://www.gnu.org/licenses/>.
//
import UIKit
class InformationSceneSchedulesCell: UITableViewCell, UICollectionViewDelegate, UICollectionViewDataSource {
@IBOutlet private weak var collectionView: UICollectionView!
@IBOutlet private weak var flowLayout: UICollectionViewFlowLayout!
private(set) var airingSchedules: [ListingAiringEpisode]?
func setPresenting(_ schedules: [ListingAiringEpisode]) {
self.airingSchedules = schedules
}
func numberOfSections(in collectionView: UICollectionView) -> Int { 1 }
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
section == 0 ? airingSchedules?.count ?? 0 : 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(
withReuseIdentifier: "schedule.episode",
for: indexPath
) as! InformationSceneAiringEpisodeCell
if let airingSchedules = airingSchedules, indexPath.section == 0 {
cell.setPresenting(airingSchedules[indexPath.item])
}
return cell
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2009,2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// OpenBSD system calls.
// This file is compiled as ordinary Go code,
// but it is also input to mksyscall,
// which parses the //sys lines and generates system call stubs.
// Note that sometimes we use a lowercase //sys name and wrap
// it in our own nicer implementation, either here or in
// syscall_bsd.go or syscall_unix.go.
package unix
import (
"sort"
"syscall"
"unsafe"
)
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
type SockaddrDatalink struct {
Len uint8
Family uint8
Index uint16
Type uint8
Nlen uint8
Alen uint8
Slen uint8
Data [24]int8
raw RawSockaddrDatalink
}
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
func nametomib(name string) (mib []_C_int, err error) {
i := sort.Search(len(sysctlMib), func(i int) bool {
return sysctlMib[i].ctlname >= name
})
if i < len(sysctlMib) && sysctlMib[i].ctlname == name {
return sysctlMib[i].ctloid, nil
}
return nil, EINVAL
}
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofClockinfo)
var ci Clockinfo
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofClockinfo {
return nil, EIO
}
return &ci, nil
}
func SysctlUvmexp(name string) (*Uvmexp, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofUvmexp)
var u Uvmexp
if err := sysctl(mib, (*byte)(unsafe.Pointer(&u)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofUvmexp {
return nil, EIO
}
return &u, nil
}
//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
var pp [2]_C_int
err = pipe(&pp)
p[0] = int(pp[0])
p[1] = int(pp[1])
return
}
//sys Getdents(fd int, buf []byte) (n int, err error)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
n, err = Getdents(fd, buf)
if err != nil || basep == nil {
return
}
var off int64
off, err = Seek(fd, 0, 1 /* SEEK_CUR */)
if err != nil {
*basep = ^uintptr(0)
return
}
*basep = uintptr(off)
if unsafe.Sizeof(*basep) == 8 {
return
}
if off>>32 != 0 {
// We can't stuff the offset back into a uintptr, so any
// future calls would be suspect. Generate an error.
// EIO was allowed by getdirentries.
err = EIO
}
return
}
const ImplementsGetwd = true
//sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
func Getwd() (string, error) {
var buf [PathMax]byte
_, err := Getcwd(buf[0:])
if err != nil {
return "", err
}
n := clen(buf[:])
if n < 1 {
return "", EINVAL
}
return string(buf[:n]), nil
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
// TODO
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
return -1, ENOSYS
}
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
var _p0 unsafe.Pointer
var bufsize uintptr
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
n = int(r0)
if e1 != 0 {
err = e1
}
return
}
func setattrlistTimes(path string, times []Timespec, flags int) error {
// used on Darwin for UtimesNano
return ENOSYS
}
//sys ioctl(fd int, req uint, arg uintptr) (err error)
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// IoctlSetInt performs an ioctl operation which sets an integer value
// on fd, using the specified request number.
func IoctlSetInt(fd int, req uint, value int) error {
return ioctl(fd, req, uintptr(value))
}
func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
func ioctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
var value int
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return value, err
}
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
var value Winsize
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return &value, err
}
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
if len(fds) == 0 {
return ppoll(nil, 0, timeout, sigmask)
}
return ppoll(&fds[0], len(fds), timeout, sigmask)
}
func Uname(uname *Utsname) error {
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
n := unsafe.Sizeof(uname.Sysname)
if err := sysctl(mib, &uname.Sysname[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_HOSTNAME}
n = unsafe.Sizeof(uname.Nodename)
if err := sysctl(mib, &uname.Nodename[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_OSRELEASE}
n = unsafe.Sizeof(uname.Release)
if err := sysctl(mib, &uname.Release[0], &n, nil, 0); err != nil {
return err
}
mib = []_C_int{CTL_KERN, KERN_VERSION}
n = unsafe.Sizeof(uname.Version)
if err := sysctl(mib, &uname.Version[0], &n, nil, 0); err != nil {
return err
}
// The version might have newlines or tabs in it, convert them to
// spaces.
for i, b := range uname.Version {
if b == '\n' || b == '\t' {
if i == len(uname.Version)-1 {
uname.Version[i] = 0
} else {
uname.Version[i] = ' '
}
}
}
mib = []_C_int{CTL_HW, HW_MACHINE}
n = unsafe.Sizeof(uname.Machine)
if err := sysctl(mib, &uname.Machine[0], &n, nil, 0); err != nil {
return err
}
return nil
}
/*
* Exposed directly
*/
//sys Access(path string, mode uint32) (err error)
//sys Adjtime(delta *Timeval, olddelta *Timeval) (err error)
//sys Chdir(path string) (err error)
//sys Chflags(path string, flags int) (err error)
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)
//sys Exit(code int)
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
//sys Fchdir(fd int) (err error)
//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
//sys Flock(fd int, how int) (err error)
//sys Fpathconf(fd int, name int) (val int, err error)
//sys Fstat(fd int, stat *Stat_t) (err error)
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
//sys Fsync(fd int) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sysnb Getegid() (egid int)
//sysnb Geteuid() (uid int)
//sysnb Getgid() (gid int)
//sysnb Getpgid(pid int) (pgid int, err error)
//sysnb Getpgrp() (pgrp int)
//sysnb Getpid() (pid int)
//sysnb Getppid() (ppid int)
//sys Getpriority(which int, who int) (prio int, err error)
//sysnb Getrlimit(which int, lim *Rlimit) (err error)
//sysnb Getrtable() (rtable int, err error)
//sysnb Getrusage(who int, rusage *Rusage) (err error)
//sysnb Getsid(pid int) (sid int, err error)
//sysnb Gettimeofday(tv *Timeval) (err error)
//sysnb Getuid() (uid int)
//sys Issetugid() (tainted bool)
//sys Kill(pid int, signum syscall.Signal) (err error)
//sys Kqueue() (fd int, err error)
//sys Lchown(path string, uid int, gid int) (err error)
//sys Link(path string, link string) (err error)
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
//sys Listen(s int, backlog int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error)
//sys Mkdir(path string, mode uint32) (err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mkfifo(path string, mode uint32) (err error)
//sys Mkfifoat(dirfd int, path string, mode uint32) (err error)
//sys Mknod(path string, mode uint32, dev int) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
//sys Open(path string, mode int, perm uint32) (fd int, err error)
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
//sys Pathconf(path string, name int) (val int, err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
//sys read(fd int, p []byte) (n int, err error)
//sys Readlink(path string, buf []byte) (n int, err error)
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
//sys Rename(from string, to string) (err error)
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
//sys Revoke(path string) (err error)
//sys Rmdir(path string) (err error)
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
//sys Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error)
//sysnb Setegid(egid int) (err error)
//sysnb Seteuid(euid int) (err error)
//sysnb Setgid(gid int) (err error)
//sys Setlogin(name string) (err error)
//sysnb Setpgid(pid int, pgid int) (err error)
//sys Setpriority(which int, who int, prio int) (err error)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
//sysnb Setrtable(rtable int) (err error)
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, stat *Statfs_t) (err error)
//sys Symlink(path string, link string) (err error)
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
//sys Sync() (err error)
//sys Truncate(path string, length int64) (err error)
//sys Umask(newmask int) (oldmask int)
//sys Unlink(path string) (err error)
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Unmount(path string, flags int) (err error)
//sys write(fd int, p []byte) (n int, err error)
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
/*
* Unimplemented
*/
// __getcwd
// __semctl
// __syscall
// __sysctl
// adjfreq
// break
// clock_getres
// clock_gettime
// clock_settime
// closefrom
// execve
// fcntl
// fhopen
// fhstat
// fhstatfs
// fork
// futimens
// getfh
// getgid
// getitimer
// getlogin
// getresgid
// getresuid
// getthrid
// ktrace
// lfs_bmapv
// lfs_markv
// lfs_segclean
// lfs_segwait
// mincore
// minherit
// mount
// mquery
// msgctl
// msgget
// msgrcv
// msgsnd
// nfssvc
// nnpfspioctl
// preadv
// profil
// pwritev
// quotactl
// readv
// reboot
// renameat
// rfork
// sched_yield
// semget
// semop
// setgroups
// setitimer
// setsockopt
// shmat
// shmctl
// shmdt
// shmget
// sigaction
// sigaltstack
// sigpending
// sigprocmask
// sigreturn
// sigsuspend
// sysarch
// syscall
// threxit
// thrsigdivert
// thrsleep
// thrwakeup
// vfork
// writev
| {
"pile_set_name": "Github"
} |
#pragma once
#include "Camera.h"
#include <pjmedia.h>
#include <pjlib.h>
#include "VideoFrame.h"
/**
* @brief 摄像头 pjsip 实现类
* @ingroup RABBITIM_IMPLEMENT_CAMERA_PJSIP
* @see CCamera
*/
class CCameraPjsip : public CCamera
{
public:
CCameraPjsip(int nIndex);
virtual ~CCameraPjsip();
virtual int Start();
virtual int Stop();
virtual int OnFrame(pjmedia_frame *frame);
private:
virtual int OnOpen(VideoInfo* pVideoInfo = NULL);
virtual int OnClose();
private:
pj_caching_pool m_Caching_pool;
pjmedia_vid_dev_stream * m_pVidDevStream;
pjmedia_vid_dev_cb m_VidDevCb;
static pj_status_t capture_cb(pjmedia_vid_dev_stream *stream, void *user_data, pjmedia_frame *frame);
int Init();
int Clean();
};
| {
"pile_set_name": "Github"
} |
package viper
import "github.com/spf13/pflag"
// FlagValueSet is an interface that users can implement
// to bind a set of flags to viper.
type FlagValueSet interface {
VisitAll(fn func(FlagValue))
}
// FlagValue is an interface that users can implement
// to bind different flags to viper.
type FlagValue interface {
HasChanged() bool
Name() string
ValueString() string
ValueType() string
}
// pflagValueSet is a wrapper around *pflag.ValueSet
// that implements FlagValueSet.
type pflagValueSet struct {
flags *pflag.FlagSet
}
// VisitAll iterates over all *pflag.Flag inside the *pflag.FlagSet.
func (p pflagValueSet) VisitAll(fn func(flag FlagValue)) {
p.flags.VisitAll(func(flag *pflag.Flag) {
fn(pflagValue{flag})
})
}
// pflagValue is a wrapper aroung *pflag.flag
// that implements FlagValue
type pflagValue struct {
flag *pflag.Flag
}
// HasChanges returns whether the flag has changes or not.
func (p pflagValue) HasChanged() bool {
return p.flag.Changed
}
// Name returns the name of the flag.
func (p pflagValue) Name() string {
return p.flag.Name
}
// ValueString returns the value of the flag as a string.
func (p pflagValue) ValueString() string {
return p.flag.Value.String()
}
// ValueType returns the type of the flag as a string.
func (p pflagValue) ValueType() string {
return p.flag.Value.Type()
}
| {
"pile_set_name": "Github"
} |
'''
persist data to db
'''
from datetime import date
import datetime
import operator
from functools import reduce
import json
from peewee import *
from enum import IntEnum
from collections import defaultdict
from bustag.util import logger, get_data_path, format_datetime, get_now_time, get_full_url
DB_FILE = 'bus.db'
db = SqliteDatabase(get_data_path(DB_FILE), pragmas={
'journal_mode': 'wal'})
class BaseModel(Model):
class Meta:
database = db
legacy_table_names = False
class ExistError(Exception):
pass
class DBError(Exception):
pass
class Item(BaseModel):
'''
item table
'''
title = CharField()
fanhao = CharField(unique=True)
url = CharField(unique=True)
release_date = DateField()
add_date = DateTimeField(default=datetime.datetime.now)
meta_info = TextField()
def __repr__(self):
return f'<Item:{self.fanhao} {self.title}>'
@staticmethod
def saveit(meta_info):
item_release_date = date.fromisoformat(meta_info.pop('release_date'))
item_fanhao = meta_info.pop('fanhao')
item_title = meta_info.pop('title')
item_url = meta_info.pop('url')
item_meta = json.dumps(meta_info)
try:
item = Item.create(fanhao=item_fanhao, title=item_title, url=item_url,
release_date=item_release_date, meta_info=item_meta)
logger.debug(f'save item: {item}')
except IntegrityError:
logger.debug('Item exists: {item_fanhao}')
raise ExistError()
else:
return item
@staticmethod
def loadit(item):
item.url = get_full_url(item.url)
meta = json.loads(item.meta_info)
item.cover_img_url = meta['cover_img_url']
series = item.fanhao.split('-')[0]
item.add_date = format_datetime(item.add_date)
@staticmethod
def getit(id):
item = Item.get_by_id(id)
return item
@staticmethod
def get_by_fanhao(fanhao):
item = Item.get_or_none(Item.fanhao == fanhao)
return item
@staticmethod
def get_tags_dict(item):
tags_dict = defaultdict(list)
for t in item.tags_list:
tags_dict[t.tag.type_].append(t.tag.value)
item.tags_dict = tags_dict
class Tag(BaseModel):
'''
tag table
'''
type_ = CharField(column_name='type')
value = CharField()
url = CharField()
class Meta:
indexes = (
# Specify a unique multi-column index
(('type_', 'value'), True),
)
def __repr__(self):
return f'<Tag {self.value}>'
@staticmethod
def saveit(tag_info):
tag, created = Tag.get_or_create(type_=tag_info.type, value=tag_info.value,
defaults={'url': tag_info.link})
if created:
logger.debug(f'save tag: {tag}')
return tag
class ItemTag(BaseModel):
item = ForeignKeyField(Item, field='fanhao', backref='tags_list')
tag = ForeignKeyField(Tag, backref='items')
class Meta:
indexes = (
# Specify a unique multi-column index
(('item', 'tag'), True),
)
@staticmethod
def saveit(item, tag):
try:
item_tag = ItemTag.create(item=item, tag=tag)
logger.debug(f'save tag_item: {item_tag}')
except Exception as ex:
logger.exception(ex)
else:
return item_tag
def __repr__(self):
return f'<ItemTag {self.item.fanhao} - {self.tag.value}>'
class RATE_TYPE(IntEnum):
NOT_RATE = 0
USER_RATE = 1
SYSTEM_RATE = 2
class RATE_VALUE(IntEnum):
LIKE = 1
DISLIKE = 0
class ItemRate(BaseModel):
rate_type = IntegerField()
rate_value = IntegerField()
item = ForeignKeyField(Item, field='fanhao',
backref='rated_items', unique=True)
rete_time = DateTimeField(default=datetime.datetime.now)
@staticmethod
def saveit(rate_type, rate_value, fanhao):
item_rate = None
try:
item_rate = ItemRate.create(
item=fanhao, rate_type=rate_type, rate_value=rate_value)
logger.debug(f'save ItemRate: {item_rate}')
except IntegrityError:
logger.debug(f'ItemRate exists: {fanhao}')
else:
return item_rate
@staticmethod
def getit(id):
item_rate = ItemRate.get_or_none(ItemRate.id == id)
return item_rate
@staticmethod
def get_by_fanhao(fanhao):
item_rate = ItemRate.get_or_none(ItemRate.item_id == fanhao)
return item_rate
class LocalItem(BaseModel):
'''
local item table
'''
item = ForeignKeyField(Item, field='fanhao',
backref='local_item', unique=True)
path = CharField(null=True)
size = IntegerField(null=True)
add_date = DateTimeField(default=datetime.datetime.now)
last_view_date = DateTimeField(null=True)
view_times = IntegerField(default=0)
@staticmethod
def saveit(fanhao, path):
local_item = None
try:
local_item = LocalItem.create(
item=fanhao, path=path)
logger.debug(f'save LocalItem: {fanhao}')
except IntegrityError:
logger.debug(f'LocalItem exists: {fanhao}')
else:
return local_item
def __repr__(self):
return f'<LocalItem {self.fanhao}({self.path})>'
@staticmethod
def update_play(id):
nrows = (LocalItem
.update({LocalItem.last_view_date: get_now_time(),
LocalItem.view_times: LocalItem.view_times+1})
.where(LocalItem.id == id)
.execute())
logger.debug(f'update LocalItem {id} : rows:{nrows}')
return LocalItem.get_by_id(id)
@staticmethod
def loadit(local_item):
local_item.last_view_date = format_datetime(
local_item.last_view_date) if local_item.last_view_date else ''
def save(meta_info, tags):
item_title = meta_info['title']
tag_objs = []
try:
item = Item.saveit(meta_info)
except ExistError:
logger.debug(f'item exists: {item_title}')
else:
with db.atomic():
for tag_info in tags:
tag = Tag.saveit(tag_info)
if tag:
tag_objs.append(tag)
with db.atomic():
for tag_obj in tag_objs:
ItemTag.saveit(item, tag_obj)
def test_save():
item_url = 'https://www.cdnbus.bid/MADM-116'
item_title = 'test item'
item_fanhao = 'MADM-116'
item_release_date = date(2019, 7, 19)
item_meta_info = ''
item = Item(title=item_title, url=item_url, fanhao=item_fanhao,
release_date=item_release_date, meta_info=item_meta_info)
item.save()
tag1 = Tag.create(type_='genre', value='素人',
url='https://www.cdnbus.bid/genre/s1')
tag2 = Tag.create(type_='star', value='樱田',
url='https://www.cdnbus.bid/star/dbd')
tag3 = Tag.create(type_='genre', value='高清',
url='https://www.cdnbus.bid/genre/x1')
ItemTag.create(item=item, tag=tag1)
ItemTag.create(item=item, tag=tag2)
ItemRate.saveit(RATE_TYPE.USER_RATE, RATE_VALUE.LIKE, item.fanhao)
LocalItem.saveit('MADM-116', '/Download/MADM-116.avi')
def get_items(rate_type=None, rate_value=None, page=1, page_size=10):
'''
get required items based on some conditions
'''
items_list = []
clauses = []
if rate_type is not None:
clauses.append(ItemRate.rate_type == rate_type)
else:
clauses.append(ItemRate.rate_type.is_null())
if rate_value is not None:
clauses.append(ItemRate.rate_value == rate_value)
q = (Item.select(Item, ItemRate)
.join(ItemRate, JOIN.LEFT_OUTER, attr='item_rate')
.where(reduce(operator.and_, clauses))
.order_by(Item.id.desc())
)
total_items = q.count()
if not page is None:
q = q.paginate(page, page_size)
items = get_tags_for_items(q)
for item in items:
Item.loadit(item)
if hasattr(item, 'item_rate'):
item.rate_value = item.item_rate.rate_value
else:
item.rate_value = None
items_list.append(item)
total_pages = (total_items + page_size - 1) // page_size
page_info = (total_items, total_pages, page, page_size)
return items_list, page_info
def get_local_items(page=1, page_size=10):
'''
get local items
'''
items = []
q = (LocalItem.select(LocalItem)
.where(LocalItem.path.is_null(False))
.order_by(LocalItem.id.desc())
)
total_items = q.count()
if not page is None:
q = q.paginate(page, page_size)
item_query = Item.select()
item_tag_query = ItemTag.select()
tag_query = Tag.select()
items_with_tags = prefetch(q, item_query, item_tag_query, tag_query)
for local_item in items_with_tags:
try:
Item.loadit(local_item.item)
Item.get_tags_dict(local_item.item)
items.append(local_item)
except Exception:
pass
total_pages = (total_items + page_size - 1) // page_size
page_info = (total_items, total_pages, page, page_size)
return items, page_info
def get_today_update_count():
now = get_now_time()
year, month, day = now.year, now.month, now.day
q = Item.select().where((Item.add_date.year == year)
& (Item.add_date.month == month)
& (Item.add_date.day == day)
)
return q.count()
def get_today_recommend_count():
now = get_now_time()
year, month, day = now.year, now.month, now.day
q = ItemRate.select().where((ItemRate.rete_time.year == year)
& (ItemRate.rete_time.month == month)
& (ItemRate.rete_time.day == day)
& (ItemRate.rate_type == RATE_TYPE.SYSTEM_RATE)
& (ItemRate.rate_value == RATE_VALUE.LIKE)
)
return q.count()
def get_tags_for_items(items_query):
item_tag_query = ItemTag.select()
tag_query = Tag.select()
items_with_tags = prefetch(items_query, item_tag_query, tag_query)
items = []
for item in items_with_tags:
Item.get_tags_dict(item)
items.append(item)
return items
def init():
db.connect(reuse_if_open=True)
db.create_tables([Item, Tag, ItemTag, ItemRate, LocalItem])
init()
| {
"pile_set_name": "Github"
} |
#include <z64.h>
// 0x25800 bytes
u16 gZBuffer[SCREEN_WIDTH * SCREEN_HEIGHT];
| {
"pile_set_name": "Github"
} |
package App::NetdiscoX::Worker::Plugin::TestThree;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
# info 'test: respect user config filtering the driver, action and namespace';
register_worker({ phase => 'main', driver => 'cli' }, sub {
return Status->done('NOT OK: CLI driver should NOT be run.');
});
register_worker({ phase => 'main', driver => 'snmp' }, sub {
return Status->done('OK: SNMP driver is successful.');
});
true;
| {
"pile_set_name": "Github"
} |
<shader>{
"name" : "VecWColor",
"ubo" : [ "UBOTransform", "UBOModel", "UBOWorld" ],
"options" : { "modelMatrix":true },
"uniforms" : [
{ "name":"u_colorAry", "type":"vec3" }
]
}<\shader>
<materials>[
{ "name":"VecWColor",
"options" : { "depthTest":true, "blend":false },
"uniforms":[
{ "name":"u_colorAry", "type":"rgb", "value": ["ff0000","00ff00","0000ff","555555","999999","dddddd","000000","ff7f7f","ff8c00","ffff00"] }
]},
{ "name":"MatGridFloor",
"options" : { "depthTest":true, "blend":false },
"uniforms":[
{ "name":"u_colorAry", "type":"rgb", "value": ["e6e6e6","ff9999","66ff66"] }
] },
{ "name":"MatGridFloorDark",
"options" : { "depthTest":true, "blend":false },
"uniforms":[
{ "name":"u_colorAry", "type":"rgb", "value": ["555555","bb5555","118811"] }
] }
]<\materials>
<vertex>
#version 300 es
layout(location=0) in vec4 a_position;
uniform UBOTransform{
mat4 projViewMatrix;
vec3 cameraPos;
float globalTime;
vec2 screenSize;
};
uniform UBOWorld{
vec4 rotation;
vec3 position;
vec3 scale;
} model;
uniform UBOModel{
mat4 modelMatrix;
mat3 normalMatrix;
};
uniform vec3 u_colorAry[20];
out vec3 v_color;
vec3 vecQuatRotation(vec4 q, vec3 v){ return v + cross(2.0 * q.xyz, cross(q.xyz, v) + q.w * v); }
void main(void){
vec3 pos = vecQuatRotation(model.rotation, a_position.xyz * model.scale) + model.position;
v_color = u_colorAry[ int(a_position.w) ];
gl_PointSize = 10.0;
//gl_Position = projViewMatrix * modelMatrix * vec4(a_position.xyz, 1.0);
gl_Position = projViewMatrix * vec4(pos, 1.0);
}
<\vertex>
<fragment>
#version 300 es
precision mediump float;
in vec3 v_color;
out vec4 oFragColor;
void main(void){ oFragColor = vec4(v_color, 1.0); }
<\fragment> | {
"pile_set_name": "Github"
} |
BaseModel = require '../BaseModel'
class Users extends BaseModel
init: =>
@keys = @load 'UserKeys'
all: (params = {}, fn = null) =>
if 'function' is typeof params
fn = params
params = {}
@debug "Users::all()"
params.page ?= 1
params.per_page ?= 100
data = []
cb = (err, retData) =>
if err
return fn(retData || data) if fn
else if retData.length == params.per_page
@debug "Recurse Users::all()"
data = data.concat(retData)
params.page++
return @get "users", params, cb
else
data = data.concat(retData)
return fn data if fn
@get "users", params, cb
current: (fn = null) =>
@debug "Users::current()"
@get "user", (data) -> fn data if fn
show: (userId, fn = null) =>
@debug "Users::show()"
@get "users/#{parseInt userId}", (data) => fn data if fn
create: (params = {}, fn = null) =>
@debug "Users::create()", params
@post "users", params, (data) -> fn data if fn
session: (email, password, fn = null) =>
@debug "Users::session()"
params =
email: email
password: password
@post "session", params, (data) -> fn data if fn
search: (emailOrUsername, fn = null) =>
@debug "Users::search(#{emailOrUsername})"
params =
search: emailOrUsername
@get "users", params, (data) -> fn data if fn
module.exports = (client) -> new Users client
| {
"pile_set_name": "Github"
} |
namespace ClassLib066
{
public class Class097
{
public static string Property => "ClassLib066";
}
}
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!4 &5620287371074205366 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
m_PrefabInstance: {fileID: 5620287371074071606}
m_PrefabAsset: {fileID: 0}
--- !u!23 &5620287371071779924 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: 2300002, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
m_PrefabInstance: {fileID: 5620287371074071606}
m_PrefabAsset: {fileID: 0}
--- !u!1 &5620287371073972894 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100008, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
m_PrefabInstance: {fileID: 5620287371074071606}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1302712140196707869
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5620287371073972894}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 42a968b42c86d9146a68f3937c63592f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Renderer: {fileID: 5620287371071779924}
--- !u!1 &5620287371073972892 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100010, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
m_PrefabInstance: {fileID: 5620287371074071606}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3343741708998412536
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5620287371073972892}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 42a968b42c86d9146a68f3937c63592f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Renderer: {fileID: 5620287371071779924}
--- !u!1 &5620287371073972890 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 100012, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
m_PrefabInstance: {fileID: 5620287371074071606}
m_PrefabAsset: {fileID: 0}
--- !u!114 &7127827649020971181
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5620287371073972890}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 42a968b42c86d9146a68f3937c63592f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Renderer: {fileID: 5620287371071779924}
--- !u!1 &8373126686056071661
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1039292308945707161}
- component: {fileID: 5930691882722629461}
m_Layer: 0
m_Name: LPG_Building_B_Staircase_C_Floor_A
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 123
m_IsActive: 1
--- !u!4 &1039292308945707161
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8373126686056071661}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5620287371074205366}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!220 &5930691882722629461
LightProbeGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8373126686056071661}
m_Enabled: 1
m_SourcePositions:
- {x: 17.648508, y: -5.1074924, z: 0.14999938}
- {x: 17.798174, y: -4.215765, z: 0.14999938}
- {x: 20.648514, y: -17.27518, z: 0.14999938}
- {x: 17.648508, y: -6.2751827, z: 0.14999938}
- {x: 7.131012, y: -1.1074976, z: 0.15000033}
- {x: 7.1310115, y: -0.12052101, z: 0.15000033}
- {x: 7.1310134, y: -3.275188, z: 0.15000033}
- {x: 7.1310124, y: -2.275188, z: 0.15000033}
- {x: 4.1310124, y: -1.107499, z: 0.15000033}
- {x: 4.131012, y: -0.12052244, z: 0.15000033}
- {x: 4.131014, y: -3.2751894, z: 0.15000033}
- {x: 4.131013, y: -2.2751894, z: 0.15000033}
- {x: 0.13101244, y: -1.1075009, z: 0.15000033}
- {x: 0.13101202, y: -0.12052435, z: 0.15000033}
- {x: 0.13101363, y: -3.2751913, z: 0.15000033}
- {x: 0.13101315, y: -2.2751913, z: 0.15000033}
- {x: 3.1310124, y: -1.1074995, z: 0.15000033}
- {x: 3.131012, y: -0.12052292, z: 0.15000033}
- {x: 3.1310139, y: -3.2751899, z: 0.15000033}
- {x: 3.131013, y: -2.2751899, z: 0.15000033}
- {x: 2.1310124, y: -1.1075, z: 0.15000033}
- {x: 2.131012, y: -0.12052339, z: 0.15000033}
- {x: 2.1310136, y: -3.2751904, z: 0.15000033}
- {x: 2.1310132, y: -2.2751904, z: 0.15000033}
- {x: 1.1310124, y: -1.1075004, z: 0.15000033}
- {x: 1.131012, y: -0.12052387, z: 0.15000033}
- {x: 1.1310136, y: -3.2751908, z: 0.15000033}
- {x: 1.1310132, y: -2.2751908, z: 0.15000033}
- {x: 6.1310124, y: -1.107498, z: 0.15000033}
- {x: 6.131012, y: -0.120521486, z: 0.15000033}
- {x: 6.131014, y: -3.2751884, z: 0.15000033}
- {x: 6.131013, y: -2.2751884, z: 0.15000033}
- {x: 5.1310124, y: -1.1074985, z: 0.15000033}
- {x: 5.131012, y: -0.12052196, z: 0.15000033}
- {x: 5.131014, y: -3.275189, z: 0.15000033}
- {x: 5.131013, y: -2.275189, z: 0.15000033}
- {x: 24.600883, y: -1.9715374, z: 0.14999938}
- {x: 22.743874, y: -0.12051362, z: 0.14999938}
- {x: 25.30845, y: -3.275179, z: 0.14999938}
- {x: 25.308449, y: -2.690195, z: 0.14999938}
- {x: 8.131014, y: -5.107497, z: 0.15000033}
- {x: 8.131014, y: -4.1205206, z: 0.15000033}
- {x: 8.131016, y: -7.2751875, z: 0.15000033}
- {x: 8.131014, y: -6.2751875, z: 0.15000033}
- {x: 8.131012, y: -1.1074971, z: 0.15000033}
- {x: 8.131012, y: -0.12052053, z: 0.15000033}
- {x: 8.131014, y: -3.2751875, z: 0.15000033}
- {x: 8.131012, y: -2.2751875, z: 0.15000033}
- {x: 15.131014, y: -5.107494, z: 0.14999938}
- {x: 15.131014, y: -4.1205173, z: 0.14999938}
- {x: 14.818375, y: -16.847351, z: 0.14999938}
- {x: 15.131014, y: -6.275184, z: 0.14999938}
- {x: 15.131012, y: -1.1074938, z: 0.14999938}
- {x: 15.131012, y: -0.120517194, z: 0.14999938}
- {x: 15.131014, y: -3.2751842, z: 0.14999938}
- {x: 15.131012, y: -2.2751842, z: 0.14999938}
- {x: 16.131014, y: -5.1074934, z: 0.14999938}
- {x: 16.131014, y: -4.120517, z: 0.14999938}
- {x: 16.566254, y: -17.009647, z: 0.14999938}
- {x: 16.131014, y: -6.2751837, z: 0.14999938}
- {x: 16.131012, y: -1.1074933, z: 0.14999938}
- {x: 16.131012, y: -0.12051672, z: 0.14999938}
- {x: 16.131014, y: -3.2751837, z: 0.14999938}
- {x: 16.131012, y: -2.2751837, z: 0.14999938}
- {x: 11.131014, y: -5.107496, z: 0.15000033}
- {x: 11.131014, y: -4.120519, z: 0.30000085}
- {x: 11.131016, y: -7.275186, z: 0.15000033}
- {x: 11.131014, y: -6.275186, z: 0.15000033}
- {x: 11.131012, y: -1.1074957, z: 0.15000033}
- {x: 11.131012, y: -0.1205191, z: 0.15000033}
- {x: 11.131014, y: -3.275186, z: 0.30000085}
- {x: 11.131012, y: -2.275186, z: 0.15000033}
- {x: 9.131014, y: -5.1074967, z: 0.15000033}
- {x: 9.131014, y: -4.12052, z: 0.15000033}
- {x: 9.131016, y: -7.275187, z: 0.15000033}
- {x: 9.131014, y: -6.275187, z: 0.15000033}
- {x: 9.131012, y: -1.1074966, z: 0.15000033}
- {x: 9.131012, y: -0.120520055, z: 0.15000033}
- {x: 9.131014, y: -3.275187, z: 0.15000033}
- {x: 9.131012, y: -2.275187, z: 0.15000033}
- {x: 10.131014, y: -5.1074963, z: 0.15000033}
- {x: 10.131014, y: -4.1205196, z: 0.15000033}
- {x: 10.131016, y: -7.2751865, z: 0.15000033}
- {x: 10.131014, y: -6.2751865, z: 0.15000033}
- {x: 10.131012, y: -1.1074961, z: 0.15000033}
- {x: 10.131012, y: -0.12051958, z: 0.15000033}
- {x: 10.131014, y: -3.2751865, z: 0.15000033}
- {x: 10.131012, y: -2.2751865, z: 0.15000033}
- {x: 14.131014, y: -5.1074944, z: 0.15000033}
- {x: 14.131014, y: -4.1205177, z: 0.15000033}
- {x: 14.13102, y: -16.723938, z: 0.15000033}
- {x: 14.131014, y: -6.2751846, z: 0.15000033}
- {x: 14.131012, y: -1.1074942, z: 0.15000033}
- {x: 14.131012, y: -0.12051767, z: 0.15000033}
- {x: 14.131014, y: -3.2751846, z: 0.15000033}
- {x: 14.131012, y: -2.2751846, z: 0.15000033}
- {x: 12.131014, y: -5.1074953, z: 0.15000033}
- {x: 12.131014, y: -4.1205187, z: 0.30000085}
- {x: 12.131014, y: -6.2751856, z: 0.15000033}
- {x: 12.131012, y: -1.1074952, z: 0.15000033}
- {x: 12.131012, y: -0.120518625, z: 0.15000033}
- {x: 12.131014, y: -3.2751856, z: 0.30000085}
- {x: 12.131012, y: -2.2751856, z: 0.15000033}
- {x: 13.131014, y: -5.107495, z: 0.15000033}
- {x: 13.131014, y: -4.120518, z: 0.15000033}
- {x: 13.131014, y: -6.275185, z: 0.15000033}
- {x: 13.131012, y: -1.1074947, z: 0.15000033}
- {x: 13.131012, y: -0.12051815, z: 0.15000033}
- {x: 13.131014, y: -3.275185, z: 0.15000033}
- {x: 13.131012, y: -2.275185, z: 0.15000033}
- {x: 17.131014, y: -5.107493, z: 0.14999938}
- {x: 17.131014, y: -4.1205163, z: 0.14999938}
- {x: 17.13102, y: -17.275185, z: 0.14999938}
- {x: 17.131014, y: -6.275183, z: 0.14999938}
- {x: 17.131012, y: -1.1074928, z: 0.14999938}
- {x: 17.131012, y: -0.12051624, z: 0.14999938}
- {x: 17.131014, y: -3.2751832, z: 0.14999938}
- {x: 17.131012, y: -2.2751832, z: 0.14999938}
- {x: 25.315262, y: -16.263264, z: 0.14999938}
- {x: 24.600883, y: -1.9715374, z: 0.14999938}
- {x: 22.743874, y: -0.12051362, z: 0.14999938}
- {x: 25.30845, y: -3.275179, z: 0.14999938}
- {x: 25.308449, y: -2.690195, z: 0.14999938}
- {x: 25.315262, y: -16.263264, z: 0.14999938}
- {x: 18.328857, y: -1.1074923, z: 0.14999938}
- {x: 18.328857, y: -0.120515764, z: 0.14999938}
- {x: 18.32886, y: -3.2751827, z: 0.14999938}
- {x: 18.328857, y: -2.2751827, z: 0.14999938}
- {x: 18.335665, y: -3.7599275, z: 0.14999938}
- {x: 18.328857, y: -1.1074923, z: 0.14999938}
- {x: 18.328857, y: -0.120515764, z: 0.14999938}
- {x: 18.32886, y: -3.2751827, z: 0.14999938}
- {x: 18.328857, y: -2.2751827, z: 0.14999938}
- {x: 18.335665, y: -3.7599275, z: 0.14999938}
- {x: 19.328857, y: -1.1074919, z: 0.14999938}
- {x: 19.328857, y: -0.12051529, z: 0.14999938}
- {x: 19.32886, y: -3.2751822, z: 0.14999938}
- {x: 19.328857, y: -2.2751822, z: 0.14999938}
- {x: 19.335665, y: -3.6442654, z: 0.14999938}
- {x: 19.328857, y: -1.1074919, z: 0.14999938}
- {x: 19.328857, y: -0.12051529, z: 0.14999938}
- {x: 19.32886, y: -3.2751822, z: 0.14999938}
- {x: 19.328857, y: -2.2751822, z: 0.14999938}
- {x: 19.335665, y: -3.6442654, z: 0.14999938}
- {x: 20.328857, y: -1.1074914, z: 0.14999938}
- {x: 20.328857, y: -0.12051481, z: 0.14999938}
- {x: 20.32886, y: -3.2751818, z: 0.14999938}
- {x: 20.328857, y: -2.2751818, z: 0.14999938}
- {x: 20.335665, y: -3.644265, z: 0.14999938}
- {x: 20.328857, y: -1.1074914, z: 0.14999938}
- {x: 20.328857, y: -0.12051481, z: 0.14999938}
- {x: 20.32886, y: -3.2751818, z: 0.14999938}
- {x: 20.328857, y: -2.2751818, z: 0.14999938}
- {x: 20.335665, y: -3.644265, z: 0.14999938}
- {x: 21.328857, y: -1.1074909, z: 0.14999938}
- {x: 21.328857, y: -0.12051433, z: 0.14999938}
- {x: 21.32886, y: -3.2751813, z: 0.14999938}
- {x: 21.328857, y: -2.2751813, z: 0.14999938}
- {x: 21.335665, y: -3.930012, z: 0.14999938}
- {x: 21.328857, y: -1.1074909, z: 0.14999938}
- {x: 21.328857, y: -0.12051433, z: 0.14999938}
- {x: 21.32886, y: -3.2751813, z: 0.14999938}
- {x: 21.328857, y: -2.2751813, z: 0.14999938}
- {x: 21.335665, y: -3.930012, z: 0.14999938}
- {x: 22.328857, y: -1.1074904, z: 0.14999938}
- {x: 22.328857, y: -0.12051386, z: 0.14999938}
- {x: 22.32886, y: -3.2751808, z: 0.14999938}
- {x: 22.328857, y: -2.2751808, z: 0.14999938}
- {x: 21.77098, y: -17.263264, z: 0.14999938}
- {x: 22.328857, y: -1.1074904, z: 0.14999938}
- {x: 22.328857, y: -0.12051386, z: 0.14999938}
- {x: 22.32886, y: -3.2751808, z: 0.14999938}
- {x: 22.328857, y: -2.2751808, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 23.124748, y: -1.3388095, z: 0.14999938}
- {x: 23.30845, y: -3.2751799, z: 0.14999938}
- {x: 24.063643, y: -1.4247386, z: 0.14999938}
- {x: 23.315262, y: -17.263264, z: 0.14999938}
- {x: 23.124748, y: -1.3388095, z: 0.14999938}
- {x: 23.30845, y: -3.2751799, z: 0.14999938}
- {x: 24.063643, y: -1.4247386, z: 0.14999938}
- {x: 23.315262, y: -17.263264, z: 0.14999938}
- {x: 23.308334, y: -0.6448511, z: 0.14999938}
- {x: 24.30845, y: -3.2751794, z: 0.14999938}
- {x: 24.158775, y: -2.424857, z: 0.14999938}
- {x: 25.315262, y: -16.660831, z: 0.14999938}
- {x: 23.308334, y: -0.6448511, z: 0.14999938}
- {x: 24.30845, y: -3.2751794, z: 0.14999938}
- {x: 24.158775, y: -2.424857, z: 0.14999938}
- {x: 25.315262, y: -16.660831, z: 0.14999938}
- {x: 23.308449, y: -2.2751799, z: 0.14999938}
- {x: 23.308449, y: -2.2751799, z: 0.14999938}
- {x: 23.703054, y: -1.8805722, z: 0.14999938}
- {x: 23.703054, y: -1.8805722, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 25.315256, y: -4.263262, z: 0.14999938}
- {x: 25.315256, y: -4.263262, z: 0.14999938}
- {x: 21.668917, y: -4.2632637, z: 0.14999938}
- {x: 22.335665, y: -4.2632637, z: 0.14999938}
- {x: 23.315256, y: -4.2632627, z: 0.14999938}
- {x: 23.315256, y: -4.2632627, z: 0.14999938}
- {x: 24.315256, y: -4.2632623, z: 0.14999938}
- {x: 24.315256, y: -4.2632623, z: 0.14999938}
- {x: 22.335665, y: -4.2632637, z: 0.14999938}
- {x: 22.335665, y: -4.2632637, z: 0.14999938}
- {x: 25.315256, y: -5.263262, z: 0.14999938}
- {x: 25.315256, y: -5.263262, z: 0.14999938}
- {x: 21.770975, y: -5.2632637, z: 0.14999938}
- {x: 22.335665, y: -5.2632637, z: 0.14999938}
- {x: 23.315256, y: -5.2632627, z: 0.14999938}
- {x: 23.315256, y: -5.2632627, z: 0.14999938}
- {x: 24.315256, y: -5.2632623, z: 0.14999938}
- {x: 24.315256, y: -5.2632623, z: 0.14999938}
- {x: 22.335665, y: -5.2632637, z: 0.14999938}
- {x: 22.335665, y: -5.2632637, z: 0.14999938}
- {x: 25.315258, y: -6.263262, z: 0.14999938}
- {x: 25.315258, y: -6.263262, z: 0.14999938}
- {x: 21.770977, y: -6.2632637, z: 0.14999938}
- {x: 22.335667, y: -6.2632637, z: 0.14999938}
- {x: 23.315258, y: -6.2632627, z: 0.14999938}
- {x: 23.315258, y: -6.2632627, z: 0.14999938}
- {x: 24.315258, y: -6.2632623, z: 0.14999938}
- {x: 24.315258, y: -6.2632623, z: 0.14999938}
- {x: 22.335667, y: -6.2632637, z: 0.14999938}
- {x: 22.335667, y: -6.2632637, z: 0.14999938}
- {x: 17.64851, y: -7.2751827, z: 0.14999938}
- {x: 15.131016, y: -7.275184, z: 0.14999938}
- {x: 16.131016, y: -7.2751837, z: 0.14999938}
- {x: 14.131016, y: -7.2751846, z: 0.15000033}
- {x: 12.131016, y: -7.2751856, z: 0.15000033}
- {x: 13.131016, y: -7.275185, z: 0.15000033}
- {x: 17.131016, y: -7.275183, z: 0.14999938}
- {x: 25.315258, y: -7.263262, z: 0.14999938}
- {x: 25.315258, y: -7.263262, z: 0.14999938}
- {x: 21.770977, y: -7.2632637, z: 0.14999938}
- {x: 22.335667, y: -7.2632637, z: 0.14999938}
- {x: 23.315258, y: -7.2632627, z: 0.14999938}
- {x: 23.315258, y: -7.2632627, z: 0.14999938}
- {x: 24.315258, y: -7.2632623, z: 0.14999938}
- {x: 24.315258, y: -7.2632623, z: 0.14999938}
- {x: 22.335667, y: -7.2632637, z: 0.14999938}
- {x: 22.335667, y: -7.2632637, z: 0.14999938}
- {x: 17.64851, y: -8.275183, z: 0.14999938}
- {x: 15.131016, y: -8.275184, z: 0.14999938}
- {x: 16.131016, y: -8.275184, z: 0.14999938}
- {x: 14.131016, y: -8.275185, z: 0.15000033}
- {x: 12.131016, y: -8.275186, z: 0.15000033}
- {x: 13.131016, y: -8.275186, z: 0.15000033}
- {x: 17.131016, y: -8.275184, z: 0.14999938}
- {x: 25.315258, y: -8.263262, z: 0.14999938}
- {x: 25.315258, y: -8.263262, z: 0.14999938}
- {x: 21.770977, y: -8.263264, z: 0.14999938}
- {x: 22.335667, y: -8.263264, z: 0.14999938}
- {x: 23.315258, y: -8.263263, z: 0.14999938}
- {x: 23.315258, y: -8.263263, z: 0.14999938}
- {x: 24.315258, y: -8.263263, z: 0.14999938}
- {x: 24.315258, y: -8.263263, z: 0.14999938}
- {x: 22.335667, y: -8.263264, z: 0.14999938}
- {x: 22.335667, y: -8.263264, z: 0.14999938}
- {x: 17.64851, y: -9.275183, z: 0.14999938}
- {x: 15.131016, y: -9.275184, z: 0.14999938}
- {x: 16.131016, y: -9.275184, z: 0.14999938}
- {x: 14.131016, y: -9.275185, z: 0.15000033}
- {x: 13.131016, y: -9.275186, z: 0.15000033}
- {x: 17.131016, y: -9.275184, z: 0.14999938}
- {x: 25.315258, y: -9.263262, z: 0.14999938}
- {x: 25.315258, y: -9.263262, z: 0.14999938}
- {x: 21.770977, y: -9.263264, z: 0.14999938}
- {x: 22.335667, y: -9.263264, z: 0.14999938}
- {x: 23.315258, y: -9.263263, z: 0.14999938}
- {x: 23.315258, y: -9.263263, z: 0.14999938}
- {x: 24.315258, y: -9.263263, z: 0.14999938}
- {x: 24.315258, y: -9.263263, z: 0.14999938}
- {x: 22.335667, y: -9.263264, z: 0.14999938}
- {x: 22.335667, y: -9.263264, z: 0.14999938}
- {x: 17.64851, y: -10.275183, z: 0.14999938}
- {x: 15.131016, y: -10.275184, z: 0.14999938}
- {x: 16.131016, y: -10.275184, z: 0.14999938}
- {x: 14.131016, y: -10.275185, z: 0.15000033}
- {x: 17.131016, y: -10.275184, z: 0.14999938}
- {x: 25.315258, y: -10.263262, z: 0.14999938}
- {x: 25.315258, y: -10.263262, z: 0.14999938}
- {x: 21.770977, y: -10.263264, z: 0.14999938}
- {x: 22.335667, y: -10.263264, z: 0.14999938}
- {x: 23.315258, y: -10.263263, z: 0.14999938}
- {x: 23.315258, y: -10.263263, z: 0.14999938}
- {x: 24.315258, y: -10.263263, z: 0.14999938}
- {x: 24.315258, y: -10.263263, z: 0.14999938}
- {x: 22.335667, y: -10.263264, z: 0.14999938}
- {x: 22.335667, y: -10.263264, z: 0.14999938}
- {x: 17.648512, y: -11.275183, z: 0.14999938}
- {x: 15.131018, y: -11.275184, z: 0.14999938}
- {x: 16.131018, y: -11.275184, z: 0.14999938}
- {x: 14.131018, y: -11.275185, z: 0.15000033}
- {x: 17.131018, y: -11.275184, z: 0.14999938}
- {x: 25.31526, y: -11.263262, z: 0.14999938}
- {x: 25.31526, y: -11.263262, z: 0.14999938}
- {x: 21.770979, y: -11.263264, z: 0.14999938}
- {x: 22.335669, y: -11.263264, z: 0.14999938}
- {x: 23.31526, y: -11.263263, z: 0.14999938}
- {x: 23.31526, y: -11.263263, z: 0.14999938}
- {x: 24.31526, y: -11.263263, z: 0.14999938}
- {x: 24.31526, y: -11.263263, z: 0.14999938}
- {x: 22.335669, y: -11.263264, z: 0.14999938}
- {x: 22.335669, y: -11.263264, z: 0.14999938}
- {x: 17.648512, y: -12.275183, z: 0.14999938}
- {x: 15.131018, y: -12.275184, z: 0.14999938}
- {x: 16.131018, y: -12.275184, z: 0.14999938}
- {x: 14.131018, y: -12.275185, z: 0.15000033}
- {x: 17.131018, y: -12.275184, z: 0.14999938}
- {x: 25.31526, y: -12.263262, z: 0.14999938}
- {x: 25.31526, y: -12.263262, z: 0.14999938}
- {x: 21.770979, y: -12.263264, z: 0.14999938}
- {x: 22.335669, y: -12.263264, z: 0.14999938}
- {x: 23.31526, y: -12.263263, z: 0.14999938}
- {x: 23.31526, y: -12.263263, z: 0.14999938}
- {x: 24.31526, y: -12.263263, z: 0.14999938}
- {x: 24.31526, y: -12.263263, z: 0.14999938}
- {x: 22.335669, y: -12.263264, z: 0.14999938}
- {x: 22.335669, y: -12.263264, z: 0.14999938}
- {x: 17.648514, y: -13.275183, z: 0.14999938}
- {x: 15.13102, y: -13.275184, z: 0.14999938}
- {x: 16.13102, y: -13.275184, z: 0.14999938}
- {x: 13.728035, y: -13.740389, z: 0.15000033}
- {x: 17.13102, y: -13.275184, z: 0.14999938}
- {x: 25.315262, y: -13.263262, z: 0.14999938}
- {x: 25.315262, y: -13.263262, z: 0.14999938}
- {x: 21.77098, y: -13.263264, z: 0.14999938}
- {x: 22.33567, y: -13.263264, z: 0.14999938}
- {x: 23.315262, y: -13.263263, z: 0.14999938}
- {x: 23.315262, y: -13.263263, z: 0.14999938}
- {x: 24.315262, y: -13.263263, z: 0.14999938}
- {x: 24.315262, y: -13.263263, z: 0.14999938}
- {x: 22.33567, y: -13.263264, z: 0.14999938}
- {x: 22.33567, y: -13.263264, z: 0.14999938}
- {x: 17.648514, y: -14.275183, z: 0.14999938}
- {x: 15.13102, y: -14.275184, z: 0.14999938}
- {x: 16.13102, y: -14.275184, z: 0.14999938}
- {x: 12.766609, y: -14.523295, z: 0.15000033}
- {x: 17.13102, y: -14.275184, z: 0.14999938}
- {x: 25.315262, y: -14.263262, z: 0.14999938}
- {x: 25.315262, y: -14.263262, z: 0.14999938}
- {x: 21.77098, y: -14.263264, z: 0.14999938}
- {x: 22.33567, y: -14.263264, z: 0.14999938}
- {x: 23.315262, y: -14.263263, z: 0.14999938}
- {x: 23.315262, y: -14.263263, z: 0.14999938}
- {x: 24.315262, y: -14.263263, z: 0.14999938}
- {x: 24.315262, y: -14.263263, z: 0.14999938}
- {x: 22.33567, y: -14.263264, z: 0.14999938}
- {x: 22.33567, y: -14.263264, z: 0.14999938}
- {x: 17.862434, y: -15.275183, z: 0.14999938}
- {x: 15.13102, y: -15.275184, z: 0.14999938}
- {x: 16.13102, y: -15.275184, z: 0.14999938}
- {x: 14.13102, y: -15.275185, z: 0.15000033}
- {x: 17.13102, y: -15.275184, z: 0.14999938}
- {x: 25.315262, y: -15.263262, z: 0.14999938}
- {x: 25.315262, y: -15.263262, z: 0.14999938}
- {x: 21.55706, y: -15.263264, z: 0.14999938}
- {x: 22.33567, y: -15.263264, z: 0.14999938}
- {x: 23.315262, y: -15.263263, z: 0.14999938}
- {x: 23.315262, y: -15.263263, z: 0.14999938}
- {x: 24.315262, y: -15.263263, z: 0.14999938}
- {x: 24.315262, y: -15.263263, z: 0.14999938}
- {x: 22.33567, y: -15.263264, z: 0.14999938}
- {x: 22.33567, y: -15.263264, z: 0.14999938}
- {x: 20.648514, y: -17.27518, z: 0.14999938}
- {x: 14.818375, y: -16.847351, z: 0.14999938}
- {x: 16.566254, y: -17.009647, z: 0.14999938}
- {x: 14.13102, y: -16.723938, z: 0.15000033}
- {x: 17.13102, y: -17.275185, z: 0.14999938}
- {x: 25.315262, y: -16.263264, z: 0.14999938}
- {x: 25.315262, y: -16.263264, z: 0.14999938}
- {x: 21.77098, y: -17.263264, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 23.315262, y: -17.263264, z: 0.14999938}
- {x: 23.315262, y: -17.263264, z: 0.14999938}
- {x: 25.315262, y: -16.660831, z: 0.14999938}
- {x: 25.315262, y: -16.660831, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 22.33567, y: -17.263264, z: 0.14999938}
- {x: 20.648514, y: -15.822665, z: 0.14999938}
- {x: 15.13102, y: -16.275185, z: 0.14999938}
- {x: 16.13102, y: -16.275185, z: 0.14999938}
- {x: 14.13102, y: -16.275185, z: 0.15000033}
- {x: 17.13102, y: -16.275185, z: 0.14999938}
- {x: 21.77098, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 23.315262, y: -16.263264, z: 0.14999938}
- {x: 23.315262, y: -16.263264, z: 0.14999938}
- {x: 24.315262, y: -16.263264, z: 0.14999938}
- {x: 24.315262, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 20.648514, y: -15.822665, z: 0.14999938}
- {x: 15.13102, y: -16.275185, z: 0.14999938}
- {x: 16.13102, y: -16.275185, z: 0.14999938}
- {x: 14.13102, y: -16.275185, z: 0.15000033}
- {x: 17.13102, y: -16.275185, z: 0.14999938}
- {x: 21.77098, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 23.315262, y: -16.263264, z: 0.14999938}
- {x: 23.315262, y: -16.263264, z: 0.14999938}
- {x: 24.315262, y: -16.263264, z: 0.14999938}
- {x: 24.315262, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 22.33567, y: -16.263264, z: 0.14999938}
- {x: 20.582697, y: -20.645424, z: 0.14999938}
- {x: 15.719645, y: -18.320782, z: 0.14999938}
- {x: 17.131021, y: -19.275185, z: 0.14999938}
- {x: 21.770983, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 22.714655, y: -19.263264, z: 0.14999938}
- {x: 22.714655, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 20.582697, y: -20.645424, z: 0.14999938}
- {x: 15.719645, y: -18.320782, z: 0.14999938}
- {x: 17.131021, y: -19.275185, z: 0.14999938}
- {x: 21.770983, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 22.714655, y: -19.263264, z: 0.14999938}
- {x: 22.714655, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 22.335672, y: -19.263264, z: 0.14999938}
- {x: 24.537407, y: -17.485409, z: 0.14999938}
- {x: 24.537407, y: -17.485409, z: 0.14999938}
- {x: 24.537407, y: -17.485409, z: 0.14999938}
- {x: 24.537407, y: -17.485409, z: 0.14999938}
- {x: 21.770983, y: -18.263264, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 23.315264, y: -18.263264, z: 0.14999938}
- {x: 23.315264, y: -18.263264, z: 0.14999938}
- {x: 23.764017, y: -18.255035, z: 0.14999938}
- {x: 23.764017, y: -18.255035, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 21.770983, y: -18.263264, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 23.315264, y: -18.263264, z: 0.14999938}
- {x: 23.315264, y: -18.263264, z: 0.14999938}
- {x: 23.764017, y: -18.255035, z: 0.14999938}
- {x: 23.764017, y: -18.255035, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 22.335672, y: -18.263264, z: 0.14999938}
- {x: 20.648516, y: -18.27518, z: 0.14999938}
- {x: 14.982925, y: -17.567612, z: 0.14999938}
- {x: 16.56708, y: -19.171993, z: 0.14999938}
- {x: 17.131021, y: -18.275185, z: 0.14999938}
- {x: 20.648516, y: -18.27518, z: 0.14999938}
- {x: 14.982925, y: -17.567612, z: 0.14999938}
- {x: 16.56708, y: -19.171993, z: 0.14999938}
- {x: 17.131021, y: -18.275185, z: 0.14999938}
- {x: 17.648514, y: -17.275185, z: 0.14999938}
- {x: 17.648514, y: -17.275185, z: 0.14999938}
- {x: 17.648514, y: -16.275185, z: 0.14999938}
- {x: 17.648514, y: -16.275185, z: 0.14999938}
- {x: 17.648516, y: -19.275185, z: 0.14999938}
- {x: 17.648516, y: -19.275185, z: 0.14999938}
- {x: 17.648516, y: -18.275185, z: 0.14999938}
- {x: 17.648516, y: -18.275185, z: 0.14999938}
- {x: 18.648514, y: -17.27518, z: 0.14999938}
- {x: 18.648514, y: -17.27518, z: 0.14999938}
- {x: 18.648514, y: -15.822665, z: 0.14999938}
- {x: 18.648514, y: -15.822665, z: 0.14999938}
- {x: 18.878893, y: -20.645424, z: 0.14999938}
- {x: 18.878893, y: -20.645424, z: 0.14999938}
- {x: 18.648516, y: -18.27518, z: 0.14999938}
- {x: 18.648516, y: -18.27518, z: 0.14999938}
- {x: 19.648514, y: -17.27518, z: 0.14999938}
- {x: 19.648514, y: -17.27518, z: 0.14999938}
- {x: 19.648514, y: -15.822665, z: 0.14999938}
- {x: 19.648514, y: -15.822665, z: 0.14999938}
- {x: 19.648516, y: -20.645424, z: 0.14999938}
- {x: 19.648516, y: -20.645424, z: 0.14999938}
- {x: 19.648516, y: -18.27518, z: 0.14999938}
- {x: 19.648516, y: -18.27518, z: 0.14999938}
- {x: 20.648514, y: -16.27518, z: 0.14999938}
- {x: 20.648514, y: -16.27518, z: 0.14999938}
- {x: 18.648514, y: -16.27518, z: 0.14999938}
- {x: 18.648514, y: -16.27518, z: 0.14999938}
- {x: 19.648514, y: -16.27518, z: 0.14999938}
- {x: 19.648514, y: -16.27518, z: 0.14999938}
- {x: 20.648516, y: -19.27518, z: 0.14999938}
- {x: 20.648516, y: -19.27518, z: 0.14999938}
- {x: 18.648516, y: -19.27518, z: 0.14999938}
- {x: 18.648516, y: -19.27518, z: 0.14999938}
- {x: 19.648516, y: -19.27518, z: 0.14999938}
- {x: 19.648516, y: -19.27518, z: 0.14999938}
- {x: 20.582697, y: -19.97076, z: 0.14999938}
- {x: 20.582697, y: -19.97076, z: 0.14999938}
- {x: 18.878893, y: -19.97076, z: 0.14999938}
- {x: 18.878893, y: -19.97076, z: 0.14999938}
- {x: 19.648516, y: -19.97076, z: 0.14999938}
- {x: 19.648516, y: -19.97076, z: 0.14999938}
- {x: 15.868065, y: -17.365856, z: 0.14999938}
- {x: 15.868065, y: -17.365856, z: 0.14999938}
- {x: 16.566256, y: -18.009647, z: 0.14999938}
- {x: 16.566256, y: -18.009647, z: 0.14999938}
- {x: 13.728035, y: -13.740389, z: 0.15000033}
- {x: 12.766609, y: -14.523295, z: 0.15000033}
- {x: 14.13102, y: -13.275185, z: 0.15000033}
- {x: 13.735596, y: -14.531048, z: 0.15000033}
- {x: 14.13102, y: -13.275185, z: 0.15000033}
- {x: 13.735596, y: -14.531048, z: 0.15000033}
- {x: 14.13102, y: -14.275185, z: 0.15000033}
- {x: 14.13102, y: -14.275185, z: 0.15000033}
- {x: 12.774368, y: -13.732636, z: 0.15000033}
- {x: 12.774368, y: -13.732636, z: 0.15000033}
- {x: 13.728034, y: -12.872005, z: 0.15000033}
- {x: 13.728034, y: -12.872005, z: 0.15000033}
- {x: 12.774367, y: -12.864253, z: 0.15000033}
- {x: 12.774367, y: -12.864253, z: 0.15000033}
m_Dering: 0
--- !u!1001 &5620287371074071606
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalPosition.x
value: 36.699978
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalPosition.y
value: 6.3600082
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalPosition.z
value: -97.6
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalRotation.x
value: -0.49999988
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalRotation.y
value: -0.5000001
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalRotation.z
value: -0.5000001
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalRotation.w
value: 0.49999988
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: -90
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Name
value: Building_B_Staircase_C_Floor_A
objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 123
objectReference: {fileID: 0}
- target: {fileID: 20500000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_FadeMode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 20500000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_AnimateCrossFading
value: 1
objectReference: {fileID: 0}
- target: {fileID: 20500000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LODs.Array.data[0].screenRelativeHeight
value: 0.50312495
objectReference: {fileID: 0}
- target: {fileID: 20500000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LODs.Array.data[1].screenRelativeHeight
value: 0.249
objectReference: {fileID: 0}
- target: {fileID: 20500000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_LODs.Array.data[2].screenRelativeHeight
value: 0.14917329
objectReference: {fileID: 0}
- target: {fileID: 100006, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 123
objectReference: {fileID: 0}
- target: {fileID: 100004, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 123
objectReference: {fileID: 0}
- target: {fileID: 2300002, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_RenderingLayerMask
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 2300002, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 675dc3e62bb1f5d40939bf83fc85505a, type: 2}
- target: {fileID: 2300002, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 7ca0fb40d956bd249a929d683d4004bc, type: 2}
- target: {fileID: 100008, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 122
objectReference: {fileID: 0}
- target: {fileID: 2300004, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_RenderingLayerMask
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 2300004, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: e3bb3597f997d1e498aaadbb7ec9b2ab, type: 2}
- target: {fileID: 2300004, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 7ca0fb40d956bd249a929d683d4004bc, type: 2}
- target: {fileID: 100010, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 122
objectReference: {fileID: 0}
- target: {fileID: 2300006, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_RenderingLayerMask
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 2300006, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 65eddcafd382cb34db23777468fce556, type: 2}
- target: {fileID: 2300006, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[1]
value:
objectReference: {fileID: 2100000, guid: 7ca0fb40d956bd249a929d683d4004bc, type: 2}
- target: {fileID: 100012, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_StaticEditorFlags
value: 122
objectReference: {fileID: 0}
- target: {fileID: 2300008, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_RenderingLayerMask
value: 4294967295
objectReference: {fileID: 0}
- target: {fileID: 2300008, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: ad8fba3b88230524ba66ca522de11eef, type: 2}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 57d5b0f56891c144fbf0eecc8984311e, type: 3}
| {
"pile_set_name": "Github"
} |
---
# defaults file for master | {
"pile_set_name": "Github"
} |
p edge 20 25
e 1 5
e 2 13
e 2 14
e 3 5
e 3 16
e 6 13
e 6 0
e 7 14
e 7 12
e 7 16
e 8 12
e 8 16
e 9 11
e 9 14
e 10 4
e 10 16
e 11 1
e 14 12
e 15 17
e 15 0
e 17 12
e 18 7
e 18 0
e 19 4
e 19 0
| {
"pile_set_name": "Github"
} |
// Copyright 2008 The Android Open Source Project
public interface Defs {
public void func();
// func2 not defined
}
| {
"pile_set_name": "Github"
} |
from collections import defaultdict, deque
import re
import regex
from telethon import events, utils
from telethon.tl import types, functions
HEADER = "「sed」\n"
KNOWN_RE_BOTS = re.compile(
r"(regex|moku|BananaButler_|rgx|l4mR)bot",
flags=re.IGNORECASE
)
# Heavily based on
# https://github.com/SijmenSchoon/regexbot/blob/master/regexbot.py
last_msgs = defaultdict(lambda: deque(maxlen=10))
def doit(chat_id, match, original):
fr = match.group(1)
to = match.group(2)
to = to.replace('\\/', '/')
try:
fl = match.group(3)
if fl is None:
fl = ''
fl = fl[1:]
except IndexError:
fl = ''
# Build Python regex flags
count = 1
flags = 0
for f in fl:
if f == 'i':
flags |= regex.IGNORECASE
elif f == 'g':
count = 0
else:
return None, f"Unknown flag: {f}"
def actually_doit(original):
try:
s = original.message
if s.startswith(HEADER):
s = s[len(HEADER):]
s, i = regex.subn(fr, to, s, count=count, flags=flags)
if i > 0:
return original, s
except Exception as e:
return None, f"u dun goofed m8: {str(e)}"
return None, None
if original is not None:
return actually_doit(original)
# Try matching the last few messages
for original in last_msgs[chat_id]:
m, s = actually_doit(original)
if s is not None:
return m, s
return None, None
async def group_has_sedbot(group):
if isinstance(group, types.InputPeerChannel):
full = await bot(functions.channels.GetFullChannelRequest(group))
elif isinstance(group, types.InputPeerChat):
full = await bot(functions.messages.GetFullChatRequest(group.chat_id))
else:
return False
return any(KNOWN_RE_BOTS.match(x.username or '') for x in full.users)
@command()
async def on_message(event):
last_msgs[event.chat_id].appendleft(event.message)
@command(allow_edited_updates=True)
async def on_edit(event):
for m in last_msgs[event.chat_id]:
if m.id == event.id:
m.raw_text = event.raw_text
break
@command(
pattern=re.compile(r"^s/((?:\\/|[^/])+)/((?:\\/|[^/])*)(/.*)?"), outgoing=True)
async def on_regex(event):
if event.fwd_from:
return
if not event.is_private and\
await group_has_sedbot(await event.get_input_chat()):
# await event.edit("This group has a sed bot. Ignoring this message!")
return
chat_id = utils.get_peer_id(await event.get_input_chat())
m, s = doit(chat_id, event.pattern_match, await event.get_reply_message())
if m is not None:
s = f"{HEADER}{s}"
out = await bot.send_message(
await event.get_input_chat(), s, reply_to=m.id
)
last_msgs[chat_id].appendleft(out)
elif s is not None:
await event.edit(s)
raise events.StopPropagation
| {
"pile_set_name": "Github"
} |
package com.atguigu.mobileplayer1020.bean;
/**
* 作者:尚硅谷-杨光福 on 2017/1/13 14:24
* 微信:yangguangfu520
* QQ号:541433511
* 作用:一句歌词
* [00:27.24]听个小姐说 她一月八千真的不多
*/
public class LyricBean {
/**
* 歌词内容
*/
private String content;
/**
* 时间戳
*/
private long timePoint;
/**
* 高亮时间
*/
private long sleepTime;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public long getTimePoint() {
return timePoint;
}
public void setTimePoint(long timePoint) {
this.timePoint = timePoint;
}
public long getSleepTime() {
return sleepTime;
}
public void setSleepTime(long sleepTime) {
this.sleepTime = sleepTime;
}
@Override
public String toString() {
return "LyricBean{" +
"content='" + content + '\'' +
", timePoint=" + timePoint +
", sleepTime=" + sleepTime +
'}';
}
}
| {
"pile_set_name": "Github"
} |
FDCH7-43394
FDCH2-33335
FDCH15-30934
FDCH2-32920
FDCH5-39723
FDCH3-35304
FDCH11-23583
FDCH3-36372
FDCH15-31740
FDCH9-46594
FDCH1-20913
FDCH8-45476
FDCH4-37119
FDCH12-25637
FDCH13-27437
FDCH11-24359
FDCH8-45232
FDCH5-39141
FDCH4-38239
FDCH9-47004
FDCH6-41375
FDCH7-42639
FDCH1-20233
FDCH6-41376
FDCH9-47472
FDCH13-27978
FDCH10-22053
FDCH7-42488
FDCH4-37866
FDCH13-27271
FDCH10-21715
FDCH3-35721
FDCH1-20980
FDCH8-44503
FDCH13-28311
FDCH11-23488
FDCH8-44867
FDCH2-34447
FDCH15-31153
FDCH11-23961
FDCH5-38818
FDCH5-39857
FDCH2-33090
FDCH5-40156
FDCH10-21928
FDCH7-43775
FDCH2-32759
FDCH2-33010
FDCH10-21418
FDCH13-28487
FDCH2-33957
FDCH2-33651
FDCH4-37926
FDCH8-46106
FDCH2-34196
FDCH12-26628
FDCH7-42971
FDCH15-32487
FDCH15-32489
FDCH1-20133
FDCH14-29565
FDCH9-47178
FDCH5-40034
FDCH4-38111
FDCH14-29922
FDCH15-32210
FDCH5-38481
FDCH14-29522
FDCH3-36313
FDCH11-24959
FDCH7-43193
FDCH13-28290
FDCH1-20825
FDCH8-45824
FDCH14-29364
FDCH7-44030
FDCH4-38374
FDCH4-36678
FDCH6-40950
FDCH8-46000
FDCH8-44682
FDCH6-42291
FDCH4-36579
FDCH6-40838
FDCH3-36073
FDCH9-48061
FDCH4-36718
FDCH6-42035
FDCH5-39295
FDCH15-32685
FDCH7-44101
FDCH7-43150
FDCH10-22315
FDCH4-38329
FDCH7-43062
FDCH1-19334
FDCH13-28534
FDCH2-34573
FDCH7-42669
FDCH5-38557
FDCH7-42593
FDCH6-41689
FDCH8-44949
FDCH12-25319
FDCH9-48196
FDCH4-37729
FDCH3-35114
FDCH11-24823
FDCH13-28698
FDCH14-29340
FDCH5-39926
FDCH7-42622
FDCH4-37589
FDCH9-46430
FDCH2-34092
FDCH5-39832
FDCH9-47885
FDCH13-27160
FDCH6-40758
FDCH14-29344
FDCH14-29811
FDCH8-45715
FDCH1-20897
FDCH1-20345
FDCH2-34463
FDCH11-23894
FDCH9-48210
FDCH5-38916
FDCH3-35946
FDCH5-38983
FDCH11-24589
FDCH2-32786
FDCH6-41513
FDCH12-26849
FDCH15-31880
FDCH12-25802
FDCH4-37576
FDCH7-44114
FDCH5-38548
FDCH11-23446
FDCH3-36237
FDCH3-35318
FDCH4-36986
FDCH8-44708
FDCH10-22709
FDCH10-21512
FDCH7-42963
FDCH2-32892
FDCH6-41599
FDCH10-22092
FDCH1-19851
FDCH13-28931
FDCH11-23701
FDCH15-31564
FDCH13-28593
FDCH13-27805
FDCH12-25286
FDCH13-28479
FDCH10-21596
FDCH6-40866
FDCH14-29342
FDCH1-19935
FDCH2-33418
FDCH15-31289
FDCH10-21525
FDCH6-41687
FDCH13-27667
FDCH11-24291
FDCH14-30528
FDCH8-45826
FDCH15-31137
FDCH12-26326
FDCH6-42232
FDCH9-46740
FDCH15-32365
FDCH2-34382
FDCH5-39507
FDCH7-42431
FDCH3-35013
FDCH14-29933
FDCH5-38514
FDCH13-27201
FDCH3-36016
FDCH3-35543
FDCH8-46049
FDCH9-48231
FDCH4-36614
FDCH13-28568
FDCH14-29302
FDCH6-41370
FDCH15-31549
FDCH4-37748
FDCH7-42872
FDCH15-31789
FDCH4-37609
FDCH1-20384
FDCH10-22264
FDCH11-24554
FDCH7-43554
FDCH5-38716
FDCH8-44805
FDCH2-32826
FDCH9-47224
FDCH6-41610
FDCH9-47387
FDCH12-26472
FDCH6-41772
FDCH14-30581
FDCH7-44046
FDCH5-40244
FDCH1-19458
FDCH4-38095
FDCH14-29538
FDCH8-45502
FDCH14-29359
FDCH4-37371
FDCH1-19305
FDCH9-46670
FDCH15-31716
FDCH12-26612
FDCH15-32001
FDCH14-30452
FDCH5-40198
FDCH10-21351
FDCH15-31538
FDCH1-20291
FDCH9-46364
FDCH6-40505
FDCH7-42967
FDCH5-38790
FDCH1-19497
FDCH9-46470
FDCH5-39692
FDCH8-45690
FDCH8-44733
FDCH8-44757
FDCH5-39200
FDCH4-37062
FDCH7-42748
FDCH6-42228
FDCH9-47970
FDCH6-41531
FDCH1-20518
FDCH4-38183
FDCH7-43618
FDCH5-38774
FDCH7-42930
FDCH15-32073
FDCH1-19355
FDCH14-29309
FDCH2-32804
FDCH5-38857
FDCH11-24989
FDCH3-35011
FDCH3-35708
FDCH8-46150
FDCH6-42170
FDCH7-42858
FDCH4-36572
FDCH12-25630
FDCH12-25840
FDCH13-28877
FDCH7-43345
FDCH5-39544
FDCH3-35760
FDCH1-19381
FDCH7-43415
FDCH12-25776
FDCH9-48041
FDCH6-40818
FDCH8-44896
FDCH2-34386
FDCH2-33142
FDCH10-21519
FDCH7-42453
FDCH2-34266
FDCH7-42690
FDCH5-40204
FDCH4-36725
FDCH15-31529
FDCH5-40120
FDCH15-32496
FDCH2-32965
FDCH15-32662
FDCH6-41371
FDCH3-36242
FDCH7-43332
FDCH3-36053
FDCH9-47664
FDCH7-43814
FDCH6-42083
FDCH7-42349
FDCH10-22958
FDCH5-39171
FDCH2-32914
FDCH15-32379
FDCH5-38613
FDCH3-35260
FDCH5-38639
FDCH6-41857
FDCH4-36643
FDCH12-25915
FDCH4-36739
FDCH6-40962
FDCH5-39731
FDCH8-44667
FDCH15-32706
FDCH2-33724
FDCH11-24367
FDCH8-45970
FDCH9-47334
FDCH1-20054
FDCH2-33385
FDCH5-40315
FDCH4-38280
FDCH15-32433
FDCH7-43510
FDCH1-20359
FDCH4-36917
FDCH15-31216
FDCH4-37768
FDCH9-47014
FDCH4-37085
FDCH1-20870
FDCH7-44082
FDCH8-45038
FDCH5-39813
FDCH8-44993
FDCH15-32312
FDCH12-26771
FDCH13-27429
FDCH12-26366
FDCH13-27883
FDCH3-35169
FDCH8-45335
FDCH7-43126
FDCH9-46453
FDCH7-42628
FDCH8-45913
FDCH14-29943
FDCH11-24248
FDCH11-23964
FDCH3-34990
FDCH3-34915
FDCH6-41111
FDCH12-25646
FDCH11-23926
FDCH1-20890
FDCH3-35494
FDCH13-28514
FDCH1-20593
FDCH2-34248
FDCH14-29839
FDCH14-29710
FDCH13-27931
FDCH6-42127
FDCH5-40045
FDCH13-27782
FDCH15-31382
FDCH12-25886
FDCH15-31124
FDCH9-46581
FDCH5-39055
FDCH2-33303
FDCH6-42104
FDCH4-38201
FDCH4-37890
FDCH8-44822
FDCH10-22879
FDCH8-45870
FDCH7-43020
FDCH4-37321
FDCH6-40594
FDCH13-28850
FDCH8-45748
FDCH5-39477
FDCH4-38362
FDCH8-45665
FDCH8-44496
FDCH8-45552
FDCH7-42743
FDCH5-40255
FDCH4-38422
FDCH1-20179
FDCH4-36570
FDCH14-30015
FDCH12-25786
FDCH10-22721
FDCH5-39348
FDCH15-31809
FDCH14-29308
FDCH13-27085
FDCH6-41360
FDCH1-20103
FDCH8-46081
FDCH6-41958
FDCH1-20730
FDCH6-40595
FDCH7-43519
FDCH4-37732
FDCH15-31738
FDCH14-29783
FDCH4-37654
FDCH1-20811
FDCH6-42130
FDCH9-48019
FDCH12-25849
FDCH1-19320
FDCH8-44482
FDCH10-21598
FDCH7-43860
FDCH11-24845
FDCH15-31011
FDCH8-45823
FDCH3-35028
FDCH10-21717
FDCH9-46578
FDCH10-22080
FDCH14-30708
FDCH14-29401
FDCH2-33580
FDCH13-27746
FDCH2-34293
FDCH9-48147
FDCH6-40982
FDCH9-47373
FDCH11-24146
FDCH13-28527
FDCH3-35839
FDCH13-27138
FDCH11-23911
FDCH7-42908
FDCH15-31081
FDCH7-44093
FDCH12-26664
FDCH10-22910
FDCH10-22039
FDCH2-32812
FDCH10-22765
FDCH1-20321
FDCH5-39929
FDCH7-43301
FDCH11-23837
FDCH15-31490
FDCH12-25874
FDCH10-22218
FDCH13-27416
FDCH8-44895
FDCH6-41495
FDCH3-34985
FDCH13-27230
FDCH12-26667
FDCH5-38643
FDCH11-23410
FDCH6-42193
FDCH15-31945
FDCH2-34563
FDCH11-24007
FDCH8-45954
FDCH8-45411
FDCH13-28944
FDCH12-26695
FDCH13-27048
FDCH2-32831
FDCH7-42466
FDCH7-42945
FDCH6-41156
FDCH1-19644
FDCH4-38316
FDCH5-39334
FDCH9-47390
FDCH6-41367
FDCH14-29674
FDCH12-25263
FDCH9-47707
FDCH12-25688
FDCH6-41886
FDCH13-28159
FDCH2-33697
FDCH13-27547
FDCH4-37416
FDCH15-32682
FDCH2-33424
FDCH14-30569
FDCH8-44910
FDCH7-42948
FDCH4-37921
FDCH6-40693
FDCH5-38673
FDCH11-24942
FDCH7-43068
FDCH3-35354
FDCH3-35184
FDCH12-25771
FDCH1-20846
FDCH11-23373
FDCH8-45999
FDCH11-24820
FDCH6-41973
FDCH5-39757
FDCH15-31045
FDCH8-44658
FDCH3-35874
FDCH14-29092
FDCH14-29153
FDCH15-32568
FDCH12-25316
FDCH12-25955
FDCH1-20862
FDCH11-24417
FDCH2-34024
FDCH12-26214
FDCH9-47405
FDCH10-21987
FDCH15-32470
FDCH5-39799
FDCH14-29644
FDCH10-22981
FDCH13-27188
FDCH4-38092
FDCH14-30545
FDCH14-30496
FDCH7-43424
FDCH13-28175
FDCH15-32687
FDCH5-40060
FDCH4-38250
FDCH14-30008
FDCH2-33204
FDCH8-45548
FDCH9-47164
FDCH15-32500
FDCH5-39300
FDCH13-27545
FDCH2-33016
FDCH3-35754
FDCH3-35366
FDCH7-42835
FDCH10-22634
FDCH13-28041
FDCH10-22648
FDCH5-40077
FDCH9-47032
FDCH5-40218
FDCH15-31580
FDCH12-26605
FDCH2-33741
FDCH3-36314
FDCH1-20064
FDCH2-34478
FDCH10-22788
FDCH2-33480
FDCH7-43679
FDCH15-31305
FDCH11-24575
FDCH9-47102
FDCH5-39560
FDCH12-25520
FDCH4-36940
FDCH6-41151
FDCH10-21616
FDCH4-37169
FDCH15-32410
FDCH4-36587
FDCH15-31511
FDCH5-38758
FDCH11-24477
FDCH15-31230
FDCH4-37788
FDCH1-21095
FDCH11-23948
FDCH11-24351
FDCH3-34863
FDCH7-43128
FDCH4-36700
FDCH2-33331
FDCH7-42342
FDCH7-42778
FDCH7-43968
FDCH7-43033
FDCH7-43342
FDCH2-33347
FDCH5-39500
FDCH14-29753
FDCH6-40843
FDCH9-47625
FDCH4-36923
FDCH15-31066
FDCH9-47397
FDCH2-33648
FDCH4-37345
FDCH4-37719
FDCH7-42688
FDCH14-30593
FDCH15-31211
FDCH9-47626
FDCH4-36695
FDCH1-19770
FDCH4-36662
FDCH12-25386
FDCH13-28830
FDCH7-43330
FDCH5-40020
FDCH6-41937
FDCH7-43372
FDCH15-30926
FDCH1-20978
FDCH8-45674
FDCH1-20226
FDCH4-36668
FDCH5-39872
FDCH9-47921
FDCH3-35377
FDCH8-45711
FDCH1-20963
FDCH9-47553
FDCH4-36722
FDCH1-19479
FDCH7-44089
FDCH1-20165
FDCH7-43383
FDCH2-33181
FDCH5-38845
FDCH10-22108
FDCH7-43923
FDCH8-45738
FDCH5-39752
FDCH1-19993
FDCH14-30677
FDCH2-32753
FDCH2-33845
FDCH13-27204
FDCH13-27319
FDCH1-20060
FDCH9-47567
FDCH14-29760
FDCH4-37257
FDCH5-39335
FDCH7-42986
FDCH8-46092
FDCH13-27199
FDCH5-39498
FDCH14-29534
FDCH1-19295
FDCH4-38047
FDCH13-27544
FDCH13-28707
FDCH12-25537
FDCH5-40042
FDCH14-30319
FDCH7-43368
FDCH1-20006
FDCH15-32621
FDCH8-45679
FDCH11-24907
FDCH2-34533
FDCH2-33261
FDCH1-19432
FDCH5-38759
FDCH12-26749
FDCH14-29132
FDCH1-20932
FDCH8-45616
FDCH5-40075
FDCH2-33199
FDCH14-29369
FDCH7-42970
FDCH5-38841
FDCH2-33665
FDCH4-36673
FDCH9-46846
FDCH13-28464
FDCH5-38917
FDCH3-36202
FDCH1-21045
FDCH5-39265
FDCH6-41260
FDCH2-32815
FDCH6-41097
FDCH10-21571
FDCH9-47086
FDCH3-35518
FDCH5-39080
FDCH15-32348
FDCH11-23489
FDCH10-22753
FDCH5-39914
FDCH6-41406
FDCH5-40196
FDCH5-40308
FDCH3-35748
FDCH5-39540
FDCH11-23932
FDCH12-26263
FDCH8-45078
FDCH8-45261
FDCH9-47608
FDCH15-32313
FDCH2-33930
FDCH15-31846
FDCH11-24604
FDCH12-25339
FDCH5-39459
FDCH2-33723
FDCH8-45422
FDCH3-35030
FDCH10-22323
FDCH13-27293
FDCH1-21103
FDCH3-35274
FDCH1-19697
FDCH11-24392
FDCH15-31620
FDCH11-25019
FDCH12-26572
FDCH4-36679
FDCH4-37822
FDCH15-31401
FDCH4-37984
FDCH1-20033
FDCH11-24157
FDCH13-28099
FDCH15-32681
FDCH14-30747
FDCH2-33356
FDCH11-24514
FDCH11-24983
FDCH10-22745
FDCH8-45104
FDCH2-34136
FDCH1-19331
FDCH5-39966
FDCH1-20053
FDCH7-44097
FDCH8-45435
FDCH14-30491
FDCH10-22366
FDCH5-39455
FDCH13-27148
FDCH3-35967
FDCH15-31478
FDCH4-37995
FDCH14-29174
FDCH8-44677
FDCH8-45892
FDCH4-37882
FDCH11-23547
FDCH7-44140
FDCH15-31757
FDCH10-22492
FDCH12-26385
FDCH5-38752
FDCH6-41037
FDCH12-25700
FDCH4-38217
FDCH1-20087
FDCH14-30268
FDCH5-38600
FDCH11-23737
FDCH8-44930
FDCH1-20851
FDCH2-34606
FDCH7-42657
FDCH12-26059
FDCH3-36281
FDCH2-34499
FDCH10-22565
FDCH10-21467
FDCH13-28335
FDCH13-28700
FDCH1-19714
FDCH5-38536
FDCH11-24556
FDCH4-36931
FDCH1-21098
FDCH4-37029
FDCH8-45498
FDCH13-28756
FDCH14-29897
FDCH11-23974
FDCH9-46761
FDCH15-31432
FDCH12-25992
FDCH6-41229
FDCH13-28017
FDCH2-33487
FDCH9-47501
FDCH9-47899
FDCH8-45088
FDCH13-27202
FDCH12-25213
FDCH5-38856
FDCH9-47391
FDCH14-30604
FDCH2-34274
FDCH2-33004
FDCH4-37143
FDCH13-28794
FDCH7-44122
FDCH15-32138
FDCH14-30177
FDCH7-42426
FDCH13-28714
FDCH1-19306
FDCH10-21823
FDCH10-22118
FDCH2-33001
FDCH2-34269
FDCH9-47141
FDCH12-26586
FDCH6-41387
FDCH13-28016
FDCH1-20530
FDCH11-25070
FDCH4-37204
FDCH10-22167
FDCH7-42409
FDCH3-35293
FDCH9-48204
FDCH2-33642
FDCH7-43760
FDCH2-32898
FDCH6-42253
FDCH13-28584
FDCH11-24867
FDCH7-44016
FDCH15-32116
FDCH7-42750
FDCH5-38616
FDCH11-24447
FDCH15-32488
FDCH11-23735
FDCH3-36101
FDCH12-26192
FDCH10-22431
FDCH10-22885
FDCH11-24168
FDCH8-45646
FDCH11-24261
FDCH7-43219
FDCH6-40798
FDCH15-31678
FDCH10-21465
FDCH9-46381
FDCH7-43034
FDCH4-38407
FDCH6-42163
FDCH11-23944
FDCH1-20400
FDCH3-35737
FDCH1-19728
FDCH4-36728
FDCH9-47592
FDCH2-34223
FDCH8-44802
FDCH9-46497
FDCH9-47717
FDCH4-38167
FDCH11-23943
FDCH12-26769
FDCH10-22064
FDCH11-24457
FDCH13-28746
FDCH15-32610
FDCH6-40692
FDCH14-30724
FDCH1-20607
FDCH14-29667
FDCH3-35955
FDCH1-21028
FDCH2-33616
FDCH14-30533
FDCH4-37319
FDCH4-37570
FDCH2-34332
FDCH14-30007
FDCH6-41582
FDCH2-33454
FDCH5-39684
FDCH8-45996
FDCH3-36218
FDCH10-22193
FDCH10-22793
FDCH3-35248
FDCH5-38809
FDCH13-27765
FDCH9-47284
FDCH4-37328
FDCH12-26154
FDCH9-47145
FDCH4-36735
FDCH8-45531
FDCH5-40278
FDCH1-21019
FDCH5-38890
FDCH1-19735
FDCH4-37962
FDCH5-38550
FDCH10-22374
FDCH3-35278
FDCH12-26186
FDCH8-46171
FDCH8-45354
FDCH4-37265
FDCH2-33939
FDCH9-46518
FDCH8-46121
FDCH13-26973
FDCH12-26370
FDCH11-23720
FDCH5-40133
FDCH7-42979
FDCH6-40998
FDCH11-23438
FDCH2-32994
FDCH15-32703
FDCH12-26740
FDCH14-29179
FDCH15-31861
FDCH14-30609
FDCH9-47229
FDCH8-46204
FDCH6-41221
FDCH10-21954
FDCH9-47500
FDCH14-29915
FDCH5-39724
FDCH4-38178
FDCH13-27971
FDCH2-34160
FDCH5-39441
FDCH2-33523
FDCH6-41275
FDCH6-42033
FDCH9-46749
FDCH15-31856
FDCH8-45677
FDCH10-22860
FDCH12-26435
FDCH1-19775
FDCH1-19372
FDCH3-35602
FDCH3-35931
FDCH12-25357
FDCH1-20190
FDCH13-27205
FDCH8-44489
FDCH10-21593
FDCH4-37474
FDCH8-45503
FDCH15-31019
FDCH1-20572
FDCH3-34866
FDCH5-39135
FDCH1-20010
FDCH6-41208
FDCH7-43614
FDCH9-48106
FDCH4-38348
FDCH11-24952
FDCH3-36005
FDCH1-20024
FDCH15-32426
FDCH4-38233
FDCH3-35475
FDCH8-45378
FDCH3-35422
FDCH15-31622
FDCH14-30187
FDCH13-28880
FDCH9-46879
FDCH12-26025
FDCH14-29345
FDCH5-39063
FDCH13-27990
FDCH7-43777
FDCH6-41434
FDCH4-37956
FDCH9-47104
FDCH2-33013
FDCH1-19715
FDCH7-43060
FDCH8-45475
FDCH1-20275
FDCH5-39595
FDCH7-42428
FDCH9-47914
FDCH7-44086
FDCH9-46901
FDCH14-29769
FDCH13-28437
FDCH4-37805
FDCH13-28870
FDCH10-21878
FDCH1-19912
FDCH1-20121
FDCH3-35460
FDCH6-40545
FDCH10-21639
FDCH1-19459
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
/**
* StreamOutput writes the output to a given stream.
*
* Usage:
*
* $output = new StreamOutput(fopen('php://stdout', 'w'));
*
* As `StreamOutput` can use any stream, you can also use a file:
*
* $output = new StreamOutput(fopen('/path/to/output.log', 'a', false));
*
* @author Fabien Potencier <[email protected]>
*/
class StreamOutput extends Output
{
private $stream;
/**
* @param resource $stream A stream resource
* @param int $verbosity The verbosity level (one of the VERBOSITY constants in OutputInterface)
* @param bool|null $decorated Whether to decorate messages (null for auto-guessing)
* @param OutputFormatterInterface|null $formatter Output formatter instance (null to use default OutputFormatter)
*
* @throws InvalidArgumentException When first argument is not a real stream
*/
public function __construct($stream, int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = null, OutputFormatterInterface $formatter = null)
{
if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
}
$this->stream = $stream;
if (null === $decorated) {
$decorated = $this->hasColorSupport();
}
parent::__construct($verbosity, $decorated, $formatter);
}
/**
* Gets the stream attached to this StreamOutput instance.
*
* @return resource A stream resource
*/
public function getStream()
{
return $this->stream;
}
/**
* {@inheritdoc}
*/
protected function doWrite(string $message, bool $newline)
{
if ($newline) {
$message .= PHP_EOL;
}
@fwrite($this->stream, $message);
fflush($this->stream);
}
/**
* Returns true if the stream supports colorization.
*
* Colorization is disabled if not supported by the stream:
*
* This is tricky on Windows, because Cygwin, Msys2 etc emulate pseudo
* terminals via named pipes, so we can only check the environment.
*
* Reference: Composer\XdebugHandler\Process::supportsColor
* https://github.com/composer/xdebug-handler
*
* @return bool true if the stream supports colorization, false otherwise
*/
protected function hasColorSupport()
{
// Follow https://no-color.org/
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
return false;
}
if ('Hyper' === getenv('TERM_PROGRAM')) {
return true;
}
if (\DIRECTORY_SEPARATOR === '\\') {
return (\function_exists('sapi_windows_vt100_support')
&& @sapi_windows_vt100_support($this->stream))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'xterm' === getenv('TERM');
}
return stream_isatty($this->stream);
}
}
| {
"pile_set_name": "Github"
} |
/*
* cocos2d for iPhone: http://www.cocos2d-iphone.org
*
* Copyright (c) 2009 On-Core
*
* 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.
*
*/
#import "CCActionTiledGrid.h"
#import "CCDirector.h"
#import "ccMacros.h"
#import "Support/CGPointExtension.h"
typedef struct
{
CGPoint position;
CGPoint startPosition;
ccGridSize delta;
} Tile;
#pragma mark -
#pragma mark ShakyTiles3D
@implementation CCShakyTiles3D
+(id)actionWithRange:(int)range shakeZ:(BOOL)shakeZ grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithRange:range shakeZ:shakeZ grid:gridSize duration:d] autorelease];
}
-(id)initWithRange:(int)range shakeZ:(BOOL)sz grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
randrange = range;
shakeZ = sz;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithRange:randrange shakeZ:shakeZ grid:gridSize_ duration:duration_];
return copy;
}
-(void)update:(ccTime)time
{
int i, j;
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
ccQuad3 coords = [self originalTile:ccg(i,j)];
// X
coords.bl.x += ( rand() % (randrange*2) ) - randrange;
coords.br.x += ( rand() % (randrange*2) ) - randrange;
coords.tl.x += ( rand() % (randrange*2) ) - randrange;
coords.tr.x += ( rand() % (randrange*2) ) - randrange;
// Y
coords.bl.y += ( rand() % (randrange*2) ) - randrange;
coords.br.y += ( rand() % (randrange*2) ) - randrange;
coords.tl.y += ( rand() % (randrange*2) ) - randrange;
coords.tr.y += ( rand() % (randrange*2) ) - randrange;
if( shakeZ ) {
coords.bl.z += ( rand() % (randrange*2) ) - randrange;
coords.br.z += ( rand() % (randrange*2) ) - randrange;
coords.tl.z += ( rand() % (randrange*2) ) - randrange;
coords.tr.z += ( rand() % (randrange*2) ) - randrange;
}
[self setTile:ccg(i,j) coords:coords];
}
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCShatteredTiles3D
@implementation CCShatteredTiles3D
+(id)actionWithRange:(int)range shatterZ:(BOOL)sz grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithRange:range shatterZ:sz grid:gridSize duration:d] autorelease];
}
-(id)initWithRange:(int)range shatterZ:(BOOL)sz grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
once = NO;
randrange = range;
shatterZ = sz;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithRange:randrange shatterZ:shatterZ grid:gridSize_ duration:duration_];
return copy;
}
-(void)update:(ccTime)time
{
int i, j;
if ( once == NO )
{
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
ccQuad3 coords = [self originalTile:ccg(i,j)];
// X
coords.bl.x += ( rand() % (randrange*2) ) - randrange;
coords.br.x += ( rand() % (randrange*2) ) - randrange;
coords.tl.x += ( rand() % (randrange*2) ) - randrange;
coords.tr.x += ( rand() % (randrange*2) ) - randrange;
// Y
coords.bl.y += ( rand() % (randrange*2) ) - randrange;
coords.br.y += ( rand() % (randrange*2) ) - randrange;
coords.tl.y += ( rand() % (randrange*2) ) - randrange;
coords.tr.y += ( rand() % (randrange*2) ) - randrange;
if( shatterZ ) {
coords.bl.z += ( rand() % (randrange*2) ) - randrange;
coords.br.z += ( rand() % (randrange*2) ) - randrange;
coords.tl.z += ( rand() % (randrange*2) ) - randrange;
coords.tr.z += ( rand() % (randrange*2) ) - randrange;
}
[self setTile:ccg(i,j) coords:coords];
}
}
once = YES;
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCShuffleTiles
@implementation CCShuffleTiles
+(id)actionWithSeed:(int)s grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithSeed:s grid:gridSize duration:d] autorelease];
}
-(id)initWithSeed:(int)s grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
seed = s;
tilesOrder = nil;
tiles = nil;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithSeed:seed grid:gridSize_ duration:duration_];
return copy;
}
-(void)dealloc
{
if ( tilesOrder ) free(tilesOrder);
if ( tiles ) free(tiles);
[super dealloc];
}
-(void)shuffle:(int*)array count:(NSUInteger)len
{
NSInteger i;
for( i = len - 1; i >= 0; i-- )
{
NSInteger j = rand() % (i+1);
int v = array[i];
array[i] = array[j];
array[j] = v;
}
}
-(ccGridSize)getDelta:(ccGridSize)pos
{
CGPoint pos2;
NSInteger idx = pos.x * gridSize_.y + pos.y;
pos2.x = tilesOrder[idx] / (int)gridSize_.y;
pos2.y = tilesOrder[idx] % (int)gridSize_.y;
return ccg(pos2.x - pos.x, pos2.y - pos.y);
}
-(void)placeTile:(ccGridSize)pos tile:(Tile)t
{
ccQuad3 coords = [self originalTile:pos];
CGPoint step = [[target_ grid] step];
coords.bl.x += (int)(t.position.x * step.x);
coords.bl.y += (int)(t.position.y * step.y);
coords.br.x += (int)(t.position.x * step.x);
coords.br.y += (int)(t.position.y * step.y);
coords.tl.x += (int)(t.position.x * step.x);
coords.tl.y += (int)(t.position.y * step.y);
coords.tr.x += (int)(t.position.x * step.x);
coords.tr.y += (int)(t.position.y * step.y);
[self setTile:pos coords:coords];
}
-(void)startWithTarget:(id)aTarget
{
[super startWithTarget:aTarget];
if ( seed != -1 )
srand(seed);
tilesCount = gridSize_.x * gridSize_.y;
tilesOrder = (int*)malloc(tilesCount*sizeof(int));
int i, j;
for( i = 0; i < tilesCount; i++ )
tilesOrder[i] = i;
[self shuffle:tilesOrder count:tilesCount];
tiles = malloc(tilesCount*sizeof(Tile));
Tile *tileArray = (Tile*)tiles;
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
tileArray->position = ccp(i,j);
tileArray->startPosition = ccp(i,j);
tileArray->delta = [self getDelta:ccg(i,j)];
tileArray++;
}
}
}
-(void)update:(ccTime)time
{
int i, j;
Tile *tileArray = (Tile*)tiles;
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
tileArray->position = ccpMult( ccp(tileArray->delta.x, tileArray->delta.y), time);
[self placeTile:ccg(i,j) tile:*tileArray];
tileArray++;
}
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCFadeOutTRTiles
@implementation CCFadeOutTRTiles
-(float)testFunc:(ccGridSize)pos time:(ccTime)time
{
CGPoint n = ccpMult( ccp(gridSize_.x,gridSize_.y), time);
if ( (n.x+n.y) == 0.0f )
return 1.0f;
return powf( (pos.x+pos.y) / (n.x+n.y), 6 );
}
-(void)turnOnTile:(ccGridSize)pos
{
[self setTile:pos coords:[self originalTile:pos]];
}
-(void)turnOffTile:(ccGridSize)pos
{
ccQuad3 coords;
bzero(&coords, sizeof(ccQuad3));
[self setTile:pos coords:coords];
}
-(void)transformTile:(ccGridSize)pos distance:(float)distance
{
ccQuad3 coords = [self originalTile:pos];
CGPoint step = [[target_ grid] step];
coords.bl.x += (step.x / 2) * (1.0f - distance);
coords.bl.y += (step.y / 2) * (1.0f - distance);
coords.br.x -= (step.x / 2) * (1.0f - distance);
coords.br.y += (step.y / 2) * (1.0f - distance);
coords.tl.x += (step.x / 2) * (1.0f - distance);
coords.tl.y -= (step.y / 2) * (1.0f - distance);
coords.tr.x -= (step.x / 2) * (1.0f - distance);
coords.tr.y -= (step.y / 2) * (1.0f - distance);
[self setTile:pos coords:coords];
}
-(void)update:(ccTime)time
{
int i, j;
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
float distance = [self testFunc:ccg(i,j) time:time];
if ( distance == 0 )
[self turnOffTile:ccg(i,j)];
else if ( distance < 1 )
[self transformTile:ccg(i,j) distance:distance];
else
[self turnOnTile:ccg(i,j)];
}
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCFadeOutBLTiles
@implementation CCFadeOutBLTiles
-(float)testFunc:(ccGridSize)pos time:(ccTime)time
{
CGPoint n = ccpMult(ccp(gridSize_.x, gridSize_.y), (1.0f-time));
if ( (pos.x+pos.y) == 0 )
return 1.0f;
return powf( (n.x+n.y) / (pos.x+pos.y), 6 );
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCFadeOutUpTiles
@implementation CCFadeOutUpTiles
-(float)testFunc:(ccGridSize)pos time:(ccTime)time
{
CGPoint n = ccpMult(ccp(gridSize_.x, gridSize_.y), time);
if ( n.y == 0 )
return 1.0f;
return powf( pos.y / n.y, 6 );
}
-(void)transformTile:(ccGridSize)pos distance:(float)distance
{
ccQuad3 coords = [self originalTile:pos];
CGPoint step = [[target_ grid] step];
coords.bl.y += (step.y / 2) * (1.0f - distance);
coords.br.y += (step.y / 2) * (1.0f - distance);
coords.tl.y -= (step.y / 2) * (1.0f - distance);
coords.tr.y -= (step.y / 2) * (1.0f - distance);
[self setTile:pos coords:coords];
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCFadeOutDownTiles
@implementation CCFadeOutDownTiles
-(float)testFunc:(ccGridSize)pos time:(ccTime)time
{
CGPoint n = ccpMult(ccp(gridSize_.x,gridSize_.y), (1.0f - time));
if ( pos.y == 0 )
return 1.0f;
return powf( n.y / pos.y, 6 );
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark TurnOffTiles
@implementation CCTurnOffTiles
+(id)actionWithSeed:(int)s grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithSeed:s grid:gridSize duration:d] autorelease];
}
-(id)initWithSeed:(int)s grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
seed = s;
tilesOrder = nil;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithSeed:seed grid:gridSize_ duration:duration_];
return copy;
}
-(void)dealloc
{
if ( tilesOrder ) free(tilesOrder);
[super dealloc];
}
-(void)shuffle:(int*)array count:(NSUInteger)len
{
NSInteger i;
for( i = len - 1; i >= 0; i-- )
{
NSInteger j = rand() % (i+1);
int v = array[i];
array[i] = array[j];
array[j] = v;
}
}
-(void)turnOnTile:(ccGridSize)pos
{
[self setTile:pos coords:[self originalTile:pos]];
}
-(void)turnOffTile:(ccGridSize)pos
{
ccQuad3 coords;
bzero(&coords, sizeof(ccQuad3));
[self setTile:pos coords:coords];
}
-(void)startWithTarget:(id)aTarget
{
int i;
[super startWithTarget:aTarget];
if ( seed != -1 )
srand(seed);
tilesCount = gridSize_.x * gridSize_.y;
tilesOrder = (int*)malloc(tilesCount*sizeof(int));
for( i = 0; i < tilesCount; i++ )
tilesOrder[i] = i;
[self shuffle:tilesOrder count:tilesCount];
}
-(void)update:(ccTime)time
{
int i, l, t;
l = (int)(time * (float)tilesCount);
for( i = 0; i < tilesCount; i++ )
{
t = tilesOrder[i];
ccGridSize tilePos = ccg( t / gridSize_.y, t % gridSize_.y );
if ( i < l )
[self turnOffTile:tilePos];
else
[self turnOnTile:tilePos];
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCWavesTiles3D
@implementation CCWavesTiles3D
@synthesize amplitude;
@synthesize amplitudeRate;
+(id)actionWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithWaves:wav amplitude:amp grid:gridSize duration:d] autorelease];
}
-(id)initWithWaves:(int)wav amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
waves = wav;
amplitude = amp;
amplitudeRate = 1.0f;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithWaves:waves amplitude:amplitude grid:gridSize_ duration:duration_];
return copy;
}
-(void)update:(ccTime)time
{
int i, j;
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
ccQuad3 coords = [self originalTile:ccg(i,j)];
coords.bl.z = (sinf(time*(CGFloat)M_PI*waves*2 + (coords.bl.y+coords.bl.x) * .01f) * amplitude * amplitudeRate );
coords.br.z = coords.bl.z;
coords.tl.z = coords.bl.z;
coords.tr.z = coords.bl.z;
[self setTile:ccg(i,j) coords:coords];
}
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCJumpTiles3D
@implementation CCJumpTiles3D
@synthesize amplitude;
@synthesize amplitudeRate;
+(id)actionWithJumps:(int)j amplitude:(float)amp grid:(ccGridSize)gridSize duration:(ccTime)d
{
return [[[self alloc] initWithJumps:j amplitude:amp grid:gridSize duration:d] autorelease];
}
-(id)initWithJumps:(int)j amplitude:(float)amp grid:(ccGridSize)gSize duration:(ccTime)d
{
if ( (self = [super initWithSize:gSize duration:d]) )
{
jumps = j;
amplitude = amp;
amplitudeRate = 1.0f;
}
return self;
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithJumps:jumps amplitude:amplitude grid:gridSize_ duration:duration_];
return copy;
}
-(void)update:(ccTime)time
{
int i, j;
float sinz = (sinf((CGFloat)M_PI*time*jumps*2) * amplitude * amplitudeRate );
float sinz2 = (sinf((CGFloat)M_PI*(time*jumps*2 + 1)) * amplitude * amplitudeRate );
for( i = 0; i < gridSize_.x; i++ )
{
for( j = 0; j < gridSize_.y; j++ )
{
ccQuad3 coords = [self originalTile:ccg(i,j)];
if ( ((i+j) % 2) == 0 )
{
coords.bl.z += sinz;
coords.br.z += sinz;
coords.tl.z += sinz;
coords.tr.z += sinz;
}
else
{
coords.bl.z += sinz2;
coords.br.z += sinz2;
coords.tl.z += sinz2;
coords.tr.z += sinz2;
}
[self setTile:ccg(i,j) coords:coords];
}
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark SplitRows
@implementation CCSplitRows
+(id)actionWithRows:(int)r duration:(ccTime)d
{
return [[[self alloc] initWithRows:r duration:d] autorelease];
}
-(id)initWithRows:(int)r duration:(ccTime)d
{
rows = r;
return [super initWithSize:ccg(1,r) duration:d];
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithRows:rows duration:duration_];
return copy;
}
-(void)startWithTarget:(id)aTarget
{
[super startWithTarget:aTarget];
winSize = [[CCDirector sharedDirector] winSizeInPixels];
}
-(void)update:(ccTime)time
{
int j;
for( j = 0; j < gridSize_.y; j++ )
{
ccQuad3 coords = [self originalTile:ccg(0,j)];
float direction = 1;
if ( (j % 2 ) == 0 )
direction = -1;
coords.bl.x += direction * winSize.width * time;
coords.br.x += direction * winSize.width * time;
coords.tl.x += direction * winSize.width * time;
coords.tr.x += direction * winSize.width * time;
[self setTile:ccg(0,j) coords:coords];
}
}
@end
////////////////////////////////////////////////////////////
#pragma mark -
#pragma mark CCSplitCols
@implementation CCSplitCols
+(id)actionWithCols:(int)c duration:(ccTime)d
{
return [[[self alloc] initWithCols:c duration:d] autorelease];
}
-(id)initWithCols:(int)c duration:(ccTime)d
{
cols = c;
return [super initWithSize:ccg(c,1) duration:d];
}
-(id) copyWithZone: (NSZone*) zone
{
CCGridAction *copy = [[[self class] allocWithZone:zone] initWithCols:cols duration:duration_];
return copy;
}
-(void)startWithTarget:(id)aTarget
{
[super startWithTarget:aTarget];
winSize = [[CCDirector sharedDirector] winSizeInPixels];
}
-(void)update:(ccTime)time
{
int i;
for( i = 0; i < gridSize_.x; i++ )
{
ccQuad3 coords = [self originalTile:ccg(i,0)];
float direction = 1;
if ( (i % 2 ) == 0 )
direction = -1;
coords.bl.y += direction * winSize.height * time;
coords.br.y += direction * winSize.height * time;
coords.tl.y += direction * winSize.height * time;
coords.tr.y += direction * winSize.height * time;
[self setTile:ccg(i,0) coords:coords];
}
}
@end
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2008 - 2015 Freescale Semiconductor Inc.
*
* 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 Freescale Semiconductor nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* ALTERNATIVELY, this software may be distributed under the terms of the
* GNU General Public License ("GPL") as published by the Free Software
* Foundation, either version 2 of that License or (at your option) any
* later version.
*
* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __FM_SP_H
#define __FM_SP_H
#include "fman.h"
#include <linux/types.h>
#define ILLEGAL_BASE (~0)
/* defaults */
#define DFLT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64
/* Registers bit fields */
#define FMAN_SP_EXT_BUF_POOL_EN_COUNTER 0x40000000
#define FMAN_SP_EXT_BUF_POOL_VALID 0x80000000
#define FMAN_SP_EXT_BUF_POOL_BACKUP 0x20000000
#define FMAN_SP_DMA_ATTR_WRITE_OPTIMIZE 0x00100000
#define FMAN_SP_SG_DISABLE 0x80000000
/* shifts */
#define FMAN_SP_EXT_BUF_MARG_START_SHIFT 16
#define FMAN_SP_DMA_ATTR_SWP_SHIFT 30
#define FMAN_SP_IC_TO_EXT_SHIFT 16
#define FMAN_SP_IC_FROM_INT_SHIFT 8
/* structure for defining internal context copying */
struct fman_sp_int_context_data_copy {
/* < Offset in External buffer to which internal
* context is copied to (Rx) or taken from (Tx, Op).
*/
u16 ext_buf_offset;
/* Offset within internal context to copy from
* (Rx) or to copy to (Tx, Op).
*/
u8 int_context_offset;
/* Internal offset size to be copied */
u16 size;
};
/* struct for defining external buffer margins */
struct fman_sp_buf_margins {
/* Number of bytes to be left at the beginning
* of the external buffer (must be divisible by 16)
*/
u16 start_margins;
/* number of bytes to be left at the end
* of the external buffer(must be divisible by 16)
*/
u16 end_margins;
};
struct fman_sp_buffer_offsets {
u32 data_offset;
u32 prs_result_offset;
u32 time_stamp_offset;
u32 hash_result_offset;
};
int fman_sp_build_buffer_struct(struct fman_sp_int_context_data_copy
*int_context_data_copy,
struct fman_buffer_prefix_content
*buffer_prefix_content,
struct fman_sp_buf_margins *buf_margins,
struct fman_sp_buffer_offsets
*buffer_offsets,
u8 *internal_buf_offset);
void fman_sp_set_buf_pools_in_asc_order_of_buf_sizes(struct fman_ext_pools
*fm_ext_pools,
u8 *ordered_array,
u16 *sizes_array);
#endif /* __FM_SP_H */
| {
"pile_set_name": "Github"
} |
%%% -*-mode:erlang;coding:utf-8;tabidth,:4;c-basic-offset:4;indent-tabs-mode:()-*-
%%% ex: set ft=erlang fenc=utf-8 sts=4 ts=4 sw=4 et:
%%%
%%% Require OTP 19.1 at a bare minimum
{minimum_otp_vsn, "19.1"}.
%% Plugins
{plugins, [rebar3_hex]}.
{shell, [
{apps, [lager, sync, gen_rpc]}
]}.
{erl_opts, [debug_info,
{warn_format, 1},
bin_opt_info,
inline_list_funcs,
warnings_as_errors,
report_warnings,
warn_untyped_record,
warn_export_vars,
warn_export_all,
warn_shadow_vars,
warn_obsolete_guard,
warn_unused_import,
warn_deprecated_function,
warn_unused_vars,
warn_unused_function,
warn_bif_clash,
warn_unused_record,
warn_exported_vars
]}.
{deps, [
{hut, "~> 1.2"},
{ssl_verify_fun, "~> 1.1"}
]}.
{profiles, [
{test, [
{erl_opts, [{d,'TEST'},
{d,'HUT_LAGER'},
{parse_transform, lager_transform},
warnings_as_errors,
export_all,
no_inline_list_funcs]},
{deps, [{lager, "~> 3.0"},
{eunit_formatters, "~> 0.3"}
]}
]},
{dev, [
{erl_opts, [{d,'HUT_LAGER'},
{parse_transform, lager_transform},
warnings_as_errors,
no_inline_list_funcs]},
{deps, [{lager, "~> 3.0"},
{sync, {git, "git://github.com/rustyio/sync.git", {branch, "master"}}}
]}
]}
]}.
%% Code coverage
{cover_enabled, true}.
{cover_export_enabled, true}.
{cover_opts, [verbose]}.
%% Coveralls code coverage reporting
{coveralls_coverdata, "_build/test/cover/ct.coverdata"}.
{coveralls_service_name, "travis-ci"}.
{do_coveralls_after_ct, false}.
{do_coveralls_after_eunit, false}.
%% EUnit options
{eunit_compile_opts, [warnings_as_errors, debug_info, export_all]}.
{eunit_opts, [verbose,
no_tty,
{report, {eunit_progress, [colored, profile]}}
]}.
%% Common Test options
{ct_opts, [{logdir, "log/ct"},
{dir, "test"},
{cover, "test/gen_rpc.coverspec"},
{suite, [
local_SUITE,
remote_SUITE,
remote_with_key_SUITE,
multi_rpc_SUITE,
multi_rpc_with_key_SUITE
]}
]}.
% Dialyzer
{dialyzer, [
{warnings, [unmatched_returns, error_handling]},
{get_warnings, true},
{plt_location, "_plt"},
{base_plt_location, global},
{base_plt_apps, [asn1, crypto, edoc, erts, eunit, inets, kernel, mnesia, public_key, ssl, stdlib, xmerl]}
]}.
%% XRef
{xref_warnings, true}.
{xref_extra_paths, []}.
{xref_checks, [undefined_function_calls, undefined_functions, locals_not_used,
deprecated_function_calls, deprecated_functions]}.
| {
"pile_set_name": "Github"
} |
/*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "avfilter.h"
#include "internal.h"
#include "libavutil/internal.h"
static int filter_frame(AVFilterLink *link, AVFrame *frame)
{
av_frame_free(&frame);
return 0;
}
static const AVFilterPad avfilter_vsink_nullsink_inputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = filter_frame,
},
{ NULL },
};
AVFilter ff_vsink_nullsink = {
.name = "nullsink",
.description = NULL_IF_CONFIG_SMALL("Do absolutely nothing with the input video."),
.priv_size = 0,
.inputs = avfilter_vsink_nullsink_inputs,
.outputs = NULL,
};
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020 Darby Johnston
// All rights reserved.
#include <djvRender3DTest/CameraTest.h>
#include <djvRender3D/Camera.h>
using namespace djv::Core;
using namespace djv::Render3D;
namespace djv
{
namespace Render3DTest
{
CameraTest::CameraTest(
const System::File::Path& tempPath,
const std::shared_ptr<System::Context>& context) :
ITest("djv::Render3DTest::CameraTest", tempPath, context)
{}
void CameraTest::run()
{
{
auto camera = DefaultCamera::create();
const glm::mat4x4 m(1.F);
camera->setV(m);
DJV_ASSERT(m == camera->getV());
camera->setP(m);
DJV_ASSERT(m == camera->getP());
}
}
} // namespace Render3DTest
} // namespace djv
| {
"pile_set_name": "Github"
} |
#
# Copyright 2015-2017, Noah Kantrowitz
#
# 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.
#
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'poise_application_ruby/version'
Gem::Specification.new do |spec|
spec.name = 'poise-application-ruby'
spec.version = PoiseApplicationRuby::VERSION
spec.authors = ['Noah Kantrowitz']
spec.email = %w{[email protected]}
spec.description = "A Chef cookbook for deploying application code."
spec.summary = spec.description
spec.homepage = 'https://github.com/poise/application_ruby'
spec.license = 'Apache-2.0'
spec.metadata['halite_name'] = 'application_ruby'
spec.metadata['platforms'] = 'any'
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = %w{lib}
spec.add_dependency 'chef', '>= 12.1', '< 14'
spec.add_dependency 'halite', '~> 1.0'
spec.add_dependency 'poise', '~> 2.0'
spec.add_dependency 'poise-application', '~> 5.0'
spec.add_dependency 'poise-ruby', '~> 2.1'
spec.add_dependency 'poise-service', '~> 1.0'
spec.add_development_dependency 'poise-application-git', '~> 1.2'
spec.add_development_dependency 'poise-boiler', '~> 1.15'
spec.add_development_dependency 'poise-build-essential', '~> 1.0'
end
| {
"pile_set_name": "Github"
} |
<html>
<body style="background-color: blue">
<iframe width="50%" height="50%"
src="empty_page.html"></iframe>
Page with single frame
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright Aleksey Gurtovoy 2000-2004
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// Preprocessed version of "boost/mpl/less_equal.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct less_equal_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct less_equal_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct less_equal_impl< na,Tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename Tag > struct less_equal_impl< Tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct less_equal_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct less_equal
: less_equal_impl<
typename less_equal_tag<N1>::type
, typename less_equal_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
}}
namespace boost { namespace mpl {
template<>
struct less_equal_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
{
BOOST_STATIC_CONSTANT(bool, value =
( BOOST_MPL_AUX_VALUE_WKND(N1)::value <=
BOOST_MPL_AUX_VALUE_WKND(N2)::value )
);
typedef bool_<value> type;
};
};
}}
| {
"pile_set_name": "Github"
} |
**To change a deployment's description**
The following ``update-deployment`` example updates a deployment's description. ::
aws apigatewayv2 update-deployment \
--api-id a1b2c3d4 \
--deployment-id abcdef \
--description 'Manual deployment to fix integration test failures.'
Output::
{
"AutoDeployed": false,
"CreatedDate": "2020-02-05T16:21:48+00:00",
"DeploymentId": "abcdef",
"DeploymentStatus": "DEPLOYED",
"Description": "Manual deployment to fix integration test failures."
}
For more information, see `Developing an HTTP API in API Gateway <https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop.html>`__ in the *Amazon API Gateway Developer Guide*.
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.IO;
using Mapsui.Styles;
using System.Windows.Media.Imaging;
using System.Windows.Media;
namespace Mapsui.Rendering.Xaml
{
public class SymbolCache : Dictionary<int, ImageSource>, ISymbolCache
{
public ImageSource GetOrCreate(int bitmapId)
{
if (ContainsKey(bitmapId)) return this[bitmapId];
var obj = BitmapRegistry.Instance.Get(bitmapId);
if (obj is Sprite sprite)
{
if (GetOrCreate(sprite.Atlas) == null)
throw new AccessViolationException("Atlas bitmap unknown");
var bitmapSource = new CroppedBitmap((BitmapImage)GetOrCreate(sprite.Atlas),
new System.Windows.Int32Rect(sprite.X, sprite.Y, sprite.Width, sprite.Height));
var encoder = new PngBitmapEncoder();
var memoryStream = new MemoryStream();
encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
encoder.Save(memoryStream);
memoryStream.Position = 0;
return this[bitmapId] = memoryStream.ToBitmapImage();
}
else
{
var stream = (Stream) obj;
byte[] buffer = new byte[4];
stream.Position = 0;
stream.Read(buffer, 0, 4);
if (System.Text.Encoding.UTF8.GetString(buffer).ToLower().Equals("<svg"))
{
stream.Position = 0;
var image = Svg2Xaml.SvgReader.Load(stream);
// Freeze the DrawingImage for performance benefits.
image.Freeze();
return this[bitmapId] = image;
}
else
return this[bitmapId] = stream.ToBitmapImage();
}
}
public Size GetSize(int bitmapId)
{
var brush = GetOrCreate(bitmapId);
return new Size(brush.Width, brush.Height);
}
}
} | {
"pile_set_name": "Github"
} |
/**
* Copyright 2017 Goldman Sachs.
* 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.gs.obevo.db.impl.platforms.mssql;
import java.sql.Connection;
import com.gs.obevo.api.appdata.Change;
import com.gs.obevo.api.appdata.ObjectTypeAndNamePredicateBuilder;
import com.gs.obevo.api.appdata.PhysicalSchema;
import com.gs.obevo.api.platform.ChangeType;
import com.gs.obevo.api.platform.DeployerAppContext;
import com.gs.obevo.apps.reveng.ChangeEntry;
import com.gs.obevo.apps.reveng.Reveng;
import com.gs.obevo.db.api.appdata.GrantTargetType;
import com.gs.obevo.db.api.platform.DbChangeTypeImpl;
import com.gs.obevo.db.api.platform.DbPlatform;
import com.gs.obevo.db.api.platform.DbTranslationDialect;
import com.gs.obevo.db.api.platform.SqlExecutor;
import com.gs.obevo.db.impl.platforms.AbstractDbPlatform;
import com.gs.obevo.impl.reader.TextMarkupDocumentReader;
import org.apache.commons.lang3.ObjectUtils;
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.impl.block.factory.Functions;
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.Multimaps;
public class MsSqlDbPlatform extends AbstractDbPlatform {
public MsSqlDbPlatform() {
super("MSSQL");
}
@Override
public Class<? extends DeployerAppContext> initializeAppContextBuilderClass() {
return MsSqlAppContext.class;
}
@Override
protected String initializeDefaultDriverClassName() {
return "com.microsoft.sqlserver.jdbc.SQLServerDriver";
}
@Override
protected ImmutableList<ChangeType> initializeChangeTypes() {
return super.initializeChangeTypes().newWithAll(Lists.immutable.with(
DbChangeTypeImpl.newDbChangeType(ChangeType.RULE_STR, true, 2, "RULE").build(),
DbChangeTypeImpl.newDbChangeType(ChangeType.USERTYPE_STR, true, 3, "DOMAIN").build(),
DbChangeTypeImpl.newDbChangeType(ChangeType.DEFAULT_STR, true, 5, "DEFAULT").build()
));
}
/**
* Sybase allows the object names to differ from the generated file names in case of duplicates; hence, we enable.
*/
@Override
public boolean isDuplicateCheckRequiredForReverseEngineering() {
return true;
}
@Override
public ObjectTypeAndNamePredicateBuilder getObjectExclusionPredicateBuilder() {
return super.getObjectExclusionPredicateBuilder().add(Multimaps.immutable.set.with(
ChangeType.TABLE_STR, "rs_%",
ChangeType.SP_STR, "rs_%"
));
}
@Override
protected String getGrantTargetTypeStrDbSpecific(GrantTargetType grantTargetType) {
// These DB types do not need "GROUP" or "USER" explicitly specified
return "";
}
@Override
public Function<String, String> convertDbObjectName() {
return Functions.getPassThru();
}
@Override
public String getSchemaPrefix(PhysicalSchema schema) {
return schema.getPhysicalName() + "." + ObjectUtils.defaultIfNull(schema.getSubschema(), "") + ".";
}
@Override
public String getSubschemaPrefix(PhysicalSchema schema) {
return schema.getSubschema() != null ? schema.getSubschema() + "." : "";
}
@Override
@Deprecated
public String getSchemaSeparator() {
return "..";
}
@Override
public boolean isSubschemaSupported() {
return true;
}
@Override
public void doTryBlockForArtifact(Connection conn, final SqlExecutor sqlExecutor, Change artifact) {
// See here for why we do this:
// http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc38151.1510/html/iqrefbb/CACIIHCI.htm
// In short - JDBC defaults this to ON, but isql had this to OFF
// We have this toggle to handle the legacy DB cases that started off deploying their scripts via isql, and
// need to transition to this product, which deploys things via JDBC
if (artifact.getMetadataSection() != null
&& artifact.getMetadataSection().isTogglePresent(TextMarkupDocumentReader.TOGGLE_DISABLE_QUOTED_IDENTIFIERS)) {
sqlExecutor.getJdbcTemplate().update(conn, "SET quoted_identifier OFF");
}
}
@Override
public void doFinallyBlockForArtifact(Connection conn, final SqlExecutor sqlExecutor, Change artifact) {
if (artifact.getMetadataSection() != null
&& artifact.getMetadataSection().isTogglePresent(TextMarkupDocumentReader.TOGGLE_DISABLE_QUOTED_IDENTIFIERS)) {
sqlExecutor.getJdbcTemplate().update(conn, "SET quoted_identifier ON");
}
}
@Override
public void postProcessChangeForRevEng(ChangeEntry change, String sql) {
if (sql.contains("\"")) {
change.addMetadataAnnotation(TextMarkupDocumentReader.TOGGLE_DISABLE_QUOTED_IDENTIFIERS);
}
}
@Override
public DbTranslationDialect getDbTranslationDialect(DbPlatform targetDialect) {
if (targetDialect.getClass().getName().equals("com.gs.obevo.db.impl.platforms.h2.H2DbPlatform")) {
return new MsSqlToH2TranslationDialect();
} else if (targetDialect.getClass().getName().equals("com.gs.obevo.db.impl.platforms.hsql.HsqlDbPlatform")) {
return new MsSqlToHsqlTranslationDialect();
} else {
return super.getDbTranslationDialect(targetDialect);
}
}
@Override
public String getTextType() {
return "TEXT";
}
@Override
public Reveng getDdlReveng() {
return new MsSqlReveng();
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="talkback_service_description">Коли TalkBack увімкнено, озвучуються голосові підказки, щоб можна було користуватися пристроєм, не дивлячись на екран. Це корисно для людей із вадами зору.\n\nЯк працює TalkBack\n• Проводьте пальцем уліво або вправо, щоб переходити між елементами\n• Двічі торкайтеся, щоб активувати елемент\n• Перетягуйте два пальці, щоб прокручувати\n\nЯк вимкнути TalkBack\n• Торкніться перемикача. З’явиться зелений контур. Двічі торкніться перемикача.\n• У повідомленні для підтвердження виберіть OK. Потім двічі торкніться опції OK.</string>
<string name="talkback_service_summary">oзвучувати елементи на екрані</string>
<string name="talkback_preferences_title">Налаштування TalkBack</string>
<string name="tts_preferences_title">Налаштування синтезу мовлення</string>
<string name="language_options">Мови</string>
<string name="talkback_preferences_subtitle">Версія %1$s</string>
<string name="label_manager_summary_title">Спеціальні мітки</string>
<string name="label_manager_package_title">Керування мітками додатка %1$s</string>
<string name="label_manager_no_packages_message">Зараз немає спеціальних міток. Щоб створити спеціальну мітку, перейдіть до зображення без мітки та додайте мітку в локальному контекстному меню.</string>
<string name="label_manager_timestamp_text">Остання зміна: %1$s</string>
<string name="search_dialog_label">Шукати: %1$s</string>
<string name="search_mode_open">Режим пошуку відкрито.</string>
<string name="search_mode_cancel">Пошук скасовано.</string>
<string name="search_mode_finish">Пошук завершено.</string>
<string name="search_mode_hint_start">Режим пошуку.</string>
<string name="search_mode_hint_no_query">Не введено пошуковий запит.</string>
<string name="search_mode_hint_query">Поточний пошуковий запит: %1$s.</string>
<string name="search_mode_hint_no_selection">Не вибрано елемент.</string>
<string name="search_mode_hint_selection">Поточний вибір: %1$s.</string>
<string name="notification_type_missed_call">Пропущений дзвінок</string>
<string name="notification_type_status_mute">Без звуку</string>
<string name="notification_type_status_chat">Чат</string>
<string name="notification_type_status_error">Помилка</string>
<string name="notification_type_status_more">Більше</string>
<string name="notification_type_status_sdcard">Карта SD</string>
<string name="notification_type_status_sdcard_usb">USB карти SD</string>
<string name="notification_status_sync">Синхронізується</string>
<string name="notification_type_status_sync_noanim">Синхронізується</string>
<string name="notification_type_status_voicemail">Голосова пошта</string>
<string name="notification_type_status_started">Почато</string>
<string name="notification_type_status_stopped">Зупинено</string>
<string name="template_menu">Меню \"%1$s\"</string>
<string name="template_no_text_selected">Немає вибраного тексту</string>
<string name="template_long_clicked">Утримується %1$s</string>
<string name="template_charging">Стан акумулятора: %1$s; рівень заряду у відсотках: %2$s.</string>
<string name="template_charging_lite">Заряджання %1$s</string>
<string name="template_language_options_menu_item">%1$s (%2$s)</string>
<string name="value_notification_shade_opened">Панель відкрито</string>
<string name="value_text_removed">видалено</string>
<string name="value_dismissible">можна відхилити</string>
<string name="hint_radial_menu">Торкніться екрана та проведіть пальцем по колу, щоб знайти елемент, а потім підніміть палець, щоб активувати його.</string>
<string name="hint_summary_jog_dial">Торкніться екрана та проведіть пальцем по колу, щоб пересуватися вмістом на екрані, а потім підніміть палець, щоб відкрити вибране.</string>
<string name="value_ringer_vibrate">Вібросигнал.</string>
<string name="value_ringer_silent">Дзвінок беззвучний.</string>
<string name="value_screen_on">Екран увімкнено.</string>
<string name="value_screen_off">Екран вимкнено.</string>
<string name="value_device_unlocked">Пристрій розблоковано.</string>
<string name="title_pref_category_when_to_speak">Мовлення</string>
<string name="title_pref_speech_volume">Гучність мовлення</string>
<string name="title_pref_speak_screenoff">Говорити, коли екран вимкнено</string>
<string name="summaryOn_pref_speak_screenoff">Сповіщення озвучуються, коли екран вимкнено</string>
<string name="summaryOff_pref_speak_screenoff">Дії не озвучуються, коли екран вимкнено</string>
<string name="title_pref_verbose_scroll_announcement">Озвучувати кількість елементів списку на екрані</string>
<string name="summaryOff_pref_verbose_scroll_announcement">Озвучувати, коли користувач прокручує вміст жестом</string>
<string name="summaryOn_pref_verbose_scroll_announcement">Завжди озвучується</string>
<string name="title_pref_proximity">Використ. датчик відстані</string>
<string name="summaryOn_pref_proximity">Датчик наближення вимикає мовлення</string>
<string name="summaryOff_pref_proximity">Датчик наближення не керує мовленням</string>
<string name="title_pref_phonetic_letters">Увімкнути вимову літер</string>
<string name="summaryOff_pref_phonetic_letters">Вимова літер не озвучується</string>
<string name="summaryOn_pref_phonetic_letters">Вимова літер озвучується, якщо втримувати клавіші та переходити між символами</string>
<string name="title_pref_a11y_hints">Увімкнути голосові підказки</string>
<string name="summaryOff_pref_a11y_hints">Підказки не озвучуються, якщо переходити між елементами</string>
<string name="summaryOn_pref_a11y_hints">Підказки озвучуються під час навігації з невеликою затримкою</string>
<string name="pref_speak_container_element_positions_title">Озвучувати інформацію списку й таблиці</string>
<string name="pref_speak_container_element_positions_summaryOn">Озвучується інформація зі списків і таблиць</string>
<string name="pref_speak_container_element_positions_summaryOff">Інформація зі списків і таблиць не озвучується</string>
<string name="pref_speak_roles_title">Озвучувати тип елемента</string>
<string name="pref_speak_roles_summary_on">Озвучується тип вибраних елементів</string>
<string name="pref_speak_roles_summary_off">Тип вибраних елементів не озвучується</string>
<string name="title_pref_speak_element_ids">Озвучувати ідентифікатори елементів</string>
<string name="summaryOff_pref_speak_element_ids">Ідентифікатори елементів не озвучуються для кнопок без міток</string>
<string name="summaryOn_pref_speak_element_ids">Ідентифікатори елементів озвучуються для кнопок без міток</string>
<string name="title_pref_explore_by_touch">Дослідження дотиком</string>
<string name="title_pref_category_touch_exploration">Навігація</string>
<string name="title_pref_single_tap">Активація одним дотиком</string>
<string name="title_pref_show_context_menu_as_list">Показувати контекстне меню як список</string>
<string name="summary_pref_single_tap">Торкніться виділеного елемента, щоб активувати його (експериментальна функція)</string>
<string name="title_pref_shake_to_read_threshold">Струсити, щоб читати</string>
<string name="pref_verbosity_title">Деталізація</string>
<string name="title_pref_category_manage_gestures">Жести</string>
<string name="title_pref_manage_labels">Спеціальні мітки</string>
<string name="title_pref_manage_keyboard_shortcuts">Комбінації клавіш</string>
<string name="title_pref_export_custom_labels">Експортувати спеціальні мітки</string>
<string name="title_pref_play_store">Відкрити TalkBack у Google Play</string>
<string name="summary_pref_play_store">Поточна версія TalkBack: %1$s</string>
<string name="title_pref_help_and_feedback">Довідка й відгуки</string>
<string name="pref_item_licenses">Ліцензії відкритого коду</string>
<string name="title_pref_help">Довідка</string>
<string name="title_pref_show_tos">Умови використання</string>
<string name="title_pref_show_privacy_policy">Політика конфіденційності</string>
<string name="title_pref_category_touch_shortcuts">Жести швидкого доступу</string>
<string name="title_pref_category_fingerprint_touch_shortcuts">Жести на сканері відбитків пальців</string>
<string name="title_pref_category_built_in_gestures">Вбудовані жести</string>
<string name="pref_verbosity_preset_title">Виберіть набір налаштувань</string>
<string name="pref_verbosity_preset_entry_high">Висока</string>
<string name="pref_verbosity_preset_entry_custom">Спеціальна</string>
<string name="pref_verbosity_preset_entry_low">Низька</string>
<string name="pref_verbosity_category_preset_settings_title">Відомості про деталізацію</string>
<string name="pref_verbosity_category_misc_settings_title">Інше</string>
<string name="pref_verbosity_preset_change">%1$s деталізація ввімкнена.</string>
<string name="keycombo_menu_category_select_keymap">Розкладка</string>
<string name="keycombo_menu_select_keymap">Вибрати розкладку</string>
<string name="keycombo_menu_reset_keymap">Скинути налаштування розкладки</string>
<string name="keycombo_menu_choose_trigger_modifier">Виберіть клавішу-модифікатор</string>
<string name="keycombo_menu_alert_title_trigger_modifier">TalkBack скине налаштування розкладки</string>
<string name="keycombo_menu_alert_message_trigger_modifier">TalkBack скине налаштування розкладки та змінить клавішу-модифікатор на %1$s</string>
<string name="keycombo_menu_announce_new_trigger_modifier">Клавішу-модифікатор змінено на %1$s.</string>
<string name="keycombo_menu_announce_active_keymap">Розкладка \"%1$s\" активна.</string>
<string name="keycombo_menu_announce_reset_keymap">Налаштування розкладки скинуто.</string>
<string name="keycombo_announce_shortcut_not_supported">Комбінація клавіш не підтримується</string>
<string name="value_classic_keymap">Класична розкладка</string>
<string name="value_default_keymap">Розкладка за умовчанням</string>
<string name="keycombo_menu_category_navigation">Навігаційні дії</string>
<string name="keycombo_menu_navigate_next">Перейти до наступного пункту</string>
<string name="keycombo_menu_navigate_previous">Перейти до попереднього пункту</string>
<string name="keycombo_menu_navigate_up">Перейти до елемента вище</string>
<string name="keycombo_menu_navigate_down">Перейти до елемента нижче</string>
<string name="keycombo_menu_navigate_first">Перейти до першого пункту</string>
<string name="keycombo_menu_navigate_last">Перейти до останнього пункту</string>
<string name="keycombo_menu_navigate_next_window">Перехід до наступного вікна</string>
<string name="keycombo_menu_navigate_previous_window">Перехід до попереднього вікна</string>
<string name="keycombo_menu_navigate_next_word">Перейти до наступного слова</string>
<string name="keycombo_menu_navigate_previous_word">Перейти до попереднього слова</string>
<string name="keycombo_menu_navigate_next_character">Перейти до наступного символу</string>
<string name="keycombo_menu_navigate_previous_character">Перейти до попереднього символу</string>
<string name="keycombo_menu_perform_click">Натиснути</string>
<string name="keycombo_menu_perform_long_click">Утримати</string>
<string name="keycombo_menu_category_global">Загальні дії</string>
<string name="keycombo_menu_global_back">Назад</string>
<string name="keycombo_menu_global_home">Головний екран</string>
<string name="keycombo_menu_global_recent">Останні додатки</string>
<string name="keycombo_menu_global_notifications">Сповіщення</string>
<string name="keycombo_menu_global_suspend">Призупинити або відновити TalkBack</string>
<string name="keycombo_menu_category_granularity">Навігація</string>
<string name="keycombo_menu_granularity_increase">Наступне налаштування навігації</string>
<string name="keycombo_menu_granularity_decrease">Попереднє налаштування навігації</string>
<string name="keycombo_menu_category_other">Інші дії</string>
<string name="keycombo_menu_other_read_from_top">Переглядати від початку</string>
<string name="keycombo_menu_other_read_from_next_item">Переглядати від наступного пункту</string>
<string name="keycombo_menu_other_toggle_search">Шукати пункт на екрані</string>
<string name="keycombo_menu_other_local_context_menu">Показати локальне контекстне меню</string>
<string name="keycombo_menu_other_global_context_menu">Показати загальне контекстне меню</string>
<string name="keycombo_menu_other_custom_actions">Показати дії</string>
<string name="keycombo_menu_other_language_options">Показати встановлені мови</string>
<string name="keycombo_menu_other_open_manage_keyboard_shortcuts">Керувати комбінаціями клавіш</string>
<string name="keycombo_menu_other_open_talkback_settings">Відкрити налаштування TalkBack</string>
<string name="keycombo_menu_category_web">Навігаційні дії в Інтернеті</string>
<string name="keycombo_menu_web_navigate_to_next_button">Перейти до наступної кнопки</string>
<string name="keycombo_menu_web_navigate_to_previous_button">Перейти до попередньої кнопки</string>
<string name="keycombo_menu_web_navigate_to_next_control">Перейти до наступного елемента керування</string>
<string name="keycombo_menu_web_navigate_to_previous_control">Перейти до попереднього елемента керування</string>
<string name="keycombo_menu_web_navigate_to_next_checkbox">Перейти до наступного прапорця</string>
<string name="keycombo_menu_web_navigate_to_previous_checkbox">Перейти до попереднього прапорця</string>
<string name="keycombo_menu_web_navigate_to_next_aria_landmark">Перейти до наступного орієнтира ARIA</string>
<string name="keycombo_menu_web_navigate_to_previous_aria_landmark">Перейти до попереднього орієнтира ARIA</string>
<string name="keycombo_menu_web_navigate_to_next_edit_field">Перейти до наступного поля редагування</string>
<string name="keycombo_menu_web_navigate_to_previous_edit_field">Перейти до попереднього поля редагування</string>
<string name="keycombo_menu_web_navigate_to_next_focusable_item">Наступний елемент із фокусуванням</string>
<string name="keycombo_menu_web_navigate_to_previous_focusable_item">Попередній елемент із фокусуванням</string>
<string name="keycombo_menu_web_navigate_to_next_graphic">Перейти до наступного зображення</string>
<string name="keycombo_menu_web_navigate_to_previous_graphic">Перейти до попереднього зображення</string>
<string name="keycombo_menu_web_navigate_to_next_heading">Перейти до наступного заголовка</string>
<string name="keycombo_menu_web_navigate_to_previous_heading">Перейти до попереднього заголовка</string>
<string name="keycombo_menu_web_navigate_to_next_heading_1">Перейти до наступного заголовка 1</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_1">Перейти до попереднього заголовка 1</string>
<string name="keycombo_menu_web_navigate_to_next_heading_2">Перейти до наступного заголовка 2</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_2">Перейти до попереднього заголовка 2</string>
<string name="keycombo_menu_web_navigate_to_next_heading_3">Перейти до наступного заголовка 3</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_3">Перейти до попереднього заголовка 3</string>
<string name="keycombo_menu_web_navigate_to_next_heading_4">Перейти до наступного заголовка 4</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_4">Перейти до попереднього заголовка 4</string>
<string name="keycombo_menu_web_navigate_to_next_heading_5">Перейти до наступного заголовка 5</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_5">Перейти до попереднього заголовка 5</string>
<string name="keycombo_menu_web_navigate_to_next_heading_6">Перейти до наступного заголовка 6</string>
<string name="keycombo_menu_web_navigate_to_previous_heading_6">Перейти до попереднього заголовка 6</string>
<string name="keycombo_menu_web_navigate_to_next_list_item">Перейти до наступного пункту списку</string>
<string name="keycombo_menu_web_navigate_to_previous_list_item">Перейти до попереднього пункту списку</string>
<string name="keycombo_menu_web_navigate_to_next_link">Перейти до наступного посилання</string>
<string name="keycombo_menu_web_navigate_to_previous_link">Перейти до попереднього посилання</string>
<string name="keycombo_menu_web_navigate_to_next_list">Перейти до наступного списку</string>
<string name="keycombo_menu_web_navigate_to_previous_list">Перейти до попереднього списку</string>
<string name="keycombo_menu_web_navigate_to_next_table">Перейти до наступної таблиці</string>
<string name="keycombo_menu_web_navigate_to_previous_table">Перейти до попередньої таблиці</string>
<string name="keycombo_menu_web_navigate_to_next_combobox">Перейти до наступного комбінованого вікна</string>
<string name="keycombo_menu_web_navigate_to_previous_combobox">Перейти до попереднього комбінованого вікна</string>
<string name="keycombo_assign_dialog_message">Комбінація клавіш:</string>
<string name="keycombo_assign_dialog_navigation_reminder">Натисніть клавішу Backspace, щоб стерти ярлик, Enter – щоб зберегти елемент, або Escape – щоб скасувати дію.</string>
<string name="keycombo_assign_dialog_clear">Видалити ярлик</string>
<string name="voice_commands_summary">підсумок</string>
<string name="voice_commands_read">читання</string>
<string name="voice_commands_top">угорі</string>
<string name="voice_commands_recent">нещодавні</string>
<string name="voice_commands_edit">змінити</string>
<string name="voice_commands_what">що</string>
<string name="voice_commands_say">казати</string>
<string name="voice_commands_next">далі</string>
<string name="voice_commands_language">мова</string>
<string name="voice_commands_action">дія</string>
<string name="voice_commands_setting">налаштування</string>
<string name="voice_commands_dim_screen">зменшити яскравість</string>
<string name="voice_commands_brighten_screen">збільшити яскравість</string>
<string name="voice_commands_find">Знайти</string>
<string name="voice_commands_find_again">Знайти ще</string>
<string name="voice_commands_next_heading">Наступний заголовок</string>
<string name="voice_commands_not_editable">Неможливо редагувати</string>
<string name="voice_commands_start_select">Вибрати</string>
<string name="voice_commands_finish_select">Завершити вибір</string>
<string name="voice_commands_deselect">Скасувати вибір</string>
<string name="voice_commands_dictate">Диктувати</string>
<string name="voice_commands_assistant">Асистент</string>
<string name="voice_commands_possible_options_title">Можна сказати…</string>
<string name="voice_commands_no_action">Голосова команда не підтримується</string>
<string name="voice_commands_no_mic_permissions">Щоб скористатися цією функцією, потрібно надати дозвіл на використання мікрофона.</string>
<string name="voice_commands_no_voice_recognition_ability">Ця функція недоступна на вашому пристрої</string>
<string name="voice_commands_error">Помилка розпізнавання голосової команди</string>
<string name="voice_commands_partial_result">Голосові команди не розпізнано. Скажіть \"%1$s\", щоб переглянути список доступних команд.</string>
<string name="voice_commands_many_requests">Повторіть спробу за кілька хвилин</string>
<string name="message_in_reset_keymap_confirm_dialog">Відновити значення клавіш швидкого доступу за умовчанням для цієї розкладки? Цю дію не можна відмінити.</string>
<string name="reset_button_in_reset_keymap_confirm_dialog">Скинути</string>
<string name="override_keycombo">Комбінація вже використовується</string>
<string name="override_keycombo_message_two_params">Ви вибрали цю комбінацію клавіш для дії \"%1$s\". Скасувати та призначити цю комбінацію для дії \"%2$s\"?</string>
<string name="title_pref_intonation">Змінювати тон під час озвучування</string>
<string name="title_pref_keyboard_echo">Озвучення натиснених клавіш</string>
<string name="pref_node_desc_order_title">Порядок опису елементів</string>
<string name="summaryOn_pref_intonation">Відтворювати введений за допомогою клавіатури текст із меншою висотою звуку</string>
<string name="summaryOff_pref_intonation">Не змінювати висоту звуку під час мовлення</string>
<string name="title_pref_category_feedback_settings">Інші сигнали</string>
<string name="title_pref_vibration">Вібровідгук</string>
<string name="title_pref_soundback">Звуковий відгук</string>
<string name="title_pref_use_audio_focus">Зменшення гучності аудіо</string>
<string name="summary_pref_use_audio_focus">Зменшувати гучність інших додатків під час роботи TalkBack</string>
<string name="title_pref_soundback_volume">Гучність звукового сигналу</string>
<string name="title_pref_two_volume_button_long_click">Призупиняти та відновлювати Talkback комбінацією клавіш</string>
<string name="title_pref_dim_volume_three_clicks">Комбінація для затемнення</string>
<string name="title_pref_category_miscellaneous_settings">Інше</string>
<string name="title_pref_category_developer_settings">Налаштування розробника</string>
<string name="title_activity_dump_a11y_event">Вибирати, які події внести в журнал</string>
<string name="title_pref_dump_a11y_event">Фільтрувати події спеціальних можливостей під час внесення в журнал</string>
<string name="pref_reduce_window_delay_title">Зменшити затримку під час озвучування заголовків</string>
<string name="title_pref_log_level">Рівень виводу журналу</string>
<string name="title_pref_tts_overlay">Показувати результат мовлення</string>
<string name="title_pref_tree_debug">Увімкнути налагодження дерева вузлів</string>
<string name="summary_pref_tree_debug_tv">Використовувати клавішу голосового пошуку, щоб друкувати дерево вузлів</string>
<string name="title_pref_performance_stats">Увімкнути статистику продуктивності</string>
<string name="title_pref_resume_talkback">Відновити після призупинення</string>
<string name="screen_dimmed">Яскравість екрана зменшено</string>
<string name="screen_brightness_restored">Яскравість екрана відновлено</string>
<string name="screen_dimming_exit_instruction_line1">Сервіс спеціальних можливостей TalkBack зменшує яскравість екрана</string>
<string name="screen_dimming_exit_instruction_line2">Проведіть пальцем %1$s, щоб відкрити глобальне контекстне меню, виділіть опцію \"%2$s\" і двічі торкніться її.</string>
<string name="shortcut_unassigned">Не призначено</string>
<string name="shortcut_next">Далі</string>
<string name="shortcut_previous">Назад</string>
<string name="shortcut_scroll_forward">Прокрутити вперед</string>
<string name="shortcut_scroll_back">Прокрутити назад</string>
<string name="shortcut_back">Кнопка \"Назад\"</string>
<string name="shortcut_home">Кнопка \"Головний екран\"</string>
<string name="shortcut_overview">Кнопка огляду</string>
<string name="shortcut_notifications">Відкрити сповіщення</string>
<string name="shortcut_quick_settings">Відкрити вікно швидких налаштувань</string>
<string name="shortcut_show_custom_actions">Показати дії</string>
<string name="shortcut_editing">Показати параметри редагування</string>
<string name="shortcut_talkback_breakout">Відкрити глобальне контекстне меню</string>
<string name="shortcut_local_breakout">Відкрити локальне контекстне меню</string>
<string name="shortcut_repeat_last_utterance">Повторити останнє висловлювання</string>
<string name="shortcut_spell_last_utterance">Вимовити останнє висловлювання</string>
<string name="shortcut_copy_last_utterance_to_clipboard">Скопіювати останню фразу в буфер обміну</string>
<string name="shortcut_pause_feedback">Призупинити голосові підказки</string>
<string name="shortcut_read_from_top">Читати від початку</string>
<string name="shortcut_read_from_current">Читати від наступного елемента</string>
<string name="shortcut_print_node_tree">Друкувати дерево вузлів</string>
<string name="shortcut_print_performance_stats">Друкувати статистику продуктивності</string>
<string name="shortcut_next_granularity">Наступне налаштування навігації</string>
<string name="shortcut_previous_granularity">Попереднє налаштування навігації</string>
<string name="shortcut_first_in_screen">Перейти до першого елемента на екрані</string>
<string name="shortcut_summary">Підсумувати вигляд на екрані</string>
<string name="shortcut_voice_commands">Розпочати використання голосових команд</string>
<string name="shortcut_last_in_screen">Перейти до останнього елемента на екрані</string>
<string name="shortcut_enable_dimming">Затемнювати дисплей</string>
<string name="shortcut_disable_dimming">Збільшити яскравість екрана</string>
<string name="shortcut_perform_click_action">Натиснути</string>
<string name="local_context_menu_title">Локальне контекстне меню</string>
<string name="global_context_menu_title">Глобальне контекстне меню</string>
<string name="shortcut_show_language_options">Показати встановлені мови</string>
<string name="shortcut_select_next_setting">Вибрати наступне налаштування</string>
<string name="shortcut_select_previous_setting">Вибрати попереднє налаштування</string>
<string name="shortcut_selected_setting_next_action">Наступна дія для вибраного налаштування</string>
<string name="shortcut_selected_setting_previous_action">Попередня дія для вибраного налаштування</string>
<string name="shortcut_perform_screen_search">Пошук на екрані</string>
<string name="label_screen_search_result">Результат пошуку</string>
<string name="title_local_breakout_no_items">Немає пунктів меню.</string>
<string name="title_web_breakout_next_section">Наступний розділ</string>
<string name="title_web_breakout_next_list">Наступний список</string>
<string name="title_web_breakout_next_control">Наступний елемент керування</string>
<string name="title_web_breakout_prev_section">Попередній розділ</string>
<string name="title_web_breakout_prev_list">Попередній список</string>
<string name="title_web_breakout_prev_control">Попередній елемент керування</string>
<string name="title_edittext_controls">Редагувати параметри</string>
<string name="title_edittext_breakout_move_to_beginning">Перемістити курсор на початок</string>
<string name="title_edittext_breakout_move_to_end">Перемістити курсор у кінець</string>
<string name="title_edittext_breakout_start_selection_mode">Початок режиму вибору</string>
<string name="title_edittext_breakout_end_selection_mode">Кінець режиму вибору</string>
<string name="title_viewpager_controls">Навігація сторінкою</string>
<string name="title_viewpager_breakout_next_page">Наступна сторінка</string>
<string name="title_viewpager_breakout_prev_page">Попередня сторінка</string>
<string name="title_viewpager_breakout_page_up">На сторінку вгору</string>
<string name="title_viewpager_breakout_page_down">На сторінку вниз</string>
<string name="title_viewpager_breakout_page_left">На сторінку ліворуч</string>
<string name="title_viewpager_breakout_page_right">На сторінку праворуч</string>
<string name="title_labeling_controls">Мітки</string>
<string name="title_summary">Швидка навігація</string>
<string name="title_granularity">Навігація</string>
<string name="title_custom_action">Дії</string>
<string name="title_suggestions_controls">Пропозиції автозавершення</string>
<string name="title_suggestions_breakout_suggestions">Перейти до пропозицій</string>
<string name="title_suggestions_breakout_anchor">Назад у поле редагування</string>
<string name="title_seek_bar_controls">Керування пошуком</string>
<string name="title_seek_bar_edit">Змінити рівень керування пошуком</string>
<string name="value_seek_bar_dialog_instructions">Введіть число від 0 до 100.</string>
<string name="value_seek_bar_dialog_percent">%</string>
<string name="value_direction_up">угору</string>
<string name="value_direction_down">униз</string>
<string name="value_direction_left">ліворуч</string>
<string name="value_direction_right">праворуч</string>
<string name="value_direction_up_and_down">угору, а потім униз</string>
<string name="value_direction_down_and_up">униз, а потім угору</string>
<string name="value_direction_right_and_left">праворуч, а потім ліворуч</string>
<string name="value_direction_left_and_right">ліворуч, а потім праворуч</string>
<string name="value_direction_down_and_left">униз, а потім ліворуч</string>
<string name="value_direction_down_and_right">униз, а потім праворуч</string>
<string name="value_direction_up_and_left">угору, а потім ліворуч</string>
<string name="value_direction_up_and_right">угору, а потім праворуч</string>
<string name="value_direction_right_and_down">праворуч, а потім униз</string>
<string name="value_direction_right_and_up">праворуч, а потім угору</string>
<string name="value_direction_left_and_down">ліворуч, а потім униз</string>
<string name="value_direction_left_and_up">ліворуч, а потім угору</string>
<string name="title_pref_shortcut_up">Провести пальцем угору</string>
<string name="title_pref_shortcut_down">Провести пальцем униз</string>
<string name="title_pref_shortcut_left">Провести пальцем ліворуч</string>
<string name="title_pref_shortcut_right">Провести пальцем праворуч</string>
<string name="title_pref_shortcut_up_and_down">Провести пальцем угору, потім униз</string>
<string name="title_pref_shortcut_down_and_up">Провести пальцем униз, потім угору</string>
<string name="title_pref_shortcut_left_and_right">Провести пальцем ліворуч, потім праворуч</string>
<string name="title_pref_shortcut_right_and_left">Провести пальцем праворуч, потім ліворуч</string>
<string name="title_pref_shortcut_down_and_left">Проведіть пальцем униз, потім ліворуч</string>
<string name="title_pref_shortcut_down_and_right">Проведіть пальцем униз, потім праворуч</string>
<string name="title_pref_shortcut_up_and_left">Проведіть пальцем угору, потім ліворуч</string>
<string name="title_pref_shortcut_up_and_right">Проведіть пальцем угору, потім праворуч</string>
<string name="title_pref_shortcut_right_and_down">Проведіть пальцем праворуч, потім униз</string>
<string name="title_pref_shortcut_right_and_up">Проведіть пальцем праворуч, потім угору</string>
<string name="title_pref_shortcut_left_and_down">Проведіть пальцем ліворуч, потім униз</string>
<string name="title_pref_shortcut_left_and_up">Проведіть пальцем ліворуч, потім угору</string>
<string name="title_pref_shortcut_fingerprint_up">Провести вгору на сканері відбитків пальців</string>
<string name="title_pref_shortcut_fingerprint_down">Провести вниз на сканері відбитків пальців</string>
<string name="title_pref_shortcut_fingerprint_left">Провести вліво на сканері відбитків пальців</string>
<string name="title_pref_shortcut_fingerprint_right">Провести вправо на сканері відбитків пальців</string>
<string name="title_pref_two_part_vertical_gestures">Вертикальні жести з двох рухів</string>
<string formatted="false" name="value_volume_100_percent">На рівні гучності звуку</string>
<string formatted="false" name="value_volume_75_percent">75% гучності звуку</string>
<string formatted="false" name="value_volume_50_percent">50% гучності звуку</string>
<string formatted="false" name="value_volume_25_percent">25% гучності звуку</string>
<string name="value_resume_screen_on">Коли вмикається екран</string>
<string name="value_resume_keyguard">Коли відображається екран блокування</string>
<string name="value_resume_manual">Лише на панелі сповіщень</string>
<string name="value_shake_to_read_disabled">Вимкнено</string>
<string name="value_shake_to_read_threshold_very_light">Дуже легко</string>
<string name="value_shake_to_read_threshold_light">Легко</string>
<string name="value_shake_to_read_threshold_medium">Не дуже сильно</string>
<string name="value_shake_to_read_threshold_hard">Сильно</string>
<string name="value_shake_to_read_threshold_very_hard">Дуже сильно</string>
<string name="value_keyboard_echo_always">Завжди озвучувати натиснені клавіші</string>
<string name="value_keyboard_echo_softkeys">Лише для екранної клавіатури</string>
<string name="value_keyboard_echo_never">Ніколи не озвучувати натиснені клавіші</string>
<string name="pref_node_desc_order_entry_state_name_role_pos">Стан, назва, тип</string>
<string name="pref_node_desc_order_entry_role_name_state_pos">Тип, назва, стан</string>
<string name="pref_node_desc_order_entry_name_role_state_pos">Назва, тип, стан</string>
<string name="notification_title_talkback_gestures_changed">Жести TalkBack змінено</string>
<string name="notification_message_talkback_gestures_changed">Торкніться, щоб переглянути зміни в жестах доступності</string>
<string name="notification_title_talkback_suspended">TalkBack призупинено</string>
<string name="notification_message_talkback_suspended">Торкніться, щоб відновити</string>
<string name="notification_tutorial_navigate_to_lession_1">Автоматичний перехід до 1 уроку.</string>
<string name="dialog_title_suspend_talkback">Призупинити TalkBack?</string>
<string name="dialog_message_suspend_talkback">Призупинити TalkBack?\n\nВаш пристрій не надаватиме голосові підказки, а функцію дослідження дотиком буде вимкнено.</string>
<string name="message_resume_manual">Відновити TalkBack можна на панелі сповіщень</string>
<string name="message_resume_screen_on">Відновити TalkBack можна на панелі сповіщень або ввімкнувши екран</string>
<string name="message_resume_keyguard">Відновити TalkBack можна на панелі сповіщень або повернувшись на заблокований екран</string>
<string name="show_suspend_warning_label">Завжди показувати це застереження</string>
<string name="cannot_add_label">Неможливо позначити цей елемент.</string>
<string name="label_dialog_title_add">Додавання мітки</string>
<string name="label_dialog_title_edit">Редагування мітки</string>
<string name="label_dialog_title_remove">Видалення мітки</string>
<string name="label_dialog_text">Введіть текст, який буде міткою \nвнутрішньої назви елемента: %1$s</string>
<string name="label_remove_dialog_text">Видалити мітку \"%1$s\"?</string>
<string name="label_remove_dialog_text_app_name">Видалити мітку \"%1$s\" з додатка %2$s?</string>
<string name="label_dialog_edit_hint">Текст мітки</string>
<string name="label_import">Імпортувати спеціальні мітки</string>
<string name="label_import_dialog_title">Імпортувати спеціальні мітки в TalkBack</string>
<string name="label_import_dialog_message">Виберіть, що робити у випадку конфлікту: замінити чи залишити наявні мітки</string>
<string name="label_import_dialog_skip">Залишити</string>
<string name="label_import_dialog_override">Замінити</string>
<string name="label_export_empty">Немає що експортувати. Ви не додали міток</string>
<string name="label_export_failed">Мітку не експортовано</string>
<string name="label_import_failed">Мітку не імпортовано</string>
<plurals name="label_import_succeeded">
<item quantity="one">Оновлено %d мітку</item>
<item quantity="few">Оновлено %d мітки</item>
<item quantity="many">Оновлено %d міток</item>
<item quantity="other">Оновлено %d мітки</item>
</plurals>
<string name="no_apps_to_import_labels">Немає додатків для імпорту міток</string>
<string name="no_apps_to_export_labels">Немає додатків для експорту міток.</string>
<string name="label_choose_app_to_import">Виберіть додаток для імпорту міток.</string>
<string name="label_choose_app_to_export">Виберіть, у який додаток експортувати мітки:</string>
<string name="talkback_gesture_change_details">У цій версії TalkBack змінено жести доступності за умовчанням. Дії, пов’язані з цими жестами, можна вказати в налаштуваннях TalkBack. Якщо функцію дослідження дотиком увімкнено, можна виконувати певні дії за допомогою вказаних нижче жестів.\n\n%1$s</string>
<string formatted="false" name="value_long_volume_pressed_suspend_talkback">Натисніть і утримуйте кнопки збільшення та зменшення гучності</string>
<string formatted="false" name="value_dim_volume_three_clicks">Швидко натисніть обидві клавіші гучності, щоб увімкнути або вимкнути затемнення дисплея</string>
<string name="dialog_title_dim_screen">Зменшити яскравість екрана?</string>
<string name="dialog_message_dim_screen">Зменшити яскравість екрана?</string>
<string name="talkback_built_in_gesture_change_details">У цій версії TalkBack змінено жести доступності за умовчанням.\n\nРух пальцем \"угору, а потім униз\" дає змогу перейти до першого елемента на екрані, а рух пальцем \"униз, а потім угору\" – до останнього елемента.\n\nТепер, щоб змінити деталізацію читання, потрібно перейти до елемента й вибрати деталізацію в локальному контекстному меню.\n\nДії, які відповідають цим жестам, можна змінити в налаштуваннях TalkBack.</string>
<string name="talkback_built_in_gesture_change_details_45">У цій версії TalkBack змінено стандартні жести спеціальних можливостей.\n\nТепер за допомогою жесту вгору можна перейти до попереднього налаштування навігації, а за допомогою жесту вниз – до наступного.</string>
<string name="side_tap_shortcuts_removed_details">Наведені нижче параметри вилучено з TalkBack через ненадійну роботу.\n• Жести \"Торкніться краю пристрою\"\n• Струсити, щоб читати</string>
<string name="button_accept_changed_gesture_mappings">Прийняти жести</string>
<string name="button_customize_gesture_mappings">Налаштувати жести</string>
<string name="button_disable_all_events">Вимкнути всі</string>
<string name="button_enable_all_events">Увімкнути всі</string>
<string name="dialog_title_disable_exploration">Вимкнути функцію дослідження дотиком?</string>
<string name="dialog_message_disable_exploration">Вимкнути функцію дослідження дотиком?\n\nВаш пристрій більше не реагуватиме на жести чи диктування, коли ви торкатиметесь екрана.</string>
<string name="dialog_title_enable_tree_debug">Увімкнути налагодження дерева вузлів?</string>
<string name="dialog_message_enable_tree_debug">Увімкнути налагодження дерева вузлів?\n\nНалагодження дерева вузлів відкриває вміст вашого екрана для журналів пристрою, які можуть бути зчитані іншими додатками.</string>
<string name="dialog_title_enable_performance_stats">Увімкнути статистику продуктивності?</string>
<string name="dialog_message_enable_performance_stats">Увімкнути статистику продуктивності? \n\n Вона може споживати більше пам’яті та заряду акумулятора.</string>
<string name="label_talkback_context_menu">Глобальне контекстне меню TalkBack</string>
<string name="permission_talkback_label">Керування TalkBack</string>
<string name="permission_talkback_desc">Дозвіл на надсилання жестів у TalkBack і відновлення голосових підказок.</string>
<string name="permission_labeling_label">Керування спеціальними мітками TalkBack</string>
<string name="permission_labeling_desc">Дозвіл на доступ до спеціальних міток, продиктованих TalkBack, а також їх змінення та видалення.</string>
<string name="links">Посилання</string>
<string name="end_of_text">Кінець</string>
<string name="start_of_page">Немає такого попереднього елемента: %1$s</string>
<string name="end_of_page">Немає такого наступного елемента: %1$s</string>
<string name="display_name_heading">заголовок</string>
<string name="display_name_button">кнопка</string>
<string name="display_name_combobox">комбіноване вікно</string>
<string name="display_name_aria_landmark">Орієнтир ARIA</string>
<string name="display_name_edit_field">поле редагування</string>
<string name="display_name_focusable_item">інтерактивний елемент</string>
<string name="display_name_heading_1">заголовок 1</string>
<string name="display_name_heading_2">заголовок 2</string>
<string name="display_name_heading_3">заголовок 3</string>
<string name="display_name_heading_4">заголовок 4</string>
<string name="display_name_heading_5">заголовок 5</string>
<string name="display_name_heading_6">заголовок 6</string>
<string name="display_name_link">посилання</string>
<string name="display_name_control">елемент керування</string>
<string name="display_name_graphic">графічний об’єкт</string>
<string name="display_name_list_item">пункт списку</string>
<string name="display_name_list">список</string>
<string name="display_name_table">таблиця</string>
<string name="display_name_checkbox">прапорець</string>
<string name="item_index_template">Пункт %1$d</string>
<string name="revert_imported_labels">Замінити імпортовані мітки на попередні</string>
<string name="imported_labels_reverted">Імпортовані мітки замінено на попередні</string>
<string name="template_window_switch_application">%1$s</string>
<string name="template_window_switch_system">%1$s</string>
<string name="status_bar">рядок стану</string>
<string name="navigation_bar">панель навігації</string>
<plurals name="template_dump_event_count">
<item quantity="one">Вибрано %1$d подію</item>
<item quantity="few">Вибрано %1$d події</item>
<item quantity="many">Вибрано %1$d подій</item>
<item quantity="other">Вибрано %1$d події</item>
</plurals>
<string name="template_tv_remote_mode_started">%1$s увімкнено</string>
<string name="template_tv_remote_mode_ended">%1$s вимкнено</string>
<string name="value_tv_remote_mode_seek_control">Режим керування пошуком</string>
<string name="value_hint_tv_remote_mode_seek_control">Натискайте кнопки зі стрілками, щоб змінити значення, або \"Вибрати\", щоб завершити.</string>
<string name="arc_android_window">Вікно додатка</string>
<string name="arc_talkback_activation_hint">TalkBack увімкнено</string>
<string name="arc_navigation_hint">Для навігації натисніть клавішу Search і клавіші зі стрілками</string>
<string name="arc_open_manage_keyboard_shortcuts_hint">Натисніть %1$s, щоб побачити список комбінацій клавіш</string>
<string name="arc_open_talkback_settings_hint">Щоб відкрити налаштування TalkBack, натисніть %1$s</string>
<string name="reset_user_language_preference">Скинути</string>
<string name="title_pref_selector_settings">Інструмент вибору</string>
<string name="title_pref_selector_activation">Активація інструмента вибору</string>
<string name="title_pref_category_selector_settings_configuration">Налаштувати параметри</string>
<string name="title_pref_selector_speech_rate">Темп мовлення</string>
<string name="title_pref_selector_verbosity">Деталізація</string>
<string name="title_pref_selector_granularity">Навігація</string>
<string name="title_pref_selector_audio_focus">Зменшення гучності аудіо</string>
<string name="pref_selector_activation_summary">Щоб вибрати налаштування, проведіть пальцем угору та вниз по сканеру відбитків пальців. Щоб змінити значення налаштування, проведіть пальцем угору та вниз по екрану</string>
<string name="title_pref_speak_passwords_without_headphones">Озвучувати паролі</string>
<string name="summaryOn_pref_speak_passwords_without_headphones">Паролі завжди озвучуються</string>
<string name="template_text_copied">скопійовано: %1$s</string>
<string name="value_location_left">ліворуч</string>
<string name="value_location_right">праворуч</string>
<string name="value_location_top">угорі</string>
<string name="value_location_bottom">унизу</string>
<string name="value_location_center">в центрі</string>
<string name="value_location_top_left">угорі ліворуч</string>
<string name="value_location_top_right">угорі праворуч</string>
<string name="value_location_bottom_left">унизу ліворуч</string>
<string name="value_location_bottom_right">унизу праворуч</string>
<string name="title_screen_summary">Підсумок екрана</string>
<string name="title_cancel_button">Закрити</string>
<string name="title_cancel_screen_search">Закрити пошук</string>
<string name="title_clear_keyword">Видалити введене</string>
<string name="title_previous_screen">Попередній екран</string>
<string name="title_next_screen">Наступний екран</string>
<plurals name="msg_matches_found">
<item quantity="one">%1$d збіг</item>
<item quantity="few">%1$d збіги</item>
<item quantity="many">%1$d збігів</item>
<item quantity="other">%1$d збігу</item>
</plurals>
<string name="msg_no_matches">На цьому екрані збігів немає</string>
<string name="dialog_title_continuous_reading_mode">Нові елементи безперервного читання</string>
<string name="dialog_message_continuous_reading_mode">Вибравши опцію \"Читати від початку\" або \"Читати від наступного елемента\", ви можете переходити до попереднього або наступного елемента під час читання тексту. Це допомагає з легкістю повернутися назад або перейти вперед.</string>
<string name="always_show_this_message_label">Завжди показувати це повідомлення</string>
<string name="dialog_title_voice_commands">Використання голосових команд TalkBack</string>
<string name="dialog_message_voice_commands">Керуйте TalkBack голосом.\nЩоб побачити список доступних голосових команд, скажіть \"Довідка\" або \"Що я можу сказати?\" під час голосового запиту.</string>
<string name="hint_type_search_term">Введіть пошуковий термін</string>
<string name="talkback_notification_channel_name">TalkBack</string>
<string name="talkback_notification_channel_description">Канал сповіщень TalkBack</string>
</resources>
| {
"pile_set_name": "Github"
} |
// leave this as first line for PCH reasons...
//
//Anything above this #include will be ignored by the compiler
#include "../qcommon/exe_headers.h"
#if !defined(TR_LOCAL_H)
#include "../renderer/tr_local.h"
#endif
#if !defined(G2_H_INC)
#include "G2.h"
#endif
#include "G2_local.h"
#pragma warning(disable : 4512) //assignment op could not be genereated
class CConstructBoneList
{
public:
int surfaceNum;
int *boneUsedList;
surfaceInfo_v &rootSList;
model_t *currentModel;
boneInfo_v &boneList;
CConstructBoneList(
int initsurfaceNum,
int *initboneUsedList,
surfaceInfo_v &initrootSList,
model_t *initcurrentModel,
boneInfo_v &initboneList):
surfaceNum(initsurfaceNum),
boneUsedList(initboneUsedList),
rootSList(initrootSList),
currentModel(initcurrentModel),
boneList(initboneList) { }
};
extern void G2_ConstructUsedBoneList(CConstructBoneList &CBL);
//=====================================================================================================================
// Surface List handling routines - so entities can determine what surfaces attached to a model are operational or not.
// find a particular surface in the surface override list
surfaceInfo_t *G2_FindOverrideSurface(int surfaceNum, surfaceInfo_v &surfaceList)
{
int i;
// look through entire list
for(i=0; i<surfaceList.size(); i++)
{
if (surfaceList[i].surface == surfaceNum)
{
return &surfaceList[i];
}
}
// didn't find it.
return NULL;
}
// given a surface name, lets see if it's legal in the model
int G2_IsSurfaceLegal(void *mod, const char *surfaceName, int *flags)
{
// damn include file dependancies
mdxmSurfHierarchy_t *surf;
model_t *mod_m = (model_t *)mod;
surf = (mdxmSurfHierarchy_t *) ( (byte *)mod_m->mdxm + mod_m->mdxm->ofsSurfHierarchy );
for ( int i = 0 ; i < mod_m->mdxm->numSurfaces ; i++)
{
if (!stricmp(surfaceName, surf->name))
{
*flags = surf->flags;
return i;
}
// find the next surface
surf = (mdxmSurfHierarchy_t *)( (byte *)surf + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surf->numChildren ] ));
}
return -1;
}
/************************************************************************************************
* G2_FindSurface
* find a surface in a ghoul2 surface override list based on it's name
*
* Input
* filename of model, surface list of model instance, name of surface, int to be filled in
* with the index of this surface (defaults to NULL)
*
* Output
* pointer to surface if successful, false otherwise
*
************************************************************************************************/
mdxmSurface_t *G2_FindSurface(CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *surfaceName,
int *surfIndex/*NULL*/)
{
int i = 0;
// find the model we want
model_t *mod = (model_t *)ghlInfo->currentModel;
mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)mod->mdxm + sizeof(mdxmHeader_t));
mdxmSurfHierarchy_t *surfInfo;
// did we find a ghoul 2 model or not?
if (!mod->mdxm)
{
assert(0);
if (surfIndex)
{
*surfIndex = -1;
}
return 0;
}
// first find if we already have this surface in the list
for (i = slist.size() - 1; i >= 0; i--)
{
if ((slist[i].surface != 10000) && (slist[i].surface != -1))
{
mdxmSurface_t *surf = (mdxmSurface_t *)G2_FindSurface((void *)mod, slist[i].surface, 0);
// back track and get the surfinfo struct for this surface
surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surf->thisSurfaceIndex]);
// are these the droids we're looking for?
if (!stricmp (surfInfo->name, surfaceName))
{
// yup
if (surfIndex)
{
*surfIndex = i;
}
return surf;
}
}
}
// didn't find it
if (surfIndex)
{
*surfIndex = -1;
}
return 0;
}
// set a named surface offFlags - if it doesn't find a surface with this name in the list then it will add one.
qboolean G2_SetSurfaceOnOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *surfaceName, const int offFlags)
{
int surfIndex = -1;
surfaceInfo_t temp_slist_entry;
mdxmSurface_t *surf;
// find the model we want
model_t *mod = (model_t *)ghlInfo->currentModel;
// did we find a ghoul 2 model or not?
if (!mod->mdxm)
{
assert(0);
return qfalse;
}
// first find if we already have this surface in the list
surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex);
if (surf)
{
// set descendants value
// slist[surfIndex].offFlags = offFlags;
// seems to me that we shouldn't overwrite the other flags.
// the only bit we really care about in the incoming flags is the off bit
slist[surfIndex].offFlags &= ~(G2SURFACEFLAG_OFF | G2SURFACEFLAG_NODESCENDANTS);
slist[surfIndex].offFlags |= offFlags & (G2SURFACEFLAG_OFF | G2SURFACEFLAG_NODESCENDANTS);
return qtrue;
}
else
{
// ok, not in the list already - in that case, lets verify this surface exists in the model mesh
int flags;
int surfaceNum = G2_IsSurfaceLegal((void*)mod, surfaceName, &flags);
if (surfaceNum != -1)
{
int newflags = flags;
// the only bit we really care about in the incoming flags is the off bit
newflags &= ~(G2SURFACEFLAG_OFF | G2SURFACEFLAG_NODESCENDANTS);
newflags |= offFlags & (G2SURFACEFLAG_OFF | G2SURFACEFLAG_NODESCENDANTS);
if (newflags != flags)
{ // insert here then because it changed, no need to add an override otherwise
temp_slist_entry.offFlags = newflags;
temp_slist_entry.surface = surfaceNum;
slist.push_back(temp_slist_entry);
}
return qtrue;
}
}
return qfalse;
}
void G2_SetSurfaceOnOffFromSkin (CGhoul2Info *ghlInfo, qhandle_t renderSkin)
{
int j;
const skin_t *skin = R_GetSkinByHandle( renderSkin );
ghlInfo->mSlist.clear(); //remove any overrides we had before.
ghlInfo->mMeshFrameNum = 0;
for ( j = 0 ; j < skin->numSurfaces ; j++ )
{
// the names have both been lowercased
if ( !strcmp( skin->surfaces[j]->shader->name , "*off") )
{
G2_SetSurfaceOnOff(ghlInfo, ghlInfo->mSlist, skin->surfaces[j]->name, G2SURFACEFLAG_OFF);
}
else
{
int flags;
int surfaceNum = G2_IsSurfaceLegal((void *)ghlInfo->currentModel, skin->surfaces[j]->name, &flags);
if ( (surfaceNum != -1) && (!(flags&G2SURFACEFLAG_OFF)) ) //only turn on if it's not an "_off" surface
{
G2_SetSurfaceOnOff(ghlInfo, ghlInfo->mSlist, skin->surfaces[j]->name, 0);
}
}
}
}
// return a named surfaces off flags - should tell you if this surface is on or off.
int G2_IsSurfaceOff (CGhoul2Info *ghlInfo, surfaceInfo_v &slist, const char *surfaceName)
{
model_t *mod = (model_t *)ghlInfo->currentModel;
int surfIndex = -1;
mdxmSurface_t *surf = 0;
// did we find a ghoul 2 model or not?
if (!mod->mdxm)
{
return 0;
}
// first find if we already have this surface in the list
surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex);
if (surf)
{
// set descendants value
return slist[surfIndex].offFlags;
}
// ok, we didn't find it in the surface list. Lets look at the original surface then.
mdxmSurfHierarchy_t *surface = (mdxmSurfHierarchy_t *) ( (byte *)mod->mdxm + mod->mdxm->ofsSurfHierarchy );
for ( int i = 0 ; i < mod->mdxm->numSurfaces ; i++)
{
if (!stricmp(surfaceName, surface->name))
{
return surface->flags;
}
// find the next surface
surface = (mdxmSurfHierarchy_t *)( (byte *)surface + (int)( &((mdxmSurfHierarchy_t *)0)->childIndexes[ surface->numChildren ] ));
}
assert(0);
return 0;
}
void G2_FindRecursiveSurface(model_t *currentModel, int surfaceNum, surfaceInfo_v &rootList, int *activeSurfaces)
{
int i;
mdxmSurface_t *surface = (mdxmSurface_t *)G2_FindSurface((void *)currentModel, surfaceNum, 0);
mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)currentModel->mdxm + sizeof(mdxmHeader_t));
mdxmSurfHierarchy_t *surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surface->thisSurfaceIndex]);
// see if we have an override surface in the surface list
surfaceInfo_t *surfOverride = G2_FindOverrideSurface(surfaceNum, rootList);
// really, we should use the default flags for this surface unless it's been overriden
int offFlags = surfInfo->flags;
// set the off flags if we have some
if (surfOverride)
{
offFlags = surfOverride->offFlags;
}
// if this surface is not off, indicate as such in the active surface list
if (!(offFlags & G2SURFACEFLAG_OFF))
{
activeSurfaces[surfaceNum] = 1;
}
else
// if we are turning off all descendants, then stop this recursion now
if (offFlags & G2SURFACEFLAG_NODESCENDANTS)
{
return;
}
// now recursively call for the children
for (i=0; i< surfInfo->numChildren; i++)
{
surfaceNum = surfInfo->childIndexes[i];
G2_FindRecursiveSurface(currentModel, surfaceNum, rootList, activeSurfaces);
}
}
void G2_RemoveRedundantGeneratedSurfaces(surfaceInfo_v &slist, int *activeSurfaces)
{
int i;
// walk the surface list, removing surface overrides or generated surfaces that are pointing at surfaces that aren't active anymore
for (i=0; i<slist.size(); i++)
{
if (slist[i].surface != -1)
{
// is this a generated surface?
if (slist[i].offFlags & G2SURFACEFLAG_GENERATED)
{
// if it's not in the list, remove it
if (!activeSurfaces[slist[i].genPolySurfaceIndex & 0xffff])
{
G2_RemoveSurface(slist, i);
}
}
// no, so it does point back at a legal surface
else
{
// if it's not in the list, remove it
if (!activeSurfaces[slist[i].surface])
{
G2_RemoveSurface(slist, i);
}
}
}
}
}
qboolean G2_SetRootSurface(CGhoul2Info_v &ghoul2, const int modelIndex, const char *surfaceName)
{
int surf;
int flags;
int *activeSurfaces, *activeBones;
assert(ghoul2[modelIndex].currentModel && ghoul2[modelIndex].animModel);
model_t *mod_m = (model_t *)ghoul2[modelIndex].currentModel;
model_t *mod_a = (model_t *)ghoul2[modelIndex].animModel;
// did we find a ghoul 2 model or not?
if (!mod_m->mdxm)
{
return qfalse;
}
// first find if we already have this surface in the list
surf = G2_IsSurfaceLegal(mod_m, surfaceName, &flags);
if (surf != -1)
{
// first see if this ghoul2 model already has this as a root surface
if (ghoul2[modelIndex].mSurfaceRoot == surf)
{
return qtrue;
}
// set the root surface
ghoul2[modelIndex].mSurfaceRoot = surf;
// ok, now the tricky bits.
// firstly, generate a list of active / on surfaces below the root point
// gimme some space to put this list into
activeSurfaces = (int *)Z_Malloc(mod_m->mdxm->numSurfaces * 4, TAG_GHOUL2, qtrue);
memset(activeSurfaces, 0, (mod_m->mdxm->numSurfaces * 4));
activeBones = (int *)Z_Malloc(mod_a->mdxa->numBones * 4, TAG_GHOUL2, qtrue);
memset(activeBones, 0, (mod_a->mdxa->numBones * 4));
G2_FindRecursiveSurface(mod_m, surf, ghoul2[modelIndex].mSlist, activeSurfaces);
// now generate the used bone list
CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot,
activeBones,
ghoul2[modelIndex].mSlist,
mod_m,
ghoul2[modelIndex].mBlist);
G2_ConstructUsedBoneList(CBL);
// now remove all procedural or override surfaces that refer to surfaces that arent on this list
G2_RemoveRedundantGeneratedSurfaces(ghoul2[modelIndex].mSlist, activeSurfaces);
// now remove all bones that are pointing at bones that aren't active
G2_RemoveRedundantBoneOverrides(ghoul2[modelIndex].mBlist, activeBones);
// then remove all bolts that point at surfaces or bones that *arent* active.
G2_RemoveRedundantBolts(ghoul2[modelIndex].mBltlist, ghoul2[modelIndex].mSlist, activeSurfaces, activeBones);
// then remove all models on this ghoul2 instance that use those bolts that are being removed.
for (int i=0; i<ghoul2.size(); i++)
{
// are we even bolted to anything?
if (ghoul2[i].mModelBoltLink != -1)
{
int boltMod = (ghoul2[i].mModelBoltLink >> MODEL_SHIFT) & MODEL_AND;
int boltNum = (ghoul2[i].mModelBoltLink >> BOLT_SHIFT) & BOLT_AND;
// if either the bolt list is too small, or the bolt we are pointing at references nothing, remove this model
if ((ghoul2[boltMod].mBltlist.size() <= boltNum) ||
((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) &&
(ghoul2[boltMod].mBltlist[boltNum].surfaceNumber == -1)))
{
CGhoul2Info_v *g2i = &ghoul2;
G2API_RemoveGhoul2Model((CGhoul2Info_v **)&g2i, i);
}
}
}
//No support for this, for now.
// remember to free what we used
Z_Free(activeSurfaces);
Z_Free(activeBones);
return (qtrue);
}
/*
//g2r if (entstate->ghoul2)
{
CGhoul2Info_v &ghoul2 = *((CGhoul2Info_v *)entstate->ghoul2);
model_t *mod_m = R_GetModelByHandle(RE_RegisterModel(ghoul2[modelIndex].mFileName));
model_t *mod_a = R_GetModelByHandle(mod_m->mdxm->animIndex);
int surf;
int flags;
int *activeSurfaces, *activeBones;
// did we find a ghoul 2 model or not?
if (!mod_m->mdxm)
{
return qfalse;
}
// first find if we already have this surface in the list
surf = G2_IsSurfaceLegal(mod_m, surfaceName, &flags);
if (surf != -1)
{
// first see if this ghoul2 model already has this as a root surface
if (ghoul2[modelIndex].mSurfaceRoot == surf)
{
return qtrue;
}
// set the root surface
ghoul2[modelIndex].mSurfaceRoot = surf;
// ok, now the tricky bits.
// firstly, generate a list of active / on surfaces below the root point
// gimme some space to put this list into
activeSurfaces = (int *)Z_Malloc(mod_m->mdxm->numSurfaces * 4, TAG_GHOUL2, qtrue);
memset(activeSurfaces, 0, (mod_m->mdxm->numSurfaces * 4));
activeBones = (int *)Z_Malloc(mod_a->mdxa->numBones * 4, TAG_GHOUL2, qtrue);
memset(activeBones, 0, (mod_a->mdxa->numBones * 4));
G2_FindRecursiveSurface(mod_m, surf, ghoul2[modelIndex].mSlist, activeSurfaces);
// now generate the used bone list
CConstructBoneList CBL(ghoul2[modelIndex].mSurfaceRoot,
activeBones,
ghoul2[modelIndex].mSlist,
mod_m,
ghoul2[modelIndex].mBlist);
G2_ConstructUsedBoneList(CBL);
// now remove all procedural or override surfaces that refer to surfaces that arent on this list
G2_RemoveRedundantGeneratedSurfaces(ghoul2[modelIndex].mSlist, activeSurfaces);
// now remove all bones that are pointing at bones that aren't active
G2_RemoveRedundantBoneOverrides(ghoul2[modelIndex].mBlist, activeBones);
// then remove all bolts that point at surfaces or bones that *arent* active.
G2_RemoveRedundantBolts(ghoul2[modelIndex].mBltlist, ghoul2[modelIndex].mSlist, activeSurfaces, activeBones);
// then remove all models on this ghoul2 instance that use those bolts that are being removed.
for (int i=0; i<ghoul2.size(); i++)
{
// are we even bolted to anything?
if (ghoul2[i].mModelBoltLink != -1)
{
int boltMod = (ghoul2[i].mModelBoltLink >> MODEL_SHIFT) & MODEL_AND;
int boltNum = (ghoul2[i].mModelBoltLink >> BOLT_SHIFT) & BOLT_AND;
// if either the bolt list is too small, or the bolt we are pointing at references nothing, remove this model
if ((ghoul2[boltMod].mBltlist.size() <= boltNum) ||
((ghoul2[boltMod].mBltlist[boltNum].boneNumber == -1) &&
(ghoul2[boltMod].mBltlist[boltNum].surfaceNumber == -1)))
{
G2API_RemoveGhoul2Model(entstate, i);
}
}
}
// remember to free what we used
Z_Free(activeSurfaces);
Z_Free(activeBones);
return (qtrue);
}
}
assert(0);*/
return qfalse;
}
extern int G2_DecideTraceLod(CGhoul2Info &ghoul2, int useLod);
int G2_AddSurface(CGhoul2Info *ghoul2, int surfaceNumber, int polyNumber, float BarycentricI, float BarycentricJ, int lod )
{
surfaceInfo_t temp_slist_entry;
// decide if LOD is legal
lod = G2_DecideTraceLod(*(CGhoul2Info *)(ghoul2), lod);
// first up, see if we have a free one already set up - look only from the end of the constant surfaces onwards
for (int i=0; i<ghoul2->mSlist.size(); i++)
{
// is the surface count -1? That would indicate it's free
if (ghoul2->mSlist[i].surface == -1)
{
ghoul2->mSlist[i].offFlags = G2SURFACEFLAG_GENERATED;
ghoul2->mSlist[i].surface = 10000; // no model will ever have 10000 surfaces
ghoul2->mSlist[i].genBarycentricI = BarycentricI;
ghoul2->mSlist[i].genBarycentricJ = BarycentricJ;
ghoul2->mSlist[i].genPolySurfaceIndex = ((polyNumber & 0xffff) << 16) | (surfaceNumber & 0xffff);
ghoul2->mSlist[i].genLod = lod;
return i;
}
}
// ok, didn't find one. Better create one
temp_slist_entry.offFlags = G2SURFACEFLAG_GENERATED;
temp_slist_entry.surface = 10000;
temp_slist_entry.genBarycentricI = BarycentricI;
temp_slist_entry.genBarycentricJ = BarycentricJ;
temp_slist_entry.genPolySurfaceIndex = ((polyNumber & 0xffff) << 16) | (surfaceNumber & 0xffff);
temp_slist_entry.genLod = lod;
ghoul2->mSlist.push_back(temp_slist_entry);
return (ghoul2->mSlist.size() -1 );
}
qboolean G2_RemoveSurface(surfaceInfo_v &slist, const int index)
{
// did we find it?
if (index != -1)
{
// set us to be the 'not active' state
slist[index].surface = -1;
unsigned int newSize = slist.size();
// now look through the list from the back and see if there is a block of -1's we can resize off the end of the list
for (int i=slist.size()-1; i>-1; i--)
{
if (slist[i].surface == -1)
{
newSize = i;
}
// once we hit one that isn't a -1, we are done.
else
{
break;
}
}
// do we need to resize?
if (newSize != slist.size())
{
// yes, so lets do it
slist.resize(newSize);
}
return qtrue;
}
assert(0);
// no
return qfalse;
}
int G2_GetParentSurface(CGhoul2Info *ghlInfo, const int index)
{
model_t *mod = (model_t *)ghlInfo->currentModel;
mdxmSurface_t *surf = 0;
mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)mod->mdxm + sizeof(mdxmHeader_t));
mdxmSurfHierarchy_t *surfInfo = 0;
// walk each surface and see if this index is listed in it's children
surf = (mdxmSurface_t *)G2_FindSurface((void *)mod, index, 0);
surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surf->thisSurfaceIndex]);
return surfInfo->parentIndex;
}
int G2_GetSurfaceIndex(CGhoul2Info *ghlInfo, const char *surfaceName)
{
model_t *mod = (model_t *)ghlInfo->currentModel;
int flags;
return G2_IsSurfaceLegal(mod, surfaceName, &flags);
}
int G2_IsSurfaceRendered(CGhoul2Info *ghlInfo, const char *surfaceName, surfaceInfo_v &slist)
{
int flags = 0;//, surfFlags = 0;
int surfIndex = 0;
assert(ghlInfo->currentModel);
assert(ghlInfo->currentModel->mdxm);
if (!ghlInfo->currentModel->mdxm)
{
return -1;
}
// now travel up the skeleton to see if any of it's ancestors have a 'no descendants' turned on
// find the original surface in the surface list
int surfNum = G2_IsSurfaceLegal((model_t *)ghlInfo->currentModel, surfaceName, &flags);
if ( surfNum != -1 )
{//must be legal
const mdxmHierarchyOffsets_t *surfIndexes = (mdxmHierarchyOffsets_t *)((byte *)ghlInfo->currentModel->mdxm + sizeof(mdxmHeader_t));
const mdxmSurfHierarchy_t *surfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surfNum]);
surfNum = surfInfo->parentIndex;
// walk the surface hierarchy up until we hit the root
while (surfNum != -1)
{
const mdxmSurface_t *parentSurf;
int parentFlags;
const mdxmSurfHierarchy_t *parentSurfInfo;
parentSurfInfo = (mdxmSurfHierarchy_t *)((byte *)surfIndexes + surfIndexes->offsets[surfNum]);
// find the original surface in the surface list
//G2 was bug, above comment was accurate, but we don't want the original flags, we want the parent flags
G2_IsSurfaceLegal((model_t *)ghlInfo->currentModel, parentSurfInfo->name, &parentFlags);
// now see if we already have overriden this surface in the slist
parentSurf = G2_FindSurface(ghlInfo, slist, parentSurfInfo->name, &surfIndex);
if (parentSurf)
{
// set descendants value
parentFlags = slist[surfIndex].offFlags;
}
// now we have the parent flags, lets see if any have the 'no descendants' flag set
if (parentFlags & G2SURFACEFLAG_NODESCENDANTS)
{
flags |= G2SURFACEFLAG_OFF;
break;
}
// set up scan of next parent
surfNum = parentSurfInfo->parentIndex;
}
}
else
{
return -1;
}
if ( flags == 0 )
{//it's not being overridden by a parent
// now see if we already have overriden this surface in the slist
const mdxmSurface_t *surf = G2_FindSurface(ghlInfo, slist, surfaceName, &surfIndex);
if (surf)
{
// set descendants value
flags = slist[surfIndex].offFlags;
}
// ok, at this point in flags we have what this surface is set to, and the index of the surface itself
}
return flags;
}
| {
"pile_set_name": "Github"
} |
# frozen_string_literal: true
module Dynflow
module Semaphores
class Abstract
# Tries to get ticket from the semaphore
# Returns true if thing got a ticket
# Rturns false otherwise and puts the thing into the semaphore's queue
def wait(thing)
raise NotImplementedError
end
# Gets first object from the queue
def get_waiting
raise NotImplementedError
end
# Checks if there are objects in the queue
def has_waiting?
raise NotImpelementedError
end
# Returns n tickets to the semaphore
def release(n = 1)
raise NotImplementedError
end
# Saves the semaphore's state to some persistent storage
def save
raise NotImplementedError
end
# Tries to get n tickets
# Returns n if the semaphore has free >= n
# Returns free if n > free
def get(n = 1)
raise NotImplementedErrorn
end
# Requests all tickets
# Returns all free tickets from the semaphore
def drain
raise NotImplementedError
end
end
end
end
| {
"pile_set_name": "Github"
} |
// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=MS %s
// RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
// RUN: %clang_cc1 -triple x86_64-windows-gnu -fms-extensions -emit-llvm -std=c11 -O0 -o - %s | FileCheck --check-prefix=CHECK --check-prefix=GNU %s
// RUN: %clang_cc1 -triple i686-windows-msvc -fms-extensions -emit-llvm -std=c11 -O1 -o - %s | FileCheck --check-prefix=O1 --check-prefix=MO1 %s
// RUN: %clang_cc1 -triple i686-windows-gnu -fms-extensions -emit-llvm -std=c11 -O1 -o - %s | FileCheck --check-prefix=O1 --check-prefix=GO1 %s
#define JOIN2(x, y) x##y
#define JOIN(x, y) JOIN2(x, y)
#define USEVAR(var) int JOIN(use, __LINE__)() { return var; }
#define USE(func) void JOIN(use, __LINE__)() { func(); }
//===----------------------------------------------------------------------===//
// Globals
//===----------------------------------------------------------------------===//
// Import declaration.
// CHECK: @ExternGlobalDecl = external dllimport global i32
__declspec(dllimport) extern int ExternGlobalDecl;
USEVAR(ExternGlobalDecl)
// dllimport implies a declaration.
// CHECK: @GlobalDecl = external dllimport global i32
__declspec(dllimport) int GlobalDecl;
USEVAR(GlobalDecl)
// Redeclarations
// CHECK: @GlobalRedecl1 = external dllimport global i32
__declspec(dllimport) extern int GlobalRedecl1;
__declspec(dllimport) extern int GlobalRedecl1;
USEVAR(GlobalRedecl1)
// CHECK: @GlobalRedecl2 = external dllimport global i32
__declspec(dllimport) int GlobalRedecl2;
__declspec(dllimport) int GlobalRedecl2;
USEVAR(GlobalRedecl2)
// NB: MSVC issues a warning and makes GlobalRedecl3 dllexport. We follow GCC
// and drop the dllimport with a warning.
// CHECK: @GlobalRedecl3 = external dso_local global i32
__declspec(dllimport) extern int GlobalRedecl3;
extern int GlobalRedecl3; // dllimport ignored
USEVAR(GlobalRedecl3)
// Make sure this works even if the decl has been used before it's defined (PR20792).
// MS: @GlobalRedecl4 = common dso_local dllexport global i32
// GNU: @GlobalRedecl4 = common dso_local global i32
__declspec(dllimport) extern int GlobalRedecl4;
USEVAR(GlobalRedecl4)
int GlobalRedecl4; // dllimport ignored
// FIXME: dllimport is dropped in the AST; this should be reflected in codegen (PR02803).
// CHECK: @GlobalRedecl5 = external dllimport global i32
__declspec(dllimport) extern int GlobalRedecl5;
USEVAR(GlobalRedecl5)
extern int GlobalRedecl5; // dllimport ignored
// Redeclaration in local context.
// CHECK: @GlobalRedecl6 = external dllimport global i32
__declspec(dllimport) int GlobalRedecl6;
int functionScope() {
extern int GlobalRedecl6; // still dllimport
return GlobalRedecl6;
}
//===----------------------------------------------------------------------===//
// Functions
//===----------------------------------------------------------------------===//
// Import function declaration.
// CHECK-DAG: declare dllimport void @decl()
__declspec(dllimport) void decl(void);
// Initialize use_decl with the address of the thunk.
// CHECK-DAG: @use_decl = dso_local global void ()* @decl
void (*use_decl)(void) = &decl;
// Import inline function.
// MS-DAG: declare dllimport void @inlineFunc()
// MO1-DAG: define available_externally dllimport void @inlineFunc()
// GNU-DAG: declare dso_local void @inlineFunc()
// GO1-DAG: define available_externally dso_local void @inlineFunc()
__declspec(dllimport) inline void inlineFunc(void) {}
USE(inlineFunc)
// inline attributes
// MS-DAG: declare dllimport void @noinline()
// MO1-DAG: define available_externally dllimport void @noinline()
// GNU-DAG: declare dso_local void @noinline()
// GO1-DAG: define available_externally dso_local void @noinline()
// CHECK-NOT: @alwaysInline()
// O1-NOT: @alwaysInline()
__declspec(dllimport) __attribute__((noinline)) inline void noinline(void) {}
__declspec(dllimport) __attribute__((always_inline)) inline void alwaysInline(void) {}
USE(noinline)
USE(alwaysInline)
// Redeclarations
// CHECK-DAG: declare dllimport void @redecl1()
__declspec(dllimport) void redecl1(void);
__declspec(dllimport) void redecl1(void);
USE(redecl1)
// NB: MSVC issues a warning and makes redecl2/redecl3 dllexport. We follow GCC
// and drop the dllimport with a warning.
// CHECK-DAG: declare dso_local void @redecl2()
__declspec(dllimport) void redecl2(void);
void redecl2(void);
USE(redecl2)
// MS: define dso_local dllexport void @redecl3()
// GNU: define dso_local void @redecl3()
__declspec(dllimport) void redecl3(void);
void redecl3(void) {} // dllimport ignored
USE(redecl3)
// Make sure this works even if the decl is used before it's defined (PR20792).
// MS: define dso_local dllexport void @redecl4()
// GNU: define dso_local void @redecl4()
__declspec(dllimport) void redecl4(void);
USE(redecl4)
void redecl4(void) {} // dllimport ignored
// FIXME: dllimport is dropped in the AST; this should be reflected in codegen (PR20803).
// CHECK-DAG: declare dllimport
__declspec(dllimport) void redecl5(void);
USE(redecl5)
void redecl5(void); // dllimport ignored
| {
"pile_set_name": "Github"
} |
//
// Button groups
// --------------------------------------------------
// Make the div behave like a button
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle; // match .btn alignment given font-size hack above
> .btn {
position: relative;
float: left;
// Bring the "active" button to the front
&:hover,
&:focus,
&:active,
&.active {
z-index: 2;
}
}
}
// Prevent double borders when buttons are next to each other
.btn-group {
.btn + .btn,
.btn + .btn-group,
.btn-group + .btn,
.btn-group + .btn-group {
margin-left: -1px;
}
}
// Optional: Group multiple button groups together for a toolbar
.btn-toolbar {
margin-left: -5px; // Offset the first child's margin
&:extend(.clearfix all);
.btn,
.btn-group,
.input-group {
float: left;
}
> .btn,
> .btn-group,
> .input-group {
margin-left: 5px;
}
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
// Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
.btn-group > .btn:first-child {
margin-left: 0;
&:not(:last-child):not(.dropdown-toggle) {
.border-right-radius(0);
}
}
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
.border-left-radius(0);
}
// Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
.btn-group > .btn-group {
float: left;
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group > .btn-group:first-child:not(:last-child) {
> .btn:last-child,
> .dropdown-toggle {
.border-right-radius(0);
}
}
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
.border-left-radius(0);
}
// On active and open, don't show outline
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0;
}
// Sizing
//
// Remix the default button sizing classes into new ones for easier manipulation.
.btn-group-xs > .btn { &:extend(.btn-xs); }
.btn-group-sm > .btn { &:extend(.btn-sm); }
.btn-group-lg > .btn { &:extend(.btn-lg); }
// Split button dropdowns
// ----------------------
// Give the line between buttons some depth
.btn-group > .btn + .dropdown-toggle {
padding-left: 8px;
padding-right: 8px;
}
.btn-group > .btn-lg + .dropdown-toggle {
padding-left: 12px;
padding-right: 12px;
}
// The clickable button for toggling the menu
// Remove the gradient and set the same inset shadow as the :active state
.btn-group.open .dropdown-toggle {
.box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
// Show no shadow for `.btn-link` since it has no other button styles.
&.btn-link {
.box-shadow(none);
}
}
// Reposition the caret
.btn .caret {
margin-left: 0;
}
// Carets in other button sizes
.btn-lg .caret {
border-width: @caret-width-large @caret-width-large 0;
border-bottom-width: 0;
}
// Upside down carets for .dropup
.dropup .btn-lg .caret {
border-width: 0 @caret-width-large @caret-width-large;
}
// Vertical button groups
// ----------------------
.btn-group-vertical {
> .btn,
> .btn-group,
> .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
// Clear floats so dropdown menus can be properly placed
> .btn-group {
&:extend(.clearfix all);
> .btn {
float: none;
}
}
> .btn + .btn,
> .btn + .btn-group,
> .btn-group + .btn,
> .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0;
}
}
.btn-group-vertical > .btn {
&:not(:first-child):not(:last-child) {
border-radius: 0;
}
&:first-child:not(:last-child) {
border-top-right-radius: @btn-border-radius-base;
.border-bottom-radius(0);
}
&:last-child:not(:first-child) {
border-bottom-left-radius: @btn-border-radius-base;
.border-top-radius(0);
}
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group-vertical > .btn-group:first-child:not(:last-child) {
> .btn:last-child,
> .dropdown-toggle {
.border-bottom-radius(0);
}
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
.border-top-radius(0);
}
// Justified button groups
// ----------------------
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate;
> .btn,
> .btn-group {
float: none;
display: table-cell;
width: 1%;
}
> .btn-group .btn {
width: 100%;
}
> .btn-group .dropdown-menu {
left: auto;
}
}
// Checkbox and radio options
//
// In order to support the browser's form validation feedback, powered by the
// `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
// `display: none;` or `visibility: hidden;` as that also hides the popover.
// Simply visually hiding the inputs via `opacity` would leave them clickable in
// certain cases which is prevented by using `clip` and `pointer-events`.
// This way, we ensure a DOM element is visible to position the popover from.
//
// See https://github.com/twbs/bootstrap/pull/12794 and
// https://github.com/twbs/bootstrap/pull/14559 for more information.
[data-toggle="buttons"] {
> .btn,
> .btn-group > .btn {
input[type="radio"],
input[type="checkbox"] {
position: absolute;
clip: rect(0,0,0,0);
pointer-events: none;
}
}
}
| {
"pile_set_name": "Github"
} |
//===- SDBMDialect.h - Dialect for striped DBMs -----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_SDBM_SDBMDIALECT_H
#define MLIR_DIALECT_SDBM_SDBMDIALECT_H
#include "mlir/IR/Dialect.h"
#include "mlir/Support/StorageUniquer.h"
namespace mlir {
class MLIRContext;
class SDBMDialect : public Dialect {
public:
SDBMDialect(MLIRContext *context);
/// Since there are no other virtual methods in this derived class, override
/// the destructor so that key methods get defined in the corresponding
/// module.
~SDBMDialect() override;
static StringRef getDialectNamespace() { return "sdbm"; }
/// Get the uniquer for SDBM expressions. This should not be used directly.
StorageUniquer &getUniquer() { return uniquer; }
private:
StorageUniquer uniquer;
};
} // namespace mlir
#endif // MLIR_DIALECT_SDBM_SDBMDIALECT_H
| {
"pile_set_name": "Github"
} |
import akka.actor.{Actor, ActorSystem, Props}
import com.softwaremill.macwire.akkasupport._
/**
* In this example I am constructing simple actor with many parameter lists.
*/
trait A
trait B
trait C
class SomeActor(a: A)(b: B, c: C) extends Actor {
override def receive: Receive = {
case m => //println(m)
}
}
object SomeActor {
def get(a: A)(c: C) = new SomeActor(a)(new B{}, c)
}
val a = new A {}
lazy val b: B = throw new UnsupportedOperationException()
val c = new C {}
val system = ActorSystem("wireAnonymousActorWithFactory-2-manyParameterLists")
AfterAllTerminate(system)
val someActor = wireAnonymousActorWith(SomeActor.get _)
someActor ! "Hey someActor"
| {
"pile_set_name": "Github"
} |
John Walter believes that making strategies work within the machinery of AT&T Corp will be the core both of his job as chief operating officer and when he steps up to become chief executive (CEO) in 1998.
"You can have the greatest strategy in the world, but if you dont execute, it doesnt matter," Walter told Reuters.
Walter, chairman and chief executive of commercial printing firm R.R. Donnelley & Sons Co, was on Wednesday appointed by AT&T as president and chief operating officer, and heir apparent to AT&T CEO and chairman Robert Allen.
Walter will immerse himself in the operations of AT&T during the 14 months when he and Robert Allen work as a team, and emerge capable of holding the reins.
"I'm very comfortable with my ability to move this enterprise forward," he said in a telephone interview.
Walter declined to outline areas where he believed AT&T had failed, but underlined achieving objectives and having an appropriate cost base as his clear focus.
"We have to have a cost platform which allows us to compete effectively or we are disadvantaged even before we come into the ring," he said.
Analysts have repeatedly criticised AT&T's inability to meet its objectives, which has resulted in an erosion of the value of the brand name and a sliding share price.
AT&T has flung tens of millions in $100 checks at consumer long distance customers only to find them desert again to rivals in the industry. Its share in the $75 billion market has fallen to around 55 percent from 60 two years ago.
"They haven't had the level of execution on the consumer side that we should have seen," said consultant Chris Landis of TeleChoice, who is also an ex-AT&T executive.
AT&T has made repeated attempts to make money in online services and the Internet, but has sold off almost all its creative content efforts and has retreated to a core offering of Internet access.
For every acquisition that worked well, like the 1994 purchase of McCaw Cellular, there have been others that failed, like the $7.5 billion 1991 takeover of NCR Corp.
Adjusted for the split-off of Lucent Technologies Inc, AT&T shares have fallen 16 percent this year, about the same as the broad market has risen.
Among Walter's favorite quotes: "When you hire, hire people better than you and then you'll build a company of giants. Hire people worse than you and you'll disappear."
Printing industry analysts say Walter has used technology very effectively to make Donnelley grow, but some say growth came at a price.
"A lot of things have been going wrong," said one analyst, citing the lower earnings outlook and falling stock price.
But analyst Rudolf Hokanson of Deutsche Morgan Grenfell said Walter was an effective manager.
"He tried to make people more accountable, tried to flatten some of the reporting structure," said Hokanson.
-- New York Newsroom 212 859 1712
| {
"pile_set_name": "Github"
} |
PKG_NAME = libgcrypt
PKG_VERS = 1.8.5
PKG_EXT = tar.bz2
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = ftp://ftp.gnupg.org/gcrypt/$(PKG_NAME)
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)
DEPENDS = cross/libgpg-error
HOMEPAGE = http://directory.fsf.org/wiki/Libgcrypt
COMMENT = This is a general purpose cryptographic library based on the code from GnuPG
LICENSE = LGPL
CONFIGURE_ARGS = --with-gpg-error-prefix=$(STAGING_INSTALL_PREFIX) ac_cv_sys_symbol_underscore=no
GNU_CONFIGURE = 1
POST_INSTALL_TARGET = libgcrypt_post_install
include ../../mk/spksrc.cross-cc.mk
.PHONY: libgcrypt_post_install
libgcrypt_post_install:
sed -i -e 's|^prefix=$(INSTALL_PREFIX)$$|prefix=$(STAGING_INSTALL_PREFIX)|' $(STAGING_INSTALL_PREFIX)/bin/libgcrypt-config
| {
"pile_set_name": "Github"
} |
/* Attribution notice: Rainbow have generously allowed me to reproduce
* the necessary definitions here from their API. This means the support
* can build independently of whether application builders have the
* API or hardware. This will allow developers to easily produce software
* that has latent hardware support for any users that have accelertors
* installed, without the developers themselves needing anything extra.
*
* I have only clipped the parts from the CryptoSwift header files that
* are (or seem) relevant to the CryptoSwift support code. This is
* simply to keep the file sizes reasonable.
* [Geoff]
*/
/* NB: These type widths do *not* seem right in general, in particular
* they're not terribly friendly to 64-bit architectures (unsigned long)
* will be 64-bit on IA-64 for a start. I'm leaving these alone as they
* agree with Rainbow's API and this will only be called into question
* on platforms with Rainbow support anyway! ;-) */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef long SW_STATUS; /* status */
typedef unsigned char SW_BYTE; /* 8 bit byte */
typedef unsigned short SW_U16; /* 16 bit number */
#if defined(_IRIX)
#include <sgidefs.h>
typedef __uint32_t SW_U32;
#else
typedef unsigned long SW_U32; /* 32 bit integer */
#endif
#if defined(OPENSSL_SYS_WIN32)
typedef struct _SW_U64 {
SW_U32 low32;
SW_U32 high32;
} SW_U64; /* 64 bit integer */
#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
typedef longlong SW_U64
#else /* Unix variants */
typedef struct _SW_U64 {
SW_U32 low32;
SW_U32 high32;
} SW_U64; /* 64 bit integer */
#endif
/* status codes */
#define SW_OK (0L)
#define SW_ERR_BASE (-10000L)
#define SW_ERR_NO_CARD (SW_ERR_BASE-1) /* The Card is not present */
#define SW_ERR_CARD_NOT_READY (SW_ERR_BASE-2) /* The card has not powered */
/* up yet */
#define SW_ERR_TIME_OUT (SW_ERR_BASE-3) /* Execution of a command */
/* time out */
#define SW_ERR_NO_EXECUTE (SW_ERR_BASE-4) /* The Card failed to */
/* execute the command */
#define SW_ERR_INPUT_NULL_PTR (SW_ERR_BASE-5) /* a required pointer is */
/* NULL */
#define SW_ERR_INPUT_SIZE (SW_ERR_BASE-6) /* size is invalid, too */
/* small, too large. */
#define SW_ERR_INVALID_HANDLE (SW_ERR_BASE-7) /* Invalid SW_ACC_CONTEXT */
/* handle */
#define SW_ERR_PENDING (SW_ERR_BASE-8) /* A request is already out- */
/* standing at this */
/* context handle */
#define SW_ERR_AVAILABLE (SW_ERR_BASE-9) /* A result is available. */
#define SW_ERR_NO_PENDING (SW_ERR_BASE-10)/* No request is pending. */
#define SW_ERR_NO_MEMORY (SW_ERR_BASE-11)/* Not enough memory */
#define SW_ERR_BAD_ALGORITHM (SW_ERR_BASE-12)/* Invalid algorithm type */
/* in SW_PARAM structure */
#define SW_ERR_MISSING_KEY (SW_ERR_BASE-13)/* No key is associated with */
/* context. */
/* swAttachKeyParam() is */
/* not called. */
#define SW_ERR_KEY_CMD_MISMATCH \
(SW_ERR_BASE-14)/* Cannot perform requested */
/* SW_COMMAND_CODE since */
/* key attached via */
/* swAttachKeyParam() */
/* cannot be used for this*/
/* SW_COMMAND_CODE. */
#define SW_ERR_NOT_IMPLEMENTED \
(SW_ERR_BASE-15)/* Not implemented */
#define SW_ERR_BAD_COMMAND (SW_ERR_BASE-16)/* Bad command code */
#define SW_ERR_BAD_ITEM_SIZE (SW_ERR_BASE-17)/* too small or too large in */
/* the "initems" or */
/* "outitems". */
#define SW_ERR_BAD_ACCNUM (SW_ERR_BASE-18)/* Bad accelerator number */
#define SW_ERR_SELFTEST_FAIL (SW_ERR_BASE-19)/* At least one of the self */
/* test fail, look at the */
/* selfTestBitmap in */
/* SW_ACCELERATOR_INFO for*/
/* details. */
#define SW_ERR_MISALIGN (SW_ERR_BASE-20)/* Certain alogrithms require*/
/* key materials aligned */
/* in certain order, e.g. */
/* 128 bit for CRT */
#define SW_ERR_OUTPUT_NULL_PTR \
(SW_ERR_BASE-21)/* a required pointer is */
/* NULL */
#define SW_ERR_OUTPUT_SIZE \
(SW_ERR_BASE-22)/* size is invalid, too */
/* small, too large. */
#define SW_ERR_FIRMWARE_CHECKSUM \
(SW_ERR_BASE-23)/* firmware checksum mismatch*/
/* download failed. */
#define SW_ERR_UNKNOWN_FIRMWARE \
(SW_ERR_BASE-24)/* unknown firmware error */
#define SW_ERR_INTERRUPT (SW_ERR_BASE-25)/* request is abort when */
/* it's waiting to be */
/* completed. */
#define SW_ERR_NVWRITE_FAIL (SW_ERR_BASE-26)/* error in writing to Non- */
/* volatile memory */
#define SW_ERR_NVWRITE_RANGE (SW_ERR_BASE-27)/* out of range error in */
/* writing to NV memory */
#define SW_ERR_RNG_ERROR (SW_ERR_BASE-28)/* Random Number Generation */
/* failure */
#define SW_ERR_DSS_FAILURE (SW_ERR_BASE-29)/* DSS Sign or Verify failure*/
#define SW_ERR_MODEXP_FAILURE (SW_ERR_BASE-30)/* Failure in various math */
/* calculations */
#define SW_ERR_ONBOARD_MEMORY (SW_ERR_BASE-31)/* Error in accessing on - */
/* board memory */
#define SW_ERR_FIRMWARE_VERSION \
(SW_ERR_BASE-32)/* Wrong version in firmware */
/* update */
#define SW_ERR_ZERO_WORKING_ACCELERATOR \
(SW_ERR_BASE-44)/* All accelerators are bad */
/* algorithm type */
#define SW_ALG_CRT 1
#define SW_ALG_EXP 2
#define SW_ALG_DSA 3
#define SW_ALG_NVDATA 4
/* command code */
#define SW_CMD_MODEXP_CRT 1 /* perform Modular Exponentiation using */
/* Chinese Remainder Theorem (CRT) */
#define SW_CMD_MODEXP 2 /* perform Modular Exponentiation */
#define SW_CMD_DSS_SIGN 3 /* perform DSS sign */
#define SW_CMD_DSS_VERIFY 4 /* perform DSS verify */
#define SW_CMD_RAND 5 /* perform random number generation */
#define SW_CMD_NVREAD 6 /* perform read to nonvolatile RAM */
#define SW_CMD_NVWRITE 7 /* perform write to nonvolatile RAM */
typedef SW_U32 SW_ALGTYPE; /* alogrithm type */
typedef SW_U32 SW_STATE; /* state */
typedef SW_U32 SW_COMMAND_CODE; /* command code */
typedef SW_U32 SW_COMMAND_BITMAP[4]; /* bitmap */
typedef struct _SW_LARGENUMBER {
SW_U32 nbytes; /* number of bytes in the buffer "value" */
SW_BYTE* value; /* the large integer as a string of */
/* bytes in network (big endian) order */
} SW_LARGENUMBER;
#if defined(OPENSSL_SYS_WIN32)
#include <windows.h>
typedef HANDLE SW_OSHANDLE; /* handle to kernel object */
#define SW_OS_INVALID_HANDLE INVALID_HANDLE_VALUE
#define SW_CALLCONV _stdcall
#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
/* async callback mechanisms */
/* swiftCallbackLevel */
#define SW_MAC_CALLBACK_LEVEL_NO 0
#define SW_MAC_CALLBACK_LEVEL_HARDWARE 1 /* from the hardware ISR */
#define SW_MAC_CALLBACK_LEVEL_SECONDARY 2 /* as secondary ISR */
typedef int SW_MAC_CALLBACK_LEVEL;
typedef int SW_OSHANDLE;
#define SW_OS_INVALID_HANDLE (-1)
#define SW_CALLCONV
#else /* Unix variants */
typedef int SW_OSHANDLE; /* handle to driver */
#define SW_OS_INVALID_HANDLE (-1)
#define SW_CALLCONV
#endif
typedef struct _SW_CRT {
SW_LARGENUMBER p; /* prime number p */
SW_LARGENUMBER q; /* prime number q */
SW_LARGENUMBER dmp1; /* exponent1 */
SW_LARGENUMBER dmq1; /* exponent2 */
SW_LARGENUMBER iqmp; /* CRT coefficient */
} SW_CRT;
typedef struct _SW_EXP {
SW_LARGENUMBER modulus; /* modulus */
SW_LARGENUMBER exponent;/* exponent */
} SW_EXP;
typedef struct _SW_DSA {
SW_LARGENUMBER p; /* */
SW_LARGENUMBER q; /* */
SW_LARGENUMBER g; /* */
SW_LARGENUMBER key; /* private/public key */
} SW_DSA;
typedef struct _SW_NVDATA {
SW_U32 accnum; /* accelerator board number */
SW_U32 offset; /* offset in byte */
} SW_NVDATA;
typedef struct _SW_PARAM {
SW_ALGTYPE type; /* type of the alogrithm */
union {
SW_CRT crt;
SW_EXP exp;
SW_DSA dsa;
SW_NVDATA nvdata;
} up;
} SW_PARAM;
typedef SW_U32 SW_CONTEXT_HANDLE; /* opaque context handle */
/* Now the OpenSSL bits, these function types are the for the function
* pointers that will bound into the Rainbow shared libraries. */
typedef SW_STATUS SW_CALLCONV t_swAcquireAccContext(SW_CONTEXT_HANDLE *hac);
typedef SW_STATUS SW_CALLCONV t_swAttachKeyParam(SW_CONTEXT_HANDLE hac,
SW_PARAM *key_params);
typedef SW_STATUS SW_CALLCONV t_swSimpleRequest(SW_CONTEXT_HANDLE hac,
SW_COMMAND_CODE cmd,
SW_LARGENUMBER pin[],
SW_U32 pin_count,
SW_LARGENUMBER pout[],
SW_U32 pout_count);
typedef SW_STATUS SW_CALLCONV t_swReleaseAccContext(SW_CONTEXT_HANDLE hac);
#ifdef __cplusplus
}
#endif /* __cplusplus */
| {
"pile_set_name": "Github"
} |
[package]
name = "systest"
version = "0.1.0"
authors = ["Alex Crichton <[email protected]>"]
[dependencies]
libc = "0.2"
openssl-sys = { path = "../openssl-sys" }
[build-dependencies]
ctest = "0.2"
[features]
vendored = ['openssl-sys/vendored']
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<ContentType name="XmlFieldSetting" parentType="FieldSettingContent" handler="SenseNet.ContentRepository.Schema.FieldSettingContent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>$Ctd-XmlFieldSetting,DisplayName</DisplayName>
<Icon>addxmlfield</Icon>
<Fields />
</ContentType> | {
"pile_set_name": "Github"
} |
- var users = [{ name: 'tobi', age: 2 }]
fb:users
for user in users
fb:user(age=user.age)
:cdata
| {
"pile_set_name": "Github"
} |
# Jenkins CI script for Windows to Linux CI.
# Heavily modified by John Howard (@jhowardmsft) December 2015 to try to make it more reliable.
set +xe
SCRIPT_VER="Wed Apr 20 18:30:19 UTC 2016"
# TODO to make (even) more resilient:
# - Wait for daemon to be running before executing docker commands
# - Check if jq is installed
# - Make sure bash is v4.3 or later. Can't do until all Azure nodes on the latest version
# - Make sure we are not running as local system. Can't do until all Azure nodes are updated.
# - Error if docker versions are not equal. Can't do until all Azure nodes are updated
# - Error if go versions are not equal. Can't do until all Azure nodes are updated.
# - Error if running 32-bit posix tools. Probably can take from bash --version and check contains "x86_64"
# - Warn if the CI directory cannot be deleted afterwards. Otherwise turdlets are left behind
# - Use %systemdrive% ($SYSTEMDRIVE) rather than hard code to c: for TEMP
# - Consider cross builing the Windows binary and copy across. That's a bit of a heavy lift. Only reason
# for doing that is that it mirrors the actual release process for docker.exe which is cross-built.
# However, should absolutely not be a problem if built natively, so nit-picking.
# - Tidy up of images and containers. Either here, or in the teardown script.
ec=0
uniques=1
echo INFO: Started at `date`. Script version $SCRIPT_VER
# !README!
# There are two daemons running on the remote Linux host:
# - outer: specified by DOCKER_HOST, this is the daemon that will build and run the inner docker daemon
# from the sources matching the PR.
# - inner: runs on the host network, on a port number similar to that of DOCKER_HOST but the last two digits are inverted
# (2357 if DOCKER_HOST had port 2375; and 2367 if DOCKER_HOST had port 2376).
# The windows integration tests are run against this inner daemon.
# get the ip, inner and outer ports.
ip="${DOCKER_HOST#*://}"
port_outer="${ip#*:}"
# inner port is like outer port with last two digits inverted.
port_inner=$(echo "$port_outer" | sed -E 's/(.)(.)$/\2\1/')
ip="${ip%%:*}"
echo "INFO: IP=$ip PORT_OUTER=$port_outer PORT_INNER=$port_inner"
# If TLS is enabled
if [ -n "$DOCKER_TLS_VERIFY" ]; then
protocol=https
if [ -z "$DOCKER_MACHINE_NAME" ]; then
ec=1
echo "ERROR: DOCKER_MACHINE_NAME is undefined"
fi
certs=$(echo ~/.docker/machine/machines/$DOCKER_MACHINE_NAME)
curlopts="--cacert $certs/ca.pem --cert $certs/cert.pem --key $certs/key.pem"
run_extra_args="-v tlscerts:/etc/docker"
daemon_extra_args="--tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem"
else
protocol=http
fi
# Save for use by make.sh and scripts it invokes
export MAIN_DOCKER_HOST="tcp://$ip:$port_inner"
# Verify we can get the remote node to respond to _ping
if [ $ec -eq 0 ]; then
reply=`curl -s $curlopts $protocol://$ip:$port_outer/_ping`
if [ "$reply" != "OK" ]; then
ec=1
echo "ERROR: Failed to get an 'OK' response from the docker daemon on the Linux node"
echo " at $ip:$port_outer when called with an http request for '_ping'. This implies that"
echo " either the daemon has crashed/is not running, or the Linux node is unavailable."
echo
echo " A regular ping to the remote Linux node is below. It should reply. If not, the"
echo " machine cannot be reached at all and may have crashed. If it does reply, it is"
echo " likely a case of the Linux daemon not running or having crashed, which requires"
echo " further investigation."
echo
echo " Try re-running this CI job, or ask on #docker-dev or #docker-maintainers"
echo " for someone to perform further diagnostics, or take this node out of rotation."
echo
ping $ip
else
echo "INFO: The Linux nodes outer daemon replied to a ping. Good!"
fi
fi
# Get the version from the remote node. Note this may fail if jq is not installed.
# That's probably worth checking to make sure, just in case.
if [ $ec -eq 0 ]; then
remoteVersion=`curl -s $curlopts $protocol://$ip:$port_outer/version | jq -c '.Version'`
echo "INFO: Remote daemon is running docker version $remoteVersion"
fi
# Compare versions. We should really fail if result is no 1. Output at end of script.
if [ $ec -eq 0 ]; then
uniques=`docker version | grep Version | /usr/bin/sort -u | wc -l`
fi
# Make sure we are in repo
if [ $ec -eq 0 ]; then
if [ ! -d hack ]; then
echo "ERROR: Are you sure this is being launched from a the root of docker repository?"
echo " If this is a Windows CI machine, it should be c:\jenkins\gopath\src\github.com\docker\docker."
echo " Current directory is `pwd`"
ec=1
fi
fi
# Are we in split binary mode?
if [ `grep DOCKER_CLIENTONLY Makefile | wc -l` -gt 0 ]; then
splitBinary=0
echo "INFO: Running in single binary mode"
else
splitBinary=1
echo "INFO: Running in split binary mode"
fi
# Get the commit has and verify we have something
if [ $ec -eq 0 ]; then
export COMMITHASH=$(git rev-parse --short HEAD)
echo INFO: Commmit hash is $COMMITHASH
if [ -z $COMMITHASH ]; then
echo "ERROR: Failed to get commit hash. Are you sure this is a docker repository?"
ec=1
fi
fi
# Redirect to a temporary location. Check is here for local runs from Jenkins machines just in case not
# in the right directory where the repo is cloned. We also redirect TEMP to not use the environment
# TEMP as when running as a standard user (not local system), it otherwise exposes a bug in posix tar which
# will cause CI to fail from Windows to Linux. Obviously it's not best practice to ever run as local system...
if [ $ec -eq 0 ]; then
export TEMP=/c/CI/CI-$COMMITHASH
export TMP=$TEMP
/usr/bin/mkdir -p $TEMP # Make sure Linux mkdir for -p
fi
# Tidy up time
if [ $ec -eq 0 ]; then
echo INFO: Deleting pre-existing containers and images...
# Force remove all containers based on a previously built image with this commit
! docker rm -f $(docker ps -aq --filter "ancestor=docker:$COMMITHASH") &>/dev/null
# Force remove any container with this commithash as a name
! docker rm -f $(docker ps -aq --filter "name=docker-$COMMITHASH") &>/dev/null
# This SHOULD never happen, but just in case, also blow away any containers
# that might be around.
! if [ ! $(docker ps -aq | wc -l) -eq 0 ]; then
echo WARN: There were some leftover containers. Cleaning them up.
! docker rm -f $(docker ps -aq)
fi
# Force remove the image if it exists
! docker rmi -f "docker-$COMMITHASH" &>/dev/null
fi
# Provide the docker version for debugging purposes. If these fail, game over.
# as the Linux box isn't responding for some reason.
if [ $ec -eq 0 ]; then
echo INFO: Docker version and info of the outer daemon on the Linux node
echo
docker version
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: The main linux daemon does not appear to be running. Has the Linux node crashed?"
fi
echo
fi
# Same as above, but docker info
if [ $ec -eq 0 ]; then
echo
docker info
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: The main linux daemon does not appear to be running. Has the Linux node crashed?"
fi
echo
fi
# build the daemon image
if [ $ec -eq 0 ]; then
echo "INFO: Running docker build on Linux host at $DOCKER_HOST"
if [ $splitBinary -eq 0 ]; then
set -x
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t "docker:$COMMITHASH" .
cat <<EOF | docker build --rm --force-rm -t "docker:$COMMITHASH" -
FROM docker:$COMMITHASH
RUN hack/make.sh binary
RUN cp bundles/latest/binary/docker /bin/docker
CMD dockerd -D -H tcp://0.0.0.0:$port_inner $daemon_extra_args
EOF
else
set -x
docker build --rm --force-rm --build-arg APT_MIRROR=cdn-fastly.deb.debian.org -t "docker:$COMMITHASH" .
cat <<EOF | docker build --rm --force-rm -t "docker:$COMMITHASH" -
FROM docker:$COMMITHASH
RUN hack/make.sh binary
RUN cp bundles/latest/binary-daemon/dockerd /bin/dockerd
CMD dockerd -D -H tcp://0.0.0.0:$port_inner $daemon_extra_args
EOF
fi
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: docker build failed"
fi
fi
# Start the docker-in-docker daemon from the image we just built
if [ $ec -eq 0 ]; then
echo "INFO: Starting build of a Linux daemon to test against, and starting it..."
set -x
# aufs in aufs is faster than vfs in aufs
docker run -d $run_extra_args -e DOCKER_GRAPHDRIVER=aufs --pid host --privileged --name "docker-$COMMITHASH" --net host "docker:$COMMITHASH"
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: Failed to compile and start the linux daemon"
fi
fi
# Build locally.
if [ $ec -eq 0 ]; then
echo "INFO: Starting local build of Windows binary..."
set -x
export TIMEOUT="120m"
export DOCKER_HOST="tcp://$ip:$port_inner"
# This can be removed
export DOCKER_TEST_HOST="tcp://$ip:$port_inner"
unset DOCKER_CLIENTONLY
export DOCKER_REMOTE_DAEMON=1
hack/make.sh binary
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: Build of binary on Windows failed"
fi
fi
# Make a local copy of the built binary and ensure that is first in our path
if [ $ec -eq 0 ]; then
VERSION=$(< ./VERSION)
if [ $splitBinary -eq 0 ]; then
cp bundles/$VERSION/binary/docker.exe $TEMP
else
cp bundles/$VERSION/binary-client/docker.exe $TEMP
fi
ec=$?
if [ 0 -ne $ec ]; then
echo "ERROR: Failed to copy built binary to $TEMP"
fi
export PATH=$TEMP:$PATH
fi
# Run the integration tests
if [ $ec -eq 0 ]; then
echo "INFO: Running Integration tests..."
set -x
export DOCKER_TEST_TLS_VERIFY="$DOCKER_TLS_VERIFY"
export DOCKER_TEST_CERT_PATH="$DOCKER_CERT_PATH"
#export TESTFLAGS='-check.vv'
hack/make.sh test-integration-cli
ec=$?
set +x
if [ 0 -ne $ec ]; then
echo "ERROR: CLI test failed."
# Next line is useful, but very long winded if included
docker -H=$MAIN_DOCKER_HOST logs --tail 100 "docker-$COMMITHASH"
fi
fi
# Tidy up any temporary files from the CI run
if [ ! -z $COMMITHASH ]; then
rm -rf $TEMP
fi
# CI Integrity check - ensure we are using the same version of go as present in the Dockerfile
GOVER_DOCKERFILE=`grep 'ENV GO_VERSION' Dockerfile | awk '{print $3}'`
GOVER_INSTALLED=`go version | awk '{print $3}'`
if [ "${GOVER_INSTALLED:2}" != "$GOVER_DOCKERFILE" ]; then
#ec=1 # Uncomment to make CI fail once all nodes are updated.
echo
echo "---------------------------------------------------------------------------"
echo "WARN: CI should be using go version $GOVER_DOCKERFILE, but is using ${GOVER_INSTALLED:2}"
echo " Please ping #docker-maintainers on IRC to get this CI server updated."
echo "---------------------------------------------------------------------------"
echo
fi
# Check the Linux box is running a matching version of docker
if [ "$uniques" -ne 1 ]; then
ec=0 # Uncomment to make CI fail once all nodes are updated.
echo
echo "---------------------------------------------------------------------------"
echo "ERROR: This CI node is not running the same version of docker as the daemon."
echo " This is a CI configuration issue."
echo "---------------------------------------------------------------------------"
echo
fi
# Tell the user how we did.
if [ $ec -eq 0 ]; then
echo INFO: Completed successfully at `date`.
else
echo ERROR: Failed with exitcode $ec at `date`.
fi
exit $ec
| {
"pile_set_name": "Github"
} |
--
-- d/tools/ldc.lua
-- Provides LDC-specific configuration strings.
-- Copyright (c) 2013-2015 Andrew Gough, Manu Evans, and the Premake project
--
local p = premake
p.tools.ldc = { }
local ldc = p.tools.ldc
local project = p.project
local config = p.config
local d = p.modules.d
--
-- Set default tools
--
ldc.namestyle = "posix"
--
-- Returns list of D compiler flags for a configuration.
--
ldc.dflags = {
architecture = {
x86 = "-m32",
x86_64 = "-m64",
ARM = "-march=arm",
ARM64 = "-march=aarch64",
-- ppc = "-march=ppc32",
-- ppc64 = "-march=ppc64",
-- spu = "-march=cellspu",
-- mips = "-march=mips", -- -march=mipsel?
},
flags = {
OmitDefaultLibrary = "-mscrtlib=",
CodeCoverage = "-cov",
Color = "-enable-color",
Documentation = "-D",
FatalWarnings = "-w", -- Use LLVM flag? : "-fatal-assembler-warnings",
GenerateHeader = "-H",
GenerateJSON = "-X",
LowMem = "-lowmem",
RetainPaths = "-op",
SymbolsLikeC = "-gc",
UnitTest = "-unittest",
Verbose = "-v",
AllInstantiate = "-allinst",
BetterC = "-betterC",
Main = "-main",
PerformSyntaxCheckOnly = "-o-",
ShowGC = "-vgc",
IgnorePragma = "-ignore",
},
boundscheck = {
Off = "-boundscheck=off",
On = "-boundscheck=on",
SafeOnly = "-boundscheck=safeonly",
},
checkaction = {
D = "-checkaction=D",
C = "-checkaction=C",
Halt = "-checkaction=halt",
Context = "-checkaction=context",
},
cppdialect = {
["C++latest"] = "-extern-std=c++17", -- TODO: keep this up to date >_<
["C++98"] = "-extern-std=c++98",
["C++0x"] = "-extern-std=c++11",
["C++11"] = "-extern-std=c++11",
["C++1y"] = "-extern-std=c++14",
["C++14"] = "-extern-std=c++14",
["C++1z"] = "-extern-std=c++17",
["C++17"] = "-extern-std=c++17",
["C++2a"] = "-extern-std=c++20",
["C++20"] = "-extern-std=c++20",
["gnu++98"] = "-extern-std=c++98",
["gnu++0x"] = "-extern-std=c++11",
["gnu++11"] = "-extern-std=c++11",
["gnu++1y"] = "-extern-std=c++14",
["gnu++14"] = "-extern-std=c++14",
["gnu++1z"] = "-extern-std=c++17",
["gnu++17"] = "-extern-std=c++17",
["gnu++2a"] = "-extern-std=c++20",
["gnu++20"] = "-extern-std=c++20",
},
deprecatedfeatures = {
Allow = "-d",
Warn = "-dw",
Error = "-de",
},
floatingpoint = {
Fast = "-fp-contract=fast -enable-unsafe-fp-math",
-- Strict = "-ffloat-store",
},
optimize = {
Off = "-O0",
On = "-O2",
Debug = "-O0",
Full = "-O3",
Size = "-Oz",
Speed = "-O3",
},
pic = {
On = "-relocation-model=pic",
},
vectorextensions = {
AVX = "-mattr=+avx",
AVX2 = "-mattr=+avx2",
SSE = "-mattr=+sse",
SSE2 = "-mattr=+sse2",
SSE3 = "-mattr=+sse3",
SSSE3 = "-mattr=+ssse3",
["SSE4.1"] = "-mattr=+sse4.1",
},
warnings = {
Default = "-wi",
High = "-wi",
Extra = "-wi", -- TODO: is there a way to get extra warnings?
Everything = "-wi",
},
symbols = {
On = "-g",
FastLink = "-g",
Full = "-g",
}
}
function ldc.getdflags(cfg)
local flags = config.mapFlags(cfg, ldc.dflags)
if config.isDebugBuild(cfg) then
table.insert(flags, "-d-debug")
else
table.insert(flags, "-release")
end
if not cfg.flags.OmitDefaultLibrary then
local releaseruntime = not config.isDebugBuild(cfg)
local staticruntime = true
if cfg.staticruntime == "Off" then
staticruntime = false
end
if cfg.runtime == "Debug" then
releaseruntime = false
elseif cfg.runtime == "Release" then
releaseruntime = true
end
if (cfg.staticruntime and cfg.staticruntime ~= "Default") or (cfg.runtime and cfg.runtime ~= "Default") then
if staticruntime == true and releaseruntime == true then
table.insert(flags, "-mscrtlib=libcmt")
elseif staticruntime == true and releaseruntime == false then
table.insert(flags, "-mscrtlib=libcmtd")
elseif staticruntime == false and releaseruntime == true then
table.insert(flags, "-mscrtlib=msvcrt")
elseif staticruntime == false and releaseruntime == false then
table.insert(flags, "-mscrtlib=msvcrtd")
end
end
end
if cfg.flags.Documentation then
if cfg.docname then
table.insert(flags, "-Df=" .. p.quoted(cfg.docname))
end
if cfg.docdir then
table.insert(flags, "-Dd=" .. p.quoted(cfg.docdir))
end
end
if cfg.flags.GenerateHeader then
if cfg.headername then
table.insert(flags, "-Hf=" .. p.quoted(cfg.headername))
end
if cfg.headerdir then
table.insert(flags, "-Hd=" .. p.quoted(cfg.headerdir))
end
end
if #cfg.computetargets > 0 then
table.insert(flags, "-mdcompute-targets=" .. table.concat(cfg.computetargets, ','))
end
if #cfg.isaextensions > 0 then
local isaMap = {
MOVBE = "movbe",
POPCNT = "popcnt",
PCLMUL = "pclmul",
LZCNT = "lzcnt",
BMI = "bmi",
BMI2 = "bmi2",
F16C = "f16c",
AES = "aes",
FMA = "fma",
FMA4 = "fma4",
RDRND = "rdrnd",
}
for _, ext in ipairs(cfg.transition) do
if isaMap[ext] ~= nil then
table.insert(flags, "-mattr=+" .. isaMap[ext])
end
end
end
if #cfg.preview > 0 then
for _, opt in ipairs(cfg.preview) do
table.insert(flags, "-preview=" .. opt)
end
end
if #cfg.revert > 0 then
for _, opt in ipairs(cfg.revert) do
table.insert(flags, "-revert=" .. opt)
end
end
if #cfg.transition > 0 then
for _, opt in ipairs(cfg.transition) do
table.insert(flags, "-transition=" .. opt)
end
end
return flags
end
--
-- Decorate versions for the DMD command line.
--
function ldc.getversions(versions, level)
local result = {}
for _, version in ipairs(versions) do
table.insert(result, '-d-version=' .. version)
end
if level then
table.insert(result, '-d-version=' .. level)
end
return result
end
--
-- Decorate debug constants for the DMD command line.
--
function ldc.getdebug(constants, level)
local result = {}
for _, constant in ipairs(constants) do
table.insert(result, '-d-debug=' .. constant)
end
if level then
table.insert(result, '-d-debug=' .. level)
end
return result
end
--
-- Decorate import file search paths for the DMD command line.
--
function ldc.getimportdirs(cfg, dirs)
local result = {}
for _, dir in ipairs(dirs) do
dir = project.getrelative(cfg.project, dir)
table.insert(result, '-I=' .. p.quoted(dir))
end
return result
end
--
-- Decorate import file search paths for the DMD command line.
--
function ldc.getstringimportdirs(cfg, dirs)
local result = {}
for _, dir in ipairs(dirs) do
dir = project.getrelative(cfg.project, dir)
table.insert(result, '-J=' .. p.quoted(dir))
end
return result
end
--
-- Returns the target name specific to compiler
--
function ldc.gettarget(name)
return "-of=" .. name
end
--
-- Return a list of LDFLAGS for a specific configuration.
--
ldc.ldflags = {
architecture = {
x86 = { "-m32" },
x86_64 = { "-m64" },
},
kind = {
SharedLib = "-shared",
StaticLib = "-lib",
},
}
function ldc.getldflags(cfg)
local flags = config.mapFlags(cfg, ldc.ldflags)
return flags
end
--
-- Return a list of decorated additional libraries directories.
--
ldc.libraryDirectories = {
architecture = {
x86 = "-L=-L/usr/lib",
x86_64 = "-L=-L/usr/lib64",
}
}
function ldc.getLibraryDirectories(cfg)
local flags = config.mapFlags(cfg, ldc.libraryDirectories)
-- Scan the list of linked libraries. If any are referenced with
-- paths, add those to the list of library search paths
for _, dir in ipairs(config.getlinks(cfg, "system", "directory")) do
table.insert(flags, '-L=-L' .. project.getrelative(cfg.project, dir))
end
return flags
end
--
-- Return the list of libraries to link, decorated with flags as needed.
--
function ldc.getlinks(cfg, systemonly)
local result = {}
local links
if not systemonly then
links = config.getlinks(cfg, "siblings", "object")
for _, link in ipairs(links) do
-- skip external project references, since I have no way
-- to know the actual output target path
if not link.project.external then
if link.kind == p.STATICLIB then
-- Don't use "-l" flag when linking static libraries; instead use
-- path/libname.a to avoid linking a shared library of the same
-- name if one is present
table.insert(result, "-L=" .. project.getrelative(cfg.project, link.linktarget.abspath))
else
table.insert(result, "-L=-l" .. link.linktarget.basename)
end
end
end
end
-- The "-l" flag is fine for system libraries
links = config.getlinks(cfg, "system", "fullpath")
for _, link in ipairs(links) do
if path.isframework(link) then
table.insert(result, "-framework " .. path.getbasename(link))
elseif path.isobjectfile(link) then
table.insert(result, "-L=" .. link)
else
table.insert(result, "-L=-l" .. path.getbasename(link))
end
end
return result
end
--
-- Returns makefile-specific configuration rules.
--
ldc.makesettings = {
}
function ldc.getmakesettings(cfg)
local settings = config.mapFlags(cfg, ldc.makesettings)
return table.concat(settings)
end
--
-- Retrieves the executable command name for a tool, based on the
-- provided configuration and the operating environment.
--
-- @param cfg
-- The configuration to query.
-- @param tool
-- The tool to fetch, one of "dc" for the D compiler, or "ar" for the static linker.
-- @return
-- The executable command name for a tool, or nil if the system's
-- default value should be used.
--
ldc.tools = {
dc = "ldc2",
ar = "ar",
}
function ldc.gettoolname(cfg, tool)
return ldc.tools[tool]
end
| {
"pile_set_name": "Github"
} |
---
title: Seq.iter<'T> Function (F#)
description: Seq.iter<'T> Function (F#)
keywords: visual f#, f#, functional programming
author: dend
manager: danielfe
ms.date: 05/16/2016
ms.topic: language-reference
ms.prod: visual-studio-dev14
ms.technology: devlang-fsharp
ms.assetid: a05dad36-eeed-41dc-8bf4-53390eb38b26
---
# Seq.iter<'T> Function (F#)
Applies the given function to each element of the collection.
**Namespace/Module Path:** Microsoft.FSharp.Collections.Seq
**Assembly:** FSharp.Core (in FSharp.Core.dll)
## Syntax
```fsharp
// Signature:
Seq.iter : ('T -> unit) -> seq<'T> -> unit
// Usage:
Seq.iter action source
```
#### Parameters
*action*
Type: **'T ->**[unit](https://msdn.microsoft.com/library/00b837c2-6c8a-483a-87d3-0479c64037a7)
A function to apply to each element of the sequence.
*source*
Type: [seq](https://msdn.microsoft.com/library/2f0c87c6-8a0d-4d33-92a6-10d1d037ce75)**<'T>**
The input sequence.
## Exceptions
|Exception|Condition|
|----|----|
|[ArgumentNullException](https://msdn.microsoft.com/library/system.argumentnullexception.aspx)|Thrown when the input sequence is null.|
## Remarks
This function is named `Iterate` in compiled assemblies. If you are accessing the function from a language other than F#, or through reflection, use this name.
## Examples
[!code-fsharp[Main](snippets/fssamples101/snippet1003.fs)]
```fsharp
Seq.iter: (1, 1) (2, 4) (3, 9) (4, 16) (5, 25)
```
The following example illustrates the use of `Seq.iter` to work with CSV (Comma-Separated Value) files.
[!code-fsharp[Main](snippets/fssamples101/snippet2003.fs)]
```
-------Enumeration 1------
line System.String[]
line System.String[]
-------Enumeration 2------
line has 8 entries
line has 7 entries
-------Enumeration 3------
lengths of entries: [|7; 0; 6; 0; 6; 5; 0; 1|]
lengths of entries: [|5; 0; 6; 0; 4; 0; 2|]
```
## Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
## Version Information
**F# Core Library Versions**
Supported in: 2.0, 4.0, Portable
## See Also
[Collections.Seq Module (F#)](Collections.Seq-Module-%5BFSharp%5D.md)
[Microsoft.FSharp.Collections Namespace (F#)](Microsoft.FSharp.Collections-Namespace-%5BFSharp%5D.md)
| {
"pile_set_name": "Github"
} |
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package terminal
import (
"io"
"testing"
)
type MockTerminal struct {
toSend []byte
bytesPerRead int
received []byte
}
func (c *MockTerminal) Read(data []byte) (n int, err error) {
n = len(data)
if n == 0 {
return
}
if n > len(c.toSend) {
n = len(c.toSend)
}
if n == 0 {
return 0, io.EOF
}
if c.bytesPerRead > 0 && n > c.bytesPerRead {
n = c.bytesPerRead
}
copy(data, c.toSend[:n])
c.toSend = c.toSend[n:]
return
}
func (c *MockTerminal) Write(data []byte) (n int, err error) {
c.received = append(c.received, data...)
return len(data), nil
}
func TestClose(t *testing.T) {
c := &MockTerminal{}
ss := NewTerminal(c, "> ")
line, err := ss.ReadLine()
if line != "" {
t.Errorf("Expected empty line but got: %s", line)
}
if err != io.EOF {
t.Errorf("Error should have been EOF but got: %s", err)
}
}
var keyPressTests = []struct {
in string
line string
err error
throwAwayLines int
}{
{
err: io.EOF,
},
{
in: "\r",
line: "",
},
{
in: "foo\r",
line: "foo",
},
{
in: "a\x1b[Cb\r", // right
line: "ab",
},
{
in: "a\x1b[Db\r", // left
line: "ba",
},
{
in: "a\177b\r", // backspace
line: "b",
},
{
in: "\x1b[A\r", // up
},
{
in: "\x1b[B\r", // down
},
{
in: "line\x1b[A\x1b[B\r", // up then down
line: "line",
},
{
in: "line1\rline2\x1b[A\r", // recall previous line.
line: "line1",
throwAwayLines: 1,
},
{
// recall two previous lines and append.
in: "line1\rline2\rline3\x1b[A\x1b[Axxx\r",
line: "line1xxx",
throwAwayLines: 2,
},
{
// Ctrl-A to move to beginning of line followed by ^K to kill
// line.
in: "a b \001\013\r",
line: "",
},
{
// Ctrl-A to move to beginning of line, Ctrl-E to move to end,
// finally ^K to kill nothing.
in: "a b \001\005\013\r",
line: "a b ",
},
{
in: "\027\r",
line: "",
},
{
in: "a\027\r",
line: "",
},
{
in: "a \027\r",
line: "",
},
{
in: "a b\027\r",
line: "a ",
},
{
in: "a b \027\r",
line: "a ",
},
{
in: "one two thr\x1b[D\027\r",
line: "one two r",
},
{
in: "\013\r",
line: "",
},
{
in: "a\013\r",
line: "a",
},
{
in: "ab\x1b[D\013\r",
line: "a",
},
{
in: "Ξεσκεπάζω\r",
line: "Ξεσκεπάζω",
},
{
in: "£\r\x1b[A\177\r", // non-ASCII char, enter, up, backspace.
line: "",
throwAwayLines: 1,
},
{
in: "£\r££\x1b[A\x1b[B\177\r", // non-ASCII char, enter, 2x non-ASCII, up, down, backspace, enter.
line: "£",
throwAwayLines: 1,
},
{
// Ctrl-D at the end of the line should be ignored.
in: "a\004\r",
line: "a",
},
{
// a, b, left, Ctrl-D should erase the b.
in: "ab\x1b[D\004\r",
line: "a",
},
{
// a, b, c, d, left, left, ^U should erase to the beginning of
// the line.
in: "abcd\x1b[D\x1b[D\025\r",
line: "cd",
},
{
// Bracketed paste mode: control sequences should be returned
// verbatim in paste mode.
in: "abc\x1b[200~de\177f\x1b[201~\177\r",
line: "abcde\177",
},
{
// Enter in bracketed paste mode should still work.
in: "abc\x1b[200~d\refg\x1b[201~h\r",
line: "efgh",
throwAwayLines: 1,
},
{
// Lines consisting entirely of pasted data should be indicated as such.
in: "\x1b[200~a\r",
line: "a",
err: ErrPasteIndicator,
},
}
func TestKeyPresses(t *testing.T) {
for i, test := range keyPressTests {
for j := 1; j < len(test.in); j++ {
c := &MockTerminal{
toSend: []byte(test.in),
bytesPerRead: j,
}
ss := NewTerminal(c, "> ")
for k := 0; k < test.throwAwayLines; k++ {
_, err := ss.ReadLine()
if err != nil {
t.Errorf("Throwaway line %d from test %d resulted in error: %s", k, i, err)
}
}
line, err := ss.ReadLine()
if line != test.line {
t.Errorf("Line resulting from test %d (%d bytes per read) was '%s', expected '%s'", i, j, line, test.line)
break
}
if err != test.err {
t.Errorf("Error resulting from test %d (%d bytes per read) was '%v', expected '%v'", i, j, err, test.err)
break
}
}
}
}
func TestPasswordNotSaved(t *testing.T) {
c := &MockTerminal{
toSend: []byte("password\r\x1b[A\r"),
bytesPerRead: 1,
}
ss := NewTerminal(c, "> ")
pw, _ := ss.ReadPassword("> ")
if pw != "password" {
t.Fatalf("failed to read password, got %s", pw)
}
line, _ := ss.ReadLine()
if len(line) > 0 {
t.Fatalf("password was saved in history")
}
}
var setSizeTests = []struct {
width, height int
}{
{40, 13},
{80, 24},
{132, 43},
}
func TestTerminalSetSize(t *testing.T) {
for _, setSize := range setSizeTests {
c := &MockTerminal{
toSend: []byte("password\r\x1b[A\r"),
bytesPerRead: 1,
}
ss := NewTerminal(c, "> ")
ss.SetSize(setSize.width, setSize.height)
pw, _ := ss.ReadPassword("Password: ")
if pw != "password" {
t.Fatalf("failed to read password, got %s", pw)
}
if string(c.received) != "Password: \r\n" {
t.Errorf("failed to set the temporary prompt expected %q, got %q", "Password: ", c.received)
}
}
}
| {
"pile_set_name": "Github"
} |
MODULE Char; (* SJ 26.11.94 *)
(*
Module Character implements some procedures on type CHAR.
*)
PROCEDURE Cap*(c: CHAR) : CHAR;
(*
Answer the capital letter of c. German "Umlaute" are capitalized
correctly.
*)
PROCEDURE IsVowel*(c: CHAR) : BOOLEAN;
(*
Answer TRUE if c is a vowel. German "Umlaute" are recognized as vowels.
*)
END Char. | {
"pile_set_name": "Github"
} |
var asciiWords = require('./_asciiWords'),
hasUnicodeWord = require('./_hasUnicodeWord'),
toString = require('./toString'),
unicodeWords = require('./_unicodeWords');
/**
* Splits `string` into an array of its words.
*
* @static
* @memberOf _
* @since 3.0.0
* @category String
* @param {string} [string=''] The string to inspect.
* @param {RegExp|string} [pattern] The pattern to match words.
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
* @returns {Array} Returns the words of `string`.
* @example
*
* _.words('fred, barney, & pebbles');
* // => ['fred', 'barney', 'pebbles']
*
* _.words('fred, barney, & pebbles', /[^, ]+/g);
* // => ['fred', 'barney', '&', 'pebbles']
*/
function words(string, pattern, guard) {
string = toString(string);
pattern = guard ? undefined : pattern;
if (pattern === undefined) {
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
}
return string.match(pattern) || [];
}
module.exports = words;
| {
"pile_set_name": "Github"
} |
/*----------------------------------------------------
Copyright 2017 Xilinx, 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.
----------------------------------------------------*/
#include <iostream>
#include <vector>
#include "xchange_structs.hpp"
typedef unsigned char uint8_t;
//# Just for display
const char* getLayerName(kernel_type_e type)
{
switch (type)
{
case CONV: return "Convolution";
case POOL: return "Pool";
case FC_LAYER: return "FC";
case SOFTMAX: return "SoftMax";
case DECONV: return "Deconv";
case NORM: return "Normalization";
case NMS: return "NMS";
case PERMUTE: return "Permute";
case CROP: return "Crop";
case XCUSTOM: return "Custom";
case XPACK: return "Pack";
}
return "Invalid Layer";
}
//# Method to display all the scalar parameters for a layer
void xChangeLayer::DisplayParams(void)
{
std::cout << std::endl;
std::cout << "Layer Type : " << getLayerName(this->kernType);// << std::endl;
std::cout << std::endl;
//# TODO: Some other prints can be added later
for(uint8_t idx = 0; idx < MAX_PARAM_SIZE; ++idx)
std::cout << ((int*)params)[idx] << " ";
std::cout << std::endl;
}
void xChangeLayer::DisplayParams(int layerIdx)
{
std::cout << "** Layer " << layerIdx << " : " << getLayerName(this->kernType) << std::endl;
// std::cout << "Previous layer id : " << previous[0].seqidx << std::endl;
//# TODO: Some other prints can be added later
for(uint8_t idx = 0; idx < MAX_PARAM_SIZE; ++idx)
std::cout << ((int*)params)[idx] << " ";
std::cout << std::endl << std::endl;
}
| {
"pile_set_name": "Github"
} |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Guide to Using Jupyter Notebooks\n",
"In this lecture we will be going over the basics of the Jupyter (previously called iPython Notebooks).\n",
"\n",
"For a complete User Manual check out the [Bryn Mawr College Computer Science Guide](https://jupyter.brynmawr.edu/services/public/dblank/Jupyter%20Notebook%20Users%20Manual.ipynb).\n",
"\n",
"Most of the breakdown will actually occur in the presentation corresponding to this Notebook. So please refer to either the presentation or the full User Manual linked above."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
| {
"pile_set_name": "Github"
} |
{
"accountLinkingWhitelistedDomains": null,
"asin": "B01N0QLKXF",
"averageRating": 5,
"canDisable": true,
"capabilities": null,
"category": null,
"description": "Trivia game asking questions about the TV show Land of the Lost. The game is played by asking 5 questions. Each correct answer is worth 1 point. The game will present 4 multiple choice answers. You answer the question by speaking the number of the correct answer. Then your the game will tell you if you got the correct answer and will tell you your current score.",
"enablement": null,
"exampleInteractions": [
"Alexa Open sleestak trivia",
"Alexa Ask sleestak trivia to begin new game",
"Alexa Ask sleestak trivia to start a game"
],
"firstReleaseDate": 1481807965.817,
"homepageLinkText": null,
"homepageLinkUrl": null,
"id": "amzn1.ask.skill.8c3fdcec-ceff-4b8e-8df9-c7c14549c943",
"imageAltText": "Unofficial Land of the Lost Trivia icon",
"imageUrl": "https://github.com/dale3h/alexa-skills-list/raw/master/skills/B01N0QLKXF/skill_icon",
"inAppPurchasingSupported": false,
"launchPhrase": "sleestak trivia",
"name": "Unofficial Land of the Lost Trivia",
"numberOfReviews": 1,
"pamsPartnerId": null,
"permissions": null,
"privacyPolicyUrl": null,
"shortDescription": "Unoffical Land Of The Lost Trivia - Test your knowledge of great TV.",
"skillTypes": null,
"stage": "live",
"termsOfUseUrl": null,
"vendorId": "M2AHY3URQ1ZWAL",
"vendorName": "Craig Fullen"
}
| {
"pile_set_name": "Github"
} |
/*
* *********************************************************************** *
* project: org.matsim.*
* *********************************************************************** *
* *
* copyright : (C) 2019 by the members listed in the COPYING, *
* LICENSE and WARRANTY file. *
* email : info at matsim dot org *
* *
* *********************************************************************** *
* *
* 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. *
* See also COPYING, LICENSE and WARRANTY file *
* *
* *********************************************************************** *
*/
package org.matsim.contrib.ev.infrastructure;
import java.util.Map;
import org.matsim.api.core.v01.Id;
/**
* A container of {@link ChargerSpecification}. Its lifespan covers all iterations.
* <p>
* It can be modified between iterations by add/replace/removeChargerSpecification().
* <p>
* The contained DvrpChargerSpecifications are (meant to be) immutable, so to modify them, use replaceVehicleSpecification()
*
* @author Michal Maciejewski (michalm)
*/
public interface ChargingInfrastructureSpecification {
Map<Id<Charger>, ChargerSpecification> getChargerSpecifications();
void addChargerSpecification(ChargerSpecification specification);
void replaceChargerSpecification(ChargerSpecification specification);
void removeChargerSpecification(Id<Charger> chargerId);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<imgdir name="0559.img">
<imgdir name="05590000">
<imgdir name="info">
<canvas name="icon" width="18" height="34">
<vector name="origin" x="-7" y="33"/>
<int name="z" value="0"/>
</canvas>
<canvas name="iconRaw" width="18" height="34">
<vector name="origin" x="-7" y="33"/>
<int name="z" value="0"/>
</canvas>
<int name="cash" value="1"/>
<int name="slotMax" value="1"/>
<int name="incLEV" value="5"/>
</imgdir>
</imgdir>
</imgdir>
| {
"pile_set_name": "Github"
} |
/* mpf_random2 -- Generate a positive random mpf_t of specified size, with
long runs of consecutive ones and zeros in the binary representation.
Intended for testing of other MP routines.
Copyright 1995, 1996, 2001-2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* 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.
or both in parallel, as here.
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
void
mpf_random2 (mpf_ptr x, mp_size_t xs, mp_exp_t exp)
{
mp_size_t xn;
mp_size_t prec;
mp_limb_t elimb;
xn = ABS (xs);
prec = PREC(x);
if (xn == 0)
{
EXP(x) = 0;
SIZ(x) = 0;
return;
}
if (xn > prec + 1)
xn = prec + 1;
/* General random mantissa. */
mpn_random2 (PTR(x), xn);
/* Generate random exponent. */
_gmp_rand (&elimb, RANDS, GMP_NUMB_BITS);
exp = ABS (exp);
exp = elimb % (2 * exp + 1) - exp;
EXP(x) = exp;
SIZ(x) = xs < 0 ? -xn : xn;
}
| {
"pile_set_name": "Github"
} |
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
int main(int, char**)
{
return 0;
}
| {
"pile_set_name": "Github"
} |
! @@name: affinity.5f
! @@type: F-fixed
! @@compilable: yes
! @@linkable: yes
! @@expect: success
PROGRAM EXAMPLE
!$OMP PARALLEL PROC_BIND(MASTER) NUM_THREADS(4)
CALL WORK()
!$OMP END PARALLEL
END PROGRAM EXAMPLE
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.